react-intlayer 4.0.4 → 4.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/UI/ContentSelector.cjs +2 -2
- package/dist/cjs/UI/ContentSelector.cjs.map +1 -1
- package/dist/cjs/client/IntlayerProvider.cjs +11 -5
- package/dist/cjs/client/IntlayerProvider.cjs.map +1 -1
- package/dist/cjs/editor/ContentSelectorWrapper.cjs +9 -11
- package/dist/cjs/editor/ContentSelectorWrapper.cjs.map +1 -1
- package/dist/cjs/editor/IntlayerEditorProvider.cjs +39 -15
- package/dist/cjs/editor/IntlayerEditorProvider.cjs.map +1 -1
- package/dist/esm/UI/ContentSelector.mjs +2 -2
- package/dist/esm/UI/ContentSelector.mjs.map +1 -1
- package/dist/esm/client/IntlayerProvider.mjs +13 -8
- package/dist/esm/client/IntlayerProvider.mjs.map +1 -1
- package/dist/esm/client/index.mjs +10 -10
- package/dist/esm/client/t.mjs +2 -2
- package/dist/esm/client/useContent.mjs +2 -2
- package/dist/esm/client/useDictionary.mjs +2 -2
- package/dist/esm/client/useIntlayer.mjs +2 -2
- package/dist/esm/client/useIntlayerAsync.mjs +3 -3
- package/dist/esm/client/useLocale.mjs +2 -2
- package/dist/esm/client/useLocaleBase.mjs +1 -1
- package/dist/esm/client/useTraduction.mjs +2 -2
- package/dist/esm/editor/ContentSelectorWrapper.mjs +10 -12
- package/dist/esm/editor/ContentSelectorWrapper.mjs.map +1 -1
- package/dist/esm/editor/IntlayerEditorProvider.mjs +42 -17
- package/dist/esm/editor/IntlayerEditorProvider.mjs.map +1 -1
- package/dist/esm/editor/index.mjs +2 -2
- package/dist/esm/editor/renderContentEditor.mjs +1 -1
- package/dist/esm/getDictionary.mjs +2 -2
- package/dist/esm/getIntlayer.mjs +2 -2
- package/dist/esm/getIntlayerAsync.mjs +1 -1
- package/dist/esm/index.mjs +4 -4
- package/dist/esm/processDictionary/index.mjs +2 -2
- package/dist/esm/recursiveTransformContent.mjs +1 -1
- package/dist/esm/server/IntlayerServerProvider.mjs +1 -1
- package/dist/esm/server/getLocaleTranslation.mjs +2 -2
- package/dist/esm/server/index.mjs +6 -6
- package/dist/esm/server/t.mjs +3 -3
- package/dist/esm/server/useDictionary.mjs +3 -3
- package/dist/esm/server/useIntlayer.mjs +3 -3
- package/dist/esm/server/useTraduction.mjs +3 -3
- package/dist/types/client/IntlayerProvider.d.ts +0 -3
- package/dist/types/client/IntlayerProvider.d.ts.map +1 -1
- package/dist/types/editor/ContentSelectorWrapper.d.ts.map +1 -1
- package/dist/types/editor/IntlayerEditorProvider.d.ts.map +1 -1
- package/package.json +14 -14
|
@@ -24,7 +24,7 @@ __export(ContentSelector_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(ContentSelector_exports);
|
|
25
25
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
26
|
var import_react = require("react");
|
|
27
|
-
const DEFAULT_PRESS_DETECT_DURATION =
|
|
27
|
+
const DEFAULT_PRESS_DETECT_DURATION = 250;
|
|
28
28
|
const ContentSelector = ({
|
|
29
29
|
children,
|
|
30
30
|
onPress: onSelect,
|
|
@@ -99,7 +99,7 @@ const ContentSelector = ({
|
|
|
99
99
|
outlineOffset: "4px",
|
|
100
100
|
outlineStyle: "solid",
|
|
101
101
|
outlineColor: isSelectingProp || isSelectingState || isHovered ? "inherit" : "transparent",
|
|
102
|
-
transition: "all
|
|
102
|
+
transition: "all 100ms 50ms ease-in-out"
|
|
103
103
|
},
|
|
104
104
|
role: "button",
|
|
105
105
|
tabIndex: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/UI/ContentSelector.tsx"],"sourcesContent":["'use client';\n\nimport {\n useEffect,\n useState,\n useRef,\n useCallback,\n type FC,\n type MouseEventHandler,\n type HTMLAttributes,\n} from 'react';\n\nconst DEFAULT_PRESS_DETECT_DURATION =
|
|
1
|
+
{"version":3,"sources":["../../../src/UI/ContentSelector.tsx"],"sourcesContent":["'use client';\n\nimport {\n useEffect,\n useState,\n useRef,\n useCallback,\n type FC,\n type MouseEventHandler,\n type HTMLAttributes,\n} from 'react';\n\nconst DEFAULT_PRESS_DETECT_DURATION = 250;\n\ntype ContentSelectorProps = {\n onPress: () => void;\n onClickOutside?: () => void;\n pressDuration?: number;\n isSelecting?: boolean;\n} & HTMLAttributes<HTMLDivElement>;\n\nexport const ContentSelector: FC<ContentSelectorProps> = ({\n children,\n onPress: onSelect,\n onClickOutside: onUnselect,\n pressDuration = DEFAULT_PRESS_DETECT_DURATION,\n isSelecting: isSelectingProp,\n ...props\n}) => {\n const divRef = useRef<HTMLDivElement>(null);\n const [isHovered, setIsHovered] = useState(false);\n const [isSelectingState, setIsSelectingState] = useState(isSelectingProp);\n const pressTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const handleOnLongPress = () => {\n setIsSelectingState(true);\n onSelect();\n };\n\n const startPressTimer = () => {\n pressTimerRef.current = setTimeout(() => {\n handleOnLongPress();\n }, pressDuration);\n };\n\n const clearPressTimer = () => {\n if (pressTimerRef.current) {\n clearTimeout(pressTimerRef.current);\n pressTimerRef.current = null;\n }\n };\n\n const handleMouseDown = () => {\n clearPressTimer(); // Ensure any previous timer is cleared\n startPressTimer();\n };\n\n const handleMouseEnter = () => {\n setIsHovered(true);\n };\n\n const handleMouseUp = () => {\n setIsHovered(false);\n clearPressTimer();\n };\n\n // Use useCallback to ensure the function identity remains stable\n const handleClickOutside = useCallback(\n (event: MouseEvent) => {\n if (divRef.current && !divRef.current.contains(event.target as Node)) {\n setIsSelectingState(false);\n onUnselect?.();\n }\n },\n [onUnselect]\n );\n\n useEffect(() => {\n // Attach click outside listener\n document.addEventListener('mousedown', handleClickOutside);\n\n return () => {\n // Cleanup\n document.removeEventListener('mousedown', handleClickOutside);\n // clearPressTimer(); // Ensure to clear the timer when component unmounts\n };\n }, [handleClickOutside]);\n\n const handleOnClick: MouseEventHandler<HTMLDivElement> = (e) => {\n if (isSelectingState) {\n e.preventDefault();\n e.stopPropagation();\n }\n };\n\n const handleOnBlur = () => {\n // Stop editing when the element loses focus\n setIsSelectingState(false);\n };\n\n return (\n <span\n style={{\n display: 'inline',\n cursor: 'pointer',\n userSelect: 'none',\n borderRadius: '0.375rem',\n outlineWidth: '2px',\n outlineOffset: '4px',\n outlineStyle: 'solid',\n outlineColor:\n isSelectingProp || isSelectingState || isHovered\n ? 'inherit'\n : 'transparent',\n transition: 'all 100ms 50ms ease-in-out',\n }}\n role=\"button\"\n tabIndex={0}\n onKeyUp={() => null}\n onClick={handleOnClick}\n onMouseDown={handleMouseDown}\n onMouseUp={handleMouseUp}\n onMouseLeave={handleMouseUp}\n onTouchStart={handleMouseDown}\n onTouchEnd={handleMouseUp}\n onTouchCancel={handleMouseUp}\n onBlur={handleOnBlur}\n onMouseEnter={handleMouseEnter}\n ref={divRef}\n {...props}\n >\n {children}\n </span>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAqGI;AAnGJ,mBAQO;AAEP,MAAM,gCAAgC;AAS/B,MAAM,kBAA4C,CAAC;AAAA,EACxD;AAAA,EACA,SAAS;AAAA,EACT,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,GAAG;AACL,MAAM;AACJ,QAAM,aAAS,qBAAuB,IAAI;AAC1C,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAS,KAAK;AAChD,QAAM,CAAC,kBAAkB,mBAAmB,QAAI,uBAAS,eAAe;AACxE,QAAM,oBAAgB,qBAA6C,IAAI;AAEvE,QAAM,oBAAoB,MAAM;AAC9B,wBAAoB,IAAI;AACxB,aAAS;AAAA,EACX;AAEA,QAAM,kBAAkB,MAAM;AAC5B,kBAAc,UAAU,WAAW,MAAM;AACvC,wBAAkB;AAAA,IACpB,GAAG,aAAa;AAAA,EAClB;AAEA,QAAM,kBAAkB,MAAM;AAC5B,QAAI,cAAc,SAAS;AACzB,mBAAa,cAAc,OAAO;AAClC,oBAAc,UAAU;AAAA,IAC1B;AAAA,EACF;AAEA,QAAM,kBAAkB,MAAM;AAC5B,oBAAgB;AAChB,oBAAgB;AAAA,EAClB;AAEA,QAAM,mBAAmB,MAAM;AAC7B,iBAAa,IAAI;AAAA,EACnB;AAEA,QAAM,gBAAgB,MAAM;AAC1B,iBAAa,KAAK;AAClB,oBAAgB;AAAA,EAClB;AAGA,QAAM,yBAAqB;AAAA,IACzB,CAAC,UAAsB;AACrB,UAAI,OAAO,WAAW,CAAC,OAAO,QAAQ,SAAS,MAAM,MAAc,GAAG;AACpE,4BAAoB,KAAK;AACzB,qBAAa;AAAA,MACf;AAAA,IACF;AAAA,IACA,CAAC,UAAU;AAAA,EACb;AAEA,8BAAU,MAAM;AAEd,aAAS,iBAAiB,aAAa,kBAAkB;AAEzD,WAAO,MAAM;AAEX,eAAS,oBAAoB,aAAa,kBAAkB;AAAA,IAE9D;AAAA,EACF,GAAG,CAAC,kBAAkB,CAAC;AAEvB,QAAM,gBAAmD,CAAC,MAAM;AAC9D,QAAI,kBAAkB;AACpB,QAAE,eAAe;AACjB,QAAE,gBAAgB;AAAA,IACpB;AAAA,EACF;AAEA,QAAM,eAAe,MAAM;AAEzB,wBAAoB,KAAK;AAAA,EAC3B;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,QACL,SAAS;AAAA,QACT,QAAQ;AAAA,QACR,YAAY;AAAA,QACZ,cAAc;AAAA,QACd,cAAc;AAAA,QACd,eAAe;AAAA,QACf,cAAc;AAAA,QACd,cACE,mBAAmB,oBAAoB,YACnC,YACA;AAAA,QACN,YAAY;AAAA,MACd;AAAA,MACA,MAAK;AAAA,MACL,UAAU;AAAA,MACV,SAAS,MAAM;AAAA,MACf,SAAS;AAAA,MACT,aAAa;AAAA,MACb,WAAW;AAAA,MACX,cAAc;AAAA,MACd,cAAc;AAAA,MACd,YAAY;AAAA,MACZ,eAAe;AAAA,MACf,QAAQ;AAAA,MACR,cAAc;AAAA,MACd,KAAK;AAAA,MACJ,GAAG;AAAA,MAEH;AAAA;AAAA,EACH;AAEJ;","names":[]}
|
|
@@ -26,23 +26,25 @@ __export(IntlayerProvider_exports, {
|
|
|
26
26
|
module.exports = __toCommonJS(IntlayerProvider_exports);
|
|
27
27
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
28
|
var import_client = require("@intlayer/config/client");
|
|
29
|
+
var import_editor_react = require("@intlayer/editor-react");
|
|
29
30
|
var import_react = require("react");
|
|
30
|
-
var import_useLocaleCookie = require('./useLocaleCookie.cjs');
|
|
31
31
|
var import_IntlayerEditorProvider = require('../editor/IntlayerEditorProvider.cjs');
|
|
32
32
|
var import_PoweredByMeta = require('./PoweredByMeta.cjs');
|
|
33
|
+
var import_useLocaleCookie = require('./useLocaleCookie.cjs');
|
|
33
34
|
const IntlayerClientContext = (0, import_react.createContext)({
|
|
34
35
|
locale: import_useLocaleCookie.localeCookie ?? (0, import_client.getConfiguration)().internationalization.defaultLocale,
|
|
35
36
|
setLocale: () => null
|
|
36
37
|
});
|
|
37
38
|
const useIntlayerContext = () => (0, import_react.useContext)(IntlayerClientContext);
|
|
38
|
-
const
|
|
39
|
+
const IntlayerProviderContent = ({
|
|
39
40
|
locale,
|
|
40
41
|
children,
|
|
41
42
|
setLocale: setLocaleProp
|
|
42
43
|
}) => {
|
|
43
44
|
const { internationalization } = (0, import_client.getConfiguration)();
|
|
44
45
|
const { defaultLocale, locales: availableLocales } = internationalization;
|
|
45
|
-
const [currentLocale, setCurrentLocale] = (0,
|
|
46
|
+
const [currentLocale, setCurrentLocale] = (0, import_editor_react.useCrossFrameState)(
|
|
47
|
+
"INTLAYER_CURRENT_LOCALE",
|
|
46
48
|
locale ?? import_useLocaleCookie.localeCookie ?? defaultLocale
|
|
47
49
|
);
|
|
48
50
|
const setLocaleBase = (0, import_react.useCallback)(
|
|
@@ -57,16 +59,20 @@ const IntlayerProvider = ({
|
|
|
57
59
|
},
|
|
58
60
|
[availableLocales, currentLocale, locale]
|
|
59
61
|
);
|
|
60
|
-
const setLocale =
|
|
62
|
+
const setLocale = (0, import_react.useMemo)(
|
|
63
|
+
() => setLocaleProp ?? setLocaleBase,
|
|
64
|
+
[setLocaleProp, setLocaleBase]
|
|
65
|
+
);
|
|
61
66
|
const value = (0, import_react.useMemo)(
|
|
62
67
|
() => ({ locale: currentLocale, setLocale }),
|
|
63
68
|
[currentLocale, setLocale]
|
|
64
69
|
);
|
|
65
70
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(IntlayerClientContext.Provider, { value, children: [
|
|
66
71
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_PoweredByMeta.PoweredByMeta, {}),
|
|
67
|
-
|
|
72
|
+
children
|
|
68
73
|
] });
|
|
69
74
|
};
|
|
75
|
+
const IntlayerProvider = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_IntlayerEditorProvider.IntlayerEditorProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IntlayerProviderContent, { ...props }) });
|
|
70
76
|
// Annotate the CommonJS export names for ESM import in node:
|
|
71
77
|
0 && (module.exports = {
|
|
72
78
|
IntlayerClientContext,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/IntlayerProvider.tsx"],"sourcesContent":["'use client';\n\nimport { getConfiguration, type Locales } from '@intlayer/config/client';\nimport {\n type PropsWithChildren,\n createContext,\n useContext,\n useMemo,\n type FC,\n useState,\n useCallback,\n} from 'react';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/client/IntlayerProvider.tsx"],"sourcesContent":["'use client';\n\nimport { getConfiguration, type Locales } from '@intlayer/config/client';\nimport { useCrossFrameState } from '@intlayer/editor-react';\nimport {\n type PropsWithChildren,\n createContext,\n useContext,\n useMemo,\n type FC,\n useState,\n useCallback,\n} from 'react';\nimport { IntlayerEditorProvider } from '../editor/IntlayerEditorProvider';\nimport { PoweredByMeta } from './PoweredByMeta';\nimport { localeCookie, setLocaleCookie } from './useLocaleCookie';\n\ntype IntlayerValue = {\n locale: Locales;\n setLocale: (newLocale: Locales) => void;\n};\n\n/**\n * Context that store the current locale on the client side\n */\nexport const IntlayerClientContext = createContext<IntlayerValue>({\n locale: localeCookie ?? getConfiguration().internationalization.defaultLocale,\n setLocale: () => null,\n});\n\n/**\n * Hook that provides the current locale\n */\nexport const useIntlayerContext = () => useContext(IntlayerClientContext);\n\nexport type IntlayerProviderProps = PropsWithChildren & {\n locale?: Locales;\n setLocale?: (locale: Locales) => void;\n};\n\n/**\n * Provider that store the current locale on the client side\n */\nconst IntlayerProviderContent: FC<IntlayerProviderProps> = ({\n locale,\n children,\n setLocale: setLocaleProp,\n}) => {\n const { internationalization } = getConfiguration();\n const { defaultLocale, locales: availableLocales } = internationalization;\n\n const [currentLocale, setCurrentLocale] = useCrossFrameState(\n 'INTLAYER_CURRENT_LOCALE',\n locale ?? localeCookie ?? defaultLocale\n );\n\n const setLocaleBase = useCallback(\n (newLocale: Locales) => {\n if (currentLocale.toString() === newLocale.toString()) return;\n\n if (!availableLocales.includes(newLocale)) {\n console.error(`Locale ${locale} is not available`);\n return;\n }\n\n setCurrentLocale(newLocale); // Update state\n setLocaleCookie(newLocale); // Optionally set cookie for persistence\n },\n [availableLocales, currentLocale, locale]\n );\n\n const setLocale = useMemo(\n () => setLocaleProp ?? setLocaleBase,\n [setLocaleProp, setLocaleBase]\n );\n\n const value: IntlayerValue = useMemo<IntlayerValue>(\n () => ({ locale: currentLocale, setLocale }),\n [currentLocale, setLocale]\n );\n\n return (\n <IntlayerClientContext.Provider value={value}>\n <PoweredByMeta />\n {children}\n </IntlayerClientContext.Provider>\n );\n};\n\nexport const IntlayerProvider: FC<IntlayerProviderProps> = (props) => (\n <IntlayerEditorProvider>\n <IntlayerProviderContent {...props} />\n </IntlayerEditorProvider>\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkFI;AAhFJ,oBAA+C;AAC/C,0BAAmC;AACnC,mBAQO;AACP,oCAAuC;AACvC,2BAA8B;AAC9B,6BAA8C;AAUvC,MAAM,4BAAwB,4BAA6B;AAAA,EAChE,QAAQ,2CAAgB,gCAAiB,EAAE,qBAAqB;AAAA,EAChE,WAAW,MAAM;AACnB,CAAC;AAKM,MAAM,qBAAqB,UAAM,yBAAW,qBAAqB;AAUxE,MAAM,0BAAqD,CAAC;AAAA,EAC1D;AAAA,EACA;AAAA,EACA,WAAW;AACb,MAAM;AACJ,QAAM,EAAE,qBAAqB,QAAI,gCAAiB;AAClD,QAAM,EAAE,eAAe,SAAS,iBAAiB,IAAI;AAErD,QAAM,CAAC,eAAe,gBAAgB,QAAI;AAAA,IACxC;AAAA,IACA,UAAU,uCAAgB;AAAA,EAC5B;AAEA,QAAM,oBAAgB;AAAA,IACpB,CAAC,cAAuB;AACtB,UAAI,cAAc,SAAS,MAAM,UAAU,SAAS,EAAG;AAEvD,UAAI,CAAC,iBAAiB,SAAS,SAAS,GAAG;AACzC,gBAAQ,MAAM,UAAU,MAAM,mBAAmB;AACjD;AAAA,MACF;AAEA,uBAAiB,SAAS;AAC1B,kDAAgB,SAAS;AAAA,IAC3B;AAAA,IACA,CAAC,kBAAkB,eAAe,MAAM;AAAA,EAC1C;AAEA,QAAM,gBAAY;AAAA,IAChB,MAAM,iBAAiB;AAAA,IACvB,CAAC,eAAe,aAAa;AAAA,EAC/B;AAEA,QAAM,YAAuB;AAAA,IAC3B,OAAO,EAAE,QAAQ,eAAe,UAAU;AAAA,IAC1C,CAAC,eAAe,SAAS;AAAA,EAC3B;AAEA,SACE,6CAAC,sBAAsB,UAAtB,EAA+B,OAC9B;AAAA,gDAAC,sCAAc;AAAA,IACd;AAAA,KACH;AAEJ;AAEO,MAAM,mBAA8C,CAAC,UAC1D,4CAAC,wDACC,sDAAC,2BAAyB,GAAG,OAAO,GACtC;","names":[]}
|
|
@@ -27,14 +27,13 @@ var import_core = require("@intlayer/core");
|
|
|
27
27
|
var import_editor_react = require("@intlayer/editor-react");
|
|
28
28
|
var import_react = require("react");
|
|
29
29
|
var import_ContentSelector = require('../UI/ContentSelector.cjs');
|
|
30
|
-
const
|
|
30
|
+
const ContentSelectorWrapperContent = ({
|
|
31
31
|
children,
|
|
32
32
|
dictionaryKey,
|
|
33
33
|
dictionaryPath,
|
|
34
34
|
keyPath,
|
|
35
35
|
...props
|
|
36
36
|
}) => {
|
|
37
|
-
const { enabled } = (0, import_editor_react.useEditorEnabled)();
|
|
38
37
|
const { focusedContent, setFocusedContent } = (0, import_editor_react.useFocusDictionary)();
|
|
39
38
|
const { getEditedContentValue } = (0, import_editor_react.useEditedContentActions)();
|
|
40
39
|
const editedValue = (0, import_react.useMemo)(
|
|
@@ -61,16 +60,15 @@ const ContentSelectorWrapper = ({
|
|
|
61
60
|
setDisplayedChildren(children);
|
|
62
61
|
}
|
|
63
62
|
}, [editedValue, focusedContent, children]);
|
|
63
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ContentSelector.ContentSelector, { onPress: handleSelect, isSelecting: isSelected, ...props, children: displayedChildren });
|
|
64
|
+
};
|
|
65
|
+
const ContentSelectorWrapper = ({
|
|
66
|
+
children,
|
|
67
|
+
...props
|
|
68
|
+
}) => {
|
|
69
|
+
const { enabled } = (0, import_editor_react.useEditorEnabled)();
|
|
64
70
|
if (enabled) {
|
|
65
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
66
|
-
import_ContentSelector.ContentSelector,
|
|
67
|
-
{
|
|
68
|
-
onPress: handleSelect,
|
|
69
|
-
isSelecting: isSelected,
|
|
70
|
-
...props,
|
|
71
|
-
children: displayedChildren
|
|
72
|
-
}
|
|
73
|
-
);
|
|
71
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ContentSelectorWrapperContent, { ...props, children });
|
|
74
72
|
}
|
|
75
73
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
|
|
76
74
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/editor/ContentSelectorWrapper.tsx"],"sourcesContent":["'use client';\n\nimport { isSameKeyPath, type KeyPath } from '@intlayer/core';\nimport {\n useFocusDictionary,\n useEditedContentActions,\n useEditorEnabled,\n} from '@intlayer/editor-react';\nimport {\n useCallback,\n useEffect,\n useState,\n useMemo,\n type FC,\n type ReactNode,\n HTMLAttributes,\n} from 'react';\nimport { ContentSelector } from '../UI/ContentSelector';\n\ntype ContentData = {\n dictionaryKey: string;\n dictionaryPath: string;\n keyPath: KeyPath[];\n};\n\nexport type ContentSelectorWrapperProps = ContentData &\n HTMLAttributes<HTMLDivElement>;\n\
|
|
1
|
+
{"version":3,"sources":["../../../src/editor/ContentSelectorWrapper.tsx"],"sourcesContent":["'use client';\n\nimport { isSameKeyPath, type KeyPath } from '@intlayer/core';\nimport {\n useFocusDictionary,\n useEditedContentActions,\n useEditorEnabled,\n} from '@intlayer/editor-react';\nimport {\n useCallback,\n useEffect,\n useState,\n useMemo,\n type FC,\n type ReactNode,\n HTMLAttributes,\n} from 'react';\nimport { ContentSelector } from '../UI/ContentSelector';\n\ntype ContentData = {\n dictionaryKey: string;\n dictionaryPath: string;\n keyPath: KeyPath[];\n};\n\nexport type ContentSelectorWrapperProps = ContentData &\n HTMLAttributes<HTMLDivElement>;\n\nconst ContentSelectorWrapperContent: FC<ContentSelectorWrapperProps> = ({\n children,\n dictionaryKey,\n dictionaryPath,\n keyPath,\n ...props\n}) => {\n const { focusedContent, setFocusedContent } = useFocusDictionary();\n const { getEditedContentValue } = useEditedContentActions();\n\n const editedValue = useMemo(\n () => getEditedContentValue(dictionaryKey, keyPath),\n [dictionaryKey, keyPath, getEditedContentValue]\n );\n\n const [displayedChildren, setDisplayedChildren] =\n useState<ReactNode>(children);\n\n const handleSelect = useCallback(\n () =>\n setFocusedContent({\n dictionaryKey,\n dictionaryPath,\n keyPath,\n }),\n [dictionaryKey, dictionaryPath, keyPath, setFocusedContent]\n );\n\n const isSelected = useMemo(\n () =>\n (focusedContent?.dictionaryKey === dictionaryKey &&\n (focusedContent?.keyPath?.length ?? 0) > 0 &&\n isSameKeyPath(focusedContent?.keyPath ?? [], keyPath)) ??\n false,\n [focusedContent, keyPath]\n );\n\n useEffect(() => {\n // Use useEffect to avoid 'Text content does not match server-rendered HTML' error\n if (editedValue && typeof editedValue === 'string') {\n setDisplayedChildren(editedValue);\n } else {\n setDisplayedChildren(children);\n }\n }, [editedValue, focusedContent, children]);\n\n return (\n <ContentSelector onPress={handleSelect} isSelecting={isSelected} {...props}>\n {displayedChildren}\n </ContentSelector>\n );\n};\n\nexport const ContentSelectorWrapper: FC<ContentSelectorWrapperProps> = ({\n children,\n ...props\n}) => {\n const { enabled } = useEditorEnabled();\n\n if (enabled) {\n return (\n <ContentSelectorWrapperContent {...props}>\n {children}\n </ContentSelectorWrapperContent>\n );\n }\n\n return <>{children}</>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA2EI;AAzEJ,kBAA4C;AAC5C,0BAIO;AACP,mBAQO;AACP,6BAAgC;AAWhC,MAAM,gCAAiE,CAAC;AAAA,EACtE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,EAAE,gBAAgB,kBAAkB,QAAI,wCAAmB;AACjE,QAAM,EAAE,sBAAsB,QAAI,6CAAwB;AAE1D,QAAM,kBAAc;AAAA,IAClB,MAAM,sBAAsB,eAAe,OAAO;AAAA,IAClD,CAAC,eAAe,SAAS,qBAAqB;AAAA,EAChD;AAEA,QAAM,CAAC,mBAAmB,oBAAoB,QAC5C,uBAAoB,QAAQ;AAE9B,QAAM,mBAAe;AAAA,IACnB,MACE,kBAAkB;AAAA,MAChB;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,IACH,CAAC,eAAe,gBAAgB,SAAS,iBAAiB;AAAA,EAC5D;AAEA,QAAM,iBAAa;AAAA,IACjB,OACG,gBAAgB,kBAAkB,kBAChC,gBAAgB,SAAS,UAAU,KAAK,SACzC,2BAAc,gBAAgB,WAAW,CAAC,GAAG,OAAO,MACtD;AAAA,IACF,CAAC,gBAAgB,OAAO;AAAA,EAC1B;AAEA,8BAAU,MAAM;AAEd,QAAI,eAAe,OAAO,gBAAgB,UAAU;AAClD,2BAAqB,WAAW;AAAA,IAClC,OAAO;AACL,2BAAqB,QAAQ;AAAA,IAC/B;AAAA,EACF,GAAG,CAAC,aAAa,gBAAgB,QAAQ,CAAC;AAE1C,SACE,4CAAC,0CAAgB,SAAS,cAAc,aAAa,YAAa,GAAG,OAClE,6BACH;AAEJ;AAEO,MAAM,yBAA0D,CAAC;AAAA,EACtE;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,EAAE,QAAQ,QAAI,sCAAiB;AAErC,MAAI,SAAS;AACX,WACE,4CAAC,iCAA+B,GAAG,OAChC,UACH;AAAA,EAEJ;AAEA,SAAO,2EAAG,UAAS;AACrB;","names":[]}
|
|
@@ -37,32 +37,56 @@ var import_client = require("@intlayer/config/client");
|
|
|
37
37
|
var import_dictionaries_entry = __toESM(require("@intlayer/dictionaries-entry"));
|
|
38
38
|
var import_editor_react = require("@intlayer/editor-react");
|
|
39
39
|
var import_react = require("react");
|
|
40
|
-
const
|
|
40
|
+
const IntlayerEditorHooksEnabled = () => {
|
|
41
41
|
(0, import_editor_react.useCrossURLPathState)(void 0, {
|
|
42
42
|
receive: false,
|
|
43
43
|
emit: true
|
|
44
44
|
});
|
|
45
|
-
const
|
|
46
|
-
const { setLocaleDictionaries } = (0, import_editor_react.useDictionariesRecordActions)();
|
|
45
|
+
const [, setConfiguration] = (0, import_editor_react.useConfigurationState)();
|
|
47
46
|
(0, import_react.useEffect)(() => {
|
|
48
|
-
setLocaleDictionaries(import_dictionaries_entry.default);
|
|
49
47
|
const config = (0, import_client.getConfiguration)();
|
|
50
48
|
setConfiguration(config);
|
|
49
|
+
}, [setConfiguration]);
|
|
50
|
+
const { setLocaleDictionaries } = (0, import_editor_react.useDictionariesRecordActions)();
|
|
51
|
+
(0, import_react.useEffect)(() => {
|
|
52
|
+
setLocaleDictionaries(import_dictionaries_entry.default);
|
|
51
53
|
}, [setLocaleDictionaries]);
|
|
52
54
|
(0, import_editor_react.useIframeClickInterceptor)();
|
|
53
55
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
|
|
54
56
|
};
|
|
55
|
-
const
|
|
56
|
-
import_editor_react.
|
|
57
|
-
{
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
);
|
|
57
|
+
const IntlayerEditorHook = () => {
|
|
58
|
+
const { enabled } = (0, import_editor_react.useEditorEnabled)();
|
|
59
|
+
return enabled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IntlayerEditorHooksEnabled, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
|
|
60
|
+
};
|
|
61
|
+
const IntlayerEditorProvider = ({ children }) => {
|
|
62
|
+
const { editor } = (0, import_client.getConfiguration)();
|
|
63
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
64
|
+
import_editor_react.EditorProvider,
|
|
65
|
+
{
|
|
66
|
+
postMessage: (data) => {
|
|
67
|
+
if (typeof window === "undefined") return;
|
|
68
|
+
window?.postMessage(
|
|
69
|
+
data,
|
|
70
|
+
// Use to restrict the origin of the editor for security reasons.
|
|
71
|
+
// Correspond to the current application URL to synchronize the locales states.
|
|
72
|
+
editor.applicationURL
|
|
73
|
+
);
|
|
74
|
+
window.parent?.postMessage(
|
|
75
|
+
data,
|
|
76
|
+
// Use to restrict the origin of the editor for security reasons.
|
|
77
|
+
// Correspond to the current editor URL.
|
|
78
|
+
editor.editorURL
|
|
79
|
+
);
|
|
80
|
+
},
|
|
81
|
+
allowedOrigins: [editor.editorURL, editor.applicationURL],
|
|
82
|
+
mode: "client",
|
|
83
|
+
children: [
|
|
84
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(IntlayerEditorHook, {}),
|
|
85
|
+
children
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
};
|
|
66
90
|
// Annotate the CommonJS export names for ESM import in node:
|
|
67
91
|
0 && (module.exports = {
|
|
68
92
|
IntlayerEditorProvider
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport { getConfiguration } from '@intlayer/config/client';\
|
|
1
|
+
{"version":3,"sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\n'use client';\n\nimport { getConfiguration } from '@intlayer/config/client';\n/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n * The alias allow hot reload the app (such as nextjs) on any dictionary change.\n */\nimport dictionaries from '@intlayer/dictionaries-entry';\nimport {\n EditorProvider,\n useCrossURLPathState,\n useDictionariesRecordActions,\n useConfigurationState,\n useIframeClickInterceptor,\n useEditorEnabled,\n} from '@intlayer/editor-react';\nimport { useEffect, type FC, type PropsWithChildren } from 'react';\n\nconst IntlayerEditorHooksEnabled: FC = () => {\n /**\n * URL Messages\n */\n useCrossURLPathState(undefined, {\n receive: false,\n emit: true,\n });\n\n /**\n * Configuration Messages\n */\n const [, setConfiguration] = useConfigurationState();\n\n useEffect(() => {\n const config = getConfiguration();\n setConfiguration(config);\n }, [setConfiguration]);\n\n /**\n * Locale Dictionaries Messages\n */\n const { setLocaleDictionaries } = useDictionariesRecordActions();\n\n useEffect(() => {\n setLocaleDictionaries(dictionaries);\n }, [setLocaleDictionaries]);\n\n /**\n * Click Messages\n */\n useIframeClickInterceptor();\n\n return <></>;\n};\n\nconst IntlayerEditorHook: FC = () => {\n const { enabled } = useEditorEnabled();\n\n return enabled ? <IntlayerEditorHooksEnabled /> : <></>;\n};\n\nexport const IntlayerEditorProvider: FC<PropsWithChildren> = ({ children }) => {\n const { editor } = getConfiguration();\n\n return (\n <EditorProvider\n postMessage={(data: any) => {\n if (typeof window === 'undefined') return;\n\n window?.postMessage(\n data,\n // Use to restrict the origin of the editor for security reasons.\n // Correspond to the current application URL to synchronize the locales states.\n editor.applicationURL\n );\n window.parent?.postMessage(\n data,\n // Use to restrict the origin of the editor for security reasons.\n // Correspond to the current editor URL.\n editor.editorURL\n );\n }}\n allowedOrigins={[editor.editorURL, editor.applicationURL]}\n mode=\"client\"\n >\n <IntlayerEditorHook />\n {children}\n </EditorProvider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsDS;AAlDT,oBAAiC;AAMjC,gCAAyB;AACzB,0BAOO;AACP,mBAA2D;AAE3D,MAAM,6BAAiC,MAAM;AAI3C,gDAAqB,QAAW;AAAA,IAC9B,SAAS;AAAA,IACT,MAAM;AAAA,EACR,CAAC;AAKD,QAAM,CAAC,EAAE,gBAAgB,QAAI,2CAAsB;AAEnD,8BAAU,MAAM;AACd,UAAM,aAAS,gCAAiB;AAChC,qBAAiB,MAAM;AAAA,EACzB,GAAG,CAAC,gBAAgB,CAAC;AAKrB,QAAM,EAAE,sBAAsB,QAAI,kDAA6B;AAE/D,8BAAU,MAAM;AACd,0BAAsB,0BAAAA,OAAY;AAAA,EACpC,GAAG,CAAC,qBAAqB,CAAC;AAK1B,qDAA0B;AAE1B,SAAO,2EAAE;AACX;AAEA,MAAM,qBAAyB,MAAM;AACnC,QAAM,EAAE,QAAQ,QAAI,sCAAiB;AAErC,SAAO,UAAU,4CAAC,8BAA2B,IAAK,2EAAE;AACtD;AAEO,MAAM,yBAAgD,CAAC,EAAE,SAAS,MAAM;AAC7E,QAAM,EAAE,OAAO,QAAI,gCAAiB;AAEpC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAa,CAAC,SAAc;AAC1B,YAAI,OAAO,WAAW,YAAa;AAEnC,gBAAQ;AAAA,UACN;AAAA;AAAA;AAAA,UAGA,OAAO;AAAA,QACT;AACA,eAAO,QAAQ;AAAA,UACb;AAAA;AAAA;AAAA,UAGA,OAAO;AAAA,QACT;AAAA,MACF;AAAA,MACA,gBAAgB,CAAC,OAAO,WAAW,OAAO,cAAc;AAAA,MACxD,MAAK;AAAA,MAEL;AAAA,oDAAC,sBAAmB;AAAA,QACnB;AAAA;AAAA;AAAA,EACH;AAEJ;","names":["dictionaries"]}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
useRef,
|
|
7
7
|
useCallback
|
|
8
8
|
} from "react";
|
|
9
|
-
const DEFAULT_PRESS_DETECT_DURATION =
|
|
9
|
+
const DEFAULT_PRESS_DETECT_DURATION = 250;
|
|
10
10
|
const ContentSelector = ({
|
|
11
11
|
children,
|
|
12
12
|
onPress: onSelect,
|
|
@@ -81,7 +81,7 @@ const ContentSelector = ({
|
|
|
81
81
|
outlineOffset: "4px",
|
|
82
82
|
outlineStyle: "solid",
|
|
83
83
|
outlineColor: isSelectingProp || isSelectingState || isHovered ? "inherit" : "transparent",
|
|
84
|
-
transition: "all
|
|
84
|
+
transition: "all 100ms 50ms ease-in-out"
|
|
85
85
|
},
|
|
86
86
|
role: "button",
|
|
87
87
|
tabIndex: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/UI/ContentSelector.tsx"],"sourcesContent":["'use client';\n\nimport {\n useEffect,\n useState,\n useRef,\n useCallback,\n type FC,\n type MouseEventHandler,\n type HTMLAttributes,\n} from 'react';\n\nconst DEFAULT_PRESS_DETECT_DURATION =
|
|
1
|
+
{"version":3,"sources":["../../../src/UI/ContentSelector.tsx"],"sourcesContent":["'use client';\n\nimport {\n useEffect,\n useState,\n useRef,\n useCallback,\n type FC,\n type MouseEventHandler,\n type HTMLAttributes,\n} from 'react';\n\nconst DEFAULT_PRESS_DETECT_DURATION = 250;\n\ntype ContentSelectorProps = {\n onPress: () => void;\n onClickOutside?: () => void;\n pressDuration?: number;\n isSelecting?: boolean;\n} & HTMLAttributes<HTMLDivElement>;\n\nexport const ContentSelector: FC<ContentSelectorProps> = ({\n children,\n onPress: onSelect,\n onClickOutside: onUnselect,\n pressDuration = DEFAULT_PRESS_DETECT_DURATION,\n isSelecting: isSelectingProp,\n ...props\n}) => {\n const divRef = useRef<HTMLDivElement>(null);\n const [isHovered, setIsHovered] = useState(false);\n const [isSelectingState, setIsSelectingState] = useState(isSelectingProp);\n const pressTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const handleOnLongPress = () => {\n setIsSelectingState(true);\n onSelect();\n };\n\n const startPressTimer = () => {\n pressTimerRef.current = setTimeout(() => {\n handleOnLongPress();\n }, pressDuration);\n };\n\n const clearPressTimer = () => {\n if (pressTimerRef.current) {\n clearTimeout(pressTimerRef.current);\n pressTimerRef.current = null;\n }\n };\n\n const handleMouseDown = () => {\n clearPressTimer(); // Ensure any previous timer is cleared\n startPressTimer();\n };\n\n const handleMouseEnter = () => {\n setIsHovered(true);\n };\n\n const handleMouseUp = () => {\n setIsHovered(false);\n clearPressTimer();\n };\n\n // Use useCallback to ensure the function identity remains stable\n const handleClickOutside = useCallback(\n (event: MouseEvent) => {\n if (divRef.current && !divRef.current.contains(event.target as Node)) {\n setIsSelectingState(false);\n onUnselect?.();\n }\n },\n [onUnselect]\n );\n\n useEffect(() => {\n // Attach click outside listener\n document.addEventListener('mousedown', handleClickOutside);\n\n return () => {\n // Cleanup\n document.removeEventListener('mousedown', handleClickOutside);\n // clearPressTimer(); // Ensure to clear the timer when component unmounts\n };\n }, [handleClickOutside]);\n\n const handleOnClick: MouseEventHandler<HTMLDivElement> = (e) => {\n if (isSelectingState) {\n e.preventDefault();\n e.stopPropagation();\n }\n };\n\n const handleOnBlur = () => {\n // Stop editing when the element loses focus\n setIsSelectingState(false);\n };\n\n return (\n <span\n style={{\n display: 'inline',\n cursor: 'pointer',\n userSelect: 'none',\n borderRadius: '0.375rem',\n outlineWidth: '2px',\n outlineOffset: '4px',\n outlineStyle: 'solid',\n outlineColor:\n isSelectingProp || isSelectingState || isHovered\n ? 'inherit'\n : 'transparent',\n transition: 'all 100ms 50ms ease-in-out',\n }}\n role=\"button\"\n tabIndex={0}\n onKeyUp={() => null}\n onClick={handleOnClick}\n onMouseDown={handleMouseDown}\n onMouseUp={handleMouseUp}\n onMouseLeave={handleMouseUp}\n onTouchStart={handleMouseDown}\n onTouchEnd={handleMouseUp}\n onTouchCancel={handleMouseUp}\n onBlur={handleOnBlur}\n onMouseEnter={handleMouseEnter}\n ref={divRef}\n {...props}\n >\n {children}\n </span>\n );\n};\n"],"mappings":";AAqGI;AAnGJ;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAEP,MAAM,gCAAgC;AAS/B,MAAM,kBAA4C,CAAC;AAAA,EACxD;AAAA,EACA,SAAS;AAAA,EACT,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,GAAG;AACL,MAAM;AACJ,QAAM,SAAS,OAAuB,IAAI;AAC1C,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAChD,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,SAAS,eAAe;AACxE,QAAM,gBAAgB,OAA6C,IAAI;AAEvE,QAAM,oBAAoB,MAAM;AAC9B,wBAAoB,IAAI;AACxB,aAAS;AAAA,EACX;AAEA,QAAM,kBAAkB,MAAM;AAC5B,kBAAc,UAAU,WAAW,MAAM;AACvC,wBAAkB;AAAA,IACpB,GAAG,aAAa;AAAA,EAClB;AAEA,QAAM,kBAAkB,MAAM;AAC5B,QAAI,cAAc,SAAS;AACzB,mBAAa,cAAc,OAAO;AAClC,oBAAc,UAAU;AAAA,IAC1B;AAAA,EACF;AAEA,QAAM,kBAAkB,MAAM;AAC5B,oBAAgB;AAChB,oBAAgB;AAAA,EAClB;AAEA,QAAM,mBAAmB,MAAM;AAC7B,iBAAa,IAAI;AAAA,EACnB;AAEA,QAAM,gBAAgB,MAAM;AAC1B,iBAAa,KAAK;AAClB,oBAAgB;AAAA,EAClB;AAGA,QAAM,qBAAqB;AAAA,IACzB,CAAC,UAAsB;AACrB,UAAI,OAAO,WAAW,CAAC,OAAO,QAAQ,SAAS,MAAM,MAAc,GAAG;AACpE,4BAAoB,KAAK;AACzB,qBAAa;AAAA,MACf;AAAA,IACF;AAAA,IACA,CAAC,UAAU;AAAA,EACb;AAEA,YAAU,MAAM;AAEd,aAAS,iBAAiB,aAAa,kBAAkB;AAEzD,WAAO,MAAM;AAEX,eAAS,oBAAoB,aAAa,kBAAkB;AAAA,IAE9D;AAAA,EACF,GAAG,CAAC,kBAAkB,CAAC;AAEvB,QAAM,gBAAmD,CAAC,MAAM;AAC9D,QAAI,kBAAkB;AACpB,QAAE,eAAe;AACjB,QAAE,gBAAgB;AAAA,IACpB;AAAA,EACF;AAEA,QAAM,eAAe,MAAM;AAEzB,wBAAoB,KAAK;AAAA,EAC3B;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,QACL,SAAS;AAAA,QACT,QAAQ;AAAA,QACR,YAAY;AAAA,QACZ,cAAc;AAAA,QACd,cAAc;AAAA,QACd,eAAe;AAAA,QACf,cAAc;AAAA,QACd,cACE,mBAAmB,oBAAoB,YACnC,YACA;AAAA,QACN,YAAY;AAAA,MACd;AAAA,MACA,MAAK;AAAA,MACL,UAAU;AAAA,MACV,SAAS,MAAM;AAAA,MACf,SAAS;AAAA,MACT,aAAa;AAAA,MACb,WAAW;AAAA,MACX,cAAc;AAAA,MACd,cAAc;AAAA,MACd,YAAY;AAAA,MACZ,eAAe;AAAA,MACf,QAAQ;AAAA,MACR,cAAc;AAAA,MACd,KAAK;AAAA,MACJ,GAAG;AAAA,MAEH;AAAA;AAAA,EACH;AAEJ;","names":[]}
|
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { getConfiguration } from "@intlayer/config/client";
|
|
4
|
+
import { useCrossFrameState } from "@intlayer/editor-react";
|
|
4
5
|
import {
|
|
5
6
|
createContext,
|
|
6
7
|
useContext,
|
|
7
8
|
useMemo,
|
|
8
|
-
useState,
|
|
9
9
|
useCallback
|
|
10
10
|
} from "react";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
11
|
+
import { IntlayerEditorProvider } from "../editor/IntlayerEditorProvider.mjs";
|
|
12
|
+
import { PoweredByMeta } from "./PoweredByMeta.mjs";
|
|
13
|
+
import { localeCookie, setLocaleCookie } from "./useLocaleCookie.mjs";
|
|
14
14
|
const IntlayerClientContext = createContext({
|
|
15
15
|
locale: localeCookie ?? getConfiguration().internationalization.defaultLocale,
|
|
16
16
|
setLocale: () => null
|
|
17
17
|
});
|
|
18
18
|
const useIntlayerContext = () => useContext(IntlayerClientContext);
|
|
19
|
-
const
|
|
19
|
+
const IntlayerProviderContent = ({
|
|
20
20
|
locale,
|
|
21
21
|
children,
|
|
22
22
|
setLocale: setLocaleProp
|
|
23
23
|
}) => {
|
|
24
24
|
const { internationalization } = getConfiguration();
|
|
25
25
|
const { defaultLocale, locales: availableLocales } = internationalization;
|
|
26
|
-
const [currentLocale, setCurrentLocale] =
|
|
26
|
+
const [currentLocale, setCurrentLocale] = useCrossFrameState(
|
|
27
|
+
"INTLAYER_CURRENT_LOCALE",
|
|
27
28
|
locale ?? localeCookie ?? defaultLocale
|
|
28
29
|
);
|
|
29
30
|
const setLocaleBase = useCallback(
|
|
@@ -38,16 +39,20 @@ const IntlayerProvider = ({
|
|
|
38
39
|
},
|
|
39
40
|
[availableLocales, currentLocale, locale]
|
|
40
41
|
);
|
|
41
|
-
const setLocale =
|
|
42
|
+
const setLocale = useMemo(
|
|
43
|
+
() => setLocaleProp ?? setLocaleBase,
|
|
44
|
+
[setLocaleProp, setLocaleBase]
|
|
45
|
+
);
|
|
42
46
|
const value = useMemo(
|
|
43
47
|
() => ({ locale: currentLocale, setLocale }),
|
|
44
48
|
[currentLocale, setLocale]
|
|
45
49
|
);
|
|
46
50
|
return /* @__PURE__ */ jsxs(IntlayerClientContext.Provider, { value, children: [
|
|
47
51
|
/* @__PURE__ */ jsx(PoweredByMeta, {}),
|
|
48
|
-
|
|
52
|
+
children
|
|
49
53
|
] });
|
|
50
54
|
};
|
|
55
|
+
const IntlayerProvider = (props) => /* @__PURE__ */ jsx(IntlayerEditorProvider, { children: /* @__PURE__ */ jsx(IntlayerProviderContent, { ...props }) });
|
|
51
56
|
export {
|
|
52
57
|
IntlayerClientContext,
|
|
53
58
|
IntlayerProvider,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/IntlayerProvider.tsx"],"sourcesContent":["'use client';\n\nimport { getConfiguration, type Locales } from '@intlayer/config/client';\nimport {\n type PropsWithChildren,\n createContext,\n useContext,\n useMemo,\n type FC,\n useState,\n useCallback,\n} from 'react';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/client/IntlayerProvider.tsx"],"sourcesContent":["'use client';\n\nimport { getConfiguration, type Locales } from '@intlayer/config/client';\nimport { useCrossFrameState } from '@intlayer/editor-react';\nimport {\n type PropsWithChildren,\n createContext,\n useContext,\n useMemo,\n type FC,\n useState,\n useCallback,\n} from 'react';\nimport { IntlayerEditorProvider } from '../editor/IntlayerEditorProvider';\nimport { PoweredByMeta } from './PoweredByMeta';\nimport { localeCookie, setLocaleCookie } from './useLocaleCookie';\n\ntype IntlayerValue = {\n locale: Locales;\n setLocale: (newLocale: Locales) => void;\n};\n\n/**\n * Context that store the current locale on the client side\n */\nexport const IntlayerClientContext = createContext<IntlayerValue>({\n locale: localeCookie ?? getConfiguration().internationalization.defaultLocale,\n setLocale: () => null,\n});\n\n/**\n * Hook that provides the current locale\n */\nexport const useIntlayerContext = () => useContext(IntlayerClientContext);\n\nexport type IntlayerProviderProps = PropsWithChildren & {\n locale?: Locales;\n setLocale?: (locale: Locales) => void;\n};\n\n/**\n * Provider that store the current locale on the client side\n */\nconst IntlayerProviderContent: FC<IntlayerProviderProps> = ({\n locale,\n children,\n setLocale: setLocaleProp,\n}) => {\n const { internationalization } = getConfiguration();\n const { defaultLocale, locales: availableLocales } = internationalization;\n\n const [currentLocale, setCurrentLocale] = useCrossFrameState(\n 'INTLAYER_CURRENT_LOCALE',\n locale ?? localeCookie ?? defaultLocale\n );\n\n const setLocaleBase = useCallback(\n (newLocale: Locales) => {\n if (currentLocale.toString() === newLocale.toString()) return;\n\n if (!availableLocales.includes(newLocale)) {\n console.error(`Locale ${locale} is not available`);\n return;\n }\n\n setCurrentLocale(newLocale); // Update state\n setLocaleCookie(newLocale); // Optionally set cookie for persistence\n },\n [availableLocales, currentLocale, locale]\n );\n\n const setLocale = useMemo(\n () => setLocaleProp ?? setLocaleBase,\n [setLocaleProp, setLocaleBase]\n );\n\n const value: IntlayerValue = useMemo<IntlayerValue>(\n () => ({ locale: currentLocale, setLocale }),\n [currentLocale, setLocale]\n );\n\n return (\n <IntlayerClientContext.Provider value={value}>\n <PoweredByMeta />\n {children}\n </IntlayerClientContext.Provider>\n );\n};\n\nexport const IntlayerProvider: FC<IntlayerProviderProps> = (props) => (\n <IntlayerEditorProvider>\n <IntlayerProviderContent {...props} />\n </IntlayerEditorProvider>\n);\n"],"mappings":";AAkFI,SACE,KADF;AAhFJ,SAAS,wBAAsC;AAC/C,SAAS,0BAA0B;AACnC;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EAGA;AAAA,OACK;AACP,SAAS,8BAA8B;AACvC,SAAS,qBAAqB;AAC9B,SAAS,cAAc,uBAAuB;AAUvC,MAAM,wBAAwB,cAA6B;AAAA,EAChE,QAAQ,gBAAgB,iBAAiB,EAAE,qBAAqB;AAAA,EAChE,WAAW,MAAM;AACnB,CAAC;AAKM,MAAM,qBAAqB,MAAM,WAAW,qBAAqB;AAUxE,MAAM,0BAAqD,CAAC;AAAA,EAC1D;AAAA,EACA;AAAA,EACA,WAAW;AACb,MAAM;AACJ,QAAM,EAAE,qBAAqB,IAAI,iBAAiB;AAClD,QAAM,EAAE,eAAe,SAAS,iBAAiB,IAAI;AAErD,QAAM,CAAC,eAAe,gBAAgB,IAAI;AAAA,IACxC;AAAA,IACA,UAAU,gBAAgB;AAAA,EAC5B;AAEA,QAAM,gBAAgB;AAAA,IACpB,CAAC,cAAuB;AACtB,UAAI,cAAc,SAAS,MAAM,UAAU,SAAS,EAAG;AAEvD,UAAI,CAAC,iBAAiB,SAAS,SAAS,GAAG;AACzC,gBAAQ,MAAM,UAAU,MAAM,mBAAmB;AACjD;AAAA,MACF;AAEA,uBAAiB,SAAS;AAC1B,sBAAgB,SAAS;AAAA,IAC3B;AAAA,IACA,CAAC,kBAAkB,eAAe,MAAM;AAAA,EAC1C;AAEA,QAAM,YAAY;AAAA,IAChB,MAAM,iBAAiB;AAAA,IACvB,CAAC,eAAe,aAAa;AAAA,EAC/B;AAEA,QAAM,QAAuB;AAAA,IAC3B,OAAO,EAAE,QAAQ,eAAe,UAAU;AAAA,IAC1C,CAAC,eAAe,SAAS;AAAA,EAC3B;AAEA,SACE,qBAAC,sBAAsB,UAAtB,EAA+B,OAC9B;AAAA,wBAAC,iBAAc;AAAA,IACd;AAAA,KACH;AAEJ;AAEO,MAAM,mBAA8C,CAAC,UAC1D,oBAAC,0BACC,8BAAC,2BAAyB,GAAG,OAAO,GACtC;","names":[]}
|
|
@@ -2,20 +2,20 @@ import {
|
|
|
2
2
|
IntlayerClientContext,
|
|
3
3
|
useIntlayerContext,
|
|
4
4
|
IntlayerProvider
|
|
5
|
-
} from
|
|
6
|
-
import { useIntlayer } from
|
|
7
|
-
import { useIntlayerAsync } from
|
|
8
|
-
import { useDictionary } from
|
|
9
|
-
import { useLocaleBase } from
|
|
10
|
-
import { useLocale } from
|
|
11
|
-
import { useTraduction } from
|
|
5
|
+
} from "./IntlayerProvider.mjs";
|
|
6
|
+
import { useIntlayer } from "./useIntlayer.mjs";
|
|
7
|
+
import { useIntlayerAsync } from "./useIntlayerAsync.mjs";
|
|
8
|
+
import { useDictionary } from "./useDictionary.mjs";
|
|
9
|
+
import { useLocaleBase } from "./useLocaleBase.mjs";
|
|
10
|
+
import { useLocale } from "./useLocale.mjs";
|
|
11
|
+
import { useTraduction } from "./useTraduction.mjs";
|
|
12
12
|
import {
|
|
13
13
|
useLocaleCookie,
|
|
14
14
|
localeCookie,
|
|
15
15
|
setLocaleCookie
|
|
16
|
-
} from
|
|
17
|
-
import { getBrowserLocale } from
|
|
18
|
-
import { t } from
|
|
16
|
+
} from "./useLocaleCookie.mjs";
|
|
17
|
+
import { getBrowserLocale } from "./getBrowserLocale.mjs";
|
|
18
|
+
import { t } from "./t.mjs";
|
|
19
19
|
export {
|
|
20
20
|
IntlayerClientContext,
|
|
21
21
|
IntlayerProvider,
|
package/dist/esm/client/t.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useContext } from "react";
|
|
3
|
-
import { getTranslation } from
|
|
4
|
-
import { IntlayerClientContext } from
|
|
3
|
+
import { getTranslation } from "../getTranslation.mjs";
|
|
4
|
+
import { IntlayerClientContext } from "./IntlayerProvider.mjs";
|
|
5
5
|
const t = (multilangContent, locale) => {
|
|
6
6
|
const { locale: currentLocale } = useContext(IntlayerClientContext);
|
|
7
7
|
const localeTarget = locale ?? currentLocale;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useLocaleBase } from
|
|
2
|
-
import { useTraduction } from
|
|
1
|
+
import { useLocaleBase } from "./useLocaleBase.mjs";
|
|
2
|
+
import { useTraduction } from "./useTraduction.mjs";
|
|
3
3
|
const useContent = (languageContent) => {
|
|
4
4
|
const { locale } = useLocaleBase();
|
|
5
5
|
const content = useTraduction(languageContent);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useContext } from "react";
|
|
3
|
-
import { getDictionary } from
|
|
4
|
-
import { IntlayerClientContext } from
|
|
3
|
+
import { getDictionary } from "../getDictionary.mjs";
|
|
4
|
+
import { IntlayerClientContext } from "./IntlayerProvider.mjs";
|
|
5
5
|
const useDictionary = (dictionary, locale, isRenderEditor = false) => {
|
|
6
6
|
const { locale: currentLocale } = useContext(IntlayerClientContext);
|
|
7
7
|
const localeTarget = locale ?? currentLocale;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { useContext } from "react";
|
|
3
3
|
import {
|
|
4
4
|
getIntlayer
|
|
5
|
-
} from
|
|
6
|
-
import { IntlayerClientContext } from
|
|
5
|
+
} from "../getIntlayer.mjs";
|
|
6
|
+
import { IntlayerClientContext } from "./IntlayerProvider.mjs";
|
|
7
7
|
const useIntlayer = (key, locale, isRenderEditor = true) => {
|
|
8
8
|
const { locale: currentLocale } = useContext(IntlayerClientContext);
|
|
9
9
|
const localeTarget = locale ?? currentLocale;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { useContext, useEffect, useMemo, useState } from "react";
|
|
3
3
|
import {
|
|
4
4
|
getIntlayer
|
|
5
|
-
} from
|
|
6
|
-
import { getIntlayerAsync } from
|
|
7
|
-
import { IntlayerClientContext } from
|
|
5
|
+
} from "../getIntlayer.mjs";
|
|
6
|
+
import { getIntlayerAsync } from "../getIntlayerAsync.mjs";
|
|
7
|
+
import { IntlayerClientContext } from "./IntlayerProvider.mjs";
|
|
8
8
|
const useIntlayerAsync = (key, locale, isRenderEditor = true) => {
|
|
9
9
|
const { locale: currentLocale } = useContext(IntlayerClientContext);
|
|
10
10
|
const localeTarget = locale ?? currentLocale;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { getConfiguration } from "@intlayer/config/client";
|
|
3
3
|
import { localeList } from "@intlayer/core";
|
|
4
4
|
import { useCallback, useContext } from "react";
|
|
5
|
-
import { IntlayerClientContext } from
|
|
6
|
-
import { useLocaleCookie } from
|
|
5
|
+
import { IntlayerClientContext } from "./IntlayerProvider.mjs";
|
|
6
|
+
import { useLocaleCookie } from "./useLocaleCookie.mjs";
|
|
7
7
|
const useLocale = ({ onLocaleChange } = {}) => {
|
|
8
8
|
const {
|
|
9
9
|
/**
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { getConfiguration } from "@intlayer/config/client";
|
|
3
3
|
import { localeList } from "@intlayer/core";
|
|
4
4
|
import { useContext } from "react";
|
|
5
|
-
import { IntlayerClientContext } from
|
|
5
|
+
import { IntlayerClientContext } from "./IntlayerProvider.mjs";
|
|
6
6
|
const { defaultLocale, locales: availableLocales } = getConfiguration().internationalization;
|
|
7
7
|
const useLocaleBase = () => {
|
|
8
8
|
const { locale, setLocale } = useContext(IntlayerClientContext);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useContext } from "react";
|
|
2
|
-
import { getTranslation } from
|
|
3
|
-
import { IntlayerClientContext } from
|
|
2
|
+
import { getTranslation } from "../getTranslation.mjs";
|
|
3
|
+
import { IntlayerClientContext } from "./IntlayerProvider.mjs";
|
|
4
4
|
const useTraduction = (languageContent) => {
|
|
5
5
|
const { locale } = useContext(IntlayerClientContext);
|
|
6
6
|
return getTranslation(languageContent, locale);
|
|
@@ -12,15 +12,14 @@ import {
|
|
|
12
12
|
useState,
|
|
13
13
|
useMemo
|
|
14
14
|
} from "react";
|
|
15
|
-
import { ContentSelector } from
|
|
16
|
-
const
|
|
15
|
+
import { ContentSelector } from "../UI/ContentSelector.mjs";
|
|
16
|
+
const ContentSelectorWrapperContent = ({
|
|
17
17
|
children,
|
|
18
18
|
dictionaryKey,
|
|
19
19
|
dictionaryPath,
|
|
20
20
|
keyPath,
|
|
21
21
|
...props
|
|
22
22
|
}) => {
|
|
23
|
-
const { enabled } = useEditorEnabled();
|
|
24
23
|
const { focusedContent, setFocusedContent } = useFocusDictionary();
|
|
25
24
|
const { getEditedContentValue } = useEditedContentActions();
|
|
26
25
|
const editedValue = useMemo(
|
|
@@ -47,16 +46,15 @@ const ContentSelectorWrapper = ({
|
|
|
47
46
|
setDisplayedChildren(children);
|
|
48
47
|
}
|
|
49
48
|
}, [editedValue, focusedContent, children]);
|
|
49
|
+
return /* @__PURE__ */ jsx(ContentSelector, { onPress: handleSelect, isSelecting: isSelected, ...props, children: displayedChildren });
|
|
50
|
+
};
|
|
51
|
+
const ContentSelectorWrapper = ({
|
|
52
|
+
children,
|
|
53
|
+
...props
|
|
54
|
+
}) => {
|
|
55
|
+
const { enabled } = useEditorEnabled();
|
|
50
56
|
if (enabled) {
|
|
51
|
-
return /* @__PURE__ */ jsx(
|
|
52
|
-
ContentSelector,
|
|
53
|
-
{
|
|
54
|
-
onPress: handleSelect,
|
|
55
|
-
isSelecting: isSelected,
|
|
56
|
-
...props,
|
|
57
|
-
children: displayedChildren
|
|
58
|
-
}
|
|
59
|
-
);
|
|
57
|
+
return /* @__PURE__ */ jsx(ContentSelectorWrapperContent, { ...props, children });
|
|
60
58
|
}
|
|
61
59
|
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
62
60
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/editor/ContentSelectorWrapper.tsx"],"sourcesContent":["'use client';\n\nimport { isSameKeyPath, type KeyPath } from '@intlayer/core';\nimport {\n useFocusDictionary,\n useEditedContentActions,\n useEditorEnabled,\n} from '@intlayer/editor-react';\nimport {\n useCallback,\n useEffect,\n useState,\n useMemo,\n type FC,\n type ReactNode,\n HTMLAttributes,\n} from 'react';\nimport { ContentSelector } from '../UI/ContentSelector';\n\ntype ContentData = {\n dictionaryKey: string;\n dictionaryPath: string;\n keyPath: KeyPath[];\n};\n\nexport type ContentSelectorWrapperProps = ContentData &\n HTMLAttributes<HTMLDivElement>;\n\
|
|
1
|
+
{"version":3,"sources":["../../../src/editor/ContentSelectorWrapper.tsx"],"sourcesContent":["'use client';\n\nimport { isSameKeyPath, type KeyPath } from '@intlayer/core';\nimport {\n useFocusDictionary,\n useEditedContentActions,\n useEditorEnabled,\n} from '@intlayer/editor-react';\nimport {\n useCallback,\n useEffect,\n useState,\n useMemo,\n type FC,\n type ReactNode,\n HTMLAttributes,\n} from 'react';\nimport { ContentSelector } from '../UI/ContentSelector';\n\ntype ContentData = {\n dictionaryKey: string;\n dictionaryPath: string;\n keyPath: KeyPath[];\n};\n\nexport type ContentSelectorWrapperProps = ContentData &\n HTMLAttributes<HTMLDivElement>;\n\nconst ContentSelectorWrapperContent: FC<ContentSelectorWrapperProps> = ({\n children,\n dictionaryKey,\n dictionaryPath,\n keyPath,\n ...props\n}) => {\n const { focusedContent, setFocusedContent } = useFocusDictionary();\n const { getEditedContentValue } = useEditedContentActions();\n\n const editedValue = useMemo(\n () => getEditedContentValue(dictionaryKey, keyPath),\n [dictionaryKey, keyPath, getEditedContentValue]\n );\n\n const [displayedChildren, setDisplayedChildren] =\n useState<ReactNode>(children);\n\n const handleSelect = useCallback(\n () =>\n setFocusedContent({\n dictionaryKey,\n dictionaryPath,\n keyPath,\n }),\n [dictionaryKey, dictionaryPath, keyPath, setFocusedContent]\n );\n\n const isSelected = useMemo(\n () =>\n (focusedContent?.dictionaryKey === dictionaryKey &&\n (focusedContent?.keyPath?.length ?? 0) > 0 &&\n isSameKeyPath(focusedContent?.keyPath ?? [], keyPath)) ??\n false,\n [focusedContent, keyPath]\n );\n\n useEffect(() => {\n // Use useEffect to avoid 'Text content does not match server-rendered HTML' error\n if (editedValue && typeof editedValue === 'string') {\n setDisplayedChildren(editedValue);\n } else {\n setDisplayedChildren(children);\n }\n }, [editedValue, focusedContent, children]);\n\n return (\n <ContentSelector onPress={handleSelect} isSelecting={isSelected} {...props}>\n {displayedChildren}\n </ContentSelector>\n );\n};\n\nexport const ContentSelectorWrapper: FC<ContentSelectorWrapperProps> = ({\n children,\n ...props\n}) => {\n const { enabled } = useEditorEnabled();\n\n if (enabled) {\n return (\n <ContentSelectorWrapperContent {...props}>\n {children}\n </ContentSelectorWrapperContent>\n );\n }\n\n return <>{children}</>;\n};\n"],"mappings":";AA2EI,SAoBK,UApBL;AAzEJ,SAAS,qBAAmC;AAC5C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP,SAAS,uBAAuB;AAWhC,MAAM,gCAAiE,CAAC;AAAA,EACtE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,EAAE,gBAAgB,kBAAkB,IAAI,mBAAmB;AACjE,QAAM,EAAE,sBAAsB,IAAI,wBAAwB;AAE1D,QAAM,cAAc;AAAA,IAClB,MAAM,sBAAsB,eAAe,OAAO;AAAA,IAClD,CAAC,eAAe,SAAS,qBAAqB;AAAA,EAChD;AAEA,QAAM,CAAC,mBAAmB,oBAAoB,IAC5C,SAAoB,QAAQ;AAE9B,QAAM,eAAe;AAAA,IACnB,MACE,kBAAkB;AAAA,MAChB;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,IACH,CAAC,eAAe,gBAAgB,SAAS,iBAAiB;AAAA,EAC5D;AAEA,QAAM,aAAa;AAAA,IACjB,OACG,gBAAgB,kBAAkB,kBAChC,gBAAgB,SAAS,UAAU,KAAK,KACzC,cAAc,gBAAgB,WAAW,CAAC,GAAG,OAAO,MACtD;AAAA,IACF,CAAC,gBAAgB,OAAO;AAAA,EAC1B;AAEA,YAAU,MAAM;AAEd,QAAI,eAAe,OAAO,gBAAgB,UAAU;AAClD,2BAAqB,WAAW;AAAA,IAClC,OAAO;AACL,2BAAqB,QAAQ;AAAA,IAC/B;AAAA,EACF,GAAG,CAAC,aAAa,gBAAgB,QAAQ,CAAC;AAE1C,SACE,oBAAC,mBAAgB,SAAS,cAAc,aAAa,YAAa,GAAG,OAClE,6BACH;AAEJ;AAEO,MAAM,yBAA0D,CAAC;AAAA,EACtE;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,EAAE,QAAQ,IAAI,iBAAiB;AAErC,MAAI,SAAS;AACX,WACE,oBAAC,iCAA+B,GAAG,OAChC,UACH;AAAA,EAEJ;AAEA,SAAO,gCAAG,UAAS;AACrB;","names":[]}
|
|
@@ -6,36 +6,61 @@ import {
|
|
|
6
6
|
EditorProvider,
|
|
7
7
|
useCrossURLPathState,
|
|
8
8
|
useDictionariesRecordActions,
|
|
9
|
-
|
|
10
|
-
useIframeClickInterceptor
|
|
9
|
+
useConfigurationState,
|
|
10
|
+
useIframeClickInterceptor,
|
|
11
|
+
useEditorEnabled
|
|
11
12
|
} from "@intlayer/editor-react";
|
|
12
13
|
import { useEffect } from "react";
|
|
13
|
-
const
|
|
14
|
+
const IntlayerEditorHooksEnabled = () => {
|
|
14
15
|
useCrossURLPathState(void 0, {
|
|
15
16
|
receive: false,
|
|
16
17
|
emit: true
|
|
17
18
|
});
|
|
18
|
-
const
|
|
19
|
-
const { setLocaleDictionaries } = useDictionariesRecordActions();
|
|
19
|
+
const [, setConfiguration] = useConfigurationState();
|
|
20
20
|
useEffect(() => {
|
|
21
|
-
setLocaleDictionaries(dictionaries);
|
|
22
21
|
const config = getConfiguration();
|
|
23
22
|
setConfiguration(config);
|
|
23
|
+
}, [setConfiguration]);
|
|
24
|
+
const { setLocaleDictionaries } = useDictionariesRecordActions();
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
setLocaleDictionaries(dictionaries);
|
|
24
27
|
}, [setLocaleDictionaries]);
|
|
25
28
|
useIframeClickInterceptor();
|
|
26
29
|
return /* @__PURE__ */ jsx(Fragment, {});
|
|
27
30
|
};
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
);
|
|
31
|
+
const IntlayerEditorHook = () => {
|
|
32
|
+
const { enabled } = useEditorEnabled();
|
|
33
|
+
return enabled ? /* @__PURE__ */ jsx(IntlayerEditorHooksEnabled, {}) : /* @__PURE__ */ jsx(Fragment, {});
|
|
34
|
+
};
|
|
35
|
+
const IntlayerEditorProvider = ({ children }) => {
|
|
36
|
+
const { editor } = getConfiguration();
|
|
37
|
+
return /* @__PURE__ */ jsxs(
|
|
38
|
+
EditorProvider,
|
|
39
|
+
{
|
|
40
|
+
postMessage: (data) => {
|
|
41
|
+
if (typeof window === "undefined") return;
|
|
42
|
+
window?.postMessage(
|
|
43
|
+
data,
|
|
44
|
+
// Use to restrict the origin of the editor for security reasons.
|
|
45
|
+
// Correspond to the current application URL to synchronize the locales states.
|
|
46
|
+
editor.applicationURL
|
|
47
|
+
);
|
|
48
|
+
window.parent?.postMessage(
|
|
49
|
+
data,
|
|
50
|
+
// Use to restrict the origin of the editor for security reasons.
|
|
51
|
+
// Correspond to the current editor URL.
|
|
52
|
+
editor.editorURL
|
|
53
|
+
);
|
|
54
|
+
},
|
|
55
|
+
allowedOrigins: [editor.editorURL, editor.applicationURL],
|
|
56
|
+
mode: "client",
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ jsx(IntlayerEditorHook, {}),
|
|
59
|
+
children
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
};
|
|
39
64
|
export {
|
|
40
65
|
IntlayerEditorProvider
|
|
41
66
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport { getConfiguration } from '@intlayer/config/client';\
|
|
1
|
+
{"version":3,"sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\n'use client';\n\nimport { getConfiguration } from '@intlayer/config/client';\n/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n * The alias allow hot reload the app (such as nextjs) on any dictionary change.\n */\nimport dictionaries from '@intlayer/dictionaries-entry';\nimport {\n EditorProvider,\n useCrossURLPathState,\n useDictionariesRecordActions,\n useConfigurationState,\n useIframeClickInterceptor,\n useEditorEnabled,\n} from '@intlayer/editor-react';\nimport { useEffect, type FC, type PropsWithChildren } from 'react';\n\nconst IntlayerEditorHooksEnabled: FC = () => {\n /**\n * URL Messages\n */\n useCrossURLPathState(undefined, {\n receive: false,\n emit: true,\n });\n\n /**\n * Configuration Messages\n */\n const [, setConfiguration] = useConfigurationState();\n\n useEffect(() => {\n const config = getConfiguration();\n setConfiguration(config);\n }, [setConfiguration]);\n\n /**\n * Locale Dictionaries Messages\n */\n const { setLocaleDictionaries } = useDictionariesRecordActions();\n\n useEffect(() => {\n setLocaleDictionaries(dictionaries);\n }, [setLocaleDictionaries]);\n\n /**\n * Click Messages\n */\n useIframeClickInterceptor();\n\n return <></>;\n};\n\nconst IntlayerEditorHook: FC = () => {\n const { enabled } = useEditorEnabled();\n\n return enabled ? <IntlayerEditorHooksEnabled /> : <></>;\n};\n\nexport const IntlayerEditorProvider: FC<PropsWithChildren> = ({ children }) => {\n const { editor } = getConfiguration();\n\n return (\n <EditorProvider\n postMessage={(data: any) => {\n if (typeof window === 'undefined') return;\n\n window?.postMessage(\n data,\n // Use to restrict the origin of the editor for security reasons.\n // Correspond to the current application URL to synchronize the locales states.\n editor.applicationURL\n );\n window.parent?.postMessage(\n data,\n // Use to restrict the origin of the editor for security reasons.\n // Correspond to the current editor URL.\n editor.editorURL\n );\n }}\n allowedOrigins={[editor.editorURL, editor.applicationURL]}\n mode=\"client\"\n >\n <IntlayerEditorHook />\n {children}\n </EditorProvider>\n );\n};\n"],"mappings":";AAsDS,wBAaL,YAbK;AAlDT,SAAS,wBAAwB;AAMjC,OAAO,kBAAkB;AACzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iBAAkD;AAE3D,MAAM,6BAAiC,MAAM;AAI3C,uBAAqB,QAAW;AAAA,IAC9B,SAAS;AAAA,IACT,MAAM;AAAA,EACR,CAAC;AAKD,QAAM,CAAC,EAAE,gBAAgB,IAAI,sBAAsB;AAEnD,YAAU,MAAM;AACd,UAAM,SAAS,iBAAiB;AAChC,qBAAiB,MAAM;AAAA,EACzB,GAAG,CAAC,gBAAgB,CAAC;AAKrB,QAAM,EAAE,sBAAsB,IAAI,6BAA6B;AAE/D,YAAU,MAAM;AACd,0BAAsB,YAAY;AAAA,EACpC,GAAG,CAAC,qBAAqB,CAAC;AAK1B,4BAA0B;AAE1B,SAAO,gCAAE;AACX;AAEA,MAAM,qBAAyB,MAAM;AACnC,QAAM,EAAE,QAAQ,IAAI,iBAAiB;AAErC,SAAO,UAAU,oBAAC,8BAA2B,IAAK,gCAAE;AACtD;AAEO,MAAM,yBAAgD,CAAC,EAAE,SAAS,MAAM;AAC7E,QAAM,EAAE,OAAO,IAAI,iBAAiB;AAEpC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAa,CAAC,SAAc;AAC1B,YAAI,OAAO,WAAW,YAAa;AAEnC,gBAAQ;AAAA,UACN;AAAA;AAAA;AAAA,UAGA,OAAO;AAAA,QACT;AACA,eAAO,QAAQ;AAAA,UACb;AAAA;AAAA;AAAA,UAGA,OAAO;AAAA,QACT;AAAA,MACF;AAAA,MACA,gBAAgB,CAAC,OAAO,WAAW,OAAO,cAAc;AAAA,MACxD,MAAK;AAAA,MAEL;AAAA,4BAAC,sBAAmB;AAAA,QACnB;AAAA;AAAA;AAAA,EACH;AAEJ;","names":[]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from "./ContentSelectorWrapper.mjs";
|
|
2
|
+
export * from "./renderContentEditor.mjs";
|
|
3
3
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import {
|
|
3
3
|
ContentSelectorWrapper
|
|
4
|
-
} from
|
|
4
|
+
} from "./ContentSelectorWrapper.mjs";
|
|
5
5
|
const renderIntlayerEditor = (props) => {
|
|
6
6
|
const Result = /* @__PURE__ */ jsx(ContentSelectorWrapper, { ...props, children: props.content });
|
|
7
7
|
return { ...Result, value: props.content };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { processDictionary } from
|
|
1
|
+
import { processDictionary } from "./processDictionary/index.mjs";
|
|
2
2
|
import {
|
|
3
3
|
recursiveTransformContent
|
|
4
|
-
} from
|
|
4
|
+
} from "./recursiveTransformContent.mjs";
|
|
5
5
|
const getDictionary = (dictionary, locale, isRenderEditor = false) => {
|
|
6
6
|
const result = processDictionary(
|
|
7
7
|
dictionary.content,
|
package/dist/esm/getIntlayer.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import dictionaries from "@intlayer/dictionaries-entry";
|
|
2
|
-
import { processDictionary } from
|
|
2
|
+
import { processDictionary } from "./processDictionary/index.mjs";
|
|
3
3
|
import {
|
|
4
4
|
recursiveTransformContent
|
|
5
|
-
} from
|
|
5
|
+
} from "./recursiveTransformContent.mjs";
|
|
6
6
|
const getIntlayer = (key, locale, isRenderEditor = false) => {
|
|
7
7
|
const dictionary = dictionaries[key];
|
|
8
8
|
if (!dictionary) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { fetchDistantDictionary } from "@intlayer/api";
|
|
3
|
-
import { getDictionary } from
|
|
3
|
+
import { getDictionary } from "./getDictionary.mjs";
|
|
4
4
|
const getIntlayerAsync = async (key, locale, isRenderEditor = true) => {
|
|
5
5
|
const jsonDistantDictionary = await fetchDistantDictionary(key);
|
|
6
6
|
if (jsonDistantDictionary) {
|
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
|
IntlayerProvider,
|
|
4
4
|
IntlayerClientContext,
|
|
@@ -14,9 +14,9 @@ import {
|
|
|
14
14
|
getBrowserLocale,
|
|
15
15
|
useLocaleBase,
|
|
16
16
|
t
|
|
17
|
-
} from
|
|
18
|
-
import { getDictionary } from
|
|
19
|
-
import { getIntlayer } from
|
|
17
|
+
} from "./client/index.mjs";
|
|
18
|
+
import { getDictionary } from "./getDictionary.mjs";
|
|
19
|
+
import { getIntlayer } from "./getIntlayer.mjs";
|
|
20
20
|
export {
|
|
21
21
|
IntlayerClientContext,
|
|
22
22
|
IntlayerProvider,
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
findMatchingCondition
|
|
5
5
|
} from "@intlayer/core";
|
|
6
6
|
import { createElement } from "react";
|
|
7
|
-
import { getEnumeration } from
|
|
8
|
-
import { getTranslation } from
|
|
7
|
+
import { getEnumeration } from "../getEnumeration.mjs";
|
|
8
|
+
import { getTranslation } from "../getTranslation.mjs";
|
|
9
9
|
const {
|
|
10
10
|
internationalization: { defaultLocale }
|
|
11
11
|
} = getConfiguration();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isValidElement } from "react";
|
|
2
2
|
import {
|
|
3
3
|
renderIntlayerEditor
|
|
4
|
-
} from
|
|
4
|
+
} from "./editor/renderContentEditor.mjs";
|
|
5
5
|
const recursiveTransformContent = (value, isRenderEditor = false) => {
|
|
6
6
|
if (typeof value === "function") {
|
|
7
7
|
return (props) => recursiveTransformContent(value(props), isRenderEditor);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { getConfiguration } from "@intlayer/config/client";
|
|
3
|
-
import { createServerContext, getServerContext } from
|
|
3
|
+
import { createServerContext, getServerContext } from "./serverContext.mjs";
|
|
4
4
|
const { defaultLocale } = getConfiguration().internationalization;
|
|
5
5
|
const IntlayerServerContext = createServerContext(defaultLocale);
|
|
6
6
|
const useIntlayer = () => getServerContext(IntlayerServerContext);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getConfiguration } from "@intlayer/config/client";
|
|
2
2
|
import { getTranslationContent } from "@intlayer/core";
|
|
3
|
-
import { IntlayerServerContext } from
|
|
4
|
-
import { getServerContext } from
|
|
3
|
+
import { IntlayerServerContext } from "./IntlayerServerProvider.mjs";
|
|
4
|
+
import { getServerContext } from "./serverContext.mjs";
|
|
5
5
|
const getLocaleTranslation = (languageContent) => {
|
|
6
6
|
const locale = getServerContext(IntlayerServerContext);
|
|
7
7
|
const content = getTranslationContent(
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { getLocaleTranslation } from
|
|
2
|
-
import { useTraduction } from
|
|
1
|
+
import { getLocaleTranslation } from "./getLocaleTranslation.mjs";
|
|
2
|
+
import { useTraduction } from "./useTraduction.mjs";
|
|
3
3
|
import {
|
|
4
4
|
IntlayerServerContext,
|
|
5
5
|
locale,
|
|
6
6
|
IntlayerServerProvider
|
|
7
|
-
} from
|
|
8
|
-
import { useIntlayer } from
|
|
9
|
-
import { useDictionary } from
|
|
10
|
-
import { t } from
|
|
7
|
+
} from "./IntlayerServerProvider.mjs";
|
|
8
|
+
import { useIntlayer } from "./useIntlayer.mjs";
|
|
9
|
+
import { useDictionary } from "./useDictionary.mjs";
|
|
10
|
+
import { t } from "./t.mjs";
|
|
11
11
|
export {
|
|
12
12
|
IntlayerServerContext as IntlayerServer,
|
|
13
13
|
IntlayerServerProvider,
|
package/dist/esm/server/t.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getTranslation } from
|
|
2
|
-
import { IntlayerServerContext } from
|
|
3
|
-
import { getServerContext } from
|
|
1
|
+
import { getTranslation } from "../getTranslation.mjs";
|
|
2
|
+
import { IntlayerServerContext } from "./IntlayerServerProvider.mjs";
|
|
3
|
+
import { getServerContext } from "./serverContext.mjs";
|
|
4
4
|
const t = (multilangContent, locale) => {
|
|
5
5
|
const currentLocale = getServerContext(IntlayerServerContext);
|
|
6
6
|
const localeTarget = locale ?? currentLocale;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getDictionary } from
|
|
2
|
-
import { IntlayerServerContext } from
|
|
3
|
-
import { getServerContext } from
|
|
1
|
+
import { getDictionary } from "../getDictionary.mjs";
|
|
2
|
+
import { IntlayerServerContext } from "./IntlayerServerProvider.mjs";
|
|
3
|
+
import { getServerContext } from "./serverContext.mjs";
|
|
4
4
|
const useDictionary = (dictionary, locale, isRenderEditor = false) => {
|
|
5
5
|
const localeTarget = locale ?? getServerContext(IntlayerServerContext);
|
|
6
6
|
return getDictionary(dictionary, localeTarget, isRenderEditor);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getIntlayer
|
|
3
|
-
} from
|
|
4
|
-
import { IntlayerServerContext } from
|
|
5
|
-
import { getServerContext } from
|
|
3
|
+
} from "../getIntlayer.mjs";
|
|
4
|
+
import { IntlayerServerContext } from "./IntlayerServerProvider.mjs";
|
|
5
|
+
import { getServerContext } from "./serverContext.mjs";
|
|
6
6
|
const useIntlayer = (key, locale, isRenderEditor = true) => {
|
|
7
7
|
const localeTarget = locale ?? getServerContext(IntlayerServerContext);
|
|
8
8
|
return getIntlayer(key, localeTarget, isRenderEditor);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getTranslation } from
|
|
2
|
-
import { IntlayerServerContext } from
|
|
3
|
-
import { getServerContext } from
|
|
1
|
+
import { getTranslation } from "../getTranslation.mjs";
|
|
2
|
+
import { IntlayerServerContext } from "./IntlayerServerProvider.mjs";
|
|
3
|
+
import { getServerContext } from "./serverContext.mjs";
|
|
4
4
|
const useTraduction = (languageContent) => {
|
|
5
5
|
const locale = getServerContext(IntlayerServerContext);
|
|
6
6
|
return getTranslation(languageContent, locale);
|
|
@@ -16,9 +16,6 @@ export type IntlayerProviderProps = PropsWithChildren & {
|
|
|
16
16
|
locale?: Locales;
|
|
17
17
|
setLocale?: (locale: Locales) => void;
|
|
18
18
|
};
|
|
19
|
-
/**
|
|
20
|
-
* Provider that store the current locale on the client side
|
|
21
|
-
*/
|
|
22
19
|
export declare const IntlayerProvider: FC<IntlayerProviderProps>;
|
|
23
20
|
export {};
|
|
24
21
|
//# sourceMappingURL=IntlayerProvider.d.ts.map
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"IntlayerProvider.d.ts","sourceRoot":"","sources":["../../../src/client/IntlayerProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAEzE,OAAO,EACL,KAAK,iBAAiB,EAItB,KAAK,EAAE,EAGR,MAAM,OAAO,CAAC;AAKf,KAAK,aAAa,GAAG;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CACzC,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,CAAC;IACjB,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CACvC,CAAC;AAmDF,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAItD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentSelectorWrapper.d.ts","sourceRoot":"","sources":["../../../src/editor/ContentSelectorWrapper.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAiB,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAM7D,OAAO,EAKL,KAAK,EAAE,EAEP,cAAc,EACf,MAAM,OAAO,CAAC;AAGf,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,OAAO,EAAE,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,WAAW,GACnD,cAAc,CAAC,cAAc,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"ContentSelectorWrapper.d.ts","sourceRoot":"","sources":["../../../src/editor/ContentSelectorWrapper.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAiB,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAM7D,OAAO,EAKL,KAAK,EAAE,EAEP,cAAc,EACf,MAAM,OAAO,CAAC;AAGf,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,OAAO,EAAE,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,WAAW,GACnD,cAAc,CAAC,cAAc,CAAC,CAAC;AAuDjC,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":"AAmBA,OAAO,EAAa,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AA4CnE,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,iBAAiB,CA4BxD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-intlayer",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your React applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -71,11 +71,11 @@
|
|
|
71
71
|
],
|
|
72
72
|
"dependencies": {
|
|
73
73
|
"js-cookie": "^3.0.5",
|
|
74
|
-
"@intlayer/
|
|
75
|
-
"@intlayer/
|
|
76
|
-
"@intlayer/
|
|
77
|
-
"@intlayer/
|
|
78
|
-
"@intlayer/
|
|
74
|
+
"@intlayer/api": "4.0.5",
|
|
75
|
+
"@intlayer/editor-react": "4.0.5",
|
|
76
|
+
"@intlayer/config": "4.0.5",
|
|
77
|
+
"@intlayer/dictionaries-entry": "4.0.5",
|
|
78
|
+
"@intlayer/core": "4.0.5"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@craco/types": "^7.1.0",
|
|
@@ -92,9 +92,9 @@
|
|
|
92
92
|
"tsc-alias": "^1.8.10",
|
|
93
93
|
"tsup": "^8.3.5",
|
|
94
94
|
"typescript": "^5.7.3",
|
|
95
|
-
"@intlayer/backend": "4.0.
|
|
96
|
-
"@utils/ts-config": "1.0.4",
|
|
95
|
+
"@intlayer/backend": "4.0.5",
|
|
97
96
|
"@utils/eslint-config": "1.0.4",
|
|
97
|
+
"@utils/ts-config": "1.0.4",
|
|
98
98
|
"@utils/ts-config-types": "1.0.4",
|
|
99
99
|
"@utils/tsup-config": "1.0.4"
|
|
100
100
|
},
|
|
@@ -102,12 +102,12 @@
|
|
|
102
102
|
"react": ">=16.0.0",
|
|
103
103
|
"react-dom": ">=16.0.0",
|
|
104
104
|
"vite": ">=4.0.0",
|
|
105
|
-
"@intlayer/api": "4.0.
|
|
106
|
-
"@intlayer/
|
|
107
|
-
"@intlayer/core": "4.0.
|
|
108
|
-
"intlayer": "4.0.
|
|
109
|
-
"
|
|
110
|
-
"@intlayer/editor-react": "4.0.
|
|
105
|
+
"@intlayer/api": "4.0.5",
|
|
106
|
+
"@intlayer/config": "4.0.5",
|
|
107
|
+
"@intlayer/core": "4.0.5",
|
|
108
|
+
"@intlayer/dictionaries-entry": "4.0.5",
|
|
109
|
+
"intlayer": "4.0.5",
|
|
110
|
+
"@intlayer/editor-react": "4.0.5"
|
|
111
111
|
},
|
|
112
112
|
"engines": {
|
|
113
113
|
"node": ">=14.18"
|