react-intlayer 1.0.0 → 1.0.1
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/dist/cjs/ContentEditor/ContentEditor.cjs +36 -39
- package/dist/cjs/ContentEditor/ContentEditor.d.ts +2 -2
- package/dist/cjs/ContentEditor/contentRender.cjs +10 -18
- package/dist/cjs/ContentEditor/index.cjs +11 -27
- package/dist/cjs/ContentEditor/index.d.ts +3 -3
- package/dist/cjs/LocaleContextProvider.cjs +14 -26
- package/dist/cjs/LocaleContextProvider.d.ts +5 -6
- package/dist/cjs/client/LocaleClientContextProvider.cjs +14 -26
- package/dist/cjs/client/LocaleClientContextProvider.d.ts +6 -11
- package/dist/cjs/client/index.cjs +23 -30
- package/dist/cjs/client/index.d.ts +10 -19
- package/dist/cjs/client/useContent.cjs +11 -16
- package/dist/cjs/client/useContent.d.ts +7 -8
- package/dist/cjs/client/useIntlayer.cjs +11 -18
- package/dist/cjs/client/useIntlayer.d.ts +3 -3
- package/dist/cjs/client/useLocale.cjs +12 -20
- package/dist/cjs/client/useLocale.d.ts +5 -5
- package/dist/cjs/client/useLocaleCookie.cjs +20 -30
- package/dist/cjs/client/useLocaleCookie.d.ts +3 -3
- package/dist/cjs/client/useTraduction.cjs +11 -18
- package/dist/cjs/client/useTraduction.d.ts +2 -4
- package/dist/cjs/getEnumeration.cjs +9 -14
- package/dist/cjs/getEnumeration.d.ts +2 -5
- package/dist/cjs/getTranslation.cjs +9 -14
- package/dist/cjs/getTranslation.d.ts +3 -6
- package/dist/cjs/index.cjs +19 -24
- package/dist/cjs/index.d.ts +11 -20
- package/dist/cjs/processDictionary/contentDictionary.d.cjs +4 -8
- package/dist/cjs/processDictionary/contentDictionary.d.d.ts +6 -9
- package/dist/cjs/processDictionary/index.cjs +15 -17
- package/dist/cjs/processDictionary/index.d.ts +5 -16
- package/dist/cjs/server/LocaleServerContextProvider.cjs +12 -21
- package/dist/cjs/server/LocaleServerContextProvider.d.ts +16 -26
- package/dist/cjs/server/getLocaleTranslation.cjs +12 -19
- package/dist/cjs/server/getLocaleTranslation.d.ts +5 -7
- package/dist/cjs/server/index.cjs +19 -26
- package/dist/cjs/server/index.d.ts +9 -13
- package/dist/cjs/server/serverContext.cjs +25 -31
- package/dist/cjs/server/serverContext.d.ts +12 -20
- package/dist/cjs/server/useIntlayer.cjs +12 -21
- package/dist/cjs/server/useIntlayer.d.ts +3 -3
- package/dist/cjs/server/useTraduction.cjs +12 -19
- package/dist/cjs/server/useTraduction.d.ts +2 -4
- package/dist/cjs/useIntlayerBase.cjs +22 -31
- package/dist/cjs/useIntlayerBase.d.ts +4 -12
- package/dist/esm/ContentEditor/ContentEditor.d.mts +2 -2
- package/dist/esm/ContentEditor/ContentEditor.mjs +38 -29
- package/dist/esm/ContentEditor/contentRender.mjs +5 -3
- package/dist/esm/ContentEditor/index.d.mts +3 -3
- package/dist/esm/ContentEditor/index.mjs +3 -3
- package/dist/esm/LocaleContextProvider.d.mts +5 -6
- package/dist/esm/LocaleContextProvider.mjs +14 -12
- package/dist/esm/client/LocaleClientContextProvider.d.mts +6 -11
- package/dist/esm/client/LocaleClientContextProvider.mjs +16 -11
- package/dist/esm/client/index.d.mts +10 -19
- package/dist/esm/client/index.mjs +9 -9
- package/dist/esm/client/useContent.d.mts +7 -8
- package/dist/esm/client/useContent.mjs +7 -5
- package/dist/esm/client/useIntlayer.d.mts +3 -3
- package/dist/esm/client/useIntlayer.mjs +8 -4
- package/dist/esm/client/useLocale.d.mts +5 -5
- package/dist/esm/client/useLocale.mjs +6 -4
- package/dist/esm/client/useLocaleCookie.d.mts +3 -3
- package/dist/esm/client/useLocaleCookie.mjs +11 -5
- package/dist/esm/client/useTraduction.d.mts +2 -4
- package/dist/esm/client/useTraduction.mjs +6 -4
- package/dist/esm/getEnumeration.d.mts +2 -5
- package/dist/esm/getEnumeration.mjs +9 -4
- package/dist/esm/getTranslation.d.mts +3 -6
- package/dist/esm/getTranslation.mjs +8 -4
- package/dist/esm/index.d.mts +11 -20
- package/dist/esm/index.mjs +5 -5
- package/dist/esm/processDictionary/contentDictionary.d.d.mts +6 -9
- package/dist/esm/processDictionary/contentDictionary.d.mjs +1 -1
- package/dist/esm/processDictionary/index.d.mts +5 -16
- package/dist/esm/processDictionary/index.mjs +25 -9
- package/dist/esm/server/LocaleServerContextProvider.d.mts +16 -26
- package/dist/esm/server/LocaleServerContextProvider.mjs +11 -9
- package/dist/esm/server/getLocaleTranslation.d.mts +5 -7
- package/dist/esm/server/getLocaleTranslation.mjs +7 -5
- package/dist/esm/server/index.d.mts +9 -13
- package/dist/esm/server/index.mjs +7 -7
- package/dist/esm/server/serverContext.d.mts +12 -20
- package/dist/esm/server/serverContext.mjs +13 -6
- package/dist/esm/server/useIntlayer.d.mts +3 -3
- package/dist/esm/server/useIntlayer.mjs +9 -5
- package/dist/esm/server/useTraduction.d.mts +2 -4
- package/dist/esm/server/useTraduction.mjs +7 -5
- package/dist/esm/useIntlayerBase.d.mts +4 -12
- package/dist/esm/useIntlayerBase.mjs +9 -4
- package/package.json +8 -8
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
useEffect,
|
|
5
|
+
useState,
|
|
6
|
+
useRef,
|
|
7
|
+
useCallback
|
|
8
|
+
} from "react";
|
|
4
9
|
const PRESS_DETECT_DURATION = 500;
|
|
5
10
|
const ContentEditor = ({ children }) => {
|
|
6
11
|
const divRef = useRef(null);
|
|
@@ -51,32 +56,36 @@ const ContentEditor = ({ children }) => {
|
|
|
51
56
|
const handleOnBlur = () => {
|
|
52
57
|
setIsEditing(false);
|
|
53
58
|
};
|
|
54
|
-
const onContentChange = (_e) => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
59
|
+
const onContentChange = (_e) => {
|
|
60
|
+
};
|
|
61
|
+
return /* @__PURE__ */ jsx(
|
|
62
|
+
"div",
|
|
63
|
+
{
|
|
64
|
+
role: "textbox",
|
|
65
|
+
tabIndex: 0,
|
|
66
|
+
onKeyUp: () => null,
|
|
67
|
+
contentEditable: isEditing,
|
|
68
|
+
onInput: onContentChange,
|
|
69
|
+
onClick: handleOnClick,
|
|
70
|
+
onMouseDown: handleMouseDown,
|
|
71
|
+
onMouseUp: handleMouseUp,
|
|
72
|
+
onMouseLeave: handleMouseUp,
|
|
73
|
+
onTouchStart: handleMouseDown,
|
|
74
|
+
onTouchEnd: handleMouseUp,
|
|
75
|
+
onTouchCancel: handleMouseUp,
|
|
76
|
+
onBlur: handleOnBlur,
|
|
77
|
+
suppressContentEditableWarning: true,
|
|
78
|
+
style: isEditing ? {
|
|
79
|
+
backgroundColor: "transparent",
|
|
80
|
+
cursor: "text",
|
|
81
|
+
display: "inline"
|
|
82
|
+
} : { cursor: "pointer", display: "inline" },
|
|
83
|
+
ref: divRef,
|
|
84
|
+
children
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
};
|
|
88
|
+
export {
|
|
89
|
+
ContentEditor
|
|
80
90
|
};
|
|
81
|
-
|
|
82
|
-
//# sourceMappingURL=ContentEditor.mjs.map
|
|
91
|
+
//# sourceMappingURL=ContentEditor.mjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ContentEditor } from
|
|
2
|
+
import { ContentEditor } from './ContentEditor.mjs';
|
|
3
3
|
const contentRender = (content) => {
|
|
4
4
|
const isEditable = process.env.NODE_ENV === "development";
|
|
5
5
|
if (isEditable && ContentEditor) {
|
|
@@ -7,5 +7,7 @@ const contentRender = (content) => {
|
|
|
7
7
|
}
|
|
8
8
|
return content;
|
|
9
9
|
};
|
|
10
|
-
export {
|
|
11
|
-
|
|
10
|
+
export {
|
|
11
|
+
contentRender
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=contentRender.mjs.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { ContentEditor } from
|
|
2
|
-
export { contentRender } from
|
|
3
|
-
import
|
|
1
|
+
export { ContentEditor } from './ContentEditor.mjs';
|
|
2
|
+
export { contentRender } from './contentRender.mjs';
|
|
3
|
+
import 'react';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
//# sourceMappingURL=index.mjs.map
|
|
1
|
+
export * from './ContentEditor.mjs';
|
|
2
|
+
export * from './contentRender.mjs';
|
|
3
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { FC } from
|
|
2
|
-
import { LocaleClientContextProviderProps } from
|
|
3
|
-
import { LocaleServerContextProviderProps } from
|
|
4
|
-
import
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { LocaleClientContextProviderProps } from './client/LocaleClientContextProvider.mjs';
|
|
3
|
+
import { LocaleServerContextProviderProps } from './server/LocaleServerContextProvider.mjs';
|
|
4
|
+
import '@intlayer/config/client';
|
|
5
5
|
|
|
6
|
-
type LocaleContextProviderProps = LocaleClientContextProviderProps &
|
|
7
|
-
LocaleServerContextProviderProps;
|
|
6
|
+
type LocaleContextProviderProps = LocaleClientContextProviderProps & LocaleServerContextProviderProps;
|
|
8
7
|
declare const LocaleContextProvider: FC<LocaleContextProviderProps>;
|
|
9
8
|
|
|
10
9
|
export { LocaleContextProvider };
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { intlayerIntlConfiguration } from "@intlayer/config/client";
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
LocaleClientContextProvider
|
|
5
|
+
} from './client/LocaleClientContextProvider.mjs';
|
|
6
|
+
import {
|
|
7
|
+
LocaleServerContextProvider
|
|
8
|
+
} from './server/LocaleServerContextProvider.mjs';
|
|
5
9
|
const defaultLocale = intlayerIntlConfiguration.defaultLocale;
|
|
6
|
-
const LocaleContextProvider = ({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export { LocaleContextProvider };
|
|
15
|
-
//# sourceMappingURL=LocaleContextProvider.mjs.map
|
|
10
|
+
const LocaleContextProvider = ({
|
|
11
|
+
children,
|
|
12
|
+
locale = defaultLocale
|
|
13
|
+
}) => /* @__PURE__ */ jsx(LocaleServerContextProvider, { locale, children: /* @__PURE__ */ jsx(LocaleClientContextProvider, { locale, children }) });
|
|
14
|
+
export {
|
|
15
|
+
LocaleContextProvider
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=LocaleContextProvider.mjs.map
|
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
import * as react from
|
|
2
|
-
import { PropsWithChildren, FC } from
|
|
3
|
-
import { Locales } from
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { PropsWithChildren, FC } from 'react';
|
|
3
|
+
import { Locales } from '@intlayer/config/client';
|
|
4
4
|
|
|
5
5
|
type LocaleContextValue = {
|
|
6
|
-
|
|
6
|
+
locale: Locales;
|
|
7
7
|
};
|
|
8
8
|
declare const LocaleClientContext: react.Context<LocaleContextValue>;
|
|
9
9
|
declare const useLocaleContext: () => LocaleContextValue;
|
|
10
10
|
type LocaleClientContextProviderProps = PropsWithChildren & {
|
|
11
|
-
|
|
11
|
+
locale: Locales;
|
|
12
12
|
};
|
|
13
13
|
declare const LocaleClientContextProvider: FC<LocaleClientContextProviderProps>;
|
|
14
14
|
|
|
15
|
-
export {
|
|
16
|
-
LocaleClientContext,
|
|
17
|
-
LocaleClientContextProvider,
|
|
18
|
-
type LocaleClientContextProviderProps,
|
|
19
|
-
useLocaleContext,
|
|
20
|
-
};
|
|
15
|
+
export { LocaleClientContext, LocaleClientContextProvider, type LocaleClientContextProviderProps, useLocaleContext };
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import {
|
|
4
|
+
intlayerIntlConfiguration
|
|
5
|
+
} from "@intlayer/config/client";
|
|
6
|
+
import {
|
|
7
|
+
createContext,
|
|
8
|
+
useContext
|
|
9
|
+
} from "react";
|
|
10
|
+
import { localeCookie } from './useLocaleCookie.mjs';
|
|
6
11
|
const LocaleClientContext = createContext({
|
|
7
|
-
locale: localeCookie ?? intlayerIntlConfiguration.defaultLocale
|
|
12
|
+
locale: localeCookie ?? intlayerIntlConfiguration.defaultLocale
|
|
8
13
|
});
|
|
9
14
|
const useLocaleContext = () => useContext(LocaleClientContext);
|
|
10
|
-
const LocaleClientContextProvider = ({ locale, children }) =>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
//# sourceMappingURL=LocaleClientContextProvider.mjs.map
|
|
15
|
+
const LocaleClientContextProvider = ({ locale, children }) => /* @__PURE__ */ jsx(LocaleClientContext.Provider, { value: { locale }, children });
|
|
16
|
+
export {
|
|
17
|
+
LocaleClientContext,
|
|
18
|
+
LocaleClientContextProvider,
|
|
19
|
+
useLocaleContext
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=LocaleClientContextProvider.mjs.map
|
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
localeCookie,
|
|
12
|
-
setLocaleCookie,
|
|
13
|
-
useLocaleCookie,
|
|
14
|
-
} from "./useLocaleCookie.mjs";
|
|
15
|
-
import "react";
|
|
16
|
-
import "@intlayer/config/client";
|
|
17
|
-
import "../useIntlayerBase.mjs";
|
|
18
|
-
import "intlayer";
|
|
19
|
-
import "@intlayer/core";
|
|
1
|
+
export { LocaleClientContext, LocaleClientContextProvider, LocaleClientContextProviderProps, useLocaleContext } from './LocaleClientContextProvider.mjs';
|
|
2
|
+
export { useIntlayer } from './useIntlayer.mjs';
|
|
3
|
+
export { useLocale } from './useLocale.mjs';
|
|
4
|
+
export { useTraduction } from './useTraduction.mjs';
|
|
5
|
+
export { localeCookie, setLocaleCookie, useLocaleCookie } from './useLocaleCookie.mjs';
|
|
6
|
+
import 'react';
|
|
7
|
+
import '@intlayer/config/client';
|
|
8
|
+
import '../useIntlayerBase.mjs';
|
|
9
|
+
import 'intlayer';
|
|
10
|
+
import '@intlayer/core';
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LocaleClientContext,
|
|
3
3
|
useLocaleContext,
|
|
4
|
-
LocaleClientContextProvider
|
|
5
|
-
} from
|
|
6
|
-
import { useIntlayer } from
|
|
7
|
-
import { useLocale } from
|
|
8
|
-
import { useTraduction } from
|
|
4
|
+
LocaleClientContextProvider
|
|
5
|
+
} from './LocaleClientContextProvider.mjs';
|
|
6
|
+
import { useIntlayer } from './useIntlayer.mjs';
|
|
7
|
+
import { useLocale } from './useLocale.mjs';
|
|
8
|
+
import { useTraduction } from './useTraduction.mjs';
|
|
9
9
|
import {
|
|
10
10
|
useLocaleCookie,
|
|
11
11
|
localeCookie,
|
|
12
|
-
setLocaleCookie
|
|
13
|
-
} from
|
|
12
|
+
setLocaleCookie
|
|
13
|
+
} from './useLocaleCookie.mjs';
|
|
14
14
|
export {
|
|
15
15
|
LocaleClientContext,
|
|
16
16
|
LocaleClientContextProvider,
|
|
@@ -20,6 +20,6 @@ export {
|
|
|
20
20
|
useLocale,
|
|
21
21
|
useLocaleContext,
|
|
22
22
|
useLocaleCookie,
|
|
23
|
-
useTraduction
|
|
23
|
+
useTraduction
|
|
24
24
|
};
|
|
25
|
-
//# sourceMappingURL=index.mjs.map
|
|
25
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
1
|
+
import * as _intlayer_config_client from '@intlayer/config/client';
|
|
2
|
+
import * as intlayer from 'intlayer';
|
|
3
|
+
import { LanguageContent } from '@intlayer/core';
|
|
3
4
|
|
|
4
|
-
declare const useContent: <Content>(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
content: Content;
|
|
9
|
-
t: <Content_1>(languageContent: LanguageContent<Content_1>) => Content_1;
|
|
5
|
+
declare const useContent: <Content>(languageContent: LanguageContent<Content>) => {
|
|
6
|
+
locale: intlayer.Locales;
|
|
7
|
+
content: Content;
|
|
8
|
+
t: <Content_1>(languageContent: Partial<Record<_intlayer_config_client.LocalesValues, Content_1>>) => Content_1;
|
|
10
9
|
};
|
|
11
10
|
|
|
12
11
|
export { useContent };
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { useLocale } from
|
|
2
|
-
import { useTraduction } from
|
|
1
|
+
import { useLocale } from './useLocale.mjs';
|
|
2
|
+
import { useTraduction } from './useTraduction.mjs';
|
|
3
3
|
const useContent = (languageContent) => {
|
|
4
4
|
const { locale } = useLocale();
|
|
5
5
|
const content = useTraduction(languageContent);
|
|
6
6
|
return {
|
|
7
7
|
locale,
|
|
8
8
|
content,
|
|
9
|
-
t: useTraduction
|
|
9
|
+
t: useTraduction
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
|
-
export {
|
|
13
|
-
|
|
12
|
+
export {
|
|
13
|
+
useContent
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=useContent.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { UseIntlayer } from
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { UseIntlayer } from '../useIntlayerBase.mjs';
|
|
2
|
+
import '@intlayer/config/client';
|
|
3
|
+
import 'intlayer';
|
|
4
4
|
|
|
5
5
|
declare const useIntlayer: UseIntlayer;
|
|
6
6
|
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useContext } from "react";
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
useIntlayerBase
|
|
5
|
+
} from '../useIntlayerBase.mjs';
|
|
6
|
+
import { LocaleClientContext } from './LocaleClientContextProvider.mjs';
|
|
5
7
|
const useIntlayer = (id, locale) => {
|
|
6
8
|
const { locale: currentLocale } = useContext(LocaleClientContext);
|
|
7
9
|
const localeTarget = locale ?? currentLocale;
|
|
8
10
|
return useIntlayerBase(id, localeTarget);
|
|
9
11
|
};
|
|
10
|
-
export {
|
|
11
|
-
|
|
12
|
+
export {
|
|
13
|
+
useIntlayer
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=useIntlayer.mjs.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as _intlayer_config_client from
|
|
1
|
+
import * as _intlayer_config_client from '@intlayer/config/client';
|
|
2
2
|
|
|
3
3
|
declare const useLocale: () => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
locale: _intlayer_config_client.Locales;
|
|
5
|
+
defaultLocale: _intlayer_config_client.Locales;
|
|
6
|
+
availableLocales: _intlayer_config_client.Locales[];
|
|
7
|
+
localeList: _intlayer_config_client.Locales[];
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export { useLocale };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { intlayerIntlConfiguration } from "@intlayer/config/client";
|
|
3
3
|
import { localeList } from "@intlayer/core";
|
|
4
4
|
import { useContext } from "react";
|
|
5
|
-
import { LocaleClientContext } from
|
|
5
|
+
import { LocaleClientContext } from './LocaleClientContextProvider.mjs';
|
|
6
6
|
const { defaultLocale, locales: availableLocales } = intlayerIntlConfiguration;
|
|
7
7
|
const useLocale = () => {
|
|
8
8
|
const { locale } = useContext(LocaleClientContext);
|
|
@@ -13,9 +13,11 @@ const useLocale = () => {
|
|
|
13
13
|
// Principal locale defined in config
|
|
14
14
|
availableLocales,
|
|
15
15
|
// List of the available locales defined in config
|
|
16
|
-
localeList
|
|
16
|
+
localeList
|
|
17
17
|
// List of all available locales
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
-
export {
|
|
21
|
-
|
|
20
|
+
export {
|
|
21
|
+
useLocale
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=useLocale.mjs.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Locales } from
|
|
1
|
+
import { Locales } from '@intlayer/config/client';
|
|
2
2
|
|
|
3
3
|
declare const localeCookie: Locales | undefined;
|
|
4
4
|
declare const setLocaleCookie: (locale: Locales) => void;
|
|
5
5
|
declare const useLocaleCookie: () => {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
localeCookie: Locales | undefined;
|
|
7
|
+
setLocaleCookie: (locale: Locales) => void;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export { localeCookie, setLocaleCookie, useLocaleCookie };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
intlayerMiddlewareConfiguration
|
|
3
|
+
} from "@intlayer/config/client";
|
|
2
4
|
import Cookies from "js-cookie";
|
|
3
5
|
const { cookieName } = intlayerMiddlewareConfiguration;
|
|
4
6
|
const cookieAttributes = {
|
|
@@ -6,7 +8,7 @@ const cookieAttributes = {
|
|
|
6
8
|
expires: void 0,
|
|
7
9
|
domain: void 0,
|
|
8
10
|
secure: false,
|
|
9
|
-
sameSite: "strict"
|
|
11
|
+
sameSite: "strict"
|
|
10
12
|
};
|
|
11
13
|
const localeCookie = Cookies.get(cookieName);
|
|
12
14
|
const setLocaleCookie = (locale) => {
|
|
@@ -14,7 +16,11 @@ const setLocaleCookie = (locale) => {
|
|
|
14
16
|
};
|
|
15
17
|
const useLocaleCookie = () => ({
|
|
16
18
|
localeCookie,
|
|
17
|
-
setLocaleCookie
|
|
19
|
+
setLocaleCookie
|
|
18
20
|
});
|
|
19
|
-
export {
|
|
20
|
-
|
|
21
|
+
export {
|
|
22
|
+
localeCookie,
|
|
23
|
+
setLocaleCookie,
|
|
24
|
+
useLocaleCookie
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=useLocaleCookie.mjs.map
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { LanguageContent } from
|
|
1
|
+
import { LanguageContent } from '@intlayer/core';
|
|
2
2
|
|
|
3
|
-
declare const useTraduction: <Content>(
|
|
4
|
-
languageContent: LanguageContent<Content>
|
|
5
|
-
) => Content;
|
|
3
|
+
declare const useTraduction: <Content>(languageContent: LanguageContent<Content>) => Content;
|
|
6
4
|
|
|
7
5
|
export { useTraduction };
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { useContext } from "react";
|
|
2
|
-
import { getTranslation } from
|
|
3
|
-
import { LocaleClientContext } from
|
|
2
|
+
import { getTranslation } from '../getTranslation.mjs';
|
|
3
|
+
import { LocaleClientContext } from './LocaleClientContextProvider.mjs';
|
|
4
4
|
const useTraduction = (languageContent) => {
|
|
5
5
|
const { locale } = useContext(LocaleClientContext);
|
|
6
6
|
return getTranslation(languageContent, locale);
|
|
7
7
|
};
|
|
8
|
-
export {
|
|
9
|
-
|
|
8
|
+
export {
|
|
9
|
+
useTraduction
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=useTraduction.mjs.map
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { QuantityContent } from
|
|
1
|
+
import { QuantityContent } from '@intlayer/core';
|
|
2
2
|
|
|
3
|
-
declare const getEnumeration: <Content>(
|
|
4
|
-
enumerationContent: QuantityContent<Content>,
|
|
5
|
-
quantity: number
|
|
6
|
-
) => Content;
|
|
3
|
+
declare const getEnumeration: <Content>(enumerationContent: QuantityContent<Content>, quantity: number) => Content;
|
|
7
4
|
|
|
8
5
|
export { getEnumeration };
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { getEnumerationContent } from "@intlayer/core";
|
|
2
|
-
import { contentRender } from
|
|
2
|
+
import { contentRender } from './ContentEditor/contentRender.mjs';
|
|
3
3
|
const getEnumeration = (enumerationContent, quantity) => {
|
|
4
|
-
const result = getEnumerationContent(
|
|
4
|
+
const result = getEnumerationContent(
|
|
5
|
+
enumerationContent,
|
|
6
|
+
quantity
|
|
7
|
+
);
|
|
5
8
|
if (typeof result === "string") {
|
|
6
9
|
return contentRender(result);
|
|
7
10
|
}
|
|
8
11
|
return result;
|
|
9
12
|
};
|
|
10
|
-
export {
|
|
11
|
-
|
|
13
|
+
export {
|
|
14
|
+
getEnumeration
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=getEnumeration.mjs.map
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { Locales } from
|
|
2
|
-
import { LanguageContent } from
|
|
1
|
+
import { Locales } from '@intlayer/config/client';
|
|
2
|
+
import { LanguageContent } from '@intlayer/core';
|
|
3
3
|
|
|
4
|
-
declare const getTranslation: <Content>(
|
|
5
|
-
languageContent: LanguageContent<Content>,
|
|
6
|
-
locale?: Locales
|
|
7
|
-
) => Content;
|
|
4
|
+
declare const getTranslation: <Content>(languageContent: LanguageContent<Content>, locale?: Locales) => Content;
|
|
8
5
|
|
|
9
6
|
export { getTranslation };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
intlayerIntlConfiguration
|
|
3
|
+
} from "@intlayer/config/client";
|
|
2
4
|
import { getTranslationContent } from "@intlayer/core";
|
|
3
|
-
import { contentRender } from
|
|
5
|
+
import { contentRender } from './ContentEditor/contentRender.mjs';
|
|
4
6
|
const getTranslation = (languageContent, locale) => {
|
|
5
7
|
const { defaultLocale } = intlayerIntlConfiguration;
|
|
6
8
|
const result = getTranslationContent(
|
|
@@ -12,5 +14,7 @@ const getTranslation = (languageContent, locale) => {
|
|
|
12
14
|
}
|
|
13
15
|
return result;
|
|
14
16
|
};
|
|
15
|
-
export {
|
|
16
|
-
|
|
17
|
+
export {
|
|
18
|
+
getTranslation
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=getTranslation.mjs.map
|
package/dist/esm/index.d.mts
CHANGED
|
@@ -1,20 +1,11 @@
|
|
|
1
|
-
export { getTranslation } from
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
localeCookie,
|
|
13
|
-
setLocaleCookie,
|
|
14
|
-
useLocaleCookie,
|
|
15
|
-
} from "./client/useLocaleCookie.mjs";
|
|
16
|
-
import "@intlayer/config/client";
|
|
17
|
-
import "@intlayer/core";
|
|
18
|
-
import "react";
|
|
19
|
-
import "./useIntlayerBase.mjs";
|
|
20
|
-
import "intlayer";
|
|
1
|
+
export { getTranslation } from './getTranslation.mjs';
|
|
2
|
+
export { LocaleClientContext, LocaleClientContextProvider, LocaleClientContextProviderProps, useLocaleContext } from './client/LocaleClientContextProvider.mjs';
|
|
3
|
+
export { useIntlayer } from './client/useIntlayer.mjs';
|
|
4
|
+
export { useLocale } from './client/useLocale.mjs';
|
|
5
|
+
export { useTraduction } from './client/useTraduction.mjs';
|
|
6
|
+
export { localeCookie, setLocaleCookie, useLocaleCookie } from './client/useLocaleCookie.mjs';
|
|
7
|
+
import '@intlayer/config/client';
|
|
8
|
+
import '@intlayer/core';
|
|
9
|
+
import 'react';
|
|
10
|
+
import './useIntlayerBase.mjs';
|
|
11
|
+
import 'intlayer';
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getTranslation } from
|
|
1
|
+
import { getTranslation } from './getTranslation.mjs';
|
|
2
2
|
import {
|
|
3
3
|
LocaleClientContextProvider,
|
|
4
4
|
LocaleClientContext,
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
useTraduction,
|
|
9
9
|
useLocaleCookie,
|
|
10
10
|
localeCookie,
|
|
11
|
-
setLocaleCookie
|
|
12
|
-
} from
|
|
11
|
+
setLocaleCookie
|
|
12
|
+
} from './client/index.mjs';
|
|
13
13
|
export {
|
|
14
14
|
LocaleClientContext,
|
|
15
15
|
LocaleClientContextProvider,
|
|
@@ -20,6 +20,6 @@ export {
|
|
|
20
20
|
useLocale,
|
|
21
21
|
useLocaleContext,
|
|
22
22
|
useLocaleCookie,
|
|
23
|
-
useTraduction
|
|
23
|
+
useTraduction
|
|
24
24
|
};
|
|
25
|
-
//# sourceMappingURL=index.mjs.map
|
|
25
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TranslationContent } from
|
|
1
|
+
import { TranslationContent } from '@intlayer/core';
|
|
2
2
|
|
|
3
3
|
type ContentValue =
|
|
4
4
|
| string
|
|
@@ -17,16 +17,13 @@ type TransformedContentValue =
|
|
|
17
17
|
| undefined
|
|
18
18
|
| ((quantity: number) => TransformedContentValue);
|
|
19
19
|
|
|
20
|
-
type TransformedContent = Record<
|
|
20
|
+
type TransformedContent = Record<
|
|
21
|
+
string,
|
|
22
|
+
TransformedContentValue | undefined
|
|
23
|
+
>;
|
|
21
24
|
|
|
22
25
|
type ContentDictionary = Content & {
|
|
23
26
|
id: string;
|
|
24
27
|
};
|
|
25
28
|
|
|
26
|
-
export type {
|
|
27
|
-
Content,
|
|
28
|
-
ContentDictionary,
|
|
29
|
-
ContentValue,
|
|
30
|
-
TransformedContent,
|
|
31
|
-
TransformedContentValue,
|
|
32
|
-
};
|
|
29
|
+
export type { Content, ContentDictionary, ContentValue, TransformedContent, TransformedContentValue };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
//# sourceMappingURL=contentDictionary.d.mjs.map
|
|
1
|
+
//# sourceMappingURL=contentDictionary.d.mjs.map
|