react-intlayer 4.1.10 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/cjs/{getEnumeration.cjs → IntlayerNode.cjs} +14 -13
- package/dist/cjs/IntlayerNode.cjs.map +1 -0
- package/dist/cjs/UI/ContentSelector.cjs.map +1 -1
- package/dist/cjs/client/IntlayerProvider.cjs.map +1 -1
- package/dist/cjs/client/index.cjs +2 -5
- package/dist/cjs/client/index.cjs.map +1 -1
- package/dist/cjs/client/t.cjs +2 -2
- package/dist/cjs/client/t.cjs.map +1 -1
- package/dist/cjs/client/useContent.cjs +2 -2
- package/dist/cjs/client/useContent.cjs.map +1 -1
- package/dist/cjs/client/useDictionary.cjs +3 -3
- package/dist/cjs/client/useDictionary.cjs.map +1 -1
- package/dist/cjs/client/useIntlayer.cjs +7 -4
- package/dist/cjs/client/useIntlayer.cjs.map +1 -1
- package/dist/cjs/client/useIntlayerAsync.cjs +3 -4
- package/dist/cjs/client/useIntlayerAsync.cjs.map +1 -1
- package/dist/cjs/client/useLocale.cjs +1 -1
- package/dist/cjs/client/useLocale.cjs.map +1 -1
- package/dist/cjs/client/useLocaleCookie.cjs.map +1 -1
- package/dist/cjs/client/useTraduction.cjs +5 -5
- package/dist/cjs/client/useTraduction.cjs.map +1 -1
- package/dist/cjs/editor/ContentSelectorWrapper.cjs +1 -3
- package/dist/cjs/editor/ContentSelectorWrapper.cjs.map +1 -1
- package/dist/cjs/editor/IntlayerEditorProvider.cjs +3 -1
- package/dist/cjs/editor/IntlayerEditorProvider.cjs.map +1 -1
- package/dist/cjs/editor/renderContentEditor.cjs +5 -4
- package/dist/cjs/editor/renderContentEditor.cjs.map +1 -1
- package/dist/cjs/getDictionary.cjs +13 -13
- package/dist/cjs/getDictionary.cjs.map +1 -1
- package/dist/cjs/getIntlayer.cjs +10 -29
- package/dist/cjs/getIntlayer.cjs.map +1 -1
- package/dist/cjs/index.cjs +5 -13
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/{getIntlayerAsync.cjs → markdown/MarkdownProvider.cjs} +18 -19
- package/dist/cjs/markdown/MarkdownProvider.cjs.map +1 -0
- package/dist/cjs/{server/useTraduction.cjs → markdown/MarkdownRenderer.cjs} +17 -12
- package/dist/cjs/markdown/MarkdownRenderer.cjs.map +1 -0
- package/dist/cjs/markdown/index.cjs +27 -0
- package/dist/cjs/markdown/index.cjs.map +1 -0
- package/dist/cjs/{getTranslation.cjs → markdown/renderMarkdown.cjs} +13 -16
- package/dist/cjs/markdown/renderMarkdown.cjs.map +1 -0
- package/dist/cjs/plugins.cjs +85 -0
- package/dist/cjs/plugins.cjs.map +1 -0
- package/dist/cjs/server/IntlayerServerProvider.cjs.map +1 -1
- package/dist/cjs/server/index.cjs +2 -8
- package/dist/cjs/server/index.cjs.map +1 -1
- package/dist/cjs/server/t.cjs +5 -3
- package/dist/cjs/server/t.cjs.map +1 -1
- package/dist/cjs/server/useDictionary.cjs +2 -2
- package/dist/cjs/server/useDictionary.cjs.map +1 -1
- package/dist/cjs/server/useIntlayer.cjs +2 -2
- package/dist/cjs/server/useIntlayer.cjs.map +1 -1
- package/dist/esm/IntlayerNode.mjs +16 -0
- package/dist/esm/IntlayerNode.mjs.map +1 -0
- package/dist/esm/UI/ContentSelector.mjs.map +1 -1
- package/dist/esm/client/IntlayerProvider.mjs.map +1 -1
- package/dist/esm/client/index.mjs +1 -3
- package/dist/esm/client/index.mjs.map +1 -1
- package/dist/esm/client/t.mjs +1 -1
- package/dist/esm/client/t.mjs.map +1 -1
- package/dist/esm/client/useContent.mjs +3 -3
- package/dist/esm/client/useContent.mjs.map +1 -1
- package/dist/esm/client/useDictionary.mjs +3 -3
- package/dist/esm/client/useDictionary.mjs.map +1 -1
- package/dist/esm/client/useIntlayer.mjs +8 -7
- package/dist/esm/client/useIntlayer.mjs.map +1 -1
- package/dist/esm/client/useIntlayerAsync.mjs +5 -5
- package/dist/esm/client/useIntlayerAsync.mjs.map +1 -1
- package/dist/esm/client/useLocale.mjs +1 -1
- package/dist/esm/client/useLocale.mjs.map +1 -1
- package/dist/esm/client/useLocaleCookie.mjs.map +1 -1
- package/dist/esm/client/useTraduction.mjs +3 -3
- package/dist/esm/client/useTraduction.mjs.map +1 -1
- package/dist/esm/editor/ContentSelectorWrapper.mjs +1 -3
- package/dist/esm/editor/ContentSelectorWrapper.mjs.map +1 -1
- package/dist/esm/editor/IntlayerEditorProvider.mjs +3 -1
- package/dist/esm/editor/IntlayerEditorProvider.mjs.map +1 -1
- package/dist/esm/editor/renderContentEditor.mjs +5 -4
- package/dist/esm/editor/renderContentEditor.mjs.map +1 -1
- package/dist/esm/getDictionary.mjs +18 -14
- package/dist/esm/getDictionary.mjs.map +1 -1
- package/dist/esm/getIntlayer.mjs +15 -20
- package/dist/esm/getIntlayer.mjs.map +1 -1
- package/dist/esm/index.mjs +3 -9
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/markdown/MarkdownProvider.mjs +19 -0
- package/dist/esm/markdown/MarkdownProvider.mjs.map +1 -0
- package/dist/esm/markdown/MarkdownRenderer.mjs +16 -0
- package/dist/esm/markdown/MarkdownRenderer.mjs.map +1 -0
- package/dist/esm/markdown/index.mjs +4 -0
- package/dist/esm/markdown/index.mjs.map +1 -0
- package/dist/esm/markdown/renderMarkdown.mjs +11 -0
- package/dist/esm/markdown/renderMarkdown.mjs.map +1 -0
- package/dist/esm/plugins.mjs +61 -0
- package/dist/esm/plugins.mjs.map +1 -0
- package/dist/esm/server/IntlayerServerProvider.mjs.map +1 -1
- package/dist/esm/server/index.mjs +1 -5
- package/dist/esm/server/index.mjs.map +1 -1
- package/dist/esm/server/t.mjs +4 -2
- package/dist/esm/server/t.mjs.map +1 -1
- package/dist/esm/server/useDictionary.mjs +2 -2
- package/dist/esm/server/useDictionary.mjs.map +1 -1
- package/dist/esm/server/useIntlayer.mjs +2 -4
- package/dist/esm/server/useIntlayer.mjs.map +1 -1
- package/dist/types/IntlayerNode.d.ts +9 -0
- package/dist/types/IntlayerNode.d.ts.map +1 -0
- package/dist/types/UI/ContentSelector.d.ts +1 -1
- package/dist/types/UI/ContentSelector.d.ts.map +1 -1
- package/dist/types/client/IntlayerProvider.d.ts +4 -4
- package/dist/types/client/IntlayerProvider.d.ts.map +1 -1
- package/dist/types/client/index.d.ts +0 -1
- package/dist/types/client/index.d.ts.map +1 -1
- package/dist/types/client/t.d.ts +1 -1
- package/dist/types/client/t.d.ts.map +1 -1
- package/dist/types/client/useContent.d.ts +1 -1
- package/dist/types/client/useDictionary.d.ts +3 -2
- package/dist/types/client/useDictionary.d.ts.map +1 -1
- package/dist/types/client/useIntlayer.d.ts +4 -2
- package/dist/types/client/useIntlayer.d.ts.map +1 -1
- package/dist/types/client/useIntlayerAsync.d.ts +4 -5
- package/dist/types/client/useIntlayerAsync.d.ts.map +1 -1
- package/dist/types/client/useLocale.d.ts +3 -3
- package/dist/types/client/useLocale.d.ts.map +1 -1
- package/dist/types/client/useLocaleBase.d.ts +2 -2
- package/dist/types/client/useLocaleCookie.d.ts +4 -4
- package/dist/types/client/useLocaleCookie.d.ts.map +1 -1
- package/dist/types/client/useTraduction.d.ts +3 -3
- package/dist/types/client/useTraduction.d.ts.map +1 -1
- package/dist/types/editor/ContentSelectorWrapper.d.ts +2 -8
- package/dist/types/editor/ContentSelectorWrapper.d.ts.map +1 -1
- package/dist/types/editor/IntlayerEditorProvider.d.ts.map +1 -1
- package/dist/types/editor/renderContentEditor.d.ts +3 -7
- package/dist/types/editor/renderContentEditor.d.ts.map +1 -1
- package/dist/types/getDictionary.d.ts +4 -12
- package/dist/types/getDictionary.d.ts.map +1 -1
- package/dist/types/getIntlayer.d.ts +4 -34
- package/dist/types/getIntlayer.d.ts.map +1 -1
- package/dist/types/index.d.ts +8 -5
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/markdown/MarkdownProvider.d.ts +9 -0
- package/dist/types/markdown/MarkdownProvider.d.ts.map +1 -0
- package/dist/types/markdown/MarkdownRenderer.d.ts +5 -0
- package/dist/types/markdown/MarkdownRenderer.d.ts.map +1 -0
- package/dist/types/markdown/index.d.ts +4 -0
- package/dist/types/markdown/index.d.ts.map +1 -0
- package/dist/types/markdown/renderMarkdown.d.ts +3 -0
- package/dist/types/markdown/renderMarkdown.d.ts.map +1 -0
- package/dist/types/plugins.d.ts +48 -0
- package/dist/types/plugins.d.ts.map +1 -0
- package/dist/types/server/IntlayerServerProvider.d.ts +7 -7
- package/dist/types/server/IntlayerServerProvider.d.ts.map +1 -1
- package/dist/types/server/index.d.ts +0 -2
- package/dist/types/server/index.d.ts.map +1 -1
- package/dist/types/server/t.d.ts +20 -4
- package/dist/types/server/t.d.ts.map +1 -1
- package/dist/types/server/useDictionary.d.ts +3 -2
- package/dist/types/server/useDictionary.d.ts.map +1 -1
- package/dist/types/server/useIntlayer.d.ts +3 -2
- package/dist/types/server/useIntlayer.d.ts.map +1 -1
- package/package.json +16 -16
- package/dist/cjs/getEnumeration.cjs.map +0 -1
- package/dist/cjs/getIntlayerAsync.cjs.map +0 -1
- package/dist/cjs/getTranslation.cjs.map +0 -1
- package/dist/cjs/processDictionary/contentDictionary.cjs +0 -17
- package/dist/cjs/processDictionary/contentDictionary.cjs.map +0 -1
- package/dist/cjs/processDictionary/index.cjs +0 -201
- package/dist/cjs/processDictionary/index.cjs.map +0 -1
- package/dist/cjs/recursiveTransformContent.cjs +0 -54
- package/dist/cjs/recursiveTransformContent.cjs.map +0 -1
- package/dist/cjs/server/getLocaleTranslation.cjs +0 -43
- package/dist/cjs/server/getLocaleTranslation.cjs.map +0 -1
- package/dist/cjs/server/useTraduction.cjs.map +0 -1
- package/dist/esm/getEnumeration.mjs +0 -12
- package/dist/esm/getEnumeration.mjs.map +0 -1
- package/dist/esm/getIntlayerAsync.mjs +0 -18
- package/dist/esm/getIntlayerAsync.mjs.map +0 -1
- package/dist/esm/getTranslation.mjs +0 -14
- package/dist/esm/getTranslation.mjs.map +0 -1
- package/dist/esm/processDictionary/contentDictionary.mjs +0 -1
- package/dist/esm/processDictionary/contentDictionary.mjs.map +0 -1
- package/dist/esm/processDictionary/index.mjs +0 -179
- package/dist/esm/processDictionary/index.mjs.map +0 -1
- package/dist/esm/recursiveTransformContent.mjs +0 -32
- package/dist/esm/recursiveTransformContent.mjs.map +0 -1
- package/dist/esm/server/getLocaleTranslation.mjs +0 -19
- package/dist/esm/server/getLocaleTranslation.mjs.map +0 -1
- package/dist/esm/server/useTraduction.mjs +0 -11
- package/dist/esm/server/useTraduction.mjs.map +0 -1
- package/dist/types/getEnumeration.d.ts +0 -31
- package/dist/types/getEnumeration.d.ts.map +0 -1
- package/dist/types/getIntlayerAsync.d.ts +0 -13
- package/dist/types/getIntlayerAsync.d.ts.map +0 -1
- package/dist/types/getTranslation.d.ts +0 -25
- package/dist/types/getTranslation.d.ts.map +0 -1
- package/dist/types/processDictionary/contentDictionary.d.ts +0 -14
- package/dist/types/processDictionary/contentDictionary.d.ts.map +0 -1
- package/dist/types/processDictionary/index.d.ts +0 -9
- package/dist/types/processDictionary/index.d.ts.map +0 -1
- package/dist/types/recursiveTransformContent.d.ts +0 -27
- package/dist/types/recursiveTransformContent.d.ts.map +0 -1
- package/dist/types/server/getLocaleTranslation.d.ts +0 -9
- package/dist/types/server/getLocaleTranslation.d.ts.map +0 -1
- package/dist/types/server/useTraduction.d.ts +0 -24
- package/dist/types/server/useTraduction.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/server/IntlayerServerProvider.tsx"],"sourcesContent":["import { type Locales, getConfiguration } from '@intlayer/config/client';\nimport type { FC, PropsWithChildren } from 'react';\nimport { createServerContext, getServerContext } from './serverContext';\n\nconst { defaultLocale } = getConfiguration().internationalization;\n\n/**\n * Context that store the current locale on the server side\n */\nexport const IntlayerServerContext
|
|
1
|
+
{"version":3,"sources":["../../../src/server/IntlayerServerProvider.tsx"],"sourcesContent":["import { type Locales, getConfiguration } from '@intlayer/config/client';\nimport type { FC, PropsWithChildren } from 'react';\nimport { createServerContext, getServerContext } from './serverContext';\n\nconst { defaultLocale } = getConfiguration().internationalization;\n\n/**\n * Context that store the current locale on the server side\n */\nexport const IntlayerServerContext = createServerContext<\n Locales | `${Locales}`\n>(defaultLocale);\n\n/**\n * Hook that provides the current locale\n */\nexport const useIntlayer = () => getServerContext(IntlayerServerContext);\n\n/**\n * Get the current locale\n */\nexport const locale = getServerContext(IntlayerServerContext);\n\nexport type IntlayerServerProviderProps = PropsWithChildren & {\n locale?: Locales | `${Locales}`;\n};\n\n/**\n * Provider that store the current locale on the server side\n */\nexport const IntlayerServerProvider: FC<IntlayerServerProviderProps> = ({\n children,\n locale = defaultLocale,\n}) => (\n <IntlayerServerContext.Provider value={locale}>\n {children}\n </IntlayerServerContext.Provider>\n);\n"],"mappings":"AAkCE;AAlCF,SAAuB,wBAAwB;AAE/C,SAAS,qBAAqB,wBAAwB;AAEtD,MAAM,EAAE,cAAc,IAAI,iBAAiB,EAAE;AAKtC,MAAM,wBAAwB,oBAEnC,aAAa;AAKR,MAAM,cAAc,MAAM,iBAAiB,qBAAqB;AAKhE,MAAM,SAAS,iBAAiB,qBAAqB;AASrD,MAAM,yBAA0D,CAAC;AAAA,EACtE;AAAA,EACA,QAAAA,UAAS;AACX,MACE,oBAAC,sBAAsB,UAAtB,EAA+B,OAAOA,SACpC,UACH;","names":["locale"]}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { getLocaleTranslation } from "./getLocaleTranslation.mjs";
|
|
2
|
-
import { useTraduction } from "./useTraduction.mjs";
|
|
3
1
|
import {
|
|
4
2
|
IntlayerServerContext,
|
|
5
3
|
locale,
|
|
@@ -11,11 +9,9 @@ import { t } from "./t.mjs";
|
|
|
11
9
|
export {
|
|
12
10
|
IntlayerServerContext as IntlayerServer,
|
|
13
11
|
IntlayerServerProvider,
|
|
14
|
-
getLocaleTranslation as getLocaleContent,
|
|
15
12
|
locale,
|
|
16
13
|
t,
|
|
17
14
|
useDictionary,
|
|
18
|
-
useIntlayer
|
|
19
|
-
useTraduction
|
|
15
|
+
useIntlayer
|
|
20
16
|
};
|
|
21
17
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/server/index.ts"],"sourcesContent":["export {
|
|
1
|
+
{"version":3,"sources":["../../../src/server/index.ts"],"sourcesContent":["export {\n IntlayerServerContext as IntlayerServer,\n locale,\n IntlayerServerProvider,\n} from './IntlayerServerProvider';\nexport { useIntlayer } from './useIntlayer';\nexport { useDictionary } from './useDictionary';\nexport { t } from './t';\n"],"mappings":"AAAA;AAAA,EAC2B;AAAA,EACzB;AAAA,EACA;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,SAAS;","names":[]}
|
package/dist/esm/server/t.mjs
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { getTranslation } from "../getTranslation.mjs";
|
|
2
1
|
import { IntlayerServerContext } from "./IntlayerServerProvider.mjs";
|
|
3
2
|
import { getServerContext } from "./serverContext.mjs";
|
|
3
|
+
import { getTranslation } from "@intlayer/core";
|
|
4
4
|
const t = (multilangContent, locale) => {
|
|
5
|
-
const currentLocale = getServerContext(
|
|
5
|
+
const currentLocale = getServerContext(
|
|
6
|
+
IntlayerServerContext
|
|
7
|
+
);
|
|
6
8
|
const localeTarget = locale ?? currentLocale;
|
|
7
9
|
return getTranslation(multilangContent, localeTarget);
|
|
8
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/server/t.ts"],"sourcesContent":["import type { Locales } from '@intlayer/config/client';\nimport
|
|
1
|
+
{"version":3,"sources":["../../../src/server/t.ts"],"sourcesContent":["import type { Locales } from '@intlayer/config/client';\nimport { IntlayerServerContext } from './IntlayerServerProvider';\nimport { getServerContext } from './serverContext';\nimport { type LanguageContent, getTranslation } from '@intlayer/core';\n\n/**\n * On the server side, hook to get the translation content based on the locale\n *\n * If not locale found, it will return the content related to the default locale.\n *\n * Return either the content editor, or the content itself depending on the configuration.\n *\n * Usage:\n *\n * ```ts\n * const content = t<string>({\n * en: 'Hello',\n * fr: 'Bonjour',\n * }, 'fr');\n * // 'Bonjour'\n * ```\n *\n * Using TypeScript:\n * - this function will require each locale to be defined if defined in the project configuration.\n * - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.\n */\nexport const t = <Content = string>(\n multilangContent: LanguageContent<Content>,\n locale?: Locales | `${Locales}`\n) => {\n const currentLocale = getServerContext<Locales | `${Locales}`>(\n IntlayerServerContext\n );\n const localeTarget = locale ?? currentLocale;\n\n return getTranslation<Content>(multilangContent, localeTarget);\n};\n"],"mappings":"AACA,SAAS,6BAA6B;AACtC,SAAS,wBAAwB;AACjC,SAA+B,sBAAsB;AAuB9C,MAAM,IAAI,CACf,kBACA,WACG;AACH,QAAM,gBAAgB;AAAA,IACpB;AAAA,EACF;AACA,QAAM,eAAe,UAAU;AAE/B,SAAO,eAAwB,kBAAkB,YAAY;AAC/D;","names":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { getDictionary } from "../getDictionary.mjs";
|
|
2
1
|
import { IntlayerServerContext } from "./IntlayerServerProvider.mjs";
|
|
3
2
|
import { getServerContext } from "./serverContext.mjs";
|
|
3
|
+
import { getDictionary } from "../getDictionary.mjs";
|
|
4
4
|
const useDictionary = (dictionary, locale, isRenderEditor = false) => {
|
|
5
5
|
const localeTarget = locale ?? getServerContext(IntlayerServerContext);
|
|
6
|
-
return getDictionary(dictionary, localeTarget
|
|
6
|
+
return getDictionary(dictionary, localeTarget);
|
|
7
7
|
};
|
|
8
8
|
export {
|
|
9
9
|
useDictionary
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/server/useDictionary.ts"],"sourcesContent":["import type { Locales } from '@intlayer/config/client';\nimport type
|
|
1
|
+
{"version":3,"sources":["../../../src/server/useDictionary.ts"],"sourcesContent":["import type { Locales } 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?: Locales | `${Locales}`,\n isRenderEditor = false\n) => {\n const localeTarget =\n locale ?? getServerContext<Locales | `${Locales}`>(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,iBAAyC,qBAAqB;AAE1E,SAAO,cAAc,YAAY,YAAY;AAC/C;","names":[]}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getIntlayer
|
|
3
|
-
} from "../getIntlayer.mjs";
|
|
4
1
|
import { IntlayerServerContext } from "./IntlayerServerProvider.mjs";
|
|
5
2
|
import { getServerContext } from "./serverContext.mjs";
|
|
3
|
+
import { getIntlayer } from "../getIntlayer.mjs";
|
|
6
4
|
const useIntlayer = (key, locale, isRenderEditor = true) => {
|
|
7
5
|
const localeTarget = locale ?? getServerContext(IntlayerServerContext);
|
|
8
|
-
return getIntlayer(key, localeTarget
|
|
6
|
+
return getIntlayer(key, localeTarget);
|
|
9
7
|
};
|
|
10
8
|
export {
|
|
11
9
|
useIntlayer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/server/useIntlayer.ts"],"sourcesContent":["import type { Locales } from '@intlayer/config/client';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/server/useIntlayer.ts"],"sourcesContent":["import type { Locales } 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 = <\n T extends DictionaryKeys,\n K extends Locales | `${Locales}`,\n>(\n key: T,\n locale?: K,\n isRenderEditor = true\n) => {\n const localeTarget =\n locale ?? getServerContext<Locales | `${Locales}`>(IntlayerServerContext);\n\n return getIntlayer(key, localeTarget);\n};\n"],"mappings":"AACA,SAAS,6BAA6B;AACtC,SAAS,wBAAwB;AAEjC,SAAS,mBAAmB;AAOrB,MAAM,cAAc,CAIzB,KACA,QACA,iBAAiB,SACd;AACH,QAAM,eACJ,UAAU,iBAAyC,qBAAqB;AAE1E,SAAO,YAAY,KAAK,YAAY;AACtC;","names":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { NodeProps } from '@intlayer/core';
|
|
2
|
+
import { type PropsWithChildren, type ReactNode } from 'react';
|
|
3
|
+
export type IntlayerNode<T = NodeProps['content']> = ReactNode & {
|
|
4
|
+
value: T;
|
|
5
|
+
};
|
|
6
|
+
export declare const rendererIntlayerNode: <T extends number | string | boolean | undefined | null>({ value, children, }: PropsWithChildren<{
|
|
7
|
+
value: T;
|
|
8
|
+
}>) => IntlayerNode;
|
|
9
|
+
//# sourceMappingURL=IntlayerNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IntlayerNode.d.ts","sourceRoot":"","sources":["../../src/IntlayerNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AAEf,MAAM,MAAM,YAAY,CAAC,CAAC,GAAG,SAAS,CAAC,SAAS,CAAC,IAAI,SAAS,GAAG;IAC/D,KAAK,EAAE,CAAC,CAAC;CACV,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,IAAI,wBAIrD,iBAAiB,CAAC;IACnB,KAAK,EAAE,CAAC,CAAC;CACV,CAAC,KAAG,YAUJ,CAAC"}
|
|
@@ -4,7 +4,7 @@ type ContentSelectorProps = {
|
|
|
4
4
|
onClickOutside?: () => void;
|
|
5
5
|
pressDuration?: number;
|
|
6
6
|
isSelecting?: boolean;
|
|
7
|
-
} & HTMLAttributes<HTMLDivElement>;
|
|
7
|
+
} & Omit<HTMLAttributes<HTMLDivElement>, 'content'>;
|
|
8
8
|
export declare const ContentSelector: FC<ContentSelectorProps>;
|
|
9
9
|
export {};
|
|
10
10
|
//# sourceMappingURL=ContentSelector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentSelector.d.ts","sourceRoot":"","sources":["../../../src/UI/ContentSelector.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,EAAE,EAEP,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;AAIf,KAAK,oBAAoB,GAAG;IAC1B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"ContentSelector.d.ts","sourceRoot":"","sources":["../../../src/UI/ContentSelector.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,EAAE,EAEP,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;AAIf,KAAK,oBAAoB,GAAG;IAC1B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,SAAS,CAAC,CAAC;AAEpD,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAiHpD,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type Locales } from '@intlayer/config/client';
|
|
2
2
|
import { type PropsWithChildren, type FC } from 'react';
|
|
3
3
|
type IntlayerValue = {
|
|
4
|
-
locale: Locales
|
|
5
|
-
setLocale: (newLocale: Locales) => void;
|
|
4
|
+
locale: Locales | `${Locales}`;
|
|
5
|
+
setLocale: (newLocale: Locales | `${Locales}`) => void;
|
|
6
6
|
};
|
|
7
7
|
/**
|
|
8
8
|
* Context that store the current locale on the client side
|
|
@@ -13,8 +13,8 @@ export declare const IntlayerClientContext: import("react").Context<IntlayerValu
|
|
|
13
13
|
*/
|
|
14
14
|
export declare const useIntlayerContext: () => IntlayerValue;
|
|
15
15
|
export type IntlayerProviderProps = PropsWithChildren & {
|
|
16
|
-
locale?: Locales
|
|
17
|
-
setLocale?: (locale: Locales) => void;
|
|
16
|
+
locale?: Locales | `${Locales}`;
|
|
17
|
+
setLocale?: (locale: Locales | `${Locales}`) => void;
|
|
18
18
|
};
|
|
19
19
|
export declare const IntlayerProvider: FC<IntlayerProviderProps>;
|
|
20
20
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntlayerProvider.d.ts","sourceRoot":"","sources":["../../../src/client/IntlayerProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAKzE,OAAO,EACL,KAAK,iBAAiB,EAItB,KAAK,EAAE,EAER,MAAM,OAAO,CAAC;AAKf,KAAK,aAAa,GAAG;IACnB,MAAM,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"IntlayerProvider.d.ts","sourceRoot":"","sources":["../../../src/client/IntlayerProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAKzE,OAAO,EACL,KAAK,iBAAiB,EAItB,KAAK,EAAE,EAER,MAAM,OAAO,CAAC;AAKf,KAAK,aAAa,GAAG;IACnB,MAAM,EAAE,OAAO,GAAG,GAAG,OAAO,EAAE,CAAC;IAC/B,SAAS,EAAE,CAAC,SAAS,EAAE,OAAO,GAAG,GAAG,OAAO,EAAE,KAAK,IAAI,CAAC;CACxD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,wCAGhC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB,qBAA0C,CAAC;AAE1E,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,GAAG;IACtD,MAAM,CAAC,EAAE,OAAO,GAAG,GAAG,OAAO,EAAE,CAAC;IAChC,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,GAAG,GAAG,OAAO,EAAE,KAAK,IAAI,CAAC;CACtD,CAAC;AAqDF,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAItD,CAAC"}
|
|
@@ -4,7 +4,6 @@ export { useIntlayerAsync } from './useIntlayerAsync';
|
|
|
4
4
|
export { useDictionary } from './useDictionary';
|
|
5
5
|
export { useLocaleBase } from './useLocaleBase';
|
|
6
6
|
export { useLocale } from './useLocale';
|
|
7
|
-
export { useTraduction } from './useTraduction';
|
|
8
7
|
export { useLocaleCookie, localeCookie, setLocaleCookie, } from './useLocaleCookie';
|
|
9
8
|
export { getBrowserLocale } from './getBrowserLocale';
|
|
10
9
|
export { t } from './t';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,qBAAqB,EAC1B,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,qBAAqB,EAC1B,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EACL,eAAe,EACf,YAAY,EACZ,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC"}
|
package/dist/types/client/t.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Locales } from '@intlayer/config/client';
|
|
2
|
-
import type
|
|
2
|
+
import { type LanguageContent } from '@intlayer/core';
|
|
3
3
|
/**
|
|
4
4
|
* On the client side, this function returns the translation of the provided multilang content.
|
|
5
5
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"t.d.ts","sourceRoot":"","sources":["../../../src/client/t.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"t.d.ts","sourceRoot":"","sources":["../../../src/client/t.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,KAAK,eAAe,EAAkB,MAAM,gBAAgB,CAAC;AAItE;;;;GAIG;AACH,eAAO,MAAM,CAAC,GAAI,OAAO,6BACL,eAAe,CAAC,OAAO,CAAC,WACjC,OAAO,YAMjB,CAAC"}
|
|
@@ -3,7 +3,7 @@ import type { LanguageContent } from '@intlayer/core';
|
|
|
3
3
|
* On the client side, hook to get the translation content based on the locale
|
|
4
4
|
*/
|
|
5
5
|
export declare const useContent: <Content>(languageContent: LanguageContent<Content>) => {
|
|
6
|
-
locale: import("intlayer").Locales;
|
|
6
|
+
locale: "hr" | "th" | "tr" | "id" | "is" | import("intlayer").Locales | "af" | "af-ZA" | "ar" | "ar-AE" | "ar-BH" | "ar-DZ" | "ar-EG" | "ar-IQ" | "ar-JO" | "ar-KW" | "ar-LB" | "ar-LY" | "ar-MA" | "ar-OM" | "ar-QA" | "ar-SA" | "ar-SY" | "ar-TN" | "ar-YE" | "az" | "az-AZ" | "be" | "be-BY" | "bg" | "bg-BG" | "bs" | "bs-BA" | "ca" | "ca-ES" | "cs" | "cs-CZ" | "cy" | "cy-GB" | "da" | "da-DK" | "de" | "de-AT" | "de-CH" | "de-DE" | "de-LI" | "de-LU" | "dv" | "dv-MV" | "el" | "el-GR" | "en" | "en-AU" | "en-BZ" | "en-CA" | "en-CB" | "en-GB" | "en-IE" | "en-JM" | "en-NZ" | "en-PH" | "en-TT" | "en-US" | "en-ZA" | "en-ZW" | "eo" | "es" | "es-AR" | "es-BO" | "es-CL" | "es-CO" | "es-CR" | "es-DO" | "es-EC" | "es-ES" | "es-GT" | "es-HN" | "es-MX" | "es-NI" | "es-PA" | "es-PE" | "es-PR" | "es-PY" | "es-SV" | "es-UY" | "es-VE" | "et" | "et-EE" | "eu" | "eu-ES" | "fa" | "fa-IR" | "fi" | "fi-FI" | "fo" | "fo-FO" | "fr" | "fr-BE" | "fr-CA" | "fr-CH" | "fr-FR" | "fr-LU" | "fr-MC" | "gl" | "gl-ES" | "gu" | "gu-IN" | "he" | "he-IL" | "hi" | "hi-IN" | "hr-BA" | "hr-HR" | "hu" | "hu-HU" | "hy" | "hy-AM" | "id-ID" | "is-IS" | "it" | "it-CH" | "it-IT" | "ja" | "ja-JP" | "ka" | "ka-GE" | "kk" | "kk-KZ" | "kn" | "kn-IN" | "ko" | "ko-KR" | "kok" | "kok-IN" | "ky" | "ky-KG" | "lt" | "lt-LT" | "lv" | "lv-LV" | "mi" | "mi-NZ" | "mk" | "mk-MK" | "mn" | "mn-MN" | "mr" | "mr-IN" | "ms" | "ms-BN" | "ms-MY" | "mt" | "mt-MT" | "nb" | "nb-NO" | "nl" | "nl-BE" | "nl-NL" | "nn-NO" | "ns" | "ns-ZA" | "pa" | "pa-IN" | "pl" | "pl-PL" | "ps" | "ps-AR" | "pt" | "pt-BR" | "pt-PT" | "qu" | "qu-BO" | "qu-EC" | "qu-PE" | "ro" | "ro-RO" | "ru" | "ru-RU" | "sa" | "sa-IN" | "se" | "se-FI" | "se-NO" | "se-SE" | "sk" | "sk-SK" | "sl" | "sl-SI" | "sq" | "sq-AL" | "sr" | "sr-BA" | "sr-SP" | "sv" | "sv-FI" | "sv-SE" | "sw" | "sw-KE" | "syr" | "syr-SY" | "ta" | "ta-IN" | "te" | "te-IN" | "th-TH" | "tl" | "tl-PH" | "tn" | "tn-ZA" | "tr-TR" | "tt" | "tt-RU" | "ts" | "uk" | "uk-UA" | "ur" | "ur-PK" | "uz" | "uz-UZ" | "vi" | "vi-VN" | "xh" | "xh-ZA" | "zh" | "zh-Hans" | "zh-CN" | "zh-HK" | "zh-MO" | "zh-SG" | "zh-Hant" | "zu" | "zu-ZA";
|
|
7
7
|
content: Content;
|
|
8
8
|
t: <Content_1 = string>(languageContent: LanguageContent<Content_1>) => Content_1;
|
|
9
9
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Locales } from '@intlayer/config/client';
|
|
2
|
+
import { type Dictionary } from '@intlayer/core';
|
|
2
3
|
/**
|
|
3
4
|
* On the server side, Hook that transform a dictionary and return the content
|
|
4
5
|
*
|
|
5
6
|
* If the locale is not provided, it will use the locale from the client context
|
|
6
7
|
*/
|
|
7
|
-
export declare const useDictionary:
|
|
8
|
+
export declare const useDictionary: <T extends Dictionary>(dictionary: T, locale?: Locales) => import("@intlayer/core").DeepTransformContent<T["content"], import("../plugins").IInterpreterPluginState>;
|
|
8
9
|
//# sourceMappingURL=useDictionary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionary.d.ts","sourceRoot":"","sources":["../../../src/client/useDictionary.ts"],"names":[],"mappings":"
|
|
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,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Locales } from '@intlayer/config/client';
|
|
2
|
+
import { type DictionaryKeys } from '@intlayer/core';
|
|
3
|
+
import { IntlayerDictionaryTypesConnector } from 'intlayer';
|
|
2
4
|
/**
|
|
3
5
|
* On the client side, Hook that picking one dictionary by its key and return the content
|
|
4
6
|
*
|
|
5
7
|
* If the locale is not provided, it will use the locale from the client context
|
|
6
8
|
*/
|
|
7
|
-
export declare const useIntlayer:
|
|
9
|
+
export declare const useIntlayer: <T extends DictionaryKeys>(key: T, locale?: Locales) => import("@intlayer/core").DeepTransformContent<IntlayerDictionaryTypesConnector[T]["content"], import("../plugins").IInterpreterPluginState>;
|
|
8
10
|
//# sourceMappingURL=useIntlayer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIntlayer.d.ts","sourceRoot":"","sources":["../../../src/client/useIntlayer.ts"],"names":[],"mappings":"
|
|
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,8 +1,5 @@
|
|
|
1
1
|
import type { Locales } from '@intlayer/config/client';
|
|
2
|
-
import {
|
|
3
|
-
export type UseIntlayerAsync = <T extends DictionaryKeys, L extends Locales, R extends boolean = true>(key: T, locale?: L, isRenderEditor?: R) => DataFromDictionaryKey<T, L, R> & {
|
|
4
|
-
isLoading: boolean;
|
|
5
|
-
};
|
|
2
|
+
import { type DictionaryKeys } from '@intlayer/core';
|
|
6
3
|
/**
|
|
7
4
|
* On the client side, Hook that picking one dictionary by its key and return the content
|
|
8
5
|
*
|
|
@@ -11,5 +8,7 @@ export type UseIntlayerAsync = <T extends DictionaryKeys, L extends Locales, R e
|
|
|
11
8
|
*
|
|
12
9
|
* If the locale is not provided, it will use the locale from the client context
|
|
13
10
|
*/
|
|
14
|
-
export declare const useIntlayerAsync:
|
|
11
|
+
export declare const useIntlayerAsync: <T extends DictionaryKeys>(key: T, locale?: Locales | `${Locales}`, isRenderEditor?: boolean) => import("@intlayer/core").DeepTransformContent<import("intlayer").IntlayerDictionaryTypesConnector[T]["content"], import("@intlayer/core").IInterpreterPluginState> & {
|
|
12
|
+
isLoading: boolean;
|
|
13
|
+
};
|
|
15
14
|
//# sourceMappingURL=useIntlayerAsync.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIntlayerAsync.d.ts","sourceRoot":"","sources":["../../../src/client/useIntlayerAsync.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"useIntlayerAsync.d.ts","sourceRoot":"","sources":["../../../src/client/useIntlayerAsync.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAGvD,OAAO,EAEL,KAAK,cAAc,EAGpB,MAAM,gBAAgB,CAAC;AAExB;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,cAAc,OAClD,CAAC,WACG,OAAO,GAAG,GAAG,OAAO,EAAE,+BA8BoB,qKAA0B;IAC3E,SAAS,EAAE,OAAO,CAAC;CAEtB,CAAC"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { type Locales } from '@intlayer/config';
|
|
2
2
|
type useLocaleProps = {
|
|
3
|
-
onLocaleChange?: (locale: Locales) => void;
|
|
3
|
+
onLocaleChange?: (locale: Locales | `${Locales}`) => void;
|
|
4
4
|
};
|
|
5
5
|
/**
|
|
6
6
|
* On the client side, hook to get the current locale and all related fields
|
|
7
7
|
*/
|
|
8
8
|
export declare const useLocale: ({ onLocaleChange }?: useLocaleProps) => {
|
|
9
|
-
locale: Locales;
|
|
9
|
+
locale: "hr" | "th" | "tr" | "id" | "is" | Locales | "af" | "af-ZA" | "ar" | "ar-AE" | "ar-BH" | "ar-DZ" | "ar-EG" | "ar-IQ" | "ar-JO" | "ar-KW" | "ar-LB" | "ar-LY" | "ar-MA" | "ar-OM" | "ar-QA" | "ar-SA" | "ar-SY" | "ar-TN" | "ar-YE" | "az" | "az-AZ" | "be" | "be-BY" | "bg" | "bg-BG" | "bs" | "bs-BA" | "ca" | "ca-ES" | "cs" | "cs-CZ" | "cy" | "cy-GB" | "da" | "da-DK" | "de" | "de-AT" | "de-CH" | "de-DE" | "de-LI" | "de-LU" | "dv" | "dv-MV" | "el" | "el-GR" | "en" | "en-AU" | "en-BZ" | "en-CA" | "en-CB" | "en-GB" | "en-IE" | "en-JM" | "en-NZ" | "en-PH" | "en-TT" | "en-US" | "en-ZA" | "en-ZW" | "eo" | "es" | "es-AR" | "es-BO" | "es-CL" | "es-CO" | "es-CR" | "es-DO" | "es-EC" | "es-ES" | "es-GT" | "es-HN" | "es-MX" | "es-NI" | "es-PA" | "es-PE" | "es-PR" | "es-PY" | "es-SV" | "es-UY" | "es-VE" | "et" | "et-EE" | "eu" | "eu-ES" | "fa" | "fa-IR" | "fi" | "fi-FI" | "fo" | "fo-FO" | "fr" | "fr-BE" | "fr-CA" | "fr-CH" | "fr-FR" | "fr-LU" | "fr-MC" | "gl" | "gl-ES" | "gu" | "gu-IN" | "he" | "he-IL" | "hi" | "hi-IN" | "hr-BA" | "hr-HR" | "hu" | "hu-HU" | "hy" | "hy-AM" | "id-ID" | "is-IS" | "it" | "it-CH" | "it-IT" | "ja" | "ja-JP" | "ka" | "ka-GE" | "kk" | "kk-KZ" | "kn" | "kn-IN" | "ko" | "ko-KR" | "kok" | "kok-IN" | "ky" | "ky-KG" | "lt" | "lt-LT" | "lv" | "lv-LV" | "mi" | "mi-NZ" | "mk" | "mk-MK" | "mn" | "mn-MN" | "mr" | "mr-IN" | "ms" | "ms-BN" | "ms-MY" | "mt" | "mt-MT" | "nb" | "nb-NO" | "nl" | "nl-BE" | "nl-NL" | "nn-NO" | "ns" | "ns-ZA" | "pa" | "pa-IN" | "pl" | "pl-PL" | "ps" | "ps-AR" | "pt" | "pt-BR" | "pt-PT" | "qu" | "qu-BO" | "qu-EC" | "qu-PE" | "ro" | "ro-RO" | "ru" | "ru-RU" | "sa" | "sa-IN" | "se" | "se-FI" | "se-NO" | "se-SE" | "sk" | "sk-SK" | "sl" | "sl-SI" | "sq" | "sq-AL" | "sr" | "sr-BA" | "sr-SP" | "sv" | "sv-FI" | "sv-SE" | "sw" | "sw-KE" | "syr" | "syr-SY" | "ta" | "ta-IN" | "te" | "te-IN" | "th-TH" | "tl" | "tl-PH" | "tn" | "tn-ZA" | "tr-TR" | "tt" | "tt-RU" | "ts" | "uk" | "uk-UA" | "ur" | "ur-PK" | "uz" | "uz-UZ" | "vi" | "vi-VN" | "xh" | "xh-ZA" | "zh" | "zh-Hans" | "zh-CN" | "zh-HK" | "zh-MO" | "zh-SG" | "zh-Hant" | "zu" | "zu-ZA";
|
|
10
10
|
defaultLocale: Locales;
|
|
11
11
|
availableLocales: Locales[];
|
|
12
12
|
localeList: Locales[];
|
|
13
|
-
setLocale: (locale: Locales) => void;
|
|
13
|
+
setLocale: (locale: Locales | `${Locales}`) => void;
|
|
14
14
|
};
|
|
15
15
|
export {};
|
|
16
16
|
//# sourceMappingURL=useLocale.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocale.d.ts","sourceRoot":"","sources":["../../../src/client/useLocale.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAOhD,KAAK,cAAc,GAAG;IACpB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"useLocale.d.ts","sourceRoot":"","sources":["../../../src/client/useLocale.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAOhD,KAAK,cAAc,GAAG;IACpB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,GAAG,GAAG,OAAO,EAAE,KAAK,IAAI,CAAC;CAC3D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,wBAAwB,cAAc;;;;;wBAsB/C,OAAO,GAAG,GAAG,OAAO,EAAE;CA0BlC,CAAC"}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* On the client side, hook to get the current locale and all related fields
|
|
3
3
|
*/
|
|
4
4
|
export declare const useLocaleBase: () => {
|
|
5
|
-
locale: import("intlayer").Locales;
|
|
5
|
+
locale: "hr" | "th" | "tr" | "id" | "is" | import("intlayer").Locales | "af" | "af-ZA" | "ar" | "ar-AE" | "ar-BH" | "ar-DZ" | "ar-EG" | "ar-IQ" | "ar-JO" | "ar-KW" | "ar-LB" | "ar-LY" | "ar-MA" | "ar-OM" | "ar-QA" | "ar-SA" | "ar-SY" | "ar-TN" | "ar-YE" | "az" | "az-AZ" | "be" | "be-BY" | "bg" | "bg-BG" | "bs" | "bs-BA" | "ca" | "ca-ES" | "cs" | "cs-CZ" | "cy" | "cy-GB" | "da" | "da-DK" | "de" | "de-AT" | "de-CH" | "de-DE" | "de-LI" | "de-LU" | "dv" | "dv-MV" | "el" | "el-GR" | "en" | "en-AU" | "en-BZ" | "en-CA" | "en-CB" | "en-GB" | "en-IE" | "en-JM" | "en-NZ" | "en-PH" | "en-TT" | "en-US" | "en-ZA" | "en-ZW" | "eo" | "es" | "es-AR" | "es-BO" | "es-CL" | "es-CO" | "es-CR" | "es-DO" | "es-EC" | "es-ES" | "es-GT" | "es-HN" | "es-MX" | "es-NI" | "es-PA" | "es-PE" | "es-PR" | "es-PY" | "es-SV" | "es-UY" | "es-VE" | "et" | "et-EE" | "eu" | "eu-ES" | "fa" | "fa-IR" | "fi" | "fi-FI" | "fo" | "fo-FO" | "fr" | "fr-BE" | "fr-CA" | "fr-CH" | "fr-FR" | "fr-LU" | "fr-MC" | "gl" | "gl-ES" | "gu" | "gu-IN" | "he" | "he-IL" | "hi" | "hi-IN" | "hr-BA" | "hr-HR" | "hu" | "hu-HU" | "hy" | "hy-AM" | "id-ID" | "is-IS" | "it" | "it-CH" | "it-IT" | "ja" | "ja-JP" | "ka" | "ka-GE" | "kk" | "kk-KZ" | "kn" | "kn-IN" | "ko" | "ko-KR" | "kok" | "kok-IN" | "ky" | "ky-KG" | "lt" | "lt-LT" | "lv" | "lv-LV" | "mi" | "mi-NZ" | "mk" | "mk-MK" | "mn" | "mn-MN" | "mr" | "mr-IN" | "ms" | "ms-BN" | "ms-MY" | "mt" | "mt-MT" | "nb" | "nb-NO" | "nl" | "nl-BE" | "nl-NL" | "nn-NO" | "ns" | "ns-ZA" | "pa" | "pa-IN" | "pl" | "pl-PL" | "ps" | "ps-AR" | "pt" | "pt-BR" | "pt-PT" | "qu" | "qu-BO" | "qu-EC" | "qu-PE" | "ro" | "ro-RO" | "ru" | "ru-RU" | "sa" | "sa-IN" | "se" | "se-FI" | "se-NO" | "se-SE" | "sk" | "sk-SK" | "sl" | "sl-SI" | "sq" | "sq-AL" | "sr" | "sr-BA" | "sr-SP" | "sv" | "sv-FI" | "sv-SE" | "sw" | "sw-KE" | "syr" | "syr-SY" | "ta" | "ta-IN" | "te" | "te-IN" | "th-TH" | "tl" | "tl-PH" | "tn" | "tn-ZA" | "tr-TR" | "tt" | "tt-RU" | "ts" | "uk" | "uk-UA" | "ur" | "ur-PK" | "uz" | "uz-UZ" | "vi" | "vi-VN" | "xh" | "xh-ZA" | "zh" | "zh-Hans" | "zh-CN" | "zh-HK" | "zh-MO" | "zh-SG" | "zh-Hant" | "zu" | "zu-ZA";
|
|
6
6
|
defaultLocale: import("intlayer").Locales;
|
|
7
7
|
availableLocales: import("intlayer").Locales[];
|
|
8
8
|
localeList: import("intlayer").Locales[];
|
|
9
|
-
setLocale: (newLocale: import("intlayer").Locales) => void;
|
|
9
|
+
setLocale: (newLocale: import("intlayer").Locales | `${import("intlayer").Locales}`) => void;
|
|
10
10
|
};
|
|
11
11
|
//# sourceMappingURL=useLocaleBase.d.ts.map
|
|
@@ -2,16 +2,16 @@ import { type Locales } from '@intlayer/config/client';
|
|
|
2
2
|
/**
|
|
3
3
|
* Get the locale cookie
|
|
4
4
|
*/
|
|
5
|
-
export declare const localeCookie: Locales | undefined;
|
|
5
|
+
export declare const localeCookie: Locales | `${Locales}` | undefined;
|
|
6
6
|
/**
|
|
7
7
|
* Set the locale cookie
|
|
8
8
|
*/
|
|
9
|
-
export declare const setLocaleCookie: (locale: Locales) => void;
|
|
9
|
+
export declare const setLocaleCookie: (locale: Locales | `${Locales}`) => void;
|
|
10
10
|
/**
|
|
11
11
|
* Hook that provides the locale cookie and a function to set it
|
|
12
12
|
*/
|
|
13
13
|
export declare const useLocaleCookie: () => {
|
|
14
|
-
localeCookie: Locales;
|
|
15
|
-
setLocaleCookie: (locale: Locales) => void;
|
|
14
|
+
localeCookie: "hr" | "th" | "tr" | "id" | "is" | Locales | "af" | "af-ZA" | "ar" | "ar-AE" | "ar-BH" | "ar-DZ" | "ar-EG" | "ar-IQ" | "ar-JO" | "ar-KW" | "ar-LB" | "ar-LY" | "ar-MA" | "ar-OM" | "ar-QA" | "ar-SA" | "ar-SY" | "ar-TN" | "ar-YE" | "az" | "az-AZ" | "be" | "be-BY" | "bg" | "bg-BG" | "bs" | "bs-BA" | "ca" | "ca-ES" | "cs" | "cs-CZ" | "cy" | "cy-GB" | "da" | "da-DK" | "de" | "de-AT" | "de-CH" | "de-DE" | "de-LI" | "de-LU" | "dv" | "dv-MV" | "el" | "el-GR" | "en" | "en-AU" | "en-BZ" | "en-CA" | "en-CB" | "en-GB" | "en-IE" | "en-JM" | "en-NZ" | "en-PH" | "en-TT" | "en-US" | "en-ZA" | "en-ZW" | "eo" | "es" | "es-AR" | "es-BO" | "es-CL" | "es-CO" | "es-CR" | "es-DO" | "es-EC" | "es-ES" | "es-GT" | "es-HN" | "es-MX" | "es-NI" | "es-PA" | "es-PE" | "es-PR" | "es-PY" | "es-SV" | "es-UY" | "es-VE" | "et" | "et-EE" | "eu" | "eu-ES" | "fa" | "fa-IR" | "fi" | "fi-FI" | "fo" | "fo-FO" | "fr" | "fr-BE" | "fr-CA" | "fr-CH" | "fr-FR" | "fr-LU" | "fr-MC" | "gl" | "gl-ES" | "gu" | "gu-IN" | "he" | "he-IL" | "hi" | "hi-IN" | "hr-BA" | "hr-HR" | "hu" | "hu-HU" | "hy" | "hy-AM" | "id-ID" | "is-IS" | "it" | "it-CH" | "it-IT" | "ja" | "ja-JP" | "ka" | "ka-GE" | "kk" | "kk-KZ" | "kn" | "kn-IN" | "ko" | "ko-KR" | "kok" | "kok-IN" | "ky" | "ky-KG" | "lt" | "lt-LT" | "lv" | "lv-LV" | "mi" | "mi-NZ" | "mk" | "mk-MK" | "mn" | "mn-MN" | "mr" | "mr-IN" | "ms" | "ms-BN" | "ms-MY" | "mt" | "mt-MT" | "nb" | "nb-NO" | "nl" | "nl-BE" | "nl-NL" | "nn-NO" | "ns" | "ns-ZA" | "pa" | "pa-IN" | "pl" | "pl-PL" | "ps" | "ps-AR" | "pt" | "pt-BR" | "pt-PT" | "qu" | "qu-BO" | "qu-EC" | "qu-PE" | "ro" | "ro-RO" | "ru" | "ru-RU" | "sa" | "sa-IN" | "se" | "se-FI" | "se-NO" | "se-SE" | "sk" | "sk-SK" | "sl" | "sl-SI" | "sq" | "sq-AL" | "sr" | "sr-BA" | "sr-SP" | "sv" | "sv-FI" | "sv-SE" | "sw" | "sw-KE" | "syr" | "syr-SY" | "ta" | "ta-IN" | "te" | "te-IN" | "th-TH" | "tl" | "tl-PH" | "tn" | "tn-ZA" | "tr-TR" | "tt" | "tt-RU" | "ts" | "uk" | "uk-UA" | "ur" | "ur-PK" | "uz" | "uz-UZ" | "vi" | "vi-VN" | "xh" | "xh-ZA" | "zh" | "zh-Hans" | "zh-CN" | "zh-HK" | "zh-MO" | "zh-SG" | "zh-Hant" | "zu" | "zu-ZA";
|
|
15
|
+
setLocaleCookie: (locale: Locales | `${Locales}`) => void;
|
|
16
16
|
};
|
|
17
17
|
//# sourceMappingURL=useLocaleCookie.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocaleCookie.d.ts","sourceRoot":"","sources":["../../../src/client/useLocaleCookie.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAoB,MAAM,yBAAyB,CAAC;AAazE;;GAEG;AACH,eAAO,MAAM,YAAY,EACrB,OAAO,GACP,SAAS,CAAC;AAEd;;GAEG;AACH,eAAO,MAAM,eAAe,WAAY,OAAO,
|
|
1
|
+
{"version":3,"file":"useLocaleCookie.d.ts","sourceRoot":"","sources":["../../../src/client/useLocaleCookie.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAoB,MAAM,yBAAyB,CAAC;AAazE;;GAEG;AACH,eAAO,MAAM,YAAY,EACrB,OAAO,GACP,GAAG,OAAO,EAAE,GACZ,SAAS,CAAC;AAEd;;GAEG;AACH,eAAO,MAAM,eAAe,WAAY,OAAO,GAAG,GAAG,OAAO,EAAE,SAE7D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe;;8BAPY,OAAO,GAAG,GAAG,OAAO,EAAE;CAU5D,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type LanguageContent } from '@intlayer/core';
|
|
2
2
|
/**
|
|
3
3
|
* On the client side, Hook that picking one dictionary by its id and return the content.
|
|
4
4
|
*
|
|
@@ -9,7 +9,7 @@ import type { LanguageContent } from '@intlayer/core';
|
|
|
9
9
|
* Usage:
|
|
10
10
|
*
|
|
11
11
|
* ```tsx
|
|
12
|
-
* const content =
|
|
12
|
+
* const content = useTranslation<string>({
|
|
13
13
|
* en: 'Hello',
|
|
14
14
|
* fr: 'Bonjour',
|
|
15
15
|
* }, 'fr');
|
|
@@ -20,5 +20,5 @@ import type { LanguageContent } from '@intlayer/core';
|
|
|
20
20
|
* - this function will require each locale to be defined if defined in the project configuration.
|
|
21
21
|
* - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.
|
|
22
22
|
*/
|
|
23
|
-
export declare const
|
|
23
|
+
export declare const useTranslation: <Content = string>(languageContent: LanguageContent<Content>) => Content;
|
|
24
24
|
//# sourceMappingURL=useTraduction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTraduction.d.ts","sourceRoot":"","sources":["../../../src/client/useTraduction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"useTraduction.d.ts","sourceRoot":"","sources":["../../../src/client/useTraduction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAItE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,4BACnB,eAAe,CAAC,OAAO,CAAC,KACxC,OAIF,CAAC"}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type NodeProps } from '@intlayer/core';
|
|
2
2
|
import { type FC, HTMLAttributes } from 'react';
|
|
3
|
-
type
|
|
4
|
-
dictionaryKey: string;
|
|
5
|
-
dictionaryPath: string;
|
|
6
|
-
keyPath: KeyPath[];
|
|
7
|
-
};
|
|
8
|
-
export type ContentSelectorWrapperProps = ContentData & HTMLAttributes<HTMLDivElement>;
|
|
3
|
+
export type ContentSelectorWrapperProps = NodeProps & Omit<HTMLAttributes<HTMLDivElement>, 'content'>;
|
|
9
4
|
export declare const ContentSelectorWrapper: FC<ContentSelectorWrapperProps>;
|
|
10
|
-
export {};
|
|
11
5
|
//# sourceMappingURL=ContentSelectorWrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentSelectorWrapper.d.ts","sourceRoot":"","sources":["../../../src/editor/ContentSelectorWrapper.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"ContentSelectorWrapper.d.ts","sourceRoot":"","sources":["../../../src/editor/ContentSelectorWrapper.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAiB,MAAM,gBAAgB,CAAC;AAM/D,OAAO,EAKL,KAAK,EAAE,EAEP,cAAc,EACf,MAAM,OAAO,CAAC;AAGf,MAAM,MAAM,2BAA2B,GAAG,SAAS,GACjD,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,SAAS,CAAC,CAAC;AAqDlD,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,2BAA2B,CAelE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntlayerEditorProvider.d.ts","sourceRoot":"","sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"IntlayerEditorProvider.d.ts","sourceRoot":"","sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"names":[],"mappings":"AAqBA,OAAO,EAAa,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAwDnE,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,iBAAiB,CA4CxD,CAAC"}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
1
|
import { type ContentSelectorWrapperProps } from './ContentSelectorWrapper';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export type RenderIntlayerEditorProps = Omit<ContentSelectorWrapperProps, 'children'> & {
|
|
7
|
-
content: string;
|
|
8
|
-
};
|
|
2
|
+
import { type NodeProps } from '@intlayer/core';
|
|
3
|
+
import { IntlayerNode } from '../IntlayerNode';
|
|
4
|
+
export type RenderIntlayerEditorProps = Omit<ContentSelectorWrapperProps, 'children' | 'content'> & NodeProps;
|
|
9
5
|
export declare const renderIntlayerEditor: (props: RenderIntlayerEditorProps) => IntlayerNode;
|
|
10
6
|
//# sourceMappingURL=renderContentEditor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderContentEditor.d.ts","sourceRoot":"","sources":["../../../src/editor/renderContentEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"renderContentEditor.d.ts","sourceRoot":"","sources":["../../../src/editor/renderContentEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,2BAA2B,EACjC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAwB,MAAM,iBAAiB,CAAC;AAErE,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAC1C,2BAA2B,EAC3B,UAAU,GAAG,SAAS,CACvB,GACC,SAAS,CAAC;AAEZ,eAAO,MAAM,oBAAoB,UACxB,yBAAyB,KAC/B,YAQC,CAAC"}
|
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export type UseDictionary = <T extends DeclarationContent, L extends Locales, R extends boolean = false>(dictionary: T, locale?: L, isRenderEditor?: R, isContentSelectable?: boolean) => DataFromDictionary<T, L, R>;
|
|
6
|
-
/**
|
|
7
|
-
* Hook that picks one dictionary by its id and return the content
|
|
8
|
-
*
|
|
9
|
-
* If the locale is not provided, it will use the locale from the client context
|
|
10
|
-
*/
|
|
11
|
-
export declare const getDictionary: UseDictionary;
|
|
12
|
-
export {};
|
|
1
|
+
import { type Dictionary, type Plugins } from '@intlayer/core';
|
|
2
|
+
import { type DeepTransformContent } from './plugins';
|
|
3
|
+
import type { Locales } from '@intlayer/config/client';
|
|
4
|
+
export declare const getDictionary: <T extends Dictionary, L extends Locales | `${Locales}` = Locales>(dictionary: T, locale?: L, additionalPlugins?: Plugins[]) => DeepTransformContent<T["content"]>;
|
|
13
5
|
//# sourceMappingURL=getDictionary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDictionary.d.ts","sourceRoot":"","sources":["../../src/getDictionary.ts"],"names":[],"mappings":"
|
|
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,MAAM,yBAAyB,CAAC;AAEvD,eAAO,MAAM,aAAa,GACxB,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,OAAO,GAAG,GAAG,OAAO,EAAE,wBAEpB,CAAC,WACJ,CAAC,sBACU,OAAO,EAAE,KAajB,oBAAoB,CAAC,CAAC,CAAC,SAAS,CAAC,CAC9C,CAAC"}
|
|
@@ -1,35 +1,5 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
* Provides a fallback to string type if the generic type T is never,
|
|
6
|
-
* otherwise returns T. This is useful for handling cases where no keys are found.
|
|
7
|
-
* Example: StringFallback<never> -> string; StringFallback<'key'> -> 'key'
|
|
8
|
-
*/
|
|
9
|
-
export type StringFallback<T> = T extends never ? string : T;
|
|
10
|
-
/**
|
|
11
|
-
* Represents the keys of the IntlayerDictionaryTypesConnector,
|
|
12
|
-
* ensuring they are valid dictionary keys or fallback to string if none exist.
|
|
13
|
-
*
|
|
14
|
-
* Example:
|
|
15
|
-
* ```ts
|
|
16
|
-
* DictionaryKeys -> 'key1' | 'key2'
|
|
17
|
-
* // or if IntlayerDictionaryTypesConnector is not defined,
|
|
18
|
-
* DictionaryKeys -> string
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export type DictionaryKeys = StringFallback<keyof IntlayerDictionaryTypesConnector>;
|
|
22
|
-
/**
|
|
23
|
-
* Represents the data type returned by the useIntlayer hook,
|
|
24
|
-
* excluding the 'id' and 'filePath' keys from the dictionary content.
|
|
25
|
-
*/
|
|
26
|
-
export type DataFromDictionaryKey<T extends DictionaryKeys, K extends Locales, R extends boolean = false> = DeepTransformContent<IntlayerDictionaryTypesConnector[T]['content'], K, R>;
|
|
27
|
-
/**
|
|
28
|
-
* Type definition for the useIntlayer hook, which takes a dictionary ID and an optional locale,
|
|
29
|
-
* and returns the deeply transformed dictionary content.
|
|
30
|
-
*
|
|
31
|
-
*/
|
|
32
|
-
export type UseIntlayer = <T extends DictionaryKeys, L extends Locales, R extends boolean = false>(key: T, locale?: L, isRenderEditor?: R, isContentSelectable?: boolean) => DataFromDictionaryKey<T, L, R>;
|
|
33
|
-
export type UseIntlayerEditable = <T extends DictionaryKeys, L extends Locales, R extends boolean = true>(key: T, locale?: L, isRenderEditor?: R, isContentSelectable?: boolean) => DataFromDictionaryKey<T, L, R>;
|
|
34
|
-
export declare const getIntlayer: UseIntlayer;
|
|
1
|
+
import { type DictionaryKeys, type Plugins } from '@intlayer/core';
|
|
2
|
+
import { type DeepTransformContent } from './plugins';
|
|
3
|
+
import type { IntlayerDictionaryTypesConnector, Locales } from 'intlayer';
|
|
4
|
+
export declare const getIntlayer: <T extends DictionaryKeys, L extends Locales | `${Locales}`>(key: T, locale?: L, additionalPlugins?: Plugins[]) => DeepTransformContent<IntlayerDictionaryTypesConnector[T]["content"]>;
|
|
35
5
|
//# sourceMappingURL=getIntlayer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getIntlayer.d.ts","sourceRoot":"","sources":["../../src/getIntlayer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getIntlayer.d.ts","sourceRoot":"","sources":["../../src/getIntlayer.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,OAAO,EAEb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,oBAAoB,EAI1B,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,gCAAgC,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAE1E,eAAO,MAAM,WAAW,GACtB,CAAC,SAAS,cAAc,EACxB,CAAC,SAAS,OAAO,GAAG,GAAG,OAAO,EAAE,OAE3B,CAAC,WACG,CAAC,sBACU,OAAO,EAAE,KAS0B,oBAAoB,CACzE,gCAAgC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAEjD,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { IInterpreterPluginReact } from './plugins';
|
|
2
|
+
declare module '@intlayer/core' {
|
|
3
|
+
interface IInterpreterPlugin<T, S> extends IInterpreterPluginReact<T, S> {
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
export { IntlayerProvider, type IntlayerProviderProps, IntlayerClientContext, useIntlayer, useIntlayerAsync, useDictionary, useLocale, useLocaleCookie, useIntlayerContext, localeCookie, setLocaleCookie, getBrowserLocale, useLocaleBase, t, } from './client/index';
|
|
7
|
+
export { type IntlayerNode } from './IntlayerNode';
|
|
8
|
+
export { MarkdownProvider } from './markdown/index';
|
|
6
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
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,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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type FC, type PropsWithChildren, type ReactNode } from 'react';
|
|
2
|
+
type MarkdownContextValue = {
|
|
3
|
+
renderMarkdown: (markdown: string) => ReactNode;
|
|
4
|
+
};
|
|
5
|
+
type MarkdownProviderProps = PropsWithChildren<MarkdownContextValue>;
|
|
6
|
+
export declare const useMarkdownContext: () => MarkdownContextValue;
|
|
7
|
+
export declare const MarkdownProvider: FC<MarkdownProviderProps>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=MarkdownProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownProvider.d.ts","sourceRoot":"","sources":["../../../src/markdown/MarkdownProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,EAAE,EACP,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,KAAK,oBAAoB,GAAG;IAC1B,cAAc,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,SAAS,CAAC;CACjD,CAAC;AAEF,KAAK,qBAAqB,GAAG,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;AAMrE,eAAO,MAAM,kBAAkB,4BAAoC,CAAC;AAEpE,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAOtD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownRenderer.d.ts","sourceRoot":"","sources":["../../../src/markdown/MarkdownRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAI3B,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CASrD,CAAC"}
|