intlayer-editor 2.0.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -135
- package/dist/cjs/client/ContentEditionLayout.cjs +21 -13
- package/dist/cjs/client/ContentEditionLayout.cjs.map +1 -1
- package/dist/cjs/client/ContentEditionLayout.d.ts +1 -0
- package/dist/cjs/client/ContentEditorProvider.cjs +47 -0
- package/dist/cjs/client/ContentEditorProvider.cjs.map +1 -0
- package/dist/cjs/client/ContentEditorProvider.d.ts +23 -0
- package/dist/cjs/client/ContentSelectorWrapper.cjs +27 -10
- package/dist/cjs/client/ContentSelectorWrapper.cjs.map +1 -1
- package/dist/cjs/client/ContentSelectorWrapper.d.ts +2 -2
- package/dist/cjs/client/DictionaryEditionDrawer/DictionaryEditionDrawer.cjs +135 -0
- package/dist/cjs/client/DictionaryEditionDrawer/DictionaryEditionDrawer.cjs.map +1 -0
- package/dist/cjs/client/DictionaryEditionDrawer/DictionaryEditionDrawer.d.ts +28 -0
- package/dist/cjs/client/DictionaryEditionDrawer/index.cjs +27 -0
- package/dist/cjs/client/DictionaryEditionDrawer/index.cjs.map +1 -0
- package/dist/cjs/client/DictionaryEditionDrawer/index.d.ts +9 -0
- package/dist/cjs/client/DictionaryEditionDrawer/useDictionaryEditionDrawer.cjs +103 -0
- package/dist/cjs/client/DictionaryEditionDrawer/useDictionaryEditionDrawer.cjs.map +1 -0
- package/dist/cjs/client/DictionaryEditionDrawer/useDictionaryEditionDrawer.d.ts +32 -0
- package/dist/cjs/client/{EditionPanel → DictionaryEditionDrawer}/useEditedContentStore.cjs +19 -11
- package/dist/cjs/client/DictionaryEditionDrawer/useEditedContentStore.cjs.map +1 -0
- package/dist/cjs/client/{EditionPanel → DictionaryEditionDrawer}/useEditedContentStore.d.ts +1 -1
- package/dist/cjs/client/{EditionPanel/useEditionPanelStore.cjs → DictionaryEditionDrawer/useFocusContentStore.cjs} +4 -4
- package/dist/cjs/client/DictionaryEditionDrawer/useFocusContentStore.cjs.map +1 -0
- package/dist/cjs/client/{EditionPanel/useEditionPanelStore.d.ts → DictionaryEditionDrawer/useFocusContentStore.d.ts} +1 -1
- package/dist/cjs/client/DictionaryListDrawer/DictionaryListDrawer.cjs +74 -0
- package/dist/cjs/client/DictionaryListDrawer/DictionaryListDrawer.cjs.map +1 -0
- package/dist/cjs/client/DictionaryListDrawer/DictionaryListDrawer.d.ts +5 -0
- package/dist/cjs/client/{EditionPanel → DictionaryListDrawer}/index.cjs +6 -8
- package/dist/cjs/client/DictionaryListDrawer/index.cjs.map +1 -0
- package/dist/cjs/client/DictionaryListDrawer/index.d.ts +3 -0
- package/dist/cjs/client/{renderContentSelector.cjs → DictionaryListDrawer/useDictionaryListDrawer.cjs} +11 -17
- package/dist/cjs/client/DictionaryListDrawer/useDictionaryListDrawer.cjs.map +1 -0
- package/dist/cjs/client/DictionaryListDrawer/useDictionaryListDrawer.d.ts +8 -0
- package/dist/cjs/client/index.cjs +9 -5
- package/dist/cjs/client/index.cjs.map +1 -1
- package/dist/cjs/client/index.d.ts +9 -7
- package/dist/cjs/client/renderContentEditor.cjs +48 -0
- package/dist/cjs/client/renderContentEditor.cjs.map +1 -0
- package/dist/cjs/client/renderContentEditor.d.ts +15 -0
- package/dist/cjs/client/useEditorServer.cjs +5 -2
- package/dist/cjs/client/useEditorServer.cjs.map +1 -1
- package/dist/cjs/server/formatPrettier.cjs +51 -0
- package/dist/cjs/server/formatPrettier.cjs.map +1 -0
- package/dist/cjs/server/formatPrettier.d.ts +6 -0
- package/dist/cjs/server/index.cjs +2 -2
- package/dist/cjs/server/index.cjs.map +1 -1
- package/dist/cjs/server/{content-editor.cjs → processEdition.cjs} +69 -68
- package/dist/cjs/server/processEdition.cjs.map +1 -0
- package/dist/cjs/server/processEdition.d.ts +12 -0
- package/dist/esm/client/ContentEditionLayout.d.mts +1 -0
- package/dist/esm/client/ContentEditionLayout.mjs +21 -13
- package/dist/esm/client/ContentEditionLayout.mjs.map +1 -1
- package/dist/esm/client/ContentEditorProvider.d.mts +23 -0
- package/dist/esm/client/ContentEditorProvider.mjs +24 -0
- package/dist/esm/client/ContentEditorProvider.mjs.map +1 -0
- package/dist/esm/client/ContentSelectorWrapper.d.mts +2 -2
- package/dist/esm/client/ContentSelectorWrapper.mjs +27 -10
- package/dist/esm/client/ContentSelectorWrapper.mjs.map +1 -1
- package/dist/esm/client/DictionaryEditionDrawer/DictionaryEditionDrawer.d.mts +28 -0
- package/dist/esm/client/DictionaryEditionDrawer/DictionaryEditionDrawer.mjs +104 -0
- package/dist/esm/client/DictionaryEditionDrawer/DictionaryEditionDrawer.mjs.map +1 -0
- package/dist/esm/client/DictionaryEditionDrawer/index.d.mts +9 -0
- package/dist/esm/client/DictionaryEditionDrawer/index.mjs +4 -0
- package/dist/esm/client/DictionaryEditionDrawer/index.mjs.map +1 -0
- package/dist/esm/client/DictionaryEditionDrawer/useDictionaryEditionDrawer.d.mts +32 -0
- package/dist/esm/client/DictionaryEditionDrawer/useDictionaryEditionDrawer.mjs +80 -0
- package/dist/esm/client/DictionaryEditionDrawer/useDictionaryEditionDrawer.mjs.map +1 -0
- package/dist/esm/client/{EditionPanel → DictionaryEditionDrawer}/useEditedContentStore.d.mts +1 -1
- package/dist/esm/client/{EditionPanel → DictionaryEditionDrawer}/useEditedContentStore.mjs +17 -9
- package/dist/esm/client/DictionaryEditionDrawer/useEditedContentStore.mjs.map +1 -0
- package/dist/esm/client/{EditionPanel/useEditionPanelStore.d.mts → DictionaryEditionDrawer/useFocusContentStore.d.mts} +1 -1
- package/dist/esm/client/{EditionPanel/useEditionPanelStore.mjs → DictionaryEditionDrawer/useFocusContentStore.mjs} +1 -1
- package/dist/esm/client/DictionaryEditionDrawer/useFocusContentStore.mjs.map +1 -0
- package/dist/esm/client/DictionaryListDrawer/DictionaryListDrawer.d.mts +5 -0
- package/dist/esm/client/DictionaryListDrawer/DictionaryListDrawer.mjs +46 -0
- package/dist/esm/client/DictionaryListDrawer/DictionaryListDrawer.mjs.map +1 -0
- package/dist/esm/client/DictionaryListDrawer/index.d.mts +3 -0
- package/dist/esm/client/DictionaryListDrawer/index.mjs +3 -0
- package/dist/esm/client/DictionaryListDrawer/index.mjs.map +1 -0
- package/dist/esm/client/DictionaryListDrawer/useDictionaryListDrawer.d.mts +8 -0
- package/dist/esm/client/DictionaryListDrawer/useDictionaryListDrawer.mjs +8 -0
- package/dist/esm/client/DictionaryListDrawer/useDictionaryListDrawer.mjs.map +1 -0
- package/dist/esm/client/index.d.mts +9 -7
- package/dist/esm/client/index.mjs +4 -2
- package/dist/esm/client/index.mjs.map +1 -1
- package/dist/esm/client/renderContentEditor.d.mts +15 -0
- package/dist/esm/client/renderContentEditor.mjs +24 -0
- package/dist/esm/client/renderContentEditor.mjs.map +1 -0
- package/dist/esm/client/useEditorServer.mjs +5 -2
- package/dist/esm/client/useEditorServer.mjs.map +1 -1
- package/dist/esm/server/formatPrettier.d.mts +6 -0
- package/dist/esm/server/formatPrettier.mjs +17 -0
- package/dist/esm/server/formatPrettier.mjs.map +1 -0
- package/dist/esm/server/index.mjs +2 -2
- package/dist/esm/server/index.mjs.map +1 -1
- package/dist/esm/server/processEdition.d.mts +12 -0
- package/dist/esm/server/processEdition.mjs +134 -0
- package/dist/esm/server/processEdition.mjs.map +1 -0
- package/package.json +17 -18
- package/dist/cjs/client/EditionPanel/EditionPanel.cjs +0 -101
- package/dist/cjs/client/EditionPanel/EditionPanel.cjs.map +0 -1
- package/dist/cjs/client/EditionPanel/EditionPanel.d.ts +0 -11
- package/dist/cjs/client/EditionPanel/index.cjs.map +0 -1
- package/dist/cjs/client/EditionPanel/index.d.ts +0 -9
- package/dist/cjs/client/EditionPanel/useEditedContentStore.cjs.map +0 -1
- package/dist/cjs/client/EditionPanel/useEditionPanelStore.cjs.map +0 -1
- package/dist/cjs/client/renderContentSelector.cjs.map +0 -1
- package/dist/cjs/client/renderContentSelector.d.ts +0 -6
- package/dist/cjs/server/content-editor.cjs.map +0 -1
- package/dist/cjs/server/content-editor.d.ts +0 -12
- package/dist/esm/client/EditionPanel/EditionPanel.d.mts +0 -11
- package/dist/esm/client/EditionPanel/EditionPanel.mjs +0 -72
- package/dist/esm/client/EditionPanel/EditionPanel.mjs.map +0 -1
- package/dist/esm/client/EditionPanel/index.d.mts +0 -9
- package/dist/esm/client/EditionPanel/index.mjs +0 -4
- package/dist/esm/client/EditionPanel/index.mjs.map +0 -1
- package/dist/esm/client/EditionPanel/useEditedContentStore.mjs.map +0 -1
- package/dist/esm/client/EditionPanel/useEditionPanelStore.mjs.map +0 -1
- package/dist/esm/client/renderContentSelector.d.mts +0 -6
- package/dist/esm/client/renderContentSelector.mjs +0 -15
- package/dist/esm/client/renderContentSelector.mjs.map +0 -1
- package/dist/esm/server/content-editor.d.mts +0 -12
- package/dist/esm/server/content-editor.mjs +0 -123
- package/dist/esm/server/content-editor.mjs.map +0 -1
- package/src/client/ContentEditionLayout.tsx +0 -26
- package/src/client/ContentSelectorWrapper.tsx +0 -38
- package/src/client/EditionPanel/EditionPanel.tsx +0 -90
- package/src/client/EditionPanel/index.ts +0 -3
- package/src/client/EditionPanel/useEditedContentStore.ts +0 -98
- package/src/client/EditionPanel/useEditionPanelStore.ts +0 -19
- package/src/client/index.ts +0 -4
- package/src/client/renderContentSelector.tsx +0 -17
- package/src/client/useEditorServer.ts +0 -31
- package/src/server/content-editor.ts +0 -209
- package/src/server/index.ts +0 -40
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
RightDrawer,
|
|
5
|
+
DictionaryEditor,
|
|
6
|
+
LocaleSwitcher
|
|
7
|
+
} from "@intlayer/design-system";
|
|
8
|
+
import dictionaries from "@intlayer/dictionaries-entry";
|
|
9
|
+
import { useDictionaryListDrawer } from '../DictionaryListDrawer/index.mjs';
|
|
10
|
+
import {
|
|
11
|
+
useDictionaryEditionDrawer
|
|
12
|
+
} from './useDictionaryEditionDrawer.mjs';
|
|
13
|
+
import { useEditionPanelStore } from './useFocusContentStore.mjs';
|
|
14
|
+
const DictionaryEditionDrawerContent = ({ focusedContent, locale, identifier }) => {
|
|
15
|
+
const {
|
|
16
|
+
setFocusedContent,
|
|
17
|
+
editContentRequest,
|
|
18
|
+
editedContent,
|
|
19
|
+
addEditedContent,
|
|
20
|
+
clearEditedDictionaryContent
|
|
21
|
+
} = useDictionaryEditionDrawer(identifier);
|
|
22
|
+
const dictionaryId = focusedContent.dictionaryId;
|
|
23
|
+
const dictionary = dictionaries[dictionaryId];
|
|
24
|
+
const dictionaryPath = dictionary.filePath;
|
|
25
|
+
const editedDictionaryContent = editedContent[dictionaryPath];
|
|
26
|
+
return /* @__PURE__ */ jsx(
|
|
27
|
+
DictionaryEditor,
|
|
28
|
+
{
|
|
29
|
+
dictionary,
|
|
30
|
+
locale,
|
|
31
|
+
focusedKeyPath: focusedContent.keyPath,
|
|
32
|
+
editedContent: editedDictionaryContent,
|
|
33
|
+
onFocusKeyPath: (keyPath) => setFocusedContent({ ...focusedContent, keyPath }),
|
|
34
|
+
onContentChange: (keyPath, newValue) => addEditedContent(dictionaryPath, keyPath, newValue),
|
|
35
|
+
onValidEdition: editContentRequest,
|
|
36
|
+
onCancelEdition: () => clearEditedDictionaryContent(dictionaryPath)
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
const getDrawerIdentifier = (dictionaryId) => `dictionary_edition_${dictionaryId}`;
|
|
41
|
+
const DictionaryEditionDrawer = ({
|
|
42
|
+
locale,
|
|
43
|
+
localeList,
|
|
44
|
+
setLocale,
|
|
45
|
+
dictionaryId
|
|
46
|
+
}) => {
|
|
47
|
+
const id = getDrawerIdentifier(dictionaryId);
|
|
48
|
+
const { focusedContent, close } = useDictionaryEditionDrawer(dictionaryId);
|
|
49
|
+
const { open: openDictionaryListDrawer } = useDictionaryListDrawer();
|
|
50
|
+
const handleOnBack = () => {
|
|
51
|
+
close();
|
|
52
|
+
openDictionaryListDrawer();
|
|
53
|
+
};
|
|
54
|
+
return /* @__PURE__ */ jsx(
|
|
55
|
+
RightDrawer,
|
|
56
|
+
{
|
|
57
|
+
title: dictionaryId,
|
|
58
|
+
identifier: id,
|
|
59
|
+
header: /* @__PURE__ */ jsx(
|
|
60
|
+
LocaleSwitcher,
|
|
61
|
+
{
|
|
62
|
+
setLocale,
|
|
63
|
+
locale,
|
|
64
|
+
localeList
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
backButton: {
|
|
68
|
+
onBack: handleOnBack,
|
|
69
|
+
text: "Dictionary list"
|
|
70
|
+
},
|
|
71
|
+
children: focusedContent && /* @__PURE__ */ jsx(
|
|
72
|
+
DictionaryEditionDrawerContent,
|
|
73
|
+
{
|
|
74
|
+
focusedContent,
|
|
75
|
+
locale,
|
|
76
|
+
identifier: id
|
|
77
|
+
}
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
const DictionaryEditionDrawerController = ({ locale, localeList, setLocale }) => {
|
|
83
|
+
const focusedContent = useEditionPanelStore((s) => s.focusedContent);
|
|
84
|
+
const dictionaryId = focusedContent?.dictionaryId;
|
|
85
|
+
if (!dictionaryId) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
return /* @__PURE__ */ jsx(
|
|
89
|
+
DictionaryEditionDrawer,
|
|
90
|
+
{
|
|
91
|
+
locale,
|
|
92
|
+
localeList,
|
|
93
|
+
setLocale,
|
|
94
|
+
dictionaryId
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
export {
|
|
99
|
+
DictionaryEditionDrawer,
|
|
100
|
+
DictionaryEditionDrawerContent,
|
|
101
|
+
DictionaryEditionDrawerController,
|
|
102
|
+
getDrawerIdentifier
|
|
103
|
+
};
|
|
104
|
+
//# sourceMappingURL=DictionaryEditionDrawer.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/client/DictionaryEditionDrawer/DictionaryEditionDrawer.tsx"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/core';\nimport {\n RightDrawer,\n DictionaryEditor,\n LocaleSwitcher,\n type FileContent,\n} from '@intlayer/design-system';\n/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n * The alias allow hot reload the app (such as nextjs) on any dictionary change.\n */\nimport dictionaries from '@intlayer/dictionaries-entry';\nimport type { FC } from 'react';\nimport { useDictionaryListDrawer } from '../DictionaryListDrawer/index';\nimport {\n type FileContent as FileContentWithDictionaryPath,\n useDictionaryEditionDrawer,\n} from './useDictionaryEditionDrawer';\nimport { useEditionPanelStore } from './useFocusContentStore';\n\ntype DictionaryEditionDrawerContentProps = {\n focusedContent: FileContentWithDictionaryPath;\n locale: Locales;\n identifier: string;\n};\n\nexport const DictionaryEditionDrawerContent: FC<\n DictionaryEditionDrawerContentProps\n> = ({ focusedContent, locale, identifier }) => {\n const {\n setFocusedContent,\n editContentRequest,\n editedContent,\n addEditedContent,\n clearEditedDictionaryContent,\n } = useDictionaryEditionDrawer(identifier);\n\n const dictionaryId: string = focusedContent.dictionaryId;\n const dictionary: Dictionary = dictionaries[dictionaryId];\n const dictionaryPath: string = dictionary.filePath;\n const editedDictionaryContent: FileContent[] = editedContent[dictionaryPath];\n\n return (\n <DictionaryEditor\n dictionary={dictionary}\n locale={locale}\n focusedKeyPath={focusedContent.keyPath}\n editedContent={editedDictionaryContent}\n onFocusKeyPath={(keyPath) =>\n setFocusedContent({ ...focusedContent, keyPath })\n }\n onContentChange={(keyPath, newValue) =>\n addEditedContent(dictionaryPath, keyPath, newValue)\n }\n onValidEdition={editContentRequest}\n onCancelEdition={() => clearEditedDictionaryContent(dictionaryPath)}\n />\n );\n};\n\ntype DictionaryEditionDrawerProps = DictionaryEditionDrawerControllerProps & {\n dictionaryId: string;\n};\n\nexport const getDrawerIdentifier = (dictionaryId: string) =>\n `dictionary_edition_${dictionaryId}`;\n\nexport const DictionaryEditionDrawer: FC<DictionaryEditionDrawerProps> = ({\n locale,\n localeList,\n setLocale,\n dictionaryId,\n}) => {\n const id = getDrawerIdentifier(dictionaryId);\n\n const { focusedContent, close } = useDictionaryEditionDrawer(dictionaryId);\n const { open: openDictionaryListDrawer } = useDictionaryListDrawer();\n\n const handleOnBack = () => {\n close();\n openDictionaryListDrawer();\n };\n\n return (\n <RightDrawer\n title={dictionaryId}\n identifier={id}\n header={\n <LocaleSwitcher\n setLocale={setLocale}\n locale={locale}\n localeList={localeList}\n />\n }\n backButton={{\n onBack: handleOnBack,\n text: 'Dictionary list',\n }}\n >\n {focusedContent && (\n <DictionaryEditionDrawerContent\n focusedContent={focusedContent}\n locale={locale}\n identifier={id}\n />\n )}\n </RightDrawer>\n );\n};\n\ntype DictionaryEditionDrawerControllerProps = {\n locale: Locales;\n localeList: Locales[];\n setLocale: (locale: Locales) => void;\n};\n\nexport const DictionaryEditionDrawerController: FC<\n DictionaryEditionDrawerControllerProps\n> = ({ locale, localeList, setLocale }) => {\n const focusedContent = useEditionPanelStore((s) => s.focusedContent);\n const dictionaryId: string | undefined = focusedContent?.dictionaryId;\n\n if (!dictionaryId) {\n return null;\n }\n\n return (\n <DictionaryEditionDrawer\n locale={locale}\n localeList={localeList}\n setLocale={setLocale}\n dictionaryId={dictionaryId}\n />\n );\n};\n"],"mappings":";AA+CI;AA3CJ;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAMP,OAAO,kBAAkB;AAEzB,SAAS,+BAA+B;AACxC;AAAA,EAEE;AAAA,OACK;AACP,SAAS,4BAA4B;AAQ9B,MAAM,iCAET,CAAC,EAAE,gBAAgB,QAAQ,WAAW,MAAM;AAC9C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,2BAA2B,UAAU;AAEzC,QAAM,eAAuB,eAAe;AAC5C,QAAM,aAAyB,aAAa,YAAY;AACxD,QAAM,iBAAyB,WAAW;AAC1C,QAAM,0BAAyC,cAAc,cAAc;AAE3E,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,gBAAgB,eAAe;AAAA,MAC/B,eAAe;AAAA,MACf,gBAAgB,CAAC,YACf,kBAAkB,EAAE,GAAG,gBAAgB,QAAQ,CAAC;AAAA,MAElD,iBAAiB,CAAC,SAAS,aACzB,iBAAiB,gBAAgB,SAAS,QAAQ;AAAA,MAEpD,gBAAgB;AAAA,MAChB,iBAAiB,MAAM,6BAA6B,cAAc;AAAA;AAAA,EACpE;AAEJ;AAMO,MAAM,sBAAsB,CAAC,iBAClC,sBAAsB,YAAY;AAE7B,MAAM,0BAA4D,CAAC;AAAA,EACxE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,KAAK,oBAAoB,YAAY;AAE3C,QAAM,EAAE,gBAAgB,MAAM,IAAI,2BAA2B,YAAY;AACzE,QAAM,EAAE,MAAM,yBAAyB,IAAI,wBAAwB;AAEnE,QAAM,eAAe,MAAM;AACzB,UAAM;AACN,6BAAyB;AAAA,EAC3B;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,MACP,YAAY;AAAA,MACZ,QACE;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACF;AAAA,MAEF,YAAY;AAAA,QACV,QAAQ;AAAA,QACR,MAAM;AAAA,MACR;AAAA,MAEC,4BACC;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA,YAAY;AAAA;AAAA,MACd;AAAA;AAAA,EAEJ;AAEJ;AAQO,MAAM,oCAET,CAAC,EAAE,QAAQ,YAAY,UAAU,MAAM;AACzC,QAAM,iBAAiB,qBAAqB,CAAC,MAAM,EAAE,cAAc;AACnE,QAAM,eAAmC,gBAAgB;AAEzD,MAAI,CAAC,cAAc;AACjB,WAAO;AAAA,EACT;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { DictionaryEditionDrawer, DictionaryEditionDrawerContent, DictionaryEditionDrawerController, getDrawerIdentifier } from './DictionaryEditionDrawer.mjs';
|
|
2
|
+
export { FileContent, useDictionaryEditionDrawer, useDictionaryEditionDrawerControl } from './useDictionaryEditionDrawer.mjs';
|
|
3
|
+
export { EditedContent, useEditedContentStore } from './useEditedContentStore.mjs';
|
|
4
|
+
import '@intlayer/config/client';
|
|
5
|
+
import 'react';
|
|
6
|
+
import '@intlayer/core';
|
|
7
|
+
import 'zustand/middleware';
|
|
8
|
+
import 'zustand';
|
|
9
|
+
import '@intlayer/design-system';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/client/DictionaryEditionDrawer/index.ts"],"sourcesContent":["export * from './DictionaryEditionDrawer';\nexport * from './useDictionaryEditionDrawer';\nexport * from './useEditedContentStore';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { KeyPath } from '@intlayer/core';
|
|
2
|
+
import { EditedContent } from './useEditedContentStore.mjs';
|
|
3
|
+
import 'zustand/middleware';
|
|
4
|
+
import 'zustand';
|
|
5
|
+
import '@intlayer/design-system';
|
|
6
|
+
|
|
7
|
+
type DictionaryPath = string;
|
|
8
|
+
type FileContent = {
|
|
9
|
+
dictionaryPath: DictionaryPath;
|
|
10
|
+
dictionaryId: string;
|
|
11
|
+
keyPath?: KeyPath[];
|
|
12
|
+
};
|
|
13
|
+
type DictionaryEditionDrawer = {
|
|
14
|
+
focusedContent: FileContent | null;
|
|
15
|
+
setFocusedContent: (content: FileContent | null) => void;
|
|
16
|
+
isOpen: boolean;
|
|
17
|
+
open: (content: FileContent) => void;
|
|
18
|
+
close: () => void;
|
|
19
|
+
editContentRequest: () => Promise<void>;
|
|
20
|
+
editedContent: EditedContent;
|
|
21
|
+
addEditedContent: (dictionaryPath: DictionaryPath, keyPath: KeyPath[], newValue: string) => void;
|
|
22
|
+
getEditedContentValue: (dictionaryPath: DictionaryPath, keyPath: KeyPath[]) => string | undefined;
|
|
23
|
+
clearEditedDictionaryContent: (dictionaryPath: DictionaryPath) => void;
|
|
24
|
+
};
|
|
25
|
+
declare const useDictionaryEditionDrawer: (dictionaryId: string) => DictionaryEditionDrawer;
|
|
26
|
+
type DictionaryEditionDrawerControl = {
|
|
27
|
+
open: (content: FileContent) => void;
|
|
28
|
+
close: (dictionaryId: string) => void;
|
|
29
|
+
};
|
|
30
|
+
declare const useDictionaryEditionDrawerControl: () => DictionaryEditionDrawerControl;
|
|
31
|
+
|
|
32
|
+
export { type FileContent, useDictionaryEditionDrawer, useDictionaryEditionDrawerControl };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { useRightDrawerStore } from "@intlayer/design-system";
|
|
2
|
+
import { useEditorServer } from '../useEditorServer.mjs';
|
|
3
|
+
import { getDrawerIdentifier } from './DictionaryEditionDrawer.mjs';
|
|
4
|
+
import {
|
|
5
|
+
useEditedContentStore
|
|
6
|
+
} from './useEditedContentStore.mjs';
|
|
7
|
+
import { useEditionPanelStore } from './useFocusContentStore.mjs';
|
|
8
|
+
const useDictionaryEditionDrawer = (dictionaryId) => {
|
|
9
|
+
const id = getDrawerIdentifier(dictionaryId);
|
|
10
|
+
const { isOpen, open, close } = useRightDrawerStore(id)();
|
|
11
|
+
const {
|
|
12
|
+
editedContent,
|
|
13
|
+
getEditedContentValue,
|
|
14
|
+
addEditedContent,
|
|
15
|
+
clearEditedDictionaryContent
|
|
16
|
+
} = useEditedContentStore((s) => ({
|
|
17
|
+
editedContent: s.editedContent,
|
|
18
|
+
addEditedContent: s.addEditedContent,
|
|
19
|
+
getEditedContentValue: s.getEditedContentValue,
|
|
20
|
+
clearEditedDictionaryContent: s.clearEditedDictionaryContent
|
|
21
|
+
}));
|
|
22
|
+
const { setFocusedContent, focusedContent } = useEditionPanelStore((s) => ({
|
|
23
|
+
focusedContent: s.focusedContent,
|
|
24
|
+
setFocusedContent: s.setFocusedContent
|
|
25
|
+
}));
|
|
26
|
+
const { editContentRequest } = useEditorServer();
|
|
27
|
+
const openDictionaryEditionDrawer = ({
|
|
28
|
+
dictionaryId: dictionaryId2,
|
|
29
|
+
dictionaryPath,
|
|
30
|
+
keyPath = []
|
|
31
|
+
}) => {
|
|
32
|
+
setFocusedContent({
|
|
33
|
+
dictionaryId: dictionaryId2,
|
|
34
|
+
dictionaryPath,
|
|
35
|
+
keyPath
|
|
36
|
+
});
|
|
37
|
+
open();
|
|
38
|
+
};
|
|
39
|
+
return {
|
|
40
|
+
isOpen,
|
|
41
|
+
focusedContent,
|
|
42
|
+
setFocusedContent,
|
|
43
|
+
open: openDictionaryEditionDrawer,
|
|
44
|
+
close,
|
|
45
|
+
getEditedContentValue,
|
|
46
|
+
editContentRequest,
|
|
47
|
+
editedContent,
|
|
48
|
+
addEditedContent,
|
|
49
|
+
clearEditedDictionaryContent
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
const useDictionaryEditionDrawerControl = () => {
|
|
53
|
+
const setFocusedContent = useEditionPanelStore((s) => s.setFocusedContent);
|
|
54
|
+
const open = ({
|
|
55
|
+
dictionaryId,
|
|
56
|
+
dictionaryPath,
|
|
57
|
+
keyPath = []
|
|
58
|
+
}) => {
|
|
59
|
+
setFocusedContent({
|
|
60
|
+
dictionaryId,
|
|
61
|
+
dictionaryPath,
|
|
62
|
+
keyPath
|
|
63
|
+
});
|
|
64
|
+
const id = getDrawerIdentifier(dictionaryId);
|
|
65
|
+
useRightDrawerStore(id).getState().open();
|
|
66
|
+
};
|
|
67
|
+
const close = (dictionaryId) => {
|
|
68
|
+
const id = getDrawerIdentifier(dictionaryId);
|
|
69
|
+
useRightDrawerStore(id).getState().close();
|
|
70
|
+
};
|
|
71
|
+
return {
|
|
72
|
+
open,
|
|
73
|
+
close
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
export {
|
|
77
|
+
useDictionaryEditionDrawer,
|
|
78
|
+
useDictionaryEditionDrawerControl
|
|
79
|
+
};
|
|
80
|
+
//# sourceMappingURL=useDictionaryEditionDrawer.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/client/DictionaryEditionDrawer/useDictionaryEditionDrawer.ts"],"sourcesContent":["import type { KeyPath } from '@intlayer/core';\nimport { useRightDrawerStore } from '@intlayer/design-system';\nimport { useEditorServer } from '../useEditorServer';\nimport { getDrawerIdentifier } from './DictionaryEditionDrawer';\nimport {\n type EditedContent,\n useEditedContentStore,\n} from './useEditedContentStore';\nimport { useEditionPanelStore } from './useFocusContentStore';\n\ntype DictionaryPath = string;\nexport type FileContent = {\n dictionaryPath: DictionaryPath;\n dictionaryId: string;\n keyPath?: KeyPath[];\n};\n\ntype DictionaryEditionDrawer = {\n focusedContent: FileContent | null;\n setFocusedContent: (content: FileContent | null) => void;\n isOpen: boolean;\n open: (content: FileContent) => void;\n close: () => void;\n editContentRequest: () => Promise<void>;\n editedContent: EditedContent;\n addEditedContent: (\n dictionaryPath: DictionaryPath,\n keyPath: KeyPath[],\n newValue: string\n ) => void;\n getEditedContentValue: (\n dictionaryPath: DictionaryPath,\n keyPath: KeyPath[]\n ) => string | undefined;\n clearEditedDictionaryContent: (dictionaryPath: DictionaryPath) => void;\n};\n\ntype OpenDictionaryEditionDrawerProps = {\n dictionaryId: string;\n dictionaryPath: string;\n keyPath?: KeyPath[];\n};\n\nexport const useDictionaryEditionDrawer = (\n dictionaryId: string\n): DictionaryEditionDrawer => {\n const id = getDrawerIdentifier(dictionaryId);\n const { isOpen, open, close } = useRightDrawerStore(id)();\n const {\n editedContent,\n getEditedContentValue,\n addEditedContent,\n clearEditedDictionaryContent,\n } = useEditedContentStore((s) => ({\n editedContent: s.editedContent,\n addEditedContent: s.addEditedContent,\n getEditedContentValue: s.getEditedContentValue,\n clearEditedDictionaryContent: s.clearEditedDictionaryContent,\n }));\n const { setFocusedContent, focusedContent } = useEditionPanelStore((s) => ({\n focusedContent: s.focusedContent,\n setFocusedContent: s.setFocusedContent,\n }));\n const { editContentRequest } = useEditorServer();\n\n const openDictionaryEditionDrawer = ({\n dictionaryId,\n dictionaryPath,\n keyPath = [],\n }: OpenDictionaryEditionDrawerProps) => {\n setFocusedContent({\n dictionaryId,\n dictionaryPath,\n keyPath,\n });\n\n open();\n };\n\n return {\n isOpen,\n focusedContent,\n setFocusedContent,\n open: openDictionaryEditionDrawer,\n close,\n getEditedContentValue,\n editContentRequest,\n editedContent,\n addEditedContent,\n clearEditedDictionaryContent,\n };\n};\n\ntype DictionaryEditionDrawerControl = {\n open: (content: FileContent) => void;\n close: (dictionaryId: string) => void;\n};\n\nexport const useDictionaryEditionDrawerControl =\n (): DictionaryEditionDrawerControl => {\n const setFocusedContent = useEditionPanelStore((s) => s.setFocusedContent);\n\n const open = ({\n dictionaryId,\n dictionaryPath,\n keyPath = [],\n }: OpenDictionaryEditionDrawerProps) => {\n setFocusedContent({\n dictionaryId,\n dictionaryPath,\n keyPath,\n });\n\n const id = getDrawerIdentifier(dictionaryId);\n\n useRightDrawerStore(id).getState().open();\n };\n\n const close = (dictionaryId: string) => {\n const id = getDrawerIdentifier(dictionaryId);\n\n useRightDrawerStore(id).getState().close();\n };\n\n return {\n open,\n close,\n };\n };\n"],"mappings":"AACA,SAAS,2BAA2B;AACpC,SAAS,uBAAuB;AAChC,SAAS,2BAA2B;AACpC;AAAA,EAEE;AAAA,OACK;AACP,SAAS,4BAA4B;AAmC9B,MAAM,6BAA6B,CACxC,iBAC4B;AAC5B,QAAM,KAAK,oBAAoB,YAAY;AAC3C,QAAM,EAAE,QAAQ,MAAM,MAAM,IAAI,oBAAoB,EAAE,EAAE;AACxD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,sBAAsB,CAAC,OAAO;AAAA,IAChC,eAAe,EAAE;AAAA,IACjB,kBAAkB,EAAE;AAAA,IACpB,uBAAuB,EAAE;AAAA,IACzB,8BAA8B,EAAE;AAAA,EAClC,EAAE;AACF,QAAM,EAAE,mBAAmB,eAAe,IAAI,qBAAqB,CAAC,OAAO;AAAA,IACzE,gBAAgB,EAAE;AAAA,IAClB,mBAAmB,EAAE;AAAA,EACvB,EAAE;AACF,QAAM,EAAE,mBAAmB,IAAI,gBAAgB;AAE/C,QAAM,8BAA8B,CAAC;AAAA,IACnC,cAAAA;AAAA,IACA;AAAA,IACA,UAAU,CAAC;AAAA,EACb,MAAwC;AACtC,sBAAkB;AAAA,MAChB,cAAAA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAED,SAAK;AAAA,EACP;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAOO,MAAM,oCACX,MAAsC;AACpC,QAAM,oBAAoB,qBAAqB,CAAC,MAAM,EAAE,iBAAiB;AAEzE,QAAM,OAAO,CAAC;AAAA,IACZ;AAAA,IACA;AAAA,IACA,UAAU,CAAC;AAAA,EACb,MAAwC;AACtC,sBAAkB;AAAA,MAChB;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAED,UAAM,KAAK,oBAAoB,YAAY;AAE3C,wBAAoB,EAAE,EAAE,SAAS,EAAE,KAAK;AAAA,EAC1C;AAEA,QAAM,QAAQ,CAAC,iBAAyB;AACtC,UAAM,KAAK,oBAAoB,YAAY;AAE3C,wBAAoB,EAAE,EAAE,SAAS,EAAE,MAAM;AAAA,EAC3C;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;","names":["dictionaryId"]}
|
package/dist/esm/client/{EditionPanel → DictionaryEditionDrawer}/useEditedContentStore.d.mts
RENAMED
|
@@ -17,7 +17,7 @@ declare const useEditedContentStore: zustand.UseBoundStore<Omit<zustand.StoreApi
|
|
|
17
17
|
persist: {
|
|
18
18
|
setOptions: (options: Partial<zustand_middleware.PersistOptions<EditedContentStore, EditedContentStore>>) => void;
|
|
19
19
|
clearStorage: () => void;
|
|
20
|
-
rehydrate: () => void |
|
|
20
|
+
rehydrate: () => Promise<void> | void;
|
|
21
21
|
hasHydrated: () => boolean;
|
|
22
22
|
onHydrate: (fn: (state: EditedContentStore) => void) => () => void;
|
|
23
23
|
onFinishHydration: (fn: (state: EditedContentStore) => void) => () => void;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
+
import { isSameKeyPath } from "@intlayer/core";
|
|
1
2
|
import { create } from "zustand";
|
|
2
3
|
import { persist, createJSONStorage } from "zustand/middleware";
|
|
3
|
-
const isSameKeyPath = (keyPath1, keyPath2) => keyPath1.every(
|
|
4
|
-
(element, index) => keyPath2[index] && keyPath2[index].key === element.key && keyPath2[index].type === element.type
|
|
5
|
-
);
|
|
6
4
|
const useEditedContentStore = create(
|
|
7
5
|
persist(
|
|
8
6
|
(set, get) => ({
|
|
@@ -40,12 +38,22 @@ const useEditedContentStore = create(
|
|
|
40
38
|
});
|
|
41
39
|
},
|
|
42
40
|
clearEditedDictionaryContent: (dictionaryPath) => {
|
|
43
|
-
set((state) =>
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
41
|
+
set((state) => {
|
|
42
|
+
const filteredEditedContent = Object.entries(
|
|
43
|
+
state.editedContent
|
|
44
|
+
).reduce((acc, [path, content]) => {
|
|
45
|
+
if (path === dictionaryPath) {
|
|
46
|
+
return acc;
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
...acc,
|
|
50
|
+
[path]: content
|
|
51
|
+
};
|
|
52
|
+
}, {});
|
|
53
|
+
return {
|
|
54
|
+
editedContent: filteredEditedContent
|
|
55
|
+
};
|
|
56
|
+
});
|
|
49
57
|
},
|
|
50
58
|
clearEditedContent: () => {
|
|
51
59
|
set({ editedContent: {} });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/client/DictionaryEditionDrawer/useEditedContentStore.ts"],"sourcesContent":["import { type KeyPath, isSameKeyPath } from '@intlayer/core';\nimport type { FileContent } from '@intlayer/design-system';\nimport { create } from 'zustand';\nimport { persist, createJSONStorage } from 'zustand/middleware';\n\ntype DictionaryPath = string;\n\nexport type EditedContent = Record<DictionaryPath, FileContent[]>;\n\ntype EditedContentStore = {\n editedContent: EditedContent;\n addEditedContent: (\n dictionaryPath: DictionaryPath,\n keyPath: KeyPath[],\n newValue: string\n ) => void;\n removeEditedContent: (\n dictionaryPath: DictionaryPath,\n keyPath: KeyPath[]\n ) => void;\n clearEditedDictionaryContent: (dictionaryPath: DictionaryPath) => void;\n clearEditedContent: () => void;\n getEditedContentValue: (\n dictionaryPath: DictionaryPath,\n keyPath: KeyPath[]\n ) => string | undefined;\n};\n\nexport const useEditedContentStore = create(\n persist<EditedContentStore>(\n (set, get) => ({\n editedContent: {},\n addEditedContent: (dictionaryPath, keyPath, newValue) => {\n set((state) => {\n const editedContent = state.editedContent[dictionaryPath] ?? [];\n return {\n editedContent: {\n ...state.editedContent,\n [dictionaryPath]: [\n ...editedContent.filter(\n (content) => !isSameKeyPath(content.keyPath, keyPath)\n ),\n {\n keyPath,\n newValue,\n },\n ],\n },\n };\n });\n },\n\n removeEditedContent: (dictionaryPath, keyPath) => {\n set((state) => {\n const editedContent = state.editedContent[dictionaryPath] ?? [];\n return {\n editedContent: {\n ...state.editedContent,\n [dictionaryPath]: editedContent.filter(\n (content) => content.keyPath !== keyPath\n ),\n },\n };\n });\n },\n\n clearEditedDictionaryContent: (dictionaryPath) => {\n set((state) => {\n const filteredEditedContent = Object.entries(\n state.editedContent\n ).reduce((acc, [path, content]) => {\n if (path === dictionaryPath) {\n return acc;\n }\n\n return {\n ...acc,\n [path]: content,\n };\n }, {});\n\n return {\n editedContent: filteredEditedContent,\n };\n });\n },\n\n clearEditedContent: () => {\n set({ editedContent: {} });\n },\n\n getEditedContentValue: (dictionaryPath, keyPath): string | undefined =>\n get().editedContent[dictionaryPath]?.find((content) =>\n isSameKeyPath(content.keyPath, keyPath)\n )?.newValue,\n }),\n {\n name: 'edited-content-store',\n storage: createJSONStorage(() => sessionStorage),\n }\n )\n);\n"],"mappings":"AAAA,SAAuB,qBAAqB;AAE5C,SAAS,cAAc;AACvB,SAAS,SAAS,yBAAyB;AAyBpC,MAAM,wBAAwB;AAAA,EACnC;AAAA,IACE,CAAC,KAAK,SAAS;AAAA,MACb,eAAe,CAAC;AAAA,MAChB,kBAAkB,CAAC,gBAAgB,SAAS,aAAa;AACvD,YAAI,CAAC,UAAU;AACb,gBAAM,gBAAgB,MAAM,cAAc,cAAc,KAAK,CAAC;AAC9D,iBAAO;AAAA,YACL,eAAe;AAAA,cACb,GAAG,MAAM;AAAA,cACT,CAAC,cAAc,GAAG;AAAA,gBAChB,GAAG,cAAc;AAAA,kBACf,CAAC,YAAY,CAAC,cAAc,QAAQ,SAAS,OAAO;AAAA,gBACtD;AAAA,gBACA;AAAA,kBACE;AAAA,kBACA;AAAA,gBACF;AAAA,cACF;AAAA,YACF;AAAA,UACF;AAAA,QACF,CAAC;AAAA,MACH;AAAA,MAEA,qBAAqB,CAAC,gBAAgB,YAAY;AAChD,YAAI,CAAC,UAAU;AACb,gBAAM,gBAAgB,MAAM,cAAc,cAAc,KAAK,CAAC;AAC9D,iBAAO;AAAA,YACL,eAAe;AAAA,cACb,GAAG,MAAM;AAAA,cACT,CAAC,cAAc,GAAG,cAAc;AAAA,gBAC9B,CAAC,YAAY,QAAQ,YAAY;AAAA,cACnC;AAAA,YACF;AAAA,UACF;AAAA,QACF,CAAC;AAAA,MACH;AAAA,MAEA,8BAA8B,CAAC,mBAAmB;AAChD,YAAI,CAAC,UAAU;AACb,gBAAM,wBAAwB,OAAO;AAAA,YACnC,MAAM;AAAA,UACR,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,OAAO,MAAM;AACjC,gBAAI,SAAS,gBAAgB;AAC3B,qBAAO;AAAA,YACT;AAEA,mBAAO;AAAA,cACL,GAAG;AAAA,cACH,CAAC,IAAI,GAAG;AAAA,YACV;AAAA,UACF,GAAG,CAAC,CAAC;AAEL,iBAAO;AAAA,YACL,eAAe;AAAA,UACjB;AAAA,QACF,CAAC;AAAA,MACH;AAAA,MAEA,oBAAoB,MAAM;AACxB,YAAI,EAAE,eAAe,CAAC,EAAE,CAAC;AAAA,MAC3B;AAAA,MAEA,uBAAuB,CAAC,gBAAgB,YACtC,IAAI,EAAE,cAAc,cAAc,GAAG;AAAA,QAAK,CAAC,YACzC,cAAc,QAAQ,SAAS,OAAO;AAAA,MACxC,GAAG;AAAA,IACP;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,SAAS,kBAAkB,MAAM,cAAc;AAAA,IACjD;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/client/DictionaryEditionDrawer/useFocusContentStore.ts"],"sourcesContent":["import type { KeyPath } from '@intlayer/core';\nimport { create } from 'zustand';\n\ntype DictionaryPath = string;\ntype FileContent = {\n dictionaryPath: DictionaryPath;\n dictionaryId: string;\n keyPath?: KeyPath[];\n};\n\ntype EditionPanelStore = {\n focusedContent: FileContent | null;\n setFocusedContent: (content: FileContent | null) => void;\n};\n\nexport const useEditionPanelStore = create<EditionPanelStore>((set) => ({\n focusedContent: null,\n setFocusedContent: (content) => set({ focusedContent: content }),\n}));\n"],"mappings":"AACA,SAAS,cAAc;AAchB,MAAM,uBAAuB,OAA0B,CAAC,SAAS;AAAA,EACtE,gBAAgB;AAAA,EAChB,mBAAmB,CAAC,YAAY,IAAI,EAAE,gBAAgB,QAAQ,CAAC;AACjE,EAAE;","names":[]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { RightDrawer, RedirectionButton } from "@intlayer/design-system";
|
|
3
|
+
import dictionaries from "@intlayer/dictionaries-entry";
|
|
4
|
+
import {
|
|
5
|
+
useDictionaryEditionDrawerControl,
|
|
6
|
+
useEditedContentStore
|
|
7
|
+
} from '../DictionaryEditionDrawer/index.mjs';
|
|
8
|
+
import {
|
|
9
|
+
dictionaryListDrawerIdentifier,
|
|
10
|
+
useDictionaryListDrawer
|
|
11
|
+
} from './useDictionaryListDrawer.mjs';
|
|
12
|
+
const DictionaryListDrawer = () => {
|
|
13
|
+
const dictionaryKeyList = Object.keys(dictionaries);
|
|
14
|
+
const { open: openDictionaryEditionDrawer } = useDictionaryEditionDrawerControl();
|
|
15
|
+
const { close } = useDictionaryListDrawer();
|
|
16
|
+
const editedContent = useEditedContentStore((s) => s.editedContent);
|
|
17
|
+
const handleClickDictionary = (dictionaryId) => {
|
|
18
|
+
const { filePath } = dictionaries[dictionaryId];
|
|
19
|
+
close();
|
|
20
|
+
openDictionaryEditionDrawer({ dictionaryId, dictionaryPath: filePath });
|
|
21
|
+
};
|
|
22
|
+
const isDictionaryEdited = (dictionaryId) => {
|
|
23
|
+
const dictionaryPath = dictionaries[dictionaryId].filePath;
|
|
24
|
+
return Object.keys(editedContent).includes(dictionaryPath);
|
|
25
|
+
};
|
|
26
|
+
return /* @__PURE__ */ jsx(
|
|
27
|
+
RightDrawer,
|
|
28
|
+
{
|
|
29
|
+
title: "Dictionary list",
|
|
30
|
+
identifier: dictionaryListDrawerIdentifier,
|
|
31
|
+
children: dictionaryKeyList.map((dictionaryId) => /* @__PURE__ */ jsx(
|
|
32
|
+
RedirectionButton,
|
|
33
|
+
{
|
|
34
|
+
label: `Open dictionary editor ${dictionaryId}`,
|
|
35
|
+
onClick: () => handleClickDictionary(dictionaryId),
|
|
36
|
+
children: isDictionaryEdited(dictionaryId) ? `\u270E ${dictionaryId}` : dictionaryId
|
|
37
|
+
},
|
|
38
|
+
dictionaryId
|
|
39
|
+
))
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
DictionaryListDrawer
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=DictionaryListDrawer.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/client/DictionaryListDrawer/DictionaryListDrawer.tsx"],"sourcesContent":["import type { Locales } from '@intlayer/config/client';\nimport { RightDrawer, RedirectionButton } from '@intlayer/design-system';\n/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n * The alias allow hot reload the app (such as nextjs) on any dictionary change.\n */\nimport dictionaries from '@intlayer/dictionaries-entry';\nimport type { FC } from 'react';\nimport {\n useDictionaryEditionDrawerControl,\n useEditedContentStore,\n} from '../DictionaryEditionDrawer/index';\nimport {\n dictionaryListDrawerIdentifier,\n useDictionaryListDrawer,\n} from './useDictionaryListDrawer';\n\nexport const DictionaryListDrawer: FC = () => {\n const dictionaryKeyList = Object.keys(dictionaries) as Locales[];\n const { open: openDictionaryEditionDrawer } =\n useDictionaryEditionDrawerControl();\n const { close } = useDictionaryListDrawer();\n const editedContent = useEditedContentStore((s) => s.editedContent);\n\n const handleClickDictionary = (dictionaryId: string) => {\n const { filePath } = dictionaries[dictionaryId];\n\n close();\n openDictionaryEditionDrawer({ dictionaryId, dictionaryPath: filePath });\n };\n\n const isDictionaryEdited = (dictionaryId: string) => {\n const dictionaryPath = dictionaries[dictionaryId].filePath;\n\n return Object.keys(editedContent).includes(dictionaryPath);\n };\n\n return (\n <RightDrawer\n title=\"Dictionary list\"\n identifier={dictionaryListDrawerIdentifier}\n >\n {dictionaryKeyList.map((dictionaryId) => (\n <RedirectionButton\n key={dictionaryId}\n label={`Open dictionary editor ${dictionaryId}`}\n onClick={() => handleClickDictionary(dictionaryId)}\n >\n {isDictionaryEdited(dictionaryId)\n ? `✎ ${dictionaryId}`\n : dictionaryId}\n </RedirectionButton>\n ))}\n </RightDrawer>\n );\n};\n"],"mappings":"AA4CQ;AA3CR,SAAS,aAAa,yBAAyB;AAM/C,OAAO,kBAAkB;AAEzB;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEA,MAAM,uBAA2B,MAAM;AAC5C,QAAM,oBAAoB,OAAO,KAAK,YAAY;AAClD,QAAM,EAAE,MAAM,4BAA4B,IACxC,kCAAkC;AACpC,QAAM,EAAE,MAAM,IAAI,wBAAwB;AAC1C,QAAM,gBAAgB,sBAAsB,CAAC,MAAM,EAAE,aAAa;AAElE,QAAM,wBAAwB,CAAC,iBAAyB;AACtD,UAAM,EAAE,SAAS,IAAI,aAAa,YAAY;AAE9C,UAAM;AACN,gCAA4B,EAAE,cAAc,gBAAgB,SAAS,CAAC;AAAA,EACxE;AAEA,QAAM,qBAAqB,CAAC,iBAAyB;AACnD,UAAM,iBAAiB,aAAa,YAAY,EAAE;AAElD,WAAO,OAAO,KAAK,aAAa,EAAE,SAAS,cAAc;AAAA,EAC3D;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAM;AAAA,MACN,YAAY;AAAA,MAEX,4BAAkB,IAAI,CAAC,iBACtB;AAAA,QAAC;AAAA;AAAA,UAEC,OAAO,0BAA0B,YAAY;AAAA,UAC7C,SAAS,MAAM,sBAAsB,YAAY;AAAA,UAEhD,6BAAmB,YAAY,IAC5B,UAAK,YAAY,KACjB;AAAA;AAAA,QANC;AAAA,MAOP,CACD;AAAA;AAAA,EACH;AAEJ;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/client/DictionaryListDrawer/index.ts"],"sourcesContent":["export * from './DictionaryListDrawer';\nexport * from './useDictionaryListDrawer';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useRightDrawerStore } from "@intlayer/design-system";
|
|
2
|
+
const dictionaryListDrawerIdentifier = "dictionaryList";
|
|
3
|
+
const useDictionaryListDrawer = () => useRightDrawerStore(dictionaryListDrawerIdentifier)();
|
|
4
|
+
export {
|
|
5
|
+
dictionaryListDrawerIdentifier,
|
|
6
|
+
useDictionaryListDrawer
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=useDictionaryListDrawer.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/client/DictionaryListDrawer/useDictionaryListDrawer.ts"],"sourcesContent":["import { useRightDrawerStore } from '@intlayer/design-system';\n\nexport const dictionaryListDrawerIdentifier = 'dictionaryList';\n\nexport const useDictionaryListDrawer = () =>\n useRightDrawerStore(dictionaryListDrawerIdentifier)();\n"],"mappings":"AAAA,SAAS,2BAA2B;AAE7B,MAAM,iCAAiC;AAEvC,MAAM,0BAA0B,MACrC,oBAAoB,8BAA8B,EAAE;","names":[]}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
1
|
+
export { DictionaryEditionDrawer, DictionaryEditionDrawerContent, DictionaryEditionDrawerController, getDrawerIdentifier } from './DictionaryEditionDrawer/DictionaryEditionDrawer.mjs';
|
|
2
|
+
export { FileContent, useDictionaryEditionDrawer, useDictionaryEditionDrawerControl } from './DictionaryEditionDrawer/useDictionaryEditionDrawer.mjs';
|
|
3
|
+
export { EditedContent, useEditedContentStore } from './DictionaryEditionDrawer/useEditedContentStore.mjs';
|
|
4
|
+
export { DictionaryListDrawer } from './DictionaryListDrawer/DictionaryListDrawer.mjs';
|
|
5
|
+
export { dictionaryListDrawerIdentifier, useDictionaryListDrawer } from './DictionaryListDrawer/useDictionaryListDrawer.mjs';
|
|
5
6
|
export { ContentEditionLayout, ContentEditionLayoutProps } from './ContentEditionLayout.mjs';
|
|
6
7
|
export { useEditorServer } from './useEditorServer.mjs';
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
export { IntlayerEditorElementProps, renderIntlayerEditor } from './renderContentEditor.mjs';
|
|
9
|
+
export { IntlayerEditorContext, IntlayerEditorProvider, IntlayerEditorProviderProps, useIntlayerEditorContext } from './ContentEditorProvider.mjs';
|
|
9
10
|
import '@intlayer/config/client';
|
|
10
11
|
import 'react';
|
|
11
|
-
import '
|
|
12
|
+
import '@intlayer/core';
|
|
12
13
|
import 'zustand/middleware';
|
|
14
|
+
import 'zustand';
|
|
13
15
|
import '@intlayer/design-system';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
1
|
+
export * from './DictionaryEditionDrawer/index.mjs';
|
|
2
|
+
export * from './DictionaryListDrawer/index.mjs';
|
|
3
3
|
export * from './ContentEditionLayout.mjs';
|
|
4
4
|
export * from './useEditorServer.mjs';
|
|
5
|
+
export * from './renderContentEditor.mjs';
|
|
6
|
+
export * from './ContentEditorProvider.mjs';
|
|
5
7
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/index.ts"],"sourcesContent":["export * from './
|
|
1
|
+
{"version":3,"sources":["../../../src/client/index.ts"],"sourcesContent":["export * from './DictionaryEditionDrawer/index';\nexport * from './DictionaryListDrawer/index';\nexport * from './ContentEditionLayout';\nexport * from './useEditorServer';\nexport * from './renderContentEditor';\nexport * from './ContentEditorProvider';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { KeyPath } from '@intlayer/core';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
type IntlayerEditorElementProps = {
|
|
5
|
+
content: string;
|
|
6
|
+
dictionaryId: string;
|
|
7
|
+
dictionaryPath: string;
|
|
8
|
+
keyPath: KeyPath[];
|
|
9
|
+
};
|
|
10
|
+
type RenderIntlayerEditorResult = ReactNode & {
|
|
11
|
+
value: string;
|
|
12
|
+
};
|
|
13
|
+
declare const renderIntlayerEditor: (data: IntlayerEditorElementProps) => RenderIntlayerEditorResult;
|
|
14
|
+
|
|
15
|
+
export { type IntlayerEditorElementProps, renderIntlayerEditor };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getConfiguration } from "@intlayer/config/client";
|
|
3
|
+
import { ContentSelectorWrapper } from './ContentSelectorWrapper.mjs';
|
|
4
|
+
const {
|
|
5
|
+
editor: { enabled }
|
|
6
|
+
} = getConfiguration();
|
|
7
|
+
const IntlayerEditorElement = ({
|
|
8
|
+
content,
|
|
9
|
+
...props
|
|
10
|
+
}) => {
|
|
11
|
+
if (enabled) {
|
|
12
|
+
return /* @__PURE__ */ jsx(ContentSelectorWrapper, { ...props, children: content });
|
|
13
|
+
}
|
|
14
|
+
return content;
|
|
15
|
+
};
|
|
16
|
+
IntlayerEditorElement.content = "";
|
|
17
|
+
const renderIntlayerEditor = (data) => {
|
|
18
|
+
const Result = /* @__PURE__ */ jsx(IntlayerEditorElement, { ...data });
|
|
19
|
+
return { ...Result, value: data.content };
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
renderIntlayerEditor
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=renderContentEditor.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/client/renderContentEditor.tsx"],"sourcesContent":["import { getConfiguration } from '@intlayer/config/client';\nimport type { KeyPath } from '@intlayer/core';\nimport type { ReactNode } from 'react';\nimport { ContentSelectorWrapper } from './ContentSelectorWrapper';\n\nconst {\n editor: { enabled },\n} = getConfiguration();\n\nexport type IntlayerEditorElementProps = {\n content: string;\n dictionaryId: string;\n dictionaryPath: string;\n keyPath: KeyPath[];\n};\n\ntype RenderIntlayerEditorResult = ReactNode & { value: string };\n\nconst IntlayerEditorElement = ({\n content,\n ...props\n}: IntlayerEditorElementProps) => {\n if (enabled) {\n return (\n <ContentSelectorWrapper {...props}>{content}</ContentSelectorWrapper>\n );\n }\n return content;\n};\n\nIntlayerEditorElement.content = '';\n\nexport const renderIntlayerEditor = (\n data: IntlayerEditorElementProps\n): RenderIntlayerEditorResult => {\n const Result = <IntlayerEditorElement {...data} />;\n\n return { ...Result, value: data.content };\n};\n"],"mappings":"AAwBM;AAxBN,SAAS,wBAAwB;AAGjC,SAAS,8BAA8B;AAEvC,MAAM;AAAA,EACJ,QAAQ,EAAE,QAAQ;AACpB,IAAI,iBAAiB;AAWrB,MAAM,wBAAwB,CAAC;AAAA,EAC7B;AAAA,EACA,GAAG;AACL,MAAkC;AAChC,MAAI,SAAS;AACX,WACE,oBAAC,0BAAwB,GAAG,OAAQ,mBAAQ;AAAA,EAEhD;AACA,SAAO;AACT;AAEA,sBAAsB,UAAU;AAEzB,MAAM,uBAAuB,CAClC,SAC+B;AAC/B,QAAM,SAAS,oBAAC,yBAAuB,GAAG,MAAM;AAEhD,SAAO,EAAE,GAAG,QAAQ,OAAO,KAAK,QAAQ;AAC1C;","names":[]}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { getConfiguration } from "@intlayer/config/client";
|
|
2
|
-
import { useEditedContentStore } from './
|
|
2
|
+
import { useEditedContentStore } from './DictionaryEditionDrawer/useEditedContentStore.mjs';
|
|
3
3
|
const useEditorServer = () => {
|
|
4
|
-
const { editedContent, clearEditedContent } = useEditedContentStore()
|
|
4
|
+
const { editedContent, clearEditedContent } = useEditedContentStore((s) => ({
|
|
5
|
+
editedContent: s.editedContent,
|
|
6
|
+
clearEditedContent: s.clearEditedContent
|
|
7
|
+
}));
|
|
5
8
|
const editContentRequest = async () => {
|
|
6
9
|
const {
|
|
7
10
|
editor: { port }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/useEditorServer.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config/client';\nimport { useEditedContentStore } from './
|
|
1
|
+
{"version":3,"sources":["../../../src/client/useEditorServer.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config/client';\nimport { useEditedContentStore } from './DictionaryEditionDrawer/useEditedContentStore';\n\nexport const useEditorServer = () => {\n const { editedContent, clearEditedContent } = useEditedContentStore((s) => ({\n editedContent: s.editedContent,\n clearEditedContent: s.clearEditedContent,\n }));\n\n const editContentRequest = async () => {\n const {\n editor: { port },\n } = getConfiguration();\n\n await fetch(`http://localhost:${port}`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(editedContent),\n })\n .then((response) => {\n if (!response.ok) {\n throw new Error('Failed to edit content');\n }\n clearEditedContent();\n })\n .catch((error) => {\n console.error('Failed to edit content:', error);\n });\n };\n\n return { editContentRequest };\n};\n"],"mappings":"AAAA,SAAS,wBAAwB;AACjC,SAAS,6BAA6B;AAE/B,MAAM,kBAAkB,MAAM;AACnC,QAAM,EAAE,eAAe,mBAAmB,IAAI,sBAAsB,CAAC,OAAO;AAAA,IAC1E,eAAe,EAAE;AAAA,IACjB,oBAAoB,EAAE;AAAA,EACxB,EAAE;AAEF,QAAM,qBAAqB,YAAY;AACrC,UAAM;AAAA,MACJ,QAAQ,EAAE,KAAK;AAAA,IACjB,IAAI,iBAAiB;AAErB,UAAM,MAAM,oBAAoB,IAAI,IAAI;AAAA,MACtC,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,gBAAgB;AAAA,MAClB;AAAA,MACA,MAAM,KAAK,UAAU,aAAa;AAAA,IACpC,CAAC,EACE,KAAK,CAAC,aAAa;AAClB,UAAI,CAAC,SAAS,IAAI;AAChB,cAAM,IAAI,MAAM,wBAAwB;AAAA,MAC1C;AACA,yBAAmB;AAAA,IACrB,CAAC,EACA,MAAM,CAAC,UAAU;AAChB,cAAQ,MAAM,2BAA2B,KAAK;AAAA,IAChD,CAAC;AAAA,EACL;AAEA,SAAO,EAAE,mBAAmB;AAC9B;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import prettier from "prettier";
|
|
2
|
+
const format = async (content) => {
|
|
3
|
+
let options = {};
|
|
4
|
+
try {
|
|
5
|
+
options = await prettier.resolveConfig(content, {
|
|
6
|
+
editorconfig: true
|
|
7
|
+
}) ?? {};
|
|
8
|
+
} catch (error) {
|
|
9
|
+
console.error("Failed to resolve Prettier configuration:", error);
|
|
10
|
+
}
|
|
11
|
+
const config = { ...options, parser: "typescript" };
|
|
12
|
+
return prettier.format(content, config);
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
format
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=formatPrettier.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/server/formatPrettier.ts"],"sourcesContent":["import prettier from 'prettier';\n\n/**\n * Format the content with Prettier\n */\nexport const format = async (content: string) => {\n // Resolve the configuration from the project\n let options: prettier.Options = {};\n\n try {\n // Resolve the prettier configuration from the project\n options =\n (await prettier.resolveConfig(content, {\n editorconfig: true,\n })) ?? {};\n } catch (error) {\n console.error('Failed to resolve Prettier configuration:', error);\n }\n\n // Add the parser option to the resolved config\n const config: prettier.Options = { ...options, parser: 'typescript' };\n\n return prettier.format(content, config);\n};\n"],"mappings":"AAAA,OAAO,cAAc;AAKd,MAAM,SAAS,OAAO,YAAoB;AAE/C,MAAI,UAA4B,CAAC;AAEjC,MAAI;AAEF,cACG,MAAM,SAAS,cAAc,SAAS;AAAA,MACrC,cAAc;AAAA,IAChB,CAAC,KAAM,CAAC;AAAA,EACZ,SAAS,OAAO;AACd,YAAQ,MAAM,6CAA6C,KAAK;AAAA,EAClE;AAGA,QAAM,SAA2B,EAAE,GAAG,SAAS,QAAQ,aAAa;AAEpE,SAAO,SAAS,OAAO,SAAS,MAAM;AACxC;","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getConfiguration } from "@intlayer/config";
|
|
2
2
|
import bodyParser from "body-parser";
|
|
3
3
|
import express from "express";
|
|
4
|
-
import {
|
|
4
|
+
import { processEdition } from './processEdition.mjs';
|
|
5
5
|
const startIntlayerEditor = () => {
|
|
6
6
|
const app = express();
|
|
7
7
|
const {
|
|
@@ -14,7 +14,7 @@ const startIntlayerEditor = () => {
|
|
|
14
14
|
async (req, res) => {
|
|
15
15
|
const editedContent = req.body;
|
|
16
16
|
try {
|
|
17
|
-
await
|
|
17
|
+
await processEdition(editedContent);
|
|
18
18
|
res.send({ success: true, editedContent });
|
|
19
19
|
} catch (error) {
|
|
20
20
|
console.error(error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/server/index.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config';\nimport bodyParser from 'body-parser';\nimport express, { type Request, type Response } from 'express';\nimport type { EditedContent } from '../client';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/server/index.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config';\nimport bodyParser from 'body-parser';\nimport express, { type Request, type Response } from 'express';\nimport type { EditedContent } from '../client';\nimport { processEdition } from './processEdition';\n\nexport const startIntlayerEditor = () => {\n const app = express();\n const {\n editor: { port },\n } = getConfiguration();\n\n app.use(bodyParser.json());\n app.use(bodyParser.urlencoded({ extended: true }));\n\n app.post(\n '/',\n async (\n req: Request<undefined, undefined, EditedContent>,\n res: Response\n ) => {\n const editedContent = req.body;\n\n try {\n await processEdition(editedContent);\n\n res.send({ success: true, editedContent });\n } catch (error) {\n console.error(error);\n res.status(500).send({ success: false });\n }\n }\n );\n\n app.listen(port, () => {\n console.info(\n `Intlayer editor server is running on http://localhost:${port}`\n );\n });\n};\n"],"mappings":"AAAA,SAAS,wBAAwB;AACjC,OAAO,gBAAgB;AACvB,OAAO,aAA8C;AAErD,SAAS,sBAAsB;AAExB,MAAM,sBAAsB,MAAM;AACvC,QAAM,MAAM,QAAQ;AACpB,QAAM;AAAA,IACJ,QAAQ,EAAE,KAAK;AAAA,EACjB,IAAI,iBAAiB;AAErB,MAAI,IAAI,WAAW,KAAK,CAAC;AACzB,MAAI,IAAI,WAAW,WAAW,EAAE,UAAU,KAAK,CAAC,CAAC;AAEjD,MAAI;AAAA,IACF;AAAA,IACA,OACE,KACA,QACG;AACH,YAAM,gBAAgB,IAAI;AAE1B,UAAI;AACF,cAAM,eAAe,aAAa;AAElC,YAAI,KAAK,EAAE,SAAS,MAAM,cAAc,CAAC;AAAA,MAC3C,SAAS,OAAO;AACd,gBAAQ,MAAM,KAAK;AACnB,YAAI,OAAO,GAAG,EAAE,KAAK,EAAE,SAAS,MAAM,CAAC;AAAA,MACzC;AAAA,IACF;AAAA,EACF;AAEA,MAAI,OAAO,MAAM,MAAM;AACrB,YAAQ;AAAA,MACN,yDAAyD,IAAI;AAAA,IAC/D;AAAA,EACF,CAAC;AACH;","names":[]}
|