@intlayer/editor-react 6.1.6-canary.0 → 7.0.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 +43 -65
- package/dist/cjs/CommunicatorContext.cjs.map +1 -1
- package/dist/cjs/ConfigurationContext.cjs +26 -47
- package/dist/cjs/ConfigurationContext.cjs.map +1 -1
- package/dist/cjs/DictionariesRecordContext.cjs +48 -74
- package/dist/cjs/DictionariesRecordContext.cjs.map +1 -1
- package/dist/cjs/EditedContentContext.cjs +164 -225
- package/dist/cjs/EditedContentContext.cjs.map +1 -1
- package/dist/cjs/EditorEnabledContext.cjs +34 -59
- package/dist/cjs/EditorEnabledContext.cjs.map +1 -1
- package/dist/cjs/EditorProvider.cjs +65 -66
- package/dist/cjs/EditorProvider.cjs.map +1 -1
- package/dist/cjs/FocusDictionaryContext.cjs +51 -75
- package/dist/cjs/FocusDictionaryContext.cjs.map +1 -1
- package/dist/cjs/_virtual/rolldown_runtime.cjs +25 -0
- package/dist/cjs/index.cjs +46 -44
- package/dist/cjs/useCrossFrameMessageListener.cjs +73 -50
- package/dist/cjs/useCrossFrameMessageListener.cjs.map +1 -1
- package/dist/cjs/useCrossFrameState.cjs +106 -73
- package/dist/cjs/useCrossFrameState.cjs.map +1 -1
- package/dist/cjs/useCrossURLPathState.cjs +67 -66
- package/dist/cjs/useCrossURLPathState.cjs.map +1 -1
- package/dist/cjs/useIframeClickInterceptor.cjs +24 -47
- package/dist/cjs/useIframeClickInterceptor.cjs.map +1 -1
- package/dist/esm/CommunicatorContext.mjs +34 -32
- package/dist/esm/CommunicatorContext.mjs.map +1 -1
- package/dist/esm/ConfigurationContext.mjs +19 -23
- package/dist/esm/ConfigurationContext.mjs.map +1 -1
- package/dist/esm/DictionariesRecordContext.mjs +37 -47
- package/dist/esm/DictionariesRecordContext.mjs.map +1 -1
- package/dist/esm/EditedContentContext.mjs +150 -201
- package/dist/esm/EditedContentContext.mjs.map +1 -1
- package/dist/esm/EditorEnabledContext.mjs +22 -32
- package/dist/esm/EditorEnabledContext.mjs.map +1 -1
- package/dist/esm/EditorProvider.mjs +60 -54
- package/dist/esm/EditorProvider.mjs.map +1 -1
- package/dist/esm/FocusDictionaryContext.mjs +41 -48
- package/dist/esm/FocusDictionaryContext.mjs.map +1 -1
- package/dist/esm/index.mjs +15 -13
- package/dist/esm/useCrossFrameMessageListener.mjs +69 -25
- package/dist/esm/useCrossFrameMessageListener.mjs.map +1 -1
- package/dist/esm/useCrossFrameState.mjs +102 -47
- package/dist/esm/useCrossFrameState.mjs.map +1 -1
- package/dist/esm/useCrossURLPathState.mjs +61 -41
- package/dist/esm/useCrossURLPathState.mjs.map +1 -1
- package/dist/esm/useIframeClickInterceptor.mjs +19 -21
- package/dist/esm/useIframeClickInterceptor.mjs.map +1 -1
- package/dist/types/CommunicatorContext.d.ts +12 -8
- package/dist/types/CommunicatorContext.d.ts.map +1 -1
- package/dist/types/ConfigurationContext.d.ts +12 -7
- package/dist/types/ConfigurationContext.d.ts.map +1 -1
- package/dist/types/DictionariesRecordContext.d.ts +15 -12
- package/dist/types/DictionariesRecordContext.d.ts.map +1 -1
- package/dist/types/EditedContentContext.d.ts +33 -30
- package/dist/types/EditedContentContext.d.ts.map +1 -1
- package/dist/types/EditorEnabledContext.d.ts +14 -9
- package/dist/types/EditorEnabledContext.d.ts.map +1 -1
- package/dist/types/EditorProvider.d.ts +10 -6
- package/dist/types/EditorProvider.d.ts.map +1 -1
- package/dist/types/FocusDictionaryContext.d.ts +18 -15
- package/dist/types/FocusDictionaryContext.d.ts.map +1 -1
- package/dist/types/index.d.ts +13 -13
- package/dist/types/useCrossFrameMessageListener.d.ts +7 -2
- package/dist/types/useCrossFrameMessageListener.d.ts.map +1 -1
- package/dist/types/useCrossFrameState.d.ts +10 -6
- package/dist/types/useCrossFrameState.d.ts.map +1 -1
- package/dist/types/useCrossURLPathState.d.ts +8 -3
- package/dist/types/useCrossURLPathState.d.ts.map +1 -1
- package/dist/types/useIframeClickInterceptor.d.ts +5 -2
- package/dist/types/useIframeClickInterceptor.d.ts.map +1 -1
- package/package.json +34 -40
- package/LICENSE +0 -202
- package/dist/cjs/index.cjs.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
|
@@ -1,46 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { useCrossFrameState } from "./useCrossFrameState.mjs";
|
|
3
5
|
import { useEffect } from "react";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
import { MessageKey } from "@intlayer/editor";
|
|
7
|
+
|
|
8
|
+
//#region src/useCrossURLPathState.tsx
|
|
7
9
|
const useCrossURLPathState = (initialState, options) => useCrossFrameState(MessageKey.INTLAYER_URL_CHANGE, initialState, options);
|
|
8
10
|
const useCrossURLPathSetter = (initialState) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
11
|
+
const states = useCrossURLPathState(initialState, {
|
|
12
|
+
emit: true,
|
|
13
|
+
receive: false
|
|
14
|
+
});
|
|
15
|
+
const [_state, setState] = states;
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
/**
|
|
18
|
+
* 1) Monkey patch history methods (pushState, replaceState)
|
|
19
|
+
* to dispatch a custom event whenever they are called.
|
|
20
|
+
*/
|
|
21
|
+
const originalPushState = history.pushState;
|
|
22
|
+
const originalReplaceState = history.replaceState;
|
|
23
|
+
const injectLocationChangeEvent = (method) => function(...args) {
|
|
24
|
+
method.apply(this, args);
|
|
25
|
+
window.dispatchEvent(new Event("locationchange"));
|
|
26
|
+
};
|
|
27
|
+
history.pushState = injectLocationChangeEvent(originalPushState);
|
|
28
|
+
history.replaceState = injectLocationChangeEvent(originalReplaceState);
|
|
29
|
+
/**
|
|
30
|
+
* 2) The callback to update our state whenever the URL changes.
|
|
31
|
+
*/
|
|
32
|
+
const updateURLState = () => {
|
|
33
|
+
setState(window.location.pathname);
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* 3) Attach event listeners for locationchange, popstate, hashchange.
|
|
37
|
+
* - 'locationchange' is our custom event triggered by push/replaceState overrides.
|
|
38
|
+
* - 'popstate' is fired on back/forward navigation.
|
|
39
|
+
* - 'hashchange' is for URL hash (#) changes.
|
|
40
|
+
* - 'load' is when new page is loaded
|
|
41
|
+
*/
|
|
42
|
+
window.addEventListener("locationchange", updateURLState);
|
|
43
|
+
window.addEventListener("popstate", updateURLState);
|
|
44
|
+
window.addEventListener("hashchange", updateURLState);
|
|
45
|
+
window.addEventListener("load", updateURLState);
|
|
46
|
+
updateURLState();
|
|
47
|
+
/**
|
|
48
|
+
* 4) Cleanup when the component unmounts:
|
|
49
|
+
* - Remove event listeners.
|
|
50
|
+
* - Restore original pushState & replaceState to avoid side effects.
|
|
51
|
+
*/
|
|
52
|
+
return () => {
|
|
53
|
+
window.removeEventListener("locationchange", updateURLState);
|
|
54
|
+
window.removeEventListener("popstate", updateURLState);
|
|
55
|
+
window.removeEventListener("hashchange", updateURLState);
|
|
56
|
+
window.removeEventListener("load", updateURLState);
|
|
57
|
+
history.pushState = originalPushState;
|
|
58
|
+
history.replaceState = originalReplaceState;
|
|
59
|
+
};
|
|
60
|
+
}, []);
|
|
61
|
+
return states;
|
|
45
62
|
};
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
export { useCrossURLPathSetter, useCrossURLPathState };
|
|
46
66
|
//# sourceMappingURL=useCrossURLPathState.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/useCrossURLPathState.tsx"],"sourcesContent":["'use client';\n\nimport { MessageKey } from '@intlayer/editor';\nimport { useEffect } from 'react';\nimport {\n
|
|
1
|
+
{"version":3,"file":"useCrossURLPathState.mjs","names":[],"sources":["../../src/useCrossURLPathState.tsx"],"sourcesContent":["'use client';\n\nimport { MessageKey } from '@intlayer/editor';\nimport { useEffect } from 'react';\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 const states = useCrossURLPathState(initialState, {\n emit: true,\n receive: false,\n });\n const [_state, setState] = states;\n\n useEffect(() => {\n /**\n * 1) Monkey patch history methods (pushState, replaceState)\n * to dispatch a custom event whenever they are called.\n */\n const originalPushState = history.pushState;\n const originalReplaceState = history.replaceState;\n\n const injectLocationChangeEvent = (method: (...args: any[]) => void) =>\n function (this: typeof history, ...args: [any, string, string?]) {\n method.apply(this, args);\n window.dispatchEvent(new Event('locationchange'));\n };\n\n history.pushState = injectLocationChangeEvent(originalPushState);\n history.replaceState = injectLocationChangeEvent(originalReplaceState);\n\n /**\n * 2) The callback to update our state whenever the URL changes.\n */\n const updateURLState = () => {\n setState(window.location.pathname);\n };\n\n /**\n * 3) Attach event listeners for locationchange, popstate, hashchange.\n * - 'locationchange' is our custom event triggered by push/replaceState overrides.\n * - 'popstate' is fired on back/forward navigation.\n * - 'hashchange' is for URL hash (#) changes.\n * - 'load' is when new page is loaded\n */\n window.addEventListener('locationchange', updateURLState);\n window.addEventListener('popstate', updateURLState);\n window.addEventListener('hashchange', updateURLState);\n window.addEventListener('load', updateURLState);\n\n // Initialize our state immediately on mount\n updateURLState();\n\n /**\n * 4) Cleanup when the component unmounts:\n * - Remove event listeners.\n * - Restore original pushState & replaceState to avoid side effects.\n */\n return () => {\n window.removeEventListener('locationchange', updateURLState);\n window.removeEventListener('popstate', updateURLState);\n window.removeEventListener('hashchange', updateURLState);\n window.removeEventListener('load', updateURLState);\n history.pushState = originalPushState;\n history.replaceState = originalReplaceState;\n };\n }, []);\n\n return states;\n};\n"],"mappings":";;;;;;;;AASA,MAAa,wBACX,cACA,YACG,mBAAmB,WAAW,qBAAqB,cAAc,QAAQ;AAE9E,MAAa,yBAAyB,iBAA0B;CAC9D,MAAM,SAAS,qBAAqB,cAAc;EAChD,MAAM;EACN,SAAS;EACV,CAAC;CACF,MAAM,CAAC,QAAQ,YAAY;AAE3B,iBAAgB;;;;;EAKd,MAAM,oBAAoB,QAAQ;EAClC,MAAM,uBAAuB,QAAQ;EAErC,MAAM,6BAA6B,WACjC,SAAgC,GAAG,MAA8B;AAC/D,UAAO,MAAM,MAAM,KAAK;AACxB,UAAO,cAAc,IAAI,MAAM,iBAAiB,CAAC;;AAGrD,UAAQ,YAAY,0BAA0B,kBAAkB;AAChE,UAAQ,eAAe,0BAA0B,qBAAqB;;;;EAKtE,MAAM,uBAAuB;AAC3B,YAAS,OAAO,SAAS,SAAS;;;;;;;;;AAUpC,SAAO,iBAAiB,kBAAkB,eAAe;AACzD,SAAO,iBAAiB,YAAY,eAAe;AACnD,SAAO,iBAAiB,cAAc,eAAe;AACrD,SAAO,iBAAiB,QAAQ,eAAe;AAG/C,kBAAgB;;;;;;AAOhB,eAAa;AACX,UAAO,oBAAoB,kBAAkB,eAAe;AAC5D,UAAO,oBAAoB,YAAY,eAAe;AACtD,UAAO,oBAAoB,cAAc,eAAe;AACxD,UAAO,oBAAoB,QAAQ,eAAe;AAClD,WAAQ,YAAY;AACpB,WAAQ,eAAe;;IAExB,EAAE,CAAC;AAEN,QAAO"}
|
|
@@ -1,25 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
4
|
import { useCrossFrameMessageListener } from "./useCrossFrameMessageListener.mjs";
|
|
5
|
+
import { useEffect } from "react";
|
|
6
|
+
import { MessageKey, mergeIframeClick } from "@intlayer/editor";
|
|
7
|
+
|
|
8
|
+
//#region src/useIframeClickInterceptor.tsx
|
|
5
9
|
const useIframeClickInterceptor = () => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return () => window.removeEventListener("mousedown", handlePostMessageEvent);
|
|
15
|
-
}, [postMessage]);
|
|
16
|
-
};
|
|
17
|
-
const useIframeClickMerger = () => useCrossFrameMessageListener(
|
|
18
|
-
MessageKey.INTLAYER_IFRAME_CLICKED,
|
|
19
|
-
mergeIframeClick
|
|
20
|
-
);
|
|
21
|
-
export {
|
|
22
|
-
useIframeClickInterceptor,
|
|
23
|
-
useIframeClickMerger
|
|
10
|
+
const postMessage = useCrossFrameMessageListener(MessageKey.INTLAYER_IFRAME_CLICKED);
|
|
11
|
+
const handlePostMessageEvent = () => {
|
|
12
|
+
postMessage();
|
|
13
|
+
};
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
window.addEventListener("mousedown", handlePostMessageEvent);
|
|
16
|
+
return () => window.removeEventListener("mousedown", handlePostMessageEvent);
|
|
17
|
+
}, [postMessage]);
|
|
24
18
|
};
|
|
19
|
+
const useIframeClickMerger = () => useCrossFrameMessageListener(MessageKey.INTLAYER_IFRAME_CLICKED, mergeIframeClick);
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { useIframeClickInterceptor, useIframeClickMerger };
|
|
25
23
|
//# sourceMappingURL=useIframeClickInterceptor.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/useIframeClickInterceptor.tsx"],"sourcesContent":["'use client';\n\nimport { MessageKey, mergeIframeClick } from '@intlayer/editor';\nimport { useEffect } from 'react';\nimport { useCrossFrameMessageListener } from './useCrossFrameMessageListener';\n\nexport const useIframeClickInterceptor = () => {\n const postMessage = useCrossFrameMessageListener<undefined>(\n MessageKey.INTLAYER_IFRAME_CLICKED\n );\n const handlePostMessageEvent: EventListener = () => {\n postMessage();\n };\n\n useEffect(() => {\n window.addEventListener('mousedown', handlePostMessageEvent);\n\n return () =>\n window.removeEventListener('mousedown', handlePostMessageEvent);\n }, [postMessage]);\n};\n\nexport const useIframeClickMerger = () =>\n useCrossFrameMessageListener<MessageEvent>(\n MessageKey.INTLAYER_IFRAME_CLICKED,\n mergeIframeClick\n );\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useIframeClickInterceptor.mjs","names":["handlePostMessageEvent: EventListener"],"sources":["../../src/useIframeClickInterceptor.tsx"],"sourcesContent":["'use client';\n\nimport { MessageKey, mergeIframeClick } from '@intlayer/editor';\nimport { useEffect } from 'react';\nimport { useCrossFrameMessageListener } from './useCrossFrameMessageListener';\n\nexport const useIframeClickInterceptor = () => {\n const postMessage = useCrossFrameMessageListener<undefined>(\n MessageKey.INTLAYER_IFRAME_CLICKED\n );\n const handlePostMessageEvent: EventListener = () => {\n postMessage();\n };\n\n useEffect(() => {\n window.addEventListener('mousedown', handlePostMessageEvent);\n\n return () =>\n window.removeEventListener('mousedown', handlePostMessageEvent);\n }, [postMessage]);\n};\n\nexport const useIframeClickMerger = () =>\n useCrossFrameMessageListener<MessageEvent>(\n MessageKey.INTLAYER_IFRAME_CLICKED,\n mergeIframeClick\n );\n"],"mappings":";;;;;;;;AAMA,MAAa,kCAAkC;CAC7C,MAAM,cAAc,6BAClB,WAAW,wBACZ;CACD,MAAMA,+BAA8C;AAClD,eAAa;;AAGf,iBAAgB;AACd,SAAO,iBAAiB,aAAa,uBAAuB;AAE5D,eACE,OAAO,oBAAoB,aAAa,uBAAuB;IAChE,CAAC,YAAY,CAAC;;AAGnB,MAAa,6BACX,6BACE,WAAW,yBACX,iBACD"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { FC, PropsWithChildren } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/CommunicatorContext.d.ts
|
|
4
|
+
type UseCrossPlatformStateProps = {
|
|
5
|
+
postMessage: typeof window.postMessage;
|
|
6
|
+
allowedOrigins?: string[];
|
|
7
|
+
senderId: string;
|
|
6
8
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
type CommunicatorProviderProps = PropsWithChildren<Omit<UseCrossPlatformStateProps, 'senderId'>>;
|
|
10
|
+
declare const CommunicatorProvider: FC<CommunicatorProviderProps>;
|
|
11
|
+
declare const useCommunicator: () => UseCrossPlatformStateProps;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { CommunicatorProvider, CommunicatorProviderProps, UseCrossPlatformStateProps, useCommunicator };
|
|
10
14
|
//# sourceMappingURL=CommunicatorContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommunicatorContext.d.ts","
|
|
1
|
+
{"version":3,"file":"CommunicatorContext.d.ts","names":[],"sources":["../../src/CommunicatorContext.tsx"],"sourcesContent":[],"mappings":";;;KAaY,0BAAA;sBACU,MAAA,CAAO;EADjB,cAAA,CAAA,EAAA,MAAA,EAAA;EAkBA,QAAA,EAAA,MAAA;CACL;AAAL,KADU,yBAAA,GAA4B,iBACtC,CAAA,IAAA,CAAK,0BAAL,EAAA,UAAA,CAAA,CAAA;AADsC,cAI3B,oBAJ2B,EAIL,EAJK,CAIF,yBAJE,CAAA;AAAiB,cAwB5C,eAxB4C,EAAA,GAAA,GAwB7B,0BAxB6B"}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import * as react0 from "react";
|
|
2
|
+
import { FC, PropsWithChildren } from "react";
|
|
3
|
+
import { IntlayerConfig } from "@intlayer/types";
|
|
4
|
+
|
|
5
|
+
//#region src/ConfigurationContext.d.ts
|
|
6
|
+
declare const useConfigurationState: () => [IntlayerConfig, react0.Dispatch<react0.SetStateAction<IntlayerConfig>>, () => void];
|
|
7
|
+
type ConfigurationProviderProps = {
|
|
8
|
+
configuration?: IntlayerConfig;
|
|
6
9
|
};
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
declare const ConfigurationProvider: FC<PropsWithChildren<ConfigurationProviderProps>>;
|
|
11
|
+
declare const useConfiguration: () => IntlayerConfig;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { ConfigurationProvider, ConfigurationProviderProps, useConfiguration, useConfigurationState };
|
|
9
14
|
//# sourceMappingURL=ConfigurationContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigurationContext.d.ts","
|
|
1
|
+
{"version":3,"file":"ConfigurationContext.d.ts","names":[],"sources":["../../src/ConfigurationContext.tsx"],"sourcesContent":[],"mappings":";;;;;cAgBa,8BAAqB,gBAAA,MAAA,CAAA,SAAA,MAAA,CAAA,eAAA;KAUtB,0BAAA;kBACM;AAXlB,CAAA;AAAkC,cAcrB,qBAdqB,EAcE,EAdF,CAehC,iBAfgC,CAed,0BAfc,CAAA,CAAA;AAAA,cAsBrB,gBAtBqB,EAAA,GAAA,GAsBL,cAtBK"}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { Dispatch, FC, PropsWithChildren, SetStateAction } from "react";
|
|
2
|
+
import { Dictionary, LocalDictionaryId } from "@intlayer/types";
|
|
3
|
+
|
|
4
|
+
//#region src/DictionariesRecordContext.d.ts
|
|
5
|
+
type DictionaryContent = Record<LocalDictionaryId, Dictionary>;
|
|
4
6
|
type DictionariesRecordActionsContextType = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
setLocaleDictionaries: Dispatch<SetStateAction<DictionaryContent>>;
|
|
8
|
+
setLocaleDictionary: (dictionary: Dictionary) => void;
|
|
7
9
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
declare const DictionariesRecordProvider: FC<PropsWithChildren>;
|
|
11
|
+
declare const useDictionariesRecordActions: () => DictionariesRecordActionsContextType;
|
|
12
|
+
declare const useDictionariesRecord: () => {
|
|
13
|
+
setLocaleDictionaries: Dispatch<SetStateAction<DictionaryContent>>;
|
|
14
|
+
setLocaleDictionary: (dictionary: Dictionary) => void;
|
|
15
|
+
localeDictionaries: DictionaryContent;
|
|
14
16
|
};
|
|
15
|
-
|
|
17
|
+
//#endregion
|
|
18
|
+
export { DictionariesRecordProvider, DictionaryContent, useDictionariesRecord, useDictionariesRecordActions };
|
|
16
19
|
//# sourceMappingURL=DictionariesRecordContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionariesRecordContext.d.ts","
|
|
1
|
+
{"version":3,"file":"DictionariesRecordContext.d.ts","names":[],"sources":["../../src/DictionariesRecordContext.tsx"],"sourcesContent":[],"mappings":";;;;KAeY,iBAAA,GAAoB,OAAO,mBAAmB;KAKrD,oCAAA;EALO,qBAAiB,EAMJ,QANI,CAMK,cANL,CAMoB,iBANpB,CAAA,CAAA;EAAU,mBAAA,EAAA,CAAA,UAAA,EAOH,UAPG,EAAA,GAAA,IAAA;CAAmB;AAA1B,cAiBnB,0BAjBmB,EAiBS,EAjBT,CAiBY,iBAjBZ,CAAA;AAAM,cAyDzB,4BAzDyB,EAAA,GAAA,GAyDG,oCAzDH;AAKjC,cAuDQ,qBAvDR,EAAoC,GAAA,GAAA;EACQ,qBAAA,EAAxB,QAAwB,CAAf,cAAe,CAAA,iBAAA,CAAA,CAAA;EAAf,mBAAA,EAAA,CAAA,UAAA,EACE,UADF,EAAA,GAAA,IAAA;EAAT,kBAAA,EAHH,iBAGG;CACW"}
|
|
@@ -1,34 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { DictionaryContent } from "./DictionariesRecordContext.js";
|
|
2
|
+
import { Dispatch, FC, PropsWithChildren, SetStateAction } from "react";
|
|
3
|
+
import { ContentNode, Dictionary, KeyPath, LocalDictionaryId } from "@intlayer/types";
|
|
4
|
+
|
|
5
|
+
//#region src/EditedContentContext.d.ts
|
|
6
|
+
declare const usePostEditedContentState: <S>(onEventTriggered?: (data: S) => void) => (data?: S) => void;
|
|
7
|
+
declare const useGetEditedContentState: <S>(onEventTriggered?: (data: S) => void) => (data?: S) => void;
|
|
6
8
|
type EditedContentActionsContextType = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
setEditedContentState: (editedContent: DictionaryContent) => void;
|
|
10
|
+
setEditedDictionary: Dispatch<SetStateAction<Dictionary>>;
|
|
11
|
+
setEditedContent: (localDictionaryId: LocalDictionaryId, newValue: Dictionary['content']) => void;
|
|
12
|
+
addEditedContent: (localDictionaryId: LocalDictionaryId, newValue: ContentNode<any>, keyPath?: KeyPath[], overwrite?: boolean) => void;
|
|
13
|
+
renameEditedContent: (localDictionaryId: LocalDictionaryId, newKey: KeyPath['key'], keyPath?: KeyPath[]) => void;
|
|
14
|
+
removeEditedContent: (localDictionaryId: LocalDictionaryId, keyPath: KeyPath[]) => void;
|
|
15
|
+
restoreEditedContent: (localDictionaryId: LocalDictionaryId) => void;
|
|
16
|
+
clearEditedDictionaryContent: (localDictionaryId: LocalDictionaryId) => void;
|
|
17
|
+
clearEditedContent: () => void;
|
|
18
|
+
getEditedContentValue: (localDictionaryIdOrKey: LocalDictionaryId | Dictionary['key'] | string, keyPath: KeyPath[]) => ContentNode | undefined;
|
|
17
19
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
declare const EditedContentProvider: FC<PropsWithChildren>;
|
|
21
|
+
declare const useEditedContentActions: () => EditedContentActionsContextType;
|
|
22
|
+
declare const useEditedContent: () => {
|
|
23
|
+
setEditedContentState: (editedContent: DictionaryContent) => void;
|
|
24
|
+
setEditedDictionary: Dispatch<SetStateAction<Dictionary>>;
|
|
25
|
+
setEditedContent: (localDictionaryId: LocalDictionaryId, newValue: Dictionary["content"]) => void;
|
|
26
|
+
addEditedContent: (localDictionaryId: LocalDictionaryId, newValue: ContentNode<any>, keyPath?: KeyPath[], overwrite?: boolean) => void;
|
|
27
|
+
renameEditedContent: (localDictionaryId: LocalDictionaryId, newKey: KeyPath["key"], keyPath?: KeyPath[]) => void;
|
|
28
|
+
removeEditedContent: (localDictionaryId: LocalDictionaryId, keyPath: KeyPath[]) => void;
|
|
29
|
+
restoreEditedContent: (localDictionaryId: LocalDictionaryId) => void;
|
|
30
|
+
clearEditedDictionaryContent: (localDictionaryId: LocalDictionaryId) => void;
|
|
31
|
+
clearEditedContent: () => void;
|
|
32
|
+
getEditedContentValue: (localDictionaryIdOrKey: LocalDictionaryId | Dictionary["key"] | string, keyPath: KeyPath[]) => ContentNode | undefined;
|
|
33
|
+
editedContent: Record<LocalDictionaryId, Dictionary> | undefined;
|
|
32
34
|
};
|
|
33
|
-
|
|
35
|
+
//#endregion
|
|
36
|
+
export { EditedContentProvider, useEditedContent, useEditedContentActions, useGetEditedContentState, usePostEditedContentState };
|
|
34
37
|
//# sourceMappingURL=EditedContentContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditedContentContext.d.ts","
|
|
1
|
+
{"version":3,"file":"EditedContentContext.d.ts","names":[],"sources":["../../src/EditedContentContext.tsx"],"sourcesContent":[],"mappings":";;;;;cAqCa,yDACe,uBAAU;cAOzB,wDACe,uBAAU;AATtC,KAgBK,+BAAA,GAVF;EAEU,qBAAA,EAAA,CAAA,aAMV,EAGsC,iBARH,EAAA,GAAA,IAAA;EAOjC,mBAAA,EAEkB,QAFlB,CAE2B,cAFI,CAEW,UAFX,CAAA,CAAA;EACK,gBAAA,EAAA,CAAA,iBAAA,EAGlB,iBAHkB,EAAA,QAAA,EAI3B,UAJ2B,CAAA,SAAA,CAAA,EAAA,GAAA,IAAA;EACM,gBAAA,EAAA,CAAA,iBAAA,EAMxB,iBANwB,EAAA,QAAA,EAOjC,WAPiC,CAAA,GAAA,CAAA,EAAA,OAAA,CAAA,EAQjC,OARiC,EAAA,EAAA,SAAA,CAAA,EAAA,OAAA,EAAA,GAAA,IAAA;EAAf,mBAAA,EAAA,CAAA,iBAAA,EAYT,iBAZS,EAAA,MAAA,EAapB,OAboB,CAAA,KAAA,CAAA,EAAA,OAAA,CAAA,EAclB,OAdkB,EAAA,EAAA,GAAA,IAAA;EAAT,mBAAA,EAAA,CAAA,iBAAA,EAiBA,iBAjBA,EAAA,OAAA,EAkBV,OAlBU,EAAA,EAAA,GAAA,IAAA;EAEA,oBAAA,EAAA,CAAA,iBAAA,EAkBqB,iBAlBrB,EAAA,GAAA,IAAA;EACT,4BAAA,EAAA,CAAA,iBAAA,EAkBsC,iBAlBtC,EAAA,GAAA,IAAA;EAGS,kBAAA,EAAA,GAAA,GAAA,IAAA;EACT,qBAAA,EAAA,CAAA,sBAAA,EAiBc,iBAjBd,GAiBkC,UAjBlC,CAAA,KAAA,CAAA,GAAA,MAAA,EAAA,OAAA,EAkBD,OAlBC,EAAA,EAAA,GAmBP,WAnBO,GAAA,SAAA;CACA;AAIS,cA0BV,qBA1BU,EA0Ba,EA1Bb,CA0BgB,iBA1BhB,CAAA;AACX,cA8QC,uBA9QD,EAAA,GAAA,GA8QwB,+BA9QxB;AACE,cAgRD,gBAhRC,EAAA,GAAA,GAAA;EAGS,qBAAA,EAAA,CAAA,aAAA,EAlBkB,iBAkBlB,EAAA,GAAA,IAAA;EACV,mBAAA,EAlBU,QAkBV,CAlBmB,cAkBnB,CAlBkC,UAkBlC,CAAA,CAAA;EAE+B,gBAAA,EAAA,CAAA,iBAAA,EAlBrB,iBAkBqB,EAAA,QAAA,EAjB9B,UAiB8B,CAAA,SAAA,CAAA,EAAA,GAAA,IAAA;EACQ,gBAAA,EAAA,CAAA,iBAAA,EAf7B,iBAe6B,EAAA,QAAA,EAdtC,WAcsC,CAAA,GAAA,CAAA,EAAA,OAAA,CAAA,EAbtC,OAasC,EAAA,EAAA,SAAA,CAAA,EAAA,OAAA,EAAA,GAAA,IAAA;EAGxB,mBAAA,EAAA,CAAA,iBAAA,EAZL,iBAYK,EAAA,MAAA,EAXhB,OAWgB,CAAA,KAAA,CAAA,EAAA,OAAA,CAAA,EAVd,OAUc,EAAA,EAAA,GAAA,IAAA;EAAoB,mBAAA,EAAA,CAAA,iBAAA,EAPzB,iBAOyB,EAAA,OAAA,EANnC,OAMmC,EAAA,EAAA,GAAA,IAAA;EACnC,oBAAA,EAAA,CAAA,iBAAA,EAL+B,iBAK/B,EAAA,GAAA,IAAA;EACN,4BAAA,EAAA,CAAA,iBAAA,EAL6C,iBAK7C,EAAA,GAAA,IAAA;EAAW,kBAAA,EAAA,GAAA,GAAA,IAAA;EAYL,qBAAA,EAAA,CAmPZ,sBAnPsC,EAdX,iBAcU,GAdU,UAcV,CAAA,KAAA,CAAA,GAAA,MAAA,EAAA,OAAA,EAbzB,OAayB,EAAA,EAAA,GAZ/B,WAY+B,GAAA,SAAA;EAqPzB,aAAA,EApTI,MAoTJ,CApTW,iBAoTY,EApTO,UAoTP,CAAA,GAAA,SAAA;AAGpC,CAAA"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { CrossFrameStateOptions } from "./useCrossFrameState.js";
|
|
2
|
+
import * as react1 from "react";
|
|
3
|
+
import { FC, PropsWithChildren } from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/EditorEnabledContext.d.ts
|
|
6
|
+
type EditorEnabledStateProps = {
|
|
7
|
+
enabled: boolean;
|
|
5
8
|
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
declare const useEditorEnabledState: (options?: CrossFrameStateOptions) => [boolean, react1.Dispatch<react1.SetStateAction<boolean>>, () => void];
|
|
10
|
+
declare const usePostEditorEnabledState: <S>(onEventTriggered?: (data: S) => void) => (data?: S) => void;
|
|
11
|
+
declare const useGetEditorEnabledState: <S>(onEventTriggered?: (data: S) => void) => (data?: S) => void;
|
|
12
|
+
declare const EditorEnabledProvider: FC<PropsWithChildren>;
|
|
13
|
+
declare const useEditorEnabled: () => EditorEnabledStateProps;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { EditorEnabledProvider, EditorEnabledStateProps, useEditorEnabled, useEditorEnabledState, useGetEditorEnabledState, usePostEditorEnabledState };
|
|
11
16
|
//# sourceMappingURL=EditorEnabledContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorEnabledContext.d.ts","
|
|
1
|
+
{"version":3,"file":"EditorEnabledContext.d.ts","names":[],"sources":["../../src/EditorEnabledContext.tsx"],"sourcesContent":[],"mappings":";;;;;KAeY,uBAAA;;;AAAA,cAQC,qBARsB,EAAA,CAAA,OAAA,CAAA,EAQa,sBARb,EAAA,GAAA,CAAA,OAAA,EAQmC,MAAA,CAAA,QARnC,CAQmC,MAAA,CAAA,cARnC,CAAA,OAAA,CAAA,CAAA,EAAA,GAAA,GAAA,IAAA,CAAA;AAQtB,cAGA,yBAF2D,EAAA,CAAA,CAAA,CAAA,CAAA,gBAAA,CAAA,EAAA,CAAA,IAAA,EAG5C,CAH4C,EAAA,GAAA,IAAA,EAAA,GAAA,CAAA,IAAA,CAAA,EAGlC,CAHkC,EAAA,GAAA,IAAA;AADxB,cAWnC,wBAXmC,EAAA,CAAA,CAAA,CAAA,CAAA,gBAAA,CAAA,EAAA,CAAA,IAAA,EAYpB,CAZoB,EAAA,GAAA,IAAA,EAAA,GAAA,CAAA,IAAA,CAAA,EAYV,CAZU,EAAA,GAAA,IAAA;AAAsB,cAmBzD,qBAnByD,EAmBlC,EAnBkC,CAmB/B,iBAnB+B,CAAA;AAAA,cAgCzD,gBAhCyD,EAAA,GAAA,GAgCzC,uBAhCyC"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { CommunicatorProviderProps } from "./CommunicatorContext.js";
|
|
2
|
+
import { ConfigurationProviderProps } from "./ConfigurationContext.js";
|
|
3
|
+
import { FC, PropsWithChildren } from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/EditorProvider.d.ts
|
|
6
|
+
type EditorProviderProps = CommunicatorProviderProps & ConfigurationProviderProps & {
|
|
7
|
+
mode: 'editor' | 'client';
|
|
6
8
|
};
|
|
7
|
-
|
|
9
|
+
declare const EditorProvider: FC<PropsWithChildren<EditorProviderProps>>;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { EditorProvider, EditorProviderProps };
|
|
8
12
|
//# sourceMappingURL=EditorProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorProvider.d.ts","
|
|
1
|
+
{"version":3,"file":"EditorProvider.d.ts","names":[],"sources":["../../src/EditorProvider.tsx"],"sourcesContent":[],"mappings":";;;;;KA2FY,mBAAA,GAAsB,4BAChC;;AADF,CAAA;AAKa,cAAA,cAsBZ,EAtB4B,EAsB5B,CAtB+B,iBAsB/B,CAtBiD,mBAsBjD,CAAA,CAAA"}
|
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { Dispatch, FC, PropsWithChildren, SetStateAction } from "react";
|
|
2
|
+
import { KeyPath } from "@intlayer/types";
|
|
3
|
+
|
|
4
|
+
//#region src/FocusDictionaryContext.d.ts
|
|
5
|
+
type FileContent = {
|
|
6
|
+
dictionaryKey: string;
|
|
7
|
+
dictionaryLocalId?: string;
|
|
8
|
+
keyPath?: KeyPath[];
|
|
7
9
|
};
|
|
8
10
|
type FocusDictionaryActions = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
setFocusedContent: Dispatch<SetStateAction<FileContent | null>>;
|
|
12
|
+
setFocusedContentKeyPath: (keyPath: KeyPath[]) => void;
|
|
11
13
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
declare const FocusDictionaryProvider: FC<PropsWithChildren>;
|
|
15
|
+
declare const useFocusDictionaryActions: () => FocusDictionaryActions;
|
|
16
|
+
declare const useFocusDictionary: () => {
|
|
17
|
+
setFocusedContent: Dispatch<SetStateAction<FileContent | null>>;
|
|
18
|
+
setFocusedContentKeyPath: (keyPath: KeyPath[]) => void;
|
|
19
|
+
focusedContent: FileContent | null;
|
|
18
20
|
};
|
|
19
|
-
|
|
21
|
+
//#endregion
|
|
22
|
+
export { FileContent, FocusDictionaryProvider, useFocusDictionary, useFocusDictionaryActions };
|
|
20
23
|
//# sourceMappingURL=FocusDictionaryContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FocusDictionaryContext.d.ts","
|
|
1
|
+
{"version":3,"file":"FocusDictionaryContext.d.ts","names":[],"sources":["../../src/FocusDictionaryContext.tsx"],"sourcesContent":[],"mappings":";;;;KAcY,WAAA;;EAAA,iBAAW,CAAA,EAAA,MAGX;EAOP,OAAA,CAAA,EAPO,OAOP,EAAA;CACwC;KADxC,sBAAA,GACyB;EAAT,iBAAA,EAAA,QAAA,CAAS,cAAT,CAAwB,WAAxB,GAAA,IAAA,CAAA,CAAA;EACiB,wBAAA,EAAA,CAAA,OAAA,EAAA,OAAA,EAAA,EAAA,GAAA,IAAA;CAAO;AAUhC,cAAA,uBAA4B,EAAH,EAAG,CAAA,iBAAD,CAAA;AA6B3B,cAAA,yBAAyB,EAAA,GAAA,GAAA,sBAQrC;AAEY,cAAA,kBAWZ,EAAA,GAAA,GAAA;EA7D4C,iBAAA,EAAxB,QAAwB,CAAf,cAAe,CAAA,WAAA,GAAA,IAAA,CAAA,CAAA;EAAf,wBAAA,EAAA,CAAA,OAAA,EACQ,OADR,EAAA,EAAA,GAAA,IAAA;EAAT,cAAA,EAJH,WAIG,GAAA,IAAA;CACiB"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export * from
|
|
13
|
-
|
|
1
|
+
import { CommunicatorProvider, CommunicatorProviderProps, UseCrossPlatformStateProps, useCommunicator } from "./CommunicatorContext.js";
|
|
2
|
+
import { ConfigurationProvider, ConfigurationProviderProps, useConfiguration, useConfigurationState } from "./ConfigurationContext.js";
|
|
3
|
+
import { DictionariesRecordProvider, DictionaryContent, useDictionariesRecord, useDictionariesRecordActions } from "./DictionariesRecordContext.js";
|
|
4
|
+
import { EditedContentProvider, useEditedContent, useEditedContentActions, useGetEditedContentState, usePostEditedContentState } from "./EditedContentContext.js";
|
|
5
|
+
import { CrossFrameStateOptions, useCrossFrameState } from "./useCrossFrameState.js";
|
|
6
|
+
import { EditorEnabledProvider, EditorEnabledStateProps, useEditorEnabled, useEditorEnabledState, useGetEditorEnabledState, usePostEditorEnabledState } from "./EditorEnabledContext.js";
|
|
7
|
+
import { EditorProvider, EditorProviderProps } from "./EditorProvider.js";
|
|
8
|
+
import { FileContent, FocusDictionaryProvider, useFocusDictionary, useFocusDictionaryActions } from "./FocusDictionaryContext.js";
|
|
9
|
+
import { useCrossFrameMessageListener } from "./useCrossFrameMessageListener.js";
|
|
10
|
+
import { useCrossURLPathSetter, useCrossURLPathState } from "./useCrossURLPathState.js";
|
|
11
|
+
import { useIframeClickInterceptor, useIframeClickMerger } from "./useIframeClickInterceptor.js";
|
|
12
|
+
export * from "@intlayer/editor";
|
|
13
|
+
export { CommunicatorProvider, CommunicatorProviderProps, ConfigurationProvider, ConfigurationProviderProps, CrossFrameStateOptions, DictionariesRecordProvider, DictionaryContent, EditedContentProvider, EditorEnabledProvider, EditorEnabledStateProps, EditorProvider, EditorProviderProps, FileContent, FocusDictionaryProvider, UseCrossPlatformStateProps, useCommunicator, useConfiguration, useConfigurationState, useCrossFrameMessageListener, useCrossFrameState, useCrossURLPathSetter, useCrossURLPathState, useDictionariesRecord, useDictionariesRecordActions, useEditedContent, useEditedContentActions, useEditorEnabled, useEditorEnabledState, useFocusDictionary, useFocusDictionaryActions, useGetEditedContentState, useGetEditorEnabledState, useIframeClickInterceptor, useIframeClickMerger, usePostEditedContentState, usePostEditorEnabledState };
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MessageKey } from "@intlayer/editor";
|
|
2
|
+
|
|
3
|
+
//#region src/useCrossFrameMessageListener.d.ts
|
|
4
|
+
|
|
2
5
|
/**
|
|
3
6
|
* useCrossFrameMessageListener
|
|
4
7
|
*
|
|
@@ -15,5 +18,7 @@ import { type MessageKey } from '@intlayer/editor';
|
|
|
15
18
|
* @returns {{ postMessage: (data: S) => void }} An object containing a `postMessage` function
|
|
16
19
|
* that allows broadcasting messages with the specified key and data.
|
|
17
20
|
*/
|
|
18
|
-
|
|
21
|
+
declare const useCrossFrameMessageListener: <S>(key: `${MessageKey}` | `${MessageKey}/post` | `${MessageKey}/get`, onEventTriggered?: (data: S) => void, revalidator?: any) => (data?: S) => void;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { useCrossFrameMessageListener };
|
|
19
24
|
//# sourceMappingURL=useCrossFrameMessageListener.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCrossFrameMessageListener.d.ts","
|
|
1
|
+
{"version":3,"file":"useCrossFrameMessageListener.d.ts","names":[],"sources":["../../src/useCrossFrameMessageListener.tsx"],"sourcesContent":[],"mappings":";;;;;;AAsBA;;;;;;;;;;;;;;cAAa,0CACH,kBAAkB,uBAAuB,4CACvB,0CAqDQ"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { Dispatch, SetStateAction } from "react";
|
|
2
|
+
import { MessageKey } from "@intlayer/editor";
|
|
3
|
+
|
|
4
|
+
//#region src/useCrossFrameState.d.ts
|
|
5
|
+
type CrossFrameStateOptions = {
|
|
6
|
+
emit?: boolean;
|
|
7
|
+
receive?: boolean;
|
|
6
8
|
};
|
|
7
9
|
/**
|
|
8
10
|
* Configuration options for `useCrossFrameState`.
|
|
@@ -25,5 +27,7 @@ export type CrossFrameStateOptions = {
|
|
|
25
27
|
*
|
|
26
28
|
* @returns {[S, Dispatch<SetStateAction<S>>]} An array containing the current state and a setter function.
|
|
27
29
|
*/
|
|
28
|
-
|
|
30
|
+
declare const useCrossFrameState: <S>(key: `${MessageKey}`, initialState?: S | (() => S), options?: CrossFrameStateOptions) => [S, Dispatch<SetStateAction<S>>, () => void];
|
|
31
|
+
//#endregion
|
|
32
|
+
export { CrossFrameStateOptions, useCrossFrameState };
|
|
29
33
|
//# sourceMappingURL=useCrossFrameState.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCrossFrameState.d.ts","
|
|
1
|
+
{"version":3,"file":"useCrossFrameState.d.ts","names":[],"sources":["../../src/useCrossFrameState.tsx"],"sourcesContent":[],"mappings":";;;;KAOY,sBAAA;;EAAA,OAAA,CAAA,EAAA,OAAA;AAgCZ,CAAA;;;;;;;;;;;;;;;;;;;;;;cAAa,gCACH,6BACO,WAAW,cAChB,4BACR,GAAG,SAAS,eAAe"}
|