react-intlayer 5.0.2 → 5.0.4

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 (37) hide show
  1. package/dist/cjs/client/useDictionary.cjs +4 -1
  2. package/dist/cjs/client/useDictionary.cjs.map +1 -1
  3. package/dist/cjs/client/useIntlayer.cjs +1 -4
  4. package/dist/cjs/client/useIntlayer.cjs.map +1 -1
  5. package/dist/cjs/getDictionary.cjs.map +1 -1
  6. package/dist/cjs/index.cjs.map +1 -1
  7. package/dist/cjs/plugins.cjs.map +1 -1
  8. package/dist/cjs/server/useDictionary.cjs +1 -1
  9. package/dist/cjs/server/useDictionary.cjs.map +1 -1
  10. package/dist/cjs/server/useIntlayer.cjs +1 -1
  11. package/dist/cjs/server/useIntlayer.cjs.map +1 -1
  12. package/dist/esm/client/useDictionary.mjs +4 -1
  13. package/dist/esm/client/useDictionary.mjs.map +1 -1
  14. package/dist/esm/client/useIntlayer.mjs +1 -4
  15. package/dist/esm/client/useIntlayer.mjs.map +1 -1
  16. package/dist/esm/getDictionary.mjs.map +1 -1
  17. package/dist/esm/index.mjs.map +1 -1
  18. package/dist/esm/plugins.mjs.map +1 -1
  19. package/dist/esm/server/useDictionary.mjs +1 -1
  20. package/dist/esm/server/useDictionary.mjs.map +1 -1
  21. package/dist/esm/server/useIntlayer.mjs +1 -1
  22. package/dist/esm/server/useIntlayer.mjs.map +1 -1
  23. package/dist/types/client/useDictionary.d.ts +3 -3
  24. package/dist/types/client/useDictionary.d.ts.map +1 -1
  25. package/dist/types/client/useIntlayer.d.ts +3 -2
  26. package/dist/types/client/useIntlayer.d.ts.map +1 -1
  27. package/dist/types/getDictionary.d.ts +1 -1
  28. package/dist/types/getDictionary.d.ts.map +1 -1
  29. package/dist/types/index.d.ts +1 -1
  30. package/dist/types/index.d.ts.map +1 -1
  31. package/dist/types/plugins.d.ts +7 -7
  32. package/dist/types/plugins.d.ts.map +1 -1
  33. package/dist/types/server/useDictionary.d.ts +1 -1
  34. package/dist/types/server/useDictionary.d.ts.map +1 -1
  35. package/dist/types/server/useIntlayer.d.ts +1 -1
  36. package/dist/types/server/useIntlayer.d.ts.map +1 -1
  37. package/package.json +15 -15
@@ -28,7 +28,10 @@ var import_getDictionary = require('../getDictionary.cjs');
28
28
  const useDictionary = (dictionary, locale) => {
29
29
  const { locale: currentLocale } = (0, import_react.useContext)(import_IntlayerProvider.IntlayerClientContext);
30
30
  const localeTarget = locale ?? currentLocale;
31
- return (0, import_getDictionary.getDictionary)(dictionary, localeTarget);
31
+ return (0, import_getDictionary.getDictionary)(
32
+ dictionary,
33
+ localeTarget
34
+ );
32
35
  };
33
36
  // Annotate the CommonJS export names for ESM import in node:
34
37
  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 Dictionary } from '@intlayer/core';\nimport { useContext } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\nimport { getDictionary } from '../getDictionary';\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 = <T extends Dictionary>(\n dictionary: T,\n locale?: Locales\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext);\n const localeTarget = locale ?? currentLocale;\n\n return getDictionary(dictionary, localeTarget);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,mBAA2B;AAC3B,8BAAsC;AACtC,2BAA8B;AAOvB,MAAM,gBAAgB,CAC3B,YACA,WACG;AACH,QAAM,EAAE,QAAQ,cAAc,QAAI,yBAAW,6CAAqB;AAClE,QAAM,eAAe,UAAU;AAE/B,aAAO,oCAAc,YAAY,YAAY;AAC/C;","names":[]}
1
+ {"version":3,"sources":["../../../src/client/useDictionary.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n'use client';\n\nimport type { LocalesValues } from '@intlayer/config/client';\nimport { DeepTransformContent, type Dictionary } from '@intlayer/core';\nimport { useContext } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\nimport { getDictionary } from '../getDictionary';\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 = <T extends Dictionary>(\n dictionary: T,\n locale?: LocalesValues\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext);\n const localeTarget = locale ?? currentLocale;\n\n return getDictionary<T, LocalesValues>(\n dictionary,\n localeTarget\n ) as any as DeepTransformContent<T['content']>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,mBAA2B;AAC3B,8BAAsC;AACtC,2BAA8B;AAOvB,MAAM,gBAAgB,CAC3B,YACA,WACG;AACH,QAAM,EAAE,QAAQ,cAAc,QAAI,yBAAW,6CAAqB;AAClE,QAAM,eAAe,UAAU;AAE/B,aAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
@@ -32,10 +32,7 @@ const useIntlayer = (key, locale) => {
32
32
  const { changedContent } = (0, import_editor_react.useChangedContent)();
33
33
  const localeTarget = locale ?? currentLocale;
34
34
  if (changedContent?.[key]) {
35
- return (0, import_getDictionary.getDictionary)(
36
- changedContent?.[key],
37
- localeTarget
38
- );
35
+ return (0, import_getDictionary.getDictionary)(changedContent?.[key], localeTarget);
39
36
  }
40
37
  return (0, import_getIntlayer.getIntlayer)(key, localeTarget);
41
38
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/useIntlayer.ts"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport { useChangedContent } from '@intlayer/editor-react';\nimport { useContext } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\nimport { type DictionaryKeys } from '@intlayer/core';\nimport { getDictionary } from '../getDictionary';\nimport { getIntlayer } from '../getIntlayer';\n// @ts-ignore intlayer declared for module augmentation\nimport { IntlayerDictionaryTypesConnector } from 'intlayer';\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 = <T extends DictionaryKeys>(\n key: T,\n locale?: Locales\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext);\n const { changedContent } = useChangedContent();\n const localeTarget = locale ?? currentLocale;\n\n if (changedContent?.[key]) {\n return getDictionary(\n changedContent?.[key] as IntlayerDictionaryTypesConnector[T],\n localeTarget\n );\n }\n\n return getIntlayer(key, localeTarget);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAAkC;AAClC,mBAA2B;AAC3B,8BAAsC;AAEtC,2BAA8B;AAC9B,yBAA4B;AASrB,MAAM,cAAc,CACzB,KACA,WACG;AACH,QAAM,EAAE,QAAQ,cAAc,QAAI,yBAAW,6CAAqB;AAClE,QAAM,EAAE,eAAe,QAAI,uCAAkB;AAC7C,QAAM,eAAe,UAAU;AAE/B,MAAI,iBAAiB,GAAG,GAAG;AACzB,eAAO;AAAA,MACL,iBAAiB,GAAG;AAAA,MACpB;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAY,KAAK,YAAY;AACtC;","names":[]}
1
+ {"version":3,"sources":["../../../src/client/useIntlayer.ts"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport { useChangedContent } from '@intlayer/editor-react';\nimport { useContext } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\nimport type { DictionaryKeys } from '@intlayer/core';\nimport { getDictionary } from '../getDictionary';\nimport { getIntlayer } from '../getIntlayer';\n// @ts-ignore intlayer declared for module augmentation\nimport { IntlayerDictionaryTypesConnector } from 'intlayer';\nimport type { DeepTransformContent } from '../plugins';\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 = <T extends DictionaryKeys>(\n key: T,\n locale?: Locales\n): DeepTransformContent<IntlayerDictionaryTypesConnector[T]['content']> => {\n const { locale: currentLocale } = useContext(IntlayerClientContext);\n const { changedContent } = useChangedContent();\n const localeTarget = locale ?? currentLocale;\n\n if (changedContent?.[key]) {\n // @ts-ignore\n return getDictionary(changedContent?.[key], localeTarget);\n }\n\n return getIntlayer(key, localeTarget);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAAkC;AAClC,mBAA2B;AAC3B,8BAAsC;AAEtC,2BAA8B;AAC9B,yBAA4B;AAUrB,MAAM,cAAc,CACzB,KACA,WACyE;AACzE,QAAM,EAAE,QAAQ,cAAc,QAAI,yBAAW,6CAAqB;AAClE,QAAM,EAAE,eAAe,QAAI,uCAAkB;AAC7C,QAAM,eAAe,UAAU;AAE/B,MAAI,iBAAiB,GAAG,GAAG;AAEzB,eAAO,oCAAc,iBAAiB,GAAG,GAAG,YAAY;AAAA,EAC1D;AAEA,aAAO,gCAAY,KAAK,YAAY;AACtC;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/getDictionary.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport {\n type Dictionary,\n type Plugins,\n getDictionary as getDictionaryCore,\n} from '@intlayer/core';\nimport {\n type DeepTransformContent,\n intlayerNodePlugins,\n markdownPlugin,\n reactNodePlugins,\n} from './plugins';\nimport type { Locales, LocalesValues } from '@intlayer/config/client';\n\nexport const getDictionary = <\n T extends Dictionary<unknown, false>,\n L extends LocalesValues = Locales,\n>(\n dictionary: T,\n locale?: L,\n additionalPlugins?: Plugins[]\n) => {\n const plugins: Plugins[] = [\n intlayerNodePlugins,\n reactNodePlugins,\n markdownPlugin,\n ...(additionalPlugins ?? []),\n ];\n\n return getDictionaryCore(\n dictionary,\n locale,\n plugins\n ) as any as DeepTransformContent<T['content']>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAIO;AACP,qBAKO;AAGA,MAAM,gBAAgB,CAI3B,YACA,QACA,sBACG;AACH,QAAM,UAAqB;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAI,qBAAqB,CAAC;AAAA,EAC5B;AAEA,aAAO,YAAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["getDictionaryCore"]}
1
+ {"version":3,"sources":["../../src/getDictionary.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport {\n type Dictionary,\n type Plugins,\n getDictionary as getDictionaryCore,\n} from '@intlayer/core';\nimport {\n type DeepTransformContent,\n intlayerNodePlugins,\n markdownPlugin,\n reactNodePlugins,\n} from './plugins';\nimport type { Locales, LocalesValues } from '@intlayer/config/client';\n\nexport const getDictionary = <\n T extends Dictionary,\n L extends LocalesValues = Locales,\n>(\n dictionary: T,\n locale?: L,\n additionalPlugins?: Plugins[]\n) => {\n const plugins: Plugins[] = [\n intlayerNodePlugins,\n reactNodePlugins,\n markdownPlugin,\n ...(additionalPlugins ?? []),\n ];\n\n return getDictionaryCore(\n dictionary,\n locale,\n plugins\n ) as any as DeepTransformContent<T['content']>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAIO;AACP,qBAKO;AAGA,MAAM,gBAAgB,CAI3B,YACA,QACA,sBACG;AACH,QAAM,UAAqB;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAI,qBAAqB,CAAC;AAAA,EAC5B;AAEA,aAAO,YAAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["getDictionaryCore"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import { IInterpreterPluginReact } from './plugins';\n\ndeclare module '@intlayer/core' {\n interface IInterpreterPlugin<T, S> extends IInterpreterPluginReact<T, S> {}\n}\n\nexport {\n IntlayerProvider,\n IntlayerProviderContent,\n type IntlayerProviderProps,\n IntlayerClientContext,\n useIntlayer,\n useIntlayerAsync,\n useDictionary,\n useLocale,\n useLocaleCookie,\n useIntlayerContext,\n localeCookie,\n setLocaleCookie,\n getBrowserLocale,\n useLocaleBase,\n t,\n} from './client/index';\nexport { type IntlayerNode } from './IntlayerNode';\nexport { MarkdownProvider } from './markdown/index';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,oBAgBO;AAEP,sBAAiC;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import { IInterpreterPluginReact } from './plugins';\n\ndeclare module '@intlayer/core' {\n interface IInterpreterPlugin<T, S> extends IInterpreterPluginReact<T> {}\n}\n\nexport {\n IntlayerProvider,\n IntlayerProviderContent,\n type IntlayerProviderProps,\n IntlayerClientContext,\n useIntlayer,\n useIntlayerAsync,\n useDictionary,\n useLocale,\n useLocaleCookie,\n useIntlayerContext,\n localeCookie,\n setLocaleCookie,\n getBrowserLocale,\n useLocaleBase,\n t,\n} from './client/index';\nexport { type IntlayerNode } from './IntlayerNode';\nexport { MarkdownProvider } from './markdown/index';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,oBAgBO;AAEP,sBAAiC;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/plugins.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport {\n type Plugins,\n type IInterpreterPluginState as IInterpreterPluginStateCore,\n type DeepTransformContent as DeepTransformContentCore,\n type MarkdownContent,\n NodeType,\n} from '@intlayer/core';\nimport type { ReactNode } from 'react';\nimport { renderIntlayerEditor } from './editor';\nimport type { IntlayerNode } from './IntlayerNode';\nimport { renderMarkdown } from './markdown/renderMarkdown';\nimport { renderReactElement } from './reactElement/renderReactElement';\n\n/** ---------------------------------------------\n * INTLAYER NODE PLUGIN\n * --------------------------------------------- */\n\nexport type IntlayerNodeCond<T, _S> = T extends number | string\n ? IntlayerNode<T>\n : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const intlayerNodePlugins: Plugins = {\n canHandle: (node) =>\n typeof node === 'bigint' ||\n typeof node === 'string' ||\n typeof node === 'number',\n transform: (\n _node,\n {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n }\n ) => renderIntlayerEditor(rest),\n};\n\n/** ---------------------------------------------\n * REACT NODE PLUGIN\n * --------------------------------------------- */\n\nexport type ReactNodeCond<T, _S> = T extends {\n ref: any;\n props: any;\n key: any;\n}\n ? ReactNode\n : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const reactNodePlugins: Plugins = {\n canHandle: (node) =>\n typeof node === 'object' &&\n typeof node.ref !== 'undefined' &&\n typeof node.props !== 'undefined' &&\n typeof node.key !== 'undefined',\n\n transform: renderReactElement,\n};\n\n/**\n * MARKDOWN PLUGIN\n */\n\nexport type MarkdownCond<T, _S> = T extends {\n nodeType: NodeType | string;\n [NodeType.Markdown]: string;\n}\n ? IntlayerNode<string>\n : never;\n\n/** Markdown plugin. Replaces node with a function that takes quantity => string. */\nexport const markdownPlugin: Plugins = {\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Markdown,\n transform: (node: MarkdownContent) => renderMarkdown(node[NodeType.Markdown]),\n};\n\n/** ---------------------------------------------\n * PLUGINS RESULT\n * --------------------------------------------- */\n\nexport interface IInterpreterPluginReact<T, _S> {\n reactNode: ReactNodeCond<T, _S>;\n intlayerNode: IntlayerNodeCond<T, _S>;\n markdown: MarkdownCond<T, _S>;\n}\n\n/**\n * Insert this type as param of `DeepTransformContent` to avoid `intlayer` package pollution.\n *\n * Otherwise the the `react-intlayer` plugins will override the types of `intlayer` functions.\n */\nexport type IInterpreterPluginState = IInterpreterPluginStateCore & {\n reactNode: true;\n intlayerNode: true;\n markdown: true;\n};\n\nexport type DeepTransformContent<T> = DeepTransformContentCore<\n T,\n IInterpreterPluginState\n>;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAMO;AAEP,oBAAqC;AAErC,4BAA+B;AAC/B,gCAAmC;AAW5B,MAAM,sBAA+B;AAAA,EAC1C,WAAW,CAAC,SACV,OAAO,SAAS,YAChB,OAAO,SAAS,YAChB,OAAO,SAAS;AAAA,EAClB,WAAW,CACT,OACA;AAAA,IACE;AAAA;AAAA,IACA,GAAG;AAAA,EACL,UACG,oCAAqB,IAAI;AAChC;AAeO,MAAM,mBAA4B;AAAA,EACvC,WAAW,CAAC,SACV,OAAO,SAAS,YAChB,OAAO,KAAK,QAAQ,eACpB,OAAO,KAAK,UAAU,eACtB,OAAO,KAAK,QAAQ;AAAA,EAEtB,WAAW;AACb;AAcO,MAAM,iBAA0B;AAAA,EACrC,WAAW,CAAC,SACV,OAAO,SAAS,YAAY,MAAM,aAAa,qBAAS;AAAA,EAC1D,WAAW,CAAC,aAA0B,sCAAe,KAAK,qBAAS,QAAQ,CAAC;AAC9E;","names":[]}
1
+ {"version":3,"sources":["../../src/plugins.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/import/no-cycle */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport {\n type Plugins,\n type IInterpreterPluginState as IInterpreterPluginStateCore,\n type DeepTransformContent as DeepTransformContentCore,\n type MarkdownContent,\n NodeType,\n} from '@intlayer/core';\nimport type { ReactNode } from 'react';\nimport { renderIntlayerEditor } from './editor';\nimport type { IntlayerNode } from './IntlayerNode';\nimport { renderMarkdown } from './markdown/renderMarkdown';\nimport { renderReactElement } from './reactElement/renderReactElement';\n\n/** ---------------------------------------------\n * INTLAYER NODE PLUGIN\n * --------------------------------------------- */\n\nexport type IntlayerNodeCond<T> = T extends number | string\n ? IntlayerNode<T>\n : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const intlayerNodePlugins: Plugins = {\n canHandle: (node) =>\n typeof node === 'bigint' ||\n typeof node === 'string' ||\n typeof node === 'number',\n transform: (\n _node,\n {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n }\n ) => renderIntlayerEditor(rest),\n};\n\n/** ---------------------------------------------\n * REACT NODE PLUGIN\n * --------------------------------------------- */\n\nexport type ReactNodeCond<T> = T extends {\n ref: any;\n props: any;\n key: any;\n}\n ? ReactNode\n : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const reactNodePlugins: Plugins = {\n canHandle: (node) =>\n typeof node === 'object' &&\n typeof node.ref !== 'undefined' &&\n typeof node.props !== 'undefined' &&\n typeof node.key !== 'undefined',\n\n transform: renderReactElement,\n};\n\n/**\n * MARKDOWN PLUGIN\n */\n\nexport type MarkdownCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeType.Markdown]: string;\n}\n ? IntlayerNode<string>\n : never;\n\n/** Markdown plugin. Replaces node with a function that takes quantity => string. */\nexport const markdownPlugin: Plugins = {\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Markdown,\n transform: (node: MarkdownContent) => renderMarkdown(node[NodeType.Markdown]),\n};\n\n/** ---------------------------------------------\n * PLUGINS RESULT\n * --------------------------------------------- */\n\nexport interface IInterpreterPluginReact<T> {\n reactNode: ReactNodeCond<T>;\n intlayerNode: IntlayerNodeCond<T>;\n markdown: MarkdownCond<T>;\n}\n\n/**\n * Insert this type as param of `DeepTransformContent` to avoid `intlayer` package pollution.\n *\n * Otherwise the the `react-intlayer` plugins will override the types of `intlayer` functions.\n */\nexport type IInterpreterPluginState = IInterpreterPluginStateCore & {\n reactNode: true;\n intlayerNode: true;\n markdown: true;\n};\n\nexport type DeepTransformContent<T> = DeepTransformContentCore<\n T,\n IInterpreterPluginState\n>;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAMO;AAEP,oBAAqC;AAErC,4BAA+B;AAC/B,gCAAmC;AAW5B,MAAM,sBAA+B;AAAA,EAC1C,WAAW,CAAC,SACV,OAAO,SAAS,YAChB,OAAO,SAAS,YAChB,OAAO,SAAS;AAAA,EAClB,WAAW,CACT,OACA;AAAA,IACE;AAAA;AAAA,IACA,GAAG;AAAA,EACL,UACG,oCAAqB,IAAI;AAChC;AAeO,MAAM,mBAA4B;AAAA,EACvC,WAAW,CAAC,SACV,OAAO,SAAS,YAChB,OAAO,KAAK,QAAQ,eACpB,OAAO,KAAK,UAAU,eACtB,OAAO,KAAK,QAAQ;AAAA,EAEtB,WAAW;AACb;AAcO,MAAM,iBAA0B;AAAA,EACrC,WAAW,CAAC,SACV,OAAO,SAAS,YAAY,MAAM,aAAa,qBAAS;AAAA,EAC1D,WAAW,CAAC,aAA0B,sCAAe,KAAK,qBAAS,QAAQ,CAAC;AAC9E;","names":[]}
@@ -24,7 +24,7 @@ module.exports = __toCommonJS(useDictionary_exports);
24
24
  var import_IntlayerServerProvider = require('./IntlayerServerProvider.cjs');
25
25
  var import_serverContext = require('./serverContext.cjs');
26
26
  var import_getDictionary = require('../getDictionary.cjs');
27
- const useDictionary = (dictionary, locale, isRenderEditor = false) => {
27
+ const useDictionary = (dictionary, locale) => {
28
28
  const localeTarget = locale ?? (0, import_serverContext.getServerContext)(import_IntlayerServerProvider.IntlayerServerContext);
29
29
  return (0, import_getDictionary.getDictionary)(dictionary, localeTarget);
30
30
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/server/useDictionary.ts"],"sourcesContent":["import type { LocalesValues } from '@intlayer/config/client';\nimport { type Dictionary } from '@intlayer/core';\nimport { IntlayerServerContext } from './IntlayerServerProvider';\nimport { getServerContext } from './serverContext';\nimport { getDictionary } from '../getDictionary';\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 server context\n */\nexport const useDictionary = <T extends Dictionary>(\n dictionary: T,\n locale?: LocalesValues,\n isRenderEditor = false\n) => {\n const localeTarget =\n locale ?? getServerContext<LocalesValues>(IntlayerServerContext);\n\n return getDictionary(dictionary, localeTarget);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oCAAsC;AACtC,2BAAiC;AACjC,2BAA8B;AAOvB,MAAM,gBAAgB,CAC3B,YACA,QACA,iBAAiB,UACd;AACH,QAAM,eACJ,cAAU,uCAAgC,mDAAqB;AAEjE,aAAO,oCAAc,YAAY,YAAY;AAC/C;","names":[]}
1
+ {"version":3,"sources":["../../../src/server/useDictionary.ts"],"sourcesContent":["import type { LocalesValues } from '@intlayer/config/client';\nimport { type Dictionary } from '@intlayer/core';\nimport { IntlayerServerContext } from './IntlayerServerProvider';\nimport { getServerContext } from './serverContext';\nimport { getDictionary } from '../getDictionary';\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 server context\n */\nexport const useDictionary = <T extends Dictionary>(\n dictionary: T,\n locale?: LocalesValues\n) => {\n const localeTarget =\n locale ?? getServerContext<LocalesValues>(IntlayerServerContext);\n\n return getDictionary<T, LocalesValues>(dictionary, localeTarget);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oCAAsC;AACtC,2BAAiC;AACjC,2BAA8B;AAOvB,MAAM,gBAAgB,CAC3B,YACA,WACG;AACH,QAAM,eACJ,cAAU,uCAAgC,mDAAqB;AAEjE,aAAO,oCAAgC,YAAY,YAAY;AACjE;","names":[]}
@@ -24,7 +24,7 @@ module.exports = __toCommonJS(useIntlayer_exports);
24
24
  var import_IntlayerServerProvider = require('./IntlayerServerProvider.cjs');
25
25
  var import_serverContext = require('./serverContext.cjs');
26
26
  var import_getIntlayer = require('../getIntlayer.cjs');
27
- const useIntlayer = (key, locale, isRenderEditor = true) => {
27
+ const useIntlayer = (key, locale) => {
28
28
  const localeTarget = locale ?? (0, import_serverContext.getServerContext)(import_IntlayerServerProvider.IntlayerServerContext);
29
29
  return (0, import_getIntlayer.getIntlayer)(key, localeTarget);
30
30
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/server/useIntlayer.ts"],"sourcesContent":["import type { LocalesValues } from '@intlayer/config/client';\nimport { IntlayerServerContext } from './IntlayerServerProvider';\nimport { getServerContext } from './serverContext';\nimport { type DictionaryKeys } from '@intlayer/core';\nimport { getIntlayer } from '../getIntlayer';\n\n/**\n * On the server 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 server context\n */\nexport const useIntlayer = <T extends DictionaryKeys, K extends LocalesValues>(\n key: T,\n locale?: K,\n isRenderEditor = true\n) => {\n const localeTarget =\n locale ?? getServerContext<LocalesValues>(IntlayerServerContext);\n\n return getIntlayer(key, localeTarget);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oCAAsC;AACtC,2BAAiC;AAEjC,yBAA4B;AAOrB,MAAM,cAAc,CACzB,KACA,QACA,iBAAiB,SACd;AACH,QAAM,eACJ,cAAU,uCAAgC,mDAAqB;AAEjE,aAAO,gCAAY,KAAK,YAAY;AACtC;","names":[]}
1
+ {"version":3,"sources":["../../../src/server/useIntlayer.ts"],"sourcesContent":["import type { LocalesValues } from '@intlayer/config/client';\nimport { IntlayerServerContext } from './IntlayerServerProvider';\nimport { getServerContext } from './serverContext';\nimport { type DictionaryKeys } from '@intlayer/core';\nimport { getIntlayer } from '../getIntlayer';\n\n/**\n * On the server 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 server context\n */\nexport const useIntlayer = <T extends DictionaryKeys, K extends LocalesValues>(\n key: T,\n locale?: K\n) => {\n const localeTarget =\n locale ?? getServerContext<LocalesValues>(IntlayerServerContext);\n\n return getIntlayer(key, localeTarget);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oCAAsC;AACtC,2BAAiC;AAEjC,yBAA4B;AAOrB,MAAM,cAAc,CACzB,KACA,WACG;AACH,QAAM,eACJ,cAAU,uCAAgC,mDAAqB;AAEjE,aAAO,gCAAY,KAAK,YAAY;AACtC;","names":[]}
@@ -5,7 +5,10 @@ import { getDictionary } from "../getDictionary.mjs";
5
5
  const useDictionary = (dictionary, locale) => {
6
6
  const { locale: currentLocale } = useContext(IntlayerClientContext);
7
7
  const localeTarget = locale ?? currentLocale;
8
- return getDictionary(dictionary, localeTarget);
8
+ return getDictionary(
9
+ dictionary,
10
+ localeTarget
11
+ );
9
12
  };
10
13
  export {
11
14
  useDictionary
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/useDictionary.ts"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport { type Dictionary } from '@intlayer/core';\nimport { useContext } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\nimport { getDictionary } from '../getDictionary';\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 = <T extends Dictionary>(\n dictionary: T,\n locale?: Locales\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext);\n const localeTarget = locale ?? currentLocale;\n\n return getDictionary(dictionary, localeTarget);\n};\n"],"mappings":";AAIA,SAAS,kBAAkB;AAC3B,SAAS,6BAA6B;AACtC,SAAS,qBAAqB;AAOvB,MAAM,gBAAgB,CAC3B,YACA,WACG;AACH,QAAM,EAAE,QAAQ,cAAc,IAAI,WAAW,qBAAqB;AAClE,QAAM,eAAe,UAAU;AAE/B,SAAO,cAAc,YAAY,YAAY;AAC/C;","names":[]}
1
+ {"version":3,"sources":["../../../src/client/useDictionary.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n'use client';\n\nimport type { LocalesValues } from '@intlayer/config/client';\nimport { DeepTransformContent, type Dictionary } from '@intlayer/core';\nimport { useContext } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\nimport { getDictionary } from '../getDictionary';\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 = <T extends Dictionary>(\n dictionary: T,\n locale?: LocalesValues\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext);\n const localeTarget = locale ?? currentLocale;\n\n return getDictionary<T, LocalesValues>(\n dictionary,\n localeTarget\n ) as any as DeepTransformContent<T['content']>;\n};\n"],"mappings":";AAKA,SAAS,kBAAkB;AAC3B,SAAS,6BAA6B;AACtC,SAAS,qBAAqB;AAOvB,MAAM,gBAAgB,CAC3B,YACA,WACG;AACH,QAAM,EAAE,QAAQ,cAAc,IAAI,WAAW,qBAAqB;AAClE,QAAM,eAAe,UAAU;AAE/B,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
@@ -9,10 +9,7 @@ const useIntlayer = (key, locale) => {
9
9
  const { changedContent } = useChangedContent();
10
10
  const localeTarget = locale ?? currentLocale;
11
11
  if (changedContent?.[key]) {
12
- return getDictionary(
13
- changedContent?.[key],
14
- localeTarget
15
- );
12
+ return getDictionary(changedContent?.[key], localeTarget);
16
13
  }
17
14
  return getIntlayer(key, localeTarget);
18
15
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/useIntlayer.ts"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport { useChangedContent } from '@intlayer/editor-react';\nimport { useContext } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\nimport { type DictionaryKeys } from '@intlayer/core';\nimport { getDictionary } from '../getDictionary';\nimport { getIntlayer } from '../getIntlayer';\n// @ts-ignore intlayer declared for module augmentation\nimport { IntlayerDictionaryTypesConnector } from 'intlayer';\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 = <T extends DictionaryKeys>(\n key: T,\n locale?: Locales\n) => {\n const { locale: currentLocale } = useContext(IntlayerClientContext);\n const { changedContent } = useChangedContent();\n const localeTarget = locale ?? currentLocale;\n\n if (changedContent?.[key]) {\n return getDictionary(\n changedContent?.[key] as IntlayerDictionaryTypesConnector[T],\n localeTarget\n );\n }\n\n return getIntlayer(key, localeTarget);\n};\n"],"mappings":";AAGA,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAC3B,SAAS,6BAA6B;AAEtC,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;AASrB,MAAM,cAAc,CACzB,KACA,WACG;AACH,QAAM,EAAE,QAAQ,cAAc,IAAI,WAAW,qBAAqB;AAClE,QAAM,EAAE,eAAe,IAAI,kBAAkB;AAC7C,QAAM,eAAe,UAAU;AAE/B,MAAI,iBAAiB,GAAG,GAAG;AACzB,WAAO;AAAA,MACL,iBAAiB,GAAG;AAAA,MACpB;AAAA,IACF;AAAA,EACF;AAEA,SAAO,YAAY,KAAK,YAAY;AACtC;","names":[]}
1
+ {"version":3,"sources":["../../../src/client/useIntlayer.ts"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport { useChangedContent } from '@intlayer/editor-react';\nimport { useContext } from 'react';\nimport { IntlayerClientContext } from './IntlayerProvider';\nimport type { DictionaryKeys } from '@intlayer/core';\nimport { getDictionary } from '../getDictionary';\nimport { getIntlayer } from '../getIntlayer';\n// @ts-ignore intlayer declared for module augmentation\nimport { IntlayerDictionaryTypesConnector } from 'intlayer';\nimport type { DeepTransformContent } from '../plugins';\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 = <T extends DictionaryKeys>(\n key: T,\n locale?: Locales\n): DeepTransformContent<IntlayerDictionaryTypesConnector[T]['content']> => {\n const { locale: currentLocale } = useContext(IntlayerClientContext);\n const { changedContent } = useChangedContent();\n const localeTarget = locale ?? currentLocale;\n\n if (changedContent?.[key]) {\n // @ts-ignore\n return getDictionary(changedContent?.[key], localeTarget);\n }\n\n return getIntlayer(key, localeTarget);\n};\n"],"mappings":";AAGA,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAC3B,SAAS,6BAA6B;AAEtC,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;AAUrB,MAAM,cAAc,CACzB,KACA,WACyE;AACzE,QAAM,EAAE,QAAQ,cAAc,IAAI,WAAW,qBAAqB;AAClE,QAAM,EAAE,eAAe,IAAI,kBAAkB;AAC7C,QAAM,eAAe,UAAU;AAE/B,MAAI,iBAAiB,GAAG,GAAG;AAEzB,WAAO,cAAc,iBAAiB,GAAG,GAAG,YAAY;AAAA,EAC1D;AAEA,SAAO,YAAY,KAAK,YAAY;AACtC;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/getDictionary.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport {\n type Dictionary,\n type Plugins,\n getDictionary as getDictionaryCore,\n} from '@intlayer/core';\nimport {\n type DeepTransformContent,\n intlayerNodePlugins,\n markdownPlugin,\n reactNodePlugins,\n} from './plugins';\nimport type { Locales, LocalesValues } from '@intlayer/config/client';\n\nexport const getDictionary = <\n T extends Dictionary<unknown, false>,\n L extends LocalesValues = Locales,\n>(\n dictionary: T,\n locale?: L,\n additionalPlugins?: Plugins[]\n) => {\n const plugins: Plugins[] = [\n intlayerNodePlugins,\n reactNodePlugins,\n markdownPlugin,\n ...(additionalPlugins ?? []),\n ];\n\n return getDictionaryCore(\n dictionary,\n locale,\n plugins\n ) as any as DeepTransformContent<T['content']>;\n};\n"],"mappings":"AACA;AAAA,EAGE,iBAAiB;AAAA,OACZ;AACP;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGA,MAAM,gBAAgB,CAI3B,YACA,QACA,sBACG;AACH,QAAM,UAAqB;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAI,qBAAqB,CAAC;AAAA,EAC5B;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/getDictionary.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport {\n type Dictionary,\n type Plugins,\n getDictionary as getDictionaryCore,\n} from '@intlayer/core';\nimport {\n type DeepTransformContent,\n intlayerNodePlugins,\n markdownPlugin,\n reactNodePlugins,\n} from './plugins';\nimport type { Locales, LocalesValues } from '@intlayer/config/client';\n\nexport const getDictionary = <\n T extends Dictionary,\n L extends LocalesValues = Locales,\n>(\n dictionary: T,\n locale?: L,\n additionalPlugins?: Plugins[]\n) => {\n const plugins: Plugins[] = [\n intlayerNodePlugins,\n reactNodePlugins,\n markdownPlugin,\n ...(additionalPlugins ?? []),\n ];\n\n return getDictionaryCore(\n dictionary,\n locale,\n plugins\n ) as any as DeepTransformContent<T['content']>;\n};\n"],"mappings":"AACA;AAAA,EAGE,iBAAiB;AAAA,OACZ;AACP;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGA,MAAM,gBAAgB,CAI3B,YACA,QACA,sBACG;AACH,QAAM,UAAqB;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAI,qBAAqB,CAAC;AAAA,EAC5B;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import { IInterpreterPluginReact } from './plugins';\n\ndeclare module '@intlayer/core' {\n interface IInterpreterPlugin<T, S> extends IInterpreterPluginReact<T, S> {}\n}\n\nexport {\n IntlayerProvider,\n IntlayerProviderContent,\n type IntlayerProviderProps,\n IntlayerClientContext,\n useIntlayer,\n useIntlayerAsync,\n useDictionary,\n useLocale,\n useLocaleCookie,\n useIntlayerContext,\n localeCookie,\n setLocaleCookie,\n getBrowserLocale,\n useLocaleBase,\n t,\n} from './client/index';\nexport { type IntlayerNode } from './IntlayerNode';\nexport { MarkdownProvider } from './markdown/index';\n"],"mappings":"AAMA;AAAA,EACE;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,wBAAwB;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import { IInterpreterPluginReact } from './plugins';\n\ndeclare module '@intlayer/core' {\n interface IInterpreterPlugin<T, S> extends IInterpreterPluginReact<T> {}\n}\n\nexport {\n IntlayerProvider,\n IntlayerProviderContent,\n type IntlayerProviderProps,\n IntlayerClientContext,\n useIntlayer,\n useIntlayerAsync,\n useDictionary,\n useLocale,\n useLocaleCookie,\n useIntlayerContext,\n localeCookie,\n setLocaleCookie,\n getBrowserLocale,\n useLocaleBase,\n t,\n} from './client/index';\nexport { type IntlayerNode } from './IntlayerNode';\nexport { MarkdownProvider } from './markdown/index';\n"],"mappings":"AAMA;AAAA,EACE;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,wBAAwB;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/plugins.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport {\n type Plugins,\n type IInterpreterPluginState as IInterpreterPluginStateCore,\n type DeepTransformContent as DeepTransformContentCore,\n type MarkdownContent,\n NodeType,\n} from '@intlayer/core';\nimport type { ReactNode } from 'react';\nimport { renderIntlayerEditor } from './editor';\nimport type { IntlayerNode } from './IntlayerNode';\nimport { renderMarkdown } from './markdown/renderMarkdown';\nimport { renderReactElement } from './reactElement/renderReactElement';\n\n/** ---------------------------------------------\n * INTLAYER NODE PLUGIN\n * --------------------------------------------- */\n\nexport type IntlayerNodeCond<T, _S> = T extends number | string\n ? IntlayerNode<T>\n : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const intlayerNodePlugins: Plugins = {\n canHandle: (node) =>\n typeof node === 'bigint' ||\n typeof node === 'string' ||\n typeof node === 'number',\n transform: (\n _node,\n {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n }\n ) => renderIntlayerEditor(rest),\n};\n\n/** ---------------------------------------------\n * REACT NODE PLUGIN\n * --------------------------------------------- */\n\nexport type ReactNodeCond<T, _S> = T extends {\n ref: any;\n props: any;\n key: any;\n}\n ? ReactNode\n : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const reactNodePlugins: Plugins = {\n canHandle: (node) =>\n typeof node === 'object' &&\n typeof node.ref !== 'undefined' &&\n typeof node.props !== 'undefined' &&\n typeof node.key !== 'undefined',\n\n transform: renderReactElement,\n};\n\n/**\n * MARKDOWN PLUGIN\n */\n\nexport type MarkdownCond<T, _S> = T extends {\n nodeType: NodeType | string;\n [NodeType.Markdown]: string;\n}\n ? IntlayerNode<string>\n : never;\n\n/** Markdown plugin. Replaces node with a function that takes quantity => string. */\nexport const markdownPlugin: Plugins = {\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Markdown,\n transform: (node: MarkdownContent) => renderMarkdown(node[NodeType.Markdown]),\n};\n\n/** ---------------------------------------------\n * PLUGINS RESULT\n * --------------------------------------------- */\n\nexport interface IInterpreterPluginReact<T, _S> {\n reactNode: ReactNodeCond<T, _S>;\n intlayerNode: IntlayerNodeCond<T, _S>;\n markdown: MarkdownCond<T, _S>;\n}\n\n/**\n * Insert this type as param of `DeepTransformContent` to avoid `intlayer` package pollution.\n *\n * Otherwise the the `react-intlayer` plugins will override the types of `intlayer` functions.\n */\nexport type IInterpreterPluginState = IInterpreterPluginStateCore & {\n reactNode: true;\n intlayerNode: true;\n markdown: true;\n};\n\nexport type DeepTransformContent<T> = DeepTransformContentCore<\n T,\n IInterpreterPluginState\n>;\n"],"mappings":"AACA;AAAA,EAKE;AAAA,OACK;AAEP,SAAS,4BAA4B;AAErC,SAAS,sBAAsB;AAC/B,SAAS,0BAA0B;AAW5B,MAAM,sBAA+B;AAAA,EAC1C,WAAW,CAAC,SACV,OAAO,SAAS,YAChB,OAAO,SAAS,YAChB,OAAO,SAAS;AAAA,EAClB,WAAW,CACT,OACA;AAAA,IACE;AAAA;AAAA,IACA,GAAG;AAAA,EACL,MACG,qBAAqB,IAAI;AAChC;AAeO,MAAM,mBAA4B;AAAA,EACvC,WAAW,CAAC,SACV,OAAO,SAAS,YAChB,OAAO,KAAK,QAAQ,eACpB,OAAO,KAAK,UAAU,eACtB,OAAO,KAAK,QAAQ;AAAA,EAEtB,WAAW;AACb;AAcO,MAAM,iBAA0B;AAAA,EACrC,WAAW,CAAC,SACV,OAAO,SAAS,YAAY,MAAM,aAAa,SAAS;AAAA,EAC1D,WAAW,CAAC,SAA0B,eAAe,KAAK,SAAS,QAAQ,CAAC;AAC9E;","names":[]}
1
+ {"version":3,"sources":["../../src/plugins.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/import/no-cycle */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport {\n type Plugins,\n type IInterpreterPluginState as IInterpreterPluginStateCore,\n type DeepTransformContent as DeepTransformContentCore,\n type MarkdownContent,\n NodeType,\n} from '@intlayer/core';\nimport type { ReactNode } from 'react';\nimport { renderIntlayerEditor } from './editor';\nimport type { IntlayerNode } from './IntlayerNode';\nimport { renderMarkdown } from './markdown/renderMarkdown';\nimport { renderReactElement } from './reactElement/renderReactElement';\n\n/** ---------------------------------------------\n * INTLAYER NODE PLUGIN\n * --------------------------------------------- */\n\nexport type IntlayerNodeCond<T> = T extends number | string\n ? IntlayerNode<T>\n : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const intlayerNodePlugins: Plugins = {\n canHandle: (node) =>\n typeof node === 'bigint' ||\n typeof node === 'string' ||\n typeof node === 'number',\n transform: (\n _node,\n {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n }\n ) => renderIntlayerEditor(rest),\n};\n\n/** ---------------------------------------------\n * REACT NODE PLUGIN\n * --------------------------------------------- */\n\nexport type ReactNodeCond<T> = T extends {\n ref: any;\n props: any;\n key: any;\n}\n ? ReactNode\n : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const reactNodePlugins: Plugins = {\n canHandle: (node) =>\n typeof node === 'object' &&\n typeof node.ref !== 'undefined' &&\n typeof node.props !== 'undefined' &&\n typeof node.key !== 'undefined',\n\n transform: renderReactElement,\n};\n\n/**\n * MARKDOWN PLUGIN\n */\n\nexport type MarkdownCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeType.Markdown]: string;\n}\n ? IntlayerNode<string>\n : never;\n\n/** Markdown plugin. Replaces node with a function that takes quantity => string. */\nexport const markdownPlugin: Plugins = {\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Markdown,\n transform: (node: MarkdownContent) => renderMarkdown(node[NodeType.Markdown]),\n};\n\n/** ---------------------------------------------\n * PLUGINS RESULT\n * --------------------------------------------- */\n\nexport interface IInterpreterPluginReact<T> {\n reactNode: ReactNodeCond<T>;\n intlayerNode: IntlayerNodeCond<T>;\n markdown: MarkdownCond<T>;\n}\n\n/**\n * Insert this type as param of `DeepTransformContent` to avoid `intlayer` package pollution.\n *\n * Otherwise the the `react-intlayer` plugins will override the types of `intlayer` functions.\n */\nexport type IInterpreterPluginState = IInterpreterPluginStateCore & {\n reactNode: true;\n intlayerNode: true;\n markdown: true;\n};\n\nexport type DeepTransformContent<T> = DeepTransformContentCore<\n T,\n IInterpreterPluginState\n>;\n"],"mappings":"AAEA;AAAA,EAKE;AAAA,OACK;AAEP,SAAS,4BAA4B;AAErC,SAAS,sBAAsB;AAC/B,SAAS,0BAA0B;AAW5B,MAAM,sBAA+B;AAAA,EAC1C,WAAW,CAAC,SACV,OAAO,SAAS,YAChB,OAAO,SAAS,YAChB,OAAO,SAAS;AAAA,EAClB,WAAW,CACT,OACA;AAAA,IACE;AAAA;AAAA,IACA,GAAG;AAAA,EACL,MACG,qBAAqB,IAAI;AAChC;AAeO,MAAM,mBAA4B;AAAA,EACvC,WAAW,CAAC,SACV,OAAO,SAAS,YAChB,OAAO,KAAK,QAAQ,eACpB,OAAO,KAAK,UAAU,eACtB,OAAO,KAAK,QAAQ;AAAA,EAEtB,WAAW;AACb;AAcO,MAAM,iBAA0B;AAAA,EACrC,WAAW,CAAC,SACV,OAAO,SAAS,YAAY,MAAM,aAAa,SAAS;AAAA,EAC1D,WAAW,CAAC,SAA0B,eAAe,KAAK,SAAS,QAAQ,CAAC;AAC9E;","names":[]}
@@ -1,7 +1,7 @@
1
1
  import { IntlayerServerContext } from "./IntlayerServerProvider.mjs";
2
2
  import { getServerContext } from "./serverContext.mjs";
3
3
  import { getDictionary } from "../getDictionary.mjs";
4
- const useDictionary = (dictionary, locale, isRenderEditor = false) => {
4
+ const useDictionary = (dictionary, locale) => {
5
5
  const localeTarget = locale ?? getServerContext(IntlayerServerContext);
6
6
  return getDictionary(dictionary, localeTarget);
7
7
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/server/useDictionary.ts"],"sourcesContent":["import type { LocalesValues } from '@intlayer/config/client';\nimport { type Dictionary } from '@intlayer/core';\nimport { IntlayerServerContext } from './IntlayerServerProvider';\nimport { getServerContext } from './serverContext';\nimport { getDictionary } from '../getDictionary';\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 server context\n */\nexport const useDictionary = <T extends Dictionary>(\n dictionary: T,\n locale?: LocalesValues,\n isRenderEditor = false\n) => {\n const localeTarget =\n locale ?? getServerContext<LocalesValues>(IntlayerServerContext);\n\n return getDictionary(dictionary, localeTarget);\n};\n"],"mappings":"AAEA,SAAS,6BAA6B;AACtC,SAAS,wBAAwB;AACjC,SAAS,qBAAqB;AAOvB,MAAM,gBAAgB,CAC3B,YACA,QACA,iBAAiB,UACd;AACH,QAAM,eACJ,UAAU,iBAAgC,qBAAqB;AAEjE,SAAO,cAAc,YAAY,YAAY;AAC/C;","names":[]}
1
+ {"version":3,"sources":["../../../src/server/useDictionary.ts"],"sourcesContent":["import type { LocalesValues } from '@intlayer/config/client';\nimport { type Dictionary } from '@intlayer/core';\nimport { IntlayerServerContext } from './IntlayerServerProvider';\nimport { getServerContext } from './serverContext';\nimport { getDictionary } from '../getDictionary';\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 server context\n */\nexport const useDictionary = <T extends Dictionary>(\n dictionary: T,\n locale?: LocalesValues\n) => {\n const localeTarget =\n locale ?? getServerContext<LocalesValues>(IntlayerServerContext);\n\n return getDictionary<T, LocalesValues>(dictionary, localeTarget);\n};\n"],"mappings":"AAEA,SAAS,6BAA6B;AACtC,SAAS,wBAAwB;AACjC,SAAS,qBAAqB;AAOvB,MAAM,gBAAgB,CAC3B,YACA,WACG;AACH,QAAM,eACJ,UAAU,iBAAgC,qBAAqB;AAEjE,SAAO,cAAgC,YAAY,YAAY;AACjE;","names":[]}
@@ -1,7 +1,7 @@
1
1
  import { IntlayerServerContext } from "./IntlayerServerProvider.mjs";
2
2
  import { getServerContext } from "./serverContext.mjs";
3
3
  import { getIntlayer } from "../getIntlayer.mjs";
4
- const useIntlayer = (key, locale, isRenderEditor = true) => {
4
+ const useIntlayer = (key, locale) => {
5
5
  const localeTarget = locale ?? getServerContext(IntlayerServerContext);
6
6
  return getIntlayer(key, localeTarget);
7
7
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/server/useIntlayer.ts"],"sourcesContent":["import type { LocalesValues } from '@intlayer/config/client';\nimport { IntlayerServerContext } from './IntlayerServerProvider';\nimport { getServerContext } from './serverContext';\nimport { type DictionaryKeys } from '@intlayer/core';\nimport { getIntlayer } from '../getIntlayer';\n\n/**\n * On the server 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 server context\n */\nexport const useIntlayer = <T extends DictionaryKeys, K extends LocalesValues>(\n key: T,\n locale?: K,\n isRenderEditor = true\n) => {\n const localeTarget =\n locale ?? getServerContext<LocalesValues>(IntlayerServerContext);\n\n return getIntlayer(key, localeTarget);\n};\n"],"mappings":"AACA,SAAS,6BAA6B;AACtC,SAAS,wBAAwB;AAEjC,SAAS,mBAAmB;AAOrB,MAAM,cAAc,CACzB,KACA,QACA,iBAAiB,SACd;AACH,QAAM,eACJ,UAAU,iBAAgC,qBAAqB;AAEjE,SAAO,YAAY,KAAK,YAAY;AACtC;","names":[]}
1
+ {"version":3,"sources":["../../../src/server/useIntlayer.ts"],"sourcesContent":["import type { LocalesValues } from '@intlayer/config/client';\nimport { IntlayerServerContext } from './IntlayerServerProvider';\nimport { getServerContext } from './serverContext';\nimport { type DictionaryKeys } from '@intlayer/core';\nimport { getIntlayer } from '../getIntlayer';\n\n/**\n * On the server 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 server context\n */\nexport const useIntlayer = <T extends DictionaryKeys, K extends LocalesValues>(\n key: T,\n locale?: K\n) => {\n const localeTarget =\n locale ?? getServerContext<LocalesValues>(IntlayerServerContext);\n\n return getIntlayer(key, localeTarget);\n};\n"],"mappings":"AACA,SAAS,6BAA6B;AACtC,SAAS,wBAAwB;AAEjC,SAAS,mBAAmB;AAOrB,MAAM,cAAc,CACzB,KACA,WACG;AACH,QAAM,eACJ,UAAU,iBAAgC,qBAAqB;AAEjE,SAAO,YAAY,KAAK,YAAY;AACtC;","names":[]}
@@ -1,9 +1,9 @@
1
- import type { Locales } from '@intlayer/config/client';
2
- import { type Dictionary } from '@intlayer/core';
1
+ import type { LocalesValues } from '@intlayer/config/client';
2
+ import { DeepTransformContent, type Dictionary } from '@intlayer/core';
3
3
  /**
4
4
  * On the server side, Hook that transform a dictionary and return the content
5
5
  *
6
6
  * If the locale is not provided, it will use the locale from the client context
7
7
  */
8
- export declare const useDictionary: <T extends Dictionary>(dictionary: T, locale?: Locales) => import("@intlayer/core").DeepTransformContent<T["content"], import("../plugins").IInterpreterPluginState>;
8
+ export declare const useDictionary: <T extends Dictionary>(dictionary: T, locale?: LocalesValues) => DeepTransformContent<T["content"]>;
9
9
  //# sourceMappingURL=useDictionary.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionary.d.ts","sourceRoot":"","sources":["../../../src/client/useDictionary.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAKjD;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,UAAU,cACpC,CAAC,WACJ,OAAO,8GAMjB,CAAC"}
1
+ {"version":3,"file":"useDictionary.d.ts","sourceRoot":"","sources":["../../../src/client/useDictionary.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAKvE;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,UAAU,cACpC,CAAC,WACJ,aAAa,KAQV,oBAAoB,CAAC,CAAC,CAAC,SAAS,CAAC,CAC9C,CAAC"}
@@ -1,10 +1,11 @@
1
1
  import type { Locales } from '@intlayer/config/client';
2
- import { type DictionaryKeys } from '@intlayer/core';
2
+ import type { DictionaryKeys } from '@intlayer/core';
3
3
  import { IntlayerDictionaryTypesConnector } from 'intlayer';
4
+ import type { DeepTransformContent } from '../plugins';
4
5
  /**
5
6
  * On the client side, Hook that picking one dictionary by its key and return the content
6
7
  *
7
8
  * If the locale is not provided, it will use the locale from the client context
8
9
  */
9
- export declare const useIntlayer: <T extends DictionaryKeys>(key: T, locale?: Locales) => import("@intlayer/core").DeepTransformContent<IntlayerDictionaryTypesConnector[T]["content"], import("../plugins").IInterpreterPluginState>;
10
+ export declare const useIntlayer: <T extends DictionaryKeys>(key: T, locale?: Locales) => DeepTransformContent<IntlayerDictionaryTypesConnector[T]["content"]>;
10
11
  //# sourceMappingURL=useIntlayer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useIntlayer.d.ts","sourceRoot":"","sources":["../../../src/client/useIntlayer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAIvD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAIrD,OAAO,EAAE,gCAAgC,EAAE,MAAM,UAAU,CAAC;AAE5D;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,cAAc,OAC7C,CAAC,WACG,OAAO,gJAcjB,CAAC"}
1
+ {"version":3,"file":"useIntlayer.d.ts","sourceRoot":"","sources":["../../../src/client/useIntlayer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAIvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAIrD,OAAO,EAAE,gCAAgC,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,cAAc,OAC7C,CAAC,WACG,OAAO,KACf,oBAAoB,CAAC,gCAAgC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAWrE,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { type Dictionary, type Plugins } from '@intlayer/core';
2
2
  import { type DeepTransformContent } from './plugins';
3
3
  import type { Locales, LocalesValues } from '@intlayer/config/client';
4
- export declare const getDictionary: <T extends Dictionary<unknown, false>, L extends LocalesValues = Locales>(dictionary: T, locale?: L, additionalPlugins?: Plugins[]) => DeepTransformContent<T["content"]>;
4
+ export declare const getDictionary: <T extends Dictionary, L extends LocalesValues = Locales>(dictionary: T, locale?: L, additionalPlugins?: Plugins[]) => DeepTransformContent<T["content"]>;
5
5
  //# sourceMappingURL=getDictionary.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getDictionary.d.ts","sourceRoot":"","sources":["../../src/getDictionary.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,OAAO,EAEb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,oBAAoB,EAI1B,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAEtE,eAAO,MAAM,aAAa,GACxB,CAAC,SAAS,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,EACpC,CAAC,SAAS,aAAa,wBAEX,CAAC,WACJ,CAAC,sBACU,OAAO,EAAE,KAajB,oBAAoB,CAAC,CAAC,CAAC,SAAS,CAAC,CAC9C,CAAC"}
1
+ {"version":3,"file":"getDictionary.d.ts","sourceRoot":"","sources":["../../src/getDictionary.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,OAAO,EAEb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,oBAAoB,EAI1B,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAEtE,eAAO,MAAM,aAAa,GACxB,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,aAAa,wBAEX,CAAC,WACJ,CAAC,sBACU,OAAO,EAAE,KAajB,oBAAoB,CAAC,CAAC,CAAC,SAAS,CAAC,CAC9C,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { IInterpreterPluginReact } from './plugins';
2
2
  declare module '@intlayer/core' {
3
- interface IInterpreterPlugin<T, S> extends IInterpreterPluginReact<T, S> {
3
+ interface IInterpreterPlugin<T, S> extends IInterpreterPluginReact<T> {
4
4
  }
5
5
  }
6
6
  export { IntlayerProvider, IntlayerProviderContent, type IntlayerProviderProps, IntlayerClientContext, useIntlayer, useIntlayerAsync, useDictionary, useLocale, useLocaleCookie, useIntlayerContext, localeCookie, setLocaleCookie, getBrowserLocale, useLocaleBase, t, } from './client/index';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAEpD,OAAO,QAAQ,gBAAgB,CAAC;IAC9B,UAAU,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAE,SAAQ,uBAAuB,CAAC,CAAC,EAAE,CAAC,CAAC;KAAG;CAC5E;AAED,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,KAAK,qBAAqB,EAC1B,qBAAqB,EACrB,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,CAAC,GACF,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAEpD,OAAO,QAAQ,gBAAgB,CAAC;IAC9B,UAAU,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAE,SAAQ,uBAAuB,CAAC,CAAC,CAAC;KAAG;CACzE;AAED,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,KAAK,qBAAqB,EAC1B,qBAAqB,EACrB,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,CAAC,GACF,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC"}
@@ -4,13 +4,13 @@ import type { IntlayerNode } from './IntlayerNode';
4
4
  /** ---------------------------------------------
5
5
  * INTLAYER NODE PLUGIN
6
6
  * --------------------------------------------- */
7
- export type IntlayerNodeCond<T, _S> = T extends number | string ? IntlayerNode<T> : never;
7
+ export type IntlayerNodeCond<T> = T extends number | string ? IntlayerNode<T> : never;
8
8
  /** Translation plugin. Replaces node with a locale string if nodeType = Translation. */
9
9
  export declare const intlayerNodePlugins: Plugins;
10
10
  /** ---------------------------------------------
11
11
  * REACT NODE PLUGIN
12
12
  * --------------------------------------------- */
13
- export type ReactNodeCond<T, _S> = T extends {
13
+ export type ReactNodeCond<T> = T extends {
14
14
  ref: any;
15
15
  props: any;
16
16
  key: any;
@@ -20,7 +20,7 @@ export declare const reactNodePlugins: Plugins;
20
20
  /**
21
21
  * MARKDOWN PLUGIN
22
22
  */
23
- export type MarkdownCond<T, _S> = T extends {
23
+ export type MarkdownCond<T> = T extends {
24
24
  nodeType: NodeType | string;
25
25
  [NodeType.Markdown]: string;
26
26
  } ? IntlayerNode<string> : never;
@@ -29,10 +29,10 @@ export declare const markdownPlugin: Plugins;
29
29
  /** ---------------------------------------------
30
30
  * PLUGINS RESULT
31
31
  * --------------------------------------------- */
32
- export interface IInterpreterPluginReact<T, _S> {
33
- reactNode: ReactNodeCond<T, _S>;
34
- intlayerNode: IntlayerNodeCond<T, _S>;
35
- markdown: MarkdownCond<T, _S>;
32
+ export interface IInterpreterPluginReact<T> {
33
+ reactNode: ReactNodeCond<T>;
34
+ intlayerNode: IntlayerNodeCond<T>;
35
+ markdown: MarkdownCond<T>;
36
36
  }
37
37
  /**
38
38
  * Insert this type as param of `DeepTransformContent` to avoid `intlayer` package pollution.
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/plugins.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,uBAAuB,IAAI,2BAA2B,EAC3D,KAAK,oBAAoB,IAAI,wBAAwB,EAErD,QAAQ,EACT,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAInD;;oDAEoD;AAEpD,MAAM,MAAM,gBAAgB,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,SAAS,MAAM,GAAG,MAAM,GAC3D,YAAY,CAAC,CAAC,CAAC,GACf,KAAK,CAAC;AAEV,wFAAwF;AACxF,eAAO,MAAM,mBAAmB,EAAE,OAYjC,CAAC;AAEF;;oDAEoD;AAEpD,MAAM,MAAM,aAAa,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,SAAS;IAC3C,GAAG,EAAE,GAAG,CAAC;IACT,KAAK,EAAE,GAAG,CAAC;IACX,GAAG,EAAE,GAAG,CAAC;CACV,GACG,SAAS,GACT,KAAK,CAAC;AAEV,wFAAwF;AACxF,eAAO,MAAM,gBAAgB,EAAE,OAQ9B,CAAC;AAEF;;GAEG;AAEH,MAAM,MAAM,YAAY,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,SAAS;IAC1C,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAAC;IAC5B,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC7B,GACG,YAAY,CAAC,MAAM,CAAC,GACpB,KAAK,CAAC;AAEV,oFAAoF;AACpF,eAAO,MAAM,cAAc,EAAE,OAI5B,CAAC;AAEF;;oDAEoD;AAEpD,MAAM,WAAW,uBAAuB,CAAC,CAAC,EAAE,EAAE;IAC5C,SAAS,EAAE,aAAa,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAChC,YAAY,EAAE,gBAAgB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACtC,QAAQ,EAAE,YAAY,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;CAC/B;AAED;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG,2BAA2B,GAAG;IAClE,SAAS,EAAE,IAAI,CAAC;IAChB,YAAY,EAAE,IAAI,CAAC;IACnB,QAAQ,EAAE,IAAI,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI,wBAAwB,CAC5D,CAAC,EACD,uBAAuB,CACxB,CAAC"}
1
+ {"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/plugins.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,uBAAuB,IAAI,2BAA2B,EAC3D,KAAK,oBAAoB,IAAI,wBAAwB,EAErD,QAAQ,EACT,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAInD;;oDAEoD;AAEpD,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAAG,MAAM,GACvD,YAAY,CAAC,CAAC,CAAC,GACf,KAAK,CAAC;AAEV,wFAAwF;AACxF,eAAO,MAAM,mBAAmB,EAAE,OAYjC,CAAC;AAEF;;oDAEoD;AAEpD,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,SAAS;IACvC,GAAG,EAAE,GAAG,CAAC;IACT,KAAK,EAAE,GAAG,CAAC;IACX,GAAG,EAAE,GAAG,CAAC;CACV,GACG,SAAS,GACT,KAAK,CAAC;AAEV,wFAAwF;AACxF,eAAO,MAAM,gBAAgB,EAAE,OAQ9B,CAAC;AAEF;;GAEG;AAEH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS;IACtC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAAC;IAC5B,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC7B,GACG,YAAY,CAAC,MAAM,CAAC,GACpB,KAAK,CAAC;AAEV,oFAAoF;AACpF,eAAO,MAAM,cAAc,EAAE,OAI5B,CAAC;AAEF;;oDAEoD;AAEpD,MAAM,WAAW,uBAAuB,CAAC,CAAC;IACxC,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IAC5B,YAAY,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAClC,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;CAC3B;AAED;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG,2BAA2B,GAAG;IAClE,SAAS,EAAE,IAAI,CAAC;IAChB,YAAY,EAAE,IAAI,CAAC;IACnB,QAAQ,EAAE,IAAI,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI,wBAAwB,CAC5D,CAAC,EACD,uBAAuB,CACxB,CAAC"}
@@ -5,5 +5,5 @@ import { type Dictionary } from '@intlayer/core';
5
5
  *
6
6
  * If the locale is not provided, it will use the locale from the server context
7
7
  */
8
- export declare const useDictionary: <T extends Dictionary>(dictionary: T, locale?: LocalesValues, isRenderEditor?: boolean) => import("@intlayer/core").DeepTransformContent<T["content"], import("../plugins").IInterpreterPluginState>;
8
+ export declare const useDictionary: <T extends Dictionary>(dictionary: T, locale?: LocalesValues) => import("@intlayer/core").DeepTransformContent<T["content"], import("../plugins").IInterpreterPluginState>;
9
9
  //# sourceMappingURL=useDictionary.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionary.d.ts","sourceRoot":"","sources":["../../../src/server/useDictionary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAKjD;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,UAAU,cACpC,CAAC,WACJ,aAAa,wIAOvB,CAAC"}
1
+ {"version":3,"file":"useDictionary.d.ts","sourceRoot":"","sources":["../../../src/server/useDictionary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAKjD;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,UAAU,cACpC,CAAC,WACJ,aAAa,8GAMvB,CAAC"}
@@ -5,5 +5,5 @@ import { type DictionaryKeys } from '@intlayer/core';
5
5
  *
6
6
  * If the locale is not provided, it will use the locale from the server context
7
7
  */
8
- export declare const useIntlayer: <T extends DictionaryKeys, K extends LocalesValues>(key: T, locale?: K, isRenderEditor?: boolean) => import("@intlayer/core").DeepTransformContent<import("intlayer").IntlayerDictionaryTypesConnector[T]["content"], import("../plugins").IInterpreterPluginState>;
8
+ export declare const useIntlayer: <T extends DictionaryKeys, K extends LocalesValues>(key: T, locale?: K) => import("@intlayer/core").DeepTransformContent<import("intlayer").IntlayerDictionaryTypesConnector[T]["content"], import("../plugins").IInterpreterPluginState>;
9
9
  //# sourceMappingURL=useIntlayer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useIntlayer.d.ts","sourceRoot":"","sources":["../../../src/server/useIntlayer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG7D,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGrD;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,cAAc,EAAE,CAAC,SAAS,aAAa,OACtE,CAAC,WACG,CAAC,6LAOX,CAAC"}
1
+ {"version":3,"file":"useIntlayer.d.ts","sourceRoot":"","sources":["../../../src/server/useIntlayer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG7D,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGrD;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,cAAc,EAAE,CAAC,SAAS,aAAa,OACtE,CAAC,WACG,CAAC,mKAMX,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-intlayer",
3
- "version": "5.0.2",
3
+ "version": "5.0.4",
4
4
  "private": false,
5
5
  "description": "Easily internationalize i18n your React applications with type-safe multilingual content management.",
6
6
  "keywords": [
@@ -68,11 +68,11 @@
68
68
  ],
69
69
  "dependencies": {
70
70
  "js-cookie": "^3.0.5",
71
- "@intlayer/api": "5.0.2",
72
- "@intlayer/config": "5.0.2",
73
- "@intlayer/core": "5.0.2",
74
- "@intlayer/dictionaries-entry": "5.0.2",
75
- "@intlayer/editor-react": "5.0.2"
71
+ "@intlayer/api": "5.0.4",
72
+ "@intlayer/config": "5.0.4",
73
+ "@intlayer/core": "5.0.4",
74
+ "@intlayer/dictionaries-entry": "5.0.4",
75
+ "@intlayer/editor-react": "5.0.4"
76
76
  },
77
77
  "devDependencies": {
78
78
  "@craco/types": "^7.1.0",
@@ -87,21 +87,21 @@
87
87
  "tsc-alias": "^1.8.10",
88
88
  "tsup": "^8.3.5",
89
89
  "typescript": "^5.7.3",
90
- "@intlayer/backend": "5.0.2",
91
90
  "@utils/eslint-config": "1.0.4",
91
+ "@utils/ts-config": "1.0.4",
92
+ "@intlayer/backend": "5.0.4",
92
93
  "@utils/ts-config-types": "1.0.4",
93
- "@utils/tsup-config": "1.0.4",
94
- "@utils/ts-config": "1.0.4"
94
+ "@utils/tsup-config": "1.0.4"
95
95
  },
96
96
  "peerDependencies": {
97
97
  "react": ">=16.0.0",
98
98
  "react-dom": ">=16.0.0",
99
- "@intlayer/api": "5.0.2",
100
- "@intlayer/core": "5.0.2",
101
- "@intlayer/config": "5.0.2",
102
- "@intlayer/dictionaries-entry": "5.0.2",
103
- "@intlayer/editor-react": "5.0.2",
104
- "intlayer": "5.0.2"
99
+ "@intlayer/api": "5.0.4",
100
+ "@intlayer/config": "5.0.4",
101
+ "@intlayer/core": "5.0.4",
102
+ "@intlayer/dictionaries-entry": "5.0.4",
103
+ "@intlayer/editor-react": "5.0.4",
104
+ "intlayer": "5.0.4"
105
105
  },
106
106
  "engines": {
107
107
  "node": ">=14.18"