@intlayer/editor-react 5.7.5 → 5.7.6
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/EditorProvider.cjs +1 -2
- package/dist/cjs/EditorProvider.cjs.map +1 -1
- package/dist/cjs/index.cjs +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/EditorProvider.mjs +1 -2
- package/dist/esm/EditorProvider.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/EditorProvider.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +6 -6
- package/dist/cjs/ChangedContentContext.cjs +0 -77
- package/dist/cjs/ChangedContentContext.cjs.map +0 -1
- package/dist/esm/ChangedContentContext.mjs +0 -55
- package/dist/esm/ChangedContentContext.mjs.map +0 -1
- package/dist/types/ChangedContentContext.d.ts +0 -13
- package/dist/types/ChangedContentContext.d.ts.map +0 -1
|
@@ -24,7 +24,6 @@ __export(EditorProvider_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(EditorProvider_exports);
|
|
25
25
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
26
|
var import_react = require("react");
|
|
27
|
-
var import_ChangedContentContext = require('./ChangedContentContext.cjs');
|
|
28
27
|
var import_CommunicatorContext = require('./CommunicatorContext.cjs');
|
|
29
28
|
var import_ConfigurationContext = require('./ConfigurationContext.cjs');
|
|
30
29
|
var import_DictionariesRecordContext = require('./DictionariesRecordContext.cjs');
|
|
@@ -64,7 +63,7 @@ const EditorProvider = ({
|
|
|
64
63
|
children,
|
|
65
64
|
configuration,
|
|
66
65
|
...props
|
|
67
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
66
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_EditorEnabledContext.EditorEnabledProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ConfigurationContext.ConfigurationProvider, { configuration, children: props.mode === "editor" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_CommunicatorContext.CommunicatorProvider, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EditorProvidersWrapper, { children }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IframeCheckRenderer, { fallback: children, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_CommunicatorContext.CommunicatorProvider, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EditorEnabledCheckRenderer, { fallback: children, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EditorProvidersWrapper, { children }) }) }) }) }) });
|
|
68
67
|
// Annotate the CommonJS export names for ESM import in node:
|
|
69
68
|
0 && (module.exports = {
|
|
70
69
|
EditorProvider
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/EditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport {\n type FC,\n type PropsWithChildren,\n ReactNode,\n useEffect,\n useState,\n} from 'react';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/EditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport {\n type FC,\n type PropsWithChildren,\n ReactNode,\n useEffect,\n useState,\n} from 'react';\nimport {\n type CommunicatorProviderProps,\n CommunicatorProvider,\n} from './CommunicatorContext';\nimport {\n type ConfigurationProviderProps,\n ConfigurationProvider,\n} from './ConfigurationContext';\nimport { DictionariesRecordProvider } from './DictionariesRecordContext';\nimport {\n EditedContentProvider,\n useGetEditedContentState,\n} from './EditedContentContext';\nimport {\n EditorEnabledProvider,\n useEditorEnabled,\n useGetEditorEnabledState,\n} from './EditorEnabledContext';\nimport { FocusDictionaryProvider } from './FocusDictionaryContext';\n\n/**\n * This component add all the providers needed by the editor.\n * It is used to wrap the application, or the editor to work together.\n */\nconst EditorProvidersWrapper: FC<PropsWithChildren> = ({ children }) => {\n const getEditedContentState = useGetEditedContentState();\n\n useEffect(() => {\n getEditedContentState();\n }, []);\n\n return (\n <DictionariesRecordProvider>\n <EditedContentProvider>\n <FocusDictionaryProvider>{children}</FocusDictionaryProvider>\n </EditedContentProvider>\n </DictionariesRecordProvider>\n );\n};\n\ntype FallbackProps = {\n fallback: ReactNode;\n};\n\n/**\n * This component check if the editor is enabled to render the editor providers.\n */\nconst EditorEnabledCheckRenderer: FC<PropsWithChildren<FallbackProps>> = ({\n children,\n fallback,\n}) => {\n const getEditorEnabled = useGetEditorEnabledState();\n\n const { enabled } = useEditorEnabled();\n\n useEffect(() => {\n if (enabled) return;\n\n // Check if the editor is wrapping the application\n getEditorEnabled();\n }, [enabled]);\n\n return enabled ? children : fallback;\n};\n\n/**\n * This component is used to check if the editor is wrapping the application.\n * It avoid to send window.postMessage to the application if the editor is not wrapping the application.\n */\nconst IframeCheckRenderer: FC<PropsWithChildren<FallbackProps>> = ({\n children,\n fallback,\n}) => {\n const [isInIframe, setIsInIframe] = useState(false);\n\n useEffect(() => {\n setIsInIframe(window.self !== window.top);\n }, []);\n\n return isInIframe ? children : fallback;\n};\n\nexport type EditorProviderProps = CommunicatorProviderProps &\n ConfigurationProviderProps & {\n mode: 'editor' | 'client';\n };\n\nexport const EditorProvider: FC<PropsWithChildren<EditorProviderProps>> = ({\n children,\n configuration,\n ...props\n}) => (\n <EditorEnabledProvider>\n <ConfigurationProvider configuration={configuration}>\n {props.mode === 'editor' ? (\n <CommunicatorProvider {...props}>\n <EditorProvidersWrapper>{children}</EditorProvidersWrapper>\n </CommunicatorProvider>\n ) : (\n <IframeCheckRenderer fallback={children}>\n <CommunicatorProvider {...props}>\n <EditorEnabledCheckRenderer fallback={children}>\n <EditorProvidersWrapper>{children}</EditorProvidersWrapper>\n </EditorEnabledCheckRenderer>\n </CommunicatorProvider>\n </IframeCheckRenderer>\n )}\n </ConfigurationProvider>\n </EditorEnabledProvider>\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA2CQ;AAzCR,mBAMO;AACP,iCAGO;AACP,kCAGO;AACP,uCAA2C;AAC3C,kCAGO;AACP,kCAIO;AACP,oCAAwC;AAMxC,MAAM,yBAAgD,CAAC,EAAE,SAAS,MAAM;AACtE,QAAM,4BAAwB,sDAAyB;AAEvD,8BAAU,MAAM;AACd,0BAAsB;AAAA,EACxB,GAAG,CAAC,CAAC;AAEL,SACE,4CAAC,+DACC,sDAAC,qDACC,sDAAC,yDAAyB,UAAS,GACrC,GACF;AAEJ;AASA,MAAM,6BAAmE,CAAC;AAAA,EACxE;AAAA,EACA;AACF,MAAM;AACJ,QAAM,uBAAmB,sDAAyB;AAElD,QAAM,EAAE,QAAQ,QAAI,8CAAiB;AAErC,8BAAU,MAAM;AACd,QAAI,QAAS;AAGb,qBAAiB;AAAA,EACnB,GAAG,CAAC,OAAO,CAAC;AAEZ,SAAO,UAAU,WAAW;AAC9B;AAMA,MAAM,sBAA4D,CAAC;AAAA,EACjE;AAAA,EACA;AACF,MAAM;AACJ,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAElD,8BAAU,MAAM;AACd,kBAAc,OAAO,SAAS,OAAO,GAAG;AAAA,EAC1C,GAAG,CAAC,CAAC;AAEL,SAAO,aAAa,WAAW;AACjC;AAOO,MAAM,iBAA6D,CAAC;AAAA,EACzE;AAAA,EACA;AAAA,EACA,GAAG;AACL,MACE,4CAAC,qDACC,sDAAC,qDAAsB,eACpB,gBAAM,SAAS,WACd,4CAAC,mDAAsB,GAAG,OACxB,sDAAC,0BAAwB,UAAS,GACpC,IAEA,4CAAC,uBAAoB,UAAU,UAC7B,sDAAC,mDAAsB,GAAG,OACxB,sDAAC,8BAA2B,UAAU,UACpC,sDAAC,0BAAwB,UAAS,GACpC,GACF,GACF,GAEJ,GACF;","names":[]}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -16,7 +16,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
16
16
|
var index_exports = {};
|
|
17
17
|
module.exports = __toCommonJS(index_exports);
|
|
18
18
|
__reExport(index_exports, require("@intlayer/editor"), module.exports);
|
|
19
|
-
__reExport(index_exports, require('./
|
|
19
|
+
__reExport(index_exports, require('./CommunicatorContext.cjs'), module.exports);
|
|
20
20
|
__reExport(index_exports, require('./ConfigurationContext.cjs'), module.exports);
|
|
21
21
|
__reExport(index_exports, require('./DictionariesRecordContext.cjs'), module.exports);
|
|
22
22
|
__reExport(index_exports, require('./EditedContentContext.cjs'), module.exports);
|
|
@@ -30,7 +30,7 @@ __reExport(index_exports, require('./useIframeClickInterceptor.cjs'), module.exp
|
|
|
30
30
|
// Annotate the CommonJS export names for ESM import in node:
|
|
31
31
|
0 && (module.exports = {
|
|
32
32
|
...require("@intlayer/editor"),
|
|
33
|
-
...require('./
|
|
33
|
+
...require('./CommunicatorContext.cjs'),
|
|
34
34
|
...require('./ConfigurationContext.cjs'),
|
|
35
35
|
...require('./DictionariesRecordContext.cjs'),
|
|
36
36
|
...require('./EditedContentContext.cjs'),
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from '@intlayer/editor';\nexport * from './
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from '@intlayer/editor';\nexport * from './CommunicatorContext';\nexport * from './ConfigurationContext';\nexport * from './DictionariesRecordContext';\nexport * from './EditedContentContext';\nexport * from './EditorEnabledContext';\nexport * from './EditorProvider';\nexport * from './FocusDictionaryContext';\nexport * from './useCrossFrameMessageListener';\nexport * from './useCrossFrameState';\nexport * from './useCrossURLPathState';\nexport * from './useIframeClickInterceptor';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,6BAAd;AACA,0BAAc,kCADd;AAEA,0BAAc,mCAFd;AAGA,0BAAc,wCAHd;AAIA,0BAAc,mCAJd;AAKA,0BAAc,mCALd;AAMA,0BAAc,6BANd;AAOA,0BAAc,qCAPd;AAQA,0BAAc,2CARd;AASA,0BAAc,iCATd;AAUA,0BAAc,mCAVd;AAWA,0BAAc,wCAXd;","names":[]}
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
useEffect,
|
|
5
5
|
useState
|
|
6
6
|
} from "react";
|
|
7
|
-
import { ChangedContentProvider } from "./ChangedContentContext.mjs";
|
|
8
7
|
import {
|
|
9
8
|
CommunicatorProvider
|
|
10
9
|
} from "./CommunicatorContext.mjs";
|
|
@@ -55,7 +54,7 @@ const EditorProvider = ({
|
|
|
55
54
|
children,
|
|
56
55
|
configuration,
|
|
57
56
|
...props
|
|
58
|
-
}) => /* @__PURE__ */ jsx(
|
|
57
|
+
}) => /* @__PURE__ */ jsx(EditorEnabledProvider, { children: /* @__PURE__ */ jsx(ConfigurationProvider, { configuration, children: props.mode === "editor" ? /* @__PURE__ */ jsx(CommunicatorProvider, { ...props, children: /* @__PURE__ */ jsx(EditorProvidersWrapper, { children }) }) : /* @__PURE__ */ jsx(IframeCheckRenderer, { fallback: children, children: /* @__PURE__ */ jsx(CommunicatorProvider, { ...props, children: /* @__PURE__ */ jsx(EditorEnabledCheckRenderer, { fallback: children, children: /* @__PURE__ */ jsx(EditorProvidersWrapper, { children }) }) }) }) }) });
|
|
59
58
|
export {
|
|
60
59
|
EditorProvider
|
|
61
60
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/EditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport {\n type FC,\n type PropsWithChildren,\n ReactNode,\n useEffect,\n useState,\n} from 'react';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/EditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport {\n type FC,\n type PropsWithChildren,\n ReactNode,\n useEffect,\n useState,\n} from 'react';\nimport {\n type CommunicatorProviderProps,\n CommunicatorProvider,\n} from './CommunicatorContext';\nimport {\n type ConfigurationProviderProps,\n ConfigurationProvider,\n} from './ConfigurationContext';\nimport { DictionariesRecordProvider } from './DictionariesRecordContext';\nimport {\n EditedContentProvider,\n useGetEditedContentState,\n} from './EditedContentContext';\nimport {\n EditorEnabledProvider,\n useEditorEnabled,\n useGetEditorEnabledState,\n} from './EditorEnabledContext';\nimport { FocusDictionaryProvider } from './FocusDictionaryContext';\n\n/**\n * This component add all the providers needed by the editor.\n * It is used to wrap the application, or the editor to work together.\n */\nconst EditorProvidersWrapper: FC<PropsWithChildren> = ({ children }) => {\n const getEditedContentState = useGetEditedContentState();\n\n useEffect(() => {\n getEditedContentState();\n }, []);\n\n return (\n <DictionariesRecordProvider>\n <EditedContentProvider>\n <FocusDictionaryProvider>{children}</FocusDictionaryProvider>\n </EditedContentProvider>\n </DictionariesRecordProvider>\n );\n};\n\ntype FallbackProps = {\n fallback: ReactNode;\n};\n\n/**\n * This component check if the editor is enabled to render the editor providers.\n */\nconst EditorEnabledCheckRenderer: FC<PropsWithChildren<FallbackProps>> = ({\n children,\n fallback,\n}) => {\n const getEditorEnabled = useGetEditorEnabledState();\n\n const { enabled } = useEditorEnabled();\n\n useEffect(() => {\n if (enabled) return;\n\n // Check if the editor is wrapping the application\n getEditorEnabled();\n }, [enabled]);\n\n return enabled ? children : fallback;\n};\n\n/**\n * This component is used to check if the editor is wrapping the application.\n * It avoid to send window.postMessage to the application if the editor is not wrapping the application.\n */\nconst IframeCheckRenderer: FC<PropsWithChildren<FallbackProps>> = ({\n children,\n fallback,\n}) => {\n const [isInIframe, setIsInIframe] = useState(false);\n\n useEffect(() => {\n setIsInIframe(window.self !== window.top);\n }, []);\n\n return isInIframe ? children : fallback;\n};\n\nexport type EditorProviderProps = CommunicatorProviderProps &\n ConfigurationProviderProps & {\n mode: 'editor' | 'client';\n };\n\nexport const EditorProvider: FC<PropsWithChildren<EditorProviderProps>> = ({\n children,\n configuration,\n ...props\n}) => (\n <EditorEnabledProvider>\n <ConfigurationProvider configuration={configuration}>\n {props.mode === 'editor' ? (\n <CommunicatorProvider {...props}>\n <EditorProvidersWrapper>{children}</EditorProvidersWrapper>\n </CommunicatorProvider>\n ) : (\n <IframeCheckRenderer fallback={children}>\n <CommunicatorProvider {...props}>\n <EditorEnabledCheckRenderer fallback={children}>\n <EditorProvidersWrapper>{children}</EditorProvidersWrapper>\n </EditorEnabledCheckRenderer>\n </CommunicatorProvider>\n </IframeCheckRenderer>\n )}\n </ConfigurationProvider>\n </EditorEnabledProvider>\n);\n"],"mappings":";AA2CQ;AAzCR;AAAA,EAIE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP,SAAS,kCAAkC;AAC3C;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,+BAA+B;AAMxC,MAAM,yBAAgD,CAAC,EAAE,SAAS,MAAM;AACtE,QAAM,wBAAwB,yBAAyB;AAEvD,YAAU,MAAM;AACd,0BAAsB;AAAA,EACxB,GAAG,CAAC,CAAC;AAEL,SACE,oBAAC,8BACC,8BAAC,yBACC,8BAAC,2BAAyB,UAAS,GACrC,GACF;AAEJ;AASA,MAAM,6BAAmE,CAAC;AAAA,EACxE;AAAA,EACA;AACF,MAAM;AACJ,QAAM,mBAAmB,yBAAyB;AAElD,QAAM,EAAE,QAAQ,IAAI,iBAAiB;AAErC,YAAU,MAAM;AACd,QAAI,QAAS;AAGb,qBAAiB;AAAA,EACnB,GAAG,CAAC,OAAO,CAAC;AAEZ,SAAO,UAAU,WAAW;AAC9B;AAMA,MAAM,sBAA4D,CAAC;AAAA,EACjE;AAAA,EACA;AACF,MAAM;AACJ,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAElD,YAAU,MAAM;AACd,kBAAc,OAAO,SAAS,OAAO,GAAG;AAAA,EAC1C,GAAG,CAAC,CAAC;AAEL,SAAO,aAAa,WAAW;AACjC;AAOO,MAAM,iBAA6D,CAAC;AAAA,EACzE;AAAA,EACA;AAAA,EACA,GAAG;AACL,MACE,oBAAC,yBACC,8BAAC,yBAAsB,eACpB,gBAAM,SAAS,WACd,oBAAC,wBAAsB,GAAG,OACxB,8BAAC,0BAAwB,UAAS,GACpC,IAEA,oBAAC,uBAAoB,UAAU,UAC7B,8BAAC,wBAAsB,GAAG,OACxB,8BAAC,8BAA2B,UAAU,UACpC,8BAAC,0BAAwB,UAAS,GACpC,GACF,GACF,GAEJ,GACF;","names":[]}
|
package/dist/esm/index.mjs
CHANGED
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from '@intlayer/editor';\nexport * from './
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from '@intlayer/editor';\nexport * from './CommunicatorContext';\nexport * from './ConfigurationContext';\nexport * from './DictionariesRecordContext';\nexport * from './EditedContentContext';\nexport * from './EditorEnabledContext';\nexport * from './EditorProvider';\nexport * from './FocusDictionaryContext';\nexport * from './useCrossFrameMessageListener';\nexport * from './useCrossFrameState';\nexport * from './useCrossURLPathState';\nexport * from './useIframeClickInterceptor';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorProvider.d.ts","sourceRoot":"","sources":["../../src/EditorProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,EAAE,EACP,KAAK,iBAAiB,EAIvB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"EditorProvider.d.ts","sourceRoot":"","sources":["../../src/EditorProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,EAAE,EACP,KAAK,iBAAiB,EAIvB,MAAM,OAAO,CAAC;AACf,OAAO,EACL,KAAK,yBAAyB,EAE/B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,KAAK,0BAA0B,EAEhC,MAAM,wBAAwB,CAAC;AA2EhC,MAAM,MAAM,mBAAmB,GAAG,yBAAyB,GACzD,0BAA0B,GAAG;IAC3B,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC3B,CAAC;AAEJ,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,CAsBrE,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/editor-react",
|
|
3
|
-
"version": "5.7.
|
|
3
|
+
"version": "5.7.6",
|
|
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": [
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
],
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"uuid": "^11.1.0",
|
|
56
|
-
"@intlayer/config": "5.7.
|
|
57
|
-
"@intlayer/core": "5.7.
|
|
58
|
-
"@intlayer/editor": "5.7.
|
|
56
|
+
"@intlayer/config": "5.7.6",
|
|
57
|
+
"@intlayer/core": "5.7.6",
|
|
58
|
+
"@intlayer/editor": "5.7.6"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/node": "^22.15.30",
|
|
@@ -80,8 +80,8 @@
|
|
|
80
80
|
"peerDependencies": {
|
|
81
81
|
"react": ">=16.0.0",
|
|
82
82
|
"react-dom": ">=16.0.0",
|
|
83
|
-
"@intlayer/config": "5.7.
|
|
84
|
-
"@intlayer/core": "5.7.
|
|
83
|
+
"@intlayer/config": "5.7.6",
|
|
84
|
+
"@intlayer/core": "5.7.6"
|
|
85
85
|
},
|
|
86
86
|
"engines": {
|
|
87
87
|
"node": ">=14.18"
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var ChangedContentContext_exports = {};
|
|
21
|
-
__export(ChangedContentContext_exports, {
|
|
22
|
-
ChangedContentProvider: () => ChangedContentProvider,
|
|
23
|
-
useChangedContent: () => useChangedContent,
|
|
24
|
-
useChangedContentActions: () => useChangedContentActions
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(ChangedContentContext_exports);
|
|
27
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
|
-
var import_react = require("react");
|
|
29
|
-
const ChangedContentStateContext = (0, import_react.createContext)(void 0);
|
|
30
|
-
const ChangedContentActionsContext = (0, import_react.createContext)(void 0);
|
|
31
|
-
const ChangedContentProvider = ({ children }) => {
|
|
32
|
-
const [changedContent, setChangedContentState] = (0, import_react.useState)(
|
|
33
|
-
{}
|
|
34
|
-
);
|
|
35
|
-
const setChangedContent = (dictionaryKey, newValue) => {
|
|
36
|
-
setChangedContentState((prev) => ({
|
|
37
|
-
...prev,
|
|
38
|
-
[dictionaryKey]: {
|
|
39
|
-
...prev?.[dictionaryKey],
|
|
40
|
-
content: newValue
|
|
41
|
-
}
|
|
42
|
-
}));
|
|
43
|
-
};
|
|
44
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
45
|
-
ChangedContentStateContext.Provider,
|
|
46
|
-
{
|
|
47
|
-
value: {
|
|
48
|
-
changedContent
|
|
49
|
-
},
|
|
50
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
51
|
-
ChangedContentActionsContext.Provider,
|
|
52
|
-
{
|
|
53
|
-
value: {
|
|
54
|
-
setChangedContent
|
|
55
|
-
},
|
|
56
|
-
children
|
|
57
|
-
}
|
|
58
|
-
)
|
|
59
|
-
}
|
|
60
|
-
);
|
|
61
|
-
};
|
|
62
|
-
const useChangedContentActions = () => {
|
|
63
|
-
const context = (0, import_react.useContext)(ChangedContentActionsContext);
|
|
64
|
-
return context;
|
|
65
|
-
};
|
|
66
|
-
const useChangedContent = () => {
|
|
67
|
-
const stateContext = (0, import_react.useContext)(ChangedContentStateContext);
|
|
68
|
-
const actionContext = useChangedContentActions();
|
|
69
|
-
return { ...stateContext, ...actionContext };
|
|
70
|
-
};
|
|
71
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
72
|
-
0 && (module.exports = {
|
|
73
|
-
ChangedContentProvider,
|
|
74
|
-
useChangedContent,
|
|
75
|
-
useChangedContentActions
|
|
76
|
-
});
|
|
77
|
-
//# sourceMappingURL=ChangedContentContext.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ChangedContentContext.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary } from '@intlayer/core';\nimport {\n createContext,\n useContext,\n useState,\n type FC,\n type PropsWithChildren,\n} from 'react';\nimport type { DictionaryContent } from './DictionariesRecordContext';\n\ntype ChangedContentStateContextType = {\n changedContent: Record<Dictionary['key'], Dictionary> | undefined;\n};\n\nconst ChangedContentStateContext = createContext<\n ChangedContentStateContextType | undefined\n>(undefined);\n\ntype ChangedContentActionsContextType = {\n setChangedContent: (\n dictionaryKey: Dictionary['key'],\n newValue: Dictionary['content']\n ) => void;\n};\n\nconst ChangedContentActionsContext = createContext<\n ChangedContentActionsContextType | undefined\n>(undefined);\n\nexport const ChangedContentProvider: FC<PropsWithChildren> = ({ children }) => {\n const [changedContent, setChangedContentState] = useState<DictionaryContent>(\n {}\n );\n\n const setChangedContent = (\n dictionaryKey: Dictionary['key'],\n newValue: Dictionary['content']\n ) => {\n setChangedContentState((prev) => ({\n ...prev,\n [dictionaryKey]: {\n ...prev?.[dictionaryKey],\n content: newValue,\n },\n }));\n };\n\n return (\n <ChangedContentStateContext.Provider\n value={{\n changedContent,\n }}\n >\n <ChangedContentActionsContext.Provider\n value={{\n setChangedContent,\n }}\n >\n {children}\n </ChangedContentActionsContext.Provider>\n </ChangedContentStateContext.Provider>\n );\n};\n\nexport const useChangedContentActions = () => {\n const context = useContext(ChangedContentActionsContext);\n\n return context;\n};\n\nexport const useChangedContent = () => {\n const stateContext = useContext(ChangedContentStateContext);\n const actionContext = useChangedContentActions();\n\n return { ...stateContext, ...actionContext };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAuDM;AApDN,mBAMO;AAOP,MAAM,iCAA6B,4BAEjC,MAAS;AASX,MAAM,mCAA+B,4BAEnC,MAAS;AAEJ,MAAM,yBAAgD,CAAC,EAAE,SAAS,MAAM;AAC7E,QAAM,CAAC,gBAAgB,sBAAsB,QAAI;AAAA,IAC/C,CAAC;AAAA,EACH;AAEA,QAAM,oBAAoB,CACxB,eACA,aACG;AACH,2BAAuB,CAAC,UAAU;AAAA,MAChC,GAAG;AAAA,MACH,CAAC,aAAa,GAAG;AAAA,QACf,GAAG,OAAO,aAAa;AAAA,QACvB,SAAS;AAAA,MACX;AAAA,IACF,EAAE;AAAA,EACJ;AAEA,SACE;AAAA,IAAC,2BAA2B;AAAA,IAA3B;AAAA,MACC,OAAO;AAAA,QACL;AAAA,MACF;AAAA,MAEA;AAAA,QAAC,6BAA6B;AAAA,QAA7B;AAAA,UACC,OAAO;AAAA,YACL;AAAA,UACF;AAAA,UAEC;AAAA;AAAA,MACH;AAAA;AAAA,EACF;AAEJ;AAEO,MAAM,2BAA2B,MAAM;AAC5C,QAAM,cAAU,yBAAW,4BAA4B;AAEvD,SAAO;AACT;AAEO,MAAM,oBAAoB,MAAM;AACrC,QAAM,mBAAe,yBAAW,0BAA0B;AAC1D,QAAM,gBAAgB,yBAAyB;AAE/C,SAAO,EAAE,GAAG,cAAc,GAAG,cAAc;AAC7C;","names":[]}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
createContext,
|
|
5
|
-
useContext,
|
|
6
|
-
useState
|
|
7
|
-
} from "react";
|
|
8
|
-
const ChangedContentStateContext = createContext(void 0);
|
|
9
|
-
const ChangedContentActionsContext = createContext(void 0);
|
|
10
|
-
const ChangedContentProvider = ({ children }) => {
|
|
11
|
-
const [changedContent, setChangedContentState] = useState(
|
|
12
|
-
{}
|
|
13
|
-
);
|
|
14
|
-
const setChangedContent = (dictionaryKey, newValue) => {
|
|
15
|
-
setChangedContentState((prev) => ({
|
|
16
|
-
...prev,
|
|
17
|
-
[dictionaryKey]: {
|
|
18
|
-
...prev?.[dictionaryKey],
|
|
19
|
-
content: newValue
|
|
20
|
-
}
|
|
21
|
-
}));
|
|
22
|
-
};
|
|
23
|
-
return /* @__PURE__ */ jsx(
|
|
24
|
-
ChangedContentStateContext.Provider,
|
|
25
|
-
{
|
|
26
|
-
value: {
|
|
27
|
-
changedContent
|
|
28
|
-
},
|
|
29
|
-
children: /* @__PURE__ */ jsx(
|
|
30
|
-
ChangedContentActionsContext.Provider,
|
|
31
|
-
{
|
|
32
|
-
value: {
|
|
33
|
-
setChangedContent
|
|
34
|
-
},
|
|
35
|
-
children
|
|
36
|
-
}
|
|
37
|
-
)
|
|
38
|
-
}
|
|
39
|
-
);
|
|
40
|
-
};
|
|
41
|
-
const useChangedContentActions = () => {
|
|
42
|
-
const context = useContext(ChangedContentActionsContext);
|
|
43
|
-
return context;
|
|
44
|
-
};
|
|
45
|
-
const useChangedContent = () => {
|
|
46
|
-
const stateContext = useContext(ChangedContentStateContext);
|
|
47
|
-
const actionContext = useChangedContentActions();
|
|
48
|
-
return { ...stateContext, ...actionContext };
|
|
49
|
-
};
|
|
50
|
-
export {
|
|
51
|
-
ChangedContentProvider,
|
|
52
|
-
useChangedContent,
|
|
53
|
-
useChangedContentActions
|
|
54
|
-
};
|
|
55
|
-
//# sourceMappingURL=ChangedContentContext.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ChangedContentContext.tsx"],"sourcesContent":["'use client';\n\nimport type { Dictionary } from '@intlayer/core';\nimport {\n createContext,\n useContext,\n useState,\n type FC,\n type PropsWithChildren,\n} from 'react';\nimport type { DictionaryContent } from './DictionariesRecordContext';\n\ntype ChangedContentStateContextType = {\n changedContent: Record<Dictionary['key'], Dictionary> | undefined;\n};\n\nconst ChangedContentStateContext = createContext<\n ChangedContentStateContextType | undefined\n>(undefined);\n\ntype ChangedContentActionsContextType = {\n setChangedContent: (\n dictionaryKey: Dictionary['key'],\n newValue: Dictionary['content']\n ) => void;\n};\n\nconst ChangedContentActionsContext = createContext<\n ChangedContentActionsContextType | undefined\n>(undefined);\n\nexport const ChangedContentProvider: FC<PropsWithChildren> = ({ children }) => {\n const [changedContent, setChangedContentState] = useState<DictionaryContent>(\n {}\n );\n\n const setChangedContent = (\n dictionaryKey: Dictionary['key'],\n newValue: Dictionary['content']\n ) => {\n setChangedContentState((prev) => ({\n ...prev,\n [dictionaryKey]: {\n ...prev?.[dictionaryKey],\n content: newValue,\n },\n }));\n };\n\n return (\n <ChangedContentStateContext.Provider\n value={{\n changedContent,\n }}\n >\n <ChangedContentActionsContext.Provider\n value={{\n setChangedContent,\n }}\n >\n {children}\n </ChangedContentActionsContext.Provider>\n </ChangedContentStateContext.Provider>\n );\n};\n\nexport const useChangedContentActions = () => {\n const context = useContext(ChangedContentActionsContext);\n\n return context;\n};\n\nexport const useChangedContent = () => {\n const stateContext = useContext(ChangedContentStateContext);\n const actionContext = useChangedContentActions();\n\n return { ...stateContext, ...actionContext };\n};\n"],"mappings":";AAuDM;AApDN;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AAOP,MAAM,6BAA6B,cAEjC,MAAS;AASX,MAAM,+BAA+B,cAEnC,MAAS;AAEJ,MAAM,yBAAgD,CAAC,EAAE,SAAS,MAAM;AAC7E,QAAM,CAAC,gBAAgB,sBAAsB,IAAI;AAAA,IAC/C,CAAC;AAAA,EACH;AAEA,QAAM,oBAAoB,CACxB,eACA,aACG;AACH,2BAAuB,CAAC,UAAU;AAAA,MAChC,GAAG;AAAA,MACH,CAAC,aAAa,GAAG;AAAA,QACf,GAAG,OAAO,aAAa;AAAA,QACvB,SAAS;AAAA,MACX;AAAA,IACF,EAAE;AAAA,EACJ;AAEA,SACE;AAAA,IAAC,2BAA2B;AAAA,IAA3B;AAAA,MACC,OAAO;AAAA,QACL;AAAA,MACF;AAAA,MAEA;AAAA,QAAC,6BAA6B;AAAA,QAA7B;AAAA,UACC,OAAO;AAAA,YACL;AAAA,UACF;AAAA,UAEC;AAAA;AAAA,MACH;AAAA;AAAA,EACF;AAEJ;AAEO,MAAM,2BAA2B,MAAM;AAC5C,QAAM,UAAU,WAAW,4BAA4B;AAEvD,SAAO;AACT;AAEO,MAAM,oBAAoB,MAAM;AACrC,QAAM,eAAe,WAAW,0BAA0B;AAC1D,QAAM,gBAAgB,yBAAyB;AAE/C,SAAO,EAAE,GAAG,cAAc,GAAG,cAAc;AAC7C;","names":[]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Dictionary } from '@intlayer/core';
|
|
2
|
-
import { type FC, type PropsWithChildren } from 'react';
|
|
3
|
-
type ChangedContentActionsContextType = {
|
|
4
|
-
setChangedContent: (dictionaryKey: Dictionary['key'], newValue: Dictionary['content']) => void;
|
|
5
|
-
};
|
|
6
|
-
export declare const ChangedContentProvider: FC<PropsWithChildren>;
|
|
7
|
-
export declare const useChangedContentActions: () => ChangedContentActionsContextType;
|
|
8
|
-
export declare const useChangedContent: () => {
|
|
9
|
-
setChangedContent: (dictionaryKey: Dictionary["key"], newValue: Dictionary["content"]) => void;
|
|
10
|
-
changedContent: Record<Dictionary["key"], Dictionary> | undefined;
|
|
11
|
-
};
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=ChangedContentContext.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChangedContentContext.d.ts","sourceRoot":"","sources":["../../src/ChangedContentContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAIL,KAAK,EAAE,EACP,KAAK,iBAAiB,EACvB,MAAM,OAAO,CAAC;AAWf,KAAK,gCAAgC,GAAG;IACtC,iBAAiB,EAAE,CACjB,aAAa,EAAE,UAAU,CAAC,KAAK,CAAC,EAChC,QAAQ,EAAE,UAAU,CAAC,SAAS,CAAC,KAC5B,IAAI,CAAC;CACX,CAAC;AAMF,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,iBAAiB,CAiCxD,CAAC;AAEF,eAAO,MAAM,wBAAwB,wCAIpC,CAAC;AAEF,eAAO,MAAM,iBAAiB;uBAnDT,CACjB,aAAa,EAAE,UAAU,CAAC,KAAK,CAAC,EAChC,QAAQ,EAAE,UAAU,CAAC,SAAS,CAAC,KAC5B,IAAI;oBAXO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG,SAAS;CAgElE,CAAC"}
|