@intlayer/editor-react 8.3.4 → 8.4.0-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/CommunicatorContext.cjs +1 -1
- package/dist/cjs/CommunicatorContext.cjs.map +1 -1
- package/dist/cjs/ConfigurationContext.cjs +1 -1
- package/dist/cjs/ConfigurationContext.cjs.map +1 -1
- package/dist/cjs/DictionariesRecordContext.cjs +1 -1
- package/dist/cjs/DictionariesRecordContext.cjs.map +1 -1
- package/dist/cjs/EditedContentContext.cjs +1 -1
- package/dist/cjs/EditedContentContext.cjs.map +1 -1
- package/dist/cjs/EditorEnabledContext.cjs +1 -1
- package/dist/cjs/EditorEnabledContext.cjs.map +1 -1
- package/dist/cjs/EditorProvider.cjs +1 -1
- package/dist/cjs/EditorProvider.cjs.map +1 -1
- package/dist/cjs/EditorStateContext.cjs +1 -1
- package/dist/cjs/EditorStateContext.cjs.map +1 -1
- package/dist/cjs/FocusDictionaryContext.cjs +1 -1
- package/dist/cjs/FocusDictionaryContext.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/useCrossFrameMessageListener.cjs +1 -1
- package/dist/cjs/useCrossFrameMessageListener.cjs.map +1 -1
- package/dist/cjs/useCrossFrameState.cjs +1 -1
- package/dist/cjs/useCrossFrameState.cjs.map +1 -1
- package/dist/cjs/useCrossURLPathState.cjs +1 -1
- package/dist/cjs/useCrossURLPathState.cjs.map +1 -1
- package/dist/cjs/useEditorLocale.cjs +1 -1
- package/dist/cjs/useEditorLocale.cjs.map +1 -1
- package/dist/cjs/useFocusUnmergedDictionary.cjs +1 -1
- package/dist/cjs/useFocusUnmergedDictionary.cjs.map +1 -1
- package/dist/cjs/useIframeClickInterceptor.cjs +1 -1
- package/dist/cjs/useIframeClickInterceptor.cjs.map +1 -1
- package/dist/esm/CommunicatorContext.mjs +1 -1
- package/dist/esm/CommunicatorContext.mjs.map +1 -1
- package/dist/esm/ConfigurationContext.mjs +1 -1
- package/dist/esm/ConfigurationContext.mjs.map +1 -1
- package/dist/esm/DictionariesRecordContext.mjs +1 -1
- package/dist/esm/DictionariesRecordContext.mjs.map +1 -1
- package/dist/esm/EditedContentContext.mjs +1 -1
- package/dist/esm/EditedContentContext.mjs.map +1 -1
- package/dist/esm/EditorEnabledContext.mjs +1 -1
- package/dist/esm/EditorEnabledContext.mjs.map +1 -1
- package/dist/esm/EditorProvider.mjs +1 -1
- package/dist/esm/EditorProvider.mjs.map +1 -1
- package/dist/esm/EditorStateContext.mjs +1 -1
- package/dist/esm/EditorStateContext.mjs.map +1 -1
- package/dist/esm/FocusDictionaryContext.mjs +1 -1
- package/dist/esm/FocusDictionaryContext.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/useCrossFrameMessageListener.mjs +1 -1
- package/dist/esm/useCrossFrameMessageListener.mjs.map +1 -1
- package/dist/esm/useCrossFrameState.mjs +1 -1
- package/dist/esm/useCrossFrameState.mjs.map +1 -1
- package/dist/esm/useEditorLocale.mjs +1 -1
- package/dist/esm/useEditorLocale.mjs.map +1 -1
- package/dist/esm/useFocusUnmergedDictionary.mjs.map +1 -1
- package/dist/types/ConfigurationContext.d.ts +5 -9
- package/dist/types/ConfigurationContext.d.ts.map +1 -1
- package/dist/types/DictionariesRecordContext.d.ts +0 -4
- package/dist/types/DictionariesRecordContext.d.ts.map +1 -1
- package/dist/types/EditedContentContext.d.ts +2 -5
- package/dist/types/EditedContentContext.d.ts.map +1 -1
- package/dist/types/EditorEnabledContext.d.ts +6 -1
- package/dist/types/EditorEnabledContext.d.ts.map +1 -1
- package/dist/types/EditorProvider.d.ts +3 -4
- package/dist/types/EditorProvider.d.ts.map +1 -1
- package/dist/types/EditorStateContext.d.ts +1 -1
- package/dist/types/FocusDictionaryContext.d.ts.map +1 -1
- package/dist/types/index.d.ts +5 -5
- package/dist/types/useCrossFrameState.d.ts.map +1 -1
- package/dist/types/useEditorLocale.d.ts.map +1 -1
- package/package.json +6 -6
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./EditorStateContext.cjs`),t=()=>{let t=e.useEditorStateManager();return{postMessage:e=>t
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./EditorStateContext.cjs`),t=()=>{let t=e.useEditorStateManager();return{postMessage:e=>t?.messenger.send(e.type,e.data),senderId:t?.messenger.senderId??``}};exports.useCommunicator=t;
|
|
2
2
|
//# sourceMappingURL=CommunicatorContext.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommunicatorContext.cjs","names":["useEditorStateManager"],"sources":["../../src/CommunicatorContext.tsx"],"sourcesContent":["'use client';\n\nimport type { MessagePayload } from '@intlayer/editor';\nimport { useEditorStateManager } from './EditorStateContext';\n\nexport type UseCrossPlatformStateProps = {\n postMessage: (payload: MessagePayload) => void;\n allowedOrigins?: string[];\n senderId: string;\n};\n\n/**\n * Returns the communicator API backed by the shared EditorStateManager messenger.\n */\nexport const useCommunicator = (): UseCrossPlatformStateProps => {\n const manager = useEditorStateManager();\n\n return {\n postMessage: (payload: MessagePayload) =>\n manager
|
|
1
|
+
{"version":3,"file":"CommunicatorContext.cjs","names":["useEditorStateManager"],"sources":["../../src/CommunicatorContext.tsx"],"sourcesContent":["'use client';\n\nimport type { MessagePayload } from '@intlayer/editor';\nimport { useEditorStateManager } from './EditorStateContext';\n\nexport type UseCrossPlatformStateProps = {\n postMessage: (payload: MessagePayload) => void;\n allowedOrigins?: string[];\n senderId: string;\n};\n\n/**\n * Returns the communicator API backed by the shared EditorStateManager messenger.\n */\nexport const useCommunicator = (): UseCrossPlatformStateProps => {\n const manager = useEditorStateManager();\n\n return {\n postMessage: (payload: MessagePayload) =>\n manager?.messenger.send(payload.type, payload.data),\n senderId: manager?.messenger.senderId ?? '',\n };\n};\n\n// Re-export type for backward compatibility\nexport type { MessengerConfig } from '@intlayer/editor';\n"],"mappings":"4HAca,MAAoD,CAC/D,IAAM,EAAUA,EAAAA,uBAAuB,CAEvC,MAAO,CACL,YAAc,GACZ,GAAS,UAAU,KAAK,EAAQ,KAAM,EAAQ,KAAK,CACrD,SAAU,GAAS,UAAU,UAAY,GAC1C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`})
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./EditorStateContext.cjs`);let t=require(`react`);const n=({configuration:n,children:r})=>{let i=e.useEditorStateManager();return(0,t.useEffect)(()=>{!i||!n||i.configuration.set(n)},[i,n]),r},r=()=>{let n=e.useEditorStateManager(),[r,i]=(0,t.useState)(n?.configuration.value);return(0,t.useEffect)(()=>{if(!n)return;let e=e=>i(e.detail);return n.configuration.addEventListener(`change`,e),()=>n.configuration.removeEventListener(`change`,e)},[n]),r},i=()=>{let n=e.useEditorStateManager(),[r,i]=(0,t.useState)(n?.configuration.value);return[r,i,()=>n?.configuration.postCurrentValue()]};exports.ConfigurationProvider=n,exports.useConfiguration=r,exports.useConfigurationState=i;
|
|
2
2
|
//# sourceMappingURL=ConfigurationContext.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigurationContext.cjs","names":["useEditorStateManager"],"sources":["../../src/ConfigurationContext.tsx"],"sourcesContent":["'use client';\n\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { useEffect, useState } from 'react';\nimport { useEditorStateManager } from './EditorStateContext';\n\nexport type ConfigurationProviderProps = {\n configuration?: IntlayerConfig;\n}
|
|
1
|
+
{"version":3,"file":"ConfigurationContext.cjs","names":["useEditorStateManager"],"sources":["../../src/ConfigurationContext.tsx"],"sourcesContent":["'use client';\n\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FC, type PropsWithChildren, useEffect, useState } from 'react';\nimport { useEditorStateManager } from './EditorStateContext';\n\nexport type ConfigurationProviderProps = PropsWithChildren<{\n configuration?: IntlayerConfig;\n}>;\n\nexport const ConfigurationProvider: FC<ConfigurationProviderProps> = ({\n configuration,\n children,\n}) => {\n const manager = useEditorStateManager();\n\n useEffect(() => {\n if (!manager || !configuration) return;\n\n manager.configuration.set(configuration);\n }, [manager, configuration]);\n\n return children;\n};\n\nexport const useConfiguration = (): IntlayerConfig | undefined => {\n const manager = useEditorStateManager();\n const [config, setConfig] = useState<IntlayerConfig | undefined>(\n manager?.configuration.value\n );\n\n useEffect(() => {\n if (!manager) return;\n\n const handler = (e: Event) =>\n setConfig((e as CustomEvent<IntlayerConfig>).detail);\n manager.configuration.addEventListener('change', handler);\n return () => manager.configuration.removeEventListener('change', handler);\n }, [manager]);\n\n return config;\n};\n\nexport const useConfigurationState = () => {\n const manager = useEditorStateManager();\n\n const [config, setConfig] = useState<IntlayerConfig | undefined>(\n manager?.configuration.value\n );\n\n return [\n config,\n setConfig,\n () => manager?.configuration.postCurrentValue(),\n ] as const;\n};\n"],"mappings":"mJAUA,MAAa,GAAyD,CACpE,gBACA,cACI,CACJ,IAAM,EAAUA,EAAAA,uBAAuB,CAQvC,OANA,EAAA,EAAA,eAAgB,CACV,CAAC,GAAW,CAAC,GAEjB,EAAQ,cAAc,IAAI,EAAc,EACvC,CAAC,EAAS,EAAc,CAAC,CAErB,GAGI,MAAqD,CAChE,IAAM,EAAUA,EAAAA,uBAAuB,CACjC,CAAC,EAAQ,IAAA,EAAA,EAAA,UACb,GAAS,cAAc,MACxB,CAWD,OATA,EAAA,EAAA,eAAgB,CACd,GAAI,CAAC,EAAS,OAEd,IAAM,EAAW,GACf,EAAW,EAAkC,OAAO,CAEtD,OADA,EAAQ,cAAc,iBAAiB,SAAU,EAAQ,KAC5C,EAAQ,cAAc,oBAAoB,SAAU,EAAQ,EACxE,CAAC,EAAQ,CAAC,CAEN,GAGI,MAA8B,CACzC,IAAM,EAAUA,EAAAA,uBAAuB,CAEjC,CAAC,EAAQ,IAAA,EAAA,EAAA,UACb,GAAS,cAAc,MACxB,CAED,MAAO,CACL,EACA,MACM,GAAS,cAAc,kBAAkB,CAChD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`})
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./EditorStateContext.cjs`);let t=require(`react`);const n=()=>{let n=e.useEditorStateManager(),[r,i]=(0,t.useState)(n?.localeDictionaries.value??{});return(0,t.useEffect)(()=>{if(!n)return;let e=e=>i(e.detail??{});return n.localeDictionaries.addEventListener(`change`,e),()=>n.localeDictionaries.removeEventListener(`change`,e)},[n]),{localeDictionaries:r,setLocaleDictionaries:(0,t.useCallback)(e=>n?.localeDictionaries.set(e),[n]),setLocaleDictionary:(0,t.useCallback)(e=>n?.setLocaleDictionary(e),[n])}},r=()=>{let{setLocaleDictionaries:e,setLocaleDictionary:t}=n();return{setLocaleDictionaries:e,setLocaleDictionary:t}};exports.useDictionariesRecord=n,exports.useDictionariesRecordActions=r;
|
|
2
2
|
//# sourceMappingURL=DictionariesRecordContext.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionariesRecordContext.cjs","names":["useEditorStateManager"],"sources":["../../src/DictionariesRecordContext.tsx"],"sourcesContent":["'use client';\n\nimport type { DictionaryContent } from '@intlayer/editor';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { useCallback, useEffect, useState } from 'react';\nimport { useEditorStateManager } from './EditorStateContext';\n\nexport type { DictionaryContent } from '@intlayer/editor';\n\ntype DictionariesRecordStatesContextType = {\n localeDictionaries: DictionaryContent;\n};\ntype DictionariesRecordActionsContextType = {\n setLocaleDictionaries: (value: DictionaryContent) => void;\n setLocaleDictionary: (dictionary: Dictionary) => void;\n};\n\
|
|
1
|
+
{"version":3,"file":"DictionariesRecordContext.cjs","names":["useEditorStateManager"],"sources":["../../src/DictionariesRecordContext.tsx"],"sourcesContent":["'use client';\n\nimport type { DictionaryContent } from '@intlayer/editor';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { useCallback, useEffect, useState } from 'react';\nimport { useEditorStateManager } from './EditorStateContext';\n\nexport type { DictionaryContent } from '@intlayer/editor';\n\ntype DictionariesRecordStatesContextType = {\n localeDictionaries: DictionaryContent;\n};\ntype DictionariesRecordActionsContextType = {\n setLocaleDictionaries: (value: DictionaryContent) => void;\n setLocaleDictionary: (dictionary: Dictionary) => void;\n};\n\nexport const useDictionariesRecord = (): DictionariesRecordStatesContextType &\n DictionariesRecordActionsContextType => {\n const manager = useEditorStateManager();\n const [localeDictionaries, setLocaleDictionariesState] =\n useState<DictionaryContent>(manager?.localeDictionaries.value ?? {});\n\n useEffect(() => {\n if (!manager) return;\n\n const handler = (e: Event) =>\n setLocaleDictionariesState(\n (e as CustomEvent<DictionaryContent>).detail ?? {}\n );\n\n manager.localeDictionaries.addEventListener('change', handler);\n\n return () =>\n manager.localeDictionaries.removeEventListener('change', handler);\n }, [manager]);\n\n const setLocaleDictionaries = useCallback(\n (value: DictionaryContent) => manager?.localeDictionaries.set(value),\n [manager]\n );\n\n const setLocaleDictionary = useCallback(\n (dictionary: Dictionary) => manager?.setLocaleDictionary(dictionary),\n [manager]\n );\n\n return { localeDictionaries, setLocaleDictionaries, setLocaleDictionary };\n};\n\nexport const useDictionariesRecordActions =\n (): DictionariesRecordActionsContextType => {\n const { setLocaleDictionaries, setLocaleDictionary } =\n useDictionariesRecord();\n return { setLocaleDictionaries, setLocaleDictionary };\n };\n"],"mappings":"mJAiBA,MAAa,MAC6B,CACxC,IAAM,EAAUA,EAAAA,uBAAuB,CACjC,CAAC,EAAoB,IAAA,EAAA,EAAA,UACG,GAAS,mBAAmB,OAAS,EAAE,CAAC,CA0BtE,OAxBA,EAAA,EAAA,eAAgB,CACd,GAAI,CAAC,EAAS,OAEd,IAAM,EAAW,GACf,EACG,EAAqC,QAAU,EAAE,CACnD,CAIH,OAFA,EAAQ,mBAAmB,iBAAiB,SAAU,EAAQ,KAG5D,EAAQ,mBAAmB,oBAAoB,SAAU,EAAQ,EAClE,CAAC,EAAQ,CAAC,CAYN,CAAE,qBAAoB,uBAAA,EAAA,EAAA,aAT1B,GAA6B,GAAS,mBAAmB,IAAI,EAAM,CACpE,CAAC,EAAQ,CACV,CAOmD,qBAAA,EAAA,EAAA,aAJjD,GAA2B,GAAS,oBAAoB,EAAW,CACpE,CAAC,EAAQ,CACV,CAEwE,EAG9D,MACiC,CAC1C,GAAM,CAAE,wBAAuB,uBAC7B,GAAuB,CACzB,MAAO,CAAE,wBAAuB,sBAAqB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`})
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./EditorStateContext.cjs`);let t=require(`react`);const n=()=>{let t=e.useEditorStateManager();return{setEditedContentState:e=>t?.editedContent.set(e),setEditedDictionary:e=>t?.setEditedDictionary(e),setEditedContent:(e,n)=>t?.setEditedContent(e,n),addEditedContent:(e,n,r,i)=>t?.addContent(e,n,r,i),renameEditedContent:(e,n,r)=>t?.renameContent(e,n,r),removeEditedContent:(e,n)=>t?.removeContent(e,n),restoreEditedContent:e=>t?.restoreContent(e),clearEditedDictionaryContent:e=>t?.clearContent(e),clearEditedContent:()=>t?.clearAllContent(),getEditedContentValue:(e,n)=>t?.getContentValue(e,n)}},r=()=>{let r=e.useEditorStateManager(),[i,a]=(0,t.useState)(r?.editedContent.value);return(0,t.useEffect)(()=>{if(!r)return;let e=e=>a(e.detail);return r.editedContent.addEventListener(`change`,e),()=>r.editedContent.removeEventListener(`change`,e)},[r]),{editedContent:i,...n()}},i=n=>{let r=e.useEditorStateManager();(0,t.useEffect)(()=>{if(!(!n||!r))return r.messenger.subscribe(`INTLAYER_EDITED_CONTENT_CHANGED/post`,n)},[r,n])},a=()=>{let t=e.useEditorStateManager();return()=>{t?.messenger.send(`INTLAYER_EDITED_CONTENT_CHANGED/get`)}};exports.useEditedContent=r,exports.useEditedContentActions=n,exports.useGetEditedContentState=a,exports.usePostEditedContentState=i;
|
|
2
2
|
//# sourceMappingURL=EditedContentContext.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditedContentContext.cjs","names":["useEditorStateManager"],"sources":["../../src/EditedContentContext.tsx"],"sourcesContent":["'use client';\n\nimport type { DictionaryContent } from '@intlayer/editor';\nimport type {\n ContentNode,\n Dictionary,\n LocalDictionaryId,\n} from '@intlayer/types/dictionary';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport { useEffect, useState } from 'react';\nimport { useEditorStateManager } from './EditorStateContext';\n\nexport type { DictionaryContent } from '@intlayer/editor';\n\ntype EditedContentActionsContextType = {\n setEditedContentState: (editedContent: DictionaryContent) => void;\n setEditedDictionary: (dict: Dictionary) => void;\n setEditedContent: (\n localDictionaryId: LocalDictionaryId,\n newValue: Dictionary['content']\n ) => void;\n addEditedContent: (\n localDictionaryId: LocalDictionaryId,\n newValue: ContentNode<any>,\n keyPath?: KeyPath[],\n overwrite?: boolean\n ) => void;\n renameEditedContent: (\n localDictionaryId: LocalDictionaryId,\n newKey: KeyPath['key'],\n keyPath?: KeyPath[]\n ) => void;\n removeEditedContent: (\n localDictionaryId: LocalDictionaryId,\n keyPath: KeyPath[]\n ) => void;\n restoreEditedContent: (localDictionaryId: LocalDictionaryId) => void;\n clearEditedDictionaryContent: (localDictionaryId: LocalDictionaryId) => void;\n clearEditedContent: () => void;\n getEditedContentValue: (\n localDictionaryIdOrKey: LocalDictionaryId | Dictionary['key'] | string,\n keyPath: KeyPath[]\n ) => ContentNode | undefined;\n};\n\
|
|
1
|
+
{"version":3,"file":"EditedContentContext.cjs","names":["useEditorStateManager"],"sources":["../../src/EditedContentContext.tsx"],"sourcesContent":["'use client';\n\nimport type { DictionaryContent } from '@intlayer/editor';\nimport type {\n ContentNode,\n Dictionary,\n LocalDictionaryId,\n} from '@intlayer/types/dictionary';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport { useEffect, useState } from 'react';\nimport { useEditorStateManager } from './EditorStateContext';\n\nexport type { DictionaryContent } from '@intlayer/editor';\n\ntype EditedContentActionsContextType = {\n setEditedContentState: (editedContent: DictionaryContent) => void;\n setEditedDictionary: (dict: Dictionary) => void;\n setEditedContent: (\n localDictionaryId: LocalDictionaryId,\n newValue: Dictionary['content']\n ) => void;\n addEditedContent: (\n localDictionaryId: LocalDictionaryId,\n newValue: ContentNode<any>,\n keyPath?: KeyPath[],\n overwrite?: boolean\n ) => void;\n renameEditedContent: (\n localDictionaryId: LocalDictionaryId,\n newKey: KeyPath['key'],\n keyPath?: KeyPath[]\n ) => void;\n removeEditedContent: (\n localDictionaryId: LocalDictionaryId,\n keyPath: KeyPath[]\n ) => void;\n restoreEditedContent: (localDictionaryId: LocalDictionaryId) => void;\n clearEditedDictionaryContent: (localDictionaryId: LocalDictionaryId) => void;\n clearEditedContent: () => void;\n getEditedContentValue: (\n localDictionaryIdOrKey: LocalDictionaryId | Dictionary['key'] | string,\n keyPath: KeyPath[]\n ) => ContentNode | undefined;\n};\n\nexport const useEditedContentActions = (): EditedContentActionsContextType => {\n const manager = useEditorStateManager();\n\n return {\n setEditedContentState: (value: DictionaryContent) =>\n manager?.editedContent.set(value),\n setEditedDictionary: (dict: Dictionary) =>\n manager?.setEditedDictionary(dict),\n setEditedContent: (\n localId: LocalDictionaryId,\n value: Dictionary['content']\n ) => manager?.setEditedContent(localId, value),\n addEditedContent: (localId, value, keyPath, overwrite) =>\n manager?.addContent(localId, value, keyPath, overwrite),\n renameEditedContent: (localId, newKey, keyPath) =>\n manager?.renameContent(localId, newKey, keyPath),\n removeEditedContent: (localId, keyPath) =>\n manager?.removeContent(localId, keyPath),\n restoreEditedContent: (localId) => manager?.restoreContent(localId),\n clearEditedDictionaryContent: (localId) => manager?.clearContent(localId),\n clearEditedContent: () => manager?.clearAllContent(),\n getEditedContentValue: (localIdOrKey, keyPath) =>\n manager?.getContentValue(localIdOrKey, keyPath),\n };\n};\n\nexport const useEditedContent = () => {\n const manager = useEditorStateManager();\n const [editedContent, setEditedContentState] = useState<\n DictionaryContent | undefined\n >(manager?.editedContent.value);\n\n useEffect(() => {\n if (!manager) return;\n const handler = (e: Event) =>\n setEditedContentState((e as CustomEvent<DictionaryContent>).detail);\n manager.editedContent.addEventListener('change', handler);\n return () => manager.editedContent.removeEventListener('change', handler);\n }, [manager]);\n\n const actions = useEditedContentActions();\n return { editedContent, ...actions };\n};\n\nexport const usePostEditedContentState = <S,>(\n onEventTriggered?: (data: S) => void\n) => {\n const manager = useEditorStateManager();\n useEffect(() => {\n if (!onEventTriggered || !manager) return;\n return manager.messenger.subscribe(\n `INTLAYER_EDITED_CONTENT_CHANGED/post`,\n onEventTriggered as (data: unknown) => void\n );\n }, [manager, onEventTriggered]);\n};\n\nexport const useGetEditedContentState = () => {\n const manager = useEditorStateManager();\n return () => {\n manager?.messenger.send('INTLAYER_EDITED_CONTENT_CHANGED/get');\n };\n};\n"],"mappings":"mJA6CA,MAAa,MAAiE,CAC5E,IAAM,EAAUA,EAAAA,uBAAuB,CAEvC,MAAO,CACL,sBAAwB,GACtB,GAAS,cAAc,IAAI,EAAM,CACnC,oBAAsB,GACpB,GAAS,oBAAoB,EAAK,CACpC,kBACE,EACA,IACG,GAAS,iBAAiB,EAAS,EAAM,CAC9C,kBAAmB,EAAS,EAAO,EAAS,IAC1C,GAAS,WAAW,EAAS,EAAO,EAAS,EAAU,CACzD,qBAAsB,EAAS,EAAQ,IACrC,GAAS,cAAc,EAAS,EAAQ,EAAQ,CAClD,qBAAsB,EAAS,IAC7B,GAAS,cAAc,EAAS,EAAQ,CAC1C,qBAAuB,GAAY,GAAS,eAAe,EAAQ,CACnE,6BAA+B,GAAY,GAAS,aAAa,EAAQ,CACzE,uBAA0B,GAAS,iBAAiB,CACpD,uBAAwB,EAAc,IACpC,GAAS,gBAAgB,EAAc,EAAQ,CAClD,EAGU,MAAyB,CACpC,IAAM,EAAUA,EAAAA,uBAAuB,CACjC,CAAC,EAAe,IAAA,EAAA,EAAA,UAEpB,GAAS,cAAc,MAAM,CAW/B,OATA,EAAA,EAAA,eAAgB,CACd,GAAI,CAAC,EAAS,OACd,IAAM,EAAW,GACf,EAAuB,EAAqC,OAAO,CAErE,OADA,EAAQ,cAAc,iBAAiB,SAAU,EAAQ,KAC5C,EAAQ,cAAc,oBAAoB,SAAU,EAAQ,EACxE,CAAC,EAAQ,CAAC,CAGN,CAAE,gBAAe,GADR,GAAyB,CACL,EAGzB,EACX,GACG,CACH,IAAM,EAAUA,EAAAA,uBAAuB,EACvC,EAAA,EAAA,eAAgB,CACV,MAAC,GAAoB,CAAC,GAC1B,OAAO,EAAQ,UAAU,UACvB,uCACA,EACD,EACA,CAAC,EAAS,EAAiB,CAAC,EAGpB,MAAiC,CAC5C,IAAM,EAAUA,EAAAA,uBAAuB,CACvC,UAAa,CACX,GAAS,UAAU,KAAK,sCAAsC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`})
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./EditorStateContext.cjs`);let t=require(`react`),n=require(`@intlayer/editor`);const r=()=>{let n=e.useEditorStateManager(),[r,i]=(0,t.useState)(n?.editorEnabled.value??!1);return(0,t.useEffect)(()=>{if(!n)return;let e=e=>i(e.detail);return n.editorEnabled.addEventListener(`change`,e),()=>n.editorEnabled.removeEventListener(`change`,e)},[n]),{enabled:r}},i=r=>{let i=e.useEditorStateManager();(0,t.useEffect)(()=>{if(r)return i?.messenger.subscribe(`${n.MessageKey.INTLAYER_EDITOR_ENABLED}/get`,r)},[i,r])},a=()=>{let t=e.useEditorStateManager();return e=>{t?.editorEnabled.set(e),t?.editorEnabled.postCurrentValue()}},o=()=>{let{enabled:t}=r(),n=e.useEditorStateManager();return[t,e=>n?.editorEnabled.set(e)]},s=()=>{let t=e.useEditorStateManager();return()=>t?.pingClient()};exports.useEditorEnabled=r,exports.useEditorEnabledState=o,exports.useEditorPingClient=s,exports.useGetEditorEnabledState=i,exports.usePostEditorEnabledState=a;
|
|
2
2
|
//# sourceMappingURL=EditorEnabledContext.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorEnabledContext.cjs","names":["useEditorStateManager","MessageKey"],"sources":["../../src/EditorEnabledContext.tsx"],"sourcesContent":["'use client';\n\nimport { MessageKey } from '@intlayer/editor';\nimport { useEffect, useState } from 'react';\nimport { useEditorStateManager } from './EditorStateContext';\n\nexport type EditorEnabledStateProps = {\n enabled: boolean;\n};\n\n/**\n * Returns the current editor-enabled state, kept in sync with the shared\n * EditorStateManager. Replaces the old EditorEnabledContext + EditorEnabledProvider.\n */\nexport const useEditorEnabled = (): EditorEnabledStateProps => {\n const manager = useEditorStateManager();\n const [enabled, setEnabled] = useState<boolean>(\n manager
|
|
1
|
+
{"version":3,"file":"EditorEnabledContext.cjs","names":["useEditorStateManager","MessageKey"],"sources":["../../src/EditorEnabledContext.tsx"],"sourcesContent":["'use client';\n\nimport { MessageKey } from '@intlayer/editor';\nimport { useEffect, useState } from 'react';\nimport { useEditorStateManager } from './EditorStateContext';\n\nexport type EditorEnabledStateProps = {\n enabled: boolean;\n};\n\n/**\n * Returns the current editor-enabled state, kept in sync with the shared\n * EditorStateManager. Replaces the old EditorEnabledContext + EditorEnabledProvider.\n */\nexport const useEditorEnabled = (): EditorEnabledStateProps => {\n const manager = useEditorStateManager();\n const [enabled, setEnabled] = useState<boolean>(\n manager?.editorEnabled.value ?? false\n );\n\n useEffect(() => {\n if (!manager) return;\n\n const handler = (e: Event) =>\n setEnabled((e as CustomEvent<boolean>).detail);\n manager.editorEnabled.addEventListener('change', handler);\n return () => manager.editorEnabled.removeEventListener('change', handler);\n }, [manager]);\n\n return { enabled };\n};\n\n/**\n * Subscribes to incoming \"get\" requests for editor-enabled state and calls\n * the provided callback so the caller can respond.\n * Used by the editor side to respond when the client asks for the current state.\n */\nexport const useGetEditorEnabledState = (onRequest?: () => void) => {\n const manager = useEditorStateManager();\n\n useEffect(() => {\n if (!onRequest) return;\n\n return manager?.messenger.subscribe(\n `${MessageKey.INTLAYER_EDITOR_ENABLED}/get`,\n onRequest\n );\n }, [manager, onRequest]);\n};\n\n/**\n * Returns a function that sets the editor-enabled state and broadcasts it.\n */\nexport const usePostEditorEnabledState = () => {\n const manager = useEditorStateManager();\n\n return (value: boolean) => {\n manager?.editorEnabled.set(value);\n manager?.editorEnabled.postCurrentValue();\n };\n};\n\nexport const useEditorEnabledState = () => {\n const { enabled } = useEditorEnabled();\n const manager = useEditorStateManager();\n const setter = (value: boolean) => manager?.editorEnabled.set(value);\n\n return [enabled, setter] as const;\n};\n\n/**\n * Returns a function that re-pings the client via ARE_YOU_THERE.\n * Use this as the onClick for an \"Enable Editor\" / reconnect button.\n */\nexport const useEditorPingClient = (): (() => void) => {\n const manager = useEditorStateManager();\n\n return () => manager?.pingClient();\n};\n"],"mappings":"iLAcA,MAAa,MAAkD,CAC7D,IAAM,EAAUA,EAAAA,uBAAuB,CACjC,CAAC,EAAS,IAAA,EAAA,EAAA,UACd,GAAS,cAAc,OAAS,GACjC,CAWD,OATA,EAAA,EAAA,eAAgB,CACd,GAAI,CAAC,EAAS,OAEd,IAAM,EAAW,GACf,EAAY,EAA2B,OAAO,CAEhD,OADA,EAAQ,cAAc,iBAAiB,SAAU,EAAQ,KAC5C,EAAQ,cAAc,oBAAoB,SAAU,EAAQ,EACxE,CAAC,EAAQ,CAAC,CAEN,CAAE,UAAS,EAQP,EAA4B,GAA2B,CAClE,IAAM,EAAUA,EAAAA,uBAAuB,EAEvC,EAAA,EAAA,eAAgB,CACT,KAEL,OAAO,GAAS,UAAU,UACxB,GAAGC,EAAAA,WAAW,wBAAwB,MACtC,EACD,EACA,CAAC,EAAS,EAAU,CAAC,EAMb,MAAkC,CAC7C,IAAM,EAAUD,EAAAA,uBAAuB,CAEvC,MAAQ,IAAmB,CACzB,GAAS,cAAc,IAAI,EAAM,CACjC,GAAS,cAAc,kBAAkB,GAIhC,MAA8B,CACzC,GAAM,CAAE,WAAY,GAAkB,CAChC,EAAUA,EAAAA,uBAAuB,CAGvC,MAAO,CAAC,EAFQ,GAAmB,GAAS,cAAc,IAAI,EAAM,CAE5C,EAOb,MAA0C,CACrD,IAAM,EAAUA,EAAAA,uBAAuB,CAEvC,UAAa,GAAS,YAAY"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./EditorStateContext.cjs`);let t=require(`react`),n=require(`react/jsx-runtime`),r=require(`@intlayer/editor`);const i=({children:i,configuration:a,postMessage:o,allowedOrigins:s})=>{let c=(0,t.useRef)(null);c.current||=new r.EditorStateManager({mode:`editor`,messenger:{allowedOrigins:s,postMessageFn:o},configuration:a});let l=c.current;return(0,t.useEffect)(()=>((0,r.defineIntlayerElements)(),(0,r.setGlobalEditorManager)(l),l.start(),()=>{l.stop(),(0,r.setGlobalEditorManager)(null)}),[l]),(0,n.jsx)(e.EditorStateProvider,{manager:l,children:i})};exports.EditorProvider=i;
|
|
2
2
|
//# sourceMappingURL=EditorProvider.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorProvider.cjs","names":["
|
|
1
|
+
{"version":3,"file":"EditorProvider.cjs","names":["EditorStateManager","EditorStateProvider"],"sources":["../../src/EditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport {\n defineIntlayerElements,\n EditorStateManager,\n type MessengerConfig,\n setGlobalEditorManager,\n} from '@intlayer/editor';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FC, type PropsWithChildren, useEffect, useRef } from 'react';\nimport { EditorStateProvider } from './EditorStateContext';\n\nexport type EditorProviderProps = {\n configuration: IntlayerConfig;\n postMessage: (data: any) => void;\n allowedOrigins: string[];\n};\n\n/**\n * EditorProvider creates and manages the lifecycle of an EditorStateManager,\n * provides it to all descendants, and registers the Lit web components.\n */\nexport const EditorProvider: FC<PropsWithChildren<EditorProviderProps>> = ({\n children,\n configuration,\n postMessage,\n allowedOrigins,\n}) => {\n const managerRef = useRef<EditorStateManager | null>(null);\n\n if (!managerRef.current) {\n const messengerConfig: MessengerConfig = {\n allowedOrigins,\n postMessageFn: postMessage,\n };\n\n managerRef.current = new EditorStateManager({\n mode: 'editor',\n messenger: messengerConfig,\n configuration,\n });\n }\n const manager = managerRef.current;\n\n useEffect(() => {\n defineIntlayerElements();\n setGlobalEditorManager(manager);\n\n manager.start();\n return () => {\n manager.stop();\n setGlobalEditorManager(null);\n };\n }, [manager]);\n\n return (\n <EditorStateProvider manager={manager}>{children}</EditorStateProvider>\n );\n};\n"],"mappings":"gNAsBA,MAAa,GAA8D,CACzE,WACA,gBACA,cACA,oBACI,CACJ,IAAM,GAAA,EAAA,EAAA,QAA+C,KAAK,CAE1D,AAME,EAAW,UAAU,IAAIA,EAAAA,mBAAmB,CAC1C,KAAM,SACN,UAPuC,CACvC,iBACA,cAAe,EAChB,CAKC,gBACD,CAAC,CAEJ,IAAM,EAAU,EAAW,QAa3B,OAXA,EAAA,EAAA,iBACE,EAAA,EAAA,yBAAwB,EACxB,EAAA,EAAA,wBAAuB,EAAQ,CAE/B,EAAQ,OAAO,KACF,CACX,EAAQ,MAAM,EACd,EAAA,EAAA,wBAAuB,KAAK,GAE7B,CAAC,EAAQ,CAAC,EAGX,EAAA,EAAA,KAACC,EAAAA,oBAAD,CAA8B,UAAU,WAA+B,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`})
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`react`),t=require(`react/jsx-runtime`);const n=(0,e.createContext)(null),r=({children:e,manager:r})=>(0,t.jsx)(n.Provider,{value:r,children:e}),i=()=>(0,e.useContext)(n);exports.EditorStateProvider=r,exports.useEditorStateManager=i;
|
|
2
2
|
//# sourceMappingURL=EditorStateContext.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorStateContext.cjs","names":[],"sources":["../../src/EditorStateContext.tsx"],"sourcesContent":["'use client';\n\nimport type { EditorStateManager } from '@intlayer/editor';\nimport {\n createContext,\n type FC,\n type PropsWithChildren,\n useContext,\n} from 'react';\n\nconst EditorStateContext = createContext<EditorStateManager | null>(null);\n\nexport const EditorStateProvider: FC<\n PropsWithChildren<{ manager: EditorStateManager }>\n> = ({ children, manager }) => (\n <EditorStateContext.Provider value={manager}>\n {children}\n </EditorStateContext.Provider>\n);\n\nexport const useEditorStateManager = (): EditorStateManager
|
|
1
|
+
{"version":3,"file":"EditorStateContext.cjs","names":[],"sources":["../../src/EditorStateContext.tsx"],"sourcesContent":["'use client';\n\nimport type { EditorStateManager } from '@intlayer/editor';\nimport {\n createContext,\n type FC,\n type PropsWithChildren,\n useContext,\n} from 'react';\n\nconst EditorStateContext = createContext<EditorStateManager | null>(null);\n\nexport const EditorStateProvider: FC<\n PropsWithChildren<{ manager: EditorStateManager }>\n> = ({ children, manager }) => (\n <EditorStateContext.Provider value={manager}>\n {children}\n </EditorStateContext.Provider>\n);\n\nexport const useEditorStateManager = (): EditorStateManager | null =>\n useContext(EditorStateContext);\n"],"mappings":"sIAUA,MAAM,GAAA,EAAA,EAAA,eAA8D,KAAK,CAE5D,GAER,CAAE,WAAU,cACf,EAAA,EAAA,KAAC,EAAmB,SAApB,CAA6B,MAAO,EACjC,WAC2B,CAAA,CAGnB,OAAA,EAAA,EAAA,YACA,EAAmB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`})
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./EditorStateContext.cjs`);let t=require(`react`);const n=()=>{let n=e.useEditorStateManager(),[r,i]=(0,t.useState)(n?.focusedContent.value??null);return(0,t.useEffect)(()=>{if(!n)return;let e=e=>i(e.detail);return n.focusedContent.addEventListener(`change`,e),()=>n.focusedContent.removeEventListener(`change`,e)},[n]),{focusedContent:r,setFocusedContent:e=>n?.focusedContent.set(e),setFocusedContentKeyPath:e=>n?.setFocusedContentKeyPath(e)}},r=()=>{let{setFocusedContent:e,setFocusedContentKeyPath:t}=n();return{setFocusedContent:e,setFocusedContentKeyPath:t}};exports.useFocusDictionary=n,exports.useFocusDictionaryActions=r;
|
|
2
2
|
//# sourceMappingURL=FocusDictionaryContext.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FocusDictionaryContext.cjs","names":["useEditorStateManager"],"sources":["../../src/FocusDictionaryContext.tsx"],"sourcesContent":["'use client';\n\nimport type { FileContent } from '@intlayer/editor';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport { useEffect, useState } from 'react';\nimport { useEditorStateManager } from './EditorStateContext';\n\nexport type { FileContent } from '@intlayer/editor';\n\nexport type FocusDictionaryState = {\n focusedContent: FileContent | null;\n};\n\nexport type FocusDictionaryActions = {\n setFocusedContent: (value: FileContent | null) => void;\n setFocusedContentKeyPath: (keyPath: KeyPath[]) => void;\n};\n\n/**\n * Returns the focused-content state and setters, backed by EditorStateManager.\n */\nexport const useFocusDictionary = (): FocusDictionaryState &\n FocusDictionaryActions => {\n const manager = useEditorStateManager();\n const [focusedContent, setFocusedContentState] = useState<FileContent | null>(\n manager
|
|
1
|
+
{"version":3,"file":"FocusDictionaryContext.cjs","names":["useEditorStateManager"],"sources":["../../src/FocusDictionaryContext.tsx"],"sourcesContent":["'use client';\n\nimport type { FileContent } from '@intlayer/editor';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport { useEffect, useState } from 'react';\nimport { useEditorStateManager } from './EditorStateContext';\n\nexport type { FileContent } from '@intlayer/editor';\n\nexport type FocusDictionaryState = {\n focusedContent: FileContent | null;\n};\n\nexport type FocusDictionaryActions = {\n setFocusedContent: (value: FileContent | null) => void;\n setFocusedContentKeyPath: (keyPath: KeyPath[]) => void;\n};\n\n/**\n * Returns the focused-content state and setters, backed by EditorStateManager.\n */\nexport const useFocusDictionary = (): FocusDictionaryState &\n FocusDictionaryActions => {\n const manager = useEditorStateManager();\n const [focusedContent, setFocusedContentState] = useState<FileContent | null>(\n manager?.focusedContent.value ?? null\n );\n\n useEffect(() => {\n if (!manager) return;\n const handler = (e: Event) =>\n setFocusedContentState((e as CustomEvent<FileContent | null>).detail);\n manager.focusedContent.addEventListener('change', handler);\n return () => manager.focusedContent.removeEventListener('change', handler);\n }, [manager]);\n\n return {\n focusedContent,\n setFocusedContent: (value: FileContent | null) =>\n manager?.focusedContent.set(value),\n setFocusedContentKeyPath: (keyPath: KeyPath[]) =>\n manager?.setFocusedContentKeyPath(keyPath),\n };\n};\n\nexport const useFocusDictionaryActions = (): FocusDictionaryActions => {\n const { setFocusedContent, setFocusedContentKeyPath } = useFocusDictionary();\n return { setFocusedContent, setFocusedContentKeyPath };\n};\n"],"mappings":"mJAqBA,MAAa,MACe,CAC1B,IAAM,EAAUA,EAAAA,uBAAuB,CACjC,CAAC,EAAgB,IAAA,EAAA,EAAA,UACrB,GAAS,eAAe,OAAS,KAClC,CAUD,OARA,EAAA,EAAA,eAAgB,CACd,GAAI,CAAC,EAAS,OACd,IAAM,EAAW,GACf,EAAwB,EAAsC,OAAO,CAEvE,OADA,EAAQ,eAAe,iBAAiB,SAAU,EAAQ,KAC7C,EAAQ,eAAe,oBAAoB,SAAU,EAAQ,EACzE,CAAC,EAAQ,CAAC,CAEN,CACL,iBACA,kBAAoB,GAClB,GAAS,eAAe,IAAI,EAAM,CACpC,yBAA2B,GACzB,GAAS,yBAAyB,EAAQ,CAC7C,EAGU,MAA0D,CACrE,GAAM,CAAE,oBAAmB,4BAA6B,GAAoB,CAC5E,MAAO,CAAE,oBAAmB,2BAA0B"}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./EditorStateContext.cjs`),t=require(`./FocusDictionaryContext.cjs`),n=require(`./useCrossFrameState.cjs`),r=require(`./useCrossURLPathState.cjs`),i=require(`./DictionariesRecordContext.cjs`),a=require(`./useEditorLocale.cjs`),o=require(`./useFocusUnmergedDictionary.cjs`),s=require(`./
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./EditorStateContext.cjs`),t=require(`./FocusDictionaryContext.cjs`),n=require(`./useCrossFrameState.cjs`),r=require(`./useCrossURLPathState.cjs`),i=require(`./DictionariesRecordContext.cjs`),a=require(`./useEditorLocale.cjs`),o=require(`./useFocusUnmergedDictionary.cjs`),s=require(`./EditorProvider.cjs`),c=require(`./CommunicatorContext.cjs`),l=require(`./ConfigurationContext.cjs`),u=require(`./EditedContentContext.cjs`),d=require(`./EditorEnabledContext.cjs`),f=require(`./useCrossFrameMessageListener.cjs`),p=require(`./useIframeClickInterceptor.cjs`);let m=require(`@intlayer/editor`);exports.ConfigurationProvider=l.ConfigurationProvider,exports.EditorProvider=s.EditorProvider,exports.EditorStateProvider=e.EditorStateProvider,Object.defineProperty(exports,`MessageKey`,{enumerable:!0,get:function(){return m.MessageKey}}),exports.useCommunicator=c.useCommunicator,exports.useConfiguration=l.useConfiguration,exports.useConfigurationState=l.useConfigurationState,exports.useCrossFrameMessageListener=f.useCrossFrameMessageListener,exports.useCrossFrameState=n.useCrossFrameState,exports.useCrossURLPathSetter=r.useCrossURLPathSetter,exports.useCrossURLPathState=r.useCrossURLPathState,exports.useDictionariesRecord=i.useDictionariesRecord,exports.useDictionariesRecordActions=i.useDictionariesRecordActions,exports.useEditedContent=u.useEditedContent,exports.useEditedContentActions=u.useEditedContentActions,exports.useEditorEnabled=d.useEditorEnabled,exports.useEditorEnabledState=d.useEditorEnabledState,exports.useEditorLocale=a.useEditorLocale,exports.useEditorPingClient=d.useEditorPingClient,exports.useEditorStateManager=e.useEditorStateManager,exports.useFocusDictionary=t.useFocusDictionary,exports.useFocusDictionaryActions=t.useFocusDictionaryActions,exports.useFocusUnmergedDictionary=o.useFocusUnmergedDictionary,exports.useGetEditedContentState=u.useGetEditedContentState,exports.useGetEditorEnabledState=d.useGetEditorEnabledState,exports.useIframeClickInterceptor=p.useIframeClickInterceptor,exports.useIframeClickMerger=p.useIframeClickMerger,exports.usePostEditedContentState=u.usePostEditedContentState,exports.usePostEditorEnabledState=d.usePostEditorEnabledState,exports.useSetEditorLocale=a.useSetEditorLocale;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`})
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./EditorStateContext.cjs`);let t=require(`react`);const n=(n,r,i)=>{let a=e.useEditorStateManager();return(0,t.useEffect)(()=>{if(r)return a?.messenger.subscribe(n,r)},[a,n,i]),e=>{a?.messenger.send(n,e)}};exports.useCrossFrameMessageListener=n;
|
|
2
2
|
//# sourceMappingURL=useCrossFrameMessageListener.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCrossFrameMessageListener.cjs","names":["useEditorStateManager"],"sources":["../../src/useCrossFrameMessageListener.tsx"],"sourcesContent":["'use client';\n\nimport type { MessageKey } from '@intlayer/editor';\nimport { useEffect } from 'react';\nimport { useEditorStateManager } from './EditorStateContext';\n\n/**\n * Listens for cross-frame messages of the specified type and calls the callback.\n * Returns a function to manually send a message of the same type.\n *\n * Backed by CrossFrameMessenger from EditorStateManager.\n */\nexport const useCrossFrameMessageListener = <S,>(\n key: `${MessageKey}` | `${MessageKey}/post` | `${MessageKey}/get`,\n onEventTriggered?: (data: S) => void,\n revalidator?: any\n) => {\n const manager = useEditorStateManager();\n\n useEffect(() => {\n if (!onEventTriggered) return;\n return manager
|
|
1
|
+
{"version":3,"file":"useCrossFrameMessageListener.cjs","names":["useEditorStateManager"],"sources":["../../src/useCrossFrameMessageListener.tsx"],"sourcesContent":["'use client';\n\nimport type { MessageKey } from '@intlayer/editor';\nimport { useEffect } from 'react';\nimport { useEditorStateManager } from './EditorStateContext';\n\n/**\n * Listens for cross-frame messages of the specified type and calls the callback.\n * Returns a function to manually send a message of the same type.\n *\n * Backed by CrossFrameMessenger from EditorStateManager.\n */\nexport const useCrossFrameMessageListener = <S,>(\n key: `${MessageKey}` | `${MessageKey}/post` | `${MessageKey}/get`,\n onEventTriggered?: (data: S) => void,\n revalidator?: any\n) => {\n const manager = useEditorStateManager();\n\n useEffect(() => {\n if (!onEventTriggered) return;\n return manager?.messenger.subscribe<S>(key, onEventTriggered);\n }, [manager, key, revalidator]);\n\n return (data?: S) => {\n manager?.messenger.send(key, data);\n };\n};\n"],"mappings":"mJAYA,MAAa,GACX,EACA,EACA,IACG,CACH,IAAM,EAAUA,EAAAA,uBAAuB,CAOvC,OALA,EAAA,EAAA,eAAgB,CACT,KACL,OAAO,GAAS,UAAU,UAAa,EAAK,EAAiB,EAC5D,CAAC,EAAS,EAAK,EAAY,CAAC,CAEvB,GAAa,CACnB,GAAS,UAAU,KAAK,EAAK,EAAK"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`})
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./EditorStateContext.cjs`);let t=require(`react`),n=require(`@intlayer/editor`);const r=(r,i,a)=>{let o=e.useEditorStateManager(),s=typeof i==`function`?i():i,[c,l]=(0,t.useState)(s),u=(0,t.useRef)(s),d=(0,t.useRef)(null);return(0,t.useEffect)(()=>{let{emit:e=!0,receive:t=!0}=a??{},i=new n.CrossFrameStateManager(r,o?.messenger,{emit:e,receive:t,initialValue:s});d.current=i;let c=e=>{let t=e.detail;u.current=t,l(t)};return i.addEventListener(`change`,c),i.start(),()=>{i.removeEventListener(`change`,c),i.stop(),d.current=null}},[r,o?.messenger,a?.emit,a?.receive]),[c,e=>{l(t=>{let n=typeof e==`function`?e(t):e;return u.current=n,d.current?.set(n),n})},()=>{d.current?.postCurrentValue()}]};exports.useCrossFrameState=r;
|
|
2
2
|
//# sourceMappingURL=useCrossFrameState.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCrossFrameState.cjs","names":["useEditorStateManager","CrossFrameStateManager"],"sources":["../../src/useCrossFrameState.tsx"],"sourcesContent":["'use client';\n\nimport {
|
|
1
|
+
{"version":3,"file":"useCrossFrameState.cjs","names":["useEditorStateManager","CrossFrameStateManager"],"sources":["../../src/useCrossFrameState.tsx"],"sourcesContent":["'use client';\n\nimport type { MessageKey } from '@intlayer/editor';\nimport { CrossFrameStateManager } from '@intlayer/editor';\nimport {\n type Dispatch,\n type SetStateAction,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport { useEditorStateManager } from './EditorStateContext';\n\nexport type CrossFrameStateOptions = {\n emit?: boolean;\n receive?: boolean;\n};\n\n/**\n * Synchronizes a React state value across frames using CrossFrameStateManager.\n */\nexport const useCrossFrameState = <S,>(\n key: `${MessageKey}`,\n initialState?: S | (() => S),\n options?: CrossFrameStateOptions\n): [S, Dispatch<SetStateAction<S>>, () => void] => {\n const manager = useEditorStateManager();\n\n const resolvedInitial =\n typeof initialState === 'function'\n ? (initialState as () => S)()\n : initialState;\n\n const [value, setValueState] = useState<S>(resolvedInitial as S);\n const valueRef = useRef<S>(resolvedInitial as S);\n\n const stateManagerRef = useRef<CrossFrameStateManager<S> | null>(null);\n\n useEffect(() => {\n const { emit = true, receive = true } = options ?? {};\n const stateManager = new CrossFrameStateManager<S>(\n key,\n manager?.messenger,\n {\n emit,\n receive,\n initialValue: resolvedInitial,\n }\n );\n stateManagerRef.current = stateManager;\n\n const handler = (e: Event) => {\n const newValue = (e as CustomEvent<S>).detail;\n valueRef.current = newValue;\n setValueState(newValue);\n };\n stateManager.addEventListener('change', handler);\n stateManager.start();\n\n return () => {\n stateManager.removeEventListener('change', handler);\n stateManager.stop();\n stateManagerRef.current = null;\n };\n }, [key, manager?.messenger, options?.emit, options?.receive]);\n\n const setValue: Dispatch<SetStateAction<S>> = (valueOrUpdater) => {\n setValueState((prev) => {\n const newValue =\n typeof valueOrUpdater === 'function'\n ? (valueOrUpdater as (prev: S) => S)(prev)\n : valueOrUpdater;\n valueRef.current = newValue;\n stateManagerRef.current?.set(newValue);\n return newValue;\n });\n };\n\n const postState = () => {\n stateManagerRef.current?.postCurrentValue();\n };\n\n return [value, setValue, postState];\n};\n"],"mappings":"iLAqBA,MAAa,GACX,EACA,EACA,IACiD,CACjD,IAAM,EAAUA,EAAAA,uBAAuB,CAEjC,EACJ,OAAO,GAAiB,WACnB,GAA0B,CAC3B,EAEA,CAAC,EAAO,IAAA,EAAA,EAAA,UAA6B,EAAqB,CAC1D,GAAA,EAAA,EAAA,QAAqB,EAAqB,CAE1C,GAAA,EAAA,EAAA,QAA2D,KAAK,CA8CtE,OA5CA,EAAA,EAAA,eAAgB,CACd,GAAM,CAAE,OAAO,GAAM,UAAU,IAAS,GAAW,EAAE,CAC/C,EAAe,IAAIC,EAAAA,uBACvB,EACA,GAAS,UACT,CACE,OACA,UACA,aAAc,EACf,CACF,CACD,EAAgB,QAAU,EAE1B,IAAM,EAAW,GAAa,CAC5B,IAAM,EAAY,EAAqB,OACvC,EAAS,QAAU,EACnB,EAAc,EAAS,EAKzB,OAHA,EAAa,iBAAiB,SAAU,EAAQ,CAChD,EAAa,OAAO,KAEP,CACX,EAAa,oBAAoB,SAAU,EAAQ,CACnD,EAAa,MAAM,CACnB,EAAgB,QAAU,OAE3B,CAAC,EAAK,GAAS,UAAW,GAAS,KAAM,GAAS,QAAQ,CAAC,CAkBvD,CAAC,EAhBuC,GAAmB,CAChE,EAAe,GAAS,CACtB,IAAM,EACJ,OAAO,GAAmB,WACrB,EAAkC,EAAK,CACxC,EAGN,MAFA,GAAS,QAAU,EACnB,EAAgB,SAAS,IAAI,EAAS,CAC/B,GACP,MAGoB,CACtB,EAAgB,SAAS,kBAAkB,EAGV"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`})
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./useCrossFrameState.cjs`);let t=require(`@intlayer/editor`);const n=(n,r)=>e.useCrossFrameState(t.MessageKey.INTLAYER_URL_CHANGE,n,r),r=e=>n(e,{emit:!0,receive:!1});exports.useCrossURLPathSetter=r,exports.useCrossURLPathState=n;
|
|
2
2
|
//# sourceMappingURL=useCrossURLPathState.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCrossURLPathState.cjs","names":["useCrossFrameState","MessageKey"],"sources":["../../src/useCrossURLPathState.tsx"],"sourcesContent":["'use client';\n\nimport { MessageKey } from '@intlayer/editor';\nimport {\n type CrossFrameStateOptions,\n useCrossFrameState,\n} from './useCrossFrameState';\n\nexport const useCrossURLPathState = (\n initialState?: string,\n options?: CrossFrameStateOptions\n) => useCrossFrameState(MessageKey.INTLAYER_URL_CHANGE, initialState, options);\n\nexport const useCrossURLPathSetter = (initialState?: string) => {\n // The EditorStateManager already handles URL tracking in client mode via\n // UrlStateManager.start(). This hook remains for explicit use cases.\n return useCrossURLPathState(initialState, { emit: true, receive: false });\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useCrossURLPathState.cjs","names":["useCrossFrameState","MessageKey"],"sources":["../../src/useCrossURLPathState.tsx"],"sourcesContent":["'use client';\n\nimport { MessageKey } from '@intlayer/editor';\nimport {\n type CrossFrameStateOptions,\n useCrossFrameState,\n} from './useCrossFrameState';\n\nexport const useCrossURLPathState = (\n initialState?: string,\n options?: CrossFrameStateOptions\n) => useCrossFrameState(MessageKey.INTLAYER_URL_CHANGE, initialState, options);\n\nexport const useCrossURLPathSetter = (initialState?: string) => {\n // The EditorStateManager already handles URL tracking in client mode via\n // UrlStateManager.start(). This hook remains for explicit use cases.\n return useCrossURLPathState(initialState, { emit: true, receive: false });\n};\n"],"mappings":"8JAQA,MAAa,GACX,EACA,IACGA,EAAAA,mBAAmBC,EAAAA,WAAW,oBAAqB,EAAc,EAAQ,CAEjE,EAAyB,GAG7B,EAAqB,EAAc,CAAE,KAAM,GAAM,QAAS,GAAO,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`})
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./EditorStateContext.cjs`);let t=require(`react`);const n=()=>{let n=e.useEditorStateManager(),[r,i]=(0,t.useState)(n?.currentLocale.value);return(0,t.useEffect)(()=>{if(!n)return;let e=e=>i(e.detail);return n.currentLocale.addEventListener(`change`,e),()=>n.currentLocale.removeEventListener(`change`,e)},[n]),r},r=()=>{let t=e.useEditorStateManager();return e=>t?.currentLocale.set(e)};exports.useEditorLocale=n,exports.useSetEditorLocale=r;
|
|
2
2
|
//# sourceMappingURL=useEditorLocale.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEditorLocale.cjs","names":["useEditorStateManager"],"sources":["../../src/useEditorLocale.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"useEditorLocale.cjs","names":["useEditorStateManager"],"sources":["../../src/useEditorLocale.tsx"],"sourcesContent":["'use client';\n\nimport type { Locale } from '@intlayer/types/allLocales';\nimport { useEffect, useState } from 'react';\nimport { useEditorStateManager } from './EditorStateContext';\n\nexport const useEditorLocale = (): Locale | undefined => {\n const manager = useEditorStateManager();\n const [locale, setLocale] = useState<Locale | undefined>(\n manager?.currentLocale.value\n );\n\n useEffect(() => {\n if (!manager) return;\n\n const handler = (e: Event) => setLocale((e as CustomEvent<Locale>).detail);\n manager.currentLocale.addEventListener('change', handler);\n\n return () => manager.currentLocale.removeEventListener('change', handler);\n }, [manager]);\n\n return locale;\n};\n\nexport const useSetEditorLocale = () => {\n const manager = useEditorStateManager();\n return (locale: Locale) => manager?.currentLocale.set(locale);\n};\n"],"mappings":"mJAMA,MAAa,MAA4C,CACvD,IAAM,EAAUA,EAAAA,uBAAuB,CACjC,CAAC,EAAQ,IAAA,EAAA,EAAA,UACb,GAAS,cAAc,MACxB,CAWD,OATA,EAAA,EAAA,eAAgB,CACd,GAAI,CAAC,EAAS,OAEd,IAAM,EAAW,GAAa,EAAW,EAA0B,OAAO,CAG1E,OAFA,EAAQ,cAAc,iBAAiB,SAAU,EAAQ,KAE5C,EAAQ,cAAc,oBAAoB,SAAU,EAAQ,EACxE,CAAC,EAAQ,CAAC,CAEN,GAGI,MAA2B,CACtC,IAAM,EAAUA,EAAAA,uBAAuB,CACvC,MAAQ,IAAmB,GAAS,cAAc,IAAI,EAAO"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`})
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./FocusDictionaryContext.cjs`),t=require(`./DictionariesRecordContext.cjs`),n=require(`./useEditorLocale.cjs`);let r=require(`react`),i=require(`@intlayer/core/dictionaryManipulator`);const a=(e,t,n)=>{for(let r of t)try{if((0,i.getContentNodeByKeyPath)(r.content,e??[],n))return{keyPath:e,dictionaryLocalId:r.localId}}catch{}},o=()=>{let{localeDictionaries:i}=t.useDictionariesRecord(),o=n.useEditorLocale(),{setFocusedContent:s,setFocusedContentKeyPath:c,focusedContent:l}=e.useFocusDictionary();return{focusedContent:(0,r.useMemo)(()=>{if(!l||!i||l.dictionaryLocalId)return l;let e=Object.values(i).filter(e=>e.key===l.dictionaryKey),t=a(l.keyPath??[],e,o);return{...l,...t}},[l,i,o]),setFocusedContent:s,setFocusedContentKeyPath:c}};exports.useFocusUnmergedDictionary=o;
|
|
2
2
|
//# sourceMappingURL=useFocusUnmergedDictionary.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFocusUnmergedDictionary.cjs","names":["useDictionariesRecord","useEditorLocale","useFocusDictionary"],"sources":["../../src/useFocusUnmergedDictionary.tsx"],"sourcesContent":["'use client';\n\nimport { getContentNodeByKeyPath } from '@intlayer/core/dictionaryManipulator';\nimport type {
|
|
1
|
+
{"version":3,"file":"useFocusUnmergedDictionary.cjs","names":["useDictionariesRecord","useEditorLocale","useFocusDictionary"],"sources":["../../src/useFocusUnmergedDictionary.tsx"],"sourcesContent":["'use client';\n\nimport { getContentNodeByKeyPath } from '@intlayer/core/dictionaryManipulator';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type { Dictionary, LocalDictionaryId } from '@intlayer/types/dictionary';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport { useMemo } from 'react';\nimport { useDictionariesRecord } from './DictionariesRecordContext';\nimport { type FileContent, useFocusDictionary } from './FocusDictionaryContext';\nimport { useEditorLocale } from './useEditorLocale';\n\ntype UnmergedKeyPath = {\n keyPath: KeyPath[];\n dictionaryLocalId?: LocalDictionaryId;\n};\n\n/**\n * Converts merged keypath format to unmerged format.\n * Merged: [{type: \"translation\", key: \"fr\"}, {type: \"object\", key: \"title\"}]\n * Unmerged: [{type: \"object\", key: \"title\"}, {type: \"translation\", key: \"fr\"}]\n */\nconst mergedKeyPathToUnmergedKeyPath = (\n keyPath: KeyPath[],\n dictionaries: Dictionary[],\n locale?: Locale\n): UnmergedKeyPath | undefined => {\n // If we have a dictionary, verify the path exists\n // Try to find the correct position for the translation key\n // by checking which path actually exists in the dictionary\n for (const dictionary of dictionaries) {\n try {\n const result = getContentNodeByKeyPath(\n dictionary.content,\n keyPath ?? [],\n locale\n );\n\n if (result) {\n return { keyPath, dictionaryLocalId: dictionary.localId };\n }\n } catch {\n // Continue to next candidate\n }\n }\n};\n\nexport const useFocusUnmergedDictionary = () => {\n const { localeDictionaries } = useDictionariesRecord();\n const currentLocale = useEditorLocale();\n const {\n setFocusedContent,\n setFocusedContentKeyPath,\n focusedContent: mergedFocusedContent,\n } = useFocusDictionary();\n\n const focusedContent = useMemo<FileContent | null>(() => {\n if (!mergedFocusedContent) return mergedFocusedContent;\n if (!localeDictionaries) return mergedFocusedContent;\n if (mergedFocusedContent.dictionaryLocalId) return mergedFocusedContent;\n\n const dictionaries = Object.values(localeDictionaries).filter(\n (dictionary) => dictionary.key === mergedFocusedContent.dictionaryKey\n );\n\n const unmergedKeyPath = mergedKeyPathToUnmergedKeyPath(\n mergedFocusedContent.keyPath ?? [],\n dictionaries,\n currentLocale\n );\n\n return {\n ...mergedFocusedContent,\n ...unmergedKeyPath,\n };\n }, [mergedFocusedContent, localeDictionaries, currentLocale]);\n\n return {\n focusedContent,\n setFocusedContent,\n setFocusedContentKeyPath,\n };\n};\n"],"mappings":"yRAqBA,MAAM,GACJ,EACA,EACA,IACgC,CAIhC,IAAK,IAAM,KAAc,EACvB,GAAI,CAOF,IAAA,EAAA,EAAA,yBALE,EAAW,QACX,GAAW,EAAE,CACb,EACD,CAGC,MAAO,CAAE,UAAS,kBAAmB,EAAW,QAAS,MAErD,IAMC,MAAmC,CAC9C,GAAM,CAAE,sBAAuBA,EAAAA,uBAAuB,CAChD,EAAgBC,EAAAA,iBAAiB,CACjC,CACJ,oBACA,2BACA,eAAgB,GACdC,EAAAA,oBAAoB,CAuBxB,MAAO,CACL,gBAAA,EAAA,EAAA,aAtBuD,CAGvD,GAFI,CAAC,GACD,CAAC,GACD,EAAqB,kBAAmB,OAAO,EAEnD,IAAM,EAAe,OAAO,OAAO,EAAmB,CAAC,OACpD,GAAe,EAAW,MAAQ,EAAqB,cACzD,CAEK,EAAkB,EACtB,EAAqB,SAAW,EAAE,CAClC,EACA,EACD,CAED,MAAO,CACL,GAAG,EACH,GAAG,EACJ,EACA,CAAC,EAAsB,EAAoB,EAAc,CAAC,CAI3D,oBACA,2BACD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`})
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./useCrossFrameMessageListener.cjs`);let t=require(`@intlayer/editor`);const n=()=>{e.useCrossFrameMessageListener(t.MessageKey.INTLAYER_IFRAME_CLICKED)},r=()=>{e.useCrossFrameMessageListener(t.MessageKey.INTLAYER_IFRAME_CLICKED,t.mergeIframeClick)};exports.useIframeClickInterceptor=n,exports.useIframeClickMerger=r;
|
|
2
2
|
//# sourceMappingURL=useIframeClickInterceptor.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIframeClickInterceptor.cjs","names":["MessageKey","mergeIframeClick"],"sources":["../../src/useIframeClickInterceptor.tsx"],"sourcesContent":["'use client';\n\nimport { MessageKey, mergeIframeClick } from '@intlayer/editor';\nimport { useCrossFrameMessageListener } from './useCrossFrameMessageListener';\n\n/**\n * Broadcasts mousedown events from within an iframe to the parent frame.\n * Called in the client application (inside the iframe).\n * Note: EditorStateManager.start() already sets this up in client mode.\n * This hook exists for explicit / standalone use cases.\n */\nexport const useIframeClickInterceptor = () => {\n useCrossFrameMessageListener<undefined>(MessageKey.INTLAYER_IFRAME_CLICKED);\n};\n\n/**\n * Merges received iframe click events into the parent's DOM event stream.\n * Called in the editor (parent frame).\n */\nexport const useIframeClickMerger = () => {\n useCrossFrameMessageListener<MessageEvent>(\n MessageKey.INTLAYER_IFRAME_CLICKED,\n mergeIframeClick\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useIframeClickInterceptor.cjs","names":["MessageKey","mergeIframeClick"],"sources":["../../src/useIframeClickInterceptor.tsx"],"sourcesContent":["'use client';\n\nimport { MessageKey, mergeIframeClick } from '@intlayer/editor';\nimport { useCrossFrameMessageListener } from './useCrossFrameMessageListener';\n\n/**\n * Broadcasts mousedown events from within an iframe to the parent frame.\n * Called in the client application (inside the iframe).\n * Note: EditorStateManager.start() already sets this up in client mode.\n * This hook exists for explicit / standalone use cases.\n */\nexport const useIframeClickInterceptor = () => {\n useCrossFrameMessageListener<undefined>(MessageKey.INTLAYER_IFRAME_CLICKED);\n};\n\n/**\n * Merges received iframe click events into the parent's DOM event stream.\n * Called in the editor (parent frame).\n */\nexport const useIframeClickMerger = () => {\n useCrossFrameMessageListener<MessageEvent>(\n MessageKey.INTLAYER_IFRAME_CLICKED,\n mergeIframeClick\n );\n};\n"],"mappings":"wKAWA,MAAa,MAAkC,CAC7C,EAAA,6BAAwCA,EAAAA,WAAW,wBAAwB,EAOhE,MAA6B,CACxC,EAAA,6BACEA,EAAAA,WAAW,wBACXC,EAAAA,iBACD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{useEditorStateManager as e}from"./EditorStateContext.mjs";const t=()=>{let t=e();return{postMessage:e=>t
|
|
1
|
+
"use client";import{useEditorStateManager as e}from"./EditorStateContext.mjs";const t=()=>{let t=e();return{postMessage:e=>t?.messenger.send(e.type,e.data),senderId:t?.messenger.senderId??``}};export{t as useCommunicator};
|
|
2
2
|
//# sourceMappingURL=CommunicatorContext.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommunicatorContext.mjs","names":[],"sources":["../../src/CommunicatorContext.tsx"],"sourcesContent":["'use client';\n\nimport type { MessagePayload } from '@intlayer/editor';\nimport { useEditorStateManager } from './EditorStateContext';\n\nexport type UseCrossPlatformStateProps = {\n postMessage: (payload: MessagePayload) => void;\n allowedOrigins?: string[];\n senderId: string;\n};\n\n/**\n * Returns the communicator API backed by the shared EditorStateManager messenger.\n */\nexport const useCommunicator = (): UseCrossPlatformStateProps => {\n const manager = useEditorStateManager();\n\n return {\n postMessage: (payload: MessagePayload) =>\n manager
|
|
1
|
+
{"version":3,"file":"CommunicatorContext.mjs","names":[],"sources":["../../src/CommunicatorContext.tsx"],"sourcesContent":["'use client';\n\nimport type { MessagePayload } from '@intlayer/editor';\nimport { useEditorStateManager } from './EditorStateContext';\n\nexport type UseCrossPlatformStateProps = {\n postMessage: (payload: MessagePayload) => void;\n allowedOrigins?: string[];\n senderId: string;\n};\n\n/**\n * Returns the communicator API backed by the shared EditorStateManager messenger.\n */\nexport const useCommunicator = (): UseCrossPlatformStateProps => {\n const manager = useEditorStateManager();\n\n return {\n postMessage: (payload: MessagePayload) =>\n manager?.messenger.send(payload.type, payload.data),\n senderId: manager?.messenger.senderId ?? '',\n };\n};\n\n// Re-export type for backward compatibility\nexport type { MessengerConfig } from '@intlayer/editor';\n"],"mappings":"8EAcA,MAAa,MAAoD,CAC/D,IAAM,EAAU,GAAuB,CAEvC,MAAO,CACL,YAAc,GACZ,GAAS,UAAU,KAAK,EAAQ,KAAM,EAAQ,KAAK,CACrD,SAAU,GAAS,UAAU,UAAY,GAC1C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{useEditorStateManager as e}from"./EditorStateContext.mjs";import{useEffect as t,useState as n}from"react";const r=()=>{let r=e(),[i,a]=n(r
|
|
1
|
+
"use client";import{useEditorStateManager as e}from"./EditorStateContext.mjs";import{useEffect as t,useState as n}from"react";const r=({configuration:n,children:r})=>{let i=e();return t(()=>{!i||!n||i.configuration.set(n)},[i,n]),r},i=()=>{let r=e(),[i,a]=n(r?.configuration.value);return t(()=>{if(!r)return;let e=e=>a(e.detail);return r.configuration.addEventListener(`change`,e),()=>r.configuration.removeEventListener(`change`,e)},[r]),i},a=()=>{let t=e(),[r,i]=n(t?.configuration.value);return[r,i,()=>t?.configuration.postCurrentValue()]};export{r as ConfigurationProvider,i as useConfiguration,a as useConfigurationState};
|
|
2
2
|
//# sourceMappingURL=ConfigurationContext.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigurationContext.mjs","names":[],"sources":["../../src/ConfigurationContext.tsx"],"sourcesContent":["'use client';\n\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { useEffect, useState } from 'react';\nimport { useEditorStateManager } from './EditorStateContext';\n\nexport type ConfigurationProviderProps = {\n configuration?: IntlayerConfig;\n}
|
|
1
|
+
{"version":3,"file":"ConfigurationContext.mjs","names":[],"sources":["../../src/ConfigurationContext.tsx"],"sourcesContent":["'use client';\n\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FC, type PropsWithChildren, useEffect, useState } from 'react';\nimport { useEditorStateManager } from './EditorStateContext';\n\nexport type ConfigurationProviderProps = PropsWithChildren<{\n configuration?: IntlayerConfig;\n}>;\n\nexport const ConfigurationProvider: FC<ConfigurationProviderProps> = ({\n configuration,\n children,\n}) => {\n const manager = useEditorStateManager();\n\n useEffect(() => {\n if (!manager || !configuration) return;\n\n manager.configuration.set(configuration);\n }, [manager, configuration]);\n\n return children;\n};\n\nexport const useConfiguration = (): IntlayerConfig | undefined => {\n const manager = useEditorStateManager();\n const [config, setConfig] = useState<IntlayerConfig | undefined>(\n manager?.configuration.value\n );\n\n useEffect(() => {\n if (!manager) return;\n\n const handler = (e: Event) =>\n setConfig((e as CustomEvent<IntlayerConfig>).detail);\n manager.configuration.addEventListener('change', handler);\n return () => manager.configuration.removeEventListener('change', handler);\n }, [manager]);\n\n return config;\n};\n\nexport const useConfigurationState = () => {\n const manager = useEditorStateManager();\n\n const [config, setConfig] = useState<IntlayerConfig | undefined>(\n manager?.configuration.value\n );\n\n return [\n config,\n setConfig,\n () => manager?.configuration.postCurrentValue(),\n ] as const;\n};\n"],"mappings":"8HAUA,MAAa,GAAyD,CACpE,gBACA,cACI,CACJ,IAAM,EAAU,GAAuB,CAQvC,OANA,MAAgB,CACV,CAAC,GAAW,CAAC,GAEjB,EAAQ,cAAc,IAAI,EAAc,EACvC,CAAC,EAAS,EAAc,CAAC,CAErB,GAGI,MAAqD,CAChE,IAAM,EAAU,GAAuB,CACjC,CAAC,EAAQ,GAAa,EAC1B,GAAS,cAAc,MACxB,CAWD,OATA,MAAgB,CACd,GAAI,CAAC,EAAS,OAEd,IAAM,EAAW,GACf,EAAW,EAAkC,OAAO,CAEtD,OADA,EAAQ,cAAc,iBAAiB,SAAU,EAAQ,KAC5C,EAAQ,cAAc,oBAAoB,SAAU,EAAQ,EACxE,CAAC,EAAQ,CAAC,CAEN,GAGI,MAA8B,CACzC,IAAM,EAAU,GAAuB,CAEjC,CAAC,EAAQ,GAAa,EAC1B,GAAS,cAAc,MACxB,CAED,MAAO,CACL,EACA,MACM,GAAS,cAAc,kBAAkB,CAChD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{useEditorStateManager as e}from"./EditorStateContext.mjs";import{useCallback as t,useEffect as n,useState as r}from"react";const i=()=>{let i=e(),[a,o]=r(i
|
|
1
|
+
"use client";import{useEditorStateManager as e}from"./EditorStateContext.mjs";import{useCallback as t,useEffect as n,useState as r}from"react";const i=()=>{let i=e(),[a,o]=r(i?.localeDictionaries.value??{});return n(()=>{if(!i)return;let e=e=>o(e.detail??{});return i.localeDictionaries.addEventListener(`change`,e),()=>i.localeDictionaries.removeEventListener(`change`,e)},[i]),{localeDictionaries:a,setLocaleDictionaries:t(e=>i?.localeDictionaries.set(e),[i]),setLocaleDictionary:t(e=>i?.setLocaleDictionary(e),[i])}},a=()=>{let{setLocaleDictionaries:e,setLocaleDictionary:t}=i();return{setLocaleDictionaries:e,setLocaleDictionary:t}};export{i as useDictionariesRecord,a as useDictionariesRecordActions};
|
|
2
2
|
//# sourceMappingURL=DictionariesRecordContext.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionariesRecordContext.mjs","names":[],"sources":["../../src/DictionariesRecordContext.tsx"],"sourcesContent":["'use client';\n\nimport type { DictionaryContent } from '@intlayer/editor';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { useCallback, useEffect, useState } from 'react';\nimport { useEditorStateManager } from './EditorStateContext';\n\nexport type { DictionaryContent } from '@intlayer/editor';\n\ntype DictionariesRecordStatesContextType = {\n localeDictionaries: DictionaryContent;\n};\ntype DictionariesRecordActionsContextType = {\n setLocaleDictionaries: (value: DictionaryContent) => void;\n setLocaleDictionary: (dictionary: Dictionary) => void;\n};\n\
|
|
1
|
+
{"version":3,"file":"DictionariesRecordContext.mjs","names":[],"sources":["../../src/DictionariesRecordContext.tsx"],"sourcesContent":["'use client';\n\nimport type { DictionaryContent } from '@intlayer/editor';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { useCallback, useEffect, useState } from 'react';\nimport { useEditorStateManager } from './EditorStateContext';\n\nexport type { DictionaryContent } from '@intlayer/editor';\n\ntype DictionariesRecordStatesContextType = {\n localeDictionaries: DictionaryContent;\n};\ntype DictionariesRecordActionsContextType = {\n setLocaleDictionaries: (value: DictionaryContent) => void;\n setLocaleDictionary: (dictionary: Dictionary) => void;\n};\n\nexport const useDictionariesRecord = (): DictionariesRecordStatesContextType &\n DictionariesRecordActionsContextType => {\n const manager = useEditorStateManager();\n const [localeDictionaries, setLocaleDictionariesState] =\n useState<DictionaryContent>(manager?.localeDictionaries.value ?? {});\n\n useEffect(() => {\n if (!manager) return;\n\n const handler = (e: Event) =>\n setLocaleDictionariesState(\n (e as CustomEvent<DictionaryContent>).detail ?? {}\n );\n\n manager.localeDictionaries.addEventListener('change', handler);\n\n return () =>\n manager.localeDictionaries.removeEventListener('change', handler);\n }, [manager]);\n\n const setLocaleDictionaries = useCallback(\n (value: DictionaryContent) => manager?.localeDictionaries.set(value),\n [manager]\n );\n\n const setLocaleDictionary = useCallback(\n (dictionary: Dictionary) => manager?.setLocaleDictionary(dictionary),\n [manager]\n );\n\n return { localeDictionaries, setLocaleDictionaries, setLocaleDictionary };\n};\n\nexport const useDictionariesRecordActions =\n (): DictionariesRecordActionsContextType => {\n const { setLocaleDictionaries, setLocaleDictionary } =\n useDictionariesRecord();\n return { setLocaleDictionaries, setLocaleDictionary };\n };\n"],"mappings":"+IAiBA,MAAa,MAC6B,CACxC,IAAM,EAAU,GAAuB,CACjC,CAAC,EAAoB,GACzB,EAA4B,GAAS,mBAAmB,OAAS,EAAE,CAAC,CA0BtE,OAxBA,MAAgB,CACd,GAAI,CAAC,EAAS,OAEd,IAAM,EAAW,GACf,EACG,EAAqC,QAAU,EAAE,CACnD,CAIH,OAFA,EAAQ,mBAAmB,iBAAiB,SAAU,EAAQ,KAG5D,EAAQ,mBAAmB,oBAAoB,SAAU,EAAQ,EAClE,CAAC,EAAQ,CAAC,CAYN,CAAE,qBAAoB,sBAVC,EAC3B,GAA6B,GAAS,mBAAmB,IAAI,EAAM,CACpE,CAAC,EAAQ,CACV,CAOmD,oBALxB,EACzB,GAA2B,GAAS,oBAAoB,EAAW,CACpE,CAAC,EAAQ,CACV,CAEwE,EAG9D,MACiC,CAC1C,GAAM,CAAE,wBAAuB,uBAC7B,GAAuB,CACzB,MAAO,CAAE,wBAAuB,sBAAqB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{useEditorStateManager as e}from"./EditorStateContext.mjs";import{useEffect as t,useState as n}from"react";const r=()=>{let t=e();return{setEditedContentState:e=>t
|
|
1
|
+
"use client";import{useEditorStateManager as e}from"./EditorStateContext.mjs";import{useEffect as t,useState as n}from"react";const r=()=>{let t=e();return{setEditedContentState:e=>t?.editedContent.set(e),setEditedDictionary:e=>t?.setEditedDictionary(e),setEditedContent:(e,n)=>t?.setEditedContent(e,n),addEditedContent:(e,n,r,i)=>t?.addContent(e,n,r,i),renameEditedContent:(e,n,r)=>t?.renameContent(e,n,r),removeEditedContent:(e,n)=>t?.removeContent(e,n),restoreEditedContent:e=>t?.restoreContent(e),clearEditedDictionaryContent:e=>t?.clearContent(e),clearEditedContent:()=>t?.clearAllContent(),getEditedContentValue:(e,n)=>t?.getContentValue(e,n)}},i=()=>{let i=e(),[a,o]=n(i?.editedContent.value);return t(()=>{if(!i)return;let e=e=>o(e.detail);return i.editedContent.addEventListener(`change`,e),()=>i.editedContent.removeEventListener(`change`,e)},[i]),{editedContent:a,...r()}},a=n=>{let r=e();t(()=>{if(!(!n||!r))return r.messenger.subscribe(`INTLAYER_EDITED_CONTENT_CHANGED/post`,n)},[r,n])},o=()=>{let t=e();return()=>{t?.messenger.send(`INTLAYER_EDITED_CONTENT_CHANGED/get`)}};export{i as useEditedContent,r as useEditedContentActions,o as useGetEditedContentState,a as usePostEditedContentState};
|
|
2
2
|
//# sourceMappingURL=EditedContentContext.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditedContentContext.mjs","names":[],"sources":["../../src/EditedContentContext.tsx"],"sourcesContent":["'use client';\n\nimport type { DictionaryContent } from '@intlayer/editor';\nimport type {\n ContentNode,\n Dictionary,\n LocalDictionaryId,\n} from '@intlayer/types/dictionary';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport { useEffect, useState } from 'react';\nimport { useEditorStateManager } from './EditorStateContext';\n\nexport type { DictionaryContent } from '@intlayer/editor';\n\ntype EditedContentActionsContextType = {\n setEditedContentState: (editedContent: DictionaryContent) => void;\n setEditedDictionary: (dict: Dictionary) => void;\n setEditedContent: (\n localDictionaryId: LocalDictionaryId,\n newValue: Dictionary['content']\n ) => void;\n addEditedContent: (\n localDictionaryId: LocalDictionaryId,\n newValue: ContentNode<any>,\n keyPath?: KeyPath[],\n overwrite?: boolean\n ) => void;\n renameEditedContent: (\n localDictionaryId: LocalDictionaryId,\n newKey: KeyPath['key'],\n keyPath?: KeyPath[]\n ) => void;\n removeEditedContent: (\n localDictionaryId: LocalDictionaryId,\n keyPath: KeyPath[]\n ) => void;\n restoreEditedContent: (localDictionaryId: LocalDictionaryId) => void;\n clearEditedDictionaryContent: (localDictionaryId: LocalDictionaryId) => void;\n clearEditedContent: () => void;\n getEditedContentValue: (\n localDictionaryIdOrKey: LocalDictionaryId | Dictionary['key'] | string,\n keyPath: KeyPath[]\n ) => ContentNode | undefined;\n};\n\
|
|
1
|
+
{"version":3,"file":"EditedContentContext.mjs","names":[],"sources":["../../src/EditedContentContext.tsx"],"sourcesContent":["'use client';\n\nimport type { DictionaryContent } from '@intlayer/editor';\nimport type {\n ContentNode,\n Dictionary,\n LocalDictionaryId,\n} from '@intlayer/types/dictionary';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport { useEffect, useState } from 'react';\nimport { useEditorStateManager } from './EditorStateContext';\n\nexport type { DictionaryContent } from '@intlayer/editor';\n\ntype EditedContentActionsContextType = {\n setEditedContentState: (editedContent: DictionaryContent) => void;\n setEditedDictionary: (dict: Dictionary) => void;\n setEditedContent: (\n localDictionaryId: LocalDictionaryId,\n newValue: Dictionary['content']\n ) => void;\n addEditedContent: (\n localDictionaryId: LocalDictionaryId,\n newValue: ContentNode<any>,\n keyPath?: KeyPath[],\n overwrite?: boolean\n ) => void;\n renameEditedContent: (\n localDictionaryId: LocalDictionaryId,\n newKey: KeyPath['key'],\n keyPath?: KeyPath[]\n ) => void;\n removeEditedContent: (\n localDictionaryId: LocalDictionaryId,\n keyPath: KeyPath[]\n ) => void;\n restoreEditedContent: (localDictionaryId: LocalDictionaryId) => void;\n clearEditedDictionaryContent: (localDictionaryId: LocalDictionaryId) => void;\n clearEditedContent: () => void;\n getEditedContentValue: (\n localDictionaryIdOrKey: LocalDictionaryId | Dictionary['key'] | string,\n keyPath: KeyPath[]\n ) => ContentNode | undefined;\n};\n\nexport const useEditedContentActions = (): EditedContentActionsContextType => {\n const manager = useEditorStateManager();\n\n return {\n setEditedContentState: (value: DictionaryContent) =>\n manager?.editedContent.set(value),\n setEditedDictionary: (dict: Dictionary) =>\n manager?.setEditedDictionary(dict),\n setEditedContent: (\n localId: LocalDictionaryId,\n value: Dictionary['content']\n ) => manager?.setEditedContent(localId, value),\n addEditedContent: (localId, value, keyPath, overwrite) =>\n manager?.addContent(localId, value, keyPath, overwrite),\n renameEditedContent: (localId, newKey, keyPath) =>\n manager?.renameContent(localId, newKey, keyPath),\n removeEditedContent: (localId, keyPath) =>\n manager?.removeContent(localId, keyPath),\n restoreEditedContent: (localId) => manager?.restoreContent(localId),\n clearEditedDictionaryContent: (localId) => manager?.clearContent(localId),\n clearEditedContent: () => manager?.clearAllContent(),\n getEditedContentValue: (localIdOrKey, keyPath) =>\n manager?.getContentValue(localIdOrKey, keyPath),\n };\n};\n\nexport const useEditedContent = () => {\n const manager = useEditorStateManager();\n const [editedContent, setEditedContentState] = useState<\n DictionaryContent | undefined\n >(manager?.editedContent.value);\n\n useEffect(() => {\n if (!manager) return;\n const handler = (e: Event) =>\n setEditedContentState((e as CustomEvent<DictionaryContent>).detail);\n manager.editedContent.addEventListener('change', handler);\n return () => manager.editedContent.removeEventListener('change', handler);\n }, [manager]);\n\n const actions = useEditedContentActions();\n return { editedContent, ...actions };\n};\n\nexport const usePostEditedContentState = <S,>(\n onEventTriggered?: (data: S) => void\n) => {\n const manager = useEditorStateManager();\n useEffect(() => {\n if (!onEventTriggered || !manager) return;\n return manager.messenger.subscribe(\n `INTLAYER_EDITED_CONTENT_CHANGED/post`,\n onEventTriggered as (data: unknown) => void\n );\n }, [manager, onEventTriggered]);\n};\n\nexport const useGetEditedContentState = () => {\n const manager = useEditorStateManager();\n return () => {\n manager?.messenger.send('INTLAYER_EDITED_CONTENT_CHANGED/get');\n };\n};\n"],"mappings":"8HA6CA,MAAa,MAAiE,CAC5E,IAAM,EAAU,GAAuB,CAEvC,MAAO,CACL,sBAAwB,GACtB,GAAS,cAAc,IAAI,EAAM,CACnC,oBAAsB,GACpB,GAAS,oBAAoB,EAAK,CACpC,kBACE,EACA,IACG,GAAS,iBAAiB,EAAS,EAAM,CAC9C,kBAAmB,EAAS,EAAO,EAAS,IAC1C,GAAS,WAAW,EAAS,EAAO,EAAS,EAAU,CACzD,qBAAsB,EAAS,EAAQ,IACrC,GAAS,cAAc,EAAS,EAAQ,EAAQ,CAClD,qBAAsB,EAAS,IAC7B,GAAS,cAAc,EAAS,EAAQ,CAC1C,qBAAuB,GAAY,GAAS,eAAe,EAAQ,CACnE,6BAA+B,GAAY,GAAS,aAAa,EAAQ,CACzE,uBAA0B,GAAS,iBAAiB,CACpD,uBAAwB,EAAc,IACpC,GAAS,gBAAgB,EAAc,EAAQ,CAClD,EAGU,MAAyB,CACpC,IAAM,EAAU,GAAuB,CACjC,CAAC,EAAe,GAAyB,EAE7C,GAAS,cAAc,MAAM,CAW/B,OATA,MAAgB,CACd,GAAI,CAAC,EAAS,OACd,IAAM,EAAW,GACf,EAAuB,EAAqC,OAAO,CAErE,OADA,EAAQ,cAAc,iBAAiB,SAAU,EAAQ,KAC5C,EAAQ,cAAc,oBAAoB,SAAU,EAAQ,EACxE,CAAC,EAAQ,CAAC,CAGN,CAAE,gBAAe,GADR,GAAyB,CACL,EAGzB,EACX,GACG,CACH,IAAM,EAAU,GAAuB,CACvC,MAAgB,CACV,MAAC,GAAoB,CAAC,GAC1B,OAAO,EAAQ,UAAU,UACvB,uCACA,EACD,EACA,CAAC,EAAS,EAAiB,CAAC,EAGpB,MAAiC,CAC5C,IAAM,EAAU,GAAuB,CACvC,UAAa,CACX,GAAS,UAAU,KAAK,sCAAsC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{useEditorStateManager as e}from"./EditorStateContext.mjs";import{useEffect as t,useState as n}from"react";import{MessageKey as r}from"@intlayer/editor";const i=()=>{let r=e(),[i,a]=n(r
|
|
1
|
+
"use client";import{useEditorStateManager as e}from"./EditorStateContext.mjs";import{useEffect as t,useState as n}from"react";import{MessageKey as r}from"@intlayer/editor";const i=()=>{let r=e(),[i,a]=n(r?.editorEnabled.value??!1);return t(()=>{if(!r)return;let e=e=>a(e.detail);return r.editorEnabled.addEventListener(`change`,e),()=>r.editorEnabled.removeEventListener(`change`,e)},[r]),{enabled:i}},a=n=>{let i=e();t(()=>{if(n)return i?.messenger.subscribe(`${r.INTLAYER_EDITOR_ENABLED}/get`,n)},[i,n])},o=()=>{let t=e();return e=>{t?.editorEnabled.set(e),t?.editorEnabled.postCurrentValue()}},s=()=>{let{enabled:t}=i(),n=e();return[t,e=>n?.editorEnabled.set(e)]},c=()=>{let t=e();return()=>t?.pingClient()};export{i as useEditorEnabled,s as useEditorEnabledState,c as useEditorPingClient,a as useGetEditorEnabledState,o as usePostEditorEnabledState};
|
|
2
2
|
//# sourceMappingURL=EditorEnabledContext.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorEnabledContext.mjs","names":[],"sources":["../../src/EditorEnabledContext.tsx"],"sourcesContent":["'use client';\n\nimport { MessageKey } from '@intlayer/editor';\nimport { useEffect, useState } from 'react';\nimport { useEditorStateManager } from './EditorStateContext';\n\nexport type EditorEnabledStateProps = {\n enabled: boolean;\n};\n\n/**\n * Returns the current editor-enabled state, kept in sync with the shared\n * EditorStateManager. Replaces the old EditorEnabledContext + EditorEnabledProvider.\n */\nexport const useEditorEnabled = (): EditorEnabledStateProps => {\n const manager = useEditorStateManager();\n const [enabled, setEnabled] = useState<boolean>(\n manager
|
|
1
|
+
{"version":3,"file":"EditorEnabledContext.mjs","names":[],"sources":["../../src/EditorEnabledContext.tsx"],"sourcesContent":["'use client';\n\nimport { MessageKey } from '@intlayer/editor';\nimport { useEffect, useState } from 'react';\nimport { useEditorStateManager } from './EditorStateContext';\n\nexport type EditorEnabledStateProps = {\n enabled: boolean;\n};\n\n/**\n * Returns the current editor-enabled state, kept in sync with the shared\n * EditorStateManager. Replaces the old EditorEnabledContext + EditorEnabledProvider.\n */\nexport const useEditorEnabled = (): EditorEnabledStateProps => {\n const manager = useEditorStateManager();\n const [enabled, setEnabled] = useState<boolean>(\n manager?.editorEnabled.value ?? false\n );\n\n useEffect(() => {\n if (!manager) return;\n\n const handler = (e: Event) =>\n setEnabled((e as CustomEvent<boolean>).detail);\n manager.editorEnabled.addEventListener('change', handler);\n return () => manager.editorEnabled.removeEventListener('change', handler);\n }, [manager]);\n\n return { enabled };\n};\n\n/**\n * Subscribes to incoming \"get\" requests for editor-enabled state and calls\n * the provided callback so the caller can respond.\n * Used by the editor side to respond when the client asks for the current state.\n */\nexport const useGetEditorEnabledState = (onRequest?: () => void) => {\n const manager = useEditorStateManager();\n\n useEffect(() => {\n if (!onRequest) return;\n\n return manager?.messenger.subscribe(\n `${MessageKey.INTLAYER_EDITOR_ENABLED}/get`,\n onRequest\n );\n }, [manager, onRequest]);\n};\n\n/**\n * Returns a function that sets the editor-enabled state and broadcasts it.\n */\nexport const usePostEditorEnabledState = () => {\n const manager = useEditorStateManager();\n\n return (value: boolean) => {\n manager?.editorEnabled.set(value);\n manager?.editorEnabled.postCurrentValue();\n };\n};\n\nexport const useEditorEnabledState = () => {\n const { enabled } = useEditorEnabled();\n const manager = useEditorStateManager();\n const setter = (value: boolean) => manager?.editorEnabled.set(value);\n\n return [enabled, setter] as const;\n};\n\n/**\n * Returns a function that re-pings the client via ARE_YOU_THERE.\n * Use this as the onClick for an \"Enable Editor\" / reconnect button.\n */\nexport const useEditorPingClient = (): (() => void) => {\n const manager = useEditorStateManager();\n\n return () => manager?.pingClient();\n};\n"],"mappings":"4KAcA,MAAa,MAAkD,CAC7D,IAAM,EAAU,GAAuB,CACjC,CAAC,EAAS,GAAc,EAC5B,GAAS,cAAc,OAAS,GACjC,CAWD,OATA,MAAgB,CACd,GAAI,CAAC,EAAS,OAEd,IAAM,EAAW,GACf,EAAY,EAA2B,OAAO,CAEhD,OADA,EAAQ,cAAc,iBAAiB,SAAU,EAAQ,KAC5C,EAAQ,cAAc,oBAAoB,SAAU,EAAQ,EACxE,CAAC,EAAQ,CAAC,CAEN,CAAE,UAAS,EAQP,EAA4B,GAA2B,CAClE,IAAM,EAAU,GAAuB,CAEvC,MAAgB,CACT,KAEL,OAAO,GAAS,UAAU,UACxB,GAAG,EAAW,wBAAwB,MACtC,EACD,EACA,CAAC,EAAS,EAAU,CAAC,EAMb,MAAkC,CAC7C,IAAM,EAAU,GAAuB,CAEvC,MAAQ,IAAmB,CACzB,GAAS,cAAc,IAAI,EAAM,CACjC,GAAS,cAAc,kBAAkB,GAIhC,MAA8B,CACzC,GAAM,CAAE,WAAY,GAAkB,CAChC,EAAU,GAAuB,CAGvC,MAAO,CAAC,EAFQ,GAAmB,GAAS,cAAc,IAAI,EAAM,CAE5C,EAOb,MAA0C,CACrD,IAAM,EAAU,GAAuB,CAEvC,UAAa,GAAS,YAAY"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{EditorStateProvider as e}from"./EditorStateContext.mjs";import{
|
|
1
|
+
"use client";import{EditorStateProvider as e}from"./EditorStateContext.mjs";import{useEffect as t,useRef as n}from"react";import{jsx as r}from"react/jsx-runtime";import{EditorStateManager as i,defineIntlayerElements as a,setGlobalEditorManager as o}from"@intlayer/editor";const s=({children:s,configuration:c,postMessage:l,allowedOrigins:u})=>{let d=n(null);d.current||=new i({mode:`editor`,messenger:{allowedOrigins:u,postMessageFn:l},configuration:c});let f=d.current;return t(()=>(a(),o(f),f.start(),()=>{f.stop(),o(null)}),[f]),r(e,{manager:f,children:s})};export{s as EditorProvider};
|
|
2
2
|
//# sourceMappingURL=EditorProvider.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorProvider.mjs","names":[],"sources":["../../src/EditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport
|
|
1
|
+
{"version":3,"file":"EditorProvider.mjs","names":[],"sources":["../../src/EditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport {\n defineIntlayerElements,\n EditorStateManager,\n type MessengerConfig,\n setGlobalEditorManager,\n} from '@intlayer/editor';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FC, type PropsWithChildren, useEffect, useRef } from 'react';\nimport { EditorStateProvider } from './EditorStateContext';\n\nexport type EditorProviderProps = {\n configuration: IntlayerConfig;\n postMessage: (data: any) => void;\n allowedOrigins: string[];\n};\n\n/**\n * EditorProvider creates and manages the lifecycle of an EditorStateManager,\n * provides it to all descendants, and registers the Lit web components.\n */\nexport const EditorProvider: FC<PropsWithChildren<EditorProviderProps>> = ({\n children,\n configuration,\n postMessage,\n allowedOrigins,\n}) => {\n const managerRef = useRef<EditorStateManager | null>(null);\n\n if (!managerRef.current) {\n const messengerConfig: MessengerConfig = {\n allowedOrigins,\n postMessageFn: postMessage,\n };\n\n managerRef.current = new EditorStateManager({\n mode: 'editor',\n messenger: messengerConfig,\n configuration,\n });\n }\n const manager = managerRef.current;\n\n useEffect(() => {\n defineIntlayerElements();\n setGlobalEditorManager(manager);\n\n manager.start();\n return () => {\n manager.stop();\n setGlobalEditorManager(null);\n };\n }, [manager]);\n\n return (\n <EditorStateProvider manager={manager}>{children}</EditorStateProvider>\n );\n};\n"],"mappings":"gRAsBA,MAAa,GAA8D,CACzE,WACA,gBACA,cACA,oBACI,CACJ,IAAM,EAAa,EAAkC,KAAK,CAE1D,AAME,EAAW,UAAU,IAAI,EAAmB,CAC1C,KAAM,SACN,UAPuC,CACvC,iBACA,cAAe,EAChB,CAKC,gBACD,CAAC,CAEJ,IAAM,EAAU,EAAW,QAa3B,OAXA,OACE,GAAwB,CACxB,EAAuB,EAAQ,CAE/B,EAAQ,OAAO,KACF,CACX,EAAQ,MAAM,CACd,EAAuB,KAAK,GAE7B,CAAC,EAAQ,CAAC,CAGX,EAAC,EAAD,CAA8B,UAAU,WAA+B,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{createContext as e,useContext as t}from"react";import{jsx as n}from"react/jsx-runtime";const r=e(null),i=({children:e,manager:t})=>n(r.Provider,{value:t,children:e}),a=()=>
|
|
1
|
+
"use client";import{createContext as e,useContext as t}from"react";import{jsx as n}from"react/jsx-runtime";const r=e(null),i=({children:e,manager:t})=>n(r.Provider,{value:t,children:e}),a=()=>t(r);export{i as EditorStateProvider,a as useEditorStateManager};
|
|
2
2
|
//# sourceMappingURL=EditorStateContext.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorStateContext.mjs","names":[],"sources":["../../src/EditorStateContext.tsx"],"sourcesContent":["'use client';\n\nimport type { EditorStateManager } from '@intlayer/editor';\nimport {\n createContext,\n type FC,\n type PropsWithChildren,\n useContext,\n} from 'react';\n\nconst EditorStateContext = createContext<EditorStateManager | null>(null);\n\nexport const EditorStateProvider: FC<\n PropsWithChildren<{ manager: EditorStateManager }>\n> = ({ children, manager }) => (\n <EditorStateContext.Provider value={manager}>\n {children}\n </EditorStateContext.Provider>\n);\n\nexport const useEditorStateManager = (): EditorStateManager
|
|
1
|
+
{"version":3,"file":"EditorStateContext.mjs","names":[],"sources":["../../src/EditorStateContext.tsx"],"sourcesContent":["'use client';\n\nimport type { EditorStateManager } from '@intlayer/editor';\nimport {\n createContext,\n type FC,\n type PropsWithChildren,\n useContext,\n} from 'react';\n\nconst EditorStateContext = createContext<EditorStateManager | null>(null);\n\nexport const EditorStateProvider: FC<\n PropsWithChildren<{ manager: EditorStateManager }>\n> = ({ children, manager }) => (\n <EditorStateContext.Provider value={manager}>\n {children}\n </EditorStateContext.Provider>\n);\n\nexport const useEditorStateManager = (): EditorStateManager | null =>\n useContext(EditorStateContext);\n"],"mappings":"2GAUA,MAAM,EAAqB,EAAyC,KAAK,CAE5D,GAER,CAAE,WAAU,aACf,EAAC,EAAmB,SAApB,CAA6B,MAAO,EACjC,WAC2B,CAAA,CAGnB,MACX,EAAW,EAAmB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{useEditorStateManager as e}from"./EditorStateContext.mjs";import{useEffect as t,useState as n}from"react";const r=()=>{let r=e(),[i,a]=n(r
|
|
1
|
+
"use client";import{useEditorStateManager as e}from"./EditorStateContext.mjs";import{useEffect as t,useState as n}from"react";const r=()=>{let r=e(),[i,a]=n(r?.focusedContent.value??null);return t(()=>{if(!r)return;let e=e=>a(e.detail);return r.focusedContent.addEventListener(`change`,e),()=>r.focusedContent.removeEventListener(`change`,e)},[r]),{focusedContent:i,setFocusedContent:e=>r?.focusedContent.set(e),setFocusedContentKeyPath:e=>r?.setFocusedContentKeyPath(e)}},i=()=>{let{setFocusedContent:e,setFocusedContentKeyPath:t}=r();return{setFocusedContent:e,setFocusedContentKeyPath:t}};export{r as useFocusDictionary,i as useFocusDictionaryActions};
|
|
2
2
|
//# sourceMappingURL=FocusDictionaryContext.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FocusDictionaryContext.mjs","names":[],"sources":["../../src/FocusDictionaryContext.tsx"],"sourcesContent":["'use client';\n\nimport type { FileContent } from '@intlayer/editor';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport { useEffect, useState } from 'react';\nimport { useEditorStateManager } from './EditorStateContext';\n\nexport type { FileContent } from '@intlayer/editor';\n\nexport type FocusDictionaryState = {\n focusedContent: FileContent | null;\n};\n\nexport type FocusDictionaryActions = {\n setFocusedContent: (value: FileContent | null) => void;\n setFocusedContentKeyPath: (keyPath: KeyPath[]) => void;\n};\n\n/**\n * Returns the focused-content state and setters, backed by EditorStateManager.\n */\nexport const useFocusDictionary = (): FocusDictionaryState &\n FocusDictionaryActions => {\n const manager = useEditorStateManager();\n const [focusedContent, setFocusedContentState] = useState<FileContent | null>(\n manager
|
|
1
|
+
{"version":3,"file":"FocusDictionaryContext.mjs","names":[],"sources":["../../src/FocusDictionaryContext.tsx"],"sourcesContent":["'use client';\n\nimport type { FileContent } from '@intlayer/editor';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport { useEffect, useState } from 'react';\nimport { useEditorStateManager } from './EditorStateContext';\n\nexport type { FileContent } from '@intlayer/editor';\n\nexport type FocusDictionaryState = {\n focusedContent: FileContent | null;\n};\n\nexport type FocusDictionaryActions = {\n setFocusedContent: (value: FileContent | null) => void;\n setFocusedContentKeyPath: (keyPath: KeyPath[]) => void;\n};\n\n/**\n * Returns the focused-content state and setters, backed by EditorStateManager.\n */\nexport const useFocusDictionary = (): FocusDictionaryState &\n FocusDictionaryActions => {\n const manager = useEditorStateManager();\n const [focusedContent, setFocusedContentState] = useState<FileContent | null>(\n manager?.focusedContent.value ?? null\n );\n\n useEffect(() => {\n if (!manager) return;\n const handler = (e: Event) =>\n setFocusedContentState((e as CustomEvent<FileContent | null>).detail);\n manager.focusedContent.addEventListener('change', handler);\n return () => manager.focusedContent.removeEventListener('change', handler);\n }, [manager]);\n\n return {\n focusedContent,\n setFocusedContent: (value: FileContent | null) =>\n manager?.focusedContent.set(value),\n setFocusedContentKeyPath: (keyPath: KeyPath[]) =>\n manager?.setFocusedContentKeyPath(keyPath),\n };\n};\n\nexport const useFocusDictionaryActions = (): FocusDictionaryActions => {\n const { setFocusedContent, setFocusedContentKeyPath } = useFocusDictionary();\n return { setFocusedContent, setFocusedContentKeyPath };\n};\n"],"mappings":"8HAqBA,MAAa,MACe,CAC1B,IAAM,EAAU,GAAuB,CACjC,CAAC,EAAgB,GAA0B,EAC/C,GAAS,eAAe,OAAS,KAClC,CAUD,OARA,MAAgB,CACd,GAAI,CAAC,EAAS,OACd,IAAM,EAAW,GACf,EAAwB,EAAsC,OAAO,CAEvE,OADA,EAAQ,eAAe,iBAAiB,SAAU,EAAQ,KAC7C,EAAQ,eAAe,oBAAoB,SAAU,EAAQ,EACzE,CAAC,EAAQ,CAAC,CAEN,CACL,iBACA,kBAAoB,GAClB,GAAS,eAAe,IAAI,EAAM,CACpC,yBAA2B,GACzB,GAAS,yBAAyB,EAAQ,CAC7C,EAGU,MAA0D,CACrE,GAAM,CAAE,oBAAmB,4BAA6B,GAAoB,CAC5E,MAAO,CAAE,oBAAmB,2BAA0B"}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EditorStateProvider as e,useEditorStateManager as t}from"./EditorStateContext.mjs";import{useFocusDictionary as n,useFocusDictionaryActions as r}from"./FocusDictionaryContext.mjs";import{useCrossFrameState as i}from"./useCrossFrameState.mjs";import{useCrossURLPathSetter as a,useCrossURLPathState as o}from"./useCrossURLPathState.mjs";import{useDictionariesRecord as s,useDictionariesRecordActions as c}from"./DictionariesRecordContext.mjs";import{useEditorLocale as l,useSetEditorLocale as u}from"./useEditorLocale.mjs";import{useFocusUnmergedDictionary as d}from"./useFocusUnmergedDictionary.mjs";import{
|
|
1
|
+
import{EditorStateProvider as e,useEditorStateManager as t}from"./EditorStateContext.mjs";import{useFocusDictionary as n,useFocusDictionaryActions as r}from"./FocusDictionaryContext.mjs";import{useCrossFrameState as i}from"./useCrossFrameState.mjs";import{useCrossURLPathSetter as a,useCrossURLPathState as o}from"./useCrossURLPathState.mjs";import{useDictionariesRecord as s,useDictionariesRecordActions as c}from"./DictionariesRecordContext.mjs";import{useEditorLocale as l,useSetEditorLocale as u}from"./useEditorLocale.mjs";import{useFocusUnmergedDictionary as d}from"./useFocusUnmergedDictionary.mjs";import{EditorProvider as f}from"./EditorProvider.mjs";import{useCommunicator as p}from"./CommunicatorContext.mjs";import{ConfigurationProvider as m,useConfiguration as h,useConfigurationState as g}from"./ConfigurationContext.mjs";import{useEditedContent as _,useEditedContentActions as v,useGetEditedContentState as y,usePostEditedContentState as b}from"./EditedContentContext.mjs";import{useEditorEnabled as x,useEditorEnabledState as S,useEditorPingClient as C,useGetEditorEnabledState as w,usePostEditorEnabledState as T}from"./EditorEnabledContext.mjs";import{useCrossFrameMessageListener as E}from"./useCrossFrameMessageListener.mjs";import{useIframeClickInterceptor as D,useIframeClickMerger as O}from"./useIframeClickInterceptor.mjs";import{MessageKey as k}from"@intlayer/editor";export{m as ConfigurationProvider,f as EditorProvider,e as EditorStateProvider,k as MessageKey,p as useCommunicator,h as useConfiguration,g as useConfigurationState,E as useCrossFrameMessageListener,i as useCrossFrameState,a as useCrossURLPathSetter,o as useCrossURLPathState,s as useDictionariesRecord,c as useDictionariesRecordActions,_ as useEditedContent,v as useEditedContentActions,x as useEditorEnabled,S as useEditorEnabledState,l as useEditorLocale,C as useEditorPingClient,t as useEditorStateManager,n as useFocusDictionary,r as useFocusDictionaryActions,d as useFocusUnmergedDictionary,y as useGetEditedContentState,w as useGetEditorEnabledState,D as useIframeClickInterceptor,O as useIframeClickMerger,b as usePostEditedContentState,T as usePostEditorEnabledState,u as useSetEditorLocale};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{useEditorStateManager as e}from"./EditorStateContext.mjs";import{useEffect as t}from"react";const n=(n,r,i)=>{let a=e();return t(()=>{if(r)return a
|
|
1
|
+
"use client";import{useEditorStateManager as e}from"./EditorStateContext.mjs";import{useEffect as t}from"react";const n=(n,r,i)=>{let a=e();return t(()=>{if(r)return a?.messenger.subscribe(n,r)},[a,n,i]),e=>{a?.messenger.send(n,e)}};export{n as useCrossFrameMessageListener};
|
|
2
2
|
//# sourceMappingURL=useCrossFrameMessageListener.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCrossFrameMessageListener.mjs","names":[],"sources":["../../src/useCrossFrameMessageListener.tsx"],"sourcesContent":["'use client';\n\nimport type { MessageKey } from '@intlayer/editor';\nimport { useEffect } from 'react';\nimport { useEditorStateManager } from './EditorStateContext';\n\n/**\n * Listens for cross-frame messages of the specified type and calls the callback.\n * Returns a function to manually send a message of the same type.\n *\n * Backed by CrossFrameMessenger from EditorStateManager.\n */\nexport const useCrossFrameMessageListener = <S,>(\n key: `${MessageKey}` | `${MessageKey}/post` | `${MessageKey}/get`,\n onEventTriggered?: (data: S) => void,\n revalidator?: any\n) => {\n const manager = useEditorStateManager();\n\n useEffect(() => {\n if (!onEventTriggered) return;\n return manager
|
|
1
|
+
{"version":3,"file":"useCrossFrameMessageListener.mjs","names":[],"sources":["../../src/useCrossFrameMessageListener.tsx"],"sourcesContent":["'use client';\n\nimport type { MessageKey } from '@intlayer/editor';\nimport { useEffect } from 'react';\nimport { useEditorStateManager } from './EditorStateContext';\n\n/**\n * Listens for cross-frame messages of the specified type and calls the callback.\n * Returns a function to manually send a message of the same type.\n *\n * Backed by CrossFrameMessenger from EditorStateManager.\n */\nexport const useCrossFrameMessageListener = <S,>(\n key: `${MessageKey}` | `${MessageKey}/post` | `${MessageKey}/get`,\n onEventTriggered?: (data: S) => void,\n revalidator?: any\n) => {\n const manager = useEditorStateManager();\n\n useEffect(() => {\n if (!onEventTriggered) return;\n return manager?.messenger.subscribe<S>(key, onEventTriggered);\n }, [manager, key, revalidator]);\n\n return (data?: S) => {\n manager?.messenger.send(key, data);\n };\n};\n"],"mappings":"gHAYA,MAAa,GACX,EACA,EACA,IACG,CACH,IAAM,EAAU,GAAuB,CAOvC,OALA,MAAgB,CACT,KACL,OAAO,GAAS,UAAU,UAAa,EAAK,EAAiB,EAC5D,CAAC,EAAS,EAAK,EAAY,CAAC,CAEvB,GAAa,CACnB,GAAS,UAAU,KAAK,EAAK,EAAK"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{useEditorStateManager as e}from"./EditorStateContext.mjs";import{useEffect as t,useRef as n,useState as r}from"react";import{CrossFrameStateManager as i}from"@intlayer/editor";const a=(a,o,s)=>{let c=e(),l=typeof o==`function`?o():o,[u,d]=r(l),f=n(l),p=n(null);return t(()=>{let{emit:e=!0,receive:t=!0}=s??{},n=new i(a,c
|
|
1
|
+
"use client";import{useEditorStateManager as e}from"./EditorStateContext.mjs";import{useEffect as t,useRef as n,useState as r}from"react";import{CrossFrameStateManager as i}from"@intlayer/editor";const a=(a,o,s)=>{let c=e(),l=typeof o==`function`?o():o,[u,d]=r(l),f=n(l),p=n(null);return t(()=>{let{emit:e=!0,receive:t=!0}=s??{},n=new i(a,c?.messenger,{emit:e,receive:t,initialValue:l});p.current=n;let r=e=>{let t=e.detail;f.current=t,d(t)};return n.addEventListener(`change`,r),n.start(),()=>{n.removeEventListener(`change`,r),n.stop(),p.current=null}},[a,c?.messenger,s?.emit,s?.receive]),[u,e=>{d(t=>{let n=typeof e==`function`?e(t):e;return f.current=n,p.current?.set(n),n})},()=>{p.current?.postCurrentValue()}]};export{a as useCrossFrameState};
|
|
2
2
|
//# sourceMappingURL=useCrossFrameState.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCrossFrameState.mjs","names":[],"sources":["../../src/useCrossFrameState.tsx"],"sourcesContent":["'use client';\n\nimport {
|
|
1
|
+
{"version":3,"file":"useCrossFrameState.mjs","names":[],"sources":["../../src/useCrossFrameState.tsx"],"sourcesContent":["'use client';\n\nimport type { MessageKey } from '@intlayer/editor';\nimport { CrossFrameStateManager } from '@intlayer/editor';\nimport {\n type Dispatch,\n type SetStateAction,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport { useEditorStateManager } from './EditorStateContext';\n\nexport type CrossFrameStateOptions = {\n emit?: boolean;\n receive?: boolean;\n};\n\n/**\n * Synchronizes a React state value across frames using CrossFrameStateManager.\n */\nexport const useCrossFrameState = <S,>(\n key: `${MessageKey}`,\n initialState?: S | (() => S),\n options?: CrossFrameStateOptions\n): [S, Dispatch<SetStateAction<S>>, () => void] => {\n const manager = useEditorStateManager();\n\n const resolvedInitial =\n typeof initialState === 'function'\n ? (initialState as () => S)()\n : initialState;\n\n const [value, setValueState] = useState<S>(resolvedInitial as S);\n const valueRef = useRef<S>(resolvedInitial as S);\n\n const stateManagerRef = useRef<CrossFrameStateManager<S> | null>(null);\n\n useEffect(() => {\n const { emit = true, receive = true } = options ?? {};\n const stateManager = new CrossFrameStateManager<S>(\n key,\n manager?.messenger,\n {\n emit,\n receive,\n initialValue: resolvedInitial,\n }\n );\n stateManagerRef.current = stateManager;\n\n const handler = (e: Event) => {\n const newValue = (e as CustomEvent<S>).detail;\n valueRef.current = newValue;\n setValueState(newValue);\n };\n stateManager.addEventListener('change', handler);\n stateManager.start();\n\n return () => {\n stateManager.removeEventListener('change', handler);\n stateManager.stop();\n stateManagerRef.current = null;\n };\n }, [key, manager?.messenger, options?.emit, options?.receive]);\n\n const setValue: Dispatch<SetStateAction<S>> = (valueOrUpdater) => {\n setValueState((prev) => {\n const newValue =\n typeof valueOrUpdater === 'function'\n ? (valueOrUpdater as (prev: S) => S)(prev)\n : valueOrUpdater;\n valueRef.current = newValue;\n stateManagerRef.current?.set(newValue);\n return newValue;\n });\n };\n\n const postState = () => {\n stateManagerRef.current?.postCurrentValue();\n };\n\n return [value, setValue, postState];\n};\n"],"mappings":"oMAqBA,MAAa,GACX,EACA,EACA,IACiD,CACjD,IAAM,EAAU,GAAuB,CAEjC,EACJ,OAAO,GAAiB,WACnB,GAA0B,CAC3B,EAEA,CAAC,EAAO,GAAiB,EAAY,EAAqB,CAC1D,EAAW,EAAU,EAAqB,CAE1C,EAAkB,EAAyC,KAAK,CA8CtE,OA5CA,MAAgB,CACd,GAAM,CAAE,OAAO,GAAM,UAAU,IAAS,GAAW,EAAE,CAC/C,EAAe,IAAI,EACvB,EACA,GAAS,UACT,CACE,OACA,UACA,aAAc,EACf,CACF,CACD,EAAgB,QAAU,EAE1B,IAAM,EAAW,GAAa,CAC5B,IAAM,EAAY,EAAqB,OACvC,EAAS,QAAU,EACnB,EAAc,EAAS,EAKzB,OAHA,EAAa,iBAAiB,SAAU,EAAQ,CAChD,EAAa,OAAO,KAEP,CACX,EAAa,oBAAoB,SAAU,EAAQ,CACnD,EAAa,MAAM,CACnB,EAAgB,QAAU,OAE3B,CAAC,EAAK,GAAS,UAAW,GAAS,KAAM,GAAS,QAAQ,CAAC,CAkBvD,CAAC,EAhBuC,GAAmB,CAChE,EAAe,GAAS,CACtB,IAAM,EACJ,OAAO,GAAmB,WACrB,EAAkC,EAAK,CACxC,EAGN,MAFA,GAAS,QAAU,EACnB,EAAgB,SAAS,IAAI,EAAS,CAC/B,GACP,MAGoB,CACtB,EAAgB,SAAS,kBAAkB,EAGV"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useEditorStateManager as e}from"./EditorStateContext.mjs";import{useEffect as t,useState as n}from"react";const r=()=>{let r=e(),[i,a]=n(r
|
|
1
|
+
"use client";import{useEditorStateManager as e}from"./EditorStateContext.mjs";import{useEffect as t,useState as n}from"react";const r=()=>{let r=e(),[i,a]=n(r?.currentLocale.value);return t(()=>{if(!r)return;let e=e=>a(e.detail);return r.currentLocale.addEventListener(`change`,e),()=>r.currentLocale.removeEventListener(`change`,e)},[r]),i},i=()=>{let t=e();return e=>t?.currentLocale.set(e)};export{r as useEditorLocale,i as useSetEditorLocale};
|
|
2
2
|
//# sourceMappingURL=useEditorLocale.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEditorLocale.mjs","names":[],"sources":["../../src/useEditorLocale.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"useEditorLocale.mjs","names":[],"sources":["../../src/useEditorLocale.tsx"],"sourcesContent":["'use client';\n\nimport type { Locale } from '@intlayer/types/allLocales';\nimport { useEffect, useState } from 'react';\nimport { useEditorStateManager } from './EditorStateContext';\n\nexport const useEditorLocale = (): Locale | undefined => {\n const manager = useEditorStateManager();\n const [locale, setLocale] = useState<Locale | undefined>(\n manager?.currentLocale.value\n );\n\n useEffect(() => {\n if (!manager) return;\n\n const handler = (e: Event) => setLocale((e as CustomEvent<Locale>).detail);\n manager.currentLocale.addEventListener('change', handler);\n\n return () => manager.currentLocale.removeEventListener('change', handler);\n }, [manager]);\n\n return locale;\n};\n\nexport const useSetEditorLocale = () => {\n const manager = useEditorStateManager();\n return (locale: Locale) => manager?.currentLocale.set(locale);\n};\n"],"mappings":"8HAMA,MAAa,MAA4C,CACvD,IAAM,EAAU,GAAuB,CACjC,CAAC,EAAQ,GAAa,EAC1B,GAAS,cAAc,MACxB,CAWD,OATA,MAAgB,CACd,GAAI,CAAC,EAAS,OAEd,IAAM,EAAW,GAAa,EAAW,EAA0B,OAAO,CAG1E,OAFA,EAAQ,cAAc,iBAAiB,SAAU,EAAQ,KAE5C,EAAQ,cAAc,oBAAoB,SAAU,EAAQ,EACxE,CAAC,EAAQ,CAAC,CAEN,GAGI,MAA2B,CACtC,IAAM,EAAU,GAAuB,CACvC,MAAQ,IAAmB,GAAS,cAAc,IAAI,EAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFocusUnmergedDictionary.mjs","names":[],"sources":["../../src/useFocusUnmergedDictionary.tsx"],"sourcesContent":["'use client';\n\nimport { getContentNodeByKeyPath } from '@intlayer/core/dictionaryManipulator';\nimport type {
|
|
1
|
+
{"version":3,"file":"useFocusUnmergedDictionary.mjs","names":[],"sources":["../../src/useFocusUnmergedDictionary.tsx"],"sourcesContent":["'use client';\n\nimport { getContentNodeByKeyPath } from '@intlayer/core/dictionaryManipulator';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type { Dictionary, LocalDictionaryId } from '@intlayer/types/dictionary';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport { useMemo } from 'react';\nimport { useDictionariesRecord } from './DictionariesRecordContext';\nimport { type FileContent, useFocusDictionary } from './FocusDictionaryContext';\nimport { useEditorLocale } from './useEditorLocale';\n\ntype UnmergedKeyPath = {\n keyPath: KeyPath[];\n dictionaryLocalId?: LocalDictionaryId;\n};\n\n/**\n * Converts merged keypath format to unmerged format.\n * Merged: [{type: \"translation\", key: \"fr\"}, {type: \"object\", key: \"title\"}]\n * Unmerged: [{type: \"object\", key: \"title\"}, {type: \"translation\", key: \"fr\"}]\n */\nconst mergedKeyPathToUnmergedKeyPath = (\n keyPath: KeyPath[],\n dictionaries: Dictionary[],\n locale?: Locale\n): UnmergedKeyPath | undefined => {\n // If we have a dictionary, verify the path exists\n // Try to find the correct position for the translation key\n // by checking which path actually exists in the dictionary\n for (const dictionary of dictionaries) {\n try {\n const result = getContentNodeByKeyPath(\n dictionary.content,\n keyPath ?? [],\n locale\n );\n\n if (result) {\n return { keyPath, dictionaryLocalId: dictionary.localId };\n }\n } catch {\n // Continue to next candidate\n }\n }\n};\n\nexport const useFocusUnmergedDictionary = () => {\n const { localeDictionaries } = useDictionariesRecord();\n const currentLocale = useEditorLocale();\n const {\n setFocusedContent,\n setFocusedContentKeyPath,\n focusedContent: mergedFocusedContent,\n } = useFocusDictionary();\n\n const focusedContent = useMemo<FileContent | null>(() => {\n if (!mergedFocusedContent) return mergedFocusedContent;\n if (!localeDictionaries) return mergedFocusedContent;\n if (mergedFocusedContent.dictionaryLocalId) return mergedFocusedContent;\n\n const dictionaries = Object.values(localeDictionaries).filter(\n (dictionary) => dictionary.key === mergedFocusedContent.dictionaryKey\n );\n\n const unmergedKeyPath = mergedKeyPathToUnmergedKeyPath(\n mergedFocusedContent.keyPath ?? [],\n dictionaries,\n currentLocale\n );\n\n return {\n ...mergedFocusedContent,\n ...unmergedKeyPath,\n };\n }, [mergedFocusedContent, localeDictionaries, currentLocale]);\n\n return {\n focusedContent,\n setFocusedContent,\n setFocusedContentKeyPath,\n };\n};\n"],"mappings":"8TAqBA,MAAM,GACJ,EACA,EACA,IACgC,CAIhC,IAAK,IAAM,KAAc,EACvB,GAAI,CAOF,GANe,EACb,EAAW,QACX,GAAW,EAAE,CACb,EACD,CAGC,MAAO,CAAE,UAAS,kBAAmB,EAAW,QAAS,MAErD,IAMC,MAAmC,CAC9C,GAAM,CAAE,sBAAuB,GAAuB,CAChD,EAAgB,GAAiB,CACjC,CACJ,oBACA,2BACA,eAAgB,GACd,GAAoB,CAuBxB,MAAO,CACL,eAtBqB,MAAkC,CAGvD,GAFI,CAAC,GACD,CAAC,GACD,EAAqB,kBAAmB,OAAO,EAEnD,IAAM,EAAe,OAAO,OAAO,EAAmB,CAAC,OACpD,GAAe,EAAW,MAAQ,EAAqB,cACzD,CAEK,EAAkB,EACtB,EAAqB,SAAW,EAAE,CAClC,EACA,EACD,CAED,MAAO,CACL,GAAG,EACH,GAAG,EACJ,EACA,CAAC,EAAsB,EAAoB,EAAc,CAAC,CAI3D,oBACA,2BACD"}
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import * as react from "react";
|
|
2
|
+
import { FC, PropsWithChildren } from "react";
|
|
2
3
|
import { IntlayerConfig } from "@intlayer/types/config";
|
|
3
4
|
|
|
4
5
|
//#region src/ConfigurationContext.d.ts
|
|
5
|
-
type ConfigurationProviderProps = {
|
|
6
|
+
type ConfigurationProviderProps = PropsWithChildren<{
|
|
6
7
|
configuration?: IntlayerConfig;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
* Returns the current configuration, backed by EditorStateManager.
|
|
10
|
-
*/
|
|
8
|
+
}>;
|
|
9
|
+
declare const ConfigurationProvider: FC<ConfigurationProviderProps>;
|
|
11
10
|
declare const useConfiguration: () => IntlayerConfig | undefined;
|
|
12
|
-
/**
|
|
13
|
-
* Returns a function that broadcasts the current configuration.
|
|
14
|
-
*/
|
|
15
11
|
declare const useConfigurationState: () => readonly [IntlayerConfig, react.Dispatch<react.SetStateAction<IntlayerConfig>>, () => void];
|
|
16
12
|
//#endregion
|
|
17
|
-
export { ConfigurationProviderProps, useConfiguration, useConfigurationState };
|
|
13
|
+
export { ConfigurationProvider, ConfigurationProviderProps, useConfiguration, useConfigurationState };
|
|
18
14
|
//# sourceMappingURL=ConfigurationContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigurationContext.d.ts","names":[],"sources":["../../src/ConfigurationContext.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ConfigurationContext.d.ts","names":[],"sources":["../../src/ConfigurationContext.tsx"],"mappings":";;;;;KAMY,0BAAA,GAA6B,iBAAA;EACvC,aAAA,GAAgB,cAAA;AAAA;AAAA,cAGL,qBAAA,EAAuB,EAAA,CAAG,0BAAA;AAAA,cAe1B,gBAAA,QAAuB,cAAA;AAAA,cAkBvB,qBAAA,kBAAqB,cAAA,EAAA,KAAA,CAAA,QAAA,CAAA,KAAA,CAAA,cAAA,CAAA,cAAA"}
|
|
@@ -9,10 +9,6 @@ type DictionariesRecordActionsContextType = {
|
|
|
9
9
|
setLocaleDictionaries: (value: DictionaryContent$1) => void;
|
|
10
10
|
setLocaleDictionary: (dictionary: Dictionary) => void;
|
|
11
11
|
};
|
|
12
|
-
/**
|
|
13
|
-
* Returns dictionaries record state and setters, backed by EditorStateManager.
|
|
14
|
-
* Replaces the old DictionariesRecordContext + DictionariesRecordProvider.
|
|
15
|
-
*/
|
|
16
12
|
declare const useDictionariesRecord: () => DictionariesRecordStatesContextType & DictionariesRecordActionsContextType;
|
|
17
13
|
declare const useDictionariesRecordActions: () => DictionariesRecordActionsContextType;
|
|
18
14
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionariesRecordContext.d.ts","names":[],"sources":["../../src/DictionariesRecordContext.tsx"],"mappings":";;;;KASK,mCAAA;EACH,kBAAA,EAAoB,mBAAA;AAAA;AAAA,KAEjB,oCAAA;EACH,qBAAA,GAAwB,KAAA,EAAO,mBAAA;EAC/B,mBAAA,GAAsB,UAAA,EAAY,UAAA;AAAA
|
|
1
|
+
{"version":3,"file":"DictionariesRecordContext.d.ts","names":[],"sources":["../../src/DictionariesRecordContext.tsx"],"mappings":";;;;KASK,mCAAA;EACH,kBAAA,EAAoB,mBAAA;AAAA;AAAA,KAEjB,oCAAA;EACH,qBAAA,GAAwB,KAAA,EAAO,mBAAA;EAC/B,mBAAA,GAAsB,UAAA,EAAY,UAAA;AAAA;AAAA,cAGvB,qBAAA,QAA4B,mCAAA,GACvC,oCAAA;AAAA,cAgCW,4BAAA,QACP,oCAAA"}
|
|
@@ -15,10 +15,7 @@ type EditedContentActionsContextType = {
|
|
|
15
15
|
clearEditedContent: () => void;
|
|
16
16
|
getEditedContentValue: (localDictionaryIdOrKey: LocalDictionaryId | Dictionary['key'] | string, keyPath: KeyPath[]) => ContentNode | undefined;
|
|
17
17
|
};
|
|
18
|
-
|
|
19
|
-
* Returns edited-content state and actions, backed by EditorStateManager.
|
|
20
|
-
*/
|
|
21
|
-
declare const useEditedContentActions: () => EditedContentActionsContextType | undefined;
|
|
18
|
+
declare const useEditedContentActions: () => EditedContentActionsContextType;
|
|
22
19
|
declare const useEditedContent: () => {
|
|
23
20
|
setEditedContentState: (editedContent: DictionaryContent$1) => void;
|
|
24
21
|
setEditedDictionary: (dict: Dictionary) => void;
|
|
@@ -33,7 +30,7 @@ declare const useEditedContent: () => {
|
|
|
33
30
|
editedContent: DictionaryContent$1;
|
|
34
31
|
};
|
|
35
32
|
declare const usePostEditedContentState: <S>(onEventTriggered?: (data: S) => void) => void;
|
|
36
|
-
declare const useGetEditedContentState:
|
|
33
|
+
declare const useGetEditedContentState: () => () => void;
|
|
37
34
|
//#endregion
|
|
38
35
|
export { type DictionaryContent, useEditedContent, useEditedContentActions, useGetEditedContentState, usePostEditedContentState };
|
|
39
36
|
//# sourceMappingURL=EditedContentContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditedContentContext.d.ts","names":[],"sources":["../../src/EditedContentContext.tsx"],"mappings":";;;;;KAcK,+BAAA;EACH,qBAAA,GAAwB,aAAA,EAAe,mBAAA;EACvC,mBAAA,GAAsB,IAAA,EAAM,UAAA;EAC5B,gBAAA,GACE,iBAAA,EAAmB,iBAAA,EACnB,QAAA,EAAU,UAAA;EAEZ,gBAAA,GACE,iBAAA,EAAmB,iBAAA,EACnB,QAAA,EAAU,WAAA,OACV,OAAA,GAAU,OAAA,IACV,SAAA;EAEF,mBAAA,GACE,iBAAA,EAAmB,iBAAA,EACnB,MAAA,EAAQ,OAAA,SACR,OAAA,GAAU,OAAA;EAEZ,mBAAA,GACE,iBAAA,EAAmB,iBAAA,EACnB,OAAA,EAAS,OAAA;EAEX,oBAAA,GAAuB,iBAAA,EAAmB,iBAAA;EAC1C,4BAAA,GAA+B,iBAAA,EAAmB,iBAAA;EAClD,kBAAA;EACA,qBAAA,GACE,sBAAA,EAAwB,iBAAA,GAAoB,UAAA,kBAC5C,OAAA,EAAS,OAAA,OACN,WAAA;AAAA
|
|
1
|
+
{"version":3,"file":"EditedContentContext.d.ts","names":[],"sources":["../../src/EditedContentContext.tsx"],"mappings":";;;;;KAcK,+BAAA;EACH,qBAAA,GAAwB,aAAA,EAAe,mBAAA;EACvC,mBAAA,GAAsB,IAAA,EAAM,UAAA;EAC5B,gBAAA,GACE,iBAAA,EAAmB,iBAAA,EACnB,QAAA,EAAU,UAAA;EAEZ,gBAAA,GACE,iBAAA,EAAmB,iBAAA,EACnB,QAAA,EAAU,WAAA,OACV,OAAA,GAAU,OAAA,IACV,SAAA;EAEF,mBAAA,GACE,iBAAA,EAAmB,iBAAA,EACnB,MAAA,EAAQ,OAAA,SACR,OAAA,GAAU,OAAA;EAEZ,mBAAA,GACE,iBAAA,EAAmB,iBAAA,EACnB,OAAA,EAAS,OAAA;EAEX,oBAAA,GAAuB,iBAAA,EAAmB,iBAAA;EAC1C,4BAAA,GAA+B,iBAAA,EAAmB,iBAAA;EAClD,kBAAA;EACA,qBAAA,GACE,sBAAA,EAAwB,iBAAA,GAAoB,UAAA,kBAC5C,OAAA,EAAS,OAAA,OACN,WAAA;AAAA;AAAA,cAGM,uBAAA,QAA8B,+BAAA;AAAA,cA0B9B,gBAAA;0BAxDa,aAAA,EAAe,mBAAA;wBACjB,IAAA,EAAM,UAAA;qBAE1B,iBAAA,EAAmB,iBAAA,EACnB,QAAA,EAAU,UAAA;qBAGV,iBAAA,EAAmB,iBAAA,EACnB,QAAA,EAAU,WAAA,OACV,OAAA,GAAU,OAAA,IACV,SAAA;wBAGA,iBAAA,EAAmB,iBAAA,EACnB,MAAA,EAAQ,OAAA,SACR,OAAA,GAAU,OAAA;wBAGV,iBAAA,EAAmB,iBAAA,EACnB,OAAA,EAAS,OAAA;yBAEY,iBAAA,EAAmB,iBAAA;iCACX,iBAAA,EAAmB,iBAAA;;0BAGhD,sBAAA,EAAwB,iBAAA,GAAoB,UAAA,kBAC5C,OAAA,EAAS,OAAA,OACN,WAAA;;;cA+CM,yBAAA,MACX,gBAAA,IAAoB,IAAA,EAAM,CAAA;AAAA,cAYf,wBAAA"}
|
|
@@ -18,6 +18,11 @@ declare const useGetEditorEnabledState: (onRequest?: () => void) => void;
|
|
|
18
18
|
*/
|
|
19
19
|
declare const usePostEditorEnabledState: () => (value: boolean) => void;
|
|
20
20
|
declare const useEditorEnabledState: () => readonly [boolean, (value: boolean) => void];
|
|
21
|
+
/**
|
|
22
|
+
* Returns a function that re-pings the client via ARE_YOU_THERE.
|
|
23
|
+
* Use this as the onClick for an "Enable Editor" / reconnect button.
|
|
24
|
+
*/
|
|
25
|
+
declare const useEditorPingClient: () => (() => void);
|
|
21
26
|
//#endregion
|
|
22
|
-
export { EditorEnabledStateProps, useEditorEnabled, useEditorEnabledState, useGetEditorEnabledState, usePostEditorEnabledState };
|
|
27
|
+
export { EditorEnabledStateProps, useEditorEnabled, useEditorEnabledState, useEditorPingClient, useGetEditorEnabledState, usePostEditorEnabledState };
|
|
23
28
|
//# sourceMappingURL=EditorEnabledContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorEnabledContext.d.ts","names":[],"sources":["../../src/EditorEnabledContext.tsx"],"mappings":";KAMY,uBAAA;EACV,OAAA;AAAA;;;;AAOF;cAAa,gBAAA,QAAuB,uBAAA;;;;
|
|
1
|
+
{"version":3,"file":"EditorEnabledContext.d.ts","names":[],"sources":["../../src/EditorEnabledContext.tsx"],"mappings":";KAMY,uBAAA;EACV,OAAA;AAAA;;;;AAOF;cAAa,gBAAA,QAAuB,uBAAA;;;;AAuBpC;;cAAa,wBAAA,GAA4B,SAAA;;;AAgBzC;cAAa,yBAAA,SAGH,KAAA;AAAA,cAMG,qBAAA,4BAAqB,KAAA;;;AAAlC;;cAYa,mBAAA"}
|
|
@@ -3,10 +3,9 @@ import { IntlayerConfig } from "@intlayer/types/config";
|
|
|
3
3
|
|
|
4
4
|
//#region src/EditorProvider.d.ts
|
|
5
5
|
type EditorProviderProps = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
allowedOrigins?: string[];
|
|
6
|
+
configuration: IntlayerConfig;
|
|
7
|
+
postMessage: (data: any) => void;
|
|
8
|
+
allowedOrigins: string[];
|
|
10
9
|
};
|
|
11
10
|
/**
|
|
12
11
|
* EditorProvider creates and manages the lifecycle of an EditorStateManager,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorProvider.d.ts","names":[],"sources":["../../src/EditorProvider.tsx"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"EditorProvider.d.ts","names":[],"sources":["../../src/EditorProvider.tsx"],"mappings":";;;;KAYY,mBAAA;EACV,aAAA,EAAe,cAAA;EACf,WAAA,GAAc,IAAA;EACd,cAAA;AAAA;;;;;cAOW,cAAA,EAAgB,EAAA,CAAG,iBAAA,CAAkB,mBAAA"}
|
|
@@ -5,7 +5,7 @@ import { FC, PropsWithChildren } from "react";
|
|
|
5
5
|
declare const EditorStateProvider: FC<PropsWithChildren<{
|
|
6
6
|
manager: EditorStateManager;
|
|
7
7
|
}>>;
|
|
8
|
-
declare const useEditorStateManager: () => EditorStateManager;
|
|
8
|
+
declare const useEditorStateManager: () => EditorStateManager | null;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { EditorStateProvider, useEditorStateManager };
|
|
11
11
|
//# sourceMappingURL=EditorStateContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FocusDictionaryContext.d.ts","names":[],"sources":["../../src/FocusDictionaryContext.tsx"],"mappings":";;;;KASY,oBAAA;EACV,cAAA,EAAgB,aAAA;AAAA;AAAA,KAGN,sBAAA;EACV,iBAAA,GAAoB,KAAA,EAAO,aAAA;EAC3B,wBAAA,GAA2B,OAAA,EAAS,OAAA;AAAA;;;;cAMzB,kBAAA,QAAyB,oBAAA,GACpC,sBAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"FocusDictionaryContext.d.ts","names":[],"sources":["../../src/FocusDictionaryContext.tsx"],"mappings":";;;;KASY,oBAAA;EACV,cAAA,EAAgB,aAAA;AAAA;AAAA,KAGN,sBAAA;EACV,iBAAA,GAAoB,KAAA,EAAO,aAAA;EAC3B,wBAAA,GAA2B,OAAA,EAAS,OAAA;AAAA;;;;cAMzB,kBAAA,QAAyB,oBAAA,GACpC,sBAAA;AAAA,cAuBW,yBAAA,QAAgC,sBAAA"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { MessengerConfig, UseCrossPlatformStateProps, useCommunicator } from "./CommunicatorContext.js";
|
|
2
|
-
import { ConfigurationProviderProps, useConfiguration, useConfigurationState } from "./ConfigurationContext.js";
|
|
3
|
-
import { DictionaryContent, useDictionariesRecord, useDictionariesRecordActions } from "./DictionariesRecordContext.js";
|
|
2
|
+
import { ConfigurationProvider, ConfigurationProviderProps, useConfiguration, useConfigurationState } from "./ConfigurationContext.js";
|
|
3
|
+
import { DictionaryContent as DictionaryContent$1, useDictionariesRecord, useDictionariesRecordActions } from "./DictionariesRecordContext.js";
|
|
4
4
|
import { useEditedContent, useEditedContentActions, useGetEditedContentState, usePostEditedContentState } from "./EditedContentContext.js";
|
|
5
|
-
import { EditorEnabledStateProps, useEditorEnabled, useEditorEnabledState, useGetEditorEnabledState, usePostEditorEnabledState } from "./EditorEnabledContext.js";
|
|
5
|
+
import { EditorEnabledStateProps, useEditorEnabled, useEditorEnabledState, useEditorPingClient, useGetEditorEnabledState, usePostEditorEnabledState } from "./EditorEnabledContext.js";
|
|
6
6
|
import { EditorProvider, EditorProviderProps } from "./EditorProvider.js";
|
|
7
7
|
import { EditorStateProvider, useEditorStateManager } from "./EditorStateContext.js";
|
|
8
8
|
import { FileContent, FocusDictionaryActions, FocusDictionaryState, useFocusDictionary, useFocusDictionaryActions } from "./FocusDictionaryContext.js";
|
|
@@ -12,5 +12,5 @@ import { useCrossURLPathSetter, useCrossURLPathState } from "./useCrossURLPathSt
|
|
|
12
12
|
import { useEditorLocale, useSetEditorLocale } from "./useEditorLocale.js";
|
|
13
13
|
import { useFocusUnmergedDictionary } from "./useFocusUnmergedDictionary.js";
|
|
14
14
|
import { useIframeClickInterceptor, useIframeClickMerger } from "./useIframeClickInterceptor.js";
|
|
15
|
-
|
|
16
|
-
export { ConfigurationProviderProps, CrossFrameStateOptions, EditorEnabledStateProps, EditorProvider, EditorProviderProps, EditorStateProvider, FileContent, FocusDictionaryActions, FocusDictionaryState, MessengerConfig, UseCrossPlatformStateProps, useCommunicator, useConfiguration, useConfigurationState, useCrossFrameMessageListener, useCrossFrameState, useCrossURLPathSetter, useCrossURLPathState, useDictionariesRecord, useDictionariesRecordActions, useEditedContent, useEditedContentActions, useEditorEnabled, useEditorEnabledState, useEditorLocale, useEditorStateManager, useFocusDictionary, useFocusDictionaryActions, useFocusUnmergedDictionary, useGetEditedContentState, useGetEditorEnabledState, useIframeClickInterceptor, useIframeClickMerger, usePostEditedContentState, usePostEditorEnabledState, useSetEditorLocale };
|
|
15
|
+
import { MessageKey } from "@intlayer/editor";
|
|
16
|
+
export { ConfigurationProvider, ConfigurationProviderProps, CrossFrameStateOptions, EditorEnabledStateProps, EditorProvider, EditorProviderProps, EditorStateProvider, FileContent, FocusDictionaryActions, FocusDictionaryState, MessageKey, MessengerConfig, UseCrossPlatformStateProps, useCommunicator, useConfiguration, useConfigurationState, useCrossFrameMessageListener, useCrossFrameState, useCrossURLPathSetter, useCrossURLPathState, useDictionariesRecord, useDictionariesRecordActions, useEditedContent, useEditedContentActions, useEditorEnabled, useEditorEnabledState, useEditorLocale, useEditorPingClient, useEditorStateManager, useFocusDictionary, useFocusDictionaryActions, useFocusUnmergedDictionary, useGetEditedContentState, useGetEditorEnabledState, useIframeClickInterceptor, useIframeClickMerger, usePostEditedContentState, usePostEditorEnabledState, useSetEditorLocale };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCrossFrameState.d.ts","names":[],"sources":["../../src/useCrossFrameState.tsx"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"useCrossFrameState.d.ts","names":[],"sources":["../../src/useCrossFrameState.tsx"],"mappings":";;;;KAaY,sBAAA;EACV,IAAA;EACA,OAAA;AAAA;;;;cAMW,kBAAA,MACX,GAAA,KAAQ,UAAA,IACR,YAAA,GAAe,CAAA,UAAW,CAAA,GAC1B,OAAA,GAAU,sBAAA,MACR,CAAA,EAAG,QAAA,CAAS,cAAA,CAAe,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEditorLocale.d.ts","names":[],"sources":["../../src/useEditorLocale.tsx"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"useEditorLocale.d.ts","names":[],"sources":["../../src/useEditorLocale.tsx"],"mappings":";;;cAMa,eAAA,QAAsB,MAAA;AAAA,cAkBtB,kBAAA,SAEH,MAAA,EAAQ,MAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/editor-react",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.4.0-canary.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Provides the states, contexts, hooks and components to interact with the Intlayer editor for a React application",
|
|
6
6
|
"keywords": [
|
|
@@ -70,11 +70,11 @@
|
|
|
70
70
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@intlayer/config": "8.
|
|
74
|
-
"@intlayer/core": "8.
|
|
75
|
-
"@intlayer/editor": "8.
|
|
76
|
-
"@intlayer/types": "8.
|
|
77
|
-
"@intlayer/unmerged-dictionaries-entry": "8.
|
|
73
|
+
"@intlayer/config": "8.4.0-canary.0",
|
|
74
|
+
"@intlayer/core": "8.4.0-canary.0",
|
|
75
|
+
"@intlayer/editor": "8.4.0-canary.0",
|
|
76
|
+
"@intlayer/types": "8.4.0-canary.0",
|
|
77
|
+
"@intlayer/unmerged-dictionaries-entry": "8.4.0-canary.0"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@types/node": "25.5.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));exports.__toESM=s;
|