intlayer-editor 3.0.3 → 3.2.0

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.
Files changed (67) hide show
  1. package/README.md +46 -24
  2. package/dist/cjs/ContentSelectorWrapper.cjs +5 -5
  3. package/dist/cjs/ContentSelectorWrapper.cjs.map +1 -1
  4. package/dist/cjs/DictionaryEditionDrawer/DictionaryEditionDrawer.cjs +16 -18
  5. package/dist/cjs/DictionaryEditionDrawer/DictionaryEditionDrawer.cjs.map +1 -1
  6. package/dist/cjs/DictionaryEditionDrawer/index.cjs.map +1 -1
  7. package/dist/cjs/DictionaryEditionDrawer/useDictionaryEditionDrawer.cjs +4 -20
  8. package/dist/cjs/DictionaryEditionDrawer/useDictionaryEditionDrawer.cjs.map +1 -1
  9. package/dist/cjs/DictionaryListDrawer/DictionaryListDrawer.cjs.map +1 -1
  10. package/dist/cjs/DictionaryListDrawer/index.cjs.map +1 -1
  11. package/dist/cjs/DictionaryListDrawer/useDictionaryListDrawer.cjs.map +1 -1
  12. package/dist/cjs/IntlayerEditorProvider.cjs +92 -0
  13. package/dist/cjs/IntlayerEditorProvider.cjs.map +1 -0
  14. package/dist/cjs/index.cjs +6 -12
  15. package/dist/cjs/index.cjs.map +1 -1
  16. package/dist/esm/ContentSelectorWrapper.mjs +5 -6
  17. package/dist/esm/ContentSelectorWrapper.mjs.map +1 -1
  18. package/dist/esm/DictionaryEditionDrawer/DictionaryEditionDrawer.mjs +17 -19
  19. package/dist/esm/DictionaryEditionDrawer/DictionaryEditionDrawer.mjs.map +1 -1
  20. package/dist/esm/DictionaryEditionDrawer/index.mjs.map +1 -1
  21. package/dist/esm/DictionaryEditionDrawer/useDictionaryEditionDrawer.mjs +4 -20
  22. package/dist/esm/DictionaryEditionDrawer/useDictionaryEditionDrawer.mjs.map +1 -1
  23. package/dist/esm/DictionaryListDrawer/DictionaryListDrawer.mjs.map +1 -1
  24. package/dist/esm/DictionaryListDrawer/index.mjs.map +1 -1
  25. package/dist/esm/DictionaryListDrawer/useDictionaryListDrawer.mjs.map +1 -1
  26. package/dist/esm/IntlayerEditorProvider.mjs +71 -0
  27. package/dist/esm/IntlayerEditorProvider.mjs.map +1 -0
  28. package/dist/esm/index.mjs +1 -4
  29. package/dist/esm/index.mjs.map +1 -1
  30. package/dist/types/ContentSelectorWrapper.d.ts.map +1 -1
  31. package/dist/types/DictionaryEditionDrawer/DictionaryEditionDrawer.d.ts +1 -0
  32. package/dist/types/DictionaryEditionDrawer/DictionaryEditionDrawer.d.ts.map +1 -1
  33. package/dist/types/DictionaryEditionDrawer/index.d.ts.map +1 -1
  34. package/dist/types/DictionaryEditionDrawer/useDictionaryEditionDrawer.d.ts +0 -6
  35. package/dist/types/DictionaryEditionDrawer/useDictionaryEditionDrawer.d.ts.map +1 -1
  36. package/dist/types/DictionaryListDrawer/DictionaryListDrawer.d.ts.map +1 -1
  37. package/dist/types/DictionaryListDrawer/index.d.ts.map +1 -1
  38. package/dist/types/DictionaryListDrawer/useDictionaryListDrawer.d.ts.map +1 -1
  39. package/dist/types/{ContentEditorProvider.d.ts → IntlayerEditorProvider.d.ts} +4 -4
  40. package/dist/types/IntlayerEditorProvider.d.ts.map +1 -0
  41. package/dist/types/index.d.ts +1 -4
  42. package/dist/types/index.d.ts.map +1 -1
  43. package/package.json +30 -29
  44. package/bin/start-server.js +0 -16
  45. package/dist/cjs/ContentEditionLayout.cjs +0 -54
  46. package/dist/cjs/ContentEditionLayout.cjs.map +0 -1
  47. package/dist/cjs/ContentEditorProvider.cjs +0 -55
  48. package/dist/cjs/ContentEditorProvider.cjs.map +0 -1
  49. package/dist/cjs/renderContentEditor.cjs +0 -54
  50. package/dist/cjs/renderContentEditor.cjs.map +0 -1
  51. package/dist/cjs/useEditorServer.cjs +0 -56
  52. package/dist/cjs/useEditorServer.cjs.map +0 -1
  53. package/dist/esm/ContentEditionLayout.mjs +0 -30
  54. package/dist/esm/ContentEditionLayout.mjs.map +0 -1
  55. package/dist/esm/ContentEditorProvider.mjs +0 -33
  56. package/dist/esm/ContentEditorProvider.mjs.map +0 -1
  57. package/dist/esm/renderContentEditor.mjs +0 -30
  58. package/dist/esm/renderContentEditor.mjs.map +0 -1
  59. package/dist/esm/useEditorServer.mjs +0 -32
  60. package/dist/esm/useEditorServer.mjs.map +0 -1
  61. package/dist/types/ContentEditionLayout.d.ts +0 -11
  62. package/dist/types/ContentEditionLayout.d.ts.map +0 -1
  63. package/dist/types/ContentEditorProvider.d.ts.map +0 -1
  64. package/dist/types/renderContentEditor.d.ts +0 -14
  65. package/dist/types/renderContentEditor.d.ts.map +0 -1
  66. package/dist/types/useEditorServer.d.ts +0 -4
  67. package/dist/types/useEditorServer.d.ts.map +0 -1
@@ -9,24 +9,20 @@ import {
9
9
  DictionaryFieldEditor
10
10
  } from "@intlayer/design-system";
11
11
  import { useGetAllDictionaries } from "@intlayer/design-system/hooks";
12
- import { useEffect, useState } from "react";
12
+ import { useCallback, useEffect, useState } from "react";
13
13
  import { useDictionaryListDrawer } from '../DictionaryListDrawer/useDictionaryListDrawer.mjs';
14
14
  import {
15
15
  useDictionaryEditionDrawer,
16
16
  getDrawerIdentifier
17
17
  } from './useDictionaryEditionDrawer.mjs';
18
- const DictionaryEditionDrawerContent = ({ locale, identifier }) => {
18
+ const DictionaryEditionDrawerContent = ({ locale, identifier, handleOnBack }) => {
19
19
  const [keyPathEditionModal, setKeyPathEditionModal] = useState(null);
20
- const {
21
- setFocusedContent,
22
- setDictionariesRecord,
23
- editContentRequest,
24
- editedContent,
25
- focusedContent,
26
- addEditedContent,
27
- clearEditedDictionaryContent
28
- } = useDictionaryEditionDrawer(identifier);
20
+ const { setDictionariesRecord, focusedContent } = useDictionaryEditionDrawer(identifier);
29
21
  const { all: dictionaries } = useGetAllDictionaries();
22
+ const onClickDictionaryList = useCallback(() => {
23
+ setKeyPathEditionModal(null);
24
+ handleOnBack();
25
+ }, [handleOnBack]);
30
26
  useEffect(() => {
31
27
  if (dictionaries) {
32
28
  setDictionariesRecord(dictionaries);
@@ -44,7 +40,14 @@ const DictionaryEditionDrawerContent = ({ locale, identifier }) => {
44
40
  hasCloseButton: true,
45
41
  title: "Edit field",
46
42
  size: "xl",
47
- children: dictionary && /* @__PURE__ */ jsx(DictionaryFieldEditor, { dictionary })
43
+ transparency: "lg",
44
+ children: dictionary && /* @__PURE__ */ jsx(
45
+ DictionaryFieldEditor,
46
+ {
47
+ dictionary,
48
+ onClickDictionaryList
49
+ }
50
+ )
48
51
  }
49
52
  ),
50
53
  /* @__PURE__ */ jsx(
@@ -52,12 +55,6 @@ const DictionaryEditionDrawerContent = ({ locale, identifier }) => {
52
55
  {
53
56
  dictionary,
54
57
  locale,
55
- focusedKeyPath: focusedContent.keyPath,
56
- editedContent: editedContent[dictionaryId],
57
- onFocusKeyPath: (keyPath) => setFocusedContent({ ...focusedContent, keyPath }),
58
- onContentChange: (keyPath, newValue) => addEditedContent(dictionaryId, newValue, keyPath),
59
- onValidEdition: editContentRequest,
60
- onCancelEdition: () => clearEditedDictionaryContent(dictionaryId),
61
58
  onClickEdit: setKeyPathEditionModal
62
59
  }
63
60
  )
@@ -98,7 +95,8 @@ const DictionaryEditionDrawer = ({
98
95
  {
99
96
  focusedContent,
100
97
  locale,
101
- identifier: id
98
+ identifier: id,
99
+ handleOnBack
102
100
  }
103
101
  )
104
102
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/DictionaryEditionDrawer/DictionaryEditionDrawer.tsx"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport type { Dictionary, 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 { useEffect, useState, type FC } from 'react';\nimport { useDictionaryListDrawer } from '../DictionaryListDrawer/useDictionaryListDrawer';\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};\n\nexport const DictionaryEditionDrawerContent: FC<\n DictionaryEditionDrawerContentProps\n> = ({ locale, identifier }) => {\n const [keyPathEditionModal, setKeyPathEditionModal] = useState<\n KeyPath[] | null\n >(null);\n const {\n setFocusedContent,\n setDictionariesRecord,\n editContentRequest,\n editedContent,\n focusedContent,\n addEditedContent,\n clearEditedDictionaryContent,\n } = useDictionaryEditionDrawer(identifier);\n const { all: dictionaries } = useGetAllDictionaries();\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=\"Edit field\"\n size=\"xl\"\n >\n {dictionary && <DictionaryFieldEditor dictionary={dictionary} />}\n </Modal>\n <DictionaryEditor\n dictionary={dictionary}\n locale={locale}\n focusedKeyPath={focusedContent.keyPath}\n editedContent={editedContent[dictionaryId]}\n onFocusKeyPath={(keyPath) =>\n setFocusedContent({ ...focusedContent, keyPath })\n }\n onContentChange={(keyPath, newValue) =>\n addEditedContent(dictionaryId, newValue, keyPath)\n }\n onValidEdition={editContentRequest}\n onCancelEdition={() => clearEditedDictionaryContent(dictionaryId)}\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 { open: openDictionaryListDrawer } = useDictionaryListDrawer();\n\n const handleOnBack = () => {\n close();\n openDictionaryListDrawer();\n };\n\n return (\n <RightDrawer\n title={dictionaryId}\n identifier={id}\n header={\n <LocaleSwitcher\n setLocale={setLocale}\n locale={locale}\n localeList={localeList}\n />\n }\n backButton={{\n onBack: handleOnBack,\n text: 'Dictionary list',\n }}\n >\n {focusedContent && (\n <DictionaryEditionDrawerContent\n focusedContent={focusedContent}\n locale={locale}\n identifier={id}\n />\n )}\n </RightDrawer>\n );\n};\n\ntype DictionaryEditionDrawerControllerProps = {\n locale: Locales;\n localeList: Locales[];\n setLocale: (locale: Locales) => void;\n};\n\nexport const DictionaryEditionDrawerController: FC<\n DictionaryEditionDrawerControllerProps\n> = ({ locale, localeList, setLocale }) => {\n const focusedContent = useEditionPanelStore((s) => s.focusedContent);\n const dictionaryId: string | undefined = focusedContent?.dictionaryId;\n\n if (!dictionaryId) {\n return <></>;\n }\n\n return (\n <DictionaryEditionDrawer\n locale={locale}\n localeList={localeList}\n setLocale={setLocale}\n dictionaryId={dictionaryId}\n />\n );\n};\n"],"mappings":";AAoD4B,wBAKxB,YALwB;AAhD5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,6BAA6B;AACtC,SAAS,WAAW,gBAAyB;AAC7C,SAAS,+BAA+B;AACxC;AAAA,EAEE;AAAA,EACA;AAAA,OACK;AAQA,MAAM,iCAET,CAAC,EAAE,QAAQ,WAAW,MAAM;AAC9B,QAAM,CAAC,qBAAqB,sBAAsB,IAAI,SAEpD,IAAI;AACN,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,2BAA2B,UAAU;AACzC,QAAM,EAAE,KAAK,aAAa,IAAI,sBAAsB;AAEpD,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,OAAM;AAAA,QACN,MAAK;AAAA,QAEJ,wBAAc,oBAAC,yBAAsB,YAAwB;AAAA;AAAA,IAChE;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,gBAAgB,eAAe;AAAA,QAC/B,eAAe,cAAc,YAAY;AAAA,QACzC,gBAAgB,CAAC,YACf,kBAAkB,EAAE,GAAG,gBAAgB,QAAQ,CAAC;AAAA,QAElD,iBAAiB,CAAC,SAAS,aACzB,iBAAiB,cAAc,UAAU,OAAO;AAAA,QAElD,gBAAgB;AAAA,QAChB,iBAAiB,MAAM,6BAA6B,YAAY;AAAA,QAChE,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,MAAM,yBAAyB,IAAI,wBAAwB;AAEnE,QAAM,eAAe,MAAM;AACzB,UAAM;AACN,6BAAyB;AAAA,EAC3B;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,MACP,YAAY;AAAA,MACZ,QACE;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACF;AAAA,MAEF,YAAY;AAAA,QACV,QAAQ;AAAA,QACR,MAAM;AAAA,MACR;AAAA,MAEC,4BACC;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA,YAAY;AAAA;AAAA,MACd;AAAA;AAAA,EAEJ;AAEJ;AAQO,MAAM,oCAET,CAAC,EAAE,QAAQ,YAAY,UAAU,MAAM;AACzC,QAAM,iBAAiB,qBAAqB,CAAC,MAAM,EAAE,cAAc;AACnE,QAAM,eAAmC,gBAAgB;AAEzD,MAAI,CAAC,cAAc;AACjB,WAAO,gCAAE;AAAA,EACX;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;","names":[]}
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 { useDictionaryListDrawer } from '../DictionaryListDrawer/useDictionaryListDrawer';\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=\"Edit field\"\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 { 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 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((s) => s.focusedContent);\n const dictionaryId: string | undefined = focusedContent?.dictionaryId;\n\n if (!dictionaryId) {\n return <></>;\n }\n\n return (\n <DictionaryEditionDrawer\n locale={locale}\n localeList={localeList}\n setLocale={setLocale}\n dictionaryId={dictionaryId}\n />\n );\n};\n"],"mappings":";AAmD4B,wBAKxB,YALwB;AA/C5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,6BAA6B;AACtC,SAAS,aAAa,WAAW,gBAAyB;AAC1D,SAAS,+BAA+B;AACxC;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,OAAM;AAAA,QACN,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,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,UACZ;AAAA;AAAA,MACF;AAAA;AAAA,EAEJ;AAEJ;AAQO,MAAM,oCAET,CAAC,EAAE,QAAQ,YAAY,UAAU,MAAM;AACzC,QAAM,iBAAiB,qBAAqB,CAAC,MAAM,EAAE,cAAc;AACnE,QAAM,eAAmC,gBAAgB;AAEzD,MAAI,CAAC,cAAc;AACjB,WAAO,gCAAE;AAAA,EACX;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/DictionaryEditionDrawer/index.ts"],"sourcesContent":["export * from './DictionaryEditionDrawer';\nexport * from './useDictionaryEditionDrawer';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../src/DictionaryEditionDrawer/index.ts"],"sourcesContent":["export * from './DictionaryEditionDrawer';\nexport * from './useDictionaryEditionDrawer';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
@@ -3,29 +3,18 @@ import {
3
3
  useEditedContentStore,
4
4
  useEditionPanelStore
5
5
  } from "@intlayer/design-system";
6
- import { useEditorServer } from '../useEditorServer.mjs';
7
6
  const getDrawerIdentifier = (dictionaryId) => `dictionary_edition_${dictionaryId}`;
8
7
  const useDictionaryEditionDrawer = (dictionaryId) => {
9
8
  const id = getDrawerIdentifier(dictionaryId);
10
9
  const { isOpen, open, close } = useRightDrawerStore(id)();
11
- const {
12
- editedContent,
13
- setDictionariesRecord,
14
- getEditedContentValue,
15
- addEditedContent,
16
- clearEditedDictionaryContent
17
- } = useEditedContentStore((s) => ({
18
- editedContent: s.editedContent,
10
+ const { setDictionariesRecord, getEditedContentValue } = useEditedContentStore((s) => ({
19
11
  setDictionariesRecord: s.setDictionariesRecord,
20
- addEditedContent: s.addEditedContent,
21
- getEditedContentValue: s.getEditedContentValue,
22
- clearEditedDictionaryContent: s.clearEditedDictionaryContent
12
+ getEditedContentValue: s.getEditedContentValue
23
13
  }));
24
14
  const { setFocusedContent, focusedContent } = useEditionPanelStore((s) => ({
25
15
  focusedContent: s.focusedContent,
26
16
  setFocusedContent: s.setFocusedContent
27
17
  }));
28
- const { editContentRequest } = useEditorServer();
29
18
  const openDictionaryEditionDrawer = ({
30
19
  dictionaryId: dictionaryId2,
31
20
  dictionaryPath,
@@ -41,15 +30,10 @@ const useDictionaryEditionDrawer = (dictionaryId) => {
41
30
  return {
42
31
  isOpen,
43
32
  focusedContent,
44
- setFocusedContent,
45
33
  setDictionariesRecord,
46
- open: openDictionaryEditionDrawer,
47
- close,
48
34
  getEditedContentValue,
49
- editContentRequest,
50
- editedContent,
51
- addEditedContent,
52
- clearEditedDictionaryContent
35
+ open: openDictionaryEditionDrawer,
36
+ close
53
37
  };
54
38
  };
55
39
  const useDictionaryEditionDrawerControl = () => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/DictionaryEditionDrawer/useDictionaryEditionDrawer.ts"],"sourcesContent":["import type { Dictionary, DictionaryValue, KeyPath } from '@intlayer/core';\nimport {\n useRightDrawerStore,\n useEditedContentStore,\n useEditionPanelStore,\n type DictionaryContent,\n} from '@intlayer/design-system';\nimport { useEditorServer } from '../useEditorServer';\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 setFocusedContent: (content: FileContent | null) => void;\n isOpen: boolean;\n open: (content: FileContent) => void;\n close: () => void;\n editContentRequest: () => Promise<void>;\n editedContent: DictionaryContent;\n addEditedContent: (\n dictionaryId: DictionaryId,\n newValue: DictionaryValue,\n keyPath: KeyPath[]\n ) => void;\n setDictionariesRecord: (\n dictionariesRecord: Record<DictionaryId, Dictionary>\n ) => void;\n getEditedContentValue: (\n dictionaryId: DictionaryId,\n keyPath: KeyPath[]\n ) => DictionaryValue | 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 setDictionariesRecord,\n getEditedContentValue,\n addEditedContent,\n clearEditedDictionaryContent,\n } = useEditedContentStore((s) => ({\n editedContent: s.editedContent,\n setDictionariesRecord: s.setDictionariesRecord,\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 setDictionariesRecord,\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;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,uBAAuB;AAEzB,MAAM,sBAAsB,CAAC,iBAClC,sBAAsB,YAAY;AAwC7B,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,IACA;AAAA,EACF,IAAI,sBAAsB,CAAC,OAAO;AAAA,IAChC,eAAe,EAAE;AAAA,IACjB,uBAAuB,EAAE;AAAA,IACzB,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;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"]}
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 { isOpen, open, close } = useRightDrawerStore(id)();\n const { setDictionariesRecord, getEditedContentValue } =\n useEditedContentStore((s) => ({\n setDictionariesRecord: s.setDictionariesRecord,\n getEditedContentValue: s.getEditedContentValue,\n }));\n const { setFocusedContent, focusedContent } = useEditionPanelStore((s) => ({\n focusedContent: s.focusedContent,\n setFocusedContent: s.setFocusedContent,\n }));\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 setDictionariesRecord,\n getEditedContentValue,\n open: openDictionaryEditionDrawer,\n close,\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;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEA,MAAM,sBAAsB,CAAC,iBAClC,sBAAsB,YAAY;AA+B7B,MAAM,6BAA6B,CACxC,iBAC4B;AAC5B,QAAM,KAAK,oBAAoB,YAAY;AAC3C,QAAM,EAAE,QAAQ,MAAM,MAAM,IAAI,oBAAoB,EAAE,EAAE;AACxD,QAAM,EAAE,uBAAuB,sBAAsB,IACnD,sBAAsB,CAAC,OAAO;AAAA,IAC5B,uBAAuB,EAAE;AAAA,IACzB,uBAAuB,EAAE;AAAA,EAC3B,EAAE;AACJ,QAAM,EAAE,mBAAmB,eAAe,IAAI,qBAAqB,CAAC,OAAO;AAAA,IACzE,gBAAgB,EAAE;AAAA,IAClB,mBAAmB,EAAE;AAAA,EACvB,EAAE;AAEF,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;AAAA,IACA,MAAM;AAAA,IACN;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"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/DictionaryListDrawer/DictionaryListDrawer.tsx"],"sourcesContent":["import type { Locales } from '@intlayer/config/client';\nimport {\n RightDrawer,\n Button,\n useEditedContentStore,\n} from '@intlayer/design-system';\nimport { useGetAllDictionaries } from '@intlayer/design-system/hooks';\nimport { ChevronRight } from 'lucide-react';\nimport type { FC } from 'react';\nimport { useDictionaryEditionDrawerControl } from '../DictionaryEditionDrawer/index';\nimport {\n dictionaryListDrawerIdentifier,\n useDictionaryListDrawer,\n} from './useDictionaryListDrawer';\n\nexport const DictionaryListDrawer: FC = () => {\n const { all: dictionaries } = useGetAllDictionaries();\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 Object.keys(editedContent).includes(dictionaryId);\n\n return (\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"],"mappings":"AAwCU;AAvCV;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,6BAA6B;AACtC,SAAS,oBAAoB;AAE7B,SAAS,yCAAyC;AAClD;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEA,MAAM,uBAA2B,MAAM;AAC5C,QAAM,EAAE,KAAK,aAAa,IAAI,sBAAsB;AACpD,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,iBAC1B,OAAO,KAAK,aAAa,EAAE,SAAS,YAAY;AAElD,SACE;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;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/DictionaryListDrawer/DictionaryListDrawer.tsx"],"sourcesContent":["import type { Locales } from '@intlayer/config/client';\nimport {\n RightDrawer,\n Button,\n useEditedContentStore,\n} from '@intlayer/design-system';\nimport { useGetAllDictionaries } from '@intlayer/design-system/hooks';\nimport { ChevronRight } from 'lucide-react';\nimport type { FC } from 'react';\nimport { useDictionaryEditionDrawerControl } from '../DictionaryEditionDrawer/index';\nimport {\n dictionaryListDrawerIdentifier,\n useDictionaryListDrawer,\n} from './useDictionaryListDrawer';\n\nexport const DictionaryListDrawer: FC = () => {\n const { all: dictionaries } = useGetAllDictionaries();\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 Object.keys(editedContent).includes(dictionaryId);\n\n return (\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"],"mappings":"AAwCU;AAvCV;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,6BAA6B;AACtC,SAAS,oBAAoB;AAE7B,SAAS,yCAAyC;AAClD;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEA,MAAM,uBAA2B,MAAM;AAC5C,QAAM,EAAE,KAAK,aAAa,IAAI,sBAAsB;AACpD,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,iBAC1B,OAAO,KAAK,aAAa,EAAE,SAAS,YAAY;AAElD,SACE;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;AAEJ;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/DictionaryListDrawer/index.ts"],"sourcesContent":["export * from './DictionaryListDrawer';\nexport * from './useDictionaryListDrawer';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../src/DictionaryListDrawer/index.ts"],"sourcesContent":["export * from './DictionaryListDrawer';\nexport * from './useDictionaryListDrawer';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
@@ -1 +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
+ {"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":[]}
@@ -0,0 +1,71 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { getConfiguration } from "@intlayer/config/client";
4
+ import { DictionaryEditionDrawerController } from './DictionaryEditionDrawer/index.mjs';
5
+ import { DictionaryListDrawer } from './DictionaryListDrawer/index.mjs';
6
+ import { useIntlayerContext } from "react-intlayer";
7
+ import { useContentSelectorContext } from "react-intlayer/editor";
8
+ import { ContentSelectorWrapper } from './ContentSelectorWrapper.mjs';
9
+ import {
10
+ createContext,
11
+ useContext,
12
+ useEffect,
13
+ useMemo
14
+ } from "react";
15
+ const IntlayerEditorContext = createContext({
16
+ isEditorEnabled: false
17
+ });
18
+ const useIntlayerEditorContext = () => useContext(IntlayerEditorContext);
19
+ const IntlayerEditorProvider = ({
20
+ children,
21
+ isEnabled = true
22
+ }) => {
23
+ const { editor, internationalization } = getConfiguration();
24
+ const { setState } = useContentSelectorContext();
25
+ const { locale, setLocale } = useIntlayerContext();
26
+ const isEditorEnabled = useMemo(
27
+ () => Boolean(
28
+ editor.enabled && editor.clientId && editor.clientSecret && isEnabled
29
+ ),
30
+ [editor.enabled && editor.clientId && editor.clientSecret && isEnabled]
31
+ );
32
+ useEffect(() => {
33
+ setState({
34
+ ContentSelectorWrapper
35
+ });
36
+ }, [setState]);
37
+ useEffect(() => {
38
+ if (isEnabled && editor.enabled) {
39
+ if (!editor.clientId) {
40
+ console.error(
41
+ "Editor is enabled but clientId is not set. Please set it in the editor configuration. See http://localhost:3000/doc/concept/editor."
42
+ );
43
+ }
44
+ if (!editor.clientSecret) {
45
+ console.error(
46
+ "Editor is enabled but clientSecret is not set. Please set it in the editor configuration. See http://localhost:3000/doc/concept/editor."
47
+ );
48
+ }
49
+ }
50
+ }, [isEnabled, editor.enabled, editor.clientId, editor.clientSecret]);
51
+ return /* @__PURE__ */ jsxs(IntlayerEditorContext.Provider, { value: { isEditorEnabled }, children: [
52
+ children,
53
+ isEditorEnabled && /* @__PURE__ */ jsxs(Fragment, { children: [
54
+ /* @__PURE__ */ jsx(
55
+ DictionaryEditionDrawerController,
56
+ {
57
+ locale,
58
+ localeList: internationalization.locales,
59
+ setLocale
60
+ }
61
+ ),
62
+ /* @__PURE__ */ jsx(DictionaryListDrawer, {})
63
+ ] })
64
+ ] });
65
+ };
66
+ export {
67
+ IntlayerEditorContext,
68
+ IntlayerEditorProvider,
69
+ useIntlayerEditorContext
70
+ };
71
+ //# sourceMappingURL=IntlayerEditorProvider.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/IntlayerEditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport { getConfiguration } from '@intlayer/config/client';\nimport { DictionaryEditionDrawerController } from './DictionaryEditionDrawer/index';\nimport { DictionaryListDrawer } from './DictionaryListDrawer/index';\nimport { useIntlayerContext } from 'react-intlayer';\nimport { useContentSelectorContext } from 'react-intlayer/editor';\nimport { ContentSelectorWrapper } from './ContentSelectorWrapper';\nimport {\n type FC,\n type PropsWithChildren,\n createContext,\n useContext,\n useEffect,\n useMemo,\n} from 'react';\n\ntype IntlayerEditorValue = {\n isEditorEnabled: boolean;\n};\n\n/**\n * Context that store the current locale on the client side\n */\nexport const IntlayerEditorContext = createContext<IntlayerEditorValue>({\n isEditorEnabled: false,\n});\n\n/**\n * Hook that provides the current locale\n */\nexport const useIntlayerEditorContext = () => useContext(IntlayerEditorContext);\n\nexport type IntlayerEditorProviderProps = PropsWithChildren<{\n isEnabled?: boolean;\n}>;\n\n/**\n * Provider that store the current locale on the client side\n */\nexport const IntlayerEditorProvider: FC<IntlayerEditorProviderProps> = ({\n children,\n isEnabled = true,\n}) => {\n const { editor, internationalization } = getConfiguration();\n\n const { setState } = useContentSelectorContext();\n\n const { locale, setLocale } = useIntlayerContext();\n\n const isEditorEnabled = useMemo(\n () =>\n Boolean(\n editor.enabled && editor.clientId && editor.clientSecret && isEnabled\n ),\n [editor.enabled && editor.clientId && editor.clientSecret && isEnabled]\n );\n\n useEffect(() => {\n setState({\n ContentSelectorWrapper,\n });\n }, [setState]);\n\n useEffect(() => {\n if (isEnabled && editor.enabled) {\n if (!editor.clientId) {\n console.error(\n 'Editor is enabled but clientId is not set. Please set it in the editor configuration. See http://localhost:3000/doc/concept/editor.'\n );\n }\n\n if (!editor.clientSecret) {\n console.error(\n 'Editor is enabled but clientSecret is not set. Please set it in the editor configuration. See http://localhost:3000/doc/concept/editor.'\n );\n }\n }\n }, [isEnabled, editor.enabled, editor.clientId, editor.clientSecret]);\n\n return (\n <IntlayerEditorContext.Provider value={{ isEditorEnabled }}>\n {children}\n\n {isEditorEnabled && (\n <>\n <DictionaryEditionDrawerController\n locale={locale}\n localeList={internationalization.locales}\n setLocale={setLocale}\n />\n <DictionaryListDrawer />\n </>\n )}\n </IntlayerEditorContext.Provider>\n );\n};\n"],"mappings":";AAqFQ,mBACE,KADF;AAnFR,SAAS,wBAAwB;AACjC,SAAS,yCAAyC;AAClD,SAAS,4BAA4B;AACrC,SAAS,0BAA0B;AACnC,SAAS,iCAAiC;AAC1C,SAAS,8BAA8B;AACvC;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AASA,MAAM,wBAAwB,cAAmC;AAAA,EACtE,iBAAiB;AACnB,CAAC;AAKM,MAAM,2BAA2B,MAAM,WAAW,qBAAqB;AASvE,MAAM,yBAA0D,CAAC;AAAA,EACtE;AAAA,EACA,YAAY;AACd,MAAM;AACJ,QAAM,EAAE,QAAQ,qBAAqB,IAAI,iBAAiB;AAE1D,QAAM,EAAE,SAAS,IAAI,0BAA0B;AAE/C,QAAM,EAAE,QAAQ,UAAU,IAAI,mBAAmB;AAEjD,QAAM,kBAAkB;AAAA,IACtB,MACE;AAAA,MACE,OAAO,WAAW,OAAO,YAAY,OAAO,gBAAgB;AAAA,IAC9D;AAAA,IACF,CAAC,OAAO,WAAW,OAAO,YAAY,OAAO,gBAAgB,SAAS;AAAA,EACxE;AAEA,YAAU,MAAM;AACd,aAAS;AAAA,MACP;AAAA,IACF,CAAC;AAAA,EACH,GAAG,CAAC,QAAQ,CAAC;AAEb,YAAU,MAAM;AACd,QAAI,aAAa,OAAO,SAAS;AAC/B,UAAI,CAAC,OAAO,UAAU;AACpB,gBAAQ;AAAA,UACN;AAAA,QACF;AAAA,MACF;AAEA,UAAI,CAAC,OAAO,cAAc;AACxB,gBAAQ;AAAA,UACN;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF,GAAG,CAAC,WAAW,OAAO,SAAS,OAAO,UAAU,OAAO,YAAY,CAAC;AAEpE,SACE,qBAAC,sBAAsB,UAAtB,EAA+B,OAAO,EAAE,gBAAgB,GACtD;AAAA;AAAA,IAEA,mBACC,iCACE;AAAA;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA,YAAY,qBAAqB;AAAA,UACjC;AAAA;AAAA,MACF;AAAA,MACA,oBAAC,wBAAqB;AAAA,OACxB;AAAA,KAEJ;AAEJ;","names":[]}
@@ -1,7 +1,4 @@
1
1
  export * from './DictionaryEditionDrawer/index.mjs';
2
2
  export * from './DictionaryListDrawer/index.mjs';
3
- export * from './ContentEditionLayout.mjs';
4
- export * from './useEditorServer.mjs';
5
- export * from './renderContentEditor.mjs';
6
- export * from './ContentEditorProvider.mjs';
3
+ export * from './IntlayerEditorProvider.mjs';
7
4
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
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":[]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './DictionaryEditionDrawer/index';\nexport * from './DictionaryListDrawer/index';\nexport * from './IntlayerEditorProvider';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"ContentSelectorWrapper.d.ts","sourceRoot":"","sources":["../../src/client/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,CA6ClE,CAAC"}
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,EAIL,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,CA6ClE,CAAC"}
@@ -5,6 +5,7 @@ type DictionaryEditionDrawerContentProps = {
5
5
  focusedContent: FileContentWithDictionaryPath;
6
6
  locale: Locales;
7
7
  identifier: string;
8
+ handleOnBack: () => void;
8
9
  };
9
10
  export declare const DictionaryEditionDrawerContent: FC<DictionaryEditionDrawerContentProps>;
10
11
  type DictionaryEditionDrawerProps = DictionaryEditionDrawerControllerProps & {
@@ -1 +1 @@
1
- {"version":3,"file":"DictionaryEditionDrawer.d.ts","sourceRoot":"","sources":["../../../src/client/DictionaryEditionDrawer/DictionaryEditionDrawer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAWvD,OAAO,EAAuB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAErD,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;CACpB,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,EAAE,CAC7C,mCAAmC,CAwDpC,CAAC;AAEF,KAAK,4BAA4B,GAAG,sCAAsC,GAAG;IAC3E,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,EAAE,CAAC,4BAA4B,CAyCpE,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,CAiBvC,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;AAWvD,OAAO,EAAoC,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAElE,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,CAkDpC,CAAC;AAEF,KAAK,4BAA4B,GAAG,sCAAsC,GAAG;IAC3E,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,EAAE,CAAC,4BAA4B,CA0CpE,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,CAiBvC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/DictionaryEditionDrawer/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/DictionaryEditionDrawer/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC"}
@@ -1,5 +1,4 @@
1
1
  import type { Dictionary, DictionaryValue, KeyPath } from '@intlayer/core';
2
- import { type DictionaryContent } from '@intlayer/design-system';
3
2
  export declare const getDrawerIdentifier: (dictionaryId: string) => string;
4
3
  type DictionaryId = string;
5
4
  type DictionaryPath = string;
@@ -10,16 +9,11 @@ export type FileContent = {
10
9
  };
11
10
  type DictionaryEditionDrawer = {
12
11
  focusedContent: FileContent | null;
13
- setFocusedContent: (content: FileContent | null) => void;
14
12
  isOpen: boolean;
15
13
  open: (content: FileContent) => void;
16
14
  close: () => void;
17
- editContentRequest: () => Promise<void>;
18
- editedContent: DictionaryContent;
19
- addEditedContent: (dictionaryId: DictionaryId, newValue: DictionaryValue, keyPath: KeyPath[]) => void;
20
15
  setDictionariesRecord: (dictionariesRecord: Record<DictionaryId, Dictionary>) => void;
21
16
  getEditedContentValue: (dictionaryId: DictionaryId, keyPath: KeyPath[]) => DictionaryValue | undefined;
22
- clearEditedDictionaryContent: (dictionaryPath: DictionaryPath) => void;
23
17
  };
24
18
  export declare const useDictionaryEditionDrawer: (dictionaryId: string) => DictionaryEditionDrawer;
25
19
  type DictionaryEditionDrawerControl = {
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionaryEditionDrawer.d.ts","sourceRoot":"","sources":["../../../src/client/DictionaryEditionDrawer/useDictionaryEditionDrawer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,yBAAyB,CAAC;AAGjC,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,iBAAiB,EAAE,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;IACzD,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IACrC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,kBAAkB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,aAAa,EAAE,iBAAiB,CAAC;IACjC,gBAAgB,EAAE,CAChB,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,OAAO,EAAE,KACf,IAAI,CAAC;IACV,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;IACjC,4BAA4B,EAAE,CAAC,cAAc,EAAE,cAAc,KAAK,IAAI,CAAC;CACxE,CAAC;AAQF,eAAO,MAAM,0BAA0B,iBACvB,MAAM,KACnB,uBAiDF,CAAC;AAEF,KAAK,8BAA8B,GAAG;IACpC,IAAI,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IACrC,KAAK,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC,CAAC;AAEF,eAAO,MAAM,iCAAiC,QACxC,8BA6BH,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;AAO3E,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,uBAmCF,CAAC;AAEF,KAAK,8BAA8B,GAAG;IACpC,IAAI,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IACrC,KAAK,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC,CAAC;AAEF,eAAO,MAAM,iCAAiC,QACxC,8BA6BH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"DictionaryListDrawer.d.ts","sourceRoot":"","sources":["../../../src/client/DictionaryListDrawer/DictionaryListDrawer.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAOhC,eAAO,MAAM,oBAAoB,EAAE,EA0ClC,CAAC"}
1
+ {"version":3,"file":"DictionaryListDrawer.d.ts","sourceRoot":"","sources":["../../../src/DictionaryListDrawer/DictionaryListDrawer.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAOhC,eAAO,MAAM,oBAAoB,EAAE,EA0ClC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/DictionaryListDrawer/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/DictionaryListDrawer/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useDictionaryListDrawer.d.ts","sourceRoot":"","sources":["../../../src/client/DictionaryListDrawer/useDictionaryListDrawer.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,8BAA8B,mBAAmB,CAAC;AAE/D,eAAO,MAAM,uBAAuB;;;;CACmB,CAAC"}
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"}
@@ -1,6 +1,6 @@
1
- import { type PropsWithChildren, type FC } from 'react';
1
+ import { type FC, type PropsWithChildren } from 'react';
2
2
  type IntlayerEditorValue = {
3
- editorEnabled: boolean;
3
+ isEditorEnabled: boolean;
4
4
  };
5
5
  /**
6
6
  * Context that store the current locale on the client side
@@ -11,11 +11,11 @@ export declare const IntlayerEditorContext: import("react").Context<IntlayerEdit
11
11
  */
12
12
  export declare const useIntlayerEditorContext: () => IntlayerEditorValue;
13
13
  export type IntlayerEditorProviderProps = PropsWithChildren<{
14
- editorEnabled?: boolean;
14
+ isEnabled?: boolean;
15
15
  }>;
16
16
  /**
17
17
  * Provider that store the current locale on the client side
18
18
  */
19
19
  export declare const IntlayerEditorProvider: FC<IntlayerEditorProviderProps>;
20
20
  export {};
21
- //# sourceMappingURL=ContentEditorProvider.d.ts.map
21
+ //# sourceMappingURL=IntlayerEditorProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IntlayerEditorProvider.d.ts","sourceRoot":"","sources":["../../src/IntlayerEditorProvider.tsx"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,EAAE,EACP,KAAK,iBAAiB,EAKvB,MAAM,OAAO,CAAC;AAEf,KAAK,mBAAmB,GAAG;IACzB,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,8CAEhC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,wBAAwB,2BAA0C,CAAC;AAEhF,MAAM,MAAM,2BAA2B,GAAG,iBAAiB,CAAC;IAC1D,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,2BAA2B,CAwDlE,CAAC"}
@@ -1,7 +1,4 @@
1
1
  export * from './DictionaryEditionDrawer/index';
2
2
  export * from './DictionaryListDrawer/index';
3
- export * from './ContentEditionLayout';
4
- export * from './useEditorServer';
5
- export * from './renderContentEditor';
6
- export * from './ContentEditorProvider';
3
+ export * from './IntlayerEditorProvider';
7
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intlayer-editor",
3
- "version": "3.0.3",
3
+ "version": "3.2.0",
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": [
@@ -50,9 +50,6 @@
50
50
  ]
51
51
  }
52
52
  },
53
- "bin": {
54
- "intlayer-editor": "./bin/start-server.js"
55
- },
56
53
  "files": [
57
54
  "./dist",
58
55
  "./bin",
@@ -62,42 +59,46 @@
62
59
  "@types/body-parser": "^1.19.5",
63
60
  "body-parser": "^1.20.3",
64
61
  "commander": "^12.1.0",
65
- "express": "^4.21.0",
66
- "lucide-react": "^0.441.0",
62
+ "express": "^4.21.1",
63
+ "lucide-react": "^0.456.0",
67
64
  "magic-regexp": "^0.8.0",
68
65
  "react": "^18.3.1",
69
66
  "react-dom": "^18.3.1",
70
- "webpack": "^5.92.1",
71
- "zustand": "^4.5.2",
72
- "@intlayer/design-system": "^3.0.3",
73
- "@intlayer/dictionaries-entry": "^3.0.3",
74
- "intlayer": "^3.0.3",
75
- "@intlayer/config": "^3.0.3",
76
- "@intlayer/core": "^3.0.3"
67
+ "webpack": "^5.96.1",
68
+ "zustand": "^5.0.1",
69
+ "@intlayer/config": "^3.2.0",
70
+ "@intlayer/core": "^3.2.0",
71
+ "@intlayer/design-system": "^3.2.0"
77
72
  },
78
73
  "devDependencies": {
79
- "@babel/generator": "7.24.4",
80
- "@babel/parser": "7.24.4",
81
- "@babel/types": "7.24.0",
74
+ "@babel/generator": "7.26.2",
75
+ "@babel/parser": "7.26.2",
76
+ "@babel/types": "7.26.0",
82
77
  "@changesets/changelog-github": "0.5.0",
83
- "@changesets/cli": "2.27.1",
78
+ "@changesets/cli": "2.27.9",
84
79
  "@types/babel__generator": "^7.6.8",
85
- "@types/express": "^4.17.21",
86
- "@types/node": "^20.14.9",
87
- "@types/react": "^18.3.3",
88
- "@types/react-dom": "^18.3.0",
89
- "concurrently": "^8.2.2",
90
- "eslint": "^9.11.1",
91
- "prettier": "3.3.3",
92
- "rimraf": "5.0.5",
80
+ "@types/express": "^5.0.0",
81
+ "@types/node": "^22.9.0",
82
+ "@types/react": "^18.3.12",
83
+ "@types/react-dom": "^18.3.1",
84
+ "concurrently": "^9.1.0",
85
+ "eslint": "^9.14.0",
86
+ "prettier": "^3.3.3",
87
+ "rimraf": "^6.0.1",
93
88
  "ts-node": "^10.9.2",
94
89
  "tsc-alias": "^1.8.10",
95
- "tsup": "^8.3.0",
96
- "typescript": "^5.5.2",
90
+ "tsup": "^8.3.5",
91
+ "typescript": "^5.6.3",
97
92
  "@utils/eslint-config": "^1.0.4",
93
+ "@utils/ts-config": "^1.0.4",
98
94
  "@utils/ts-config-types": "^1.0.4",
99
- "@utils/tsup-config": "^1.0.4",
100
- "@utils/ts-config": "^1.0.4"
95
+ "@utils/tsup-config": "^1.0.4"
96
+ },
97
+ "peerDependencies": {
98
+ "@intlayer/config": "^3.2.0",
99
+ "@intlayer/design-system": "^3.2.0",
100
+ "@intlayer/core": "^3.2.0",
101
+ "react-intlayer": "^3.2.0"
101
102
  },
102
103
  "engines": {
103
104
  "node": ">=14.18"
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const { program } = require('commander');
4
- const { startIntlayerEditor } = require('../dist/cjs/server/index.cjs');
5
- const pkg = require('../package.json');
6
-
7
- program
8
- .version(pkg.version)
9
- .description('Command-line interface to start the Intlayer Editor server');
10
-
11
- program
12
- .command('start')
13
- .description('Start the Intlayer editor server')
14
- .action(() => startIntlayerEditor());
15
-
16
- program.parse(process.argv);
@@ -1,54 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var ContentEditionLayout_exports = {};
20
- __export(ContentEditionLayout_exports, {
21
- ContentEditionLayout: () => ContentEditionLayout
22
- });
23
- module.exports = __toCommonJS(ContentEditionLayout_exports);
24
- var import_jsx_runtime = require("react/jsx-runtime");
25
- var import_ContentEditorProvider = require('./ContentEditorProvider.cjs');
26
- var import_DictionaryEditionDrawer = require('./DictionaryEditionDrawer/index.cjs');
27
- var import_DictionaryListDrawer = require('./DictionaryListDrawer/index.cjs');
28
- const ContentEditionLayout = ({
29
- children,
30
- locale,
31
- setLocale,
32
- localeList,
33
- editorEnabled = true
34
- }) => {
35
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ContentEditorProvider.IntlayerEditorProvider, { editorEnabled, children: [
36
- children,
37
- editorEnabled && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
38
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
39
- import_DictionaryEditionDrawer.DictionaryEditionDrawerController,
40
- {
41
- locale,
42
- localeList,
43
- setLocale
44
- }
45
- ),
46
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DictionaryListDrawer.DictionaryListDrawer, {})
47
- ] })
48
- ] });
49
- };
50
- // Annotate the CommonJS export names for ESM import in node:
51
- 0 && (module.exports = {
52
- ContentEditionLayout
53
- });
54
- //# sourceMappingURL=ContentEditionLayout.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/client/ContentEditionLayout.tsx"],"sourcesContent":["import type { Locales } from '@intlayer/config/client';\nimport type { FC, ReactNode } from 'react';\nimport { IntlayerEditorProvider } from './ContentEditorProvider';\nimport { DictionaryEditionDrawerController } from './DictionaryEditionDrawer/index';\nimport { DictionaryListDrawer } from './DictionaryListDrawer/index';\n\nexport type ContentEditionLayoutProps = {\n children?: ReactNode;\n locale: Locales;\n localeList: Locales[];\n setLocale: (locale: Locales) => void;\n editorEnabled?: boolean;\n};\n\nexport const ContentEditionLayout: FC<ContentEditionLayoutProps> = ({\n children,\n locale,\n setLocale,\n localeList,\n editorEnabled = true,\n}) => {\n return (\n <IntlayerEditorProvider editorEnabled={editorEnabled}>\n {children}\n\n {editorEnabled && (\n <>\n <DictionaryEditionDrawerController\n locale={locale}\n localeList={localeList}\n setLocale={setLocale}\n />\n <DictionaryListDrawer />\n </>\n )}\n </IntlayerEditorProvider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA0BQ;AAxBR,mCAAuC;AACvC,qCAAkD;AAClD,kCAAqC;AAU9B,MAAM,uBAAsD,CAAC;AAAA,EAClE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAgB;AAClB,MAAM;AACJ,SACE,6CAAC,uDAAuB,eACrB;AAAA;AAAA,IAEA,iBACC,4EACE;AAAA;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACF;AAAA,MACA,4CAAC,oDAAqB;AAAA,OACxB;AAAA,KAEJ;AAEJ;","names":[]}