intlayer-editor 3.5.4 → 3.5.5
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 +16 -13
- package/dist/cjs/DictionaryEditionDrawer/DictionaryEditionDrawer.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 +10 -4
- 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 +16 -13
- package/dist/esm/DictionaryEditionDrawer/DictionaryEditionDrawer.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 +11 -5
- 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 +3 -1
- package/dist/types/DictionaryEditionDrawer/DictionaryEditionDrawer.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 +11 -11
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,7 @@ 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, identifier, handleOnBack, isDarkMode }) => {
|
|
47
47
|
const [keyPathEditionModal, setKeyPathEditionModal] = (0, import_react.useState)(null);
|
|
48
48
|
const { setDictionariesRecord, focusedContent } = (0, import_useDictionaryEditionDrawer.useDictionaryEditionDrawer)(identifier);
|
|
49
49
|
const { all: dictionaries } = (0, import_hooks.useGetAllDictionaries)();
|
|
@@ -56,9 +56,9 @@ const DictionaryEditionDrawerContent = ({ locale, identifier, handleOnBack }) =>
|
|
|
56
56
|
setDictionariesRecord(dictionaries);
|
|
57
57
|
}
|
|
58
58
|
}, [setDictionariesRecord, dictionaries]);
|
|
59
|
-
const
|
|
60
|
-
if (!
|
|
61
|
-
const dictionary = dictionaries[
|
|
59
|
+
const dictionaryKey = focusedContent?.dictionaryKey;
|
|
60
|
+
if (!dictionaryKey) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: "No dictionary focused" });
|
|
61
|
+
const dictionary = dictionaries[dictionaryKey];
|
|
62
62
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
63
63
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
64
64
|
import_design_system.Modal,
|
|
@@ -77,7 +77,8 @@ const DictionaryEditionDrawerContent = ({ locale, identifier, handleOnBack }) =>
|
|
|
77
77
|
import_design_system.DictionaryFieldEditor,
|
|
78
78
|
{
|
|
79
79
|
dictionary,
|
|
80
|
-
onClickDictionaryList
|
|
80
|
+
onClickDictionaryList,
|
|
81
|
+
isDarkMode
|
|
81
82
|
}
|
|
82
83
|
)
|
|
83
84
|
}
|
|
@@ -96,11 +97,12 @@ const DictionaryEditionDrawer = ({
|
|
|
96
97
|
locale,
|
|
97
98
|
localeList,
|
|
98
99
|
setLocale,
|
|
99
|
-
|
|
100
|
+
dictionaryKey,
|
|
101
|
+
isDarkMode
|
|
100
102
|
}) => {
|
|
101
103
|
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)(
|
|
104
|
+
const id = (0, import_useDictionaryEditionDrawer.getDrawerIdentifier)(dictionaryKey);
|
|
105
|
+
const { focusedContent, close } = (0, import_useDictionaryEditionDrawer.useDictionaryEditionDrawer)(dictionaryKey);
|
|
104
106
|
const { openDictionaryListDrawer } = (0, import_design_system.useRightDrawerStore)((s) => ({
|
|
105
107
|
openDictionaryListDrawer: () => s.open(import_dictionaryListDrawerIdentifier.dictionaryListDrawerIdentifier)
|
|
106
108
|
}));
|
|
@@ -111,7 +113,7 @@ const DictionaryEditionDrawer = ({
|
|
|
111
113
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
112
114
|
import_design_system.RightDrawer,
|
|
113
115
|
{
|
|
114
|
-
title:
|
|
116
|
+
title: dictionaryKey,
|
|
115
117
|
identifier: id,
|
|
116
118
|
header: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
117
119
|
import_design_system.LocaleSwitcher,
|
|
@@ -131,7 +133,8 @@ const DictionaryEditionDrawer = ({
|
|
|
131
133
|
focusedContent,
|
|
132
134
|
locale,
|
|
133
135
|
identifier: id,
|
|
134
|
-
handleOnBack
|
|
136
|
+
handleOnBack,
|
|
137
|
+
isDarkMode
|
|
135
138
|
}
|
|
136
139
|
)
|
|
137
140
|
}
|
|
@@ -141,8 +144,8 @@ const DictionaryEditionDrawerController = ({ locale, localeList, setLocale }) =>
|
|
|
141
144
|
const focusedContent = (0, import_design_system.useEditionPanelStore)(
|
|
142
145
|
(0, import_shallow.useShallow)((s) => s.focusedContent)
|
|
143
146
|
);
|
|
144
|
-
const
|
|
145
|
-
if (!
|
|
147
|
+
const dictionaryKey = focusedContent?.dictionaryKey;
|
|
148
|
+
if (!dictionaryKey) {
|
|
146
149
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
|
|
147
150
|
}
|
|
148
151
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -151,7 +154,7 @@ const DictionaryEditionDrawerController = ({ locale, localeList, setLocale }) =>
|
|
|
151
154
|
locale,
|
|
152
155
|
localeList,
|
|
153
156
|
setLocale,
|
|
154
|
-
|
|
157
|
+
dictionaryKey
|
|
155
158
|
}
|
|
156
159
|
);
|
|
157
160
|
};
|
|
@@ -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 identifier: string;\n handleOnBack: () => void;\n isDarkMode?: boolean;\n};\n\nexport const DictionaryEditionDrawerContent: FC<\n DictionaryEditionDrawerContentProps\n> = ({ locale, identifier, handleOnBack, isDarkMode }) => {\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={t({\n en: 'Edit field',\n fr: 'Modifier le champ',\n es: 'Editar campo',\n })}\n size=\"xl\"\n transparency=\"lg\"\n >\n {dictionary && (\n <DictionaryFieldEditor\n dictionary={dictionary}\n onClickDictionaryList={onClickDictionaryList}\n isDarkMode={isDarkMode}\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 />\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;AAwD6B;AApD7B,2BAQO;AACP,mBAAsC;AACtC,mBAA0D;AAC1D,4BAAiC;AACjC,qBAA2B;AAC3B,4CAA+C;AAC/C,qCAA2C;AAC3C,wCAIO;AAUA,MAAM,iCAET,CAAC,EAAE,QAAQ,YAAY,cAAc,WAAW,MAAM;AACxD,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,WAAO,yBAAE;AAAA,UACP,IAAI;AAAA,UACJ,IAAI;AAAA,UACJ,IAAI;AAAA,QACN,CAAC;AAAA,QACD,MAAK;AAAA,QACL,cAAa;AAAA,QAEZ,wBACC;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA;AAAA,QACF;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;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"]}
|
|
@@ -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":[]}
|
|
@@ -57,13 +57,19 @@ const IntlayerEditorProvider = ({
|
|
|
57
57
|
(0, import_react.useEffect)(() => {
|
|
58
58
|
if (isEnabled && editor.enabled) {
|
|
59
59
|
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."
|
|
60
|
+
(0, import_client.appLogger)(
|
|
61
|
+
"Editor is enabled but clientId is not set. Please set it in the editor configuration. See http://localhost:3000/doc/concept/editor.",
|
|
62
|
+
{
|
|
63
|
+
level: "error"
|
|
64
|
+
}
|
|
62
65
|
);
|
|
63
66
|
}
|
|
64
67
|
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."
|
|
68
|
+
(0, import_client.appLogger)(
|
|
69
|
+
"Editor is enabled but clientSecret is not set. Please set it in the editor configuration. See http://localhost:3000/doc/concept/editor.",
|
|
70
|
+
{
|
|
71
|
+
level: "error"
|
|
72
|
+
}
|
|
67
73
|
);
|
|
68
74
|
}
|
|
69
75
|
}
|
|
@@ -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';\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 <>\n <DictionaryEditionDrawerController\n locale={locale}\n localeList={internationalization.locales}\n setLocale={setLocale}\n />\n <DictionaryListDrawer />\n </>\n )}\n </IntlayerEditorContext.Provider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2FQ;AAzFR,oBAA4C;AAC5C,qCAAkD;AAClD,kCAAqC;AACrC,4BAAmC;AACnC,oBAA0C;AAC1C,oCAAuC;AACvC,mBAOO;AASA,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,4EACE;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":[]}
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
useDictionaryEditionDrawer,
|
|
20
20
|
getDrawerIdentifier
|
|
21
21
|
} from './useDictionaryEditionDrawer.mjs';
|
|
22
|
-
const DictionaryEditionDrawerContent = ({ locale, identifier, handleOnBack }) => {
|
|
22
|
+
const DictionaryEditionDrawerContent = ({ locale, identifier, handleOnBack, isDarkMode }) => {
|
|
23
23
|
const [keyPathEditionModal, setKeyPathEditionModal] = useState(null);
|
|
24
24
|
const { setDictionariesRecord, focusedContent } = useDictionaryEditionDrawer(identifier);
|
|
25
25
|
const { all: dictionaries } = useGetAllDictionaries();
|
|
@@ -32,9 +32,9 @@ const DictionaryEditionDrawerContent = ({ locale, identifier, handleOnBack }) =>
|
|
|
32
32
|
setDictionariesRecord(dictionaries);
|
|
33
33
|
}
|
|
34
34
|
}, [setDictionariesRecord, dictionaries]);
|
|
35
|
-
const
|
|
36
|
-
if (!
|
|
37
|
-
const dictionary = dictionaries[
|
|
35
|
+
const dictionaryKey = focusedContent?.dictionaryKey;
|
|
36
|
+
if (!dictionaryKey) return /* @__PURE__ */ jsx(Fragment, { children: "No dictionary focused" });
|
|
37
|
+
const dictionary = dictionaries[dictionaryKey];
|
|
38
38
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
39
39
|
/* @__PURE__ */ jsx(
|
|
40
40
|
Modal,
|
|
@@ -53,7 +53,8 @@ const DictionaryEditionDrawerContent = ({ locale, identifier, handleOnBack }) =>
|
|
|
53
53
|
DictionaryFieldEditor,
|
|
54
54
|
{
|
|
55
55
|
dictionary,
|
|
56
|
-
onClickDictionaryList
|
|
56
|
+
onClickDictionaryList,
|
|
57
|
+
isDarkMode
|
|
57
58
|
}
|
|
58
59
|
)
|
|
59
60
|
}
|
|
@@ -72,11 +73,12 @@ const DictionaryEditionDrawer = ({
|
|
|
72
73
|
locale,
|
|
73
74
|
localeList,
|
|
74
75
|
setLocale,
|
|
75
|
-
|
|
76
|
+
dictionaryKey,
|
|
77
|
+
isDarkMode
|
|
76
78
|
}) => {
|
|
77
79
|
const { backButtonText } = useDictionary(dictionaryEditionDrawerContent);
|
|
78
|
-
const id = getDrawerIdentifier(
|
|
79
|
-
const { focusedContent, close } = useDictionaryEditionDrawer(
|
|
80
|
+
const id = getDrawerIdentifier(dictionaryKey);
|
|
81
|
+
const { focusedContent, close } = useDictionaryEditionDrawer(dictionaryKey);
|
|
80
82
|
const { openDictionaryListDrawer } = useRightDrawerStore((s) => ({
|
|
81
83
|
openDictionaryListDrawer: () => s.open(dictionaryListDrawerIdentifier)
|
|
82
84
|
}));
|
|
@@ -87,7 +89,7 @@ const DictionaryEditionDrawer = ({
|
|
|
87
89
|
return /* @__PURE__ */ jsx(
|
|
88
90
|
RightDrawer,
|
|
89
91
|
{
|
|
90
|
-
title:
|
|
92
|
+
title: dictionaryKey,
|
|
91
93
|
identifier: id,
|
|
92
94
|
header: /* @__PURE__ */ jsx(
|
|
93
95
|
LocaleSwitcher,
|
|
@@ -107,7 +109,8 @@ const DictionaryEditionDrawer = ({
|
|
|
107
109
|
focusedContent,
|
|
108
110
|
locale,
|
|
109
111
|
identifier: id,
|
|
110
|
-
handleOnBack
|
|
112
|
+
handleOnBack,
|
|
113
|
+
isDarkMode
|
|
111
114
|
}
|
|
112
115
|
)
|
|
113
116
|
}
|
|
@@ -117,8 +120,8 @@ const DictionaryEditionDrawerController = ({ locale, localeList, setLocale }) =>
|
|
|
117
120
|
const focusedContent = useEditionPanelStore(
|
|
118
121
|
useShallow((s) => s.focusedContent)
|
|
119
122
|
);
|
|
120
|
-
const
|
|
121
|
-
if (!
|
|
123
|
+
const dictionaryKey = focusedContent?.dictionaryKey;
|
|
124
|
+
if (!dictionaryKey) {
|
|
122
125
|
return /* @__PURE__ */ jsx(Fragment, {});
|
|
123
126
|
}
|
|
124
127
|
return /* @__PURE__ */ jsx(
|
|
@@ -127,7 +130,7 @@ const DictionaryEditionDrawerController = ({ locale, localeList, setLocale }) =>
|
|
|
127
130
|
locale,
|
|
128
131
|
localeList,
|
|
129
132
|
setLocale,
|
|
130
|
-
|
|
133
|
+
dictionaryKey
|
|
131
134
|
}
|
|
132
135
|
);
|
|
133
136
|
};
|
|
@@ -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 identifier: string;\n handleOnBack: () => void;\n isDarkMode?: boolean;\n};\n\nexport const DictionaryEditionDrawerContent: FC<\n DictionaryEditionDrawerContentProps\n> = ({ locale, identifier, handleOnBack, isDarkMode }) => {\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={t({\n en: 'Edit field',\n fr: 'Modifier le champ',\n es: 'Editar campo',\n })}\n size=\"xl\"\n transparency=\"lg\"\n >\n {dictionary && (\n <DictionaryFieldEditor\n dictionary={dictionary}\n onClickDictionaryList={onClickDictionaryList}\n isDarkMode={isDarkMode}\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 />\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":";AAwD6B,wBAKzB,YALyB;AApD7B;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,SAAS,GAAG,qBAAqB;AACjC,SAAS,kBAAkB;AAC3B,SAAS,sCAAsC;AAC/C,OAAO,oCAAoC;AAC3C;AAAA,EAEE;AAAA,EACA;AAAA,OACK;AAUA,MAAM,iCAET,CAAC,EAAE,QAAQ,YAAY,cAAc,WAAW,MAAM;AACxD,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,EAAE;AAAA,UACP,IAAI;AAAA,UACJ,IAAI;AAAA,UACJ,IAAI;AAAA,QACN,CAAC;AAAA,QACD,MAAK;AAAA,QACL,cAAa;AAAA,QAEZ,wBACC;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA;AAAA,QACF;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;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,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
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { getConfiguration } from "@intlayer/config/client";
|
|
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";
|
|
@@ -37,13 +37,19 @@ const IntlayerEditorProvider = ({
|
|
|
37
37
|
useEffect(() => {
|
|
38
38
|
if (isEnabled && editor.enabled) {
|
|
39
39
|
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."
|
|
40
|
+
appLogger(
|
|
41
|
+
"Editor is enabled but clientId is not set. Please set it in the editor configuration. See http://localhost:3000/doc/concept/editor.",
|
|
42
|
+
{
|
|
43
|
+
level: "error"
|
|
44
|
+
}
|
|
42
45
|
);
|
|
43
46
|
}
|
|
44
47
|
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."
|
|
48
|
+
appLogger(
|
|
49
|
+
"Editor is enabled but clientSecret is not set. Please set it in the editor configuration. See http://localhost:3000/doc/concept/editor.",
|
|
50
|
+
{
|
|
51
|
+
level: "error"
|
|
52
|
+
}
|
|
47
53
|
);
|
|
48
54
|
}
|
|
49
55
|
}
|
|
@@ -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';\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 <>\n <DictionaryEditionDrawerController\n locale={locale}\n localeList={internationalization.locales}\n setLocale={setLocale}\n />\n <DictionaryListDrawer />\n </>\n )}\n </IntlayerEditorContext.Provider>\n );\n};\n"],"mappings":";AA2FQ,mBACE,KADF;AAzFR,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;AASA,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,iCACE;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"}
|
|
@@ -6,10 +6,12 @@ type DictionaryEditionDrawerContentProps = {
|
|
|
6
6
|
locale: Locales;
|
|
7
7
|
identifier: string;
|
|
8
8
|
handleOnBack: () => void;
|
|
9
|
+
isDarkMode?: boolean;
|
|
9
10
|
};
|
|
10
11
|
export declare const DictionaryEditionDrawerContent: FC<DictionaryEditionDrawerContentProps>;
|
|
11
12
|
type DictionaryEditionDrawerProps = DictionaryEditionDrawerControllerProps & {
|
|
12
|
-
|
|
13
|
+
dictionaryKey: string;
|
|
14
|
+
isDarkMode?: boolean;
|
|
13
15
|
};
|
|
14
16
|
export declare const DictionaryEditionDrawer: FC<DictionaryEditionDrawerProps>;
|
|
15
17
|
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,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,EAAE,CAC7C,mCAAmC,CAuDpC,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,CA+CpE,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"}
|
|
@@ -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;AAEf,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,
|
|
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;AAEf,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.5",
|
|
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
|
-
"
|
|
79
|
-
"intlayer": "^3.5.
|
|
80
|
-
"@intlayer/design-system": "^3.5.
|
|
77
|
+
"@intlayer/config": "^3.5.5",
|
|
78
|
+
"intlayer": "^3.5.5",
|
|
79
|
+
"@intlayer/core": "^3.5.5",
|
|
80
|
+
"@intlayer/design-system": "^3.5.5"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@babel/generator": "7.26.2",
|
|
@@ -98,17 +98,17 @@
|
|
|
98
98
|
"tsc-alias": "^1.8.10",
|
|
99
99
|
"tsup": "^8.3.5",
|
|
100
100
|
"typescript": "^5.7.2",
|
|
101
|
-
"@utils/ts-config": "^1.0.4",
|
|
102
101
|
"@utils/eslint-config": "^1.0.4",
|
|
102
|
+
"@utils/ts-config": "^1.0.4",
|
|
103
103
|
"@utils/ts-config-types": "^1.0.4",
|
|
104
104
|
"@utils/tsup-config": "^1.0.4"
|
|
105
105
|
},
|
|
106
106
|
"peerDependencies": {
|
|
107
|
-
"@intlayer/
|
|
108
|
-
"intlayer": "^3.5.
|
|
109
|
-
"@intlayer/
|
|
110
|
-
"
|
|
111
|
-
"react-intlayer": "^3.5.
|
|
107
|
+
"@intlayer/config": "^3.5.5",
|
|
108
|
+
"@intlayer/core": "^3.5.5",
|
|
109
|
+
"@intlayer/design-system": "^3.5.5",
|
|
110
|
+
"intlayer": "^3.5.5",
|
|
111
|
+
"react-intlayer": "^3.5.5"
|
|
112
112
|
},
|
|
113
113
|
"engines": {
|
|
114
114
|
"node": ">=14.18"
|