intlayer-editor 3.3.5 → 3.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ContentSelectorWrapper.cjs +4 -1
- package/dist/cjs/ContentSelectorWrapper.cjs.map +1 -1
- package/dist/cjs/DictionaryEditionDrawer/DictionaryEditionDrawer.cjs +19 -5
- package/dist/cjs/DictionaryEditionDrawer/DictionaryEditionDrawer.cjs.map +1 -1
- package/dist/cjs/DictionaryEditionDrawer/useDictionaryEditionDrawer.cjs +38 -49
- package/dist/cjs/DictionaryEditionDrawer/useDictionaryEditionDrawer.cjs.map +1 -1
- package/dist/cjs/DictionaryListDrawer/DictionaryListDrawer.cjs +34 -12
- package/dist/cjs/DictionaryListDrawer/DictionaryListDrawer.cjs.map +1 -1
- package/dist/cjs/DictionaryListDrawer/{useDictionaryListDrawer.cjs → dictionaryListDrawerIdentifier.cjs} +6 -10
- package/dist/cjs/DictionaryListDrawer/dictionaryListDrawerIdentifier.cjs.map +1 -0
- package/dist/cjs/DictionaryListDrawer/index.cjs +2 -2
- package/dist/cjs/DictionaryListDrawer/index.cjs.map +1 -1
- package/dist/esm/ContentSelectorWrapper.mjs +6 -2
- package/dist/esm/ContentSelectorWrapper.mjs.map +1 -1
- package/dist/esm/DictionaryEditionDrawer/DictionaryEditionDrawer.mjs +21 -6
- package/dist/esm/DictionaryEditionDrawer/DictionaryEditionDrawer.mjs.map +1 -1
- package/dist/esm/DictionaryEditionDrawer/useDictionaryEditionDrawer.mjs +37 -47
- package/dist/esm/DictionaryEditionDrawer/useDictionaryEditionDrawer.mjs.map +1 -1
- package/dist/esm/DictionaryListDrawer/DictionaryListDrawer.mjs +37 -16
- package/dist/esm/DictionaryListDrawer/DictionaryListDrawer.mjs.map +1 -1
- package/dist/esm/DictionaryListDrawer/dictionaryListDrawerIdentifier.mjs +5 -0
- package/dist/esm/DictionaryListDrawer/dictionaryListDrawerIdentifier.mjs.map +1 -0
- package/dist/esm/DictionaryListDrawer/index.mjs +1 -1
- package/dist/esm/DictionaryListDrawer/index.mjs.map +1 -1
- package/dist/types/ContentSelectorWrapper.d.ts.map +1 -1
- package/dist/types/DictionaryEditionDrawer/DictionaryEditionDrawer.d.ts.map +1 -1
- package/dist/types/DictionaryEditionDrawer/useDictionaryEditionDrawer.d.ts +0 -5
- package/dist/types/DictionaryEditionDrawer/useDictionaryEditionDrawer.d.ts.map +1 -1
- package/dist/types/DictionaryListDrawer/DictionaryListDrawer.d.ts +1 -1
- package/dist/types/DictionaryListDrawer/DictionaryListDrawer.d.ts.map +1 -1
- package/dist/types/DictionaryListDrawer/dictionaryListDrawerIdentifier.d.ts +2 -0
- package/dist/types/DictionaryListDrawer/dictionaryListDrawerIdentifier.d.ts.map +1 -0
- package/dist/types/DictionaryListDrawer/index.d.ts +1 -1
- package/dist/types/DictionaryListDrawer/index.d.ts.map +1 -1
- package/package.json +9 -9
- package/dist/cjs/DictionaryListDrawer/useDictionaryListDrawer.cjs.map +0 -1
- package/dist/esm/DictionaryListDrawer/useDictionaryListDrawer.mjs +0 -8
- package/dist/esm/DictionaryListDrawer/useDictionaryListDrawer.mjs.map +0 -1
- package/dist/types/DictionaryListDrawer/useDictionaryListDrawer.d.ts +0 -7
- package/dist/types/DictionaryListDrawer/useDictionaryListDrawer.d.ts.map +0 -1
|
@@ -46,7 +46,10 @@ const ContentSelectorWrapper = ({
|
|
|
46
46
|
}),
|
|
47
47
|
[dictionaryId, dictionaryPath, keyPath, open]
|
|
48
48
|
);
|
|
49
|
-
const isSelected = (
|
|
49
|
+
const isSelected = (0, import_react.useMemo)(
|
|
50
|
+
() => (isOpen && (focusedContent?.keyPath?.length ?? 0) > 0 && (0, import_core.isSameKeyPath)(focusedContent?.keyPath ?? [], keyPath)) ?? false,
|
|
51
|
+
[focusedContent, isOpen, keyPath]
|
|
52
|
+
);
|
|
50
53
|
(0, import_react.useEffect)(() => {
|
|
51
54
|
if (isEditorEnabled && editedValue && typeof editedValue === "string") {
|
|
52
55
|
setDisplayedChildren(editedValue);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ContentSelectorWrapper.tsx"],"sourcesContent":["'use client';\n\nimport { isSameKeyPath, type KeyPath } from '@intlayer/core';\nimport { ContentSelector } from '@intlayer/design-system';\nimport {\n useCallback,\n useEffect,\n useState,\n type FC,\n type ReactNode,\n} from 'react';\nimport { useIntlayerEditorContext } from './IntlayerEditorProvider';\nimport { useDictionaryEditionDrawer } from './DictionaryEditionDrawer/useDictionaryEditionDrawer';\n\ntype ContentSelectorWrapperProps = {\n children: ReactNode;\n dictionaryId: string;\n dictionaryPath: string;\n keyPath: KeyPath[];\n};\n\nexport const ContentSelectorWrapper: FC<ContentSelectorWrapperProps> = ({\n children,\n dictionaryId,\n dictionaryPath,\n keyPath,\n}) => {\n const { open, getEditedContentValue, focusedContent, isOpen } =\n useDictionaryEditionDrawer(dictionaryId);\n const editedValue = getEditedContentValue(dictionaryId, keyPath);\n const { isEditorEnabled } = useIntlayerEditorContext();\n const [displayedChildren, setDisplayedChildren] =\n useState<ReactNode>(children);\n\n const handleSelect = useCallback(\n () =>\n open({\n dictionaryId,\n dictionaryPath,\n keyPath,\n }),\n [dictionaryId, dictionaryPath, keyPath, open]\n );\n\n const isSelected
|
|
1
|
+
{"version":3,"sources":["../../src/ContentSelectorWrapper.tsx"],"sourcesContent":["'use client';\n\nimport { isSameKeyPath, type KeyPath } from '@intlayer/core';\nimport { ContentSelector } 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';\n\ntype ContentSelectorWrapperProps = {\n children: ReactNode;\n dictionaryId: string;\n dictionaryPath: string;\n keyPath: KeyPath[];\n};\n\nexport const ContentSelectorWrapper: FC<ContentSelectorWrapperProps> = ({\n children,\n dictionaryId,\n dictionaryPath,\n keyPath,\n}) => {\n const { open, getEditedContentValue, focusedContent, isOpen } =\n useDictionaryEditionDrawer(dictionaryId);\n const editedValue = getEditedContentValue(dictionaryId, keyPath);\n const { isEditorEnabled } = useIntlayerEditorContext();\n const [displayedChildren, setDisplayedChildren] =\n useState<ReactNode>(children);\n\n const handleSelect = useCallback(\n () =>\n open({\n dictionaryId,\n dictionaryPath,\n keyPath,\n }),\n [dictionaryId, 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 }\n }, [editedValue, isEditorEnabled]);\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;AAkEI;AAhEJ,kBAA4C;AAC5C,2BAAgC;AAChC,mBAOO;AACP,oCAAyC;AACzC,wCAA2C;AASpC,MAAM,yBAA0D,CAAC;AAAA,EACtE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,MAAM,uBAAuB,gBAAgB,OAAO,QAC1D,8DAA2B,YAAY;AACzC,QAAM,cAAc,sBAAsB,cAAc,OAAO;AAC/D,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,cAAc,gBAAgB,SAAS,IAAI;AAAA,EAC9C;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;AAAA,EACF,GAAG,CAAC,aAAa,eAAe,CAAC;AAEjC,MAAI,CAAC,iBAAiB;AACpB,WAAO;AAAA,EACT;AAEA,SACE,4CAAC,wCAAgB,UAAU,cAAc,aAAa,YACnD,6BACH;AAEJ;","names":[]}
|
|
@@ -28,7 +28,9 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
28
28
|
var import_design_system = require("@intlayer/design-system");
|
|
29
29
|
var import_hooks = require("@intlayer/design-system/hooks");
|
|
30
30
|
var import_react = require("react");
|
|
31
|
-
var
|
|
31
|
+
var import_react_intlayer = require("react-intlayer");
|
|
32
|
+
var import_shallow = require("zustand/shallow");
|
|
33
|
+
var import_dictionaryListDrawerIdentifier = require('../DictionaryListDrawer/dictionaryListDrawerIdentifier.cjs');
|
|
32
34
|
var import_useDictionaryEditionDrawer = require('./useDictionaryEditionDrawer.cjs');
|
|
33
35
|
const DictionaryEditionDrawerContent = ({ locale, identifier, handleOnBack }) => {
|
|
34
36
|
const [keyPathEditionModal, setKeyPathEditionModal] = (0, import_react.useState)(null);
|
|
@@ -53,7 +55,11 @@ const DictionaryEditionDrawerContent = ({ locale, identifier, handleOnBack }) =>
|
|
|
53
55
|
isOpen: keyPathEditionModal !== null,
|
|
54
56
|
onClose: () => setKeyPathEditionModal(null),
|
|
55
57
|
hasCloseButton: true,
|
|
56
|
-
title:
|
|
58
|
+
title: (0, import_react_intlayer.t)({
|
|
59
|
+
en: "Edit field",
|
|
60
|
+
fr: "Modifier le champ",
|
|
61
|
+
es: "Editar campo"
|
|
62
|
+
}),
|
|
57
63
|
size: "xl",
|
|
58
64
|
transparency: "lg",
|
|
59
65
|
children: dictionary && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -83,7 +89,9 @@ const DictionaryEditionDrawer = ({
|
|
|
83
89
|
}) => {
|
|
84
90
|
const id = (0, import_useDictionaryEditionDrawer.getDrawerIdentifier)(dictionaryId);
|
|
85
91
|
const { focusedContent, close } = (0, import_useDictionaryEditionDrawer.useDictionaryEditionDrawer)(dictionaryId);
|
|
86
|
-
const {
|
|
92
|
+
const { openDictionaryListDrawer } = (0, import_design_system.useRightDrawerStore)((s) => ({
|
|
93
|
+
openDictionaryListDrawer: () => s.open(import_dictionaryListDrawerIdentifier.dictionaryListDrawerIdentifier)
|
|
94
|
+
}));
|
|
87
95
|
const handleOnBack = () => {
|
|
88
96
|
close();
|
|
89
97
|
openDictionaryListDrawer();
|
|
@@ -103,7 +111,11 @@ const DictionaryEditionDrawer = ({
|
|
|
103
111
|
),
|
|
104
112
|
backButton: {
|
|
105
113
|
onBack: handleOnBack,
|
|
106
|
-
text:
|
|
114
|
+
text: (0, import_react_intlayer.t)({
|
|
115
|
+
en: "Dictionary list",
|
|
116
|
+
fr: "Liste des dictionnaires",
|
|
117
|
+
es: "Lista de diccionarios"
|
|
118
|
+
})
|
|
107
119
|
},
|
|
108
120
|
children: focusedContent && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
109
121
|
DictionaryEditionDrawerContent,
|
|
@@ -118,7 +130,9 @@ const DictionaryEditionDrawer = ({
|
|
|
118
130
|
);
|
|
119
131
|
};
|
|
120
132
|
const DictionaryEditionDrawerController = ({ locale, localeList, setLocale }) => {
|
|
121
|
-
const focusedContent = (0, import_design_system.useEditionPanelStore)(
|
|
133
|
+
const focusedContent = (0, import_design_system.useEditionPanelStore)(
|
|
134
|
+
(0, import_shallow.useShallow)((s) => s.focusedContent)
|
|
135
|
+
);
|
|
122
136
|
const dictionaryId = focusedContent?.dictionaryId;
|
|
123
137
|
if (!dictionaryId) {
|
|
124
138
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
|
|
@@ -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} from '@intlayer/design-system';\nimport { useGetAllDictionaries } from '@intlayer/design-system/hooks';\nimport { useCallback, useEffect, useState, type FC } from 'react';\nimport {
|
|
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 } from 'react-intlayer';\nimport { useShallow } from 'zustand/shallow';\nimport { dictionaryListDrawerIdentifier } from '../DictionaryListDrawer/dictionaryListDrawerIdentifier';\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 dictionaryId = focusedContent?.dictionaryId;\n\n if (!dictionaryId) return <>No dictionary focused</>;\n\n const dictionary: Dictionary = dictionaries[dictionaryId];\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 />\n )}\n </Modal>\n <DictionaryEditor\n dictionary={dictionary}\n locale={locale}\n onClickEdit={setKeyPathEditionModal}\n />\n </>\n );\n};\n\ntype DictionaryEditionDrawerProps = DictionaryEditionDrawerControllerProps & {\n dictionaryId: string;\n};\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 { 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={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: t({\n en: 'Dictionary list',\n fr: 'Liste des dictionnaires',\n es: 'Lista de diccionarios',\n }),\n }}\n >\n {focusedContent && (\n <DictionaryEditionDrawerContent\n focusedContent={focusedContent}\n locale={locale}\n identifier={id}\n handleOnBack={handleOnBack}\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 dictionaryId: string | undefined = focusedContent?.dictionaryId;\n\n if (!dictionaryId) {\n return <></>;\n }\n\n return (\n <DictionaryEditionDrawer\n locale={locale}\n localeList={localeList}\n setLocale={setLocale}\n dictionaryId={dictionaryId}\n />\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsD4B;AAlD5B,2BAQO;AACP,mBAAsC;AACtC,mBAA0D;AAC1D,4BAAkB;AAClB,qBAA2B;AAC3B,4CAA+C;AAC/C,wCAIO;AASA,MAAM,iCAET,CAAC,EAAE,QAAQ,YAAY,aAAa,MAAM;AAC5C,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,eAAe,gBAAgB;AAErC,MAAI,CAAC,aAAc,QAAO,2EAAE,mCAAqB;AAEjD,QAAM,aAAyB,aAAa,YAAY;AAExD,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;AAAA,QACF;AAAA;AAAA,IAEJ;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,aAAa;AAAA;AAAA,IACf;AAAA,KACF;AAEJ;AAMO,MAAM,0BAA4D,CAAC;AAAA,EACxE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,SAAK,uDAAoB,YAAY;AAE3C,QAAM,EAAE,gBAAgB,MAAM,QAAI,8DAA2B,YAAY;AACzE,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,UAAM,yBAAE;AAAA,UACN,IAAI;AAAA,UACJ,IAAI;AAAA,UACJ,IAAI;AAAA,QACN,CAAC;AAAA,MACH;AAAA,MAEC,4BACC;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA,YAAY;AAAA,UACZ;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,eAAmC,gBAAgB;AAEzD,MAAI,CAAC,cAAc;AACjB,WAAO,2EAAE;AAAA,EACX;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -19,72 +19,61 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var useDictionaryEditionDrawer_exports = {};
|
|
20
20
|
__export(useDictionaryEditionDrawer_exports, {
|
|
21
21
|
getDrawerIdentifier: () => getDrawerIdentifier,
|
|
22
|
-
useDictionaryEditionDrawer: () => useDictionaryEditionDrawer
|
|
23
|
-
useDictionaryEditionDrawerControl: () => useDictionaryEditionDrawerControl
|
|
22
|
+
useDictionaryEditionDrawer: () => useDictionaryEditionDrawer
|
|
24
23
|
});
|
|
25
24
|
module.exports = __toCommonJS(useDictionaryEditionDrawer_exports);
|
|
26
25
|
var import_design_system = require("@intlayer/design-system");
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_shallow = require("zustand/shallow");
|
|
27
28
|
const getDrawerIdentifier = (dictionaryId) => `dictionary_edition_${dictionaryId}`;
|
|
28
29
|
const useDictionaryEditionDrawer = (dictionaryId) => {
|
|
29
30
|
const id = getDrawerIdentifier(dictionaryId);
|
|
30
|
-
const {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
31
|
+
const { isOpenDrawer, openDrawer, closeDrawer } = (0, import_design_system.useRightDrawerStore)(
|
|
32
|
+
(0, import_shallow.useShallow)((e) => ({
|
|
33
|
+
isOpenDrawer: e.isOpen,
|
|
34
|
+
openDrawer: e.open,
|
|
35
|
+
closeDrawer: e.close
|
|
36
|
+
}))
|
|
37
|
+
);
|
|
38
|
+
const { setDictionariesRecord, getEditedContentValue } = (0, import_design_system.useEditedContentStore)(
|
|
39
|
+
(0, import_shallow.useShallow)((s) => ({
|
|
40
|
+
setDictionariesRecord: s.setDictionariesRecord,
|
|
41
|
+
getEditedContentValue: s.getEditedContentValue
|
|
42
|
+
}))
|
|
43
|
+
);
|
|
44
|
+
const { setFocusedContent, focusedContent } = (0, import_design_system.useEditionPanelStore)(
|
|
45
|
+
(0, import_shallow.useShallow)((s) => ({
|
|
46
|
+
focusedContent: s.focusedContent,
|
|
47
|
+
setFocusedContent: s.setFocusedContent
|
|
48
|
+
}))
|
|
49
|
+
);
|
|
50
|
+
const openDictionaryEditionDrawer = (0, import_react.useCallback)(
|
|
51
|
+
({
|
|
45
52
|
dictionaryId: dictionaryId2,
|
|
46
53
|
dictionaryPath,
|
|
47
|
-
keyPath
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
|
|
54
|
+
keyPath = []
|
|
55
|
+
}) => {
|
|
56
|
+
setFocusedContent({
|
|
57
|
+
dictionaryId: dictionaryId2,
|
|
58
|
+
dictionaryPath,
|
|
59
|
+
keyPath
|
|
60
|
+
});
|
|
61
|
+
openDrawer(id);
|
|
62
|
+
},
|
|
63
|
+
[openDrawer, setFocusedContent]
|
|
64
|
+
);
|
|
51
65
|
return {
|
|
52
|
-
isOpen,
|
|
66
|
+
isOpen: isOpenDrawer(id),
|
|
53
67
|
focusedContent,
|
|
54
68
|
setDictionariesRecord,
|
|
55
69
|
getEditedContentValue,
|
|
56
70
|
open: openDictionaryEditionDrawer,
|
|
57
|
-
close
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
const useDictionaryEditionDrawerControl = () => {
|
|
61
|
-
const setFocusedContent = (0, import_design_system.useEditionPanelStore)((s) => s.setFocusedContent);
|
|
62
|
-
const open = ({
|
|
63
|
-
dictionaryId,
|
|
64
|
-
dictionaryPath,
|
|
65
|
-
keyPath = []
|
|
66
|
-
}) => {
|
|
67
|
-
setFocusedContent({
|
|
68
|
-
dictionaryId,
|
|
69
|
-
dictionaryPath,
|
|
70
|
-
keyPath
|
|
71
|
-
});
|
|
72
|
-
const id = getDrawerIdentifier(dictionaryId);
|
|
73
|
-
(0, import_design_system.useRightDrawerStore)(id).getState().open();
|
|
74
|
-
};
|
|
75
|
-
const close = (dictionaryId) => {
|
|
76
|
-
const id = getDrawerIdentifier(dictionaryId);
|
|
77
|
-
(0, import_design_system.useRightDrawerStore)(id).getState().close();
|
|
78
|
-
};
|
|
79
|
-
return {
|
|
80
|
-
open,
|
|
81
|
-
close
|
|
71
|
+
close: () => closeDrawer(id)
|
|
82
72
|
};
|
|
83
73
|
};
|
|
84
74
|
// Annotate the CommonJS export names for ESM import in node:
|
|
85
75
|
0 && (module.exports = {
|
|
86
76
|
getDrawerIdentifier,
|
|
87
|
-
useDictionaryEditionDrawer
|
|
88
|
-
useDictionaryEditionDrawerControl
|
|
77
|
+
useDictionaryEditionDrawer
|
|
89
78
|
});
|
|
90
79
|
//# sourceMappingURL=useDictionaryEditionDrawer.cjs.map
|
|
@@ -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';\n\nexport const getDrawerIdentifier = (dictionaryId: string) =>\n `dictionary_edition_${dictionaryId}`;\n\ntype DictionaryId = string;\ntype DictionaryPath = string;\n\nexport type FileContent = {\n dictionaryPath?: DictionaryPath;\n dictionaryId: string;\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<DictionaryId, Dictionary>\n ) => void;\n getEditedContentValue: (\n dictionaryId: DictionaryId,\n keyPath: KeyPath[]\n ) => DictionaryValue | undefined;\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 {
|
|
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 = (dictionaryId: string) =>\n `dictionary_edition_${dictionaryId}`;\n\ntype DictionaryId = string;\ntype DictionaryPath = string;\n\nexport type FileContent = {\n dictionaryPath?: DictionaryPath;\n dictionaryId: string;\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<DictionaryId, Dictionary>\n ) => void;\n getEditedContentValue: (\n dictionaryId: DictionaryId,\n keyPath: KeyPath[]\n ) => DictionaryValue | undefined;\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 { 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 dictionaryId,\n dictionaryPath,\n keyPath = [],\n }: OpenDictionaryEditionDrawerProps) => {\n setFocusedContent({\n dictionaryId,\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,iBAClC,sBAAsB,YAAY;AA+B7B,MAAM,6BAA6B,CACxC,iBAC4B;AAC5B,QAAM,KAAK,oBAAoB,YAAY;AAC3C,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,cAAAA;AAAA,MACA;AAAA,MACA,UAAU,CAAC;AAAA,IACb,MAAwC;AACtC,wBAAkB;AAAA,QAChB,cAAAA;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":["dictionaryId"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
"use client";
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -25,25 +26,46 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
25
26
|
var import_design_system = require("@intlayer/design-system");
|
|
26
27
|
var import_hooks = require("@intlayer/design-system/hooks");
|
|
27
28
|
var import_lucide_react = require("lucide-react");
|
|
28
|
-
var
|
|
29
|
-
var
|
|
29
|
+
var import_react = require("react");
|
|
30
|
+
var import_shallow = require("zustand/shallow");
|
|
31
|
+
var import_useDictionaryEditionDrawer = require('../DictionaryEditionDrawer/useDictionaryEditionDrawer.cjs');
|
|
32
|
+
var import_dictionaryListDrawerIdentifier = require('./dictionaryListDrawerIdentifier.cjs');
|
|
30
33
|
const DictionaryListDrawer = () => {
|
|
31
34
|
const { all: dictionaries } = (0, import_hooks.useGetAllDictionaries)();
|
|
32
|
-
const dictionaryKeyList =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
const dictionaryKeyList = (0, import_react.useMemo)(
|
|
36
|
+
() => Object.keys(dictionaries),
|
|
37
|
+
[dictionaries]
|
|
38
|
+
);
|
|
39
|
+
const { closeDrawer, openDrawer } = (0, import_design_system.useRightDrawerStore)(
|
|
40
|
+
(0, import_shallow.useShallow)((s) => ({
|
|
41
|
+
closeDrawer: s.close,
|
|
42
|
+
openDrawer: s.open
|
|
43
|
+
}))
|
|
44
|
+
);
|
|
45
|
+
const editedContent = (0, import_design_system.useEditedContentStore)(
|
|
46
|
+
(0, import_shallow.useShallow)((s) => s.editedContent)
|
|
47
|
+
);
|
|
48
|
+
const setFocusedContent = (0, import_design_system.useEditionPanelStore)(
|
|
49
|
+
(0, import_shallow.useShallow)((s) => s.setFocusedContent)
|
|
50
|
+
);
|
|
36
51
|
const handleClickDictionary = (dictionaryId) => {
|
|
52
|
+
closeDrawer(import_dictionaryListDrawerIdentifier.dictionaryListDrawerIdentifier);
|
|
37
53
|
const { filePath } = dictionaries[dictionaryId];
|
|
38
|
-
|
|
39
|
-
|
|
54
|
+
setFocusedContent({
|
|
55
|
+
dictionaryId,
|
|
56
|
+
dictionaryPath: filePath
|
|
57
|
+
});
|
|
58
|
+
openDrawer((0, import_useDictionaryEditionDrawer.getDrawerIdentifier)(dictionaryId));
|
|
40
59
|
};
|
|
41
|
-
const isDictionaryEdited = (
|
|
42
|
-
|
|
60
|
+
const isDictionaryEdited = (0, import_react.useCallback)(
|
|
61
|
+
(dictionaryId) => Object.keys(editedContent).includes(dictionaryId),
|
|
62
|
+
[editedContent]
|
|
63
|
+
);
|
|
64
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
43
65
|
import_design_system.RightDrawer,
|
|
44
66
|
{
|
|
45
67
|
title: "Dictionary list",
|
|
46
|
-
identifier:
|
|
68
|
+
identifier: import_dictionaryListDrawerIdentifier.dictionaryListDrawerIdentifier,
|
|
47
69
|
children: dictionaryKeyList.map((dictionaryId) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
48
70
|
import_design_system.Button,
|
|
49
71
|
{
|
|
@@ -58,7 +80,7 @@ const DictionaryListDrawer = () => {
|
|
|
58
80
|
}
|
|
59
81
|
) }, dictionaryId))
|
|
60
82
|
}
|
|
61
|
-
);
|
|
83
|
+
) });
|
|
62
84
|
};
|
|
63
85
|
// Annotate the CommonJS export names for ESM import in node:
|
|
64
86
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/DictionaryListDrawer/DictionaryListDrawer.tsx"],"sourcesContent":["
|
|
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 = (dictionaryId: string) => {\n closeDrawer(dictionaryListDrawerIdentifier);\n\n const { filePath } = dictionaries[dictionaryId];\n setFocusedContent({\n dictionaryId,\n dictionaryPath: filePath,\n });\n\n openDrawer(getDrawerIdentifier(dictionaryId));\n };\n\n const isDictionaryEdited = useCallback(\n (dictionaryId: string) => Object.keys(editedContent).includes(dictionaryId),\n [editedContent]\n );\n\n return (\n <>\n <RightDrawer\n title=\"Dictionary list\"\n identifier={dictionaryListDrawerIdentifier}\n >\n {dictionaryKeyList.map((dictionaryId) => (\n <div key={dictionaryId}>\n <Button\n label={`Open dictionary editor ${dictionaryId}`}\n onClick={() => handleClickDictionary(dictionaryId)}\n variant=\"hoverable\"\n color=\"text\"\n IconRight={ChevronRight}\n size=\"md\"\n isFullWidth\n >\n {isDictionaryEdited(dictionaryId)\n ? `✎ ${dictionaryId}`\n : dictionaryId}\n </Button>\n </div>\n ))}\n </RightDrawer>\n </>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwDI;AArDJ,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,iBAAyB;AACtD,gBAAY,oEAA8B;AAE1C,UAAM,EAAE,SAAS,IAAI,aAAa,YAAY;AAC9C,sBAAkB;AAAA,MAChB;AAAA,MACA,gBAAgB;AAAA,IAClB,CAAC;AAED,mBAAW,uDAAoB,YAAY,CAAC;AAAA,EAC9C;AAEA,QAAM,yBAAqB;AAAA,IACzB,CAAC,iBAAyB,OAAO,KAAK,aAAa,EAAE,SAAS,YAAY;AAAA,IAC1E,CAAC,aAAa;AAAA,EAChB;AAEA,SACE,2EACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAM;AAAA,MACN,YAAY;AAAA,MAEX,4BAAkB,IAAI,CAAC,iBACtB,4CAAC,SACC;AAAA,QAAC;AAAA;AAAA,UACC,OAAO,0BAA0B,YAAY;AAAA,UAC7C,SAAS,MAAM,sBAAsB,YAAY;AAAA,UACjD,SAAQ;AAAA,UACR,OAAM;AAAA,UACN,WAAW;AAAA,UACX,MAAK;AAAA,UACL,aAAW;AAAA,UAEV,6BAAmB,YAAY,IAC5B,UAAK,YAAY,KACjB;AAAA;AAAA,MACN,KAbQ,YAcV,CACD;AAAA;AAAA,EACH,GACF;AAEJ;","names":[]}
|
|
@@ -16,18 +16,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
21
|
-
dictionaryListDrawerIdentifier: () => dictionaryListDrawerIdentifier
|
|
22
|
-
useDictionaryListDrawer: () => useDictionaryListDrawer
|
|
19
|
+
var dictionaryListDrawerIdentifier_exports = {};
|
|
20
|
+
__export(dictionaryListDrawerIdentifier_exports, {
|
|
21
|
+
dictionaryListDrawerIdentifier: () => dictionaryListDrawerIdentifier
|
|
23
22
|
});
|
|
24
|
-
module.exports = __toCommonJS(
|
|
25
|
-
var import_design_system = require("@intlayer/design-system");
|
|
23
|
+
module.exports = __toCommonJS(dictionaryListDrawerIdentifier_exports);
|
|
26
24
|
const dictionaryListDrawerIdentifier = "dictionaryList";
|
|
27
|
-
const useDictionaryListDrawer = () => (0, import_design_system.useRightDrawerStore)(dictionaryListDrawerIdentifier)();
|
|
28
25
|
// Annotate the CommonJS export names for ESM import in node:
|
|
29
26
|
0 && (module.exports = {
|
|
30
|
-
dictionaryListDrawerIdentifier
|
|
31
|
-
useDictionaryListDrawer
|
|
27
|
+
dictionaryListDrawerIdentifier
|
|
32
28
|
});
|
|
33
|
-
//# sourceMappingURL=
|
|
29
|
+
//# sourceMappingURL=dictionaryListDrawerIdentifier.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/DictionaryListDrawer/dictionaryListDrawerIdentifier.ts"],"sourcesContent":["export const dictionaryListDrawerIdentifier = 'dictionaryList';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,iCAAiC;","names":[]}
|
|
@@ -16,10 +16,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
16
16
|
var DictionaryListDrawer_exports = {};
|
|
17
17
|
module.exports = __toCommonJS(DictionaryListDrawer_exports);
|
|
18
18
|
__reExport(DictionaryListDrawer_exports, require('./DictionaryListDrawer.cjs'), module.exports);
|
|
19
|
-
__reExport(DictionaryListDrawer_exports, require('./
|
|
19
|
+
__reExport(DictionaryListDrawer_exports, require('./dictionaryListDrawerIdentifier.cjs'), module.exports);
|
|
20
20
|
// Annotate the CommonJS export names for ESM import in node:
|
|
21
21
|
0 && (module.exports = {
|
|
22
22
|
...require('./DictionaryListDrawer.cjs'),
|
|
23
|
-
...require('./
|
|
23
|
+
...require('./dictionaryListDrawerIdentifier.cjs')
|
|
24
24
|
});
|
|
25
25
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/DictionaryListDrawer/index.ts"],"sourcesContent":["export * from './DictionaryListDrawer';\nexport * from './
|
|
1
|
+
{"version":3,"sources":["../../../src/DictionaryListDrawer/index.ts"],"sourcesContent":["export * from './DictionaryListDrawer';\nexport * from './dictionaryListDrawerIdentifier';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,yCAAc,mCAAd;AACA,yCAAc,6CADd;","names":[]}
|
|
@@ -5,7 +5,8 @@ import { ContentSelector } from "@intlayer/design-system";
|
|
|
5
5
|
import {
|
|
6
6
|
useCallback,
|
|
7
7
|
useEffect,
|
|
8
|
-
useState
|
|
8
|
+
useState,
|
|
9
|
+
useMemo
|
|
9
10
|
} from "react";
|
|
10
11
|
import { useIntlayerEditorContext } from './IntlayerEditorProvider.mjs';
|
|
11
12
|
import { useDictionaryEditionDrawer } from './DictionaryEditionDrawer/useDictionaryEditionDrawer.mjs';
|
|
@@ -27,7 +28,10 @@ const ContentSelectorWrapper = ({
|
|
|
27
28
|
}),
|
|
28
29
|
[dictionaryId, dictionaryPath, keyPath, open]
|
|
29
30
|
);
|
|
30
|
-
const isSelected = (
|
|
31
|
+
const isSelected = useMemo(
|
|
32
|
+
() => (isOpen && (focusedContent?.keyPath?.length ?? 0) > 0 && isSameKeyPath(focusedContent?.keyPath ?? [], keyPath)) ?? false,
|
|
33
|
+
[focusedContent, isOpen, keyPath]
|
|
34
|
+
);
|
|
31
35
|
useEffect(() => {
|
|
32
36
|
if (isEditorEnabled && editedValue && typeof editedValue === "string") {
|
|
33
37
|
setDisplayedChildren(editedValue);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ContentSelectorWrapper.tsx"],"sourcesContent":["'use client';\n\nimport { isSameKeyPath, type KeyPath } from '@intlayer/core';\nimport { ContentSelector } from '@intlayer/design-system';\nimport {\n useCallback,\n useEffect,\n useState,\n type FC,\n type ReactNode,\n} from 'react';\nimport { useIntlayerEditorContext } from './IntlayerEditorProvider';\nimport { useDictionaryEditionDrawer } from './DictionaryEditionDrawer/useDictionaryEditionDrawer';\n\ntype ContentSelectorWrapperProps = {\n children: ReactNode;\n dictionaryId: string;\n dictionaryPath: string;\n keyPath: KeyPath[];\n};\n\nexport const ContentSelectorWrapper: FC<ContentSelectorWrapperProps> = ({\n children,\n dictionaryId,\n dictionaryPath,\n keyPath,\n}) => {\n const { open, getEditedContentValue, focusedContent, isOpen } =\n useDictionaryEditionDrawer(dictionaryId);\n const editedValue = getEditedContentValue(dictionaryId, keyPath);\n const { isEditorEnabled } = useIntlayerEditorContext();\n const [displayedChildren, setDisplayedChildren] =\n useState<ReactNode>(children);\n\n const handleSelect = useCallback(\n () =>\n open({\n dictionaryId,\n dictionaryPath,\n keyPath,\n }),\n [dictionaryId, dictionaryPath, keyPath, open]\n );\n\n const isSelected
|
|
1
|
+
{"version":3,"sources":["../../src/ContentSelectorWrapper.tsx"],"sourcesContent":["'use client';\n\nimport { isSameKeyPath, type KeyPath } from '@intlayer/core';\nimport { ContentSelector } 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';\n\ntype ContentSelectorWrapperProps = {\n children: ReactNode;\n dictionaryId: string;\n dictionaryPath: string;\n keyPath: KeyPath[];\n};\n\nexport const ContentSelectorWrapper: FC<ContentSelectorWrapperProps> = ({\n children,\n dictionaryId,\n dictionaryPath,\n keyPath,\n}) => {\n const { open, getEditedContentValue, focusedContent, isOpen } =\n useDictionaryEditionDrawer(dictionaryId);\n const editedValue = getEditedContentValue(dictionaryId, keyPath);\n const { isEditorEnabled } = useIntlayerEditorContext();\n const [displayedChildren, setDisplayedChildren] =\n useState<ReactNode>(children);\n\n const handleSelect = useCallback(\n () =>\n open({\n dictionaryId,\n dictionaryPath,\n keyPath,\n }),\n [dictionaryId, 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 }\n }, [editedValue, isEditorEnabled]);\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":";AAkEI;AAhEJ,SAAS,qBAAmC;AAC5C,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP,SAAS,gCAAgC;AACzC,SAAS,kCAAkC;AASpC,MAAM,yBAA0D,CAAC;AAAA,EACtE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,MAAM,uBAAuB,gBAAgB,OAAO,IAC1D,2BAA2B,YAAY;AACzC,QAAM,cAAc,sBAAsB,cAAc,OAAO;AAC/D,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,cAAc,gBAAgB,SAAS,IAAI;AAAA,EAC9C;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;AAAA,EACF,GAAG,CAAC,aAAa,eAAe,CAAC;AAEjC,MAAI,CAAC,iBAAiB;AACpB,WAAO;AAAA,EACT;AAEA,SACE,oBAAC,mBAAgB,UAAU,cAAc,aAAa,YACnD,6BACH;AAEJ;","names":[]}
|
|
@@ -6,11 +6,14 @@ import {
|
|
|
6
6
|
LocaleSwitcher,
|
|
7
7
|
Modal,
|
|
8
8
|
useEditionPanelStore,
|
|
9
|
-
DictionaryFieldEditor
|
|
9
|
+
DictionaryFieldEditor,
|
|
10
|
+
useRightDrawerStore
|
|
10
11
|
} from "@intlayer/design-system";
|
|
11
12
|
import { useGetAllDictionaries } from "@intlayer/design-system/hooks";
|
|
12
13
|
import { useCallback, useEffect, useState } from "react";
|
|
13
|
-
import {
|
|
14
|
+
import { t } from "react-intlayer";
|
|
15
|
+
import { useShallow } from "zustand/shallow";
|
|
16
|
+
import { dictionaryListDrawerIdentifier } from '../DictionaryListDrawer/dictionaryListDrawerIdentifier.mjs';
|
|
14
17
|
import {
|
|
15
18
|
useDictionaryEditionDrawer,
|
|
16
19
|
getDrawerIdentifier
|
|
@@ -38,7 +41,11 @@ const DictionaryEditionDrawerContent = ({ locale, identifier, handleOnBack }) =>
|
|
|
38
41
|
isOpen: keyPathEditionModal !== null,
|
|
39
42
|
onClose: () => setKeyPathEditionModal(null),
|
|
40
43
|
hasCloseButton: true,
|
|
41
|
-
title:
|
|
44
|
+
title: t({
|
|
45
|
+
en: "Edit field",
|
|
46
|
+
fr: "Modifier le champ",
|
|
47
|
+
es: "Editar campo"
|
|
48
|
+
}),
|
|
42
49
|
size: "xl",
|
|
43
50
|
transparency: "lg",
|
|
44
51
|
children: dictionary && /* @__PURE__ */ jsx(
|
|
@@ -68,7 +75,9 @@ const DictionaryEditionDrawer = ({
|
|
|
68
75
|
}) => {
|
|
69
76
|
const id = getDrawerIdentifier(dictionaryId);
|
|
70
77
|
const { focusedContent, close } = useDictionaryEditionDrawer(dictionaryId);
|
|
71
|
-
const {
|
|
78
|
+
const { openDictionaryListDrawer } = useRightDrawerStore((s) => ({
|
|
79
|
+
openDictionaryListDrawer: () => s.open(dictionaryListDrawerIdentifier)
|
|
80
|
+
}));
|
|
72
81
|
const handleOnBack = () => {
|
|
73
82
|
close();
|
|
74
83
|
openDictionaryListDrawer();
|
|
@@ -88,7 +97,11 @@ const DictionaryEditionDrawer = ({
|
|
|
88
97
|
),
|
|
89
98
|
backButton: {
|
|
90
99
|
onBack: handleOnBack,
|
|
91
|
-
text:
|
|
100
|
+
text: t({
|
|
101
|
+
en: "Dictionary list",
|
|
102
|
+
fr: "Liste des dictionnaires",
|
|
103
|
+
es: "Lista de diccionarios"
|
|
104
|
+
})
|
|
92
105
|
},
|
|
93
106
|
children: focusedContent && /* @__PURE__ */ jsx(
|
|
94
107
|
DictionaryEditionDrawerContent,
|
|
@@ -103,7 +116,9 @@ const DictionaryEditionDrawer = ({
|
|
|
103
116
|
);
|
|
104
117
|
};
|
|
105
118
|
const DictionaryEditionDrawerController = ({ locale, localeList, setLocale }) => {
|
|
106
|
-
const focusedContent = useEditionPanelStore(
|
|
119
|
+
const focusedContent = useEditionPanelStore(
|
|
120
|
+
useShallow((s) => s.focusedContent)
|
|
121
|
+
);
|
|
107
122
|
const dictionaryId = focusedContent?.dictionaryId;
|
|
108
123
|
if (!dictionaryId) {
|
|
109
124
|
return /* @__PURE__ */ jsx(Fragment, {});
|
|
@@ -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} from '@intlayer/design-system';\nimport { useGetAllDictionaries } from '@intlayer/design-system/hooks';\nimport { useCallback, useEffect, useState, type FC } from 'react';\nimport {
|
|
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 } from 'react-intlayer';\nimport { useShallow } from 'zustand/shallow';\nimport { dictionaryListDrawerIdentifier } from '../DictionaryListDrawer/dictionaryListDrawerIdentifier';\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 dictionaryId = focusedContent?.dictionaryId;\n\n if (!dictionaryId) return <>No dictionary focused</>;\n\n const dictionary: Dictionary = dictionaries[dictionaryId];\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 />\n )}\n </Modal>\n <DictionaryEditor\n dictionary={dictionary}\n locale={locale}\n onClickEdit={setKeyPathEditionModal}\n />\n </>\n );\n};\n\ntype DictionaryEditionDrawerProps = DictionaryEditionDrawerControllerProps & {\n dictionaryId: string;\n};\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 { 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={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: t({\n en: 'Dictionary list',\n fr: 'Liste des dictionnaires',\n es: 'Lista de diccionarios',\n }),\n }}\n >\n {focusedContent && (\n <DictionaryEditionDrawerContent\n focusedContent={focusedContent}\n locale={locale}\n identifier={id}\n handleOnBack={handleOnBack}\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 dictionaryId: string | undefined = focusedContent?.dictionaryId;\n\n if (!dictionaryId) {\n return <></>;\n }\n\n return (\n <DictionaryEditionDrawer\n locale={locale}\n localeList={localeList}\n setLocale={setLocale}\n dictionaryId={dictionaryId}\n />\n );\n};\n"],"mappings":";AAsD4B,wBAKxB,YALwB;AAlD5B;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,SAAS;AAClB,SAAS,kBAAkB;AAC3B,SAAS,sCAAsC;AAC/C;AAAA,EAEE;AAAA,EACA;AAAA,OACK;AASA,MAAM,iCAET,CAAC,EAAE,QAAQ,YAAY,aAAa,MAAM;AAC5C,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,eAAe,gBAAgB;AAErC,MAAI,CAAC,aAAc,QAAO,gCAAE,mCAAqB;AAEjD,QAAM,aAAyB,aAAa,YAAY;AAExD,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;AAAA,QACF;AAAA;AAAA,IAEJ;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,aAAa;AAAA;AAAA,IACf;AAAA,KACF;AAEJ;AAMO,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,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,EAAE;AAAA,UACN,IAAI;AAAA,UACJ,IAAI;AAAA,UACJ,IAAI;AAAA,QACN,CAAC;AAAA,MACH;AAAA,MAEC,4BACC;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA,YAAY;AAAA,UACZ;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,eAAmC,gBAAgB;AAEzD,MAAI,CAAC,cAAc;AACjB,WAAO,gCAAE;AAAA,EACX;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -3,66 +3,56 @@ import {
|
|
|
3
3
|
useEditedContentStore,
|
|
4
4
|
useEditionPanelStore
|
|
5
5
|
} from "@intlayer/design-system";
|
|
6
|
+
import { useCallback } from "react";
|
|
7
|
+
import { useShallow } from "zustand/shallow";
|
|
6
8
|
const getDrawerIdentifier = (dictionaryId) => `dictionary_edition_${dictionaryId}`;
|
|
7
9
|
const useDictionaryEditionDrawer = (dictionaryId) => {
|
|
8
10
|
const id = getDrawerIdentifier(dictionaryId);
|
|
9
|
-
const {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
11
|
+
const { isOpenDrawer, openDrawer, closeDrawer } = useRightDrawerStore(
|
|
12
|
+
useShallow((e) => ({
|
|
13
|
+
isOpenDrawer: e.isOpen,
|
|
14
|
+
openDrawer: e.open,
|
|
15
|
+
closeDrawer: e.close
|
|
16
|
+
}))
|
|
17
|
+
);
|
|
18
|
+
const { setDictionariesRecord, getEditedContentValue } = useEditedContentStore(
|
|
19
|
+
useShallow((s) => ({
|
|
20
|
+
setDictionariesRecord: s.setDictionariesRecord,
|
|
21
|
+
getEditedContentValue: s.getEditedContentValue
|
|
22
|
+
}))
|
|
23
|
+
);
|
|
24
|
+
const { setFocusedContent, focusedContent } = useEditionPanelStore(
|
|
25
|
+
useShallow((s) => ({
|
|
26
|
+
focusedContent: s.focusedContent,
|
|
27
|
+
setFocusedContent: s.setFocusedContent
|
|
28
|
+
}))
|
|
29
|
+
);
|
|
30
|
+
const openDictionaryEditionDrawer = useCallback(
|
|
31
|
+
({
|
|
24
32
|
dictionaryId: dictionaryId2,
|
|
25
33
|
dictionaryPath,
|
|
26
|
-
keyPath
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
|
|
34
|
+
keyPath = []
|
|
35
|
+
}) => {
|
|
36
|
+
setFocusedContent({
|
|
37
|
+
dictionaryId: dictionaryId2,
|
|
38
|
+
dictionaryPath,
|
|
39
|
+
keyPath
|
|
40
|
+
});
|
|
41
|
+
openDrawer(id);
|
|
42
|
+
},
|
|
43
|
+
[openDrawer, setFocusedContent]
|
|
44
|
+
);
|
|
30
45
|
return {
|
|
31
|
-
isOpen,
|
|
46
|
+
isOpen: isOpenDrawer(id),
|
|
32
47
|
focusedContent,
|
|
33
48
|
setDictionariesRecord,
|
|
34
49
|
getEditedContentValue,
|
|
35
50
|
open: openDictionaryEditionDrawer,
|
|
36
|
-
close
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
const useDictionaryEditionDrawerControl = () => {
|
|
40
|
-
const setFocusedContent = useEditionPanelStore((s) => s.setFocusedContent);
|
|
41
|
-
const open = ({
|
|
42
|
-
dictionaryId,
|
|
43
|
-
dictionaryPath,
|
|
44
|
-
keyPath = []
|
|
45
|
-
}) => {
|
|
46
|
-
setFocusedContent({
|
|
47
|
-
dictionaryId,
|
|
48
|
-
dictionaryPath,
|
|
49
|
-
keyPath
|
|
50
|
-
});
|
|
51
|
-
const id = getDrawerIdentifier(dictionaryId);
|
|
52
|
-
useRightDrawerStore(id).getState().open();
|
|
53
|
-
};
|
|
54
|
-
const close = (dictionaryId) => {
|
|
55
|
-
const id = getDrawerIdentifier(dictionaryId);
|
|
56
|
-
useRightDrawerStore(id).getState().close();
|
|
57
|
-
};
|
|
58
|
-
return {
|
|
59
|
-
open,
|
|
60
|
-
close
|
|
51
|
+
close: () => closeDrawer(id)
|
|
61
52
|
};
|
|
62
53
|
};
|
|
63
54
|
export {
|
|
64
55
|
getDrawerIdentifier,
|
|
65
|
-
useDictionaryEditionDrawer
|
|
66
|
-
useDictionaryEditionDrawerControl
|
|
56
|
+
useDictionaryEditionDrawer
|
|
67
57
|
};
|
|
68
58
|
//# sourceMappingURL=useDictionaryEditionDrawer.mjs.map
|
|
@@ -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';\n\nexport const getDrawerIdentifier = (dictionaryId: string) =>\n `dictionary_edition_${dictionaryId}`;\n\ntype DictionaryId = string;\ntype DictionaryPath = string;\n\nexport type FileContent = {\n dictionaryPath?: DictionaryPath;\n dictionaryId: string;\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<DictionaryId, Dictionary>\n ) => void;\n getEditedContentValue: (\n dictionaryId: DictionaryId,\n keyPath: KeyPath[]\n ) => DictionaryValue | undefined;\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 {
|
|
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 = (dictionaryId: string) =>\n `dictionary_edition_${dictionaryId}`;\n\ntype DictionaryId = string;\ntype DictionaryPath = string;\n\nexport type FileContent = {\n dictionaryPath?: DictionaryPath;\n dictionaryId: string;\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<DictionaryId, Dictionary>\n ) => void;\n getEditedContentValue: (\n dictionaryId: DictionaryId,\n keyPath: KeyPath[]\n ) => DictionaryValue | undefined;\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 { 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 dictionaryId,\n dictionaryPath,\n keyPath = [],\n }: OpenDictionaryEditionDrawerProps) => {\n setFocusedContent({\n dictionaryId,\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,iBAClC,sBAAsB,YAAY;AA+B7B,MAAM,6BAA6B,CACxC,iBAC4B;AAC5B,QAAM,KAAK,oBAAoB,YAAY;AAC3C,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,cAAAA;AAAA,MACA;AAAA,MACA,UAAU,CAAC;AAAA,IACb,MAAwC;AACtC,wBAAkB;AAAA,QAChB,cAAAA;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":["dictionaryId"]}
|
|
@@ -1,29 +1,50 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
3
|
import {
|
|
3
4
|
RightDrawer,
|
|
4
5
|
Button,
|
|
5
|
-
useEditedContentStore
|
|
6
|
+
useEditedContentStore,
|
|
7
|
+
useEditionPanelStore,
|
|
8
|
+
useRightDrawerStore
|
|
6
9
|
} from "@intlayer/design-system";
|
|
7
10
|
import { useGetAllDictionaries } from "@intlayer/design-system/hooks";
|
|
8
11
|
import { ChevronRight } from "lucide-react";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} from './useDictionaryListDrawer.mjs';
|
|
12
|
+
import { useCallback, useMemo } from "react";
|
|
13
|
+
import { useShallow } from "zustand/shallow";
|
|
14
|
+
import { getDrawerIdentifier } from '../DictionaryEditionDrawer/useDictionaryEditionDrawer.mjs';
|
|
15
|
+
import { dictionaryListDrawerIdentifier } from './dictionaryListDrawerIdentifier.mjs';
|
|
14
16
|
const DictionaryListDrawer = () => {
|
|
15
17
|
const { all: dictionaries } = useGetAllDictionaries();
|
|
16
|
-
const dictionaryKeyList =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
const dictionaryKeyList = useMemo(
|
|
19
|
+
() => Object.keys(dictionaries),
|
|
20
|
+
[dictionaries]
|
|
21
|
+
);
|
|
22
|
+
const { closeDrawer, openDrawer } = useRightDrawerStore(
|
|
23
|
+
useShallow((s) => ({
|
|
24
|
+
closeDrawer: s.close,
|
|
25
|
+
openDrawer: s.open
|
|
26
|
+
}))
|
|
27
|
+
);
|
|
28
|
+
const editedContent = useEditedContentStore(
|
|
29
|
+
useShallow((s) => s.editedContent)
|
|
30
|
+
);
|
|
31
|
+
const setFocusedContent = useEditionPanelStore(
|
|
32
|
+
useShallow((s) => s.setFocusedContent)
|
|
33
|
+
);
|
|
20
34
|
const handleClickDictionary = (dictionaryId) => {
|
|
35
|
+
closeDrawer(dictionaryListDrawerIdentifier);
|
|
21
36
|
const { filePath } = dictionaries[dictionaryId];
|
|
22
|
-
|
|
23
|
-
|
|
37
|
+
setFocusedContent({
|
|
38
|
+
dictionaryId,
|
|
39
|
+
dictionaryPath: filePath
|
|
40
|
+
});
|
|
41
|
+
openDrawer(getDrawerIdentifier(dictionaryId));
|
|
24
42
|
};
|
|
25
|
-
const isDictionaryEdited = (
|
|
26
|
-
|
|
43
|
+
const isDictionaryEdited = useCallback(
|
|
44
|
+
(dictionaryId) => Object.keys(editedContent).includes(dictionaryId),
|
|
45
|
+
[editedContent]
|
|
46
|
+
);
|
|
47
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
27
48
|
RightDrawer,
|
|
28
49
|
{
|
|
29
50
|
title: "Dictionary list",
|
|
@@ -42,7 +63,7 @@ const DictionaryListDrawer = () => {
|
|
|
42
63
|
}
|
|
43
64
|
) }, dictionaryId))
|
|
44
65
|
}
|
|
45
|
-
);
|
|
66
|
+
) });
|
|
46
67
|
};
|
|
47
68
|
export {
|
|
48
69
|
DictionaryListDrawer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/DictionaryListDrawer/DictionaryListDrawer.tsx"],"sourcesContent":["
|
|
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 = (dictionaryId: string) => {\n closeDrawer(dictionaryListDrawerIdentifier);\n\n const { filePath } = dictionaries[dictionaryId];\n setFocusedContent({\n dictionaryId,\n dictionaryPath: filePath,\n });\n\n openDrawer(getDrawerIdentifier(dictionaryId));\n };\n\n const isDictionaryEdited = useCallback(\n (dictionaryId: string) => Object.keys(editedContent).includes(dictionaryId),\n [editedContent]\n );\n\n return (\n <>\n <RightDrawer\n title=\"Dictionary list\"\n identifier={dictionaryListDrawerIdentifier}\n >\n {dictionaryKeyList.map((dictionaryId) => (\n <div key={dictionaryId}>\n <Button\n label={`Open dictionary editor ${dictionaryId}`}\n onClick={() => handleClickDictionary(dictionaryId)}\n variant=\"hoverable\"\n color=\"text\"\n IconRight={ChevronRight}\n size=\"md\"\n isFullWidth\n >\n {isDictionaryEdited(dictionaryId)\n ? `✎ ${dictionaryId}`\n : dictionaryId}\n </Button>\n </div>\n ))}\n </RightDrawer>\n </>\n );\n};\n"],"mappings":";AAwDI,mBAOQ,WAPR;AArDJ;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,iBAAyB;AACtD,gBAAY,8BAA8B;AAE1C,UAAM,EAAE,SAAS,IAAI,aAAa,YAAY;AAC9C,sBAAkB;AAAA,MAChB;AAAA,MACA,gBAAgB;AAAA,IAClB,CAAC;AAED,eAAW,oBAAoB,YAAY,CAAC;AAAA,EAC9C;AAEA,QAAM,qBAAqB;AAAA,IACzB,CAAC,iBAAyB,OAAO,KAAK,aAAa,EAAE,SAAS,YAAY;AAAA,IAC1E,CAAC,aAAa;AAAA,EAChB;AAEA,SACE,gCACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAM;AAAA,MACN,YAAY;AAAA,MAEX,4BAAkB,IAAI,CAAC,iBACtB,oBAAC,SACC;AAAA,QAAC;AAAA;AAAA,UACC,OAAO,0BAA0B,YAAY;AAAA,UAC7C,SAAS,MAAM,sBAAsB,YAAY;AAAA,UACjD,SAAQ;AAAA,UACR,OAAM;AAAA,UACN,WAAW;AAAA,UACX,MAAK;AAAA,UACL,aAAW;AAAA,UAEV,6BAAmB,YAAY,IAC5B,UAAK,YAAY,KACjB;AAAA;AAAA,MACN,KAbQ,YAcV,CACD;AAAA;AAAA,EACH,GACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/DictionaryListDrawer/dictionaryListDrawerIdentifier.ts"],"sourcesContent":["export const dictionaryListDrawerIdentifier = 'dictionaryList';\n"],"mappings":"AAAO,MAAM,iCAAiC;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/DictionaryListDrawer/index.ts"],"sourcesContent":["export * from './DictionaryListDrawer';\nexport * from './
|
|
1
|
+
{"version":3,"sources":["../../../src/DictionaryListDrawer/index.ts"],"sourcesContent":["export * from './DictionaryListDrawer';\nexport * from './dictionaryListDrawerIdentifier';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","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;AAE7D,OAAO,
|
|
1
|
+
{"version":3,"file":"ContentSelectorWrapper.d.ts","sourceRoot":"","sources":["../../src/ContentSelectorWrapper.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAiB,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,EAKL,KAAK,EAAE,EACP,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,KAAK,2BAA2B,GAAG;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,OAAO,EAAE,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,2BAA2B,CAgDlE,CAAC"}
|
|
@@ -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;
|
|
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;AAIlE,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;CAC1B,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,EAAE,CAC7C,mCAAmC,CAsDpC,CAAC;AAEF,KAAK,4BAA4B,GAAG,sCAAsC,GAAG;IAC3E,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,EAAE,CAAC,4BAA4B,CAgDpE,CAAC;AAEF,KAAK,sCAAsC,GAAG;IAC5C,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,OAAO,EAAE,CAAC;IACtB,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CACtC,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,EAAE,CAChD,sCAAsC,CAmBvC,CAAC"}
|
|
@@ -16,10 +16,5 @@ type DictionaryEditionDrawer = {
|
|
|
16
16
|
getEditedContentValue: (dictionaryId: DictionaryId, keyPath: KeyPath[]) => DictionaryValue | undefined;
|
|
17
17
|
};
|
|
18
18
|
export declare const useDictionaryEditionDrawer: (dictionaryId: string) => DictionaryEditionDrawer;
|
|
19
|
-
type DictionaryEditionDrawerControl = {
|
|
20
|
-
open: (content: FileContent) => void;
|
|
21
|
-
close: (dictionaryId: string) => void;
|
|
22
|
-
};
|
|
23
|
-
export declare const useDictionaryEditionDrawerControl: () => DictionaryEditionDrawerControl;
|
|
24
19
|
export {};
|
|
25
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;
|
|
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,iBAAkB,MAAM,WAClB,CAAC;AAEvC,KAAK,YAAY,GAAG,MAAM,CAAC;AAC3B,KAAK,cAAc,GAAG,MAAM,CAAC;AAE7B,MAAM,MAAM,WAAW,GAAG;IACxB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,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,YAAY,EAAE,UAAU,CAAC,KACjD,IAAI,CAAC;IACV,qBAAqB,EAAE,CACrB,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,OAAO,EAAE,KACf,eAAe,GAAG,SAAS,CAAC;CAClC,CAAC;AAQF,eAAO,MAAM,0BAA0B,iBACvB,MAAM,KACnB,uBAgDF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryListDrawer.d.ts","sourceRoot":"","sources":["../../../src/DictionaryListDrawer/DictionaryListDrawer.tsx"],"names":[],"mappings":"
|
|
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,EAgElC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dictionaryListDrawerIdentifier.d.ts","sourceRoot":"","sources":["../../../src/DictionaryListDrawer/dictionaryListDrawerIdentifier.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,8BAA8B,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/DictionaryListDrawer/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/DictionaryListDrawer/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,kCAAkC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "intlayer-editor",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "IntLayer Editor is a tool that allow you to edit your IntLayer declaration files using a graphical interface.",
|
|
6
6
|
"keywords": [
|
|
@@ -69,14 +69,14 @@
|
|
|
69
69
|
"body-parser": "^1.20.3",
|
|
70
70
|
"commander": "^12.1.0",
|
|
71
71
|
"express": "^4.21.1",
|
|
72
|
-
"lucide-react": "^0.
|
|
72
|
+
"lucide-react": "^0.468.0",
|
|
73
73
|
"magic-regexp": "^0.8.0",
|
|
74
74
|
"react": "^18.3.1",
|
|
75
75
|
"react-dom": "^18.3.1",
|
|
76
76
|
"zustand": "^5.0.1",
|
|
77
|
-
"@intlayer/
|
|
78
|
-
"@intlayer/
|
|
79
|
-
"@intlayer/design-system": "^3.
|
|
77
|
+
"@intlayer/config": "^3.4.6",
|
|
78
|
+
"@intlayer/core": "^3.4.6",
|
|
79
|
+
"@intlayer/design-system": "^3.4.6"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
82
|
"@babel/generator": "7.26.2",
|
|
@@ -103,10 +103,10 @@
|
|
|
103
103
|
"@utils/tsup-config": "^1.0.4"
|
|
104
104
|
},
|
|
105
105
|
"peerDependencies": {
|
|
106
|
-
"@intlayer/config": "^3.
|
|
107
|
-
"@intlayer/
|
|
108
|
-
"@intlayer/
|
|
109
|
-
"react-intlayer": "^3.
|
|
106
|
+
"@intlayer/config": "^3.4.6",
|
|
107
|
+
"@intlayer/core": "^3.4.6",
|
|
108
|
+
"@intlayer/design-system": "^3.4.6",
|
|
109
|
+
"react-intlayer": "^3.4.6"
|
|
110
110
|
},
|
|
111
111
|
"engines": {
|
|
112
112
|
"node": ">=14.18"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAoC;AAE7B,MAAM,iCAAiC;AAEvC,MAAM,0BAA0B,UACrC,0CAAoB,8BAA8B,EAAE;","names":[]}
|
|
@@ -1,8 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionaryListDrawer.d.ts","sourceRoot":"","sources":["../../../src/DictionaryListDrawer/useDictionaryListDrawer.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,8BAA8B,mBAAmB,CAAC;AAE/D,eAAO,MAAM,uBAAuB;;;;CACmB,CAAC"}
|