intlayer-editor 3.5.4 → 3.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/dist/cjs/ContentSelectorWrapper.cjs +22 -6
- package/dist/cjs/ContentSelectorWrapper.cjs.map +1 -1
- package/dist/cjs/DictionaryEditionDrawer/DictionaryEditionDrawer.cjs +20 -18
- package/dist/cjs/DictionaryEditionDrawer/DictionaryEditionDrawer.cjs.map +1 -1
- package/dist/cjs/DictionaryEditionDrawer/dictionaryEditionDrawer.content.cjs +41 -1
- package/dist/cjs/DictionaryEditionDrawer/dictionaryEditionDrawer.content.cjs.map +1 -1
- package/dist/cjs/DictionaryEditionDrawer/useDictionaryEditionDrawer.cjs +5 -5
- package/dist/cjs/DictionaryEditionDrawer/useDictionaryEditionDrawer.cjs.map +1 -1
- package/dist/cjs/DictionaryListDrawer/DictionaryListDrawer.cjs +10 -10
- package/dist/cjs/DictionaryListDrawer/DictionaryListDrawer.cjs.map +1 -1
- package/dist/cjs/IntlayerEditorProvider.cjs +12 -5
- package/dist/cjs/IntlayerEditorProvider.cjs.map +1 -1
- package/dist/esm/ContentSelectorWrapper.mjs +26 -7
- package/dist/esm/ContentSelectorWrapper.mjs.map +1 -1
- package/dist/esm/DictionaryEditionDrawer/DictionaryEditionDrawer.mjs +21 -19
- package/dist/esm/DictionaryEditionDrawer/DictionaryEditionDrawer.mjs.map +1 -1
- package/dist/esm/DictionaryEditionDrawer/dictionaryEditionDrawer.content.mjs +41 -1
- package/dist/esm/DictionaryEditionDrawer/dictionaryEditionDrawer.content.mjs.map +1 -1
- package/dist/esm/DictionaryEditionDrawer/useDictionaryEditionDrawer.mjs +5 -5
- package/dist/esm/DictionaryEditionDrawer/useDictionaryEditionDrawer.mjs.map +1 -1
- package/dist/esm/DictionaryListDrawer/DictionaryListDrawer.mjs +10 -10
- package/dist/esm/DictionaryListDrawer/DictionaryListDrawer.mjs.map +1 -1
- package/dist/esm/IntlayerEditorProvider.mjs +14 -7
- package/dist/esm/IntlayerEditorProvider.mjs.map +1 -1
- package/dist/types/ContentSelectorWrapper.d.ts +1 -1
- package/dist/types/ContentSelectorWrapper.d.ts.map +1 -1
- package/dist/types/DictionaryEditionDrawer/DictionaryEditionDrawer.d.ts +4 -1
- package/dist/types/DictionaryEditionDrawer/DictionaryEditionDrawer.d.ts.map +1 -1
- package/dist/types/DictionaryEditionDrawer/dictionaryEditionDrawer.content.d.ts +2 -0
- package/dist/types/DictionaryEditionDrawer/dictionaryEditionDrawer.content.d.ts.map +1 -1
- package/dist/types/DictionaryEditionDrawer/useDictionaryEditionDrawer.d.ts +6 -6
- package/dist/types/DictionaryEditionDrawer/useDictionaryEditionDrawer.d.ts.map +1 -1
- package/dist/types/DictionaryListDrawer/DictionaryListDrawer.d.ts.map +1 -1
- package/dist/types/IntlayerEditorProvider.d.ts.map +1 -1
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
<a href="https://www.npmjs.com/package/intlayer">
|
|
3
|
-
<img src="docs/assets/logo.png" width="500" alt="intlayer" />
|
|
3
|
+
<img src="https://raw.githubusercontent.com/aymericzip/intlayer/572ae9c9acafb74307b81530c1931a8e98990aef/docs/assets/logo.png" width="500" alt="intlayer" />
|
|
4
4
|
</a>
|
|
5
5
|
</div>
|
|
6
6
|
|
|
@@ -29,19 +29,19 @@ For more details on how to install the package, see the relevant section below:
|
|
|
29
29
|
|
|
30
30
|
### Integrating with Next.js
|
|
31
31
|
|
|
32
|
-
For integration with Next.js, refer to the [setup guide](https://github.com/aymericzip/intlayer/blob/main/docs/
|
|
32
|
+
For integration with Next.js, refer to the [setup guide](https://github.com/aymericzip/intlayer/blob/main/docs/en/intlayer_with_nextjs_15.md).
|
|
33
33
|
|
|
34
34
|
### Integrating with Create React App
|
|
35
35
|
|
|
36
|
-
For integration with Create React App, refer to the [setup guide](https://github.com/aymericzip/intlayer/blob/main/docs/
|
|
36
|
+
For integration with Create React App, refer to the [setup guide](https://github.com/aymericzip/intlayer/blob/main/docs/en/intlayer_with_create_react_app.md)
|
|
37
37
|
|
|
38
38
|
### Integrating with Vite + React
|
|
39
39
|
|
|
40
|
-
For integration with Vite + React, refer to the [setup guide](https://github.com/aymericzip/intlayer/blob/main/docs/
|
|
40
|
+
For integration with Vite + React, refer to the [setup guide](https://github.com/aymericzip/intlayer/blob/main/docs/en/intlayer_with_vite+react.md)
|
|
41
41
|
|
|
42
42
|
## How Intlayer Editor Works
|
|
43
43
|
|
|
44
|
-
Each time you make a change using Intlayer Editor, the server automatically inserts your changes into your [Intlayer declaration files](https://github.com/aymericzip/intlayer/blob/main/docs/
|
|
44
|
+
Each time you make a change using Intlayer Editor, the server automatically inserts your changes into your [Intlayer declaration files](https://github.com/aymericzip/intlayer/blob/main/docs/en/content_declaration/get_started.md) wherever these files are declared in your project.
|
|
45
45
|
|
|
46
46
|
In this way, you don't have to worry about where the file is declared or about finding your key in your dictionary collection.
|
|
47
47
|
|
|
@@ -83,7 +83,7 @@ const config: IntlayerConfig = {
|
|
|
83
83
|
|
|
84
84
|
> If you don't have a client ID and client secret, you can obtain them by creating a new client in the [Intlayer Dashboard - Projects](https://intlayer.org/dashboard/projects).
|
|
85
85
|
|
|
86
|
-
> To see all available parameters, refer to the [configuration documentation](https://github.com/aymericzip/intlayer/blob/main/docs/
|
|
86
|
+
> To see all available parameters, refer to the [configuration documentation](https://github.com/aymericzip/intlayer/blob/main/docs/en/configuration.md)
|
|
87
87
|
|
|
88
88
|
### 2. Insert the Intlayer Editor Provider in your application
|
|
89
89
|
|
|
@@ -28,23 +28,37 @@ var import_design_system = require("@intlayer/design-system");
|
|
|
28
28
|
var import_react = require("react");
|
|
29
29
|
var import_IntlayerEditorProvider = require('./IntlayerEditorProvider.cjs');
|
|
30
30
|
var import_useDictionaryEditionDrawer = require('./DictionaryEditionDrawer/useDictionaryEditionDrawer.cjs');
|
|
31
|
+
var import_shallow = require("zustand/shallow");
|
|
31
32
|
const ContentSelectorWrapper = ({
|
|
32
33
|
children,
|
|
33
|
-
|
|
34
|
+
dictionaryKey,
|
|
34
35
|
dictionaryPath,
|
|
35
36
|
keyPath
|
|
36
37
|
}) => {
|
|
37
|
-
const { open, getEditedContentValue, focusedContent, isOpen } = (0, import_useDictionaryEditionDrawer.useDictionaryEditionDrawer)(
|
|
38
|
-
const
|
|
38
|
+
const { open, getEditedContentValue, focusedContent, isOpen } = (0, import_useDictionaryEditionDrawer.useDictionaryEditionDrawer)(dictionaryKey);
|
|
39
|
+
const { editedContent } = (0, import_design_system.useEditedContentStore)(
|
|
40
|
+
(0, import_shallow.useShallow)((s) => ({
|
|
41
|
+
editedContent: s.editedContent
|
|
42
|
+
}))
|
|
43
|
+
);
|
|
44
|
+
const editedValue = (0, import_react.useMemo)(
|
|
45
|
+
() => getEditedContentValue(dictionaryKey, keyPath),
|
|
46
|
+
[
|
|
47
|
+
editedContent[dictionaryKey],
|
|
48
|
+
dictionaryKey,
|
|
49
|
+
keyPath,
|
|
50
|
+
getEditedContentValue
|
|
51
|
+
]
|
|
52
|
+
);
|
|
39
53
|
const { isEditorEnabled } = (0, import_IntlayerEditorProvider.useIntlayerEditorContext)();
|
|
40
54
|
const [displayedChildren, setDisplayedChildren] = (0, import_react.useState)(children);
|
|
41
55
|
const handleSelect = (0, import_react.useCallback)(
|
|
42
56
|
() => open({
|
|
43
|
-
|
|
57
|
+
dictionaryKey,
|
|
44
58
|
dictionaryPath,
|
|
45
59
|
keyPath
|
|
46
60
|
}),
|
|
47
|
-
[
|
|
61
|
+
[dictionaryKey, dictionaryPath, keyPath, open]
|
|
48
62
|
);
|
|
49
63
|
const isSelected = (0, import_react.useMemo)(
|
|
50
64
|
() => (isOpen && (focusedContent?.keyPath?.length ?? 0) > 0 && (0, import_core.isSameKeyPath)(focusedContent?.keyPath ?? [], keyPath)) ?? false,
|
|
@@ -53,8 +67,10 @@ const ContentSelectorWrapper = ({
|
|
|
53
67
|
(0, import_react.useEffect)(() => {
|
|
54
68
|
if (isEditorEnabled && editedValue && typeof editedValue === "string") {
|
|
55
69
|
setDisplayedChildren(editedValue);
|
|
70
|
+
} else {
|
|
71
|
+
setDisplayedChildren(children);
|
|
56
72
|
}
|
|
57
|
-
}, [editedValue, isEditorEnabled]);
|
|
73
|
+
}, [editedValue, isEditorEnabled, focusedContent, children]);
|
|
58
74
|
if (!isEditorEnabled) {
|
|
59
75
|
return children;
|
|
60
76
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ContentSelectorWrapper.tsx"],"sourcesContent":["'use client';\n\nimport { isSameKeyPath, type KeyPath } from '@intlayer/core';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/ContentSelectorWrapper.tsx"],"sourcesContent":["'use client';\n\nimport { isSameKeyPath, type KeyPath } from '@intlayer/core';\nimport {\n ContentSelector,\n useEditedContentStore,\n} from '@intlayer/design-system';\nimport {\n useCallback,\n useEffect,\n useState,\n useMemo,\n type FC,\n type ReactNode,\n} from 'react';\nimport { useIntlayerEditorContext } from './IntlayerEditorProvider';\nimport { useDictionaryEditionDrawer } from './DictionaryEditionDrawer/useDictionaryEditionDrawer';\nimport { useShallow } from 'zustand/shallow';\n\ntype ContentSelectorWrapperProps = {\n children: ReactNode;\n dictionaryKey: string;\n dictionaryPath: string;\n keyPath: KeyPath[];\n};\n\nexport const ContentSelectorWrapper: FC<ContentSelectorWrapperProps> = ({\n children,\n dictionaryKey,\n dictionaryPath,\n keyPath,\n}) => {\n const { open, getEditedContentValue, focusedContent, isOpen } =\n useDictionaryEditionDrawer(dictionaryKey);\n const { editedContent } = useEditedContentStore(\n useShallow((s) => ({\n editedContent: s.editedContent,\n }))\n );\n const editedValue = useMemo(\n () => getEditedContentValue(dictionaryKey, keyPath),\n [\n editedContent[dictionaryKey],\n dictionaryKey,\n keyPath,\n getEditedContentValue,\n ]\n );\n const { isEditorEnabled } = useIntlayerEditorContext();\n const [displayedChildren, setDisplayedChildren] =\n useState<ReactNode>(children);\n\n const handleSelect = useCallback(\n () =>\n open({\n dictionaryKey,\n dictionaryPath,\n keyPath,\n }),\n [dictionaryKey, dictionaryPath, keyPath, open]\n );\n\n const isSelected = useMemo(\n () =>\n (isOpen &&\n (focusedContent?.keyPath?.length ?? 0) > 0 &&\n isSameKeyPath(focusedContent?.keyPath ?? [], keyPath)) ??\n false,\n [focusedContent, isOpen, keyPath]\n );\n\n useEffect(() => {\n // Use useEffect to avoid 'Text content does not match server-rendered HTML' error\n if (isEditorEnabled && editedValue && typeof editedValue === 'string') {\n setDisplayedChildren(editedValue);\n } else {\n setDisplayedChildren(children);\n }\n }, [editedValue, isEditorEnabled, focusedContent, children]);\n\n if (!isEditorEnabled) {\n return children;\n }\n\n return (\n <ContentSelector onSelect={handleSelect} isSelecting={isSelected}>\n {displayedChildren}\n </ContentSelector>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAqFI;AAnFJ,kBAA4C;AAC5C,2BAGO;AACP,mBAOO;AACP,oCAAyC;AACzC,wCAA2C;AAC3C,qBAA2B;AASpB,MAAM,yBAA0D,CAAC;AAAA,EACtE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,MAAM,uBAAuB,gBAAgB,OAAO,QAC1D,8DAA2B,aAAa;AAC1C,QAAM,EAAE,cAAc,QAAI;AAAA,QACxB,2BAAW,CAAC,OAAO;AAAA,MACjB,eAAe,EAAE;AAAA,IACnB,EAAE;AAAA,EACJ;AACA,QAAM,kBAAc;AAAA,IAClB,MAAM,sBAAsB,eAAe,OAAO;AAAA,IAClD;AAAA,MACE,cAAc,aAAa;AAAA,MAC3B;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,QAAM,EAAE,gBAAgB,QAAI,wDAAyB;AACrD,QAAM,CAAC,mBAAmB,oBAAoB,QAC5C,uBAAoB,QAAQ;AAE9B,QAAM,mBAAe;AAAA,IACnB,MACE,KAAK;AAAA,MACH;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,IACH,CAAC,eAAe,gBAAgB,SAAS,IAAI;AAAA,EAC/C;AAEA,QAAM,iBAAa;AAAA,IACjB,OACG,WACE,gBAAgB,SAAS,UAAU,KAAK,SACzC,2BAAc,gBAAgB,WAAW,CAAC,GAAG,OAAO,MACtD;AAAA,IACF,CAAC,gBAAgB,QAAQ,OAAO;AAAA,EAClC;AAEA,8BAAU,MAAM;AAEd,QAAI,mBAAmB,eAAe,OAAO,gBAAgB,UAAU;AACrE,2BAAqB,WAAW;AAAA,IAClC,OAAO;AACL,2BAAqB,QAAQ;AAAA,IAC/B;AAAA,EACF,GAAG,CAAC,aAAa,iBAAiB,gBAAgB,QAAQ,CAAC;AAE3D,MAAI,CAAC,iBAAiB;AACpB,WAAO;AAAA,EACT;AAEA,SACE,4CAAC,wCAAgB,UAAU,cAAc,aAAa,YACnD,6BACH;AAEJ;","names":[]}
|
|
@@ -43,7 +43,8 @@ var import_shallow = require("zustand/shallow");
|
|
|
43
43
|
var import_dictionaryListDrawerIdentifier = require('../DictionaryListDrawer/dictionaryListDrawerIdentifier.cjs');
|
|
44
44
|
var import_dictionaryEditionDrawer = __toESM(require('./dictionaryEditionDrawer.content.cjs'));
|
|
45
45
|
var import_useDictionaryEditionDrawer = require('./useDictionaryEditionDrawer.cjs');
|
|
46
|
-
const DictionaryEditionDrawerContent = ({ locale, identifier, handleOnBack }) => {
|
|
46
|
+
const DictionaryEditionDrawerContent = ({ locale, localeList, identifier, handleOnBack, isDarkMode }) => {
|
|
47
|
+
const { modalTitle } = (0, import_react_intlayer.useDictionary)(import_dictionaryEditionDrawer.default);
|
|
47
48
|
const [keyPathEditionModal, setKeyPathEditionModal] = (0, import_react.useState)(null);
|
|
48
49
|
const { setDictionariesRecord, focusedContent } = (0, import_useDictionaryEditionDrawer.useDictionaryEditionDrawer)(identifier);
|
|
49
50
|
const { all: dictionaries } = (0, import_hooks.useGetAllDictionaries)();
|
|
@@ -56,9 +57,9 @@ const DictionaryEditionDrawerContent = ({ locale, identifier, handleOnBack }) =>
|
|
|
56
57
|
setDictionariesRecord(dictionaries);
|
|
57
58
|
}
|
|
58
59
|
}, [setDictionariesRecord, dictionaries]);
|
|
59
|
-
const
|
|
60
|
-
if (!
|
|
61
|
-
const dictionary = dictionaries[
|
|
60
|
+
const dictionaryKey = focusedContent?.dictionaryKey;
|
|
61
|
+
if (!dictionaryKey) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: "No dictionary focused" });
|
|
62
|
+
const dictionary = dictionaries[dictionaryKey];
|
|
62
63
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
63
64
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
64
65
|
import_design_system.Modal,
|
|
@@ -66,18 +67,16 @@ const DictionaryEditionDrawerContent = ({ locale, identifier, handleOnBack }) =>
|
|
|
66
67
|
isOpen: keyPathEditionModal !== null,
|
|
67
68
|
onClose: () => setKeyPathEditionModal(null),
|
|
68
69
|
hasCloseButton: true,
|
|
69
|
-
title:
|
|
70
|
-
en: "Edit field",
|
|
71
|
-
fr: "Modifier le champ",
|
|
72
|
-
es: "Editar campo"
|
|
73
|
-
}),
|
|
70
|
+
title: modalTitle,
|
|
74
71
|
size: "xl",
|
|
75
72
|
transparency: "lg",
|
|
76
73
|
children: dictionary && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
77
74
|
import_design_system.DictionaryFieldEditor,
|
|
78
75
|
{
|
|
79
76
|
dictionary,
|
|
80
|
-
onClickDictionaryList
|
|
77
|
+
onClickDictionaryList,
|
|
78
|
+
isDarkMode,
|
|
79
|
+
availableLocales: localeList
|
|
81
80
|
}
|
|
82
81
|
)
|
|
83
82
|
}
|
|
@@ -96,11 +95,12 @@ const DictionaryEditionDrawer = ({
|
|
|
96
95
|
locale,
|
|
97
96
|
localeList,
|
|
98
97
|
setLocale,
|
|
99
|
-
|
|
98
|
+
dictionaryKey,
|
|
99
|
+
isDarkMode
|
|
100
100
|
}) => {
|
|
101
101
|
const { backButtonText } = (0, import_react_intlayer.useDictionary)(import_dictionaryEditionDrawer.default);
|
|
102
|
-
const id = (0, import_useDictionaryEditionDrawer.getDrawerIdentifier)(
|
|
103
|
-
const { focusedContent, close } = (0, import_useDictionaryEditionDrawer.useDictionaryEditionDrawer)(
|
|
102
|
+
const id = (0, import_useDictionaryEditionDrawer.getDrawerIdentifier)(dictionaryKey);
|
|
103
|
+
const { focusedContent, close } = (0, import_useDictionaryEditionDrawer.useDictionaryEditionDrawer)(dictionaryKey);
|
|
104
104
|
const { openDictionaryListDrawer } = (0, import_design_system.useRightDrawerStore)((s) => ({
|
|
105
105
|
openDictionaryListDrawer: () => s.open(import_dictionaryListDrawerIdentifier.dictionaryListDrawerIdentifier)
|
|
106
106
|
}));
|
|
@@ -111,7 +111,7 @@ const DictionaryEditionDrawer = ({
|
|
|
111
111
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
112
112
|
import_design_system.RightDrawer,
|
|
113
113
|
{
|
|
114
|
-
title:
|
|
114
|
+
title: dictionaryKey,
|
|
115
115
|
identifier: id,
|
|
116
116
|
header: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
117
117
|
import_design_system.LocaleSwitcher,
|
|
@@ -131,7 +131,9 @@ const DictionaryEditionDrawer = ({
|
|
|
131
131
|
focusedContent,
|
|
132
132
|
locale,
|
|
133
133
|
identifier: id,
|
|
134
|
-
handleOnBack
|
|
134
|
+
handleOnBack,
|
|
135
|
+
isDarkMode,
|
|
136
|
+
localeList
|
|
135
137
|
}
|
|
136
138
|
)
|
|
137
139
|
}
|
|
@@ -141,8 +143,8 @@ const DictionaryEditionDrawerController = ({ locale, localeList, setLocale }) =>
|
|
|
141
143
|
const focusedContent = (0, import_design_system.useEditionPanelStore)(
|
|
142
144
|
(0, import_shallow.useShallow)((s) => s.focusedContent)
|
|
143
145
|
);
|
|
144
|
-
const
|
|
145
|
-
if (!
|
|
146
|
+
const dictionaryKey = focusedContent?.dictionaryKey;
|
|
147
|
+
if (!dictionaryKey) {
|
|
146
148
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
|
|
147
149
|
}
|
|
148
150
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -151,7 +153,7 @@ const DictionaryEditionDrawerController = ({ locale, localeList, setLocale }) =>
|
|
|
151
153
|
locale,
|
|
152
154
|
localeList,
|
|
153
155
|
setLocale,
|
|
154
|
-
|
|
156
|
+
dictionaryKey
|
|
155
157
|
}
|
|
156
158
|
);
|
|
157
159
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/DictionaryEditionDrawer/DictionaryEditionDrawer.tsx"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport type { Dictionary, KeyPath } from '@intlayer/core';\nimport {\n RightDrawer,\n DictionaryEditor,\n LocaleSwitcher,\n Modal,\n useEditionPanelStore,\n DictionaryFieldEditor,\n useRightDrawerStore,\n} from '@intlayer/design-system';\nimport { useGetAllDictionaries } from '@intlayer/design-system/hooks';\nimport { useCallback, useEffect, useState, type FC } from 'react';\nimport { t, useDictionary } from 'react-intlayer';\nimport { useShallow } from 'zustand/shallow';\nimport { dictionaryListDrawerIdentifier } from '../DictionaryListDrawer/dictionaryListDrawerIdentifier';\nimport dictionaryEditionDrawerContent from './dictionaryEditionDrawer.content';\nimport {\n type FileContent as FileContentWithDictionaryPath,\n useDictionaryEditionDrawer,\n getDrawerIdentifier,\n} from './useDictionaryEditionDrawer';\n\ntype DictionaryEditionDrawerContentProps = {\n focusedContent: FileContentWithDictionaryPath;\n locale: Locales;\n identifier: string;\n handleOnBack: () => void;\n};\n\nexport const DictionaryEditionDrawerContent: FC<\n DictionaryEditionDrawerContentProps\n> = ({ locale, identifier, handleOnBack }) => {\n const [keyPathEditionModal, setKeyPathEditionModal] = useState<\n KeyPath[] | null\n >(null);\n const { setDictionariesRecord, focusedContent } =\n useDictionaryEditionDrawer(identifier);\n const { all: dictionaries } = useGetAllDictionaries();\n\n const onClickDictionaryList = useCallback(() => {\n setKeyPathEditionModal(null);\n handleOnBack();\n }, [handleOnBack]);\n\n useEffect(() => {\n if (dictionaries) {\n setDictionariesRecord(dictionaries);\n }\n }, [setDictionariesRecord, dictionaries]);\n\n const
|
|
1
|
+
{"version":3,"sources":["../../../src/DictionaryEditionDrawer/DictionaryEditionDrawer.tsx"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport type { Dictionary, KeyPath } from '@intlayer/core';\nimport {\n RightDrawer,\n DictionaryEditor,\n LocaleSwitcher,\n Modal,\n useEditionPanelStore,\n DictionaryFieldEditor,\n useRightDrawerStore,\n} from '@intlayer/design-system';\nimport { useGetAllDictionaries } from '@intlayer/design-system/hooks';\nimport { useCallback, useEffect, useState, type FC } from 'react';\nimport { t, useDictionary } from 'react-intlayer';\nimport { useShallow } from 'zustand/shallow';\nimport { dictionaryListDrawerIdentifier } from '../DictionaryListDrawer/dictionaryListDrawerIdentifier';\nimport dictionaryEditionDrawerContent from './dictionaryEditionDrawer.content';\nimport {\n type FileContent as FileContentWithDictionaryPath,\n useDictionaryEditionDrawer,\n getDrawerIdentifier,\n} from './useDictionaryEditionDrawer';\n\ntype DictionaryEditionDrawerContentProps = {\n focusedContent: FileContentWithDictionaryPath;\n locale: Locales;\n localeList: Locales[];\n identifier: string;\n handleOnBack: () => void;\n isDarkMode?: boolean;\n};\n\nexport const DictionaryEditionDrawerContent: FC<\n DictionaryEditionDrawerContentProps\n> = ({ locale, localeList, identifier, handleOnBack, isDarkMode }) => {\n const { modalTitle } = useDictionary(dictionaryEditionDrawerContent);\n const [keyPathEditionModal, setKeyPathEditionModal] = useState<\n KeyPath[] | null\n >(null);\n const { setDictionariesRecord, focusedContent } =\n useDictionaryEditionDrawer(identifier);\n const { all: dictionaries } = useGetAllDictionaries();\n\n const onClickDictionaryList = useCallback(() => {\n setKeyPathEditionModal(null);\n handleOnBack();\n }, [handleOnBack]);\n\n useEffect(() => {\n if (dictionaries) {\n setDictionariesRecord(dictionaries);\n }\n }, [setDictionariesRecord, dictionaries]);\n\n const dictionaryKey = focusedContent?.dictionaryKey;\n\n if (!dictionaryKey) return <>No dictionary focused</>;\n\n const dictionary: Dictionary = dictionaries[dictionaryKey];\n\n return (\n <>\n <Modal\n isOpen={keyPathEditionModal !== null}\n onClose={() => setKeyPathEditionModal(null)}\n hasCloseButton\n title={modalTitle}\n size=\"xl\"\n transparency=\"lg\"\n >\n {dictionary && (\n <DictionaryFieldEditor\n dictionary={dictionary}\n onClickDictionaryList={onClickDictionaryList}\n isDarkMode={isDarkMode}\n availableLocales={localeList}\n />\n )}\n </Modal>\n <DictionaryEditor\n dictionary={dictionary}\n locale={locale}\n onClickEdit={setKeyPathEditionModal}\n />\n </>\n );\n};\n\ntype DictionaryEditionDrawerProps = DictionaryEditionDrawerControllerProps & {\n dictionaryKey: string;\n isDarkMode?: boolean;\n};\n\nexport const DictionaryEditionDrawer: FC<DictionaryEditionDrawerProps> = ({\n locale,\n localeList,\n setLocale,\n dictionaryKey,\n isDarkMode,\n}) => {\n const { backButtonText } = useDictionary(dictionaryEditionDrawerContent);\n const id = getDrawerIdentifier(dictionaryKey);\n\n const { focusedContent, close } = useDictionaryEditionDrawer(dictionaryKey);\n const { openDictionaryListDrawer } = useRightDrawerStore((s) => ({\n openDictionaryListDrawer: () => s.open(dictionaryListDrawerIdentifier),\n }));\n\n const handleOnBack = () => {\n close();\n openDictionaryListDrawer();\n };\n\n return (\n <RightDrawer\n title={dictionaryKey}\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: backButtonText,\n }}\n >\n {focusedContent && (\n <DictionaryEditionDrawerContent\n focusedContent={focusedContent}\n locale={locale}\n identifier={id}\n handleOnBack={handleOnBack}\n isDarkMode={isDarkMode}\n localeList={localeList}\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(\n useShallow((s) => s.focusedContent)\n );\n const dictionaryKey: string | undefined = focusedContent?.dictionaryKey;\n\n if (!dictionaryKey) {\n return <></>;\n }\n\n return (\n <DictionaryEditionDrawer\n locale={locale}\n localeList={localeList}\n setLocale={setLocale}\n dictionaryKey={dictionaryKey}\n />\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0D6B;AAtD7B,2BAQO;AACP,mBAAsC;AACtC,mBAA0D;AAC1D,4BAAiC;AACjC,qBAA2B;AAC3B,4CAA+C;AAC/C,qCAA2C;AAC3C,wCAIO;AAWA,MAAM,iCAET,CAAC,EAAE,QAAQ,YAAY,YAAY,cAAc,WAAW,MAAM;AACpE,QAAM,EAAE,WAAW,QAAI,qCAAc,+BAAAA,OAA8B;AACnE,QAAM,CAAC,qBAAqB,sBAAsB,QAAI,uBAEpD,IAAI;AACN,QAAM,EAAE,uBAAuB,eAAe,QAC5C,8DAA2B,UAAU;AACvC,QAAM,EAAE,KAAK,aAAa,QAAI,oCAAsB;AAEpD,QAAM,4BAAwB,0BAAY,MAAM;AAC9C,2BAAuB,IAAI;AAC3B,iBAAa;AAAA,EACf,GAAG,CAAC,YAAY,CAAC;AAEjB,8BAAU,MAAM;AACd,QAAI,cAAc;AAChB,4BAAsB,YAAY;AAAA,IACpC;AAAA,EACF,GAAG,CAAC,uBAAuB,YAAY,CAAC;AAExC,QAAM,gBAAgB,gBAAgB;AAEtC,MAAI,CAAC,cAAe,QAAO,2EAAE,mCAAqB;AAElD,QAAM,aAAyB,aAAa,aAAa;AAEzD,SACE,4EACE;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,QAAQ,wBAAwB;AAAA,QAChC,SAAS,MAAM,uBAAuB,IAAI;AAAA,QAC1C,gBAAc;AAAA,QACd,OAAO;AAAA,QACP,MAAK;AAAA,QACL,cAAa;AAAA,QAEZ,wBACC;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACA,kBAAkB;AAAA;AAAA,QACpB;AAAA;AAAA,IAEJ;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,aAAa;AAAA;AAAA,IACf;AAAA,KACF;AAEJ;AAOO,MAAM,0BAA4D,CAAC;AAAA,EACxE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,eAAe,QAAI,qCAAc,+BAAAA,OAA8B;AACvE,QAAM,SAAK,uDAAoB,aAAa;AAE5C,QAAM,EAAE,gBAAgB,MAAM,QAAI,8DAA2B,aAAa;AAC1E,QAAM,EAAE,yBAAyB,QAAI,0CAAoB,CAAC,OAAO;AAAA,IAC/D,0BAA0B,MAAM,EAAE,KAAK,oEAA8B;AAAA,EACvE,EAAE;AAEF,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,UACZ;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACF;AAAA;AAAA,EAEJ;AAEJ;AAQO,MAAM,oCAET,CAAC,EAAE,QAAQ,YAAY,UAAU,MAAM;AACzC,QAAM,qBAAiB;AAAA,QACrB,2BAAW,CAAC,MAAM,EAAE,cAAc;AAAA,EACpC;AACA,QAAM,gBAAoC,gBAAgB;AAE1D,MAAI,CAAC,eAAe;AAClB,WAAO,2EAAE;AAAA,EACX;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;","names":["dictionaryEditionDrawerContent"]}
|
|
@@ -28,7 +28,47 @@ const dictionaryEditionDrawerContent = {
|
|
|
28
28
|
backButtonText: (0, import_intlayer.t)({
|
|
29
29
|
en: "Dictionary list",
|
|
30
30
|
fr: "Liste des dictionnaires",
|
|
31
|
-
es: "Lista de diccionarios"
|
|
31
|
+
es: "Lista de diccionarios",
|
|
32
|
+
de: "W\xF6rterbuchliste",
|
|
33
|
+
ja: "\u8F9E\u66F8\u30EA\u30B9\u30C8",
|
|
34
|
+
ko: "\uC0AC\uC804 \uBAA9\uB85D",
|
|
35
|
+
zh: "\u8BCD\u5178\u5217\u8868",
|
|
36
|
+
it: "Elenco di dizionari",
|
|
37
|
+
pt: "Lista de dicion\xE1rios",
|
|
38
|
+
hi: "\u0936\u092C\u094D\u0926\u0915\u094B\u0936 \u0938\u0942\u091A\u0940",
|
|
39
|
+
ar: "\u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0642\u0648\u0627\u0645\u0644",
|
|
40
|
+
ru: "\u0421\u043F\u0438\u0441\u043E\u043A \u0441\u043B\u043E\u0432\u0430\u0440\u0435\u0439",
|
|
41
|
+
"en-GB": "Dictionary list"
|
|
42
|
+
}),
|
|
43
|
+
modalTitle: (0, import_intlayer.t)({
|
|
44
|
+
en: "Edit dictionary",
|
|
45
|
+
fr: "Modifier le dictionnaire",
|
|
46
|
+
es: "Editar el diccionario",
|
|
47
|
+
de: "W\xF6rterbuch bearbeiten",
|
|
48
|
+
ja: "\u8F9E\u66F8\u3092\u7DE8\u96C6",
|
|
49
|
+
ko: "\uC0AC\uC804 \uD3B8\uC9D1",
|
|
50
|
+
zh: "\u7F16\u8F91\u8BCD\u5178",
|
|
51
|
+
it: "Modifica dizionario",
|
|
52
|
+
pt: "Editar dicion\xE1rio",
|
|
53
|
+
hi: "\u0936\u092C\u094D\u0926\u0915\u094B\u0936 \u0938\u0902\u092A\u093E\u0926\u093F\u0924 \u0915\u0930\u0947\u0902",
|
|
54
|
+
ar: "\u062A\u062D\u0631\u064A\u0631 \u0642\u0627\u0645\u0648\u0633",
|
|
55
|
+
ru: "\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0441\u043B\u043E\u0432\u0430\u0440\u044C",
|
|
56
|
+
"en-GB": "Edit dictionary"
|
|
57
|
+
}),
|
|
58
|
+
noDictionaryFocused: (0, import_intlayer.t)({
|
|
59
|
+
en: "No dictionary focused",
|
|
60
|
+
fr: "Aucun dictionnaire s\xE9lectionn\xE9",
|
|
61
|
+
es: "No hay diccionario enfocado",
|
|
62
|
+
de: "Kein W\xF6rterbuch ausgew\xE4hlt",
|
|
63
|
+
ja: "\u30D5\u30A9\u30FC\u30AB\u30B9\u3055\u308C\u305F\u8F9E\u66F8\u304C\u3042\u308A\u307E\u305B\u3093",
|
|
64
|
+
ko: "\uD3EC\uCEE4\uC2A4\uAC00 \uC788\uB294 \uC0AC\uC804\uC774 \uC5C6\uC2B5\uB2C8\uB2E4",
|
|
65
|
+
zh: "\u6CA1\u6709\u805A\u7126\u7684\u8BCD\u5178",
|
|
66
|
+
it: "Nessun dizionario selezionato",
|
|
67
|
+
pt: "Nenhum dicion\xE1rio focalizado",
|
|
68
|
+
hi: "\u0915\u094B\u0908 \u092B\u094B\u0915\u0938 \u0936\u092C\u094D\u0926\u0915\u094B\u0936 \u0928\u0939\u0940\u0902 \u0939\u0948",
|
|
69
|
+
ar: "\u0644\u0627 \u064A\u0648\u062C\u062F \u0642\u0627\u0645\u0648\u0633 \u0645\u0631\u062A\u0628\u0637",
|
|
70
|
+
ru: "\u041D\u0435\u0442 \u0444\u043E\u043A\u0443\u0441\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u043E\u0433\u043E \u0441\u043B\u043E\u0432\u0430\u0440\u044F",
|
|
71
|
+
"en-GB": "No dictionary focused"
|
|
32
72
|
})
|
|
33
73
|
}
|
|
34
74
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/DictionaryEditionDrawer/dictionaryEditionDrawer.content.ts"],"sourcesContent":["import { t, type DeclarationContent } from 'intlayer';\n\nconst dictionaryEditionDrawerContent = {\n key: 'dictionary-edition-drawer',\n content: {\n backButtonText: t({\n en: 'Dictionary list',\n fr: 'Liste des dictionnaires',\n es: 'Lista de diccionarios',\n }),\n },\n} satisfies DeclarationContent;\n\nexport default dictionaryEditionDrawerContent;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA2C;AAE3C,MAAM,iCAAiC;AAAA,EACrC,KAAK;AAAA,EACL,SAAS;AAAA,IACP,oBAAgB,mBAAE;AAAA,MAChB,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/DictionaryEditionDrawer/dictionaryEditionDrawer.content.ts"],"sourcesContent":["import { t, type DeclarationContent } from 'intlayer';\n\nconst dictionaryEditionDrawerContent = {\n key: 'dictionary-edition-drawer',\n content: {\n backButtonText: t({\n en: 'Dictionary list',\n fr: 'Liste des dictionnaires',\n es: 'Lista de diccionarios',\n de: 'Wörterbuchliste',\n ja: '辞書リスト',\n ko: '사전 목록',\n zh: '词典列表',\n it: 'Elenco di dizionari',\n pt: 'Lista de dicionários',\n hi: 'शब्दकोश सूची',\n ar: 'قائمة القوامل',\n ru: 'Список словарей',\n 'en-GB': 'Dictionary list',\n }),\n modalTitle: t({\n en: 'Edit dictionary',\n fr: 'Modifier le dictionnaire',\n es: 'Editar el diccionario',\n de: 'Wörterbuch bearbeiten',\n ja: '辞書を編集',\n ko: '사전 편집',\n zh: '编辑词典',\n it: 'Modifica dizionario',\n pt: 'Editar dicionário',\n hi: 'शब्दकोश संपादित करें',\n ar: 'تحرير قاموس',\n ru: 'Редактировать словарь',\n 'en-GB': 'Edit dictionary',\n }),\n noDictionaryFocused: t({\n en: 'No dictionary focused',\n fr: 'Aucun dictionnaire sélectionné',\n es: 'No hay diccionario enfocado',\n de: 'Kein Wörterbuch ausgewählt',\n ja: 'フォーカスされた辞書がありません',\n ko: '포커스가 있는 사전이 없습니다',\n zh: '没有聚焦的词典',\n it: 'Nessun dizionario selezionato',\n pt: 'Nenhum dicionário focalizado',\n hi: 'कोई फोकस शब्दकोश नहीं है',\n ar: 'لا يوجد قاموس مرتبط',\n ru: 'Нет фокусированного словаря',\n 'en-GB': 'No dictionary focused',\n }),\n },\n} satisfies DeclarationContent;\n\nexport default dictionaryEditionDrawerContent;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA2C;AAE3C,MAAM,iCAAiC;AAAA,EACrC,KAAK;AAAA,EACL,SAAS;AAAA,IACP,oBAAgB,mBAAE;AAAA,MAChB,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,SAAS;AAAA,IACX,CAAC;AAAA,IACD,gBAAY,mBAAE;AAAA,MACZ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,SAAS;AAAA,IACX,CAAC;AAAA,IACD,yBAAqB,mBAAE;AAAA,MACrB,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,SAAS;AAAA,IACX,CAAC;AAAA,EACH;AACF;AAEA,IAAO,0CAAQ;","names":[]}
|
|
@@ -25,9 +25,9 @@ module.exports = __toCommonJS(useDictionaryEditionDrawer_exports);
|
|
|
25
25
|
var import_design_system = require("@intlayer/design-system");
|
|
26
26
|
var import_react = require("react");
|
|
27
27
|
var import_shallow = require("zustand/shallow");
|
|
28
|
-
const getDrawerIdentifier = (
|
|
29
|
-
const useDictionaryEditionDrawer = (
|
|
30
|
-
const id = getDrawerIdentifier(
|
|
28
|
+
const getDrawerIdentifier = (dictionaryKey) => `dictionary_edition_${dictionaryKey}`;
|
|
29
|
+
const useDictionaryEditionDrawer = (dictionaryKey) => {
|
|
30
|
+
const id = getDrawerIdentifier(dictionaryKey);
|
|
31
31
|
const { isOpenDrawer, openDrawer, closeDrawer } = (0, import_design_system.useRightDrawerStore)(
|
|
32
32
|
(0, import_shallow.useShallow)((e) => ({
|
|
33
33
|
isOpenDrawer: e.isOpen,
|
|
@@ -49,12 +49,12 @@ const useDictionaryEditionDrawer = (dictionaryId) => {
|
|
|
49
49
|
);
|
|
50
50
|
const openDictionaryEditionDrawer = (0, import_react.useCallback)(
|
|
51
51
|
({
|
|
52
|
-
|
|
52
|
+
dictionaryKey: dictionaryKey2,
|
|
53
53
|
dictionaryPath,
|
|
54
54
|
keyPath = []
|
|
55
55
|
}) => {
|
|
56
56
|
setFocusedContent({
|
|
57
|
-
|
|
57
|
+
dictionaryKey: dictionaryKey2,
|
|
58
58
|
dictionaryPath,
|
|
59
59
|
keyPath
|
|
60
60
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/DictionaryEditionDrawer/useDictionaryEditionDrawer.ts"],"sourcesContent":["import type { Dictionary, DictionaryValue, KeyPath } from '@intlayer/core';\nimport {\n useRightDrawerStore,\n useEditedContentStore,\n useEditionPanelStore,\n} from '@intlayer/design-system';\nimport { useCallback } from 'react';\nimport { useShallow } from 'zustand/shallow';\n\nexport const getDrawerIdentifier = (
|
|
1
|
+
{"version":3,"sources":["../../../src/DictionaryEditionDrawer/useDictionaryEditionDrawer.ts"],"sourcesContent":["import type { Dictionary, DictionaryValue, KeyPath } from '@intlayer/core';\nimport {\n useRightDrawerStore,\n useEditedContentStore,\n useEditionPanelStore,\n} from '@intlayer/design-system';\nimport { useCallback } from 'react';\nimport { useShallow } from 'zustand/shallow';\n\nexport const getDrawerIdentifier = (dictionaryKey: string) =>\n `dictionary_edition_${dictionaryKey}`;\n\ntype DictionaryKey = string;\ntype DictionaryPath = string;\n\nexport type FileContent = {\n dictionaryPath?: DictionaryPath;\n dictionaryKey: DictionaryKey;\n keyPath?: KeyPath[];\n};\n\ntype DictionaryEditionDrawer = {\n focusedContent: FileContent | null;\n isOpen: boolean;\n open: (content: FileContent) => void;\n close: () => void;\n setDictionariesRecord: (\n dictionariesRecord: Record<DictionaryKey, Dictionary>\n ) => void;\n getEditedContentValue: (\n dictionaryKey: DictionaryKey,\n keyPath: KeyPath[]\n ) => DictionaryValue | undefined;\n};\n\ntype OpenDictionaryEditionDrawerProps = {\n dictionaryKey: string;\n dictionaryPath?: string;\n keyPath?: KeyPath[];\n};\n\nexport const useDictionaryEditionDrawer = (\n dictionaryKey: string\n): DictionaryEditionDrawer => {\n const id = getDrawerIdentifier(dictionaryKey);\n const { isOpenDrawer, openDrawer, closeDrawer } = useRightDrawerStore(\n useShallow((e) => ({\n isOpenDrawer: e.isOpen,\n openDrawer: e.open,\n closeDrawer: e.close,\n }))\n );\n const { setDictionariesRecord, getEditedContentValue } =\n useEditedContentStore(\n useShallow((s) => ({\n setDictionariesRecord: s.setDictionariesRecord,\n getEditedContentValue: s.getEditedContentValue,\n }))\n );\n const { setFocusedContent, focusedContent } = useEditionPanelStore(\n useShallow((s) => ({\n focusedContent: s.focusedContent,\n setFocusedContent: s.setFocusedContent,\n }))\n );\n\n const openDictionaryEditionDrawer = useCallback(\n ({\n dictionaryKey,\n dictionaryPath,\n keyPath = [],\n }: OpenDictionaryEditionDrawerProps) => {\n setFocusedContent({\n dictionaryKey,\n dictionaryPath,\n keyPath,\n });\n\n openDrawer(id);\n },\n [openDrawer, setFocusedContent]\n );\n\n return {\n isOpen: isOpenDrawer(id),\n focusedContent,\n setDictionariesRecord,\n getEditedContentValue,\n open: openDictionaryEditionDrawer,\n close: () => closeDrawer(id),\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,2BAIO;AACP,mBAA4B;AAC5B,qBAA2B;AAEpB,MAAM,sBAAsB,CAAC,kBAClC,sBAAsB,aAAa;AA+B9B,MAAM,6BAA6B,CACxC,kBAC4B;AAC5B,QAAM,KAAK,oBAAoB,aAAa;AAC5C,QAAM,EAAE,cAAc,YAAY,YAAY,QAAI;AAAA,QAChD,2BAAW,CAAC,OAAO;AAAA,MACjB,cAAc,EAAE;AAAA,MAChB,YAAY,EAAE;AAAA,MACd,aAAa,EAAE;AAAA,IACjB,EAAE;AAAA,EACJ;AACA,QAAM,EAAE,uBAAuB,sBAAsB,QACnD;AAAA,QACE,2BAAW,CAAC,OAAO;AAAA,MACjB,uBAAuB,EAAE;AAAA,MACzB,uBAAuB,EAAE;AAAA,IAC3B,EAAE;AAAA,EACJ;AACF,QAAM,EAAE,mBAAmB,eAAe,QAAI;AAAA,QAC5C,2BAAW,CAAC,OAAO;AAAA,MACjB,gBAAgB,EAAE;AAAA,MAClB,mBAAmB,EAAE;AAAA,IACvB,EAAE;AAAA,EACJ;AAEA,QAAM,kCAA8B;AAAA,IAClC,CAAC;AAAA,MACC,eAAAA;AAAA,MACA;AAAA,MACA,UAAU,CAAC;AAAA,IACb,MAAwC;AACtC,wBAAkB;AAAA,QAChB,eAAAA;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AAED,iBAAW,EAAE;AAAA,IACf;AAAA,IACA,CAAC,YAAY,iBAAiB;AAAA,EAChC;AAEA,SAAO;AAAA,IACL,QAAQ,aAAa,EAAE;AAAA,IACvB;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM;AAAA,IACN,OAAO,MAAM,YAAY,EAAE;AAAA,EAC7B;AACF;","names":["dictionaryKey"]}
|
|
@@ -48,17 +48,17 @@ const DictionaryListDrawer = () => {
|
|
|
48
48
|
const setFocusedContent = (0, import_design_system.useEditionPanelStore)(
|
|
49
49
|
(0, import_shallow.useShallow)((s) => s.setFocusedContent)
|
|
50
50
|
);
|
|
51
|
-
const handleClickDictionary = (
|
|
51
|
+
const handleClickDictionary = (dictionaryKey) => {
|
|
52
52
|
closeDrawer(import_dictionaryListDrawerIdentifier.dictionaryListDrawerIdentifier);
|
|
53
|
-
const { filePath } = dictionaries[
|
|
53
|
+
const { filePath } = dictionaries[dictionaryKey];
|
|
54
54
|
setFocusedContent({
|
|
55
|
-
|
|
55
|
+
dictionaryKey,
|
|
56
56
|
dictionaryPath: filePath
|
|
57
57
|
});
|
|
58
|
-
openDrawer((0, import_useDictionaryEditionDrawer.getDrawerIdentifier)(
|
|
58
|
+
openDrawer((0, import_useDictionaryEditionDrawer.getDrawerIdentifier)(dictionaryKey));
|
|
59
59
|
};
|
|
60
60
|
const isDictionaryEdited = (0, import_react.useCallback)(
|
|
61
|
-
(
|
|
61
|
+
(dictionaryKey) => Object.keys(editedContent).includes(dictionaryKey),
|
|
62
62
|
[editedContent]
|
|
63
63
|
);
|
|
64
64
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -66,19 +66,19 @@ const DictionaryListDrawer = () => {
|
|
|
66
66
|
{
|
|
67
67
|
title: "Dictionary list",
|
|
68
68
|
identifier: import_dictionaryListDrawerIdentifier.dictionaryListDrawerIdentifier,
|
|
69
|
-
children: dictionaryKeyList.map((
|
|
69
|
+
children: dictionaryKeyList.map((dictionaryKey) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
70
70
|
import_design_system.Button,
|
|
71
71
|
{
|
|
72
|
-
label: `Open dictionary editor ${
|
|
73
|
-
onClick: () => handleClickDictionary(
|
|
72
|
+
label: `Open dictionary editor ${dictionaryKey}`,
|
|
73
|
+
onClick: () => handleClickDictionary(dictionaryKey),
|
|
74
74
|
variant: "hoverable",
|
|
75
75
|
color: "text",
|
|
76
76
|
IconRight: import_lucide_react.ChevronRight,
|
|
77
77
|
size: "md",
|
|
78
78
|
isFullWidth: true,
|
|
79
|
-
children: isDictionaryEdited(
|
|
79
|
+
children: isDictionaryEdited(dictionaryKey) ? `\u270E ${dictionaryKey}` : dictionaryKey
|
|
80
80
|
}
|
|
81
|
-
) },
|
|
81
|
+
) }, dictionaryKey))
|
|
82
82
|
}
|
|
83
83
|
) });
|
|
84
84
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/DictionaryListDrawer/DictionaryListDrawer.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config';\nimport {\n RightDrawer,\n Button,\n useEditedContentStore,\n useEditionPanelStore,\n useRightDrawerStore,\n} from '@intlayer/design-system';\nimport { useGetAllDictionaries } from '@intlayer/design-system/hooks';\nimport { ChevronRight } from 'lucide-react';\nimport { useCallback, useMemo, FC } from 'react';\nimport { useShallow } from 'zustand/shallow';\nimport { getDrawerIdentifier } from '../DictionaryEditionDrawer/useDictionaryEditionDrawer';\nimport { dictionaryListDrawerIdentifier } from './dictionaryListDrawerIdentifier';\n\nexport const DictionaryListDrawer: FC = () => {\n const { all: dictionaries } = useGetAllDictionaries();\n const dictionaryKeyList = useMemo(\n () => Object.keys(dictionaries) as Locales[],\n [dictionaries]\n );\n\n const { closeDrawer, openDrawer } = useRightDrawerStore(\n useShallow((s) => ({\n closeDrawer: s.close,\n openDrawer: s.open,\n }))\n );\n\n const editedContent = useEditedContentStore(\n useShallow((s) => s.editedContent)\n );\n const setFocusedContent = useEditionPanelStore(\n useShallow((s) => s.setFocusedContent)\n );\n\n const handleClickDictionary = (
|
|
1
|
+
{"version":3,"sources":["../../../src/DictionaryListDrawer/DictionaryListDrawer.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config';\nimport {\n RightDrawer,\n Button,\n useEditedContentStore,\n useEditionPanelStore,\n useRightDrawerStore,\n} from '@intlayer/design-system';\nimport { useGetAllDictionaries } from '@intlayer/design-system/hooks';\nimport { ChevronRight } from 'lucide-react';\nimport { useCallback, useMemo, FC } from 'react';\nimport { useShallow } from 'zustand/shallow';\nimport { getDrawerIdentifier } from '../DictionaryEditionDrawer/useDictionaryEditionDrawer';\nimport { dictionaryListDrawerIdentifier } from './dictionaryListDrawerIdentifier';\n\nexport const DictionaryListDrawer: FC = () => {\n const { all: dictionaries } = useGetAllDictionaries();\n const dictionaryKeyList = useMemo(\n () => Object.keys(dictionaries) as Locales[],\n [dictionaries]\n );\n\n const { closeDrawer, openDrawer } = useRightDrawerStore(\n useShallow((s) => ({\n closeDrawer: s.close,\n openDrawer: s.open,\n }))\n );\n\n const editedContent = useEditedContentStore(\n useShallow((s) => s.editedContent)\n );\n const setFocusedContent = useEditionPanelStore(\n useShallow((s) => s.setFocusedContent)\n );\n\n const handleClickDictionary = (dictionaryKey: string) => {\n closeDrawer(dictionaryListDrawerIdentifier);\n\n const { filePath } = dictionaries[dictionaryKey];\n setFocusedContent({\n dictionaryKey,\n dictionaryPath: filePath,\n });\n\n openDrawer(getDrawerIdentifier(dictionaryKey));\n };\n\n const isDictionaryEdited = useCallback(\n (dictionaryKey: string) =>\n Object.keys(editedContent).includes(dictionaryKey),\n [editedContent]\n );\n\n return (\n <>\n <RightDrawer\n title=\"Dictionary list\"\n identifier={dictionaryListDrawerIdentifier}\n >\n {dictionaryKeyList.map((dictionaryKey) => (\n <div key={dictionaryKey}>\n <Button\n label={`Open dictionary editor ${dictionaryKey}`}\n onClick={() => handleClickDictionary(dictionaryKey)}\n variant=\"hoverable\"\n color=\"text\"\n IconRight={ChevronRight}\n size=\"md\"\n isFullWidth\n >\n {isDictionaryEdited(dictionaryKey)\n ? `✎ ${dictionaryKey}`\n : dictionaryKey}\n </Button>\n </div>\n ))}\n </RightDrawer>\n </>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAyDI;AAtDJ,2BAMO;AACP,mBAAsC;AACtC,0BAA6B;AAC7B,mBAAyC;AACzC,qBAA2B;AAC3B,wCAAoC;AACpC,4CAA+C;AAExC,MAAM,uBAA2B,MAAM;AAC5C,QAAM,EAAE,KAAK,aAAa,QAAI,oCAAsB;AACpD,QAAM,wBAAoB;AAAA,IACxB,MAAM,OAAO,KAAK,YAAY;AAAA,IAC9B,CAAC,YAAY;AAAA,EACf;AAEA,QAAM,EAAE,aAAa,WAAW,QAAI;AAAA,QAClC,2BAAW,CAAC,OAAO;AAAA,MACjB,aAAa,EAAE;AAAA,MACf,YAAY,EAAE;AAAA,IAChB,EAAE;AAAA,EACJ;AAEA,QAAM,oBAAgB;AAAA,QACpB,2BAAW,CAAC,MAAM,EAAE,aAAa;AAAA,EACnC;AACA,QAAM,wBAAoB;AAAA,QACxB,2BAAW,CAAC,MAAM,EAAE,iBAAiB;AAAA,EACvC;AAEA,QAAM,wBAAwB,CAAC,kBAA0B;AACvD,gBAAY,oEAA8B;AAE1C,UAAM,EAAE,SAAS,IAAI,aAAa,aAAa;AAC/C,sBAAkB;AAAA,MAChB;AAAA,MACA,gBAAgB;AAAA,IAClB,CAAC;AAED,mBAAW,uDAAoB,aAAa,CAAC;AAAA,EAC/C;AAEA,QAAM,yBAAqB;AAAA,IACzB,CAAC,kBACC,OAAO,KAAK,aAAa,EAAE,SAAS,aAAa;AAAA,IACnD,CAAC,aAAa;AAAA,EAChB;AAEA,SACE,2EACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAM;AAAA,MACN,YAAY;AAAA,MAEX,4BAAkB,IAAI,CAAC,kBACtB,4CAAC,SACC;AAAA,QAAC;AAAA;AAAA,UACC,OAAO,0BAA0B,aAAa;AAAA,UAC9C,SAAS,MAAM,sBAAsB,aAAa;AAAA,UAClD,SAAQ;AAAA,UACR,OAAM;AAAA,UACN,WAAW;AAAA,UACX,MAAK;AAAA,UACL,aAAW;AAAA,UAEV,6BAAmB,aAAa,IAC7B,UAAK,aAAa,KAClB;AAAA;AAAA,MACN,KAbQ,aAcV,CACD;AAAA;AAAA,EACH,GACF;AAEJ;","names":[]}
|
|
@@ -32,6 +32,7 @@ var import_react_intlayer = require("react-intlayer");
|
|
|
32
32
|
var import_editor = require("react-intlayer/editor");
|
|
33
33
|
var import_ContentSelectorWrapper = require('./ContentSelectorWrapper.cjs');
|
|
34
34
|
var import_react = require("react");
|
|
35
|
+
var import_hooks = require("@intlayer/design-system/hooks");
|
|
35
36
|
const IntlayerEditorContext = (0, import_react.createContext)({
|
|
36
37
|
isEditorEnabled: false
|
|
37
38
|
});
|
|
@@ -57,20 +58,26 @@ const IntlayerEditorProvider = ({
|
|
|
57
58
|
(0, import_react.useEffect)(() => {
|
|
58
59
|
if (isEnabled && editor.enabled) {
|
|
59
60
|
if (!editor.clientId) {
|
|
60
|
-
|
|
61
|
-
"Editor is enabled but clientId is not set. Please set it in the editor configuration. See http://localhost:3000/doc/concept/editor."
|
|
61
|
+
(0, import_client.appLogger)(
|
|
62
|
+
"Editor is enabled but clientId is not set. Please set it in the editor configuration. See http://localhost:3000/doc/concept/editor.",
|
|
63
|
+
{
|
|
64
|
+
level: "error"
|
|
65
|
+
}
|
|
62
66
|
);
|
|
63
67
|
}
|
|
64
68
|
if (!editor.clientSecret) {
|
|
65
|
-
|
|
66
|
-
"Editor is enabled but clientSecret is not set. Please set it in the editor configuration. See http://localhost:3000/doc/concept/editor."
|
|
69
|
+
(0, import_client.appLogger)(
|
|
70
|
+
"Editor is enabled but clientSecret is not set. Please set it in the editor configuration. See http://localhost:3000/doc/concept/editor.",
|
|
71
|
+
{
|
|
72
|
+
level: "error"
|
|
73
|
+
}
|
|
67
74
|
);
|
|
68
75
|
}
|
|
69
76
|
}
|
|
70
77
|
}, [isEnabled, editor.enabled, editor.clientId, editor.clientSecret]);
|
|
71
78
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(IntlayerEditorContext.Provider, { value: { isEditorEnabled }, children: [
|
|
72
79
|
children,
|
|
73
|
-
isEditorEnabled && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
80
|
+
isEditorEnabled && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_hooks.AsyncStateProvider, { children: [
|
|
74
81
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
75
82
|
import_DictionaryEditionDrawer.DictionaryEditionDrawerController,
|
|
76
83
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/IntlayerEditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport { getConfiguration } from '@intlayer/config/client';\nimport { DictionaryEditionDrawerController } from './DictionaryEditionDrawer/index';\nimport { DictionaryListDrawer } from './DictionaryListDrawer/index';\nimport { useIntlayerContext } from 'react-intlayer';\nimport { useContentSelectorContext } from 'react-intlayer/editor';\nimport { ContentSelectorWrapper } from './ContentSelectorWrapper';\nimport {\n type FC,\n type PropsWithChildren,\n createContext,\n useContext,\n useEffect,\n useMemo,\n} from 'react';\n\ntype IntlayerEditorValue = {\n isEditorEnabled: boolean;\n};\n\n/**\n * Context that store the current locale on the client side\n */\nexport const IntlayerEditorContext = createContext<IntlayerEditorValue>({\n isEditorEnabled: false,\n});\n\n/**\n * Hook that provides the current locale\n */\nexport const useIntlayerEditorContext = () => useContext(IntlayerEditorContext);\n\nexport type IntlayerEditorProviderProps = PropsWithChildren<{\n isEnabled?: boolean;\n}>;\n\n/**\n * Provider that store the current locale on the client side\n */\nexport const IntlayerEditorProvider: FC<IntlayerEditorProviderProps> = ({\n children,\n isEnabled = true,\n}) => {\n const { editor, internationalization } = getConfiguration();\n\n const { setState } = useContentSelectorContext();\n\n const { locale, setLocale } = useIntlayerContext();\n\n const isEditorEnabled = useMemo(\n () =>\n Boolean(\n editor.enabled && editor.clientId && editor.clientSecret && isEnabled\n ),\n [editor.enabled && editor.clientId && editor.clientSecret && isEnabled]\n );\n\n useEffect(() => {\n setState({\n ContentSelectorWrapper,\n });\n }, [setState]);\n\n useEffect(() => {\n if (isEnabled && editor.enabled) {\n if (!editor.clientId) {\n
|
|
1
|
+
{"version":3,"sources":["../../src/IntlayerEditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport { appLogger, getConfiguration } from '@intlayer/config/client';\nimport { DictionaryEditionDrawerController } from './DictionaryEditionDrawer/index';\nimport { DictionaryListDrawer } from './DictionaryListDrawer/index';\nimport { useIntlayerContext } from 'react-intlayer';\nimport { useContentSelectorContext } from 'react-intlayer/editor';\nimport { ContentSelectorWrapper } from './ContentSelectorWrapper';\nimport {\n type FC,\n type PropsWithChildren,\n createContext,\n useContext,\n useEffect,\n useMemo,\n} from 'react';\nimport { AsyncStateProvider } from '@intlayer/design-system/hooks';\n\ntype IntlayerEditorValue = {\n isEditorEnabled: boolean;\n};\n\n/**\n * Context that store the current locale on the client side\n */\nexport const IntlayerEditorContext = createContext<IntlayerEditorValue>({\n isEditorEnabled: false,\n});\n\n/**\n * Hook that provides the current locale\n */\nexport const useIntlayerEditorContext = () => useContext(IntlayerEditorContext);\n\nexport type IntlayerEditorProviderProps = PropsWithChildren<{\n isEnabled?: boolean;\n}>;\n\n/**\n * Provider that store the current locale on the client side\n */\nexport const IntlayerEditorProvider: FC<IntlayerEditorProviderProps> = ({\n children,\n isEnabled = true,\n}) => {\n const { editor, internationalization } = getConfiguration();\n\n const { setState } = useContentSelectorContext();\n\n const { locale, setLocale } = useIntlayerContext();\n\n const isEditorEnabled = useMemo(\n () =>\n Boolean(\n editor.enabled && editor.clientId && editor.clientSecret && isEnabled\n ),\n [editor.enabled && editor.clientId && editor.clientSecret && isEnabled]\n );\n\n useEffect(() => {\n setState({\n ContentSelectorWrapper,\n });\n }, [setState]);\n\n useEffect(() => {\n if (isEnabled && editor.enabled) {\n if (!editor.clientId) {\n appLogger(\n 'Editor is enabled but clientId is not set. Please set it in the editor configuration. See http://localhost:3000/doc/concept/editor.',\n {\n level: 'error',\n }\n );\n }\n\n if (!editor.clientSecret) {\n appLogger(\n 'Editor is enabled but clientSecret is not set. Please set it in the editor configuration. See http://localhost:3000/doc/concept/editor.',\n {\n level: 'error',\n }\n );\n }\n }\n }, [isEnabled, editor.enabled, editor.clientId, editor.clientSecret]);\n\n return (\n <IntlayerEditorContext.Provider value={{ isEditorEnabled }}>\n {children}\n\n {isEditorEnabled && (\n <AsyncStateProvider>\n <DictionaryEditionDrawerController\n locale={locale}\n localeList={internationalization.locales}\n setLocale={setLocale}\n />\n <DictionaryListDrawer />\n </AsyncStateProvider>\n )}\n </IntlayerEditorContext.Provider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA4FQ;AA1FR,oBAA4C;AAC5C,qCAAkD;AAClD,kCAAqC;AACrC,4BAAmC;AACnC,oBAA0C;AAC1C,oCAAuC;AACvC,mBAOO;AACP,mBAAmC;AAS5B,MAAM,4BAAwB,4BAAmC;AAAA,EACtE,iBAAiB;AACnB,CAAC;AAKM,MAAM,2BAA2B,UAAM,yBAAW,qBAAqB;AASvE,MAAM,yBAA0D,CAAC;AAAA,EACtE;AAAA,EACA,YAAY;AACd,MAAM;AACJ,QAAM,EAAE,QAAQ,qBAAqB,QAAI,gCAAiB;AAE1D,QAAM,EAAE,SAAS,QAAI,yCAA0B;AAE/C,QAAM,EAAE,QAAQ,UAAU,QAAI,0CAAmB;AAEjD,QAAM,sBAAkB;AAAA,IACtB,MACE;AAAA,MACE,OAAO,WAAW,OAAO,YAAY,OAAO,gBAAgB;AAAA,IAC9D;AAAA,IACF,CAAC,OAAO,WAAW,OAAO,YAAY,OAAO,gBAAgB,SAAS;AAAA,EACxE;AAEA,8BAAU,MAAM;AACd,aAAS;AAAA,MACP;AAAA,IACF,CAAC;AAAA,EACH,GAAG,CAAC,QAAQ,CAAC;AAEb,8BAAU,MAAM;AACd,QAAI,aAAa,OAAO,SAAS;AAC/B,UAAI,CAAC,OAAO,UAAU;AACpB;AAAA,UACE;AAAA,UACA;AAAA,YACE,OAAO;AAAA,UACT;AAAA,QACF;AAAA,MACF;AAEA,UAAI,CAAC,OAAO,cAAc;AACxB;AAAA,UACE;AAAA,UACA;AAAA,YACE,OAAO;AAAA,UACT;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF,GAAG,CAAC,WAAW,OAAO,SAAS,OAAO,UAAU,OAAO,YAAY,CAAC;AAEpE,SACE,6CAAC,sBAAsB,UAAtB,EAA+B,OAAO,EAAE,gBAAgB,GACtD;AAAA;AAAA,IAEA,mBACC,6CAAC,mCACC;AAAA;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA,YAAY,qBAAqB;AAAA,UACjC;AAAA;AAAA,MACF;AAAA,MACA,4CAAC,oDAAqB;AAAA,OACxB;AAAA,KAEJ;AAEJ;","names":[]}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { isSameKeyPath } from "@intlayer/core";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
ContentSelector,
|
|
6
|
+
useEditedContentStore
|
|
7
|
+
} from "@intlayer/design-system";
|
|
5
8
|
import {
|
|
6
9
|
useCallback,
|
|
7
10
|
useEffect,
|
|
@@ -10,23 +13,37 @@ import {
|
|
|
10
13
|
} from "react";
|
|
11
14
|
import { useIntlayerEditorContext } from './IntlayerEditorProvider.mjs';
|
|
12
15
|
import { useDictionaryEditionDrawer } from './DictionaryEditionDrawer/useDictionaryEditionDrawer.mjs';
|
|
16
|
+
import { useShallow } from "zustand/shallow";
|
|
13
17
|
const ContentSelectorWrapper = ({
|
|
14
18
|
children,
|
|
15
|
-
|
|
19
|
+
dictionaryKey,
|
|
16
20
|
dictionaryPath,
|
|
17
21
|
keyPath
|
|
18
22
|
}) => {
|
|
19
|
-
const { open, getEditedContentValue, focusedContent, isOpen } = useDictionaryEditionDrawer(
|
|
20
|
-
const
|
|
23
|
+
const { open, getEditedContentValue, focusedContent, isOpen } = useDictionaryEditionDrawer(dictionaryKey);
|
|
24
|
+
const { editedContent } = useEditedContentStore(
|
|
25
|
+
useShallow((s) => ({
|
|
26
|
+
editedContent: s.editedContent
|
|
27
|
+
}))
|
|
28
|
+
);
|
|
29
|
+
const editedValue = useMemo(
|
|
30
|
+
() => getEditedContentValue(dictionaryKey, keyPath),
|
|
31
|
+
[
|
|
32
|
+
editedContent[dictionaryKey],
|
|
33
|
+
dictionaryKey,
|
|
34
|
+
keyPath,
|
|
35
|
+
getEditedContentValue
|
|
36
|
+
]
|
|
37
|
+
);
|
|
21
38
|
const { isEditorEnabled } = useIntlayerEditorContext();
|
|
22
39
|
const [displayedChildren, setDisplayedChildren] = useState(children);
|
|
23
40
|
const handleSelect = useCallback(
|
|
24
41
|
() => open({
|
|
25
|
-
|
|
42
|
+
dictionaryKey,
|
|
26
43
|
dictionaryPath,
|
|
27
44
|
keyPath
|
|
28
45
|
}),
|
|
29
|
-
[
|
|
46
|
+
[dictionaryKey, dictionaryPath, keyPath, open]
|
|
30
47
|
);
|
|
31
48
|
const isSelected = useMemo(
|
|
32
49
|
() => (isOpen && (focusedContent?.keyPath?.length ?? 0) > 0 && isSameKeyPath(focusedContent?.keyPath ?? [], keyPath)) ?? false,
|
|
@@ -35,8 +52,10 @@ const ContentSelectorWrapper = ({
|
|
|
35
52
|
useEffect(() => {
|
|
36
53
|
if (isEditorEnabled && editedValue && typeof editedValue === "string") {
|
|
37
54
|
setDisplayedChildren(editedValue);
|
|
55
|
+
} else {
|
|
56
|
+
setDisplayedChildren(children);
|
|
38
57
|
}
|
|
39
|
-
}, [editedValue, isEditorEnabled]);
|
|
58
|
+
}, [editedValue, isEditorEnabled, focusedContent, children]);
|
|
40
59
|
if (!isEditorEnabled) {
|
|
41
60
|
return children;
|
|
42
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ContentSelectorWrapper.tsx"],"sourcesContent":["'use client';\n\nimport { isSameKeyPath, type KeyPath } from '@intlayer/core';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/ContentSelectorWrapper.tsx"],"sourcesContent":["'use client';\n\nimport { isSameKeyPath, type KeyPath } from '@intlayer/core';\nimport {\n ContentSelector,\n useEditedContentStore,\n} from '@intlayer/design-system';\nimport {\n useCallback,\n useEffect,\n useState,\n useMemo,\n type FC,\n type ReactNode,\n} from 'react';\nimport { useIntlayerEditorContext } from './IntlayerEditorProvider';\nimport { useDictionaryEditionDrawer } from './DictionaryEditionDrawer/useDictionaryEditionDrawer';\nimport { useShallow } from 'zustand/shallow';\n\ntype ContentSelectorWrapperProps = {\n children: ReactNode;\n dictionaryKey: string;\n dictionaryPath: string;\n keyPath: KeyPath[];\n};\n\nexport const ContentSelectorWrapper: FC<ContentSelectorWrapperProps> = ({\n children,\n dictionaryKey,\n dictionaryPath,\n keyPath,\n}) => {\n const { open, getEditedContentValue, focusedContent, isOpen } =\n useDictionaryEditionDrawer(dictionaryKey);\n const { editedContent } = useEditedContentStore(\n useShallow((s) => ({\n editedContent: s.editedContent,\n }))\n );\n const editedValue = useMemo(\n () => getEditedContentValue(dictionaryKey, keyPath),\n [\n editedContent[dictionaryKey],\n dictionaryKey,\n keyPath,\n getEditedContentValue,\n ]\n );\n const { isEditorEnabled } = useIntlayerEditorContext();\n const [displayedChildren, setDisplayedChildren] =\n useState<ReactNode>(children);\n\n const handleSelect = useCallback(\n () =>\n open({\n dictionaryKey,\n dictionaryPath,\n keyPath,\n }),\n [dictionaryKey, dictionaryPath, keyPath, open]\n );\n\n const isSelected = useMemo(\n () =>\n (isOpen &&\n (focusedContent?.keyPath?.length ?? 0) > 0 &&\n isSameKeyPath(focusedContent?.keyPath ?? [], keyPath)) ??\n false,\n [focusedContent, isOpen, keyPath]\n );\n\n useEffect(() => {\n // Use useEffect to avoid 'Text content does not match server-rendered HTML' error\n if (isEditorEnabled && editedValue && typeof editedValue === 'string') {\n setDisplayedChildren(editedValue);\n } else {\n setDisplayedChildren(children);\n }\n }, [editedValue, isEditorEnabled, focusedContent, children]);\n\n if (!isEditorEnabled) {\n return children;\n }\n\n return (\n <ContentSelector onSelect={handleSelect} isSelecting={isSelected}>\n {displayedChildren}\n </ContentSelector>\n );\n};\n"],"mappings":";AAqFI;AAnFJ,SAAS,qBAAmC;AAC5C;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP,SAAS,gCAAgC;AACzC,SAAS,kCAAkC;AAC3C,SAAS,kBAAkB;AASpB,MAAM,yBAA0D,CAAC;AAAA,EACtE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,MAAM,uBAAuB,gBAAgB,OAAO,IAC1D,2BAA2B,aAAa;AAC1C,QAAM,EAAE,cAAc,IAAI;AAAA,IACxB,WAAW,CAAC,OAAO;AAAA,MACjB,eAAe,EAAE;AAAA,IACnB,EAAE;AAAA,EACJ;AACA,QAAM,cAAc;AAAA,IAClB,MAAM,sBAAsB,eAAe,OAAO;AAAA,IAClD;AAAA,MACE,cAAc,aAAa;AAAA,MAC3B;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,QAAM,EAAE,gBAAgB,IAAI,yBAAyB;AACrD,QAAM,CAAC,mBAAmB,oBAAoB,IAC5C,SAAoB,QAAQ;AAE9B,QAAM,eAAe;AAAA,IACnB,MACE,KAAK;AAAA,MACH;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,IACH,CAAC,eAAe,gBAAgB,SAAS,IAAI;AAAA,EAC/C;AAEA,QAAM,aAAa;AAAA,IACjB,OACG,WACE,gBAAgB,SAAS,UAAU,KAAK,KACzC,cAAc,gBAAgB,WAAW,CAAC,GAAG,OAAO,MACtD;AAAA,IACF,CAAC,gBAAgB,QAAQ,OAAO;AAAA,EAClC;AAEA,YAAU,MAAM;AAEd,QAAI,mBAAmB,eAAe,OAAO,gBAAgB,UAAU;AACrE,2BAAqB,WAAW;AAAA,IAClC,OAAO;AACL,2BAAqB,QAAQ;AAAA,IAC/B;AAAA,EACF,GAAG,CAAC,aAAa,iBAAiB,gBAAgB,QAAQ,CAAC;AAE3D,MAAI,CAAC,iBAAiB;AACpB,WAAO;AAAA,EACT;AAEA,SACE,oBAAC,mBAAgB,UAAU,cAAc,aAAa,YACnD,6BACH;AAEJ;","names":[]}
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "@intlayer/design-system";
|
|
12
12
|
import { useGetAllDictionaries } from "@intlayer/design-system/hooks";
|
|
13
13
|
import { useCallback, useEffect, useState } from "react";
|
|
14
|
-
import {
|
|
14
|
+
import { useDictionary } from "react-intlayer";
|
|
15
15
|
import { useShallow } from "zustand/shallow";
|
|
16
16
|
import { dictionaryListDrawerIdentifier } from '../DictionaryListDrawer/dictionaryListDrawerIdentifier.mjs';
|
|
17
17
|
import dictionaryEditionDrawerContent from './dictionaryEditionDrawer.content.mjs';
|
|
@@ -19,7 +19,8 @@ import {
|
|
|
19
19
|
useDictionaryEditionDrawer,
|
|
20
20
|
getDrawerIdentifier
|
|
21
21
|
} from './useDictionaryEditionDrawer.mjs';
|
|
22
|
-
const DictionaryEditionDrawerContent = ({ locale, identifier, handleOnBack }) => {
|
|
22
|
+
const DictionaryEditionDrawerContent = ({ locale, localeList, identifier, handleOnBack, isDarkMode }) => {
|
|
23
|
+
const { modalTitle } = useDictionary(dictionaryEditionDrawerContent);
|
|
23
24
|
const [keyPathEditionModal, setKeyPathEditionModal] = useState(null);
|
|
24
25
|
const { setDictionariesRecord, focusedContent } = useDictionaryEditionDrawer(identifier);
|
|
25
26
|
const { all: dictionaries } = useGetAllDictionaries();
|
|
@@ -32,9 +33,9 @@ const DictionaryEditionDrawerContent = ({ locale, identifier, handleOnBack }) =>
|
|
|
32
33
|
setDictionariesRecord(dictionaries);
|
|
33
34
|
}
|
|
34
35
|
}, [setDictionariesRecord, dictionaries]);
|
|
35
|
-
const
|
|
36
|
-
if (!
|
|
37
|
-
const dictionary = dictionaries[
|
|
36
|
+
const dictionaryKey = focusedContent?.dictionaryKey;
|
|
37
|
+
if (!dictionaryKey) return /* @__PURE__ */ jsx(Fragment, { children: "No dictionary focused" });
|
|
38
|
+
const dictionary = dictionaries[dictionaryKey];
|
|
38
39
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
39
40
|
/* @__PURE__ */ jsx(
|
|
40
41
|
Modal,
|
|
@@ -42,18 +43,16 @@ const DictionaryEditionDrawerContent = ({ locale, identifier, handleOnBack }) =>
|
|
|
42
43
|
isOpen: keyPathEditionModal !== null,
|
|
43
44
|
onClose: () => setKeyPathEditionModal(null),
|
|
44
45
|
hasCloseButton: true,
|
|
45
|
-
title:
|
|
46
|
-
en: "Edit field",
|
|
47
|
-
fr: "Modifier le champ",
|
|
48
|
-
es: "Editar campo"
|
|
49
|
-
}),
|
|
46
|
+
title: modalTitle,
|
|
50
47
|
size: "xl",
|
|
51
48
|
transparency: "lg",
|
|
52
49
|
children: dictionary && /* @__PURE__ */ jsx(
|
|
53
50
|
DictionaryFieldEditor,
|
|
54
51
|
{
|
|
55
52
|
dictionary,
|
|
56
|
-
onClickDictionaryList
|
|
53
|
+
onClickDictionaryList,
|
|
54
|
+
isDarkMode,
|
|
55
|
+
availableLocales: localeList
|
|
57
56
|
}
|
|
58
57
|
)
|
|
59
58
|
}
|
|
@@ -72,11 +71,12 @@ const DictionaryEditionDrawer = ({
|
|
|
72
71
|
locale,
|
|
73
72
|
localeList,
|
|
74
73
|
setLocale,
|
|
75
|
-
|
|
74
|
+
dictionaryKey,
|
|
75
|
+
isDarkMode
|
|
76
76
|
}) => {
|
|
77
77
|
const { backButtonText } = useDictionary(dictionaryEditionDrawerContent);
|
|
78
|
-
const id = getDrawerIdentifier(
|
|
79
|
-
const { focusedContent, close } = useDictionaryEditionDrawer(
|
|
78
|
+
const id = getDrawerIdentifier(dictionaryKey);
|
|
79
|
+
const { focusedContent, close } = useDictionaryEditionDrawer(dictionaryKey);
|
|
80
80
|
const { openDictionaryListDrawer } = useRightDrawerStore((s) => ({
|
|
81
81
|
openDictionaryListDrawer: () => s.open(dictionaryListDrawerIdentifier)
|
|
82
82
|
}));
|
|
@@ -87,7 +87,7 @@ const DictionaryEditionDrawer = ({
|
|
|
87
87
|
return /* @__PURE__ */ jsx(
|
|
88
88
|
RightDrawer,
|
|
89
89
|
{
|
|
90
|
-
title:
|
|
90
|
+
title: dictionaryKey,
|
|
91
91
|
identifier: id,
|
|
92
92
|
header: /* @__PURE__ */ jsx(
|
|
93
93
|
LocaleSwitcher,
|
|
@@ -107,7 +107,9 @@ const DictionaryEditionDrawer = ({
|
|
|
107
107
|
focusedContent,
|
|
108
108
|
locale,
|
|
109
109
|
identifier: id,
|
|
110
|
-
handleOnBack
|
|
110
|
+
handleOnBack,
|
|
111
|
+
isDarkMode,
|
|
112
|
+
localeList
|
|
111
113
|
}
|
|
112
114
|
)
|
|
113
115
|
}
|
|
@@ -117,8 +119,8 @@ const DictionaryEditionDrawerController = ({ locale, localeList, setLocale }) =>
|
|
|
117
119
|
const focusedContent = useEditionPanelStore(
|
|
118
120
|
useShallow((s) => s.focusedContent)
|
|
119
121
|
);
|
|
120
|
-
const
|
|
121
|
-
if (!
|
|
122
|
+
const dictionaryKey = focusedContent?.dictionaryKey;
|
|
123
|
+
if (!dictionaryKey) {
|
|
122
124
|
return /* @__PURE__ */ jsx(Fragment, {});
|
|
123
125
|
}
|
|
124
126
|
return /* @__PURE__ */ jsx(
|
|
@@ -127,7 +129,7 @@ const DictionaryEditionDrawerController = ({ locale, localeList, setLocale }) =>
|
|
|
127
129
|
locale,
|
|
128
130
|
localeList,
|
|
129
131
|
setLocale,
|
|
130
|
-
|
|
132
|
+
dictionaryKey
|
|
131
133
|
}
|
|
132
134
|
);
|
|
133
135
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/DictionaryEditionDrawer/DictionaryEditionDrawer.tsx"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport type { Dictionary, KeyPath } from '@intlayer/core';\nimport {\n RightDrawer,\n DictionaryEditor,\n LocaleSwitcher,\n Modal,\n useEditionPanelStore,\n DictionaryFieldEditor,\n useRightDrawerStore,\n} from '@intlayer/design-system';\nimport { useGetAllDictionaries } from '@intlayer/design-system/hooks';\nimport { useCallback, useEffect, useState, type FC } from 'react';\nimport { t, useDictionary } from 'react-intlayer';\nimport { useShallow } from 'zustand/shallow';\nimport { dictionaryListDrawerIdentifier } from '../DictionaryListDrawer/dictionaryListDrawerIdentifier';\nimport dictionaryEditionDrawerContent from './dictionaryEditionDrawer.content';\nimport {\n type FileContent as FileContentWithDictionaryPath,\n useDictionaryEditionDrawer,\n getDrawerIdentifier,\n} from './useDictionaryEditionDrawer';\n\ntype DictionaryEditionDrawerContentProps = {\n focusedContent: FileContentWithDictionaryPath;\n locale: Locales;\n identifier: string;\n handleOnBack: () => void;\n};\n\nexport const DictionaryEditionDrawerContent: FC<\n DictionaryEditionDrawerContentProps\n> = ({ locale, identifier, handleOnBack }) => {\n const [keyPathEditionModal, setKeyPathEditionModal] = useState<\n KeyPath[] | null\n >(null);\n const { setDictionariesRecord, focusedContent } =\n useDictionaryEditionDrawer(identifier);\n const { all: dictionaries } = useGetAllDictionaries();\n\n const onClickDictionaryList = useCallback(() => {\n setKeyPathEditionModal(null);\n handleOnBack();\n }, [handleOnBack]);\n\n useEffect(() => {\n if (dictionaries) {\n setDictionariesRecord(dictionaries);\n }\n }, [setDictionariesRecord, dictionaries]);\n\n const
|
|
1
|
+
{"version":3,"sources":["../../../src/DictionaryEditionDrawer/DictionaryEditionDrawer.tsx"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport type { Dictionary, KeyPath } from '@intlayer/core';\nimport {\n RightDrawer,\n DictionaryEditor,\n LocaleSwitcher,\n Modal,\n useEditionPanelStore,\n DictionaryFieldEditor,\n useRightDrawerStore,\n} from '@intlayer/design-system';\nimport { useGetAllDictionaries } from '@intlayer/design-system/hooks';\nimport { useCallback, useEffect, useState, type FC } from 'react';\nimport { t, useDictionary } from 'react-intlayer';\nimport { useShallow } from 'zustand/shallow';\nimport { dictionaryListDrawerIdentifier } from '../DictionaryListDrawer/dictionaryListDrawerIdentifier';\nimport dictionaryEditionDrawerContent from './dictionaryEditionDrawer.content';\nimport {\n type FileContent as FileContentWithDictionaryPath,\n useDictionaryEditionDrawer,\n getDrawerIdentifier,\n} from './useDictionaryEditionDrawer';\n\ntype DictionaryEditionDrawerContentProps = {\n focusedContent: FileContentWithDictionaryPath;\n locale: Locales;\n localeList: Locales[];\n identifier: string;\n handleOnBack: () => void;\n isDarkMode?: boolean;\n};\n\nexport const DictionaryEditionDrawerContent: FC<\n DictionaryEditionDrawerContentProps\n> = ({ locale, localeList, identifier, handleOnBack, isDarkMode }) => {\n const { modalTitle } = useDictionary(dictionaryEditionDrawerContent);\n const [keyPathEditionModal, setKeyPathEditionModal] = useState<\n KeyPath[] | null\n >(null);\n const { setDictionariesRecord, focusedContent } =\n useDictionaryEditionDrawer(identifier);\n const { all: dictionaries } = useGetAllDictionaries();\n\n const onClickDictionaryList = useCallback(() => {\n setKeyPathEditionModal(null);\n handleOnBack();\n }, [handleOnBack]);\n\n useEffect(() => {\n if (dictionaries) {\n setDictionariesRecord(dictionaries);\n }\n }, [setDictionariesRecord, dictionaries]);\n\n const dictionaryKey = focusedContent?.dictionaryKey;\n\n if (!dictionaryKey) return <>No dictionary focused</>;\n\n const dictionary: Dictionary = dictionaries[dictionaryKey];\n\n return (\n <>\n <Modal\n isOpen={keyPathEditionModal !== null}\n onClose={() => setKeyPathEditionModal(null)}\n hasCloseButton\n title={modalTitle}\n size=\"xl\"\n transparency=\"lg\"\n >\n {dictionary && (\n <DictionaryFieldEditor\n dictionary={dictionary}\n onClickDictionaryList={onClickDictionaryList}\n isDarkMode={isDarkMode}\n availableLocales={localeList}\n />\n )}\n </Modal>\n <DictionaryEditor\n dictionary={dictionary}\n locale={locale}\n onClickEdit={setKeyPathEditionModal}\n />\n </>\n );\n};\n\ntype DictionaryEditionDrawerProps = DictionaryEditionDrawerControllerProps & {\n dictionaryKey: string;\n isDarkMode?: boolean;\n};\n\nexport const DictionaryEditionDrawer: FC<DictionaryEditionDrawerProps> = ({\n locale,\n localeList,\n setLocale,\n dictionaryKey,\n isDarkMode,\n}) => {\n const { backButtonText } = useDictionary(dictionaryEditionDrawerContent);\n const id = getDrawerIdentifier(dictionaryKey);\n\n const { focusedContent, close } = useDictionaryEditionDrawer(dictionaryKey);\n const { openDictionaryListDrawer } = useRightDrawerStore((s) => ({\n openDictionaryListDrawer: () => s.open(dictionaryListDrawerIdentifier),\n }));\n\n const handleOnBack = () => {\n close();\n openDictionaryListDrawer();\n };\n\n return (\n <RightDrawer\n title={dictionaryKey}\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: backButtonText,\n }}\n >\n {focusedContent && (\n <DictionaryEditionDrawerContent\n focusedContent={focusedContent}\n locale={locale}\n identifier={id}\n handleOnBack={handleOnBack}\n isDarkMode={isDarkMode}\n localeList={localeList}\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(\n useShallow((s) => s.focusedContent)\n );\n const dictionaryKey: string | undefined = focusedContent?.dictionaryKey;\n\n if (!dictionaryKey) {\n return <></>;\n }\n\n return (\n <DictionaryEditionDrawer\n locale={locale}\n localeList={localeList}\n setLocale={setLocale}\n dictionaryKey={dictionaryKey}\n />\n );\n};\n"],"mappings":";AA0D6B,wBAKzB,YALyB;AAtD7B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,6BAA6B;AACtC,SAAS,aAAa,WAAW,gBAAyB;AAC1D,SAAY,qBAAqB;AACjC,SAAS,kBAAkB;AAC3B,SAAS,sCAAsC;AAC/C,OAAO,oCAAoC;AAC3C;AAAA,EAEE;AAAA,EACA;AAAA,OACK;AAWA,MAAM,iCAET,CAAC,EAAE,QAAQ,YAAY,YAAY,cAAc,WAAW,MAAM;AACpE,QAAM,EAAE,WAAW,IAAI,cAAc,8BAA8B;AACnE,QAAM,CAAC,qBAAqB,sBAAsB,IAAI,SAEpD,IAAI;AACN,QAAM,EAAE,uBAAuB,eAAe,IAC5C,2BAA2B,UAAU;AACvC,QAAM,EAAE,KAAK,aAAa,IAAI,sBAAsB;AAEpD,QAAM,wBAAwB,YAAY,MAAM;AAC9C,2BAAuB,IAAI;AAC3B,iBAAa;AAAA,EACf,GAAG,CAAC,YAAY,CAAC;AAEjB,YAAU,MAAM;AACd,QAAI,cAAc;AAChB,4BAAsB,YAAY;AAAA,IACpC;AAAA,EACF,GAAG,CAAC,uBAAuB,YAAY,CAAC;AAExC,QAAM,gBAAgB,gBAAgB;AAEtC,MAAI,CAAC,cAAe,QAAO,gCAAE,mCAAqB;AAElD,QAAM,aAAyB,aAAa,aAAa;AAEzD,SACE,iCACE;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,QAAQ,wBAAwB;AAAA,QAChC,SAAS,MAAM,uBAAuB,IAAI;AAAA,QAC1C,gBAAc;AAAA,QACd,OAAO;AAAA,QACP,MAAK;AAAA,QACL,cAAa;AAAA,QAEZ,wBACC;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACA,kBAAkB;AAAA;AAAA,QACpB;AAAA;AAAA,IAEJ;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,aAAa;AAAA;AAAA,IACf;AAAA,KACF;AAEJ;AAOO,MAAM,0BAA4D,CAAC;AAAA,EACxE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,eAAe,IAAI,cAAc,8BAA8B;AACvE,QAAM,KAAK,oBAAoB,aAAa;AAE5C,QAAM,EAAE,gBAAgB,MAAM,IAAI,2BAA2B,aAAa;AAC1E,QAAM,EAAE,yBAAyB,IAAI,oBAAoB,CAAC,OAAO;AAAA,IAC/D,0BAA0B,MAAM,EAAE,KAAK,8BAA8B;AAAA,EACvE,EAAE;AAEF,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,UACZ;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACF;AAAA;AAAA,EAEJ;AAEJ;AAQO,MAAM,oCAET,CAAC,EAAE,QAAQ,YAAY,UAAU,MAAM;AACzC,QAAM,iBAAiB;AAAA,IACrB,WAAW,CAAC,MAAM,EAAE,cAAc;AAAA,EACpC;AACA,QAAM,gBAAoC,gBAAgB;AAE1D,MAAI,CAAC,eAAe;AAClB,WAAO,gCAAE;AAAA,EACX;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -5,7 +5,47 @@ const dictionaryEditionDrawerContent = {
|
|
|
5
5
|
backButtonText: t({
|
|
6
6
|
en: "Dictionary list",
|
|
7
7
|
fr: "Liste des dictionnaires",
|
|
8
|
-
es: "Lista de diccionarios"
|
|
8
|
+
es: "Lista de diccionarios",
|
|
9
|
+
de: "W\xF6rterbuchliste",
|
|
10
|
+
ja: "\u8F9E\u66F8\u30EA\u30B9\u30C8",
|
|
11
|
+
ko: "\uC0AC\uC804 \uBAA9\uB85D",
|
|
12
|
+
zh: "\u8BCD\u5178\u5217\u8868",
|
|
13
|
+
it: "Elenco di dizionari",
|
|
14
|
+
pt: "Lista de dicion\xE1rios",
|
|
15
|
+
hi: "\u0936\u092C\u094D\u0926\u0915\u094B\u0936 \u0938\u0942\u091A\u0940",
|
|
16
|
+
ar: "\u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0642\u0648\u0627\u0645\u0644",
|
|
17
|
+
ru: "\u0421\u043F\u0438\u0441\u043E\u043A \u0441\u043B\u043E\u0432\u0430\u0440\u0435\u0439",
|
|
18
|
+
"en-GB": "Dictionary list"
|
|
19
|
+
}),
|
|
20
|
+
modalTitle: t({
|
|
21
|
+
en: "Edit dictionary",
|
|
22
|
+
fr: "Modifier le dictionnaire",
|
|
23
|
+
es: "Editar el diccionario",
|
|
24
|
+
de: "W\xF6rterbuch bearbeiten",
|
|
25
|
+
ja: "\u8F9E\u66F8\u3092\u7DE8\u96C6",
|
|
26
|
+
ko: "\uC0AC\uC804 \uD3B8\uC9D1",
|
|
27
|
+
zh: "\u7F16\u8F91\u8BCD\u5178",
|
|
28
|
+
it: "Modifica dizionario",
|
|
29
|
+
pt: "Editar dicion\xE1rio",
|
|
30
|
+
hi: "\u0936\u092C\u094D\u0926\u0915\u094B\u0936 \u0938\u0902\u092A\u093E\u0926\u093F\u0924 \u0915\u0930\u0947\u0902",
|
|
31
|
+
ar: "\u062A\u062D\u0631\u064A\u0631 \u0642\u0627\u0645\u0648\u0633",
|
|
32
|
+
ru: "\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0441\u043B\u043E\u0432\u0430\u0440\u044C",
|
|
33
|
+
"en-GB": "Edit dictionary"
|
|
34
|
+
}),
|
|
35
|
+
noDictionaryFocused: t({
|
|
36
|
+
en: "No dictionary focused",
|
|
37
|
+
fr: "Aucun dictionnaire s\xE9lectionn\xE9",
|
|
38
|
+
es: "No hay diccionario enfocado",
|
|
39
|
+
de: "Kein W\xF6rterbuch ausgew\xE4hlt",
|
|
40
|
+
ja: "\u30D5\u30A9\u30FC\u30AB\u30B9\u3055\u308C\u305F\u8F9E\u66F8\u304C\u3042\u308A\u307E\u305B\u3093",
|
|
41
|
+
ko: "\uD3EC\uCEE4\uC2A4\uAC00 \uC788\uB294 \uC0AC\uC804\uC774 \uC5C6\uC2B5\uB2C8\uB2E4",
|
|
42
|
+
zh: "\u6CA1\u6709\u805A\u7126\u7684\u8BCD\u5178",
|
|
43
|
+
it: "Nessun dizionario selezionato",
|
|
44
|
+
pt: "Nenhum dicion\xE1rio focalizado",
|
|
45
|
+
hi: "\u0915\u094B\u0908 \u092B\u094B\u0915\u0938 \u0936\u092C\u094D\u0926\u0915\u094B\u0936 \u0928\u0939\u0940\u0902 \u0939\u0948",
|
|
46
|
+
ar: "\u0644\u0627 \u064A\u0648\u062C\u062F \u0642\u0627\u0645\u0648\u0633 \u0645\u0631\u062A\u0628\u0637",
|
|
47
|
+
ru: "\u041D\u0435\u0442 \u0444\u043E\u043A\u0443\u0441\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u043E\u0433\u043E \u0441\u043B\u043E\u0432\u0430\u0440\u044F",
|
|
48
|
+
"en-GB": "No dictionary focused"
|
|
9
49
|
})
|
|
10
50
|
}
|
|
11
51
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/DictionaryEditionDrawer/dictionaryEditionDrawer.content.ts"],"sourcesContent":["import { t, type DeclarationContent } from 'intlayer';\n\nconst dictionaryEditionDrawerContent = {\n key: 'dictionary-edition-drawer',\n content: {\n backButtonText: t({\n en: 'Dictionary list',\n fr: 'Liste des dictionnaires',\n es: 'Lista de diccionarios',\n }),\n },\n} satisfies DeclarationContent;\n\nexport default dictionaryEditionDrawerContent;\n"],"mappings":"AAAA,SAAS,SAAkC;AAE3C,MAAM,iCAAiC;AAAA,EACrC,KAAK;AAAA,EACL,SAAS;AAAA,IACP,gBAAgB,EAAE;AAAA,MAChB,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/DictionaryEditionDrawer/dictionaryEditionDrawer.content.ts"],"sourcesContent":["import { t, type DeclarationContent } from 'intlayer';\n\nconst dictionaryEditionDrawerContent = {\n key: 'dictionary-edition-drawer',\n content: {\n backButtonText: t({\n en: 'Dictionary list',\n fr: 'Liste des dictionnaires',\n es: 'Lista de diccionarios',\n de: 'Wörterbuchliste',\n ja: '辞書リスト',\n ko: '사전 목록',\n zh: '词典列表',\n it: 'Elenco di dizionari',\n pt: 'Lista de dicionários',\n hi: 'शब्दकोश सूची',\n ar: 'قائمة القوامل',\n ru: 'Список словарей',\n 'en-GB': 'Dictionary list',\n }),\n modalTitle: t({\n en: 'Edit dictionary',\n fr: 'Modifier le dictionnaire',\n es: 'Editar el diccionario',\n de: 'Wörterbuch bearbeiten',\n ja: '辞書を編集',\n ko: '사전 편집',\n zh: '编辑词典',\n it: 'Modifica dizionario',\n pt: 'Editar dicionário',\n hi: 'शब्दकोश संपादित करें',\n ar: 'تحرير قاموس',\n ru: 'Редактировать словарь',\n 'en-GB': 'Edit dictionary',\n }),\n noDictionaryFocused: t({\n en: 'No dictionary focused',\n fr: 'Aucun dictionnaire sélectionné',\n es: 'No hay diccionario enfocado',\n de: 'Kein Wörterbuch ausgewählt',\n ja: 'フォーカスされた辞書がありません',\n ko: '포커스가 있는 사전이 없습니다',\n zh: '没有聚焦的词典',\n it: 'Nessun dizionario selezionato',\n pt: 'Nenhum dicionário focalizado',\n hi: 'कोई फोकस शब्दकोश नहीं है',\n ar: 'لا يوجد قاموس مرتبط',\n ru: 'Нет фокусированного словаря',\n 'en-GB': 'No dictionary focused',\n }),\n },\n} satisfies DeclarationContent;\n\nexport default dictionaryEditionDrawerContent;\n"],"mappings":"AAAA,SAAS,SAAkC;AAE3C,MAAM,iCAAiC;AAAA,EACrC,KAAK;AAAA,EACL,SAAS;AAAA,IACP,gBAAgB,EAAE;AAAA,MAChB,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,SAAS;AAAA,IACX,CAAC;AAAA,IACD,YAAY,EAAE;AAAA,MACZ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,SAAS;AAAA,IACX,CAAC;AAAA,IACD,qBAAqB,EAAE;AAAA,MACrB,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,SAAS;AAAA,IACX,CAAC;AAAA,EACH;AACF;AAEA,IAAO,0CAAQ;","names":[]}
|
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
} from "@intlayer/design-system";
|
|
6
6
|
import { useCallback } from "react";
|
|
7
7
|
import { useShallow } from "zustand/shallow";
|
|
8
|
-
const getDrawerIdentifier = (
|
|
9
|
-
const useDictionaryEditionDrawer = (
|
|
10
|
-
const id = getDrawerIdentifier(
|
|
8
|
+
const getDrawerIdentifier = (dictionaryKey) => `dictionary_edition_${dictionaryKey}`;
|
|
9
|
+
const useDictionaryEditionDrawer = (dictionaryKey) => {
|
|
10
|
+
const id = getDrawerIdentifier(dictionaryKey);
|
|
11
11
|
const { isOpenDrawer, openDrawer, closeDrawer } = useRightDrawerStore(
|
|
12
12
|
useShallow((e) => ({
|
|
13
13
|
isOpenDrawer: e.isOpen,
|
|
@@ -29,12 +29,12 @@ const useDictionaryEditionDrawer = (dictionaryId) => {
|
|
|
29
29
|
);
|
|
30
30
|
const openDictionaryEditionDrawer = useCallback(
|
|
31
31
|
({
|
|
32
|
-
|
|
32
|
+
dictionaryKey: dictionaryKey2,
|
|
33
33
|
dictionaryPath,
|
|
34
34
|
keyPath = []
|
|
35
35
|
}) => {
|
|
36
36
|
setFocusedContent({
|
|
37
|
-
|
|
37
|
+
dictionaryKey: dictionaryKey2,
|
|
38
38
|
dictionaryPath,
|
|
39
39
|
keyPath
|
|
40
40
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/DictionaryEditionDrawer/useDictionaryEditionDrawer.ts"],"sourcesContent":["import type { Dictionary, DictionaryValue, KeyPath } from '@intlayer/core';\nimport {\n useRightDrawerStore,\n useEditedContentStore,\n useEditionPanelStore,\n} from '@intlayer/design-system';\nimport { useCallback } from 'react';\nimport { useShallow } from 'zustand/shallow';\n\nexport const getDrawerIdentifier = (
|
|
1
|
+
{"version":3,"sources":["../../../src/DictionaryEditionDrawer/useDictionaryEditionDrawer.ts"],"sourcesContent":["import type { Dictionary, DictionaryValue, KeyPath } from '@intlayer/core';\nimport {\n useRightDrawerStore,\n useEditedContentStore,\n useEditionPanelStore,\n} from '@intlayer/design-system';\nimport { useCallback } from 'react';\nimport { useShallow } from 'zustand/shallow';\n\nexport const getDrawerIdentifier = (dictionaryKey: string) =>\n `dictionary_edition_${dictionaryKey}`;\n\ntype DictionaryKey = string;\ntype DictionaryPath = string;\n\nexport type FileContent = {\n dictionaryPath?: DictionaryPath;\n dictionaryKey: DictionaryKey;\n keyPath?: KeyPath[];\n};\n\ntype DictionaryEditionDrawer = {\n focusedContent: FileContent | null;\n isOpen: boolean;\n open: (content: FileContent) => void;\n close: () => void;\n setDictionariesRecord: (\n dictionariesRecord: Record<DictionaryKey, Dictionary>\n ) => void;\n getEditedContentValue: (\n dictionaryKey: DictionaryKey,\n keyPath: KeyPath[]\n ) => DictionaryValue | undefined;\n};\n\ntype OpenDictionaryEditionDrawerProps = {\n dictionaryKey: string;\n dictionaryPath?: string;\n keyPath?: KeyPath[];\n};\n\nexport const useDictionaryEditionDrawer = (\n dictionaryKey: string\n): DictionaryEditionDrawer => {\n const id = getDrawerIdentifier(dictionaryKey);\n const { isOpenDrawer, openDrawer, closeDrawer } = useRightDrawerStore(\n useShallow((e) => ({\n isOpenDrawer: e.isOpen,\n openDrawer: e.open,\n closeDrawer: e.close,\n }))\n );\n const { setDictionariesRecord, getEditedContentValue } =\n useEditedContentStore(\n useShallow((s) => ({\n setDictionariesRecord: s.setDictionariesRecord,\n getEditedContentValue: s.getEditedContentValue,\n }))\n );\n const { setFocusedContent, focusedContent } = useEditionPanelStore(\n useShallow((s) => ({\n focusedContent: s.focusedContent,\n setFocusedContent: s.setFocusedContent,\n }))\n );\n\n const openDictionaryEditionDrawer = useCallback(\n ({\n dictionaryKey,\n dictionaryPath,\n keyPath = [],\n }: OpenDictionaryEditionDrawerProps) => {\n setFocusedContent({\n dictionaryKey,\n dictionaryPath,\n keyPath,\n });\n\n openDrawer(id);\n },\n [openDrawer, setFocusedContent]\n );\n\n return {\n isOpen: isOpenDrawer(id),\n focusedContent,\n setDictionariesRecord,\n getEditedContentValue,\n open: openDictionaryEditionDrawer,\n close: () => closeDrawer(id),\n };\n};\n"],"mappings":"AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAEpB,MAAM,sBAAsB,CAAC,kBAClC,sBAAsB,aAAa;AA+B9B,MAAM,6BAA6B,CACxC,kBAC4B;AAC5B,QAAM,KAAK,oBAAoB,aAAa;AAC5C,QAAM,EAAE,cAAc,YAAY,YAAY,IAAI;AAAA,IAChD,WAAW,CAAC,OAAO;AAAA,MACjB,cAAc,EAAE;AAAA,MAChB,YAAY,EAAE;AAAA,MACd,aAAa,EAAE;AAAA,IACjB,EAAE;AAAA,EACJ;AACA,QAAM,EAAE,uBAAuB,sBAAsB,IACnD;AAAA,IACE,WAAW,CAAC,OAAO;AAAA,MACjB,uBAAuB,EAAE;AAAA,MACzB,uBAAuB,EAAE;AAAA,IAC3B,EAAE;AAAA,EACJ;AACF,QAAM,EAAE,mBAAmB,eAAe,IAAI;AAAA,IAC5C,WAAW,CAAC,OAAO;AAAA,MACjB,gBAAgB,EAAE;AAAA,MAClB,mBAAmB,EAAE;AAAA,IACvB,EAAE;AAAA,EACJ;AAEA,QAAM,8BAA8B;AAAA,IAClC,CAAC;AAAA,MACC,eAAAA;AAAA,MACA;AAAA,MACA,UAAU,CAAC;AAAA,IACb,MAAwC;AACtC,wBAAkB;AAAA,QAChB,eAAAA;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AAED,iBAAW,EAAE;AAAA,IACf;AAAA,IACA,CAAC,YAAY,iBAAiB;AAAA,EAChC;AAEA,SAAO;AAAA,IACL,QAAQ,aAAa,EAAE;AAAA,IACvB;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM;AAAA,IACN,OAAO,MAAM,YAAY,EAAE;AAAA,EAC7B;AACF;","names":["dictionaryKey"]}
|
|
@@ -31,17 +31,17 @@ const DictionaryListDrawer = () => {
|
|
|
31
31
|
const setFocusedContent = useEditionPanelStore(
|
|
32
32
|
useShallow((s) => s.setFocusedContent)
|
|
33
33
|
);
|
|
34
|
-
const handleClickDictionary = (
|
|
34
|
+
const handleClickDictionary = (dictionaryKey) => {
|
|
35
35
|
closeDrawer(dictionaryListDrawerIdentifier);
|
|
36
|
-
const { filePath } = dictionaries[
|
|
36
|
+
const { filePath } = dictionaries[dictionaryKey];
|
|
37
37
|
setFocusedContent({
|
|
38
|
-
|
|
38
|
+
dictionaryKey,
|
|
39
39
|
dictionaryPath: filePath
|
|
40
40
|
});
|
|
41
|
-
openDrawer(getDrawerIdentifier(
|
|
41
|
+
openDrawer(getDrawerIdentifier(dictionaryKey));
|
|
42
42
|
};
|
|
43
43
|
const isDictionaryEdited = useCallback(
|
|
44
|
-
(
|
|
44
|
+
(dictionaryKey) => Object.keys(editedContent).includes(dictionaryKey),
|
|
45
45
|
[editedContent]
|
|
46
46
|
);
|
|
47
47
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
@@ -49,19 +49,19 @@ const DictionaryListDrawer = () => {
|
|
|
49
49
|
{
|
|
50
50
|
title: "Dictionary list",
|
|
51
51
|
identifier: dictionaryListDrawerIdentifier,
|
|
52
|
-
children: dictionaryKeyList.map((
|
|
52
|
+
children: dictionaryKeyList.map((dictionaryKey) => /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
53
53
|
Button,
|
|
54
54
|
{
|
|
55
|
-
label: `Open dictionary editor ${
|
|
56
|
-
onClick: () => handleClickDictionary(
|
|
55
|
+
label: `Open dictionary editor ${dictionaryKey}`,
|
|
56
|
+
onClick: () => handleClickDictionary(dictionaryKey),
|
|
57
57
|
variant: "hoverable",
|
|
58
58
|
color: "text",
|
|
59
59
|
IconRight: ChevronRight,
|
|
60
60
|
size: "md",
|
|
61
61
|
isFullWidth: true,
|
|
62
|
-
children: isDictionaryEdited(
|
|
62
|
+
children: isDictionaryEdited(dictionaryKey) ? `\u270E ${dictionaryKey}` : dictionaryKey
|
|
63
63
|
}
|
|
64
|
-
) },
|
|
64
|
+
) }, dictionaryKey))
|
|
65
65
|
}
|
|
66
66
|
) });
|
|
67
67
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/DictionaryListDrawer/DictionaryListDrawer.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config';\nimport {\n RightDrawer,\n Button,\n useEditedContentStore,\n useEditionPanelStore,\n useRightDrawerStore,\n} from '@intlayer/design-system';\nimport { useGetAllDictionaries } from '@intlayer/design-system/hooks';\nimport { ChevronRight } from 'lucide-react';\nimport { useCallback, useMemo, FC } from 'react';\nimport { useShallow } from 'zustand/shallow';\nimport { getDrawerIdentifier } from '../DictionaryEditionDrawer/useDictionaryEditionDrawer';\nimport { dictionaryListDrawerIdentifier } from './dictionaryListDrawerIdentifier';\n\nexport const DictionaryListDrawer: FC = () => {\n const { all: dictionaries } = useGetAllDictionaries();\n const dictionaryKeyList = useMemo(\n () => Object.keys(dictionaries) as Locales[],\n [dictionaries]\n );\n\n const { closeDrawer, openDrawer } = useRightDrawerStore(\n useShallow((s) => ({\n closeDrawer: s.close,\n openDrawer: s.open,\n }))\n );\n\n const editedContent = useEditedContentStore(\n useShallow((s) => s.editedContent)\n );\n const setFocusedContent = useEditionPanelStore(\n useShallow((s) => s.setFocusedContent)\n );\n\n const handleClickDictionary = (
|
|
1
|
+
{"version":3,"sources":["../../../src/DictionaryListDrawer/DictionaryListDrawer.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config';\nimport {\n RightDrawer,\n Button,\n useEditedContentStore,\n useEditionPanelStore,\n useRightDrawerStore,\n} from '@intlayer/design-system';\nimport { useGetAllDictionaries } from '@intlayer/design-system/hooks';\nimport { ChevronRight } from 'lucide-react';\nimport { useCallback, useMemo, FC } from 'react';\nimport { useShallow } from 'zustand/shallow';\nimport { getDrawerIdentifier } from '../DictionaryEditionDrawer/useDictionaryEditionDrawer';\nimport { dictionaryListDrawerIdentifier } from './dictionaryListDrawerIdentifier';\n\nexport const DictionaryListDrawer: FC = () => {\n const { all: dictionaries } = useGetAllDictionaries();\n const dictionaryKeyList = useMemo(\n () => Object.keys(dictionaries) as Locales[],\n [dictionaries]\n );\n\n const { closeDrawer, openDrawer } = useRightDrawerStore(\n useShallow((s) => ({\n closeDrawer: s.close,\n openDrawer: s.open,\n }))\n );\n\n const editedContent = useEditedContentStore(\n useShallow((s) => s.editedContent)\n );\n const setFocusedContent = useEditionPanelStore(\n useShallow((s) => s.setFocusedContent)\n );\n\n const handleClickDictionary = (dictionaryKey: string) => {\n closeDrawer(dictionaryListDrawerIdentifier);\n\n const { filePath } = dictionaries[dictionaryKey];\n setFocusedContent({\n dictionaryKey,\n dictionaryPath: filePath,\n });\n\n openDrawer(getDrawerIdentifier(dictionaryKey));\n };\n\n const isDictionaryEdited = useCallback(\n (dictionaryKey: string) =>\n Object.keys(editedContent).includes(dictionaryKey),\n [editedContent]\n );\n\n return (\n <>\n <RightDrawer\n title=\"Dictionary list\"\n identifier={dictionaryListDrawerIdentifier}\n >\n {dictionaryKeyList.map((dictionaryKey) => (\n <div key={dictionaryKey}>\n <Button\n label={`Open dictionary editor ${dictionaryKey}`}\n onClick={() => handleClickDictionary(dictionaryKey)}\n variant=\"hoverable\"\n color=\"text\"\n IconRight={ChevronRight}\n size=\"md\"\n isFullWidth\n >\n {isDictionaryEdited(dictionaryKey)\n ? `✎ ${dictionaryKey}`\n : dictionaryKey}\n </Button>\n </div>\n ))}\n </RightDrawer>\n </>\n );\n};\n"],"mappings":";AAyDI,mBAOQ,WAPR;AAtDJ;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,6BAA6B;AACtC,SAAS,oBAAoB;AAC7B,SAAS,aAAa,eAAmB;AACzC,SAAS,kBAAkB;AAC3B,SAAS,2BAA2B;AACpC,SAAS,sCAAsC;AAExC,MAAM,uBAA2B,MAAM;AAC5C,QAAM,EAAE,KAAK,aAAa,IAAI,sBAAsB;AACpD,QAAM,oBAAoB;AAAA,IACxB,MAAM,OAAO,KAAK,YAAY;AAAA,IAC9B,CAAC,YAAY;AAAA,EACf;AAEA,QAAM,EAAE,aAAa,WAAW,IAAI;AAAA,IAClC,WAAW,CAAC,OAAO;AAAA,MACjB,aAAa,EAAE;AAAA,MACf,YAAY,EAAE;AAAA,IAChB,EAAE;AAAA,EACJ;AAEA,QAAM,gBAAgB;AAAA,IACpB,WAAW,CAAC,MAAM,EAAE,aAAa;AAAA,EACnC;AACA,QAAM,oBAAoB;AAAA,IACxB,WAAW,CAAC,MAAM,EAAE,iBAAiB;AAAA,EACvC;AAEA,QAAM,wBAAwB,CAAC,kBAA0B;AACvD,gBAAY,8BAA8B;AAE1C,UAAM,EAAE,SAAS,IAAI,aAAa,aAAa;AAC/C,sBAAkB;AAAA,MAChB;AAAA,MACA,gBAAgB;AAAA,IAClB,CAAC;AAED,eAAW,oBAAoB,aAAa,CAAC;AAAA,EAC/C;AAEA,QAAM,qBAAqB;AAAA,IACzB,CAAC,kBACC,OAAO,KAAK,aAAa,EAAE,SAAS,aAAa;AAAA,IACnD,CAAC,aAAa;AAAA,EAChB;AAEA,SACE,gCACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAM;AAAA,MACN,YAAY;AAAA,MAEX,4BAAkB,IAAI,CAAC,kBACtB,oBAAC,SACC;AAAA,QAAC;AAAA;AAAA,UACC,OAAO,0BAA0B,aAAa;AAAA,UAC9C,SAAS,MAAM,sBAAsB,aAAa;AAAA,UAClD,SAAQ;AAAA,UACR,OAAM;AAAA,UACN,WAAW;AAAA,UACX,MAAK;AAAA,UACL,aAAW;AAAA,UAEV,6BAAmB,aAAa,IAC7B,UAAK,aAAa,KAClB;AAAA;AAAA,MACN,KAbQ,aAcV,CACD;AAAA;AAAA,EACH,GACF;AAEJ;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { getConfiguration } from "@intlayer/config/client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { appLogger, getConfiguration } from "@intlayer/config/client";
|
|
4
4
|
import { DictionaryEditionDrawerController } from './DictionaryEditionDrawer/index.mjs';
|
|
5
5
|
import { DictionaryListDrawer } from './DictionaryListDrawer/index.mjs';
|
|
6
6
|
import { useIntlayerContext } from "react-intlayer";
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
useEffect,
|
|
13
13
|
useMemo
|
|
14
14
|
} from "react";
|
|
15
|
+
import { AsyncStateProvider } from "@intlayer/design-system/hooks";
|
|
15
16
|
const IntlayerEditorContext = createContext({
|
|
16
17
|
isEditorEnabled: false
|
|
17
18
|
});
|
|
@@ -37,20 +38,26 @@ const IntlayerEditorProvider = ({
|
|
|
37
38
|
useEffect(() => {
|
|
38
39
|
if (isEnabled && editor.enabled) {
|
|
39
40
|
if (!editor.clientId) {
|
|
40
|
-
|
|
41
|
-
"Editor is enabled but clientId is not set. Please set it in the editor configuration. See http://localhost:3000/doc/concept/editor."
|
|
41
|
+
appLogger(
|
|
42
|
+
"Editor is enabled but clientId is not set. Please set it in the editor configuration. See http://localhost:3000/doc/concept/editor.",
|
|
43
|
+
{
|
|
44
|
+
level: "error"
|
|
45
|
+
}
|
|
42
46
|
);
|
|
43
47
|
}
|
|
44
48
|
if (!editor.clientSecret) {
|
|
45
|
-
|
|
46
|
-
"Editor is enabled but clientSecret is not set. Please set it in the editor configuration. See http://localhost:3000/doc/concept/editor."
|
|
49
|
+
appLogger(
|
|
50
|
+
"Editor is enabled but clientSecret is not set. Please set it in the editor configuration. See http://localhost:3000/doc/concept/editor.",
|
|
51
|
+
{
|
|
52
|
+
level: "error"
|
|
53
|
+
}
|
|
47
54
|
);
|
|
48
55
|
}
|
|
49
56
|
}
|
|
50
57
|
}, [isEnabled, editor.enabled, editor.clientId, editor.clientSecret]);
|
|
51
58
|
return /* @__PURE__ */ jsxs(IntlayerEditorContext.Provider, { value: { isEditorEnabled }, children: [
|
|
52
59
|
children,
|
|
53
|
-
isEditorEnabled && /* @__PURE__ */ jsxs(
|
|
60
|
+
isEditorEnabled && /* @__PURE__ */ jsxs(AsyncStateProvider, { children: [
|
|
54
61
|
/* @__PURE__ */ jsx(
|
|
55
62
|
DictionaryEditionDrawerController,
|
|
56
63
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/IntlayerEditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport { getConfiguration } from '@intlayer/config/client';\nimport { DictionaryEditionDrawerController } from './DictionaryEditionDrawer/index';\nimport { DictionaryListDrawer } from './DictionaryListDrawer/index';\nimport { useIntlayerContext } from 'react-intlayer';\nimport { useContentSelectorContext } from 'react-intlayer/editor';\nimport { ContentSelectorWrapper } from './ContentSelectorWrapper';\nimport {\n type FC,\n type PropsWithChildren,\n createContext,\n useContext,\n useEffect,\n useMemo,\n} from 'react';\n\ntype IntlayerEditorValue = {\n isEditorEnabled: boolean;\n};\n\n/**\n * Context that store the current locale on the client side\n */\nexport const IntlayerEditorContext = createContext<IntlayerEditorValue>({\n isEditorEnabled: false,\n});\n\n/**\n * Hook that provides the current locale\n */\nexport const useIntlayerEditorContext = () => useContext(IntlayerEditorContext);\n\nexport type IntlayerEditorProviderProps = PropsWithChildren<{\n isEnabled?: boolean;\n}>;\n\n/**\n * Provider that store the current locale on the client side\n */\nexport const IntlayerEditorProvider: FC<IntlayerEditorProviderProps> = ({\n children,\n isEnabled = true,\n}) => {\n const { editor, internationalization } = getConfiguration();\n\n const { setState } = useContentSelectorContext();\n\n const { locale, setLocale } = useIntlayerContext();\n\n const isEditorEnabled = useMemo(\n () =>\n Boolean(\n editor.enabled && editor.clientId && editor.clientSecret && isEnabled\n ),\n [editor.enabled && editor.clientId && editor.clientSecret && isEnabled]\n );\n\n useEffect(() => {\n setState({\n ContentSelectorWrapper,\n });\n }, [setState]);\n\n useEffect(() => {\n if (isEnabled && editor.enabled) {\n if (!editor.clientId) {\n
|
|
1
|
+
{"version":3,"sources":["../../src/IntlayerEditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport { appLogger, getConfiguration } from '@intlayer/config/client';\nimport { DictionaryEditionDrawerController } from './DictionaryEditionDrawer/index';\nimport { DictionaryListDrawer } from './DictionaryListDrawer/index';\nimport { useIntlayerContext } from 'react-intlayer';\nimport { useContentSelectorContext } from 'react-intlayer/editor';\nimport { ContentSelectorWrapper } from './ContentSelectorWrapper';\nimport {\n type FC,\n type PropsWithChildren,\n createContext,\n useContext,\n useEffect,\n useMemo,\n} from 'react';\nimport { AsyncStateProvider } from '@intlayer/design-system/hooks';\n\ntype IntlayerEditorValue = {\n isEditorEnabled: boolean;\n};\n\n/**\n * Context that store the current locale on the client side\n */\nexport const IntlayerEditorContext = createContext<IntlayerEditorValue>({\n isEditorEnabled: false,\n});\n\n/**\n * Hook that provides the current locale\n */\nexport const useIntlayerEditorContext = () => useContext(IntlayerEditorContext);\n\nexport type IntlayerEditorProviderProps = PropsWithChildren<{\n isEnabled?: boolean;\n}>;\n\n/**\n * Provider that store the current locale on the client side\n */\nexport const IntlayerEditorProvider: FC<IntlayerEditorProviderProps> = ({\n children,\n isEnabled = true,\n}) => {\n const { editor, internationalization } = getConfiguration();\n\n const { setState } = useContentSelectorContext();\n\n const { locale, setLocale } = useIntlayerContext();\n\n const isEditorEnabled = useMemo(\n () =>\n Boolean(\n editor.enabled && editor.clientId && editor.clientSecret && isEnabled\n ),\n [editor.enabled && editor.clientId && editor.clientSecret && isEnabled]\n );\n\n useEffect(() => {\n setState({\n ContentSelectorWrapper,\n });\n }, [setState]);\n\n useEffect(() => {\n if (isEnabled && editor.enabled) {\n if (!editor.clientId) {\n appLogger(\n 'Editor is enabled but clientId is not set. Please set it in the editor configuration. See http://localhost:3000/doc/concept/editor.',\n {\n level: 'error',\n }\n );\n }\n\n if (!editor.clientSecret) {\n appLogger(\n 'Editor is enabled but clientSecret is not set. Please set it in the editor configuration. See http://localhost:3000/doc/concept/editor.',\n {\n level: 'error',\n }\n );\n }\n }\n }, [isEnabled, editor.enabled, editor.clientId, editor.clientSecret]);\n\n return (\n <IntlayerEditorContext.Provider value={{ isEditorEnabled }}>\n {children}\n\n {isEditorEnabled && (\n <AsyncStateProvider>\n <DictionaryEditionDrawerController\n locale={locale}\n localeList={internationalization.locales}\n setLocale={setLocale}\n />\n <DictionaryListDrawer />\n </AsyncStateProvider>\n )}\n </IntlayerEditorContext.Provider>\n );\n};\n"],"mappings":";AA4FQ,SACE,KADF;AA1FR,SAAS,WAAW,wBAAwB;AAC5C,SAAS,yCAAyC;AAClD,SAAS,4BAA4B;AACrC,SAAS,0BAA0B;AACnC,SAAS,iCAAiC;AAC1C,SAAS,8BAA8B;AACvC;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,0BAA0B;AAS5B,MAAM,wBAAwB,cAAmC;AAAA,EACtE,iBAAiB;AACnB,CAAC;AAKM,MAAM,2BAA2B,MAAM,WAAW,qBAAqB;AASvE,MAAM,yBAA0D,CAAC;AAAA,EACtE;AAAA,EACA,YAAY;AACd,MAAM;AACJ,QAAM,EAAE,QAAQ,qBAAqB,IAAI,iBAAiB;AAE1D,QAAM,EAAE,SAAS,IAAI,0BAA0B;AAE/C,QAAM,EAAE,QAAQ,UAAU,IAAI,mBAAmB;AAEjD,QAAM,kBAAkB;AAAA,IACtB,MACE;AAAA,MACE,OAAO,WAAW,OAAO,YAAY,OAAO,gBAAgB;AAAA,IAC9D;AAAA,IACF,CAAC,OAAO,WAAW,OAAO,YAAY,OAAO,gBAAgB,SAAS;AAAA,EACxE;AAEA,YAAU,MAAM;AACd,aAAS;AAAA,MACP;AAAA,IACF,CAAC;AAAA,EACH,GAAG,CAAC,QAAQ,CAAC;AAEb,YAAU,MAAM;AACd,QAAI,aAAa,OAAO,SAAS;AAC/B,UAAI,CAAC,OAAO,UAAU;AACpB;AAAA,UACE;AAAA,UACA;AAAA,YACE,OAAO;AAAA,UACT;AAAA,QACF;AAAA,MACF;AAEA,UAAI,CAAC,OAAO,cAAc;AACxB;AAAA,UACE;AAAA,UACA;AAAA,YACE,OAAO;AAAA,UACT;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF,GAAG,CAAC,WAAW,OAAO,SAAS,OAAO,UAAU,OAAO,YAAY,CAAC;AAEpE,SACE,qBAAC,sBAAsB,UAAtB,EAA+B,OAAO,EAAE,gBAAgB,GACtD;AAAA;AAAA,IAEA,mBACC,qBAAC,sBACC;AAAA;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA,YAAY,qBAAqB;AAAA,UACjC;AAAA;AAAA,MACF;AAAA,MACA,oBAAC,wBAAqB;AAAA,OACxB;AAAA,KAEJ;AAEJ;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentSelectorWrapper.d.ts","sourceRoot":"","sources":["../../src/ContentSelectorWrapper.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAiB,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"ContentSelectorWrapper.d.ts","sourceRoot":"","sources":["../../src/ContentSelectorWrapper.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAiB,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAK7D,OAAO,EAKL,KAAK,EAAE,EACP,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAKf,KAAK,2BAA2B,GAAG;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,OAAO,EAAE,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,2BAA2B,CA+DlE,CAAC"}
|
|
@@ -4,12 +4,15 @@ import { type FileContent as FileContentWithDictionaryPath } from './useDictiona
|
|
|
4
4
|
type DictionaryEditionDrawerContentProps = {
|
|
5
5
|
focusedContent: FileContentWithDictionaryPath;
|
|
6
6
|
locale: Locales;
|
|
7
|
+
localeList: Locales[];
|
|
7
8
|
identifier: string;
|
|
8
9
|
handleOnBack: () => void;
|
|
10
|
+
isDarkMode?: boolean;
|
|
9
11
|
};
|
|
10
12
|
export declare const DictionaryEditionDrawerContent: FC<DictionaryEditionDrawerContentProps>;
|
|
11
13
|
type DictionaryEditionDrawerProps = DictionaryEditionDrawerControllerProps & {
|
|
12
|
-
|
|
14
|
+
dictionaryKey: string;
|
|
15
|
+
isDarkMode?: boolean;
|
|
13
16
|
};
|
|
14
17
|
export declare const DictionaryEditionDrawer: FC<DictionaryEditionDrawerProps>;
|
|
15
18
|
type DictionaryEditionDrawerControllerProps = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryEditionDrawer.d.ts","sourceRoot":"","sources":["../../../src/DictionaryEditionDrawer/DictionaryEditionDrawer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAYvD,OAAO,EAAoC,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAKlE,OAAO,EACL,KAAK,WAAW,IAAI,6BAA6B,EAGlD,MAAM,8BAA8B,CAAC;AAEtC,KAAK,mCAAmC,GAAG;IACzC,cAAc,EAAE,6BAA6B,CAAC;IAC9C,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"DictionaryEditionDrawer.d.ts","sourceRoot":"","sources":["../../../src/DictionaryEditionDrawer/DictionaryEditionDrawer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAYvD,OAAO,EAAoC,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAKlE,OAAO,EACL,KAAK,WAAW,IAAI,6BAA6B,EAGlD,MAAM,8BAA8B,CAAC;AAEtC,KAAK,mCAAmC,GAAG;IACzC,cAAc,EAAE,6BAA6B,CAAC;IAC9C,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,OAAO,EAAE,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,EAAE,CAC7C,mCAAmC,CAqDpC,CAAC;AAEF,KAAK,4BAA4B,GAAG,sCAAsC,GAAG;IAC3E,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,EAAE,CAAC,4BAA4B,CAgDpE,CAAC;AAEF,KAAK,sCAAsC,GAAG;IAC5C,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,OAAO,EAAE,CAAC;IACtB,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CACtC,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,EAAE,CAChD,sCAAsC,CAmBvC,CAAC"}
|
|
@@ -2,6 +2,8 @@ declare const dictionaryEditionDrawerContent: {
|
|
|
2
2
|
key: string;
|
|
3
3
|
content: {
|
|
4
4
|
backButtonText: import("@intlayer/core").TranslationContent<string>;
|
|
5
|
+
modalTitle: import("@intlayer/core").TranslationContent<string>;
|
|
6
|
+
noDictionaryFocused: import("@intlayer/core").TranslationContent<string>;
|
|
5
7
|
};
|
|
6
8
|
};
|
|
7
9
|
export default dictionaryEditionDrawerContent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionaryEditionDrawer.content.d.ts","sourceRoot":"","sources":["../../../src/DictionaryEditionDrawer/dictionaryEditionDrawer.content.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,8BAA8B
|
|
1
|
+
{"version":3,"file":"dictionaryEditionDrawer.content.d.ts","sourceRoot":"","sources":["../../../src/DictionaryEditionDrawer/dictionaryEditionDrawer.content.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,8BAA8B;;;;;;;CAiDN,CAAC;AAE/B,eAAe,8BAA8B,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Dictionary, DictionaryValue, KeyPath } from '@intlayer/core';
|
|
2
|
-
export declare const getDrawerIdentifier: (
|
|
3
|
-
type
|
|
2
|
+
export declare const getDrawerIdentifier: (dictionaryKey: string) => string;
|
|
3
|
+
type DictionaryKey = string;
|
|
4
4
|
type DictionaryPath = string;
|
|
5
5
|
export type FileContent = {
|
|
6
6
|
dictionaryPath?: DictionaryPath;
|
|
7
|
-
|
|
7
|
+
dictionaryKey: DictionaryKey;
|
|
8
8
|
keyPath?: KeyPath[];
|
|
9
9
|
};
|
|
10
10
|
type DictionaryEditionDrawer = {
|
|
@@ -12,9 +12,9 @@ type DictionaryEditionDrawer = {
|
|
|
12
12
|
isOpen: boolean;
|
|
13
13
|
open: (content: FileContent) => void;
|
|
14
14
|
close: () => void;
|
|
15
|
-
setDictionariesRecord: (dictionariesRecord: Record<
|
|
16
|
-
getEditedContentValue: (
|
|
15
|
+
setDictionariesRecord: (dictionariesRecord: Record<DictionaryKey, Dictionary>) => void;
|
|
16
|
+
getEditedContentValue: (dictionaryKey: DictionaryKey, keyPath: KeyPath[]) => DictionaryValue | undefined;
|
|
17
17
|
};
|
|
18
|
-
export declare const useDictionaryEditionDrawer: (
|
|
18
|
+
export declare const useDictionaryEditionDrawer: (dictionaryKey: string) => DictionaryEditionDrawer;
|
|
19
19
|
export {};
|
|
20
20
|
//# sourceMappingURL=useDictionaryEditionDrawer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionaryEditionDrawer.d.ts","sourceRoot":"","sources":["../../../src/DictionaryEditionDrawer/useDictionaryEditionDrawer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAS3E,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"useDictionaryEditionDrawer.d.ts","sourceRoot":"","sources":["../../../src/DictionaryEditionDrawer/useDictionaryEditionDrawer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAS3E,eAAO,MAAM,mBAAmB,kBAAmB,MAAM,WAClB,CAAC;AAExC,KAAK,aAAa,GAAG,MAAM,CAAC;AAC5B,KAAK,cAAc,GAAG,MAAM,CAAC;AAE7B,MAAM,MAAM,WAAW,GAAG;IACxB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,aAAa,EAAE,aAAa,CAAC;IAC7B,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;CACrB,CAAC;AAEF,KAAK,uBAAuB,GAAG;IAC7B,cAAc,EAAE,WAAW,GAAG,IAAI,CAAC;IACnC,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IACrC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,qBAAqB,EAAE,CACrB,kBAAkB,EAAE,MAAM,CAAC,aAAa,EAAE,UAAU,CAAC,KAClD,IAAI,CAAC;IACV,qBAAqB,EAAE,CACrB,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE,OAAO,EAAE,KACf,eAAe,GAAG,SAAS,CAAC;CAClC,CAAC;AAQF,eAAO,MAAM,0BAA0B,kBACtB,MAAM,KACpB,uBAgDF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryListDrawer.d.ts","sourceRoot":"","sources":["../../../src/DictionaryListDrawer/DictionaryListDrawer.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAwB,EAAE,EAAE,MAAM,OAAO,CAAC;AAKjD,eAAO,MAAM,oBAAoB,EAAE,
|
|
1
|
+
{"version":3,"file":"DictionaryListDrawer.d.ts","sourceRoot":"","sources":["../../../src/DictionaryListDrawer/DictionaryListDrawer.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAwB,EAAE,EAAE,MAAM,OAAO,CAAC;AAKjD,eAAO,MAAM,oBAAoB,EAAE,EAiElC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntlayerEditorProvider.d.ts","sourceRoot":"","sources":["../../src/IntlayerEditorProvider.tsx"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,EAAE,EACP,KAAK,iBAAiB,EAKvB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"IntlayerEditorProvider.d.ts","sourceRoot":"","sources":["../../src/IntlayerEditorProvider.tsx"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,EAAE,EACP,KAAK,iBAAiB,EAKvB,MAAM,OAAO,CAAC;AAGf,KAAK,mBAAmB,GAAG;IACzB,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,8CAEhC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,wBAAwB,2BAA0C,CAAC;AAEhF,MAAM,MAAM,2BAA2B,GAAG,iBAAiB,CAAC;IAC1D,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,2BAA2B,CA8DlE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "intlayer-editor",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.6",
|
|
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": [
|
|
@@ -74,10 +74,10 @@
|
|
|
74
74
|
"react": "^18.3.1",
|
|
75
75
|
"react-dom": "^18.3.1",
|
|
76
76
|
"zustand": "^5.0.1",
|
|
77
|
-
"@intlayer/config": "^3.5.
|
|
78
|
-
"@intlayer/core": "^3.5.
|
|
79
|
-
"intlayer": "^3.5.
|
|
80
|
-
"
|
|
77
|
+
"@intlayer/config": "^3.5.6",
|
|
78
|
+
"@intlayer/core": "^3.5.6",
|
|
79
|
+
"@intlayer/design-system": "^3.5.6",
|
|
80
|
+
"intlayer": "^3.5.6"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@babel/generator": "7.26.2",
|
|
@@ -104,11 +104,11 @@
|
|
|
104
104
|
"@utils/tsup-config": "^1.0.4"
|
|
105
105
|
},
|
|
106
106
|
"peerDependencies": {
|
|
107
|
-
"@intlayer/core": "^3.5.
|
|
108
|
-
"intlayer": "^3.5.
|
|
109
|
-
"
|
|
110
|
-
"@intlayer/design-system": "^3.5.
|
|
111
|
-
"react-intlayer": "^3.5.
|
|
107
|
+
"@intlayer/core": "^3.5.6",
|
|
108
|
+
"@intlayer/config": "^3.5.6",
|
|
109
|
+
"intlayer": "^3.5.6",
|
|
110
|
+
"@intlayer/design-system": "^3.5.6",
|
|
111
|
+
"react-intlayer": "^3.5.6"
|
|
112
112
|
},
|
|
113
113
|
"engines": {
|
|
114
114
|
"node": ">=14.18"
|