react-intlayer 5.1.5 → 5.1.7
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 -1
- package/dist/cjs/UI/ContentSelector.cjs.map +1 -1
- package/dist/cjs/editor/IntlayerEditorProvider.cjs +1 -4
- package/dist/cjs/editor/IntlayerEditorProvider.cjs.map +1 -1
- package/dist/cjs/editor/renderContentEditor.cjs +1 -1
- package/dist/cjs/editor/renderContentEditor.cjs.map +1 -1
- package/dist/cjs/markdown/renderMarkdown.cjs +1 -5
- package/dist/cjs/markdown/renderMarkdown.cjs.map +1 -1
- package/dist/cjs/plugins.cjs +18 -2
- package/dist/cjs/plugins.cjs.map +1 -1
- package/dist/esm/UI/ContentSelector.mjs +2 -1
- package/dist/esm/UI/ContentSelector.mjs.map +1 -1
- package/dist/esm/editor/IntlayerEditorProvider.mjs +2 -5
- package/dist/esm/editor/IntlayerEditorProvider.mjs.map +1 -1
- package/dist/esm/editor/renderContentEditor.mjs +1 -1
- package/dist/esm/editor/renderContentEditor.mjs.map +1 -1
- package/dist/esm/markdown/renderMarkdown.mjs +1 -5
- package/dist/esm/markdown/renderMarkdown.mjs.map +1 -1
- package/dist/esm/plugins.mjs +18 -2
- package/dist/esm/plugins.mjs.map +1 -1
- package/dist/types/UI/ContentSelector.d.ts.map +1 -1
- package/dist/types/editor/IntlayerEditorProvider.d.ts.map +1 -1
- package/dist/types/editor/renderContentEditor.d.ts +3 -1
- package/dist/types/editor/renderContentEditor.d.ts.map +1 -1
- package/dist/types/markdown/renderMarkdown.d.ts +2 -2
- package/dist/types/markdown/renderMarkdown.d.ts.map +1 -1
- package/dist/types/plugins.d.ts.map +1 -1
- package/package.json +14 -14
|
@@ -37,6 +37,7 @@ const ContentSelector = ({
|
|
|
37
37
|
const [isHovered, setIsHovered] = (0, import_react.useState)(false);
|
|
38
38
|
const [isSelectingState, setIsSelectingState] = (0, import_react.useState)(isSelectingProp);
|
|
39
39
|
const pressTimerRef = (0, import_react.useRef)(null);
|
|
40
|
+
const isChildrenString = typeof children === "string";
|
|
40
41
|
const handleOnLongPress = () => {
|
|
41
42
|
setIsSelectingState(true);
|
|
42
43
|
onSelect();
|
|
@@ -91,7 +92,7 @@ const ContentSelector = ({
|
|
|
91
92
|
"span",
|
|
92
93
|
{
|
|
93
94
|
style: {
|
|
94
|
-
display: "inline",
|
|
95
|
+
display: isChildrenString ? "inline" : "inline-block",
|
|
95
96
|
cursor: "pointer",
|
|
96
97
|
userSelect: "none",
|
|
97
98
|
borderRadius: "0.375rem",
|
|
@@ -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 = 250;\n\ntype ContentSelectorProps = {\n onPress: () => void;\n onClickOutside?: () => void;\n pressDuration?: number;\n isSelecting?: boolean;\n} & Omit<HTMLAttributes<HTMLDivElement>, 'content'>;\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;
|
|
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} & Omit<HTMLAttributes<HTMLDivElement>, 'content'>;\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 const isChildrenString = typeof children === 'string';\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: isChildrenString ? 'inline' : 'inline-block',\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;AAsGI;AApGJ,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;AACvE,QAAM,mBAAmB,OAAO,aAAa;AAE7C,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,mB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MACf,QAAQ;AAAA,MACR,cAAc;AAAA,MACd,KAAK;AAAA,MACJ,GAAG;AAAA,MAEH;AAAA;AAAA,EACH;AAEJ;","names":[]}
|
|
@@ -39,10 +39,7 @@ var import_dictionaries_entry = __toESM(require("@intlayer/dictionaries-entry"))
|
|
|
39
39
|
var import_editor_react = require("@intlayer/editor-react");
|
|
40
40
|
var import_react = require("react");
|
|
41
41
|
const IntlayerEditorHooksEnabled = () => {
|
|
42
|
-
(0, import_editor_react.
|
|
43
|
-
receive: false,
|
|
44
|
-
emit: true
|
|
45
|
-
});
|
|
42
|
+
(0, import_editor_react.useCrossURLPathSetter)();
|
|
46
43
|
const { setLocaleDictionaries } = (0, import_editor_react.useDictionariesRecordActions)();
|
|
47
44
|
(0, import_react.useEffect)(() => {
|
|
48
45
|
setLocaleDictionaries(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport { IntlayerEventListener } from '@intlayer/api';\nimport { getConfiguration } from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/core';\n/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n * The alias allow hot reload the app (such as nextjs) on any dictionary change.\n */\nimport dictionaries from '@intlayer/dictionaries-entry';\nimport {\n EditorProvider,\n
|
|
1
|
+
{"version":3,"sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport { IntlayerEventListener } from '@intlayer/api';\nimport { getConfiguration } from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/core';\n/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n * The alias allow hot reload the app (such as nextjs) on any dictionary change.\n */\nimport dictionaries from '@intlayer/dictionaries-entry';\nimport {\n EditorProvider,\n useCrossURLPathSetter,\n useDictionariesRecordActions,\n useIframeClickInterceptor,\n useEditorEnabled,\n useChangedContentActions,\n} from '@intlayer/editor-react';\nimport { useEffect, type FC, type PropsWithChildren } from 'react';\n\nconst IntlayerEditorHooksEnabled: FC = () => {\n /**\n * URL Messages\n */\n useCrossURLPathSetter();\n\n /**\n * Locale Dictionaries Messages\n */\n const { setLocaleDictionaries } = useDictionariesRecordActions();\n\n useEffect(() => {\n setLocaleDictionaries(\n dictionaries as unknown as Record<string, Dictionary>\n );\n }, []);\n\n /**\n * Click Messages\n */\n useIframeClickInterceptor();\n\n /**\n * Hot reloading\n */\n const { setChangedContent } = useChangedContentActions();\n const { editor } = getConfiguration();\n const eventSource = new IntlayerEventListener();\n\n useEffect(() => {\n if (!editor.hotReload) return;\n if (!editor.clientId) return;\n if (!editor.clientSecret) return;\n\n eventSource.initialize();\n\n eventSource.onDictionaryChange = (dictionary) =>\n setChangedContent(dictionary.key, dictionary.content);\n\n return () => eventSource.cleanup();\n }, []);\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 configuration = getConfiguration();\n\n const { editor } = configuration;\n\n return (\n <EditorProvider\n postMessage={(data: any) => {\n if (typeof window === 'undefined') return;\n\n if (editor.applicationURL.length > 0) {\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 }\n\n if (editor.editorURL.length > 0) {\n window.parent?.postMessage(\n data,\n // Use to restrict the origin of the editor for security reasons.\n // Correspond to the editor URL to synchronize the locales states.\n editor.editorURL\n );\n }\n\n if (editor.cmsURL.length > 0) {\n window.parent?.postMessage(\n data,\n // Use to restrict the origin of the CMS for security reasons.\n // Correspond to the CMS URL.\n editor.cmsURL\n );\n }\n }}\n allowedOrigins={[editor.editorURL, editor.cmsURL, editor.applicationURL]}\n mode=\"client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YAAI,OAAO,UAAU,SAAS,GAAG;AAC/B,iBAAO,QAAQ;AAAA,YACb;AAAA;AAAA;AAAA,YAGA,OAAO;AAAA,UACT;AAAA,QACF;AAEA,YAAI,OAAO,OAAO,SAAS,GAAG;AAC5B,iBAAO,QAAQ;AAAA,YACb;AAAA;AAAA;AAAA,YAGA,OAAO;AAAA,UACT;AAAA,QACF;AAAA,MACF;AAAA,MACA,gBAAgB,CAAC,OAAO,WAAW,OAAO,QAAQ,OAAO,cAAc;AAAA,MACvE,MAAK;AAAA,MACL;AAAA,MAEA;AAAA,oDAAC,sBAAmB;AAAA,QACnB;AAAA;AAAA;AAAA,EACH;AAEJ;","names":["dictionaries"]}
|
|
@@ -25,7 +25,7 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
25
25
|
var import_IntlayerNode = require('../IntlayerNode.cjs');
|
|
26
26
|
var import_ContentSelectorWrapper = require('./ContentSelectorWrapper.cjs');
|
|
27
27
|
const renderIntlayerEditor = (props) => (0, import_IntlayerNode.rendererIntlayerNode)({
|
|
28
|
-
value: props.content,
|
|
28
|
+
value: props.value ?? props.content,
|
|
29
29
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ContentSelectorWrapper.ContentSelectorWrapper, { ...props, children: props.content })
|
|
30
30
|
});
|
|
31
31
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/editor/renderContentEditor.tsx"],"sourcesContent":["import { type NodeProps } from '@intlayer/core';\nimport { type IntlayerNode, rendererIntlayerNode } from '../IntlayerNode';\nimport {\n ContentSelectorWrapper,\n type ContentSelectorWrapperProps,\n} from './ContentSelectorWrapper';\n\nexport type RenderIntlayerEditorProps = Omit<\n ContentSelectorWrapperProps,\n 'children' | 'content'\n> &\n NodeProps;\n\nexport const renderIntlayerEditor = (\n props: RenderIntlayerEditorProps\n): IntlayerNode =>\n rendererIntlayerNode({\n value: props.content,\n children: (\n <ContentSelectorWrapper {...props}>\n {props.content}\n </ContentSelectorWrapper>\n ),\n });\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
1
|
+
{"version":3,"sources":["../../../src/editor/renderContentEditor.tsx"],"sourcesContent":["import { type NodeProps } from '@intlayer/core';\nimport { type IntlayerNode, rendererIntlayerNode } from '../IntlayerNode';\nimport {\n ContentSelectorWrapper,\n type ContentSelectorWrapperProps,\n} from './ContentSelectorWrapper';\n\nexport type RenderIntlayerEditorProps = Omit<\n ContentSelectorWrapperProps,\n 'children' | 'content'\n> &\n NodeProps & {\n value?: string;\n };\n\nexport const renderIntlayerEditor = (\n props: RenderIntlayerEditorProps\n): IntlayerNode =>\n rendererIntlayerNode({\n value: props.value ?? props.content,\n children: (\n <ContentSelectorWrapper {...props}>\n {props.content}\n </ContentSelectorWrapper>\n ),\n });\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAqBM;AApBN,0BAAwD;AACxD,oCAGO;AAUA,MAAM,uBAAuB,CAClC,cAEA,0CAAqB;AAAA,EACnB,OAAO,MAAM,SAAS,MAAM;AAAA,EAC5B,UACE,4CAAC,wDAAwB,GAAG,OACzB,gBAAM,SACT;AAEJ,CAAC;","names":[]}
|
|
@@ -22,12 +22,8 @@ __export(renderMarkdown_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(renderMarkdown_exports);
|
|
24
24
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
-
var import_IntlayerNode = require('../IntlayerNode.cjs');
|
|
26
25
|
var import_MarkdownRenderer = require('./MarkdownRenderer.cjs');
|
|
27
|
-
const renderMarkdown = (markdown) => (0,
|
|
28
|
-
value: markdown,
|
|
29
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_MarkdownRenderer.MarkdownRenderer, { markdown })
|
|
30
|
-
});
|
|
26
|
+
const renderMarkdown = (markdown) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_MarkdownRenderer.MarkdownRenderer, { markdown });
|
|
31
27
|
// Annotate the CommonJS export names for ESM import in node:
|
|
32
28
|
0 && (module.exports = {
|
|
33
29
|
renderMarkdown
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/markdown/renderMarkdown.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../src/markdown/renderMarkdown.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { MarkdownRenderer } from './MarkdownRenderer';\n\nexport const renderMarkdown = (markdown: string): ReactNode => (\n <MarkdownRenderer markdown={markdown} />\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIE;AAHF,8BAAiC;AAE1B,MAAM,iBAAiB,CAAC,aAC7B,4CAAC,4CAAiB,UAAoB;","names":[]}
|
package/dist/cjs/plugins.cjs
CHANGED
|
@@ -37,11 +37,27 @@ const intlayerNodePlugins = {
|
|
|
37
37
|
};
|
|
38
38
|
const reactNodePlugins = {
|
|
39
39
|
canHandle: (node) => typeof node === "object" && typeof node.props !== "undefined" && typeof node.key !== "undefined",
|
|
40
|
-
transform:
|
|
40
|
+
transform: (node, {
|
|
41
|
+
plugins,
|
|
42
|
+
// Removed to avoid next error - Functions cannot be passed directly to Client Components
|
|
43
|
+
...rest
|
|
44
|
+
}) => (0, import_editor.renderIntlayerEditor)({
|
|
45
|
+
...rest,
|
|
46
|
+
content: (0, import_renderReactElement.renderReactElement)(node),
|
|
47
|
+
value: "[[react-element]]"
|
|
48
|
+
})
|
|
41
49
|
};
|
|
42
50
|
const markdownPlugin = {
|
|
43
51
|
canHandle: (node) => typeof node === "object" && node?.nodeType === import_core.NodeType.Markdown,
|
|
44
|
-
transform: (node
|
|
52
|
+
transform: (node, {
|
|
53
|
+
plugins,
|
|
54
|
+
// Removed to avoid next error - Functions cannot be passed directly to Client Components
|
|
55
|
+
...rest
|
|
56
|
+
}) => (0, import_editor.renderIntlayerEditor)({
|
|
57
|
+
...rest,
|
|
58
|
+
content: (0, import_renderMarkdown.renderMarkdown)(node[import_core.NodeType.Markdown]),
|
|
59
|
+
value: node[import_core.NodeType.Markdown]
|
|
60
|
+
})
|
|
45
61
|
};
|
|
46
62
|
// Annotate the CommonJS export names for ESM import in node:
|
|
47
63
|
0 && (module.exports = {
|
package/dist/cjs/plugins.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/plugins.tsx"],"sourcesContent":["import {\n type Plugins,\n type IInterpreterPluginState as IInterpreterPluginStateCore,\n type DeepTransformContent as DeepTransformContentCore,\n type MarkdownContent,\n NodeType,\n} from '@intlayer/core';\nimport type { ReactNode } from 'react';\nimport { renderIntlayerEditor } from './editor';\nimport type { IntlayerNode } from './IntlayerNode';\nimport { renderMarkdown } from './markdown/renderMarkdown';\nimport { renderReactElement } from './reactElement/renderReactElement';\n\n/** ---------------------------------------------\n * INTLAYER NODE PLUGIN\n * --------------------------------------------- */\n\nexport type IntlayerNodeCond<T> = T extends number | string\n ? IntlayerNode<T>\n : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const intlayerNodePlugins: Plugins = {\n canHandle: (node) =>\n typeof node === 'bigint' ||\n typeof node === 'string' ||\n typeof node === 'number',\n transform: (\n _node,\n {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n }\n ) => renderIntlayerEditor(rest),\n};\n\n/** ---------------------------------------------\n * REACT NODE PLUGIN\n * --------------------------------------------- */\n\nexport type ReactNodeCond<T> = T extends {\n props: any;\n key: any;\n}\n ? ReactNode\n : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const reactNodePlugins: Plugins = {\n canHandle: (node) =>\n typeof node === 'object' &&\n typeof node.props !== 'undefined' &&\n typeof node.key !== 'undefined',\n\n transform: renderReactElement,\n};\n\n/**\n * MARKDOWN PLUGIN\n */\n\nexport type MarkdownCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeType.Markdown]: string;\n}\n ? IntlayerNode<string>\n : never;\n\n/** Markdown plugin. Replaces node with a function that takes quantity => string. */\nexport const markdownPlugin: Plugins = {\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Markdown,\n transform: (node: MarkdownContent)
|
|
1
|
+
{"version":3,"sources":["../../src/plugins.tsx"],"sourcesContent":["import {\n type Plugins,\n type IInterpreterPluginState as IInterpreterPluginStateCore,\n type DeepTransformContent as DeepTransformContentCore,\n type MarkdownContent,\n NodeType,\n} from '@intlayer/core';\nimport type { ReactNode } from 'react';\nimport { renderIntlayerEditor } from './editor';\nimport type { IntlayerNode } from './IntlayerNode';\nimport { renderMarkdown } from './markdown/renderMarkdown';\nimport { renderReactElement } from './reactElement/renderReactElement';\n\n/** ---------------------------------------------\n * INTLAYER NODE PLUGIN\n * --------------------------------------------- */\n\nexport type IntlayerNodeCond<T> = T extends number | string\n ? IntlayerNode<T>\n : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const intlayerNodePlugins: Plugins = {\n canHandle: (node) =>\n typeof node === 'bigint' ||\n typeof node === 'string' ||\n typeof node === 'number',\n transform: (\n _node,\n {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n }\n ) => renderIntlayerEditor(rest),\n};\n\n/** ---------------------------------------------\n * REACT NODE PLUGIN\n * --------------------------------------------- */\n\nexport type ReactNodeCond<T> = T extends {\n props: any;\n key: any;\n}\n ? ReactNode\n : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const reactNodePlugins: Plugins = {\n canHandle: (node) =>\n typeof node === 'object' &&\n typeof node.props !== 'undefined' &&\n typeof node.key !== 'undefined',\n\n transform: (\n node,\n {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n }\n ) =>\n renderIntlayerEditor({\n ...rest,\n content: renderReactElement(node),\n value: '[[react-element]]',\n }),\n};\n\n/**\n * MARKDOWN PLUGIN\n */\n\nexport type MarkdownCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeType.Markdown]: string;\n}\n ? IntlayerNode<string>\n : never;\n\n/** Markdown plugin. Replaces node with a function that takes quantity => string. */\nexport const markdownPlugin: Plugins = {\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Markdown,\n transform: (\n node: MarkdownContent,\n {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n }\n ) =>\n renderIntlayerEditor({\n ...rest,\n content: renderMarkdown(node[NodeType.Markdown]),\n value: node[NodeType.Markdown],\n }),\n};\n\n/** ---------------------------------------------\n * PLUGINS RESULT\n * --------------------------------------------- */\n\nexport interface IInterpreterPluginReact<T> {\n reactNode: ReactNodeCond<T>;\n intlayerNode: IntlayerNodeCond<T>;\n markdown: MarkdownCond<T>;\n}\n\n/**\n * Insert this type as param of `DeepTransformContent` to avoid `intlayer` package pollution.\n *\n * Otherwise the the `react-intlayer` plugins will override the types of `intlayer` functions.\n */\nexport type IInterpreterPluginState = IInterpreterPluginStateCore & {\n reactNode: true;\n intlayerNode: true;\n markdown: true;\n};\n\nexport type DeepTransformContent<T> = DeepTransformContentCore<\n T,\n IInterpreterPluginState\n>;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAMO;AAEP,oBAAqC;AAErC,4BAA+B;AAC/B,gCAAmC;AAW5B,MAAM,sBAA+B;AAAA,EAC1C,WAAW,CAAC,SACV,OAAO,SAAS,YAChB,OAAO,SAAS,YAChB,OAAO,SAAS;AAAA,EAClB,WAAW,CACT,OACA;AAAA,IACE;AAAA;AAAA,IACA,GAAG;AAAA,EACL,UACG,oCAAqB,IAAI;AAChC;AAcO,MAAM,mBAA4B;AAAA,EACvC,WAAW,CAAC,SACV,OAAO,SAAS,YAChB,OAAO,KAAK,UAAU,eACtB,OAAO,KAAK,QAAQ;AAAA,EAEtB,WAAW,CACT,MACA;AAAA,IACE;AAAA;AAAA,IACA,GAAG;AAAA,EACL,UAEA,oCAAqB;AAAA,IACnB,GAAG;AAAA,IACH,aAAS,8CAAmB,IAAI;AAAA,IAChC,OAAO;AAAA,EACT,CAAC;AACL;AAcO,MAAM,iBAA0B;AAAA,EACrC,WAAW,CAAC,SACV,OAAO,SAAS,YAAY,MAAM,aAAa,qBAAS;AAAA,EAC1D,WAAW,CACT,MACA;AAAA,IACE;AAAA;AAAA,IACA,GAAG;AAAA,EACL,UAEA,oCAAqB;AAAA,IACnB,GAAG;AAAA,IACH,aAAS,sCAAe,KAAK,qBAAS,QAAQ,CAAC;AAAA,IAC/C,OAAO,KAAK,qBAAS,QAAQ;AAAA,EAC/B,CAAC;AACL;","names":[]}
|
|
@@ -19,6 +19,7 @@ const ContentSelector = ({
|
|
|
19
19
|
const [isHovered, setIsHovered] = useState(false);
|
|
20
20
|
const [isSelectingState, setIsSelectingState] = useState(isSelectingProp);
|
|
21
21
|
const pressTimerRef = useRef(null);
|
|
22
|
+
const isChildrenString = typeof children === "string";
|
|
22
23
|
const handleOnLongPress = () => {
|
|
23
24
|
setIsSelectingState(true);
|
|
24
25
|
onSelect();
|
|
@@ -73,7 +74,7 @@ const ContentSelector = ({
|
|
|
73
74
|
"span",
|
|
74
75
|
{
|
|
75
76
|
style: {
|
|
76
|
-
display: "inline",
|
|
77
|
+
display: isChildrenString ? "inline" : "inline-block",
|
|
77
78
|
cursor: "pointer",
|
|
78
79
|
userSelect: "none",
|
|
79
80
|
borderRadius: "0.375rem",
|
|
@@ -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 = 250;\n\ntype ContentSelectorProps = {\n onPress: () => void;\n onClickOutside?: () => void;\n pressDuration?: number;\n isSelecting?: boolean;\n} & Omit<HTMLAttributes<HTMLDivElement>, 'content'>;\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":";
|
|
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} & Omit<HTMLAttributes<HTMLDivElement>, 'content'>;\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 const isChildrenString = typeof children === 'string';\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: isChildrenString ? 'inline' : 'inline-block',\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":";AAsGI;AApGJ;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAEP,MAAM,gCAAgC;AAS/B,MAAM,kBAA4C,CAAC;AAAA,EACxD;AAAA,EACA,S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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,mBAAmB,WAAW;AAAA,QACvC,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":[]}
|
|
@@ -5,7 +5,7 @@ import { getConfiguration } from "@intlayer/config/client";
|
|
|
5
5
|
import dictionaries from "@intlayer/dictionaries-entry";
|
|
6
6
|
import {
|
|
7
7
|
EditorProvider,
|
|
8
|
-
|
|
8
|
+
useCrossURLPathSetter,
|
|
9
9
|
useDictionariesRecordActions,
|
|
10
10
|
useIframeClickInterceptor,
|
|
11
11
|
useEditorEnabled,
|
|
@@ -13,10 +13,7 @@ import {
|
|
|
13
13
|
} from "@intlayer/editor-react";
|
|
14
14
|
import { useEffect } from "react";
|
|
15
15
|
const IntlayerEditorHooksEnabled = () => {
|
|
16
|
-
|
|
17
|
-
receive: false,
|
|
18
|
-
emit: true
|
|
19
|
-
});
|
|
16
|
+
useCrossURLPathSetter();
|
|
20
17
|
const { setLocaleDictionaries } = useDictionariesRecordActions();
|
|
21
18
|
useEffect(() => {
|
|
22
19
|
setLocaleDictionaries(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport { IntlayerEventListener } from '@intlayer/api';\nimport { getConfiguration } from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/core';\n/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n * The alias allow hot reload the app (such as nextjs) on any dictionary change.\n */\nimport dictionaries from '@intlayer/dictionaries-entry';\nimport {\n EditorProvider,\n
|
|
1
|
+
{"version":3,"sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport { IntlayerEventListener } from '@intlayer/api';\nimport { getConfiguration } from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/core';\n/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n * The alias allow hot reload the app (such as nextjs) on any dictionary change.\n */\nimport dictionaries from '@intlayer/dictionaries-entry';\nimport {\n EditorProvider,\n useCrossURLPathSetter,\n useDictionariesRecordActions,\n useIframeClickInterceptor,\n useEditorEnabled,\n useChangedContentActions,\n} from '@intlayer/editor-react';\nimport { useEffect, type FC, type PropsWithChildren } from 'react';\n\nconst IntlayerEditorHooksEnabled: FC = () => {\n /**\n * URL Messages\n */\n useCrossURLPathSetter();\n\n /**\n * Locale Dictionaries Messages\n */\n const { setLocaleDictionaries } = useDictionariesRecordActions();\n\n useEffect(() => {\n setLocaleDictionaries(\n dictionaries as unknown as Record<string, Dictionary>\n );\n }, []);\n\n /**\n * Click Messages\n */\n useIframeClickInterceptor();\n\n /**\n * Hot reloading\n */\n const { setChangedContent } = useChangedContentActions();\n const { editor } = getConfiguration();\n const eventSource = new IntlayerEventListener();\n\n useEffect(() => {\n if (!editor.hotReload) return;\n if (!editor.clientId) return;\n if (!editor.clientSecret) return;\n\n eventSource.initialize();\n\n eventSource.onDictionaryChange = (dictionary) =>\n setChangedContent(dictionary.key, dictionary.content);\n\n return () => eventSource.cleanup();\n }, []);\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 configuration = getConfiguration();\n\n const { editor } = configuration;\n\n return (\n <EditorProvider\n postMessage={(data: any) => {\n if (typeof window === 'undefined') return;\n\n if (editor.applicationURL.length > 0) {\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 }\n\n if (editor.editorURL.length > 0) {\n window.parent?.postMessage(\n data,\n // Use to restrict the origin of the editor for security reasons.\n // Correspond to the editor URL to synchronize the locales states.\n editor.editorURL\n );\n }\n\n if (editor.cmsURL.length > 0) {\n window.parent?.postMessage(\n data,\n // Use to restrict the origin of the CMS for security reasons.\n // Correspond to the CMS URL.\n editor.cmsURL\n );\n }\n }}\n allowedOrigins={[editor.editorURL, editor.cmsURL, editor.applicationURL]}\n mode=\"client\"\n configuration={configuration}\n >\n <IntlayerEditorHook />\n {children}\n </EditorProvider>\n );\n};\n"],"mappings":";AA+DS,wBAeL,YAfK;AA7DT,SAAS,6BAA6B;AACtC,SAAS,wBAAwB;AAOjC,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,wBAAsB;AAKtB,QAAM,EAAE,sBAAsB,IAAI,6BAA6B;AAE/D,YAAU,MAAM;AACd;AAAA,MACE;AAAA,IACF;AAAA,EACF,GAAG,CAAC,CAAC;AAKL,4BAA0B;AAK1B,QAAM,EAAE,kBAAkB,IAAI,yBAAyB;AACvD,QAAM,EAAE,OAAO,IAAI,iBAAiB;AACpC,QAAM,cAAc,IAAI,sBAAsB;A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|
|
6
6
|
const renderIntlayerEditor = (props) => rendererIntlayerNode({
|
|
7
|
-
value: props.content,
|
|
7
|
+
value: props.value ?? props.content,
|
|
8
8
|
children: /* @__PURE__ */ jsx(ContentSelectorWrapper, { ...props, children: props.content })
|
|
9
9
|
});
|
|
10
10
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/editor/renderContentEditor.tsx"],"sourcesContent":["import { type NodeProps } from '@intlayer/core';\nimport { type IntlayerNode, rendererIntlayerNode } from '../IntlayerNode';\nimport {\n ContentSelectorWrapper,\n type ContentSelectorWrapperProps,\n} from './ContentSelectorWrapper';\n\nexport type RenderIntlayerEditorProps = Omit<\n ContentSelectorWrapperProps,\n 'children' | 'content'\n> &\n NodeProps;\n\nexport const renderIntlayerEditor = (\n props: RenderIntlayerEditorProps\n): IntlayerNode =>\n rendererIntlayerNode({\n value: props.content,\n children: (\n <ContentSelectorWrapper {...props}>\n {props.content}\n </ContentSelectorWrapper>\n ),\n });\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/editor/renderContentEditor.tsx"],"sourcesContent":["import { type NodeProps } from '@intlayer/core';\nimport { type IntlayerNode, rendererIntlayerNode } from '../IntlayerNode';\nimport {\n ContentSelectorWrapper,\n type ContentSelectorWrapperProps,\n} from './ContentSelectorWrapper';\n\nexport type RenderIntlayerEditorProps = Omit<\n ContentSelectorWrapperProps,\n 'children' | 'content'\n> &\n NodeProps & {\n value?: string;\n };\n\nexport const renderIntlayerEditor = (\n props: RenderIntlayerEditorProps\n): IntlayerNode =>\n rendererIntlayerNode({\n value: props.value ?? props.content,\n children: (\n <ContentSelectorWrapper {...props}>\n {props.content}\n </ContentSelectorWrapper>\n ),\n });\n"],"mappings":"AAqBM;AApBN,SAA4B,4BAA4B;AACxD;AAAA,EACE;AAAA,OAEK;AAUA,MAAM,uBAAuB,CAClC,UAEA,qBAAqB;AAAA,EACnB,OAAO,MAAM,SAAS,MAAM;AAAA,EAC5B,UACE,oBAAC,0BAAwB,GAAG,OACzB,gBAAM,SACT;AAEJ,CAAC;","names":[]}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { rendererIntlayerNode } from "../IntlayerNode.mjs";
|
|
3
2
|
import { MarkdownRenderer } from "./MarkdownRenderer.mjs";
|
|
4
|
-
const renderMarkdown = (markdown) =>
|
|
5
|
-
value: markdown,
|
|
6
|
-
children: /* @__PURE__ */ jsx(MarkdownRenderer, { markdown })
|
|
7
|
-
});
|
|
3
|
+
const renderMarkdown = (markdown) => /* @__PURE__ */ jsx(MarkdownRenderer, { markdown });
|
|
8
4
|
export {
|
|
9
5
|
renderMarkdown
|
|
10
6
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/markdown/renderMarkdown.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../src/markdown/renderMarkdown.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { MarkdownRenderer } from './MarkdownRenderer';\n\nexport const renderMarkdown = (markdown: string): ReactNode => (\n <MarkdownRenderer markdown={markdown} />\n);\n"],"mappings":"AAIE;AAHF,SAAS,wBAAwB;AAE1B,MAAM,iBAAiB,CAAC,aAC7B,oBAAC,oBAAiB,UAAoB;","names":[]}
|
package/dist/esm/plugins.mjs
CHANGED
|
@@ -14,11 +14,27 @@ const intlayerNodePlugins = {
|
|
|
14
14
|
};
|
|
15
15
|
const reactNodePlugins = {
|
|
16
16
|
canHandle: (node) => typeof node === "object" && typeof node.props !== "undefined" && typeof node.key !== "undefined",
|
|
17
|
-
transform:
|
|
17
|
+
transform: (node, {
|
|
18
|
+
plugins,
|
|
19
|
+
// Removed to avoid next error - Functions cannot be passed directly to Client Components
|
|
20
|
+
...rest
|
|
21
|
+
}) => renderIntlayerEditor({
|
|
22
|
+
...rest,
|
|
23
|
+
content: renderReactElement(node),
|
|
24
|
+
value: "[[react-element]]"
|
|
25
|
+
})
|
|
18
26
|
};
|
|
19
27
|
const markdownPlugin = {
|
|
20
28
|
canHandle: (node) => typeof node === "object" && node?.nodeType === NodeType.Markdown,
|
|
21
|
-
transform: (node
|
|
29
|
+
transform: (node, {
|
|
30
|
+
plugins,
|
|
31
|
+
// Removed to avoid next error - Functions cannot be passed directly to Client Components
|
|
32
|
+
...rest
|
|
33
|
+
}) => renderIntlayerEditor({
|
|
34
|
+
...rest,
|
|
35
|
+
content: renderMarkdown(node[NodeType.Markdown]),
|
|
36
|
+
value: node[NodeType.Markdown]
|
|
37
|
+
})
|
|
22
38
|
};
|
|
23
39
|
export {
|
|
24
40
|
intlayerNodePlugins,
|
package/dist/esm/plugins.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/plugins.tsx"],"sourcesContent":["import {\n type Plugins,\n type IInterpreterPluginState as IInterpreterPluginStateCore,\n type DeepTransformContent as DeepTransformContentCore,\n type MarkdownContent,\n NodeType,\n} from '@intlayer/core';\nimport type { ReactNode } from 'react';\nimport { renderIntlayerEditor } from './editor';\nimport type { IntlayerNode } from './IntlayerNode';\nimport { renderMarkdown } from './markdown/renderMarkdown';\nimport { renderReactElement } from './reactElement/renderReactElement';\n\n/** ---------------------------------------------\n * INTLAYER NODE PLUGIN\n * --------------------------------------------- */\n\nexport type IntlayerNodeCond<T> = T extends number | string\n ? IntlayerNode<T>\n : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const intlayerNodePlugins: Plugins = {\n canHandle: (node) =>\n typeof node === 'bigint' ||\n typeof node === 'string' ||\n typeof node === 'number',\n transform: (\n _node,\n {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n }\n ) => renderIntlayerEditor(rest),\n};\n\n/** ---------------------------------------------\n * REACT NODE PLUGIN\n * --------------------------------------------- */\n\nexport type ReactNodeCond<T> = T extends {\n props: any;\n key: any;\n}\n ? ReactNode\n : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const reactNodePlugins: Plugins = {\n canHandle: (node) =>\n typeof node === 'object' &&\n typeof node.props !== 'undefined' &&\n typeof node.key !== 'undefined',\n\n transform: renderReactElement,\n};\n\n/**\n * MARKDOWN PLUGIN\n */\n\nexport type MarkdownCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeType.Markdown]: string;\n}\n ? IntlayerNode<string>\n : never;\n\n/** Markdown plugin. Replaces node with a function that takes quantity => string. */\nexport const markdownPlugin: Plugins = {\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Markdown,\n transform: (node: MarkdownContent)
|
|
1
|
+
{"version":3,"sources":["../../src/plugins.tsx"],"sourcesContent":["import {\n type Plugins,\n type IInterpreterPluginState as IInterpreterPluginStateCore,\n type DeepTransformContent as DeepTransformContentCore,\n type MarkdownContent,\n NodeType,\n} from '@intlayer/core';\nimport type { ReactNode } from 'react';\nimport { renderIntlayerEditor } from './editor';\nimport type { IntlayerNode } from './IntlayerNode';\nimport { renderMarkdown } from './markdown/renderMarkdown';\nimport { renderReactElement } from './reactElement/renderReactElement';\n\n/** ---------------------------------------------\n * INTLAYER NODE PLUGIN\n * --------------------------------------------- */\n\nexport type IntlayerNodeCond<T> = T extends number | string\n ? IntlayerNode<T>\n : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const intlayerNodePlugins: Plugins = {\n canHandle: (node) =>\n typeof node === 'bigint' ||\n typeof node === 'string' ||\n typeof node === 'number',\n transform: (\n _node,\n {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n }\n ) => renderIntlayerEditor(rest),\n};\n\n/** ---------------------------------------------\n * REACT NODE PLUGIN\n * --------------------------------------------- */\n\nexport type ReactNodeCond<T> = T extends {\n props: any;\n key: any;\n}\n ? ReactNode\n : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const reactNodePlugins: Plugins = {\n canHandle: (node) =>\n typeof node === 'object' &&\n typeof node.props !== 'undefined' &&\n typeof node.key !== 'undefined',\n\n transform: (\n node,\n {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n }\n ) =>\n renderIntlayerEditor({\n ...rest,\n content: renderReactElement(node),\n value: '[[react-element]]',\n }),\n};\n\n/**\n * MARKDOWN PLUGIN\n */\n\nexport type MarkdownCond<T> = T extends {\n nodeType: NodeType | string;\n [NodeType.Markdown]: string;\n}\n ? IntlayerNode<string>\n : never;\n\n/** Markdown plugin. Replaces node with a function that takes quantity => string. */\nexport const markdownPlugin: Plugins = {\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Markdown,\n transform: (\n node: MarkdownContent,\n {\n plugins, // Removed to avoid next error - Functions cannot be passed directly to Client Components\n ...rest\n }\n ) =>\n renderIntlayerEditor({\n ...rest,\n content: renderMarkdown(node[NodeType.Markdown]),\n value: node[NodeType.Markdown],\n }),\n};\n\n/** ---------------------------------------------\n * PLUGINS RESULT\n * --------------------------------------------- */\n\nexport interface IInterpreterPluginReact<T> {\n reactNode: ReactNodeCond<T>;\n intlayerNode: IntlayerNodeCond<T>;\n markdown: MarkdownCond<T>;\n}\n\n/**\n * Insert this type as param of `DeepTransformContent` to avoid `intlayer` package pollution.\n *\n * Otherwise the the `react-intlayer` plugins will override the types of `intlayer` functions.\n */\nexport type IInterpreterPluginState = IInterpreterPluginStateCore & {\n reactNode: true;\n intlayerNode: true;\n markdown: true;\n};\n\nexport type DeepTransformContent<T> = DeepTransformContentCore<\n T,\n IInterpreterPluginState\n>;\n"],"mappings":"AAAA;AAAA,EAKE;AAAA,OACK;AAEP,SAAS,4BAA4B;AAErC,SAAS,sBAAsB;AAC/B,SAAS,0BAA0B;AAW5B,MAAM,sBAA+B;AAAA,EAC1C,WAAW,CAAC,SACV,OAAO,SAAS,YAChB,OAAO,SAAS,YAChB,OAAO,SAAS;AAAA,EAClB,WAAW,CACT,OACA;AAAA,IACE;AAAA;AAAA,IACA,GAAG;AAAA,EACL,MACG,qBAAqB,IAAI;AAChC;AAcO,MAAM,mBAA4B;AAAA,EACvC,WAAW,CAAC,SACV,OAAO,SAAS,YAChB,OAAO,KAAK,UAAU,eACtB,OAAO,KAAK,QAAQ;AAAA,EAEtB,WAAW,CACT,MACA;AAAA,IACE;AAAA;AAAA,IACA,GAAG;AAAA,EACL,MAEA,qBAAqB;AAAA,IACnB,GAAG;AAAA,IACH,SAAS,mBAAmB,IAAI;AAAA,IAChC,OAAO;AAAA,EACT,CAAC;AACL;AAcO,MAAM,iBAA0B;AAAA,EACrC,WAAW,CAAC,SACV,OAAO,SAAS,YAAY,MAAM,aAAa,SAAS;AAAA,EAC1D,WAAW,CACT,MACA;AAAA,IACE;AAAA;AAAA,IACA,GAAG;AAAA,EACL,MAEA,qBAAqB;AAAA,IACnB,GAAG;AAAA,IACH,SAAS,eAAe,KAAK,SAAS,QAAQ,CAAC;AAAA,IAC/C,OAAO,KAAK,SAAS,QAAQ;AAAA,EAC/B,CAAC;AACL;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentSelector.d.ts","sourceRoot":"","sources":["../../../src/UI/ContentSelector.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,EAAE,EAEP,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;AAIf,KAAK,oBAAoB,GAAG;IAC1B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,SAAS,CAAC,CAAC;AAEpD,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,
|
|
1
|
+
{"version":3,"file":"ContentSelector.d.ts","sourceRoot":"","sources":["../../../src/UI/ContentSelector.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,EAAE,EAEP,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;AAIf,KAAK,oBAAoB,GAAG;IAC1B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,SAAS,CAAC,CAAC;AAEpD,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAkHpD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAqDnE,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,iBAAiB,CA6CxD,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type NodeProps } from '@intlayer/core';
|
|
2
2
|
import { type IntlayerNode } from '../IntlayerNode';
|
|
3
3
|
import { type ContentSelectorWrapperProps } from './ContentSelectorWrapper';
|
|
4
|
-
export type RenderIntlayerEditorProps = Omit<ContentSelectorWrapperProps, 'children' | 'content'> & NodeProps
|
|
4
|
+
export type RenderIntlayerEditorProps = Omit<ContentSelectorWrapperProps, 'children' | 'content'> & NodeProps & {
|
|
5
|
+
value?: string;
|
|
6
|
+
};
|
|
5
7
|
export declare const renderIntlayerEditor: (props: RenderIntlayerEditorProps) => IntlayerNode;
|
|
6
8
|
//# sourceMappingURL=renderContentEditor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderContentEditor.d.ts","sourceRoot":"","sources":["../../../src/editor/renderContentEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,KAAK,YAAY,EAAwB,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAEL,KAAK,2BAA2B,EACjC,MAAM,0BAA0B,CAAC;AAElC,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAC1C,2BAA2B,EAC3B,UAAU,GAAG,SAAS,CACvB,GACC,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"renderContentEditor.d.ts","sourceRoot":"","sources":["../../../src/editor/renderContentEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,KAAK,YAAY,EAAwB,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAEL,KAAK,2BAA2B,EACjC,MAAM,0BAA0B,CAAC;AAElC,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAC1C,2BAA2B,EAC3B,UAAU,GAAG,SAAS,CACvB,GACC,SAAS,GAAG;IACV,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEJ,eAAO,MAAM,oBAAoB,UACxB,yBAAyB,KAC/B,YAQC,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const renderMarkdown: (markdown: string) =>
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export declare const renderMarkdown: (markdown: string) => ReactNode;
|
|
3
3
|
//# sourceMappingURL=renderMarkdown.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderMarkdown.d.ts","sourceRoot":"","sources":["../../../src/markdown/renderMarkdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"renderMarkdown.d.ts","sourceRoot":"","sources":["../../../src/markdown/renderMarkdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,eAAO,MAAM,cAAc,aAAc,MAAM,KAAG,SAEjD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/plugins.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,uBAAuB,IAAI,2BAA2B,EAC3D,KAAK,oBAAoB,IAAI,wBAAwB,EAErD,QAAQ,EACT,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAInD;;oDAEoD;AAEpD,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAAG,MAAM,GACvD,YAAY,CAAC,CAAC,CAAC,GACf,KAAK,CAAC;AAEV,wFAAwF;AACxF,eAAO,MAAM,mBAAmB,EAAE,OAYjC,CAAC;AAEF;;oDAEoD;AAEpD,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,SAAS;IACvC,KAAK,EAAE,GAAG,CAAC;IACX,GAAG,EAAE,GAAG,CAAC;CACV,GACG,SAAS,GACT,KAAK,CAAC;AAEV,wFAAwF;AACxF,eAAO,MAAM,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/plugins.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,uBAAuB,IAAI,2BAA2B,EAC3D,KAAK,oBAAoB,IAAI,wBAAwB,EAErD,QAAQ,EACT,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAA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AuB,CACxB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-intlayer",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your React applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -68,11 +68,11 @@
|
|
|
68
68
|
],
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"js-cookie": "^3.0.5",
|
|
71
|
-
"@intlayer/api": "5.1.
|
|
72
|
-
"@intlayer/config": "5.1.
|
|
73
|
-
"@intlayer/
|
|
74
|
-
"@intlayer/
|
|
75
|
-
"@intlayer/editor-react": "5.1.
|
|
71
|
+
"@intlayer/api": "5.1.7",
|
|
72
|
+
"@intlayer/config": "5.1.7",
|
|
73
|
+
"@intlayer/core": "5.1.7",
|
|
74
|
+
"@intlayer/dictionaries-entry": "5.1.7",
|
|
75
|
+
"@intlayer/editor-react": "5.1.7"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@craco/types": "^7.1.0",
|
|
@@ -89,19 +89,19 @@
|
|
|
89
89
|
"typescript": "^5.7.3",
|
|
90
90
|
"@utils/eslint-config": "1.0.4",
|
|
91
91
|
"@utils/ts-config": "1.0.4",
|
|
92
|
-
"@utils/ts-config-types": "1.0.4",
|
|
93
92
|
"@utils/tsup-config": "1.0.4",
|
|
94
|
-
"@
|
|
93
|
+
"@utils/ts-config-types": "1.0.4",
|
|
94
|
+
"@intlayer/backend": "5.1.7"
|
|
95
95
|
},
|
|
96
96
|
"peerDependencies": {
|
|
97
97
|
"react": ">=16.0.0",
|
|
98
98
|
"react-dom": ">=16.0.0",
|
|
99
|
-
"@intlayer/api": "5.1.
|
|
100
|
-
"@intlayer/
|
|
101
|
-
"@intlayer/
|
|
102
|
-
"@intlayer/dictionaries-entry": "5.1.
|
|
103
|
-
"@intlayer/editor-react": "5.1.
|
|
104
|
-
"intlayer": "5.1.
|
|
99
|
+
"@intlayer/api": "5.1.7",
|
|
100
|
+
"@intlayer/config": "5.1.7",
|
|
101
|
+
"@intlayer/core": "5.1.7",
|
|
102
|
+
"@intlayer/dictionaries-entry": "5.1.7",
|
|
103
|
+
"@intlayer/editor-react": "5.1.7",
|
|
104
|
+
"intlayer": "5.1.7"
|
|
105
105
|
},
|
|
106
106
|
"engines": {
|
|
107
107
|
"node": ">=14.18"
|