intlayer-editor 2.1.11 → 2.1.12
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/client/ContentEditorProvider.cjs.map +1 -1
- package/dist/cjs/client/ContentEditorProvider.d.ts +2 -2
- package/dist/cjs/client/DictionaryEditionDrawer/DictionaryEditionDrawer.cjs +1 -1
- package/dist/cjs/client/DictionaryEditionDrawer/DictionaryEditionDrawer.cjs.map +1 -1
- package/dist/esm/client/ContentEditorProvider.d.mts +2 -2
- package/dist/esm/client/ContentEditorProvider.mjs.map +1 -1
- package/dist/esm/client/DictionaryEditionDrawer/DictionaryEditionDrawer.mjs +2 -2
- package/dist/esm/client/DictionaryEditionDrawer/DictionaryEditionDrawer.mjs.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/ContentEditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport { getConfiguration } from '@intlayer/config/client';\nimport {\n type PropsWithChildren,\n createContext,\n useContext,\n type FC,\n} from 'react';\n\ntype IntlayerEditorValue = {\n editorEnabled: boolean;\n};\n\n/**\n * Context that store the current locale on the client side\n */\nexport const IntlayerEditorContext = createContext<IntlayerEditorValue>({\n editorEnabled: false,\n});\n\n/**\n * Hook that provides the current locale\n */\nexport const useIntlayerEditorContext = () => useContext(IntlayerEditorContext);\n\nexport type IntlayerEditorProviderProps = PropsWithChildren
|
|
1
|
+
{"version":3,"sources":["../../../src/client/ContentEditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport { getConfiguration } from '@intlayer/config/client';\nimport {\n type PropsWithChildren,\n createContext,\n useContext,\n type FC,\n} from 'react';\n\ntype IntlayerEditorValue = {\n editorEnabled: boolean;\n};\n\n/**\n * Context that store the current locale on the client side\n */\nexport const IntlayerEditorContext = createContext<IntlayerEditorValue>({\n editorEnabled: false,\n});\n\n/**\n * Hook that provides the current locale\n */\nexport const useIntlayerEditorContext = () => useContext(IntlayerEditorContext);\n\nexport type IntlayerEditorProviderProps = PropsWithChildren<{\n editorEnabled?: boolean;\n}>;\n\nconst {\n editor: { enabled },\n} = getConfiguration();\n\n/**\n * Provider that store the current locale on the client side\n */\nexport const IntlayerEditorProvider: FC<IntlayerEditorProviderProps> = ({\n children,\n editorEnabled = enabled,\n}) => (\n <IntlayerEditorContext.Provider value={{ editorEnabled }}>\n {children}\n </IntlayerEditorContext.Provider>\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAyCE;AAvCF,oBAAiC;AACjC,mBAKO;AASA,MAAM,4BAAwB,4BAAmC;AAAA,EACtE,eAAe;AACjB,CAAC;AAKM,MAAM,2BAA2B,UAAM,yBAAW,qBAAqB;AAM9E,MAAM;AAAA,EACJ,QAAQ,EAAE,QAAQ;AACpB,QAAI,gCAAiB;AAKd,MAAM,yBAA0D,CAAC;AAAA,EACtE;AAAA,EACA,gBAAgB;AAClB,MACE,4CAAC,sBAAsB,UAAtB,EAA+B,OAAO,EAAE,cAAc,GACpD,UACH;","names":[]}
|
|
@@ -12,9 +12,9 @@ declare const IntlayerEditorContext: react.Context<IntlayerEditorValue>;
|
|
|
12
12
|
* Hook that provides the current locale
|
|
13
13
|
*/
|
|
14
14
|
declare const useIntlayerEditorContext: () => IntlayerEditorValue;
|
|
15
|
-
type IntlayerEditorProviderProps = PropsWithChildren
|
|
15
|
+
type IntlayerEditorProviderProps = PropsWithChildren<{
|
|
16
16
|
editorEnabled?: boolean;
|
|
17
|
-
}
|
|
17
|
+
}>;
|
|
18
18
|
/**
|
|
19
19
|
* Provider that store the current locale on the client side
|
|
20
20
|
*/
|
|
@@ -113,7 +113,7 @@ const DictionaryEditionDrawerController = ({ locale, localeList, setLocale }) =>
|
|
|
113
113
|
const focusedContent = (0, import_useFocusContentStore.useEditionPanelStore)((s) => s.focusedContent);
|
|
114
114
|
const dictionaryId = focusedContent?.dictionaryId;
|
|
115
115
|
if (!dictionaryId) {
|
|
116
|
-
return
|
|
116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
|
|
117
117
|
}
|
|
118
118
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
119
119
|
DictionaryEditionDrawer,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/client/DictionaryEditionDrawer/DictionaryEditionDrawer.tsx"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/core';\nimport {\n RightDrawer,\n DictionaryEditor,\n LocaleSwitcher,\n type FileContent,\n} from '@intlayer/design-system';\n/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n * The alias allow hot reload the app (such as nextjs) on any dictionary change.\n */\nimport dictionaries from '@intlayer/dictionaries-entry';\nimport type { FC } from 'react';\nimport { useDictionaryListDrawer } from '../DictionaryListDrawer/index';\nimport {\n type FileContent as FileContentWithDictionaryPath,\n useDictionaryEditionDrawer,\n} from './useDictionaryEditionDrawer';\nimport { useEditionPanelStore } from './useFocusContentStore';\n\ntype DictionaryEditionDrawerContentProps = {\n focusedContent: FileContentWithDictionaryPath;\n locale: Locales;\n identifier: string;\n};\n\nexport const DictionaryEditionDrawerContent: FC<\n DictionaryEditionDrawerContentProps\n> = ({ focusedContent, locale, identifier }) => {\n const {\n setFocusedContent,\n editContentRequest,\n editedContent,\n addEditedContent,\n clearEditedDictionaryContent,\n } = useDictionaryEditionDrawer(identifier);\n\n const dictionaryId: string = focusedContent.dictionaryId;\n const dictionary: Dictionary = dictionaries[dictionaryId];\n const dictionaryPath: string = dictionary.filePath;\n const editedDictionaryContent: FileContent[] = editedContent[dictionaryPath];\n\n return (\n <DictionaryEditor\n dictionary={dictionary}\n locale={locale}\n focusedKeyPath={focusedContent.keyPath}\n editedContent={editedDictionaryContent}\n onFocusKeyPath={(keyPath) =>\n setFocusedContent({ ...focusedContent, keyPath })\n }\n onContentChange={(keyPath, newValue) =>\n addEditedContent(dictionaryPath, keyPath, newValue)\n }\n onValidEdition={editContentRequest}\n onCancelEdition={() => clearEditedDictionaryContent(dictionaryPath)}\n />\n );\n};\n\ntype DictionaryEditionDrawerProps = DictionaryEditionDrawerControllerProps & {\n dictionaryId: string;\n};\n\nexport const getDrawerIdentifier = (dictionaryId: string) =>\n `dictionary_edition_${dictionaryId}`;\n\nexport const DictionaryEditionDrawer: FC<DictionaryEditionDrawerProps> = ({\n locale,\n localeList,\n setLocale,\n dictionaryId,\n}) => {\n const id = getDrawerIdentifier(dictionaryId);\n\n const { focusedContent, close } = useDictionaryEditionDrawer(dictionaryId);\n const { open: openDictionaryListDrawer } = useDictionaryListDrawer();\n\n const handleOnBack = () => {\n close();\n openDictionaryListDrawer();\n };\n\n return (\n <RightDrawer\n title={dictionaryId}\n identifier={id}\n header={\n <LocaleSwitcher\n setLocale={setLocale}\n locale={locale}\n localeList={localeList}\n />\n }\n backButton={{\n onBack: handleOnBack,\n text: 'Dictionary list',\n }}\n >\n {focusedContent && (\n <DictionaryEditionDrawerContent\n focusedContent={focusedContent}\n locale={locale}\n identifier={id}\n />\n )}\n </RightDrawer>\n );\n};\n\ntype DictionaryEditionDrawerControllerProps = {\n locale: Locales;\n localeList: Locales[];\n setLocale: (locale: Locales) => void;\n};\n\nexport const DictionaryEditionDrawerController: FC<\n DictionaryEditionDrawerControllerProps\n> = ({ locale, localeList, setLocale }) => {\n const focusedContent = useEditionPanelStore((s) => s.focusedContent);\n const dictionaryId: string | undefined = focusedContent?.dictionaryId;\n\n if (!dictionaryId) {\n return
|
|
1
|
+
{"version":3,"sources":["../../../../src/client/DictionaryEditionDrawer/DictionaryEditionDrawer.tsx"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/core';\nimport {\n RightDrawer,\n DictionaryEditor,\n LocaleSwitcher,\n type FileContent,\n} from '@intlayer/design-system';\n/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n * The alias allow hot reload the app (such as nextjs) on any dictionary change.\n */\nimport dictionaries from '@intlayer/dictionaries-entry';\nimport type { FC } from 'react';\nimport { useDictionaryListDrawer } from '../DictionaryListDrawer/index';\nimport {\n type FileContent as FileContentWithDictionaryPath,\n useDictionaryEditionDrawer,\n} from './useDictionaryEditionDrawer';\nimport { useEditionPanelStore } from './useFocusContentStore';\n\ntype DictionaryEditionDrawerContentProps = {\n focusedContent: FileContentWithDictionaryPath;\n locale: Locales;\n identifier: string;\n};\n\nexport const DictionaryEditionDrawerContent: FC<\n DictionaryEditionDrawerContentProps\n> = ({ focusedContent, locale, identifier }) => {\n const {\n setFocusedContent,\n editContentRequest,\n editedContent,\n addEditedContent,\n clearEditedDictionaryContent,\n } = useDictionaryEditionDrawer(identifier);\n\n const dictionaryId: string = focusedContent.dictionaryId;\n const dictionary: Dictionary = dictionaries[dictionaryId];\n const dictionaryPath: string = dictionary.filePath;\n const editedDictionaryContent: FileContent[] = editedContent[dictionaryPath];\n\n return (\n <DictionaryEditor\n dictionary={dictionary}\n locale={locale}\n focusedKeyPath={focusedContent.keyPath}\n editedContent={editedDictionaryContent}\n onFocusKeyPath={(keyPath) =>\n setFocusedContent({ ...focusedContent, keyPath })\n }\n onContentChange={(keyPath, newValue) =>\n addEditedContent(dictionaryPath, keyPath, newValue)\n }\n onValidEdition={editContentRequest}\n onCancelEdition={() => clearEditedDictionaryContent(dictionaryPath)}\n />\n );\n};\n\ntype DictionaryEditionDrawerProps = DictionaryEditionDrawerControllerProps & {\n dictionaryId: string;\n};\n\nexport const getDrawerIdentifier = (dictionaryId: string) =>\n `dictionary_edition_${dictionaryId}`;\n\nexport const DictionaryEditionDrawer: FC<DictionaryEditionDrawerProps> = ({\n locale,\n localeList,\n setLocale,\n dictionaryId,\n}) => {\n const id = getDrawerIdentifier(dictionaryId);\n\n const { focusedContent, close } = useDictionaryEditionDrawer(dictionaryId);\n const { open: openDictionaryListDrawer } = useDictionaryListDrawer();\n\n const handleOnBack = () => {\n close();\n openDictionaryListDrawer();\n };\n\n return (\n <RightDrawer\n title={dictionaryId}\n identifier={id}\n header={\n <LocaleSwitcher\n setLocale={setLocale}\n locale={locale}\n localeList={localeList}\n />\n }\n backButton={{\n onBack: handleOnBack,\n text: 'Dictionary list',\n }}\n >\n {focusedContent && (\n <DictionaryEditionDrawerContent\n focusedContent={focusedContent}\n locale={locale}\n identifier={id}\n />\n )}\n </RightDrawer>\n );\n};\n\ntype DictionaryEditionDrawerControllerProps = {\n locale: Locales;\n localeList: Locales[];\n setLocale: (locale: Locales) => void;\n};\n\nexport const DictionaryEditionDrawerController: FC<\n DictionaryEditionDrawerControllerProps\n> = ({ locale, localeList, setLocale }) => {\n const focusedContent = useEditionPanelStore((s) => s.focusedContent);\n const dictionaryId: string | undefined = focusedContent?.dictionaryId;\n\n if (!dictionaryId) {\n return <></>;\n }\n\n return (\n <DictionaryEditionDrawer\n locale={locale}\n localeList={localeList}\n setLocale={setLocale}\n dictionaryId={dictionaryId}\n />\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA+CI;AA3CJ,2BAKO;AAMP,gCAAyB;AAEzB,kCAAwC;AACxC,wCAGO;AACP,kCAAqC;AAQ9B,MAAM,iCAET,CAAC,EAAE,gBAAgB,QAAQ,WAAW,MAAM;AAC9C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,8DAA2B,UAAU;AAEzC,QAAM,eAAuB,eAAe;AAC5C,QAAM,aAAyB,0BAAAA,QAAa,YAAY;AACxD,QAAM,iBAAyB,WAAW;AAC1C,QAAM,0BAAyC,cAAc,cAAc;AAE3E,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,gBAAgB,eAAe;AAAA,MAC/B,eAAe;AAAA,MACf,gBAAgB,CAAC,YACf,kBAAkB,EAAE,GAAG,gBAAgB,QAAQ,CAAC;AAAA,MAElD,iBAAiB,CAAC,SAAS,aACzB,iBAAiB,gBAAgB,SAAS,QAAQ;AAAA,MAEpD,gBAAgB;AAAA,MAChB,iBAAiB,MAAM,6BAA6B,cAAc;AAAA;AAAA,EACpE;AAEJ;AAMO,MAAM,sBAAsB,CAAC,iBAClC,sBAAsB,YAAY;AAE7B,MAAM,0BAA4D,CAAC;AAAA,EACxE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,KAAK,oBAAoB,YAAY;AAE3C,QAAM,EAAE,gBAAgB,MAAM,QAAI,8DAA2B,YAAY;AACzE,QAAM,EAAE,MAAM,yBAAyB,QAAI,qDAAwB;AAEnE,QAAM,eAAe,MAAM;AACzB,UAAM;AACN,6BAAyB;AAAA,EAC3B;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,MACP,YAAY;AAAA,MACZ,QACE;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACF;AAAA,MAEF,YAAY;AAAA,QACV,QAAQ;AAAA,QACR,MAAM;AAAA,MACR;AAAA,MAEC,4BACC;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA,YAAY;AAAA;AAAA,MACd;AAAA;AAAA,EAEJ;AAEJ;AAQO,MAAM,oCAET,CAAC,EAAE,QAAQ,YAAY,UAAU,MAAM;AACzC,QAAM,qBAAiB,kDAAqB,CAAC,MAAM,EAAE,cAAc;AACnE,QAAM,eAAmC,gBAAgB;AAEzD,MAAI,CAAC,cAAc;AACjB,WAAO,2EAAE;AAAA,EACX;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;","names":["dictionaries"]}
|
|
@@ -12,9 +12,9 @@ declare const IntlayerEditorContext: react.Context<IntlayerEditorValue>;
|
|
|
12
12
|
* Hook that provides the current locale
|
|
13
13
|
*/
|
|
14
14
|
declare const useIntlayerEditorContext: () => IntlayerEditorValue;
|
|
15
|
-
type IntlayerEditorProviderProps = PropsWithChildren
|
|
15
|
+
type IntlayerEditorProviderProps = PropsWithChildren<{
|
|
16
16
|
editorEnabled?: boolean;
|
|
17
|
-
}
|
|
17
|
+
}>;
|
|
18
18
|
/**
|
|
19
19
|
* Provider that store the current locale on the client side
|
|
20
20
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/ContentEditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport { getConfiguration } from '@intlayer/config/client';\nimport {\n type PropsWithChildren,\n createContext,\n useContext,\n type FC,\n} from 'react';\n\ntype IntlayerEditorValue = {\n editorEnabled: boolean;\n};\n\n/**\n * Context that store the current locale on the client side\n */\nexport const IntlayerEditorContext = createContext<IntlayerEditorValue>({\n editorEnabled: false,\n});\n\n/**\n * Hook that provides the current locale\n */\nexport const useIntlayerEditorContext = () => useContext(IntlayerEditorContext);\n\nexport type IntlayerEditorProviderProps = PropsWithChildren
|
|
1
|
+
{"version":3,"sources":["../../../src/client/ContentEditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport { getConfiguration } from '@intlayer/config/client';\nimport {\n type PropsWithChildren,\n createContext,\n useContext,\n type FC,\n} from 'react';\n\ntype IntlayerEditorValue = {\n editorEnabled: boolean;\n};\n\n/**\n * Context that store the current locale on the client side\n */\nexport const IntlayerEditorContext = createContext<IntlayerEditorValue>({\n editorEnabled: false,\n});\n\n/**\n * Hook that provides the current locale\n */\nexport const useIntlayerEditorContext = () => useContext(IntlayerEditorContext);\n\nexport type IntlayerEditorProviderProps = PropsWithChildren<{\n editorEnabled?: boolean;\n}>;\n\nconst {\n editor: { enabled },\n} = getConfiguration();\n\n/**\n * Provider that store the current locale on the client side\n */\nexport const IntlayerEditorProvider: FC<IntlayerEditorProviderProps> = ({\n children,\n editorEnabled = enabled,\n}) => (\n <IntlayerEditorContext.Provider value={{ editorEnabled }}>\n {children}\n </IntlayerEditorContext.Provider>\n);\n"],"mappings":";AAyCE;AAvCF,SAAS,wBAAwB;AACjC;AAAA,EAEE;AAAA,EACA;AAAA,OAEK;AASA,MAAM,wBAAwB,cAAmC;AAAA,EACtE,eAAe;AACjB,CAAC;AAKM,MAAM,2BAA2B,MAAM,WAAW,qBAAqB;AAM9E,MAAM;AAAA,EACJ,QAAQ,EAAE,QAAQ;AACpB,IAAI,iBAAiB;AAKd,MAAM,yBAA0D,CAAC;AAAA,EACtE;AAAA,EACA,gBAAgB;AAClB,MACE,oBAAC,sBAAsB,UAAtB,EAA+B,OAAO,EAAE,cAAc,GACpD,UACH;","names":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
3
3
|
import {
|
|
4
4
|
RightDrawer,
|
|
5
5
|
DictionaryEditor,
|
|
@@ -83,7 +83,7 @@ const DictionaryEditionDrawerController = ({ locale, localeList, setLocale }) =>
|
|
|
83
83
|
const focusedContent = useEditionPanelStore((s) => s.focusedContent);
|
|
84
84
|
const dictionaryId = focusedContent?.dictionaryId;
|
|
85
85
|
if (!dictionaryId) {
|
|
86
|
-
return
|
|
86
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
87
87
|
}
|
|
88
88
|
return /* @__PURE__ */ jsx(
|
|
89
89
|
DictionaryEditionDrawer,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/client/DictionaryEditionDrawer/DictionaryEditionDrawer.tsx"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/core';\nimport {\n RightDrawer,\n DictionaryEditor,\n LocaleSwitcher,\n type FileContent,\n} from '@intlayer/design-system';\n/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n * The alias allow hot reload the app (such as nextjs) on any dictionary change.\n */\nimport dictionaries from '@intlayer/dictionaries-entry';\nimport type { FC } from 'react';\nimport { useDictionaryListDrawer } from '../DictionaryListDrawer/index';\nimport {\n type FileContent as FileContentWithDictionaryPath,\n useDictionaryEditionDrawer,\n} from './useDictionaryEditionDrawer';\nimport { useEditionPanelStore } from './useFocusContentStore';\n\ntype DictionaryEditionDrawerContentProps = {\n focusedContent: FileContentWithDictionaryPath;\n locale: Locales;\n identifier: string;\n};\n\nexport const DictionaryEditionDrawerContent: FC<\n DictionaryEditionDrawerContentProps\n> = ({ focusedContent, locale, identifier }) => {\n const {\n setFocusedContent,\n editContentRequest,\n editedContent,\n addEditedContent,\n clearEditedDictionaryContent,\n } = useDictionaryEditionDrawer(identifier);\n\n const dictionaryId: string = focusedContent.dictionaryId;\n const dictionary: Dictionary = dictionaries[dictionaryId];\n const dictionaryPath: string = dictionary.filePath;\n const editedDictionaryContent: FileContent[] = editedContent[dictionaryPath];\n\n return (\n <DictionaryEditor\n dictionary={dictionary}\n locale={locale}\n focusedKeyPath={focusedContent.keyPath}\n editedContent={editedDictionaryContent}\n onFocusKeyPath={(keyPath) =>\n setFocusedContent({ ...focusedContent, keyPath })\n }\n onContentChange={(keyPath, newValue) =>\n addEditedContent(dictionaryPath, keyPath, newValue)\n }\n onValidEdition={editContentRequest}\n onCancelEdition={() => clearEditedDictionaryContent(dictionaryPath)}\n />\n );\n};\n\ntype DictionaryEditionDrawerProps = DictionaryEditionDrawerControllerProps & {\n dictionaryId: string;\n};\n\nexport const getDrawerIdentifier = (dictionaryId: string) =>\n `dictionary_edition_${dictionaryId}`;\n\nexport const DictionaryEditionDrawer: FC<DictionaryEditionDrawerProps> = ({\n locale,\n localeList,\n setLocale,\n dictionaryId,\n}) => {\n const id = getDrawerIdentifier(dictionaryId);\n\n const { focusedContent, close } = useDictionaryEditionDrawer(dictionaryId);\n const { open: openDictionaryListDrawer } = useDictionaryListDrawer();\n\n const handleOnBack = () => {\n close();\n openDictionaryListDrawer();\n };\n\n return (\n <RightDrawer\n title={dictionaryId}\n identifier={id}\n header={\n <LocaleSwitcher\n setLocale={setLocale}\n locale={locale}\n localeList={localeList}\n />\n }\n backButton={{\n onBack: handleOnBack,\n text: 'Dictionary list',\n }}\n >\n {focusedContent && (\n <DictionaryEditionDrawerContent\n focusedContent={focusedContent}\n locale={locale}\n identifier={id}\n />\n )}\n </RightDrawer>\n );\n};\n\ntype DictionaryEditionDrawerControllerProps = {\n locale: Locales;\n localeList: Locales[];\n setLocale: (locale: Locales) => void;\n};\n\nexport const DictionaryEditionDrawerController: FC<\n DictionaryEditionDrawerControllerProps\n> = ({ locale, localeList, setLocale }) => {\n const focusedContent = useEditionPanelStore((s) => s.focusedContent);\n const dictionaryId: string | undefined = focusedContent?.dictionaryId;\n\n if (!dictionaryId) {\n return
|
|
1
|
+
{"version":3,"sources":["../../../../src/client/DictionaryEditionDrawer/DictionaryEditionDrawer.tsx"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/core';\nimport {\n RightDrawer,\n DictionaryEditor,\n LocaleSwitcher,\n type FileContent,\n} from '@intlayer/design-system';\n/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n * The alias allow hot reload the app (such as nextjs) on any dictionary change.\n */\nimport dictionaries from '@intlayer/dictionaries-entry';\nimport type { FC } from 'react';\nimport { useDictionaryListDrawer } from '../DictionaryListDrawer/index';\nimport {\n type FileContent as FileContentWithDictionaryPath,\n useDictionaryEditionDrawer,\n} from './useDictionaryEditionDrawer';\nimport { useEditionPanelStore } from './useFocusContentStore';\n\ntype DictionaryEditionDrawerContentProps = {\n focusedContent: FileContentWithDictionaryPath;\n locale: Locales;\n identifier: string;\n};\n\nexport const DictionaryEditionDrawerContent: FC<\n DictionaryEditionDrawerContentProps\n> = ({ focusedContent, locale, identifier }) => {\n const {\n setFocusedContent,\n editContentRequest,\n editedContent,\n addEditedContent,\n clearEditedDictionaryContent,\n } = useDictionaryEditionDrawer(identifier);\n\n const dictionaryId: string = focusedContent.dictionaryId;\n const dictionary: Dictionary = dictionaries[dictionaryId];\n const dictionaryPath: string = dictionary.filePath;\n const editedDictionaryContent: FileContent[] = editedContent[dictionaryPath];\n\n return (\n <DictionaryEditor\n dictionary={dictionary}\n locale={locale}\n focusedKeyPath={focusedContent.keyPath}\n editedContent={editedDictionaryContent}\n onFocusKeyPath={(keyPath) =>\n setFocusedContent({ ...focusedContent, keyPath })\n }\n onContentChange={(keyPath, newValue) =>\n addEditedContent(dictionaryPath, keyPath, newValue)\n }\n onValidEdition={editContentRequest}\n onCancelEdition={() => clearEditedDictionaryContent(dictionaryPath)}\n />\n );\n};\n\ntype DictionaryEditionDrawerProps = DictionaryEditionDrawerControllerProps & {\n dictionaryId: string;\n};\n\nexport const getDrawerIdentifier = (dictionaryId: string) =>\n `dictionary_edition_${dictionaryId}`;\n\nexport const DictionaryEditionDrawer: FC<DictionaryEditionDrawerProps> = ({\n locale,\n localeList,\n setLocale,\n dictionaryId,\n}) => {\n const id = getDrawerIdentifier(dictionaryId);\n\n const { focusedContent, close } = useDictionaryEditionDrawer(dictionaryId);\n const { open: openDictionaryListDrawer } = useDictionaryListDrawer();\n\n const handleOnBack = () => {\n close();\n openDictionaryListDrawer();\n };\n\n return (\n <RightDrawer\n title={dictionaryId}\n identifier={id}\n header={\n <LocaleSwitcher\n setLocale={setLocale}\n locale={locale}\n localeList={localeList}\n />\n }\n backButton={{\n onBack: handleOnBack,\n text: 'Dictionary list',\n }}\n >\n {focusedContent && (\n <DictionaryEditionDrawerContent\n focusedContent={focusedContent}\n locale={locale}\n identifier={id}\n />\n )}\n </RightDrawer>\n );\n};\n\ntype DictionaryEditionDrawerControllerProps = {\n locale: Locales;\n localeList: Locales[];\n setLocale: (locale: Locales) => void;\n};\n\nexport const DictionaryEditionDrawerController: FC<\n DictionaryEditionDrawerControllerProps\n> = ({ locale, localeList, setLocale }) => {\n const focusedContent = useEditionPanelStore((s) => s.focusedContent);\n const dictionaryId: string | undefined = focusedContent?.dictionaryId;\n\n if (!dictionaryId) {\n return <></>;\n }\n\n return (\n <DictionaryEditionDrawer\n locale={locale}\n localeList={localeList}\n setLocale={setLocale}\n dictionaryId={dictionaryId}\n />\n );\n};\n"],"mappings":";AA+CI,SAgFO,UAhFP;AA3CJ;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAMP,OAAO,kBAAkB;AAEzB,SAAS,+BAA+B;AACxC;AAAA,EAEE;AAAA,OACK;AACP,SAAS,4BAA4B;AAQ9B,MAAM,iCAET,CAAC,EAAE,gBAAgB,QAAQ,WAAW,MAAM;AAC9C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,2BAA2B,UAAU;AAEzC,QAAM,eAAuB,eAAe;AAC5C,QAAM,aAAyB,aAAa,YAAY;AACxD,QAAM,iBAAyB,WAAW;AAC1C,QAAM,0BAAyC,cAAc,cAAc;AAE3E,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,gBAAgB,eAAe;AAAA,MAC/B,eAAe;AAAA,MACf,gBAAgB,CAAC,YACf,kBAAkB,EAAE,GAAG,gBAAgB,QAAQ,CAAC;AAAA,MAElD,iBAAiB,CAAC,SAAS,aACzB,iBAAiB,gBAAgB,SAAS,QAAQ;AAAA,MAEpD,gBAAgB;AAAA,MAChB,iBAAiB,MAAM,6BAA6B,cAAc;AAAA;AAAA,EACpE;AAEJ;AAMO,MAAM,sBAAsB,CAAC,iBAClC,sBAAsB,YAAY;AAE7B,MAAM,0BAA4D,CAAC;AAAA,EACxE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,KAAK,oBAAoB,YAAY;AAE3C,QAAM,EAAE,gBAAgB,MAAM,IAAI,2BAA2B,YAAY;AACzE,QAAM,EAAE,MAAM,yBAAyB,IAAI,wBAAwB;AAEnE,QAAM,eAAe,MAAM;AACzB,UAAM;AACN,6BAAyB;AAAA,EAC3B;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,MACP,YAAY;AAAA,MACZ,QACE;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACF;AAAA,MAEF,YAAY;AAAA,QACV,QAAQ;AAAA,QACR,MAAM;AAAA,MACR;AAAA,MAEC,4BACC;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA,YAAY;AAAA;AAAA,MACd;AAAA;AAAA,EAEJ;AAEJ;AAQO,MAAM,oCAET,CAAC,EAAE,QAAQ,YAAY,UAAU,MAAM;AACzC,QAAM,iBAAiB,qBAAqB,CAAC,MAAM,EAAE,cAAc;AACnE,QAAM,eAAmC,gBAAgB;AAEzD,MAAI,CAAC,cAAc;AACjB,WAAO,gCAAE;AAAA,EACX;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "intlayer-editor",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.12",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "IntLayer Editor is a tool that allow you to edit your IntLayer declaration files using a graphical interface.",
|
|
6
6
|
"keywords": [
|
|
@@ -73,11 +73,11 @@
|
|
|
73
73
|
"react-dom": "^18.3.1",
|
|
74
74
|
"webpack": "^5.92.1",
|
|
75
75
|
"zustand": "^4.5.2",
|
|
76
|
-
"@intlayer/config": "^2.0.
|
|
77
|
-
"@intlayer/core": "^2.0.
|
|
78
|
-
"@intlayer/design-system": "^2.0.
|
|
79
|
-
"@intlayer/dictionaries-entry": "^2.0.
|
|
80
|
-
"intlayer": "^2.0.
|
|
76
|
+
"@intlayer/config": "^2.0.13",
|
|
77
|
+
"@intlayer/core": "^2.0.13",
|
|
78
|
+
"@intlayer/design-system": "^2.0.13",
|
|
79
|
+
"@intlayer/dictionaries-entry": "^2.0.13",
|
|
80
|
+
"intlayer": "^2.0.13"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@babel/generator": "7.24.4",
|