react-intlayer 8.3.3 → 8.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/editor/ContentSelectorWrapper.cjs +1 -1
- package/dist/cjs/editor/ContentSelectorWrapper.cjs.map +1 -1
- package/dist/cjs/editor/IntlayerEditorProvider.cjs +1 -1
- package/dist/cjs/editor/IntlayerEditorProvider.cjs.map +1 -1
- package/dist/cjs/editor/useEditedContentRenderer.cjs +1 -1
- package/dist/cjs/editor/useEditedContentRenderer.cjs.map +1 -1
- package/dist/esm/editor/ContentSelectorWrapper.mjs +1 -1
- package/dist/esm/editor/ContentSelectorWrapper.mjs.map +1 -1
- package/dist/esm/editor/IntlayerEditorProvider.mjs +1 -1
- package/dist/esm/editor/IntlayerEditorProvider.mjs.map +1 -1
- package/dist/esm/editor/useEditedContentRenderer.mjs +1 -1
- package/dist/esm/editor/useEditedContentRenderer.mjs.map +1 -1
- package/dist/types/editor/ContentSelectorWrapper.d.ts +10 -0
- package/dist/types/editor/ContentSelectorWrapper.d.ts.map +1 -1
- package/dist/types/editor/IntlayerEditorProvider.d.ts +4 -0
- package/dist/types/editor/IntlayerEditorProvider.d.ts.map +1 -1
- package/dist/types/editor/useEditedContentRenderer.d.ts +1 -1
- package/dist/types/html/HTMLRendererPlugin.d.ts +1 -1
- package/package.json +10 -10
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../client/IntlayerProvider.cjs`)
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../client/IntlayerProvider.cjs`);let t=require(`@intlayer/types/nodeType`),n=require(`react`),r=require(`@intlayer/core/utils`),i=require(`@intlayer/editor`),a=require(`@intlayer/editor-react`),o=require(`react/jsx-runtime`);const s=({children:e,dictionaryKey:s,keyPath:c})=>{let{focusedContent:l,setFocusedContent:u}=(0,a.useFocusDictionary)(),{postMessage:d,senderId:f}=(0,a.useCommunicator)(),p=(0,n.useRef)(null),m=c.filter(e=>e.type!==t.NodeType.Translation),h=(l?.dictionaryKey===s&&(l?.keyPath?.length??0)>0&&(0,r.isSameKeyPath)(l?.keyPath??[],m))??!1;return(0,n.useEffect)(()=>{let e=p.current;if(!e)return;let t=()=>{u({dictionaryKey:s,keyPath:m})},n=()=>{d({type:`${i.MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,data:{dictionaryKey:s,keyPath:m},senderId:f})},r=()=>{d({type:`${i.MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,data:null,senderId:f})};return e.addEventListener(`intlayer:press`,t),e.addEventListener(`intlayer:hover`,n),e.addEventListener(`intlayer:unhover`,r),()=>{e.removeEventListener(`intlayer:press`,t),e.removeEventListener(`intlayer:hover`,n),e.removeEventListener(`intlayer:unhover`,r)}}),(0,o.jsx)(`intlayer-content-selector`,{ref:p,"is-selecting":h||void 0,children:e})},c=({children:t,...n})=>{let{enabled:r}=(0,a.useEditorEnabled)(),{disableEditor:i}=e.useIntlayerContext();return r&&!i?(0,o.jsx)(s,{...n,children:t}):t};exports.ContentSelectorRenderer=c;
|
|
2
2
|
//# sourceMappingURL=ContentSelectorWrapper.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentSelectorWrapper.cjs","names":["NodeType","
|
|
1
|
+
{"version":3,"file":"ContentSelectorWrapper.cjs","names":["NodeType","MessageKey","useIntlayerContext"],"sources":["../../../src/editor/ContentSelectorWrapper.tsx"],"sourcesContent":["'use client';\n\nimport type { NodeProps } from '@intlayer/core/interpreter';\nimport { isSameKeyPath } from '@intlayer/core/utils';\nimport { MessageKey } from '@intlayer/editor';\nimport {\n useCommunicator,\n useEditorEnabled,\n useFocusDictionary,\n} from '@intlayer/editor-react';\nimport { NodeType } from '@intlayer/types/nodeType';\nimport { type FC, type HTMLAttributes, useEffect, useRef } from 'react';\nimport { useIntlayerContext } from '../client';\n\n// JSX declaration for the Lit web component\ndeclare global {\n namespace JSX {\n interface IntrinsicElements {\n 'intlayer-content-selector': React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLElement> & {\n 'is-selecting'?: boolean;\n 'press-duration'?: number;\n },\n HTMLElement\n >;\n }\n }\n}\n\nexport type ContentSelectorWrapperProps = NodeProps &\n Omit<HTMLAttributes<HTMLDivElement>, 'children'>;\n\nconst ContentSelectorWrapperContent: FC<ContentSelectorWrapperProps> = ({\n children,\n dictionaryKey,\n keyPath,\n}) => {\n const { focusedContent, setFocusedContent } = useFocusDictionary();\n const { postMessage, senderId } = useCommunicator();\n const ref = useRef<HTMLElement>(null);\n\n const filteredKeyPath = keyPath.filter(\n (key) => key.type !== NodeType.Translation\n );\n\n const isSelected =\n (focusedContent?.dictionaryKey === dictionaryKey &&\n (focusedContent?.keyPath?.length ?? 0) > 0 &&\n isSameKeyPath(focusedContent?.keyPath ?? [], filteredKeyPath)) ??\n false;\n\n // React 18: web component custom events are not forwarded via JSX — use addEventListener\n useEffect(() => {\n const el = ref.current;\n if (!el) return;\n\n const handlePress = () => {\n setFocusedContent({ dictionaryKey, keyPath: filteredKeyPath });\n };\n\n const handleHover = () => {\n postMessage({\n type: `${MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,\n data: { dictionaryKey, keyPath: filteredKeyPath },\n senderId,\n });\n };\n\n const handleUnhover = () => {\n postMessage({\n type: `${MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,\n data: null,\n senderId,\n });\n };\n\n el.addEventListener('intlayer:press', handlePress);\n el.addEventListener('intlayer:hover', handleHover);\n el.addEventListener('intlayer:unhover', handleUnhover);\n return () => {\n el.removeEventListener('intlayer:press', handlePress);\n el.removeEventListener('intlayer:hover', handleHover);\n el.removeEventListener('intlayer:unhover', handleUnhover);\n };\n });\n\n return (\n // @ts-ignore — ref typing for custom elements\n <intlayer-content-selector ref={ref} is-selecting={isSelected || undefined}>\n {children}\n </intlayer-content-selector>\n );\n};\n\nexport const ContentSelectorRenderer: FC<ContentSelectorWrapperProps> = ({\n children,\n ...props\n}) => {\n const { enabled } = useEditorEnabled();\n const { disableEditor } = useIntlayerContext();\n\n if (enabled && !disableEditor) {\n return (\n <ContentSelectorWrapperContent {...props}>\n {children}\n </ContentSelectorWrapperContent>\n );\n }\n\n return children;\n};\n"],"mappings":"+WAgCA,MAAM,GAAkE,CACtE,WACA,gBACA,aACI,CACJ,GAAM,CAAE,iBAAgB,sBAAA,EAAA,EAAA,qBAA0C,CAC5D,CAAE,cAAa,aAAA,EAAA,EAAA,kBAA8B,CAC7C,GAAA,EAAA,EAAA,QAA0B,KAAK,CAE/B,EAAkB,EAAQ,OAC7B,GAAQ,EAAI,OAASA,EAAAA,SAAS,YAChC,CAEK,GACH,GAAgB,gBAAkB,IAChC,GAAgB,SAAS,QAAU,GAAK,IAAA,EAAA,EAAA,eAC3B,GAAgB,SAAW,EAAE,CAAE,EAAgB,GAC/D,GAqCF,OAlCA,EAAA,EAAA,eAAgB,CACd,IAAM,EAAK,EAAI,QACf,GAAI,CAAC,EAAI,OAET,IAAM,MAAoB,CACxB,EAAkB,CAAE,gBAAe,QAAS,EAAiB,CAAC,EAG1D,MAAoB,CACxB,EAAY,CACV,KAAM,GAAGC,EAAAA,WAAW,iCAAiC,OACrD,KAAM,CAAE,gBAAe,QAAS,EAAiB,CACjD,WACD,CAAC,EAGE,MAAsB,CAC1B,EAAY,CACV,KAAM,GAAGA,EAAAA,WAAW,iCAAiC,OACrD,KAAM,KACN,WACD,CAAC,EAMJ,OAHA,EAAG,iBAAiB,iBAAkB,EAAY,CAClD,EAAG,iBAAiB,iBAAkB,EAAY,CAClD,EAAG,iBAAiB,mBAAoB,EAAc,KACzC,CACX,EAAG,oBAAoB,iBAAkB,EAAY,CACrD,EAAG,oBAAoB,iBAAkB,EAAY,CACrD,EAAG,oBAAoB,mBAAoB,EAAc,GAE3D,EAIA,EAAA,EAAA,KAAC,4BAAD,CAAgC,MAAK,eAAc,GAAc,IAAA,GAC9D,WACyB,CAAA,EAInB,GAA4D,CACvE,WACA,GAAG,KACC,CACJ,GAAM,CAAE,YAAA,EAAA,EAAA,mBAA8B,CAChC,CAAE,iBAAkBC,EAAAA,oBAAoB,CAU9C,OARI,GAAW,CAAC,GAEZ,EAAA,EAAA,KAAC,EAAD,CAA+B,GAAI,EAChC,WAC6B,CAAA,CAI7B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`})
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`@intlayer/editor-react`),t=require(`react/jsx-runtime`);const n=({children:n})=>(0,t.jsx)(e.EditorProvider,{mode:`client`,children:n});exports.IntlayerEditorProvider=n;
|
|
2
2
|
//# sourceMappingURL=IntlayerEditorProvider.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntlayerEditorProvider.cjs","names":["
|
|
1
|
+
{"version":3,"file":"IntlayerEditorProvider.cjs","names":["EditorProvider"],"sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport { EditorProvider } from '@intlayer/editor-react';\nimport type { FC, PropsWithChildren } from 'react';\n\n/**\n * Wraps the application with the Intlayer editor provider in client mode.\n * All configuration (URLs, origins) is read from @intlayer/config/built.\n */\nexport const IntlayerEditorProvider: FC<PropsWithChildren> = ({ children }) => (\n <EditorProvider mode=\"client\">{children}</EditorProvider>\n);\n"],"mappings":"oMASA,MAAa,GAAiD,CAAE,eAC9D,EAAA,EAAA,KAACA,EAAAA,eAAD,CAAgB,KAAK,SAAU,WAA0B,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./ContentSelectorWrapper.cjs`);let t=require(`@intlayer/core/interpreter`),n=require(`react`),r=require(`@intlayer/editor-react`);const i=({dictionaryKey:e,keyPath:t,children:n})=>{let i=(0,r.useEditedContentActions)();return i?i.getEditedContentValue(e,t)??n:n},a=r=>{let a=i(r);if(typeof a==`object`){let i=(0,t.getContent)(a,r,r.locale);return typeof i==`string`?(0,n.createElement)(e.ContentSelectorRenderer,{...r,key:r.children},i):(console.error(`Incorrect edited content format. Content type: ${typeof i}. Expected string. Value ${JSON.stringify(i)}`),(0,n.createElement)(e.ContentSelectorRenderer,{...r,key:r.children},r.children))}return(0,n.createElement)(e.ContentSelectorRenderer,{...r,key:r.children},a)};exports.EditedContentRenderer=a,exports.useEditedContentRenderer=i;
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./ContentSelectorWrapper.cjs`);let t=require(`@intlayer/core/interpreter`),n=require(`react`),r=require(`@intlayer/editor-react`);const i=({dictionaryKey:e,keyPath:t,children:n})=>{let i=(0,r.useEditedContentActions)();return i?i.getEditedContentValue(e,t)??n:n},a=r=>{let a=i(r);if(typeof a==`object`){let i=(0,t.getContent)(a,{...r,locale:r.locale},(0,t.getBasePlugins)(r.locale));return typeof i==`string`?(0,n.createElement)(e.ContentSelectorRenderer,{...r,key:r.children},i):(console.error(`Incorrect edited content format. Content type: ${typeof i}. Expected string. Value ${JSON.stringify(i)}`),(0,n.createElement)(e.ContentSelectorRenderer,{...r,key:r.children},r.children))}return(0,n.createElement)(e.ContentSelectorRenderer,{...r,key:r.children},a)};exports.EditedContentRenderer=a,exports.useEditedContentRenderer=i;
|
|
2
2
|
//# sourceMappingURL=useEditedContentRenderer.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEditedContentRenderer.cjs","names":["ContentSelectorRenderer"],"sources":["../../../src/editor/useEditedContentRenderer.tsx"],"sourcesContent":["'use client';\n\nimport { getContent } from '@intlayer/core/interpreter';\nimport { useEditedContentActions } from '@intlayer/editor-react';\nimport type {
|
|
1
|
+
{"version":3,"file":"useEditedContentRenderer.cjs","names":["ContentSelectorRenderer"],"sources":["../../../src/editor/useEditedContentRenderer.tsx"],"sourcesContent":["'use client';\n\nimport { getBasePlugins, getContent } from '@intlayer/core/interpreter';\nimport { useEditedContentActions } from '@intlayer/editor-react';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport type { FC } from 'react';\nimport { ContentSelectorRenderer } from './ContentSelectorWrapper';\n\ntype EditedContentRendererProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n children: string;\n locale?: Locale;\n};\n\nexport const useEditedContentRenderer = ({\n dictionaryKey,\n keyPath,\n children,\n}: EditedContentRendererProps) => {\n const editedContentContext = useEditedContentActions();\n\n if (editedContentContext) {\n const editedValue = editedContentContext.getEditedContentValue(\n dictionaryKey,\n keyPath\n ) as string;\n\n const value = editedValue ?? children;\n\n return value;\n }\n\n return children;\n};\n\nexport const EditedContentRenderer: FC<EditedContentRendererProps> = (\n props\n) => {\n const content = useEditedContentRenderer(props);\n\n if (typeof content === 'object') {\n const transformedEditedContent = getContent(\n content,\n { ...props, locale: props.locale },\n getBasePlugins(props.locale)\n );\n\n if (typeof transformedEditedContent !== 'string') {\n console.error(\n `Incorrect edited content format. Content type: ${typeof transformedEditedContent}. Expected string. Value ${JSON.stringify(transformedEditedContent)}`\n );\n\n return (\n <ContentSelectorRenderer {...props} key={props.children}>\n {props.children}\n </ContentSelectorRenderer>\n );\n }\n\n return (\n <ContentSelectorRenderer {...props} key={props.children}>\n {transformedEditedContent}\n </ContentSelectorRenderer>\n );\n }\n\n return (\n <ContentSelectorRenderer {...props} key={props.children}>\n {content}\n </ContentSelectorRenderer>\n );\n};\n"],"mappings":"gRAgBA,MAAa,GAA4B,CACvC,gBACA,UACA,cACgC,CAChC,IAAM,GAAA,EAAA,EAAA,0BAAgD,CAatD,OAXI,EACkB,EAAqB,sBACvC,EACA,EACD,EAE4B,EAKxB,GAGI,EACX,GACG,CACH,IAAM,EAAU,EAAyB,EAAM,CAE/C,GAAI,OAAO,GAAY,SAAU,CAC/B,IAAM,GAAA,EAAA,EAAA,YACJ,EACA,CAAE,GAAG,EAAO,OAAQ,EAAM,OAAQ,EAAA,EAAA,EAAA,gBACnB,EAAM,OAAO,CAC7B,CAcD,OAZI,OAAO,GAA6B,UAatC,EAAA,EAAA,eAACA,EAAAA,wBAAD,CAAyB,GAAI,EAAO,IAAK,EAAM,SAErB,CADvB,EACuB,EAd1B,QAAQ,MACN,kDAAkD,OAAO,EAAyB,2BAA2B,KAAK,UAAU,EAAyB,GACtJ,EAGC,EAAA,EAAA,eAACA,EAAAA,wBAAD,CAAyB,GAAI,EAAO,IAAK,EAAM,SAErB,CADvB,EAAM,SACiB,EAWhC,OACE,EAAA,EAAA,eAACA,EAAAA,wBAAD,CAAyB,GAAI,EAAO,IAAK,EAAM,SAErB,CADvB,EACuB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{useIntlayerContext as e}from"../client/IntlayerProvider.mjs";import{
|
|
1
|
+
"use client";import{useIntlayerContext as e}from"../client/IntlayerProvider.mjs";import{NodeType as t}from"@intlayer/types/nodeType";import{useEffect as n,useRef as r}from"react";import{isSameKeyPath as i}from"@intlayer/core/utils";import{MessageKey as a}from"@intlayer/editor";import{useCommunicator as o,useEditorEnabled as s,useFocusDictionary as c}from"@intlayer/editor-react";import{jsx as l}from"react/jsx-runtime";const u=({children:e,dictionaryKey:s,keyPath:u})=>{let{focusedContent:d,setFocusedContent:f}=c(),{postMessage:p,senderId:m}=o(),h=r(null),g=u.filter(e=>e.type!==t.Translation),_=(d?.dictionaryKey===s&&(d?.keyPath?.length??0)>0&&i(d?.keyPath??[],g))??!1;return n(()=>{let e=h.current;if(!e)return;let t=()=>{f({dictionaryKey:s,keyPath:g})},n=()=>{p({type:`${a.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,data:{dictionaryKey:s,keyPath:g},senderId:m})},r=()=>{p({type:`${a.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,data:null,senderId:m})};return e.addEventListener(`intlayer:press`,t),e.addEventListener(`intlayer:hover`,n),e.addEventListener(`intlayer:unhover`,r),()=>{e.removeEventListener(`intlayer:press`,t),e.removeEventListener(`intlayer:hover`,n),e.removeEventListener(`intlayer:unhover`,r)}}),l(`intlayer-content-selector`,{ref:h,"is-selecting":_||void 0,children:e})},d=({children:t,...n})=>{let{enabled:r}=s(),{disableEditor:i}=e();return r&&!i?l(u,{...n,children:t}):t};export{d as ContentSelectorRenderer};
|
|
2
2
|
//# sourceMappingURL=ContentSelectorWrapper.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentSelectorWrapper.mjs","names":[],"sources":["../../../src/editor/ContentSelectorWrapper.tsx"],"sourcesContent":["'use client';\n\nimport type { NodeProps } from '@intlayer/core/interpreter';\nimport { isSameKeyPath } from '@intlayer/core/utils';\nimport {\n
|
|
1
|
+
{"version":3,"file":"ContentSelectorWrapper.mjs","names":[],"sources":["../../../src/editor/ContentSelectorWrapper.tsx"],"sourcesContent":["'use client';\n\nimport type { NodeProps } from '@intlayer/core/interpreter';\nimport { isSameKeyPath } from '@intlayer/core/utils';\nimport { MessageKey } from '@intlayer/editor';\nimport {\n useCommunicator,\n useEditorEnabled,\n useFocusDictionary,\n} from '@intlayer/editor-react';\nimport { NodeType } from '@intlayer/types/nodeType';\nimport { type FC, type HTMLAttributes, useEffect, useRef } from 'react';\nimport { useIntlayerContext } from '../client';\n\n// JSX declaration for the Lit web component\ndeclare global {\n namespace JSX {\n interface IntrinsicElements {\n 'intlayer-content-selector': React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLElement> & {\n 'is-selecting'?: boolean;\n 'press-duration'?: number;\n },\n HTMLElement\n >;\n }\n }\n}\n\nexport type ContentSelectorWrapperProps = NodeProps &\n Omit<HTMLAttributes<HTMLDivElement>, 'children'>;\n\nconst ContentSelectorWrapperContent: FC<ContentSelectorWrapperProps> = ({\n children,\n dictionaryKey,\n keyPath,\n}) => {\n const { focusedContent, setFocusedContent } = useFocusDictionary();\n const { postMessage, senderId } = useCommunicator();\n const ref = useRef<HTMLElement>(null);\n\n const filteredKeyPath = keyPath.filter(\n (key) => key.type !== NodeType.Translation\n );\n\n const isSelected =\n (focusedContent?.dictionaryKey === dictionaryKey &&\n (focusedContent?.keyPath?.length ?? 0) > 0 &&\n isSameKeyPath(focusedContent?.keyPath ?? [], filteredKeyPath)) ??\n false;\n\n // React 18: web component custom events are not forwarded via JSX — use addEventListener\n useEffect(() => {\n const el = ref.current;\n if (!el) return;\n\n const handlePress = () => {\n setFocusedContent({ dictionaryKey, keyPath: filteredKeyPath });\n };\n\n const handleHover = () => {\n postMessage({\n type: `${MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,\n data: { dictionaryKey, keyPath: filteredKeyPath },\n senderId,\n });\n };\n\n const handleUnhover = () => {\n postMessage({\n type: `${MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,\n data: null,\n senderId,\n });\n };\n\n el.addEventListener('intlayer:press', handlePress);\n el.addEventListener('intlayer:hover', handleHover);\n el.addEventListener('intlayer:unhover', handleUnhover);\n return () => {\n el.removeEventListener('intlayer:press', handlePress);\n el.removeEventListener('intlayer:hover', handleHover);\n el.removeEventListener('intlayer:unhover', handleUnhover);\n };\n });\n\n return (\n // @ts-ignore — ref typing for custom elements\n <intlayer-content-selector ref={ref} is-selecting={isSelected || undefined}>\n {children}\n </intlayer-content-selector>\n );\n};\n\nexport const ContentSelectorRenderer: FC<ContentSelectorWrapperProps> = ({\n children,\n ...props\n}) => {\n const { enabled } = useEditorEnabled();\n const { disableEditor } = useIntlayerContext();\n\n if (enabled && !disableEditor) {\n return (\n <ContentSelectorWrapperContent {...props}>\n {children}\n </ContentSelectorWrapperContent>\n );\n }\n\n return children;\n};\n"],"mappings":"qaAgCA,MAAM,GAAkE,CACtE,WACA,gBACA,aACI,CACJ,GAAM,CAAE,iBAAgB,qBAAsB,GAAoB,CAC5D,CAAE,cAAa,YAAa,GAAiB,CAC7C,EAAM,EAAoB,KAAK,CAE/B,EAAkB,EAAQ,OAC7B,GAAQ,EAAI,OAAS,EAAS,YAChC,CAEK,GACH,GAAgB,gBAAkB,IAChC,GAAgB,SAAS,QAAU,GAAK,GACzC,EAAc,GAAgB,SAAW,EAAE,CAAE,EAAgB,GAC/D,GAqCF,OAlCA,MAAgB,CACd,IAAM,EAAK,EAAI,QACf,GAAI,CAAC,EAAI,OAET,IAAM,MAAoB,CACxB,EAAkB,CAAE,gBAAe,QAAS,EAAiB,CAAC,EAG1D,MAAoB,CACxB,EAAY,CACV,KAAM,GAAG,EAAW,iCAAiC,OACrD,KAAM,CAAE,gBAAe,QAAS,EAAiB,CACjD,WACD,CAAC,EAGE,MAAsB,CAC1B,EAAY,CACV,KAAM,GAAG,EAAW,iCAAiC,OACrD,KAAM,KACN,WACD,CAAC,EAMJ,OAHA,EAAG,iBAAiB,iBAAkB,EAAY,CAClD,EAAG,iBAAiB,iBAAkB,EAAY,CAClD,EAAG,iBAAiB,mBAAoB,EAAc,KACzC,CACX,EAAG,oBAAoB,iBAAkB,EAAY,CACrD,EAAG,oBAAoB,iBAAkB,EAAY,CACrD,EAAG,oBAAoB,mBAAoB,EAAc,GAE3D,CAIA,EAAC,4BAAD,CAAgC,MAAK,eAAc,GAAc,IAAA,GAC9D,WACyB,CAAA,EAInB,GAA4D,CACvE,WACA,GAAG,KACC,CACJ,GAAM,CAAE,WAAY,GAAkB,CAChC,CAAE,iBAAkB,GAAoB,CAU9C,OARI,GAAW,CAAC,EAEZ,EAAC,EAAD,CAA+B,GAAI,EAChC,WAC6B,CAAA,CAI7B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import
|
|
1
|
+
"use client";import{EditorProvider as e}from"@intlayer/editor-react";import{jsx as t}from"react/jsx-runtime";const n=({children:n})=>t(e,{mode:`client`,children:n});export{n as IntlayerEditorProvider};
|
|
2
2
|
//# sourceMappingURL=IntlayerEditorProvider.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntlayerEditorProvider.mjs","names":[],"sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport
|
|
1
|
+
{"version":3,"file":"IntlayerEditorProvider.mjs","names":[],"sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport { EditorProvider } from '@intlayer/editor-react';\nimport type { FC, PropsWithChildren } from 'react';\n\n/**\n * Wraps the application with the Intlayer editor provider in client mode.\n * All configuration (URLs, origins) is read from @intlayer/config/built.\n */\nexport const IntlayerEditorProvider: FC<PropsWithChildren> = ({ children }) => (\n <EditorProvider mode=\"client\">{children}</EditorProvider>\n);\n"],"mappings":"6GASA,MAAa,GAAiD,CAAE,cAC9D,EAAC,EAAD,CAAgB,KAAK,SAAU,WAA0B,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{ContentSelectorRenderer as e}from"./ContentSelectorWrapper.mjs";import{getContent as
|
|
1
|
+
"use client";import{ContentSelectorRenderer as e}from"./ContentSelectorWrapper.mjs";import{getBasePlugins as t,getContent as n}from"@intlayer/core/interpreter";import{createElement as r}from"react";import{useEditedContentActions as i}from"@intlayer/editor-react";const a=({dictionaryKey:e,keyPath:t,children:n})=>{let r=i();return r?r.getEditedContentValue(e,t)??n:n},o=i=>{let o=a(i);if(typeof o==`object`){let a=n(o,{...i,locale:i.locale},t(i.locale));return typeof a==`string`?r(e,{...i,key:i.children},a):(console.error(`Incorrect edited content format. Content type: ${typeof a}. Expected string. Value ${JSON.stringify(a)}`),r(e,{...i,key:i.children},i.children))}return r(e,{...i,key:i.children},o)};export{o as EditedContentRenderer,a as useEditedContentRenderer};
|
|
2
2
|
//# sourceMappingURL=useEditedContentRenderer.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEditedContentRenderer.mjs","names":[],"sources":["../../../src/editor/useEditedContentRenderer.tsx"],"sourcesContent":["'use client';\n\nimport { getContent } from '@intlayer/core/interpreter';\nimport { useEditedContentActions } from '@intlayer/editor-react';\nimport type {
|
|
1
|
+
{"version":3,"file":"useEditedContentRenderer.mjs","names":[],"sources":["../../../src/editor/useEditedContentRenderer.tsx"],"sourcesContent":["'use client';\n\nimport { getBasePlugins, getContent } from '@intlayer/core/interpreter';\nimport { useEditedContentActions } from '@intlayer/editor-react';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport type { FC } from 'react';\nimport { ContentSelectorRenderer } from './ContentSelectorWrapper';\n\ntype EditedContentRendererProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n children: string;\n locale?: Locale;\n};\n\nexport const useEditedContentRenderer = ({\n dictionaryKey,\n keyPath,\n children,\n}: EditedContentRendererProps) => {\n const editedContentContext = useEditedContentActions();\n\n if (editedContentContext) {\n const editedValue = editedContentContext.getEditedContentValue(\n dictionaryKey,\n keyPath\n ) as string;\n\n const value = editedValue ?? children;\n\n return value;\n }\n\n return children;\n};\n\nexport const EditedContentRenderer: FC<EditedContentRendererProps> = (\n props\n) => {\n const content = useEditedContentRenderer(props);\n\n if (typeof content === 'object') {\n const transformedEditedContent = getContent(\n content,\n { ...props, locale: props.locale },\n getBasePlugins(props.locale)\n );\n\n if (typeof transformedEditedContent !== 'string') {\n console.error(\n `Incorrect edited content format. Content type: ${typeof transformedEditedContent}. Expected string. Value ${JSON.stringify(transformedEditedContent)}`\n );\n\n return (\n <ContentSelectorRenderer {...props} key={props.children}>\n {props.children}\n </ContentSelectorRenderer>\n );\n }\n\n return (\n <ContentSelectorRenderer {...props} key={props.children}>\n {transformedEditedContent}\n </ContentSelectorRenderer>\n );\n }\n\n return (\n <ContentSelectorRenderer {...props} key={props.children}>\n {content}\n </ContentSelectorRenderer>\n );\n};\n"],"mappings":"uQAgBA,MAAa,GAA4B,CACvC,gBACA,UACA,cACgC,CAChC,IAAM,EAAuB,GAAyB,CAatD,OAXI,EACkB,EAAqB,sBACvC,EACA,EACD,EAE4B,EAKxB,GAGI,EACX,GACG,CACH,IAAM,EAAU,EAAyB,EAAM,CAE/C,GAAI,OAAO,GAAY,SAAU,CAC/B,IAAM,EAA2B,EAC/B,EACA,CAAE,GAAG,EAAO,OAAQ,EAAM,OAAQ,CAClC,EAAe,EAAM,OAAO,CAC7B,CAcD,OAZI,OAAO,GAA6B,SAatC,EAAC,EAAD,CAAyB,GAAI,EAAO,IAAK,EAAM,SAErB,CADvB,EACuB,EAd1B,QAAQ,MACN,kDAAkD,OAAO,EAAyB,2BAA2B,KAAK,UAAU,EAAyB,GACtJ,CAGC,EAAC,EAAD,CAAyB,GAAI,EAAO,IAAK,EAAM,SAErB,CADvB,EAAM,SACiB,EAWhC,OACE,EAAC,EAAD,CAAyB,GAAI,EAAO,IAAK,EAAM,SAErB,CADvB,EACuB"}
|
|
@@ -2,6 +2,16 @@ import { NodeProps } from "@intlayer/core/interpreter";
|
|
|
2
2
|
import { FC, HTMLAttributes } from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/editor/ContentSelectorWrapper.d.ts
|
|
5
|
+
declare global {
|
|
6
|
+
namespace JSX {
|
|
7
|
+
interface IntrinsicElements {
|
|
8
|
+
'intlayer-content-selector': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement> & {
|
|
9
|
+
'is-selecting'?: boolean;
|
|
10
|
+
'press-duration'?: number;
|
|
11
|
+
}, HTMLElement>;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
5
15
|
type ContentSelectorWrapperProps = NodeProps & Omit<HTMLAttributes<HTMLDivElement>, 'children'>;
|
|
6
16
|
declare const ContentSelectorRenderer: FC<ContentSelectorWrapperProps>;
|
|
7
17
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentSelectorWrapper.d.ts","names":[],"sources":["../../../src/editor/ContentSelectorWrapper.tsx"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"ContentSelectorWrapper.d.ts","names":[],"sources":["../../../src/editor/ContentSelectorWrapper.tsx"],"mappings":";;;;QAeQ,MAAA;EAAA,UACI,GAAA;IAAA,UACE,iBAAA;MACR,2BAAA,EAA6B,KAAA,CAAM,iBAAA,CACjC,KAAA,CAAM,cAAA,CAAe,WAAA;QACnB,cAAA;QACA,gBAAA;MAAA,GAEF,WAAA;IAAA;EAAA;AAAA;AAAA,KAMI,2BAAA,GAA8B,SAAA,GACxC,IAAA,CAAK,cAAA,CAAe,cAAA;AAAA,cAgET,uBAAA,EAAyB,EAAA,CAAG,2BAAA"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { FC, PropsWithChildren } from "react";
|
|
2
2
|
|
|
3
3
|
//#region src/editor/IntlayerEditorProvider.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Wraps the application with the Intlayer editor provider in client mode.
|
|
6
|
+
* All configuration (URLs, origins) is read from @intlayer/config/built.
|
|
7
|
+
*/
|
|
4
8
|
declare const IntlayerEditorProvider: FC<PropsWithChildren>;
|
|
5
9
|
//#endregion
|
|
6
10
|
export { IntlayerEditorProvider };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntlayerEditorProvider.d.ts","names":[],"sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"IntlayerEditorProvider.d.ts","names":[],"sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"mappings":";;;;;AASA;;cAAa,sBAAA,EAAwB,EAAA,CAAG,iBAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
|
-
import { KeyPath } from "@intlayer/types/keyPath";
|
|
3
2
|
import { Locale } from "@intlayer/types/allLocales";
|
|
3
|
+
import { KeyPath } from "@intlayer/types/keyPath";
|
|
4
4
|
|
|
5
5
|
//#region src/editor/useEditedContentRenderer.d.ts
|
|
6
6
|
type EditedContentRendererProps = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
|
-
import { KeyPath } from "@intlayer/types/keyPath";
|
|
3
2
|
import { Locale } from "@intlayer/types/allLocales";
|
|
3
|
+
import { KeyPath } from "@intlayer/types/keyPath";
|
|
4
4
|
|
|
5
5
|
//#region src/html/HTMLRendererPlugin.d.ts
|
|
6
6
|
type HTMLRendererPluginProps = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-intlayer",
|
|
3
|
-
"version": "8.3.
|
|
3
|
+
"version": "8.3.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your React applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -115,14 +115,14 @@
|
|
|
115
115
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
116
116
|
},
|
|
117
117
|
"dependencies": {
|
|
118
|
-
"@intlayer/api": "8.3.
|
|
119
|
-
"@intlayer/config": "8.3.
|
|
120
|
-
"@intlayer/core": "8.3.
|
|
121
|
-
"@intlayer/dictionaries-entry": "8.3.
|
|
122
|
-
"@intlayer/editor
|
|
123
|
-
"@intlayer/
|
|
124
|
-
"@intlayer/
|
|
125
|
-
"intlayer": "8.3.
|
|
118
|
+
"@intlayer/api": "8.3.4",
|
|
119
|
+
"@intlayer/config": "8.3.4",
|
|
120
|
+
"@intlayer/core": "8.3.4",
|
|
121
|
+
"@intlayer/dictionaries-entry": "8.3.4",
|
|
122
|
+
"@intlayer/editor": "8.3.4",
|
|
123
|
+
"@intlayer/editor-react": "8.3.4",
|
|
124
|
+
"@intlayer/types": "8.3.4",
|
|
125
|
+
"intlayer": "8.3.4"
|
|
126
126
|
},
|
|
127
127
|
"devDependencies": {
|
|
128
128
|
"@craco/types": "7.1.0",
|
|
@@ -134,7 +134,7 @@
|
|
|
134
134
|
"@utils/ts-config-types": "1.0.4",
|
|
135
135
|
"@utils/tsdown-config": "1.0.4",
|
|
136
136
|
"rimraf": "6.1.3",
|
|
137
|
-
"tsdown": "0.21.
|
|
137
|
+
"tsdown": "0.21.4",
|
|
138
138
|
"typescript": "5.9.3",
|
|
139
139
|
"vite-tsconfig-paths": "6.1.1",
|
|
140
140
|
"vitest": "4.1.0"
|