react-intlayer 3.1.0 → 3.2.1

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.
Files changed (48) hide show
  1. package/dist/cjs/client/IntlayerProvider.cjs +4 -17
  2. package/dist/cjs/client/IntlayerProvider.cjs.map +1 -1
  3. package/dist/cjs/editor/ContentSelectorConnector.cjs +57 -0
  4. package/dist/cjs/editor/ContentSelectorConnector.cjs.map +1 -0
  5. package/dist/cjs/editor/ContentSelectorWrapper.cjs +33 -0
  6. package/dist/cjs/editor/ContentSelectorWrapper.cjs.map +1 -0
  7. package/dist/cjs/editor/IntlayerEditorProvider.cjs +31 -0
  8. package/dist/cjs/editor/IntlayerEditorProvider.cjs.map +1 -0
  9. package/dist/cjs/editor/index.cjs +27 -0
  10. package/dist/cjs/editor/index.cjs.map +1 -0
  11. package/dist/cjs/editor/renderContentEditor.cjs +54 -0
  12. package/dist/cjs/editor/renderContentEditor.cjs.map +1 -0
  13. package/dist/cjs/index.cjs +2 -0
  14. package/dist/cjs/index.cjs.map +1 -1
  15. package/dist/cjs/useDictionaryBase.cjs +2 -2
  16. package/dist/cjs/useDictionaryBase.cjs.map +1 -1
  17. package/dist/esm/client/IntlayerProvider.mjs +4 -17
  18. package/dist/esm/client/IntlayerProvider.mjs.map +1 -1
  19. package/dist/esm/editor/ContentSelectorConnector.mjs +37 -0
  20. package/dist/esm/editor/ContentSelectorConnector.mjs.map +1 -0
  21. package/dist/esm/editor/ContentSelectorWrapper.mjs +10 -0
  22. package/dist/esm/editor/ContentSelectorWrapper.mjs.map +1 -0
  23. package/dist/esm/editor/IntlayerEditorProvider.mjs +8 -0
  24. package/dist/esm/editor/IntlayerEditorProvider.mjs.map +1 -0
  25. package/dist/esm/editor/index.mjs +4 -0
  26. package/dist/esm/editor/index.mjs.map +1 -0
  27. package/dist/esm/editor/renderContentEditor.mjs +31 -0
  28. package/dist/esm/editor/renderContentEditor.mjs.map +1 -0
  29. package/dist/esm/index.mjs +2 -0
  30. package/dist/esm/index.mjs.map +1 -1
  31. package/dist/esm/useDictionaryBase.mjs +1 -1
  32. package/dist/esm/useDictionaryBase.mjs.map +1 -1
  33. package/dist/types/client/IntlayerProvider.d.ts +0 -1
  34. package/dist/types/client/IntlayerProvider.d.ts.map +1 -1
  35. package/dist/types/editor/ContentSelectorConnector.d.ts +14 -0
  36. package/dist/types/editor/ContentSelectorConnector.d.ts.map +1 -0
  37. package/dist/types/editor/ContentSelectorWrapper.d.ts +10 -0
  38. package/dist/types/editor/ContentSelectorWrapper.d.ts.map +1 -0
  39. package/dist/types/editor/IntlayerEditorProvider.d.ts +3 -0
  40. package/dist/types/editor/IntlayerEditorProvider.d.ts.map +1 -0
  41. package/dist/types/editor/index.d.ts +4 -0
  42. package/dist/types/editor/index.d.ts.map +1 -0
  43. package/dist/types/editor/renderContentEditor.d.ts +14 -0
  44. package/dist/types/editor/renderContentEditor.d.ts.map +1 -0
  45. package/dist/types/index.d.ts +1 -1
  46. package/dist/types/index.d.ts.map +1 -1
  47. package/dist/types/useDictionaryBase.d.ts.map +1 -1
  48. package/package.json +17 -9
@@ -26,9 +26,9 @@ __export(IntlayerProvider_exports, {
26
26
  module.exports = __toCommonJS(IntlayerProvider_exports);
27
27
  var import_jsx_runtime = require("react/jsx-runtime");
28
28
  var import_client = require("@intlayer/config/client");
29
- var import_intlayer_editor = require("intlayer-editor");
30
29
  var import_react = require("react");
31
30
  var import_useLocaleCookie = require('./useLocaleCookie.cjs');
31
+ var import_IntlayerEditorProvider = require('../editor/IntlayerEditorProvider.cjs');
32
32
  const IntlayerClientContext = (0, import_react.createContext)({
33
33
  locale: import_useLocaleCookie.localeCookie ?? (0, import_client.getConfiguration)().internationalization.defaultLocale,
34
34
  setLocale: () => null
@@ -37,10 +37,9 @@ const useIntlayerContext = () => (0, import_react.useContext)(IntlayerClientCont
37
37
  const IntlayerProvider = ({
38
38
  locale,
39
39
  children,
40
- setLocale: setLocaleProp,
41
- editorEnabled = true
40
+ setLocale: setLocaleProp
42
41
  }) => {
43
- const { internationalization, editor } = (0, import_client.getConfiguration)();
42
+ const { internationalization } = (0, import_client.getConfiguration)();
44
43
  const { defaultLocale, locales: availableLocales } = internationalization;
45
44
  const [currentLocale, setCurrentLocale] = (0, import_react.useState)(
46
45
  locale ?? import_useLocaleCookie.localeCookie ?? defaultLocale
@@ -62,19 +61,7 @@ const IntlayerProvider = ({
62
61
  () => ({ locale: currentLocale, setLocale }),
63
62
  [currentLocale, setLocale]
64
63
  );
65
- const isEditorEnabled = Boolean(
66
- editor?.enabled && editor.clientId && editor.clientSecret && editorEnabled
67
- );
68
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IntlayerClientContext.Provider, { value, children: isEditorEnabled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
69
- import_intlayer_editor.ContentEditionLayout,
70
- {
71
- locale: currentLocale,
72
- setLocale,
73
- localeList: availableLocales,
74
- editorEnabled: isEditorEnabled,
75
- children
76
- }
77
- ) : children });
64
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IntlayerClientContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_IntlayerEditorProvider.IntlayerEditorProvider, { children }) });
78
65
  };
79
66
  // Annotate the CommonJS export names for ESM import in node:
80
67
  0 && (module.exports = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/IntlayerProvider.tsx"],"sourcesContent":["'use client';\n\nimport { getConfiguration, type Locales } from '@intlayer/config/client';\nimport { ContentEditionLayout } from 'intlayer-editor';\nimport {\n type PropsWithChildren,\n createContext,\n useContext,\n useMemo,\n type FC,\n useState,\n useCallback,\n} from 'react';\nimport { localeCookie, setLocaleCookie } from './useLocaleCookie';\n\ntype IntlayerValue = {\n locale: Locales;\n setLocale: (newLocale: Locales) => void;\n};\n\n/**\n * Context that store the current locale on the client side\n */\nexport const IntlayerClientContext = createContext<IntlayerValue>({\n locale: localeCookie ?? getConfiguration().internationalization.defaultLocale,\n setLocale: () => null,\n});\n\n/**\n * Hook that provides the current locale\n */\nexport const useIntlayerContext = () => useContext(IntlayerClientContext);\n\nexport type IntlayerProviderProps = PropsWithChildren & {\n locale?: Locales;\n setLocale?: (locale: Locales) => void;\n editorEnabled?: boolean;\n};\n\n/**\n * Provider that store the current locale on the client side\n */\nexport const IntlayerProvider: FC<IntlayerProviderProps> = ({\n locale,\n children,\n setLocale: setLocaleProp,\n editorEnabled = true,\n}) => {\n const { internationalization, editor } = getConfiguration();\n const { defaultLocale, locales: availableLocales } = internationalization;\n\n const [currentLocale, setCurrentLocale] = useState(\n locale ?? localeCookie ?? defaultLocale\n );\n\n const setLocaleBase = useCallback(\n (newLocale: Locales) => {\n if (currentLocale.toString() === newLocale.toString()) return;\n\n if (!availableLocales.includes(newLocale)) {\n console.error(`Locale ${locale} is not available`);\n return;\n }\n\n setCurrentLocale(newLocale); // Update state\n setLocaleCookie(newLocale); // Optionally set cookie for persistence\n },\n [availableLocales, currentLocale, locale]\n );\n\n const setLocale = setLocaleProp ?? setLocaleBase;\n\n const value: IntlayerValue = useMemo<IntlayerValue>(\n () => ({ locale: currentLocale, setLocale: setLocale }),\n [currentLocale, setLocale]\n );\n\n const isEditorEnabled = Boolean(\n editor?.enabled && editor.clientId && editor.clientSecret && editorEnabled\n );\n\n return (\n <IntlayerClientContext.Provider value={value}>\n {isEditorEnabled ? (\n <ContentEditionLayout\n locale={currentLocale}\n setLocale={setLocale}\n localeList={availableLocales}\n editorEnabled={isEditorEnabled}\n >\n {children}\n </ContentEditionLayout>\n ) : (\n children\n )}\n </IntlayerClientContext.Provider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoFQ;AAlFR,oBAA+C;AAC/C,6BAAqC;AACrC,mBAQO;AACP,6BAA8C;AAUvC,MAAM,4BAAwB,4BAA6B;AAAA,EAChE,QAAQ,2CAAgB,gCAAiB,EAAE,qBAAqB;AAAA,EAChE,WAAW,MAAM;AACnB,CAAC;AAKM,MAAM,qBAAqB,UAAM,yBAAW,qBAAqB;AAWjE,MAAM,mBAA8C,CAAC;AAAA,EAC1D;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,gBAAgB;AAClB,MAAM;AACJ,QAAM,EAAE,sBAAsB,OAAO,QAAI,gCAAiB;AAC1D,QAAM,EAAE,eAAe,SAAS,iBAAiB,IAAI;AAErD,QAAM,CAAC,eAAe,gBAAgB,QAAI;AAAA,IACxC,UAAU,uCAAgB;AAAA,EAC5B;AAEA,QAAM,oBAAgB;AAAA,IACpB,CAAC,cAAuB;AACtB,UAAI,cAAc,SAAS,MAAM,UAAU,SAAS,EAAG;AAEvD,UAAI,CAAC,iBAAiB,SAAS,SAAS,GAAG;AACzC,gBAAQ,MAAM,UAAU,MAAM,mBAAmB;AACjD;AAAA,MACF;AAEA,uBAAiB,SAAS;AAC1B,kDAAgB,SAAS;AAAA,IAC3B;AAAA,IACA,CAAC,kBAAkB,eAAe,MAAM;AAAA,EAC1C;AAEA,QAAM,YAAY,iBAAiB;AAEnC,QAAM,YAAuB;AAAA,IAC3B,OAAO,EAAE,QAAQ,eAAe,UAAqB;AAAA,IACrD,CAAC,eAAe,SAAS;AAAA,EAC3B;AAEA,QAAM,kBAAkB;AAAA,IACtB,QAAQ,WAAW,OAAO,YAAY,OAAO,gBAAgB;AAAA,EAC/D;AAEA,SACE,4CAAC,sBAAsB,UAAtB,EAA+B,OAC7B,4BACC;AAAA,IAAC;AAAA;AAAA,MACC,QAAQ;AAAA,MACR;AAAA,MACA,YAAY;AAAA,MACZ,eAAe;AAAA,MAEd;AAAA;AAAA,EACH,IAEA,UAEJ;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/client/IntlayerProvider.tsx"],"sourcesContent":["'use client';\n\nimport { getConfiguration, type Locales } from '@intlayer/config/client';\nimport {\n type PropsWithChildren,\n createContext,\n useContext,\n useMemo,\n type FC,\n useState,\n useCallback,\n} from 'react';\nimport { localeCookie, setLocaleCookie } from './useLocaleCookie';\nimport { IntlayerEditorProvider } from '../editor/IntlayerEditorProvider';\n\ntype IntlayerValue = {\n locale: Locales;\n setLocale: (newLocale: Locales) => void;\n};\n\n/**\n * Context that store the current locale on the client side\n */\nexport const IntlayerClientContext = createContext<IntlayerValue>({\n locale: localeCookie ?? getConfiguration().internationalization.defaultLocale,\n setLocale: () => null,\n});\n\n/**\n * Hook that provides the current locale\n */\nexport const useIntlayerContext = () => useContext(IntlayerClientContext);\n\nexport type IntlayerProviderProps = PropsWithChildren & {\n locale?: Locales;\n setLocale?: (locale: Locales) => void;\n};\n\n/**\n * Provider that store the current locale on the client side\n */\nexport const IntlayerProvider: FC<IntlayerProviderProps> = ({\n locale,\n children,\n setLocale: setLocaleProp,\n}) => {\n const { internationalization } = getConfiguration();\n const { defaultLocale, locales: availableLocales } = internationalization;\n\n const [currentLocale, setCurrentLocale] = useState(\n locale ?? localeCookie ?? defaultLocale\n );\n\n const setLocaleBase = useCallback(\n (newLocale: Locales) => {\n if (currentLocale.toString() === newLocale.toString()) return;\n\n if (!availableLocales.includes(newLocale)) {\n console.error(`Locale ${locale} is not available`);\n return;\n }\n\n setCurrentLocale(newLocale); // Update state\n setLocaleCookie(newLocale); // Optionally set cookie for persistence\n },\n [availableLocales, currentLocale, locale]\n );\n\n const setLocale = setLocaleProp ?? setLocaleBase;\n\n const value: IntlayerValue = useMemo<IntlayerValue>(\n () => ({ locale: currentLocale, setLocale: setLocale }),\n [currentLocale, setLocale]\n );\n\n return (\n <IntlayerClientContext.Provider value={value}>\n <IntlayerEditorProvider>{children}</IntlayerEditorProvider>\n </IntlayerClientContext.Provider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA6EM;AA3EN,oBAA+C;AAC/C,mBAQO;AACP,6BAA8C;AAC9C,oCAAuC;AAUhC,MAAM,4BAAwB,4BAA6B;AAAA,EAChE,QAAQ,2CAAgB,gCAAiB,EAAE,qBAAqB;AAAA,EAChE,WAAW,MAAM;AACnB,CAAC;AAKM,MAAM,qBAAqB,UAAM,yBAAW,qBAAqB;AAUjE,MAAM,mBAA8C,CAAC;AAAA,EAC1D;AAAA,EACA;AAAA,EACA,WAAW;AACb,MAAM;AACJ,QAAM,EAAE,qBAAqB,QAAI,gCAAiB;AAClD,QAAM,EAAE,eAAe,SAAS,iBAAiB,IAAI;AAErD,QAAM,CAAC,eAAe,gBAAgB,QAAI;AAAA,IACxC,UAAU,uCAAgB;AAAA,EAC5B;AAEA,QAAM,oBAAgB;AAAA,IACpB,CAAC,cAAuB;AACtB,UAAI,cAAc,SAAS,MAAM,UAAU,SAAS,EAAG;AAEvD,UAAI,CAAC,iBAAiB,SAAS,SAAS,GAAG;AACzC,gBAAQ,MAAM,UAAU,MAAM,mBAAmB;AACjD;AAAA,MACF;AAEA,uBAAiB,SAAS;AAC1B,kDAAgB,SAAS;AAAA,IAC3B;AAAA,IACA,CAAC,kBAAkB,eAAe,MAAM;AAAA,EAC1C;AAEA,QAAM,YAAY,iBAAiB;AAEnC,QAAM,YAAuB;AAAA,IAC3B,OAAO,EAAE,QAAQ,eAAe,UAAqB;AAAA,IACrD,CAAC,eAAe,SAAS;AAAA,EAC3B;AAEA,SACE,4CAAC,sBAAsB,UAAtB,EAA+B,OAC9B,sDAAC,wDAAwB,UAAS,GACpC;AAEJ;","names":[]}
@@ -0,0 +1,57 @@
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 ContentSelectorConnector_exports = {};
21
+ __export(ContentSelectorConnector_exports, {
22
+ ContentSelectorConnector: () => ContentSelectorConnector,
23
+ ContentSelectorContext: () => ContentSelectorContext,
24
+ ContentSelectorProvider: () => ContentSelectorProvider,
25
+ useContentSelectorContext: () => useContentSelectorContext
26
+ });
27
+ module.exports = __toCommonJS(ContentSelectorConnector_exports);
28
+ var import_jsx_runtime = require("react/jsx-runtime");
29
+ var import_react = require("react");
30
+ var import_ContentSelectorWrapper = require('./ContentSelectorWrapper.cjs');
31
+ const ContentSelectorContext = (0, import_react.createContext)({
32
+ state: { ContentSelectorWrapper: import_ContentSelectorWrapper.ContentSelectorWrapper },
33
+ setState: () => {
34
+ }
35
+ });
36
+ const useContentSelectorContext = () => (0, import_react.useContext)(ContentSelectorContext);
37
+ const ContentSelectorProvider = ({
38
+ children
39
+ }) => {
40
+ const [state, setState] = (0, import_react.useState)({
41
+ // Add your default state here
42
+ ContentSelectorWrapper: import_ContentSelectorWrapper.ContentSelectorWrapper
43
+ });
44
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ContentSelectorContext.Provider, { value: { state, setState }, children });
45
+ };
46
+ const ContentSelectorConnector = (props) => {
47
+ const { ContentSelectorWrapper: ContentSelectorWrapper2 } = useContentSelectorContext().state;
48
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ContentSelectorWrapper2, { ...props });
49
+ };
50
+ // Annotate the CommonJS export names for ESM import in node:
51
+ 0 && (module.exports = {
52
+ ContentSelectorConnector,
53
+ ContentSelectorContext,
54
+ ContentSelectorProvider,
55
+ useContentSelectorContext
56
+ });
57
+ //# sourceMappingURL=ContentSelectorConnector.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/editor/ContentSelectorConnector.tsx"],"sourcesContent":["'use client';\n\nimport {\n createContext,\n FC,\n PropsWithChildren,\n useContext,\n useState,\n} from 'react';\nimport {\n ContentSelectorWrapper,\n ContentSelectorWrapperProps,\n} from './ContentSelectorWrapper';\n\ntype ContentSelectorContextValue = {\n state: {\n ContentSelectorWrapper: typeof ContentSelectorWrapper;\n };\n setState: (value: ContentSelectorContextValue['state']) => void;\n};\n\nexport const ContentSelectorContext =\n createContext<ContentSelectorContextValue>({\n state: { ContentSelectorWrapper },\n setState: () => {},\n });\n\nexport const useContentSelectorContext = () =>\n useContext(ContentSelectorContext);\n\nexport const ContentSelectorProvider: FC<PropsWithChildren> = ({\n children,\n}) => {\n const [state, setState] = useState({\n // Add your default state here\n ContentSelectorWrapper,\n });\n\n return (\n <ContentSelectorContext.Provider value={{ state, setState }}>\n {children}\n </ContentSelectorContext.Provider>\n );\n};\n\nexport const ContentSelectorConnector: FC<ContentSelectorWrapperProps> = (\n props\n) => {\n const { ContentSelectorWrapper } = useContentSelectorContext().state;\n\n return <ContentSelectorWrapper {...props} />;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAuCI;AArCJ,mBAMO;AACP,oCAGO;AASA,MAAM,6BACX,4BAA2C;AAAA,EACzC,OAAO,EAAE,6EAAuB;AAAA,EAChC,UAAU,MAAM;AAAA,EAAC;AACnB,CAAC;AAEI,MAAM,4BAA4B,UACvC,yBAAW,sBAAsB;AAE5B,MAAM,0BAAiD,CAAC;AAAA,EAC7D;AACF,MAAM;AACJ,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAS;AAAA;AAAA,IAEjC;AAAA,EACF,CAAC;AAED,SACE,4CAAC,uBAAuB,UAAvB,EAAgC,OAAO,EAAE,OAAO,SAAS,GACvD,UACH;AAEJ;AAEO,MAAM,2BAA4D,CACvE,UACG;AACH,QAAM,EAAE,wBAAAA,wBAAuB,IAAI,0BAA0B,EAAE;AAE/D,SAAO,4CAACA,yBAAA,EAAwB,GAAG,OAAO;AAC5C;","names":["ContentSelectorWrapper"]}
@@ -0,0 +1,33 @@
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 ContentSelectorWrapper_exports = {};
21
+ __export(ContentSelectorWrapper_exports, {
22
+ ContentSelectorWrapper: () => ContentSelectorWrapper
23
+ });
24
+ module.exports = __toCommonJS(ContentSelectorWrapper_exports);
25
+ var import_jsx_runtime = require("react/jsx-runtime");
26
+ const ContentSelectorWrapper = ({
27
+ children
28
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ ContentSelectorWrapper
32
+ });
33
+ //# sourceMappingURL=ContentSelectorWrapper.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/editor/ContentSelectorWrapper.tsx"],"sourcesContent":["'use client';\n\nimport { type KeyPath } from '@intlayer/core';\nimport { type FC, type ReactNode } from 'react';\n\nexport type ContentSelectorWrapperProps = {\n children: ReactNode;\n dictionaryId: string;\n dictionaryPath: string;\n keyPath: KeyPath[];\n};\n\nexport const ContentSelectorWrapper: FC<ContentSelectorWrapperProps> = ({\n children,\n}) => <>{children}</>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAcM;AAFC,MAAM,yBAA0D,CAAC;AAAA,EACtE;AACF,MAAM,2EAAG,UAAS;","names":[]}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var IntlayerEditorProvider_exports = {};
20
+ __export(IntlayerEditorProvider_exports, {
21
+ IntlayerEditorProvider: () => IntlayerEditorProvider
22
+ });
23
+ module.exports = __toCommonJS(IntlayerEditorProvider_exports);
24
+ var import_jsx_runtime = require("react/jsx-runtime");
25
+ var import_ContentSelectorConnector = require('./ContentSelectorConnector.cjs');
26
+ const IntlayerEditorProvider = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ContentSelectorConnector.ContentSelectorProvider, { children });
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ IntlayerEditorProvider
30
+ });
31
+ //# sourceMappingURL=IntlayerEditorProvider.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"sourcesContent":["import { FC, PropsWithChildren } from 'react';\nimport { ContentSelectorProvider } from './ContentSelectorConnector';\n\nexport const IntlayerEditorProvider: FC<PropsWithChildren> = ({ children }) => (\n <ContentSelectorProvider>{children}</ContentSelectorProvider>\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIE;AAHF,sCAAwC;AAEjC,MAAM,yBAAgD,CAAC,EAAE,SAAS,MACvE,4CAAC,2DAAyB,UAAS;","names":[]}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+ var editor_exports = {};
17
+ module.exports = __toCommonJS(editor_exports);
18
+ __reExport(editor_exports, require('./ContentSelectorWrapper.cjs'), module.exports);
19
+ __reExport(editor_exports, require('./ContentSelectorConnector.cjs'), module.exports);
20
+ __reExport(editor_exports, require('./renderContentEditor.cjs'), module.exports);
21
+ // Annotate the CommonJS export names for ESM import in node:
22
+ 0 && (module.exports = {
23
+ ...require('./ContentSelectorWrapper.cjs'),
24
+ ...require('./ContentSelectorConnector.cjs'),
25
+ ...require('./renderContentEditor.cjs')
26
+ });
27
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/editor/index.ts"],"sourcesContent":["export * from './ContentSelectorWrapper';\nexport * from './ContentSelectorConnector';\nexport * from './renderContentEditor';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,2BAAc,qCAAd;AACA,2BAAc,uCADd;AAEA,2BAAc,kCAFd;","names":[]}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var renderContentEditor_exports = {};
20
+ __export(renderContentEditor_exports, {
21
+ renderIntlayerEditor: () => renderIntlayerEditor
22
+ });
23
+ module.exports = __toCommonJS(renderContentEditor_exports);
24
+ var import_jsx_runtime = require("react/jsx-runtime");
25
+ var import_client = require("@intlayer/config/client");
26
+ var import_ContentSelectorConnector = require('./ContentSelectorConnector.cjs');
27
+ const {
28
+ editor: { enabled }
29
+ } = (0, import_client.getConfiguration)();
30
+ const IntlayerEditorElement = ({
31
+ content,
32
+ isContentSelectable,
33
+ ...props
34
+ }) => {
35
+ if (enabled && isContentSelectable) {
36
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ContentSelectorConnector.ContentSelectorConnector, { ...props, children: content });
37
+ }
38
+ return content;
39
+ };
40
+ const renderIntlayerEditor = (data, isContentSelectable) => {
41
+ const Result = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
42
+ IntlayerEditorElement,
43
+ {
44
+ ...data,
45
+ isContentSelectable
46
+ }
47
+ );
48
+ return { ...Result, value: data.content };
49
+ };
50
+ // Annotate the CommonJS export names for ESM import in node:
51
+ 0 && (module.exports = {
52
+ renderIntlayerEditor
53
+ });
54
+ //# sourceMappingURL=renderContentEditor.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/editor/renderContentEditor.tsx"],"sourcesContent":["import { getConfiguration } from '@intlayer/config/client';\nimport type { KeyPath } from '@intlayer/core';\nimport type { FC, ReactNode } from 'react';\nimport { ContentSelectorConnector } from './ContentSelectorConnector';\n\nconst {\n editor: { enabled },\n} = getConfiguration();\n\nexport type IntlayerEditorElementProps = {\n content: string;\n dictionaryId: string;\n dictionaryPath: string;\n keyPath: KeyPath[];\n isContentSelectable: boolean;\n};\n\nconst IntlayerEditorElement: FC<IntlayerEditorElementProps> = ({\n content,\n isContentSelectable,\n ...props\n}) => {\n if (enabled && isContentSelectable) {\n return (\n <ContentSelectorConnector {...props}>{content}</ContentSelectorConnector>\n );\n }\n return content;\n};\n\nexport type RenderIntlayerEditorResult = ReactNode & { value: string };\n\nexport const renderIntlayerEditor = (\n data: IntlayerEditorElementProps,\n isContentSelectable: boolean\n): RenderIntlayerEditorResult => {\n const Result = (\n <IntlayerEditorElement\n {...data}\n isContentSelectable={isContentSelectable}\n />\n );\n\n return { ...Result, value: data.content };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBM;AAxBN,oBAAiC;AAGjC,sCAAyC;AAEzC,MAAM;AAAA,EACJ,QAAQ,EAAE,QAAQ;AACpB,QAAI,gCAAiB;AAUrB,MAAM,wBAAwD,CAAC;AAAA,EAC7D;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,MAAI,WAAW,qBAAqB;AAClC,WACE,4CAAC,4DAA0B,GAAG,OAAQ,mBAAQ;AAAA,EAElD;AACA,SAAO;AACT;AAIO,MAAM,uBAAuB,CAClC,MACA,wBAC+B;AAC/B,QAAM,SACJ;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA;AAAA,EACF;AAGF,SAAO,EAAE,GAAG,QAAQ,OAAO,KAAK,QAAQ;AAC1C;","names":[]}
@@ -27,6 +27,7 @@ __export(src_exports, {
27
27
  t: () => import_client.t,
28
28
  useDictionary: () => import_client.useDictionary,
29
29
  useIntlayer: () => import_client.useIntlayer,
30
+ useIntlayerContext: () => import_client.useIntlayerContext,
30
31
  useLocale: () => import_client.useLocale,
31
32
  useLocaleBase: () => import_client.useLocaleBase,
32
33
  useLocaleCookie: () => import_client.useLocaleCookie,
@@ -46,6 +47,7 @@ var import_client = require('./client/index.cjs');
46
47
  t,
47
48
  useDictionary,
48
49
  useIntlayer,
50
+ useIntlayerContext,
49
51
  useLocale,
50
52
  useLocaleBase,
51
53
  useLocaleCookie,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export { getTranslation } from './getTranslation';\nexport {\n IntlayerProvider,\n type IntlayerProviderProps,\n IntlayerClientContext,\n useIntlayer,\n useDictionary,\n useLocale,\n useTraduction,\n useLocaleCookie,\n localeCookie,\n setLocaleCookie,\n getBrowserLocale,\n useLocaleBase,\n t,\n} from './client/index';\nexport { type IntlayerNode } from './useDictionaryBase';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA+B;AAC/B,oBAcO;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export { getTranslation } from './getTranslation';\nexport {\n IntlayerProvider,\n type IntlayerProviderProps,\n IntlayerClientContext,\n useIntlayer,\n useDictionary,\n useLocale,\n useTraduction,\n useLocaleCookie,\n useIntlayerContext,\n localeCookie,\n setLocaleCookie,\n getBrowserLocale,\n useLocaleBase,\n t,\n} from './client/index';\nexport { type IntlayerNode } from './useDictionaryBase';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA+B;AAC/B,oBAeO;","names":[]}
@@ -22,15 +22,15 @@ __export(useDictionaryBase_exports, {
22
22
  useDictionaryBase: () => useDictionaryBase
23
23
  });
24
24
  module.exports = __toCommonJS(useDictionaryBase_exports);
25
- var import_intlayer_editor = require("intlayer-editor");
26
25
  var import_react = require("react");
27
26
  var import_processDictionary = require('./processDictionary/index.cjs');
27
+ var import_renderContentEditor = require('./editor/renderContentEditor.cjs');
28
28
  const recursiveTransformContent = (value, isContentSelectable = false) => {
29
29
  if (typeof value === "function") {
30
30
  return (props) => recursiveTransformContent(value(props), isContentSelectable);
31
31
  } else if (typeof value === "object") {
32
32
  if (typeof value.dictionaryId !== "undefined") {
33
- return (0, import_intlayer_editor.renderIntlayerEditor)(value, isContentSelectable);
33
+ return (0, import_renderContentEditor.renderIntlayerEditor)(value, isContentSelectable);
34
34
  } else if (Array.isArray(value)) {
35
35
  return value.map(
36
36
  (el) => recursiveTransformContent(el, isContentSelectable)
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/useDictionaryBase.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { Locales } from '@intlayer/config';\nimport type {\n DeclarationContent,\n DictionaryValue,\n NodeType,\n} from '@intlayer/core';\nimport { renderIntlayerEditor } from 'intlayer-editor';\nimport { isValidElement, type ReactNode } from 'react';\nimport { processDictionary } from './processDictionary/index';\n\nexport type IntlayerNode<T = string> = ReactNode & {\n value: T;\n};\n\ntype TransformNodeType<T, L extends Locales> = T extends {\n [NodeType.Enumeration]: { '1': any };\n}\n ? (quantity: number) => DeepTransformContent<T[NodeType.Enumeration]['1'], L>\n : T extends {\n [NodeType.Translation]: object;\n }\n ? L extends keyof T[NodeType.Translation]\n ? DeepTransformContent<T[NodeType.Translation][L], L>\n : never\n : T;\n\nexport type DeepTransformContent<T, L extends Locales> = T extends object // Check if the property is an object\n ? T extends (infer U)[] // If it's an array, infer the type of array elements\n ? DeepTransformContent<U, L>[] // Apply DeepTransformContent recursively to each element of the array\n : T extends {\n nodeType: NodeType | string;\n }\n ? TransformNodeType<T, L>\n : T extends { _owner: any; key: any; props: any; ref: any }\n ? ReactNode\n : {\n [K in keyof T]: DeepTransformContent<T[K], L>;\n }\n : T extends undefined\n ? never\n : IntlayerNode<T>;\n\n/**\n * Go through the object. If a object has a keyPath, render the intlayer editor if editor enabled.\n */\nexport const recursiveTransformContent = (\n value: any,\n isContentSelectable = false\n): object => {\n if (typeof value === 'function') {\n return (props: any) =>\n recursiveTransformContent(value(props), isContentSelectable);\n } else if (typeof value === 'object') {\n if (typeof value.dictionaryId !== 'undefined') {\n return renderIntlayerEditor(value, isContentSelectable);\n } else if (Array.isArray(value)) {\n return value.map((el) =>\n recursiveTransformContent(el, isContentSelectable)\n );\n } else if (isValidElement(value)) {\n return value;\n }\n\n return Object.entries(value).reduce(\n (acc, [key, value]) => ({\n ...acc,\n [key]: recursiveTransformContent(value, isContentSelectable),\n }),\n {} as object\n );\n }\n\n return value;\n};\n\ntype DataFromDictionary<\n T extends DeclarationContent,\n K extends Locales,\n> = DeepTransformContent<T['content'], K>;\n\nexport type UseDictionary = <T extends DeclarationContent, L extends Locales>(\n dictionary: T,\n locale?: L\n) => DataFromDictionary<T, L>;\n\n// Add description is JSDoc\n/**\n * Hook that picks one dictionary by its id and return the content\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const useDictionaryBase: UseDictionary = <\n T extends DeclarationContent,\n L extends Locales,\n>(\n dictionary: T,\n locale?: L,\n isContentSelectable = false\n) => {\n const result = processDictionary(\n dictionary.content as DictionaryValue,\n dictionary.key,\n dictionary.filePath,\n [],\n locale\n );\n\n return recursiveTransformContent(\n result,\n isContentSelectable\n ) as DataFromDictionary<T, L>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,6BAAqC;AACrC,mBAA+C;AAC/C,+BAAkC;AAqC3B,MAAM,4BAA4B,CACvC,OACA,sBAAsB,UACX;AACX,MAAI,OAAO,UAAU,YAAY;AAC/B,WAAO,CAAC,UACN,0BAA0B,MAAM,KAAK,GAAG,mBAAmB;AAAA,EAC/D,WAAW,OAAO,UAAU,UAAU;AACpC,QAAI,OAAO,MAAM,iBAAiB,aAAa;AAC7C,iBAAO,6CAAqB,OAAO,mBAAmB;AAAA,IACxD,WAAW,MAAM,QAAQ,KAAK,GAAG;AAC/B,aAAO,MAAM;AAAA,QAAI,CAAC,OAChB,0BAA0B,IAAI,mBAAmB;AAAA,MACnD;AAAA,IACF,eAAW,6BAAe,KAAK,GAAG;AAChC,aAAO;AAAA,IACT;AAEA,WAAO,OAAO,QAAQ,KAAK,EAAE;AAAA,MAC3B,CAAC,KAAK,CAAC,KAAKA,MAAK,OAAO;AAAA,QACtB,GAAG;AAAA,QACH,CAAC,GAAG,GAAG,0BAA0BA,QAAO,mBAAmB;AAAA,MAC7D;AAAA,MACA,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AACT;AAkBO,MAAM,oBAAmC,CAI9C,YACA,QACA,sBAAsB,UACnB;AACH,QAAM,aAAS;AAAA,IACb,WAAW;AAAA,IACX,WAAW;AAAA,IACX,WAAW;AAAA,IACX,CAAC;AAAA,IACD;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;","names":["value"]}
1
+ {"version":3,"sources":["../../src/useDictionaryBase.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { Locales } from '@intlayer/config';\nimport type {\n DeclarationContent,\n DictionaryValue,\n NodeType,\n} from '@intlayer/core';\nimport { isValidElement, type ReactNode } from 'react';\nimport { processDictionary } from './processDictionary/index';\nimport { renderIntlayerEditor } from './editor/renderContentEditor';\n\nexport type IntlayerNode<T = string> = ReactNode & {\n value: T;\n};\n\ntype TransformNodeType<T, L extends Locales> = T extends {\n [NodeType.Enumeration]: { '1': any };\n}\n ? (quantity: number) => DeepTransformContent<T[NodeType.Enumeration]['1'], L>\n : T extends {\n [NodeType.Translation]: object;\n }\n ? L extends keyof T[NodeType.Translation]\n ? DeepTransformContent<T[NodeType.Translation][L], L>\n : never\n : T;\n\nexport type DeepTransformContent<T, L extends Locales> = T extends object // Check if the property is an object\n ? T extends (infer U)[] // If it's an array, infer the type of array elements\n ? DeepTransformContent<U, L>[] // Apply DeepTransformContent recursively to each element of the array\n : T extends {\n nodeType: NodeType | string;\n }\n ? TransformNodeType<T, L>\n : T extends { _owner: any; key: any; props: any; ref: any }\n ? ReactNode\n : {\n [K in keyof T]: DeepTransformContent<T[K], L>;\n }\n : T extends undefined\n ? never\n : IntlayerNode<T>;\n\n/**\n * Go through the object. If a object has a keyPath, render the intlayer editor if editor enabled.\n */\nexport const recursiveTransformContent = (\n value: any,\n isContentSelectable = false\n): object => {\n if (typeof value === 'function') {\n return (props: any) =>\n recursiveTransformContent(value(props), isContentSelectable);\n } else if (typeof value === 'object') {\n if (typeof value.dictionaryId !== 'undefined') {\n return renderIntlayerEditor(value, isContentSelectable);\n } else if (Array.isArray(value)) {\n return value.map((el) =>\n recursiveTransformContent(el, isContentSelectable)\n );\n } else if (isValidElement(value)) {\n return value;\n }\n\n return Object.entries(value).reduce(\n (acc, [key, value]) => ({\n ...acc,\n [key]: recursiveTransformContent(value, isContentSelectable),\n }),\n {} as object\n );\n }\n\n return value;\n};\n\ntype DataFromDictionary<\n T extends DeclarationContent,\n K extends Locales,\n> = DeepTransformContent<T['content'], K>;\n\nexport type UseDictionary = <T extends DeclarationContent, L extends Locales>(\n dictionary: T,\n locale?: L\n) => DataFromDictionary<T, L>;\n\n// Add description is JSDoc\n/**\n * Hook that picks one dictionary by its id and return the content\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const useDictionaryBase: UseDictionary = <\n T extends DeclarationContent,\n L extends Locales,\n>(\n dictionary: T,\n locale?: L,\n isContentSelectable = false\n) => {\n const result = processDictionary(\n dictionary.content as DictionaryValue,\n dictionary.key,\n dictionary.filePath,\n [],\n locale\n );\n\n return recursiveTransformContent(\n result,\n isContentSelectable\n ) as DataFromDictionary<T, L>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,mBAA+C;AAC/C,+BAAkC;AAClC,iCAAqC;AAqC9B,MAAM,4BAA4B,CACvC,OACA,sBAAsB,UACX;AACX,MAAI,OAAO,UAAU,YAAY;AAC/B,WAAO,CAAC,UACN,0BAA0B,MAAM,KAAK,GAAG,mBAAmB;AAAA,EAC/D,WAAW,OAAO,UAAU,UAAU;AACpC,QAAI,OAAO,MAAM,iBAAiB,aAAa;AAC7C,iBAAO,iDAAqB,OAAO,mBAAmB;AAAA,IACxD,WAAW,MAAM,QAAQ,KAAK,GAAG;AAC/B,aAAO,MAAM;AAAA,QAAI,CAAC,OAChB,0BAA0B,IAAI,mBAAmB;AAAA,MACnD;AAAA,IACF,eAAW,6BAAe,KAAK,GAAG;AAChC,aAAO;AAAA,IACT;AAEA,WAAO,OAAO,QAAQ,KAAK,EAAE;AAAA,MAC3B,CAAC,KAAK,CAAC,KAAKA,MAAK,OAAO;AAAA,QACtB,GAAG;AAAA,QACH,CAAC,GAAG,GAAG,0BAA0BA,QAAO,mBAAmB;AAAA,MAC7D;AAAA,MACA,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AACT;AAkBO,MAAM,oBAAmC,CAI9C,YACA,QACA,sBAAsB,UACnB;AACH,QAAM,aAAS;AAAA,IACb,WAAW;AAAA,IACX,WAAW;AAAA,IACX,WAAW;AAAA,IACX,CAAC;AAAA,IACD;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;","names":["value"]}
@@ -2,7 +2,6 @@
2
2
  import "../chunk-ZD7AOCMD.mjs";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  import { getConfiguration } from "@intlayer/config/client";
5
- import { ContentEditionLayout } from "intlayer-editor";
6
5
  import {
7
6
  createContext,
8
7
  useContext,
@@ -11,6 +10,7 @@ import {
11
10
  useCallback
12
11
  } from "react";
13
12
  import { localeCookie, setLocaleCookie } from './useLocaleCookie.mjs';
13
+ import { IntlayerEditorProvider } from '../editor/IntlayerEditorProvider.mjs';
14
14
  const IntlayerClientContext = createContext({
15
15
  locale: localeCookie ?? getConfiguration().internationalization.defaultLocale,
16
16
  setLocale: () => null
@@ -19,10 +19,9 @@ const useIntlayerContext = () => useContext(IntlayerClientContext);
19
19
  const IntlayerProvider = ({
20
20
  locale,
21
21
  children,
22
- setLocale: setLocaleProp,
23
- editorEnabled = true
22
+ setLocale: setLocaleProp
24
23
  }) => {
25
- const { internationalization, editor } = getConfiguration();
24
+ const { internationalization } = getConfiguration();
26
25
  const { defaultLocale, locales: availableLocales } = internationalization;
27
26
  const [currentLocale, setCurrentLocale] = useState(
28
27
  locale ?? localeCookie ?? defaultLocale
@@ -44,19 +43,7 @@ const IntlayerProvider = ({
44
43
  () => ({ locale: currentLocale, setLocale }),
45
44
  [currentLocale, setLocale]
46
45
  );
47
- const isEditorEnabled = Boolean(
48
- editor?.enabled && editor.clientId && editor.clientSecret && editorEnabled
49
- );
50
- return /* @__PURE__ */ jsx(IntlayerClientContext.Provider, { value, children: isEditorEnabled ? /* @__PURE__ */ jsx(
51
- ContentEditionLayout,
52
- {
53
- locale: currentLocale,
54
- setLocale,
55
- localeList: availableLocales,
56
- editorEnabled: isEditorEnabled,
57
- children
58
- }
59
- ) : children });
46
+ return /* @__PURE__ */ jsx(IntlayerClientContext.Provider, { value, children: /* @__PURE__ */ jsx(IntlayerEditorProvider, { children }) });
60
47
  };
61
48
  export {
62
49
  IntlayerClientContext,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/IntlayerProvider.tsx"],"sourcesContent":["'use client';\n\nimport { getConfiguration, type Locales } from '@intlayer/config/client';\nimport { ContentEditionLayout } from 'intlayer-editor';\nimport {\n type PropsWithChildren,\n createContext,\n useContext,\n useMemo,\n type FC,\n useState,\n useCallback,\n} from 'react';\nimport { localeCookie, setLocaleCookie } from './useLocaleCookie';\n\ntype IntlayerValue = {\n locale: Locales;\n setLocale: (newLocale: Locales) => void;\n};\n\n/**\n * Context that store the current locale on the client side\n */\nexport const IntlayerClientContext = createContext<IntlayerValue>({\n locale: localeCookie ?? getConfiguration().internationalization.defaultLocale,\n setLocale: () => null,\n});\n\n/**\n * Hook that provides the current locale\n */\nexport const useIntlayerContext = () => useContext(IntlayerClientContext);\n\nexport type IntlayerProviderProps = PropsWithChildren & {\n locale?: Locales;\n setLocale?: (locale: Locales) => void;\n editorEnabled?: boolean;\n};\n\n/**\n * Provider that store the current locale on the client side\n */\nexport const IntlayerProvider: FC<IntlayerProviderProps> = ({\n locale,\n children,\n setLocale: setLocaleProp,\n editorEnabled = true,\n}) => {\n const { internationalization, editor } = getConfiguration();\n const { defaultLocale, locales: availableLocales } = internationalization;\n\n const [currentLocale, setCurrentLocale] = useState(\n locale ?? localeCookie ?? defaultLocale\n );\n\n const setLocaleBase = useCallback(\n (newLocale: Locales) => {\n if (currentLocale.toString() === newLocale.toString()) return;\n\n if (!availableLocales.includes(newLocale)) {\n console.error(`Locale ${locale} is not available`);\n return;\n }\n\n setCurrentLocale(newLocale); // Update state\n setLocaleCookie(newLocale); // Optionally set cookie for persistence\n },\n [availableLocales, currentLocale, locale]\n );\n\n const setLocale = setLocaleProp ?? setLocaleBase;\n\n const value: IntlayerValue = useMemo<IntlayerValue>(\n () => ({ locale: currentLocale, setLocale: setLocale }),\n [currentLocale, setLocale]\n );\n\n const isEditorEnabled = Boolean(\n editor?.enabled && editor.clientId && editor.clientSecret && editorEnabled\n );\n\n return (\n <IntlayerClientContext.Provider value={value}>\n {isEditorEnabled ? (\n <ContentEditionLayout\n locale={currentLocale}\n setLocale={setLocale}\n localeList={availableLocales}\n editorEnabled={isEditorEnabled}\n >\n {children}\n </ContentEditionLayout>\n ) : (\n children\n )}\n </IntlayerClientContext.Provider>\n );\n};\n"],"mappings":";;AAoFQ;AAlFR,SAAS,wBAAsC;AAC/C,SAAS,4BAA4B;AACrC;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,OACK;AACP,SAAS,cAAc,uBAAuB;AAUvC,MAAM,wBAAwB,cAA6B;AAAA,EAChE,QAAQ,gBAAgB,iBAAiB,EAAE,qBAAqB;AAAA,EAChE,WAAW,MAAM;AACnB,CAAC;AAKM,MAAM,qBAAqB,MAAM,WAAW,qBAAqB;AAWjE,MAAM,mBAA8C,CAAC;AAAA,EAC1D;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,gBAAgB;AAClB,MAAM;AACJ,QAAM,EAAE,sBAAsB,OAAO,IAAI,iBAAiB;AAC1D,QAAM,EAAE,eAAe,SAAS,iBAAiB,IAAI;AAErD,QAAM,CAAC,eAAe,gBAAgB,IAAI;AAAA,IACxC,UAAU,gBAAgB;AAAA,EAC5B;AAEA,QAAM,gBAAgB;AAAA,IACpB,CAAC,cAAuB;AACtB,UAAI,cAAc,SAAS,MAAM,UAAU,SAAS,EAAG;AAEvD,UAAI,CAAC,iBAAiB,SAAS,SAAS,GAAG;AACzC,gBAAQ,MAAM,UAAU,MAAM,mBAAmB;AACjD;AAAA,MACF;AAEA,uBAAiB,SAAS;AAC1B,sBAAgB,SAAS;AAAA,IAC3B;AAAA,IACA,CAAC,kBAAkB,eAAe,MAAM;AAAA,EAC1C;AAEA,QAAM,YAAY,iBAAiB;AAEnC,QAAM,QAAuB;AAAA,IAC3B,OAAO,EAAE,QAAQ,eAAe,UAAqB;AAAA,IACrD,CAAC,eAAe,SAAS;AAAA,EAC3B;AAEA,QAAM,kBAAkB;AAAA,IACtB,QAAQ,WAAW,OAAO,YAAY,OAAO,gBAAgB;AAAA,EAC/D;AAEA,SACE,oBAAC,sBAAsB,UAAtB,EAA+B,OAC7B,4BACC;AAAA,IAAC;AAAA;AAAA,MACC,QAAQ;AAAA,MACR;AAAA,MACA,YAAY;AAAA,MACZ,eAAe;AAAA,MAEd;AAAA;AAAA,EACH,IAEA,UAEJ;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/client/IntlayerProvider.tsx"],"sourcesContent":["'use client';\n\nimport { getConfiguration, type Locales } from '@intlayer/config/client';\nimport {\n type PropsWithChildren,\n createContext,\n useContext,\n useMemo,\n type FC,\n useState,\n useCallback,\n} from 'react';\nimport { localeCookie, setLocaleCookie } from './useLocaleCookie';\nimport { IntlayerEditorProvider } from '../editor/IntlayerEditorProvider';\n\ntype IntlayerValue = {\n locale: Locales;\n setLocale: (newLocale: Locales) => void;\n};\n\n/**\n * Context that store the current locale on the client side\n */\nexport const IntlayerClientContext = createContext<IntlayerValue>({\n locale: localeCookie ?? getConfiguration().internationalization.defaultLocale,\n setLocale: () => null,\n});\n\n/**\n * Hook that provides the current locale\n */\nexport const useIntlayerContext = () => useContext(IntlayerClientContext);\n\nexport type IntlayerProviderProps = PropsWithChildren & {\n locale?: Locales;\n setLocale?: (locale: Locales) => void;\n};\n\n/**\n * Provider that store the current locale on the client side\n */\nexport const IntlayerProvider: FC<IntlayerProviderProps> = ({\n locale,\n children,\n setLocale: setLocaleProp,\n}) => {\n const { internationalization } = getConfiguration();\n const { defaultLocale, locales: availableLocales } = internationalization;\n\n const [currentLocale, setCurrentLocale] = useState(\n locale ?? localeCookie ?? defaultLocale\n );\n\n const setLocaleBase = useCallback(\n (newLocale: Locales) => {\n if (currentLocale.toString() === newLocale.toString()) return;\n\n if (!availableLocales.includes(newLocale)) {\n console.error(`Locale ${locale} is not available`);\n return;\n }\n\n setCurrentLocale(newLocale); // Update state\n setLocaleCookie(newLocale); // Optionally set cookie for persistence\n },\n [availableLocales, currentLocale, locale]\n );\n\n const setLocale = setLocaleProp ?? setLocaleBase;\n\n const value: IntlayerValue = useMemo<IntlayerValue>(\n () => ({ locale: currentLocale, setLocale: setLocale }),\n [currentLocale, setLocale]\n );\n\n return (\n <IntlayerClientContext.Provider value={value}>\n <IntlayerEditorProvider>{children}</IntlayerEditorProvider>\n </IntlayerClientContext.Provider>\n );\n};\n"],"mappings":";;AA6EM;AA3EN,SAAS,wBAAsC;AAC/C;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,OACK;AACP,SAAS,cAAc,uBAAuB;AAC9C,SAAS,8BAA8B;AAUhC,MAAM,wBAAwB,cAA6B;AAAA,EAChE,QAAQ,gBAAgB,iBAAiB,EAAE,qBAAqB;AAAA,EAChE,WAAW,MAAM;AACnB,CAAC;AAKM,MAAM,qBAAqB,MAAM,WAAW,qBAAqB;AAUjE,MAAM,mBAA8C,CAAC;AAAA,EAC1D;AAAA,EACA;AAAA,EACA,WAAW;AACb,MAAM;AACJ,QAAM,EAAE,qBAAqB,IAAI,iBAAiB;AAClD,QAAM,EAAE,eAAe,SAAS,iBAAiB,IAAI;AAErD,QAAM,CAAC,eAAe,gBAAgB,IAAI;AAAA,IACxC,UAAU,gBAAgB;AAAA,EAC5B;AAEA,QAAM,gBAAgB;AAAA,IACpB,CAAC,cAAuB;AACtB,UAAI,cAAc,SAAS,MAAM,UAAU,SAAS,EAAG;AAEvD,UAAI,CAAC,iBAAiB,SAAS,SAAS,GAAG;AACzC,gBAAQ,MAAM,UAAU,MAAM,mBAAmB;AACjD;AAAA,MACF;AAEA,uBAAiB,SAAS;AAC1B,sBAAgB,SAAS;AAAA,IAC3B;AAAA,IACA,CAAC,kBAAkB,eAAe,MAAM;AAAA,EAC1C;AAEA,QAAM,YAAY,iBAAiB;AAEnC,QAAM,QAAuB;AAAA,IAC3B,OAAO,EAAE,QAAQ,eAAe,UAAqB;AAAA,IACrD,CAAC,eAAe,SAAS;AAAA,EAC3B;AAEA,SACE,oBAAC,sBAAsB,UAAtB,EAA+B,OAC9B,8BAAC,0BAAwB,UAAS,GACpC;AAEJ;","names":[]}
@@ -0,0 +1,37 @@
1
+ "use client";
2
+ import "../chunk-ZD7AOCMD.mjs";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import {
5
+ createContext,
6
+ useContext,
7
+ useState
8
+ } from "react";
9
+ import {
10
+ ContentSelectorWrapper
11
+ } from './ContentSelectorWrapper.mjs';
12
+ const ContentSelectorContext = createContext({
13
+ state: { ContentSelectorWrapper },
14
+ setState: () => {
15
+ }
16
+ });
17
+ const useContentSelectorContext = () => useContext(ContentSelectorContext);
18
+ const ContentSelectorProvider = ({
19
+ children
20
+ }) => {
21
+ const [state, setState] = useState({
22
+ // Add your default state here
23
+ ContentSelectorWrapper
24
+ });
25
+ return /* @__PURE__ */ jsx(ContentSelectorContext.Provider, { value: { state, setState }, children });
26
+ };
27
+ const ContentSelectorConnector = (props) => {
28
+ const { ContentSelectorWrapper: ContentSelectorWrapper2 } = useContentSelectorContext().state;
29
+ return /* @__PURE__ */ jsx(ContentSelectorWrapper2, { ...props });
30
+ };
31
+ export {
32
+ ContentSelectorConnector,
33
+ ContentSelectorContext,
34
+ ContentSelectorProvider,
35
+ useContentSelectorContext
36
+ };
37
+ //# sourceMappingURL=ContentSelectorConnector.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/editor/ContentSelectorConnector.tsx"],"sourcesContent":["'use client';\n\nimport {\n createContext,\n FC,\n PropsWithChildren,\n useContext,\n useState,\n} from 'react';\nimport {\n ContentSelectorWrapper,\n ContentSelectorWrapperProps,\n} from './ContentSelectorWrapper';\n\ntype ContentSelectorContextValue = {\n state: {\n ContentSelectorWrapper: typeof ContentSelectorWrapper;\n };\n setState: (value: ContentSelectorContextValue['state']) => void;\n};\n\nexport const ContentSelectorContext =\n createContext<ContentSelectorContextValue>({\n state: { ContentSelectorWrapper },\n setState: () => {},\n });\n\nexport const useContentSelectorContext = () =>\n useContext(ContentSelectorContext);\n\nexport const ContentSelectorProvider: FC<PropsWithChildren> = ({\n children,\n}) => {\n const [state, setState] = useState({\n // Add your default state here\n ContentSelectorWrapper,\n });\n\n return (\n <ContentSelectorContext.Provider value={{ state, setState }}>\n {children}\n </ContentSelectorContext.Provider>\n );\n};\n\nexport const ContentSelectorConnector: FC<ContentSelectorWrapperProps> = (\n props\n) => {\n const { ContentSelectorWrapper } = useContentSelectorContext().state;\n\n return <ContentSelectorWrapper {...props} />;\n};\n"],"mappings":";;AAuCI;AArCJ;AAAA,EACE;AAAA,EAGA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,OAEK;AASA,MAAM,yBACX,cAA2C;AAAA,EACzC,OAAO,EAAE,uBAAuB;AAAA,EAChC,UAAU,MAAM;AAAA,EAAC;AACnB,CAAC;AAEI,MAAM,4BAA4B,MACvC,WAAW,sBAAsB;AAE5B,MAAM,0BAAiD,CAAC;AAAA,EAC7D;AACF,MAAM;AACJ,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS;AAAA;AAAA,IAEjC;AAAA,EACF,CAAC;AAED,SACE,oBAAC,uBAAuB,UAAvB,EAAgC,OAAO,EAAE,OAAO,SAAS,GACvD,UACH;AAEJ;AAEO,MAAM,2BAA4D,CACvE,UACG;AACH,QAAM,EAAE,wBAAAA,wBAAuB,IAAI,0BAA0B,EAAE;AAE/D,SAAO,oBAACA,yBAAA,EAAwB,GAAG,OAAO;AAC5C;","names":["ContentSelectorWrapper"]}
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import "../chunk-ZD7AOCMD.mjs";
3
+ import { Fragment, jsx } from "react/jsx-runtime";
4
+ const ContentSelectorWrapper = ({
5
+ children
6
+ }) => /* @__PURE__ */ jsx(Fragment, { children });
7
+ export {
8
+ ContentSelectorWrapper
9
+ };
10
+ //# sourceMappingURL=ContentSelectorWrapper.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/editor/ContentSelectorWrapper.tsx"],"sourcesContent":["'use client';\n\nimport { type KeyPath } from '@intlayer/core';\nimport { type FC, type ReactNode } from 'react';\n\nexport type ContentSelectorWrapperProps = {\n children: ReactNode;\n dictionaryId: string;\n dictionaryPath: string;\n keyPath: KeyPath[];\n};\n\nexport const ContentSelectorWrapper: FC<ContentSelectorWrapperProps> = ({\n children,\n}) => <>{children}</>;\n"],"mappings":";;AAcM;AAFC,MAAM,yBAA0D,CAAC;AAAA,EACtE;AACF,MAAM,gCAAG,UAAS;","names":[]}
@@ -0,0 +1,8 @@
1
+ import "../chunk-ZD7AOCMD.mjs";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { ContentSelectorProvider } from './ContentSelectorConnector.mjs';
4
+ const IntlayerEditorProvider = ({ children }) => /* @__PURE__ */ jsx(ContentSelectorProvider, { children });
5
+ export {
6
+ IntlayerEditorProvider
7
+ };
8
+ //# sourceMappingURL=IntlayerEditorProvider.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"sourcesContent":["import { FC, PropsWithChildren } from 'react';\nimport { ContentSelectorProvider } from './ContentSelectorConnector';\n\nexport const IntlayerEditorProvider: FC<PropsWithChildren> = ({ children }) => (\n <ContentSelectorProvider>{children}</ContentSelectorProvider>\n);\n"],"mappings":";AAIE;AAHF,SAAS,+BAA+B;AAEjC,MAAM,yBAAgD,CAAC,EAAE,SAAS,MACvE,oBAAC,2BAAyB,UAAS;","names":[]}
@@ -0,0 +1,4 @@
1
+ export * from './ContentSelectorWrapper.mjs';
2
+ export * from './ContentSelectorConnector.mjs';
3
+ export * from './renderContentEditor.mjs';
4
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/editor/index.ts"],"sourcesContent":["export * from './ContentSelectorWrapper';\nexport * from './ContentSelectorConnector';\nexport * from './renderContentEditor';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
@@ -0,0 +1,31 @@
1
+ import "../chunk-ZD7AOCMD.mjs";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { getConfiguration } from "@intlayer/config/client";
4
+ import { ContentSelectorConnector } from './ContentSelectorConnector.mjs';
5
+ const {
6
+ editor: { enabled }
7
+ } = getConfiguration();
8
+ const IntlayerEditorElement = ({
9
+ content,
10
+ isContentSelectable,
11
+ ...props
12
+ }) => {
13
+ if (enabled && isContentSelectable) {
14
+ return /* @__PURE__ */ jsx(ContentSelectorConnector, { ...props, children: content });
15
+ }
16
+ return content;
17
+ };
18
+ const renderIntlayerEditor = (data, isContentSelectable) => {
19
+ const Result = /* @__PURE__ */ jsx(
20
+ IntlayerEditorElement,
21
+ {
22
+ ...data,
23
+ isContentSelectable
24
+ }
25
+ );
26
+ return { ...Result, value: data.content };
27
+ };
28
+ export {
29
+ renderIntlayerEditor
30
+ };
31
+ //# sourceMappingURL=renderContentEditor.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/editor/renderContentEditor.tsx"],"sourcesContent":["import { getConfiguration } from '@intlayer/config/client';\nimport type { KeyPath } from '@intlayer/core';\nimport type { FC, ReactNode } from 'react';\nimport { ContentSelectorConnector } from './ContentSelectorConnector';\n\nconst {\n editor: { enabled },\n} = getConfiguration();\n\nexport type IntlayerEditorElementProps = {\n content: string;\n dictionaryId: string;\n dictionaryPath: string;\n keyPath: KeyPath[];\n isContentSelectable: boolean;\n};\n\nconst IntlayerEditorElement: FC<IntlayerEditorElementProps> = ({\n content,\n isContentSelectable,\n ...props\n}) => {\n if (enabled && isContentSelectable) {\n return (\n <ContentSelectorConnector {...props}>{content}</ContentSelectorConnector>\n );\n }\n return content;\n};\n\nexport type RenderIntlayerEditorResult = ReactNode & { value: string };\n\nexport const renderIntlayerEditor = (\n data: IntlayerEditorElementProps,\n isContentSelectable: boolean\n): RenderIntlayerEditorResult => {\n const Result = (\n <IntlayerEditorElement\n {...data}\n isContentSelectable={isContentSelectable}\n />\n );\n\n return { ...Result, value: data.content };\n};\n"],"mappings":";AAwBM;AAxBN,SAAS,wBAAwB;AAGjC,SAAS,gCAAgC;AAEzC,MAAM;AAAA,EACJ,QAAQ,EAAE,QAAQ;AACpB,IAAI,iBAAiB;AAUrB,MAAM,wBAAwD,CAAC;AAAA,EAC7D;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,MAAI,WAAW,qBAAqB;AAClC,WACE,oBAAC,4BAA0B,GAAG,OAAQ,mBAAQ;AAAA,EAElD;AACA,SAAO;AACT;AAIO,MAAM,uBAAuB,CAClC,MACA,wBAC+B;AAC/B,QAAM,SACJ;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA;AAAA,EACF;AAGF,SAAO,EAAE,GAAG,QAAQ,OAAO,KAAK,QAAQ;AAC1C;","names":[]}
@@ -8,6 +8,7 @@ import {
8
8
  useLocale,
9
9
  useTraduction,
10
10
  useLocaleCookie,
11
+ useIntlayerContext,
11
12
  localeCookie,
12
13
  setLocaleCookie,
13
14
  getBrowserLocale,
@@ -24,6 +25,7 @@ export {
24
25
  t,
25
26
  useDictionary,
26
27
  useIntlayer,
28
+ useIntlayerContext,
27
29
  useLocale,
28
30
  useLocaleBase,
29
31
  useLocaleCookie,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export { getTranslation } from './getTranslation';\nexport {\n IntlayerProvider,\n type IntlayerProviderProps,\n IntlayerClientContext,\n useIntlayer,\n useDictionary,\n useLocale,\n useTraduction,\n useLocaleCookie,\n localeCookie,\n setLocaleCookie,\n getBrowserLocale,\n useLocaleBase,\n t,\n} from './client/index';\nexport { type IntlayerNode } from './useDictionaryBase';\n"],"mappings":";AAAA,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export { getTranslation } from './getTranslation';\nexport {\n IntlayerProvider,\n type IntlayerProviderProps,\n IntlayerClientContext,\n useIntlayer,\n useDictionary,\n useLocale,\n useTraduction,\n useLocaleCookie,\n useIntlayerContext,\n localeCookie,\n setLocaleCookie,\n getBrowserLocale,\n useLocaleBase,\n t,\n} from './client/index';\nexport { type IntlayerNode } from './useDictionaryBase';\n"],"mappings":";AAAA,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":[]}
@@ -1,7 +1,7 @@
1
1
  import "./chunk-ZD7AOCMD.mjs";
2
- import { renderIntlayerEditor } from "intlayer-editor";
3
2
  import { isValidElement } from "react";
4
3
  import { processDictionary } from './processDictionary/index.mjs';
4
+ import { renderIntlayerEditor } from './editor/renderContentEditor.mjs';
5
5
  const recursiveTransformContent = (value, isContentSelectable = false) => {
6
6
  if (typeof value === "function") {
7
7
  return (props) => recursiveTransformContent(value(props), isContentSelectable);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/useDictionaryBase.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { Locales } from '@intlayer/config';\nimport type {\n DeclarationContent,\n DictionaryValue,\n NodeType,\n} from '@intlayer/core';\nimport { renderIntlayerEditor } from 'intlayer-editor';\nimport { isValidElement, type ReactNode } from 'react';\nimport { processDictionary } from './processDictionary/index';\n\nexport type IntlayerNode<T = string> = ReactNode & {\n value: T;\n};\n\ntype TransformNodeType<T, L extends Locales> = T extends {\n [NodeType.Enumeration]: { '1': any };\n}\n ? (quantity: number) => DeepTransformContent<T[NodeType.Enumeration]['1'], L>\n : T extends {\n [NodeType.Translation]: object;\n }\n ? L extends keyof T[NodeType.Translation]\n ? DeepTransformContent<T[NodeType.Translation][L], L>\n : never\n : T;\n\nexport type DeepTransformContent<T, L extends Locales> = T extends object // Check if the property is an object\n ? T extends (infer U)[] // If it's an array, infer the type of array elements\n ? DeepTransformContent<U, L>[] // Apply DeepTransformContent recursively to each element of the array\n : T extends {\n nodeType: NodeType | string;\n }\n ? TransformNodeType<T, L>\n : T extends { _owner: any; key: any; props: any; ref: any }\n ? ReactNode\n : {\n [K in keyof T]: DeepTransformContent<T[K], L>;\n }\n : T extends undefined\n ? never\n : IntlayerNode<T>;\n\n/**\n * Go through the object. If a object has a keyPath, render the intlayer editor if editor enabled.\n */\nexport const recursiveTransformContent = (\n value: any,\n isContentSelectable = false\n): object => {\n if (typeof value === 'function') {\n return (props: any) =>\n recursiveTransformContent(value(props), isContentSelectable);\n } else if (typeof value === 'object') {\n if (typeof value.dictionaryId !== 'undefined') {\n return renderIntlayerEditor(value, isContentSelectable);\n } else if (Array.isArray(value)) {\n return value.map((el) =>\n recursiveTransformContent(el, isContentSelectable)\n );\n } else if (isValidElement(value)) {\n return value;\n }\n\n return Object.entries(value).reduce(\n (acc, [key, value]) => ({\n ...acc,\n [key]: recursiveTransformContent(value, isContentSelectable),\n }),\n {} as object\n );\n }\n\n return value;\n};\n\ntype DataFromDictionary<\n T extends DeclarationContent,\n K extends Locales,\n> = DeepTransformContent<T['content'], K>;\n\nexport type UseDictionary = <T extends DeclarationContent, L extends Locales>(\n dictionary: T,\n locale?: L\n) => DataFromDictionary<T, L>;\n\n// Add description is JSDoc\n/**\n * Hook that picks one dictionary by its id and return the content\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const useDictionaryBase: UseDictionary = <\n T extends DeclarationContent,\n L extends Locales,\n>(\n dictionary: T,\n locale?: L,\n isContentSelectable = false\n) => {\n const result = processDictionary(\n dictionary.content as DictionaryValue,\n dictionary.key,\n dictionary.filePath,\n [],\n locale\n );\n\n return recursiveTransformContent(\n result,\n isContentSelectable\n ) as DataFromDictionary<T, L>;\n};\n"],"mappings":";AAOA,SAAS,4BAA4B;AACrC,SAAS,sBAAsC;AAC/C,SAAS,yBAAyB;AAqC3B,MAAM,4BAA4B,CACvC,OACA,sBAAsB,UACX;AACX,MAAI,OAAO,UAAU,YAAY;AAC/B,WAAO,CAAC,UACN,0BAA0B,MAAM,KAAK,GAAG,mBAAmB;AAAA,EAC/D,WAAW,OAAO,UAAU,UAAU;AACpC,QAAI,OAAO,MAAM,iBAAiB,aAAa;AAC7C,aAAO,qBAAqB,OAAO,mBAAmB;AAAA,IACxD,WAAW,MAAM,QAAQ,KAAK,GAAG;AAC/B,aAAO,MAAM;AAAA,QAAI,CAAC,OAChB,0BAA0B,IAAI,mBAAmB;AAAA,MACnD;AAAA,IACF,WAAW,eAAe,KAAK,GAAG;AAChC,aAAO;AAAA,IACT;AAEA,WAAO,OAAO,QAAQ,KAAK,EAAE;AAAA,MAC3B,CAAC,KAAK,CAAC,KAAKA,MAAK,OAAO;AAAA,QACtB,GAAG;AAAA,QACH,CAAC,GAAG,GAAG,0BAA0BA,QAAO,mBAAmB;AAAA,MAC7D;AAAA,MACA,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AACT;AAkBO,MAAM,oBAAmC,CAI9C,YACA,QACA,sBAAsB,UACnB;AACH,QAAM,SAAS;AAAA,IACb,WAAW;AAAA,IACX,WAAW;AAAA,IACX,WAAW;AAAA,IACX,CAAC;AAAA,IACD;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;","names":["value"]}
1
+ {"version":3,"sources":["../../src/useDictionaryBase.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { Locales } from '@intlayer/config';\nimport type {\n DeclarationContent,\n DictionaryValue,\n NodeType,\n} from '@intlayer/core';\nimport { isValidElement, type ReactNode } from 'react';\nimport { processDictionary } from './processDictionary/index';\nimport { renderIntlayerEditor } from './editor/renderContentEditor';\n\nexport type IntlayerNode<T = string> = ReactNode & {\n value: T;\n};\n\ntype TransformNodeType<T, L extends Locales> = T extends {\n [NodeType.Enumeration]: { '1': any };\n}\n ? (quantity: number) => DeepTransformContent<T[NodeType.Enumeration]['1'], L>\n : T extends {\n [NodeType.Translation]: object;\n }\n ? L extends keyof T[NodeType.Translation]\n ? DeepTransformContent<T[NodeType.Translation][L], L>\n : never\n : T;\n\nexport type DeepTransformContent<T, L extends Locales> = T extends object // Check if the property is an object\n ? T extends (infer U)[] // If it's an array, infer the type of array elements\n ? DeepTransformContent<U, L>[] // Apply DeepTransformContent recursively to each element of the array\n : T extends {\n nodeType: NodeType | string;\n }\n ? TransformNodeType<T, L>\n : T extends { _owner: any; key: any; props: any; ref: any }\n ? ReactNode\n : {\n [K in keyof T]: DeepTransformContent<T[K], L>;\n }\n : T extends undefined\n ? never\n : IntlayerNode<T>;\n\n/**\n * Go through the object. If a object has a keyPath, render the intlayer editor if editor enabled.\n */\nexport const recursiveTransformContent = (\n value: any,\n isContentSelectable = false\n): object => {\n if (typeof value === 'function') {\n return (props: any) =>\n recursiveTransformContent(value(props), isContentSelectable);\n } else if (typeof value === 'object') {\n if (typeof value.dictionaryId !== 'undefined') {\n return renderIntlayerEditor(value, isContentSelectable);\n } else if (Array.isArray(value)) {\n return value.map((el) =>\n recursiveTransformContent(el, isContentSelectable)\n );\n } else if (isValidElement(value)) {\n return value;\n }\n\n return Object.entries(value).reduce(\n (acc, [key, value]) => ({\n ...acc,\n [key]: recursiveTransformContent(value, isContentSelectable),\n }),\n {} as object\n );\n }\n\n return value;\n};\n\ntype DataFromDictionary<\n T extends DeclarationContent,\n K extends Locales,\n> = DeepTransformContent<T['content'], K>;\n\nexport type UseDictionary = <T extends DeclarationContent, L extends Locales>(\n dictionary: T,\n locale?: L\n) => DataFromDictionary<T, L>;\n\n// Add description is JSDoc\n/**\n * Hook that picks one dictionary by its id and return the content\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const useDictionaryBase: UseDictionary = <\n T extends DeclarationContent,\n L extends Locales,\n>(\n dictionary: T,\n locale?: L,\n isContentSelectable = false\n) => {\n const result = processDictionary(\n dictionary.content as DictionaryValue,\n dictionary.key,\n dictionary.filePath,\n [],\n locale\n );\n\n return recursiveTransformContent(\n result,\n isContentSelectable\n ) as DataFromDictionary<T, L>;\n};\n"],"mappings":";AAOA,SAAS,sBAAsC;AAC/C,SAAS,yBAAyB;AAClC,SAAS,4BAA4B;AAqC9B,MAAM,4BAA4B,CACvC,OACA,sBAAsB,UACX;AACX,MAAI,OAAO,UAAU,YAAY;AAC/B,WAAO,CAAC,UACN,0BAA0B,MAAM,KAAK,GAAG,mBAAmB;AAAA,EAC/D,WAAW,OAAO,UAAU,UAAU;AACpC,QAAI,OAAO,MAAM,iBAAiB,aAAa;AAC7C,aAAO,qBAAqB,OAAO,mBAAmB;AAAA,IACxD,WAAW,MAAM,QAAQ,KAAK,GAAG;AAC/B,aAAO,MAAM;AAAA,QAAI,CAAC,OAChB,0BAA0B,IAAI,mBAAmB;AAAA,MACnD;AAAA,IACF,WAAW,eAAe,KAAK,GAAG;AAChC,aAAO;AAAA,IACT;AAEA,WAAO,OAAO,QAAQ,KAAK,EAAE;AAAA,MAC3B,CAAC,KAAK,CAAC,KAAKA,MAAK,OAAO;AAAA,QACtB,GAAG;AAAA,QACH,CAAC,GAAG,GAAG,0BAA0BA,QAAO,mBAAmB;AAAA,MAC7D;AAAA,MACA,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AACT;AAkBO,MAAM,oBAAmC,CAI9C,YACA,QACA,sBAAsB,UACnB;AACH,QAAM,SAAS;AAAA,IACb,WAAW;AAAA,IACX,WAAW;AAAA,IACX,WAAW;AAAA,IACX,CAAC;AAAA,IACD;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;","names":["value"]}
@@ -15,7 +15,6 @@ export declare const useIntlayerContext: () => IntlayerValue;
15
15
  export type IntlayerProviderProps = PropsWithChildren & {
16
16
  locale?: Locales;
17
17
  setLocale?: (locale: Locales) => void;
18
- editorEnabled?: boolean;
19
18
  };
20
19
  /**
21
20
  * Provider that store the current locale on the client side
@@ -1 +1 @@
1
- {"version":3,"file":"IntlayerProvider.d.ts","sourceRoot":"","sources":["../../../src/client/IntlayerProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAEzE,OAAO,EACL,KAAK,iBAAiB,EAItB,KAAK,EAAE,EAGR,MAAM,OAAO,CAAC;AAGf,KAAK,aAAa,GAAG;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CACzC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,wCAGhC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB,qBAA0C,CAAC;AAE1E,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,GAAG;IACtD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAuDtD,CAAC"}
1
+ {"version":3,"file":"IntlayerProvider.d.ts","sourceRoot":"","sources":["../../../src/client/IntlayerProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,EACL,KAAK,iBAAiB,EAItB,KAAK,EAAE,EAGR,MAAM,OAAO,CAAC;AAIf,KAAK,aAAa,GAAG;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CACzC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,wCAGhC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB,qBAA0C,CAAC;AAE1E,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,GAAG;IACtD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CACvC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAuCtD,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { FC, PropsWithChildren } from 'react';
2
+ import { ContentSelectorWrapper, ContentSelectorWrapperProps } from './ContentSelectorWrapper';
3
+ type ContentSelectorContextValue = {
4
+ state: {
5
+ ContentSelectorWrapper: typeof ContentSelectorWrapper;
6
+ };
7
+ setState: (value: ContentSelectorContextValue['state']) => void;
8
+ };
9
+ export declare const ContentSelectorContext: import("react").Context<ContentSelectorContextValue>;
10
+ export declare const useContentSelectorContext: () => ContentSelectorContextValue;
11
+ export declare const ContentSelectorProvider: FC<PropsWithChildren>;
12
+ export declare const ContentSelectorConnector: FC<ContentSelectorWrapperProps>;
13
+ export {};
14
+ //# sourceMappingURL=ContentSelectorConnector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentSelectorConnector.d.ts","sourceRoot":"","sources":["../../../src/editor/ContentSelectorConnector.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,EAAE,EACF,iBAAiB,EAGlB,MAAM,OAAO,CAAC;AACf,OAAO,EACL,sBAAsB,EACtB,2BAA2B,EAC5B,MAAM,0BAA0B,CAAC;AAElC,KAAK,2BAA2B,GAAG;IACjC,KAAK,EAAE;QACL,sBAAsB,EAAE,OAAO,sBAAsB,CAAC;KACvD,CAAC;IACF,QAAQ,EAAE,CAAC,KAAK,EAAE,2BAA2B,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;CACjE,CAAC;AAEF,eAAO,MAAM,sBAAsB,sDAI/B,CAAC;AAEL,eAAO,MAAM,yBAAyB,mCACF,CAAC;AAErC,eAAO,MAAM,uBAAuB,EAAE,EAAE,CAAC,iBAAiB,CAazD,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,EAAE,CAAC,2BAA2B,CAMpE,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { type KeyPath } from '@intlayer/core';
2
+ import { type FC, type ReactNode } from 'react';
3
+ export type ContentSelectorWrapperProps = {
4
+ children: ReactNode;
5
+ dictionaryId: string;
6
+ dictionaryPath: string;
7
+ keyPath: KeyPath[];
8
+ };
9
+ export declare const ContentSelectorWrapper: FC<ContentSelectorWrapperProps>;
10
+ //# sourceMappingURL=ContentSelectorWrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentSelectorWrapper.d.ts","sourceRoot":"","sources":["../../../src/editor/ContentSelectorWrapper.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEhD,MAAM,MAAM,2BAA2B,GAAG;IACxC,QAAQ,EAAE,SAAS,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,OAAO,EAAE,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,2BAA2B,CAE9C,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { FC, PropsWithChildren } from 'react';
2
+ export declare const IntlayerEditorProvider: FC<PropsWithChildren>;
3
+ //# sourceMappingURL=IntlayerEditorProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IntlayerEditorProvider.d.ts","sourceRoot":"","sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG9C,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,iBAAiB,CAExD,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './ContentSelectorWrapper';
2
+ export * from './ContentSelectorConnector';
3
+ export * from './renderContentEditor';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/editor/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { KeyPath } from '@intlayer/core';
2
+ import type { ReactNode } from 'react';
3
+ export type IntlayerEditorElementProps = {
4
+ content: string;
5
+ dictionaryId: string;
6
+ dictionaryPath: string;
7
+ keyPath: KeyPath[];
8
+ isContentSelectable: boolean;
9
+ };
10
+ export type RenderIntlayerEditorResult = ReactNode & {
11
+ value: string;
12
+ };
13
+ export declare const renderIntlayerEditor: (data: IntlayerEditorElementProps, isContentSelectable: boolean) => RenderIntlayerEditorResult;
14
+ //# sourceMappingURL=renderContentEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderContentEditor.d.ts","sourceRoot":"","sources":["../../../src/editor/renderContentEditor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAM,SAAS,EAAE,MAAM,OAAO,CAAC;AAO3C,MAAM,MAAM,0BAA0B,GAAG;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,mBAAmB,EAAE,OAAO,CAAC;CAC9B,CAAC;AAeF,MAAM,MAAM,0BAA0B,GAAG,SAAS,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvE,eAAO,MAAM,oBAAoB,SACzB,0BAA0B,uBACX,OAAO,KAC3B,0BASF,CAAC"}
@@ -1,4 +1,4 @@
1
1
  export { getTranslation } from './getTranslation';
2
- export { IntlayerProvider, type IntlayerProviderProps, IntlayerClientContext, useIntlayer, useDictionary, useLocale, useTraduction, useLocaleCookie, localeCookie, setLocaleCookie, getBrowserLocale, useLocaleBase, t, } from './client/index';
2
+ export { IntlayerProvider, type IntlayerProviderProps, IntlayerClientContext, useIntlayer, useDictionary, useLocale, useTraduction, useLocaleCookie, useIntlayerContext, localeCookie, setLocaleCookie, getBrowserLocale, useLocaleBase, t, } from './client/index';
3
3
  export { type IntlayerNode } from './useDictionaryBase';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EACL,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,qBAAqB,EACrB,WAAW,EACX,aAAa,EACb,SAAS,EACT,aAAa,EACb,eAAe,EACf,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,CAAC,GACF,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EACL,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,qBAAqB,EACrB,WAAW,EACX,aAAa,EACb,SAAS,EACT,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,CAAC,GACF,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionaryBase.d.ts","sourceRoot":"","sources":["../../src/useDictionaryBase.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,EACV,kBAAkB,EAElB,QAAQ,EACT,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvD,MAAM,MAAM,YAAY,CAAC,CAAC,GAAG,MAAM,IAAI,SAAS,GAAG;IACjD,KAAK,EAAE,CAAC,CAAC;CACV,CAAC;AAEF,KAAK,iBAAiB,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,IAAI,CAAC,SAAS;IACvD,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE;QAAE,GAAG,EAAE,GAAG,CAAA;KAAE,CAAC;CACtC,GACG,CAAC,QAAQ,EAAE,MAAM,KAAK,oBAAoB,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAC3E,CAAC,SAAS;IACN,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAChC,GACD,CAAC,SAAS,MAAM,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,GACrC,oBAAoB,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GACnD,KAAK,GACP,CAAC,CAAC;AAER,MAAM,MAAM,oBAAoB,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,IAAI,CAAC,SAAS,MAAM,GACrE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GACnB,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAC5B,CAAC,SAAS;IACN,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAAC;CAC7B,GACD,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,GACvB,CAAC,SAAS;IAAE,MAAM,EAAE,GAAG,CAAC;IAAC,GAAG,EAAE,GAAG,CAAC;IAAC,KAAK,EAAE,GAAG,CAAC;IAAC,GAAG,EAAE,GAAG,CAAA;CAAE,GACvD,SAAS,GACT;KACG,CAAC,IAAI,MAAM,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;CAC9C,GACP,CAAC,SAAS,SAAS,GACjB,KAAK,GACL,YAAY,CAAC,CAAC,CAAC,CAAC;AAEtB;;GAEG;AACH,eAAO,MAAM,yBAAyB,UAC7B,GAAG,oCAET,MAyBF,CAAC;AAEF,KAAK,kBAAkB,CACrB,CAAC,SAAS,kBAAkB,EAC5B,CAAC,SAAS,OAAO,IACf,oBAAoB,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;AAE1C,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,SAAS,kBAAkB,EAAE,CAAC,SAAS,OAAO,EAC1E,UAAU,EAAE,CAAC,EACb,MAAM,CAAC,EAAE,CAAC,KACP,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAG9B;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,aAoB/B,CAAC"}
1
+ {"version":3,"file":"useDictionaryBase.d.ts","sourceRoot":"","sources":["../../src/useDictionaryBase.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,EACV,kBAAkB,EAElB,QAAQ,EACT,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvD,MAAM,MAAM,YAAY,CAAC,CAAC,GAAG,MAAM,IAAI,SAAS,GAAG;IACjD,KAAK,EAAE,CAAC,CAAC;CACV,CAAC;AAEF,KAAK,iBAAiB,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,IAAI,CAAC,SAAS;IACvD,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE;QAAE,GAAG,EAAE,GAAG,CAAA;KAAE,CAAC;CACtC,GACG,CAAC,QAAQ,EAAE,MAAM,KAAK,oBAAoB,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAC3E,CAAC,SAAS;IACN,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAChC,GACD,CAAC,SAAS,MAAM,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,GACrC,oBAAoB,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GACnD,KAAK,GACP,CAAC,CAAC;AAER,MAAM,MAAM,oBAAoB,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,IAAI,CAAC,SAAS,MAAM,GACrE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GACnB,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAC5B,CAAC,SAAS;IACN,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAAC;CAC7B,GACD,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,GACvB,CAAC,SAAS;IAAE,MAAM,EAAE,GAAG,CAAC;IAAC,GAAG,EAAE,GAAG,CAAC;IAAC,KAAK,EAAE,GAAG,CAAC;IAAC,GAAG,EAAE,GAAG,CAAA;CAAE,GACvD,SAAS,GACT;KACG,CAAC,IAAI,MAAM,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;CAC9C,GACP,CAAC,SAAS,SAAS,GACjB,KAAK,GACL,YAAY,CAAC,CAAC,CAAC,CAAC;AAEtB;;GAEG;AACH,eAAO,MAAM,yBAAyB,UAC7B,GAAG,oCAET,MAyBF,CAAC;AAEF,KAAK,kBAAkB,CACrB,CAAC,SAAS,kBAAkB,EAC5B,CAAC,SAAS,OAAO,IACf,oBAAoB,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;AAE1C,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,SAAS,kBAAkB,EAAE,CAAC,SAAS,OAAO,EAC1E,UAAU,EAAE,CAAC,EACb,MAAM,CAAC,EAAE,CAAC,KACP,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAG9B;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,aAoB/B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-intlayer",
3
- "version": "3.1.0",
3
+ "version": "3.2.1",
4
4
  "private": false,
5
5
  "description": "Internationalization layer for React applications. Declare your multilingual contant in the same lever than your component. Powered by TypeScript, declaration files.",
6
6
  "keywords": [
@@ -60,6 +60,11 @@
60
60
  "require": "./dist/cjs/vite/intlayerPlugin.cjs",
61
61
  "import": "./dist/esm/vite/intlayerPlugin.mjs"
62
62
  },
63
+ "./editor": {
64
+ "types": "./dist/types/editor/index.d.ts",
65
+ "require": "./dist/cjs/editor/index.cjs",
66
+ "import": "./dist/esm/editor/index.mjs"
67
+ },
63
68
  "./package.json": "./package.json"
64
69
  },
65
70
  "main": "dist/cjs/index.cjs",
@@ -86,12 +91,10 @@
86
91
  "react-cookie": "^7.2.2",
87
92
  "vite": "^5.4.11",
88
93
  "webpack": "^5.96.1",
89
- "@intlayer/config": "^3.1.0",
90
- "@intlayer/chokidar": "^3.1.0",
91
- "@intlayer/webpack": "^3.1.0",
92
- "intlayer-editor": "^3.1.0",
93
- "intlayer": "^3.1.0",
94
- "@intlayer/core": "^3.1.0"
94
+ "@intlayer/config": "^3.2.1",
95
+ "@intlayer/chokidar": "^3.2.1",
96
+ "@intlayer/core": "^3.2.1",
97
+ "@intlayer/webpack": "^3.2.1"
95
98
  },
96
99
  "devDependencies": {
97
100
  "@craco/types": "^7.1.0",
@@ -108,15 +111,20 @@
108
111
  "tsc-alias": "^1.8.10",
109
112
  "tsup": "^8.3.5",
110
113
  "typescript": "^5.6.3",
111
- "@utils/eslint-config": "^1.0.4",
112
114
  "@utils/tsup-config": "^1.0.4",
113
115
  "@utils/ts-config": "^1.0.4",
116
+ "@utils/eslint-config": "^1.0.4",
114
117
  "@utils/ts-config-types": "^1.0.4"
115
118
  },
116
119
  "peerDependencies": {
117
120
  "react": ">=16.0.0 <19.0.0",
118
121
  "react-dom": ">=16.0.0 <19.0.0",
119
- "@intlayer/dictionaries-entry": "^3.1.0"
122
+ "@intlayer/chokidar": "^3.2.1",
123
+ "@intlayer/core": "^3.2.1",
124
+ "@intlayer/config": "^3.2.1",
125
+ "@intlayer/dictionaries-entry": "^3.2.1",
126
+ "@intlayer/webpack": "^3.2.1",
127
+ "intlayer": "^3.2.1"
120
128
  },
121
129
  "engines": {
122
130
  "node": ">=14.18"