@intlayer/editor-react 7.1.3 → 7.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/README.md +0 -3
  2. package/dist/types/ConfigurationContext.d.ts +2 -2
  3. package/dist/types/EditorEnabledContext.d.ts +2 -2
  4. package/dist/types/useEditorLocale.d.ts +2 -2
  5. package/package.json +6 -6
  6. package/dist/cjs/FocusDictionaryContext copy.cjs +0 -57
  7. package/dist/cjs/FocusDictionaryContext copy.cjs.map +0 -1
  8. package/dist/cjs/FocusDictionaryServerContext.cjs +0 -24
  9. package/dist/cjs/FocusDictionaryServerContext.cjs.map +0 -1
  10. package/dist/cjs/FocusDictionaryUnmergedContext.cjs +0 -102
  11. package/dist/cjs/FocusDictionaryUnmergedContext.cjs.map +0 -1
  12. package/dist/cjs/config/dist/esm/_virtual/rolldown_runtime.cjs +0 -10
  13. package/dist/cjs/config/dist/esm/_virtual/rolldown_runtime.cjs.map +0 -1
  14. package/dist/cjs/config/dist/esm/built.cjs +0 -8
  15. package/dist/cjs/config/dist/esm/built.cjs.map +0 -1
  16. package/dist/cjs/config/dist/esm/configFile/buildConfigurationFields.cjs +0 -119
  17. package/dist/cjs/config/dist/esm/configFile/buildConfigurationFields.cjs.map +0 -1
  18. package/dist/cjs/config/dist/esm/configFile/getConfiguration.cjs +0 -69
  19. package/dist/cjs/config/dist/esm/configFile/getConfiguration.cjs.map +0 -1
  20. package/dist/cjs/config/dist/esm/configFile/loadConfigurationFile.cjs +0 -26
  21. package/dist/cjs/config/dist/esm/configFile/loadConfigurationFile.cjs.map +0 -1
  22. package/dist/cjs/config/dist/esm/configFile/searchConfigurationFile.cjs +0 -51
  23. package/dist/cjs/config/dist/esm/configFile/searchConfigurationFile.cjs.map +0 -1
  24. package/dist/cjs/config/dist/esm/defaultValues/build.cjs +0 -15
  25. package/dist/cjs/config/dist/esm/defaultValues/build.cjs.map +0 -1
  26. package/dist/cjs/config/dist/esm/defaultValues/content.cjs +0 -54
  27. package/dist/cjs/config/dist/esm/defaultValues/content.cjs.map +0 -1
  28. package/dist/cjs/config/dist/esm/defaultValues/dictionary.cjs +0 -7
  29. package/dist/cjs/config/dist/esm/defaultValues/dictionary.cjs.map +0 -1
  30. package/dist/cjs/config/dist/esm/defaultValues/editor.cjs +0 -23
  31. package/dist/cjs/config/dist/esm/defaultValues/editor.cjs.map +0 -1
  32. package/dist/cjs/config/dist/esm/defaultValues/internationalization.cjs +0 -14
  33. package/dist/cjs/config/dist/esm/defaultValues/internationalization.cjs.map +0 -1
  34. package/dist/cjs/config/dist/esm/defaultValues/log.cjs +0 -10
  35. package/dist/cjs/config/dist/esm/defaultValues/log.cjs.map +0 -1
  36. package/dist/cjs/config/dist/esm/defaultValues/routing.cjs +0 -11
  37. package/dist/cjs/config/dist/esm/defaultValues/routing.cjs.map +0 -1
  38. package/dist/cjs/config/dist/esm/loadEnvFile.cjs +0 -26
  39. package/dist/cjs/config/dist/esm/loadEnvFile.cjs.map +0 -1
  40. package/dist/cjs/config/dist/esm/loadExternalFile/bundleFile.cjs +0 -23
  41. package/dist/cjs/config/dist/esm/loadExternalFile/bundleFile.cjs.map +0 -1
  42. package/dist/cjs/config/dist/esm/loadExternalFile/loadExternalFile.cjs +0 -47
  43. package/dist/cjs/config/dist/esm/loadExternalFile/loadExternalFile.cjs.map +0 -1
  44. package/dist/cjs/config/dist/esm/loadExternalFile/parseFileContent.cjs +0 -65
  45. package/dist/cjs/config/dist/esm/loadExternalFile/parseFileContent.cjs.map +0 -1
  46. package/dist/cjs/config/dist/esm/loadExternalFile/transpileTSToMJS.cjs +0 -45
  47. package/dist/cjs/config/dist/esm/loadExternalFile/transpileTSToMJS.cjs.map +0 -1
  48. package/dist/cjs/config/dist/esm/logger.cjs +0 -47
  49. package/dist/cjs/config/dist/esm/logger.cjs.map +0 -1
  50. package/dist/cjs/config/dist/esm/types/dist/esm/_virtual/rolldown_runtime.cjs +0 -15
  51. package/dist/cjs/config/dist/esm/types/dist/esm/_virtual/rolldown_runtime.cjs.map +0 -1
  52. package/dist/cjs/config/dist/esm/types/dist/esm/locales.cjs +0 -1128
  53. package/dist/cjs/config/dist/esm/types/dist/esm/locales.cjs.map +0 -1
  54. package/dist/cjs/config/dist/esm/utils/ESMxCJSHelpers.cjs +0 -27
  55. package/dist/cjs/config/dist/esm/utils/ESMxCJSHelpers.cjs.map +0 -1
  56. package/dist/cjs/config/dist/esm/utils/cache.cjs +0 -261
  57. package/dist/cjs/config/dist/esm/utils/cache.cjs.map +0 -1
  58. package/dist/cjs/config/dist/esm/utils/getPackageJsonPath.cjs +0 -34
  59. package/dist/cjs/config/dist/esm/utils/getPackageJsonPath.cjs.map +0 -1
  60. package/dist/cjs/config/dist/esm/utils/normalizePath.cjs +0 -17
  61. package/dist/cjs/config/dist/esm/utils/normalizePath.cjs.map +0 -1
  62. package/dist/cjs/core/dist/esm/dictionaryManipulator/editDictionaryByKeyPath.cjs +0 -60
  63. package/dist/cjs/core/dist/esm/dictionaryManipulator/editDictionaryByKeyPath.cjs.map +0 -1
  64. package/dist/cjs/core/dist/esm/dictionaryManipulator/getContentNodeByKeyPath.cjs +0 -17
  65. package/dist/cjs/core/dist/esm/dictionaryManipulator/getContentNodeByKeyPath.cjs.map +0 -1
  66. package/dist/cjs/core/dist/esm/dictionaryManipulator/renameContentNodeByKeyPath.cjs +0 -38
  67. package/dist/cjs/core/dist/esm/dictionaryManipulator/renameContentNodeByKeyPath.cjs.map +0 -1
  68. package/dist/cjs/core/dist/esm/types/dist/esm/nodeType.cjs +0 -25
  69. package/dist/cjs/core/dist/esm/types/dist/esm/nodeType.cjs.map +0 -1
  70. package/dist/cjs/editor/dist/esm/compareUrls.cjs +0 -39
  71. package/dist/cjs/editor/dist/esm/compareUrls.cjs.map +0 -1
  72. package/dist/cjs/editor/dist/esm/mergeIframeClick.cjs +0 -22
  73. package/dist/cjs/editor/dist/esm/mergeIframeClick.cjs.map +0 -1
  74. package/dist/cjs/editor/dist/esm/messagesKeys.cjs +0 -19
  75. package/dist/cjs/editor/dist/esm/messagesKeys.cjs.map +0 -1
  76. package/dist/cjs/types/dist/esm/nodeType.cjs +0 -25
  77. package/dist/cjs/types/dist/esm/nodeType.cjs.map +0 -1
  78. package/dist/esm/FocusDictionaryContext copy.mjs +0 -51
  79. package/dist/esm/FocusDictionaryContext copy.mjs.map +0 -1
  80. package/dist/esm/FocusDictionaryServerContext.mjs +0 -21
  81. package/dist/esm/FocusDictionaryServerContext.mjs.map +0 -1
  82. package/dist/esm/FocusDictionaryUnmergedContext.mjs +0 -93
  83. package/dist/esm/FocusDictionaryUnmergedContext.mjs.map +0 -1
  84. package/dist/esm/_virtual/rolldown_runtime.mjs +0 -8
  85. package/dist/esm/config/dist/esm/_virtual/rolldown_runtime.mjs +0 -11
  86. package/dist/esm/config/dist/esm/_virtual/rolldown_runtime.mjs.map +0 -1
  87. package/dist/esm/config/dist/esm/built.mjs +0 -8
  88. package/dist/esm/config/dist/esm/built.mjs.map +0 -1
  89. package/dist/esm/config/dist/esm/configFile/buildConfigurationFields.mjs +0 -118
  90. package/dist/esm/config/dist/esm/configFile/buildConfigurationFields.mjs.map +0 -1
  91. package/dist/esm/config/dist/esm/configFile/getConfiguration.mjs +0 -67
  92. package/dist/esm/config/dist/esm/configFile/getConfiguration.mjs.map +0 -1
  93. package/dist/esm/config/dist/esm/configFile/loadConfigurationFile.mjs +0 -26
  94. package/dist/esm/config/dist/esm/configFile/loadConfigurationFile.mjs.map +0 -1
  95. package/dist/esm/config/dist/esm/configFile/searchConfigurationFile.mjs +0 -50
  96. package/dist/esm/config/dist/esm/configFile/searchConfigurationFile.mjs.map +0 -1
  97. package/dist/esm/config/dist/esm/defaultValues/build.mjs +0 -10
  98. package/dist/esm/config/dist/esm/defaultValues/build.mjs.map +0 -1
  99. package/dist/esm/config/dist/esm/defaultValues/content.mjs +0 -40
  100. package/dist/esm/config/dist/esm/defaultValues/content.mjs.map +0 -1
  101. package/dist/esm/config/dist/esm/defaultValues/dictionary.mjs +0 -6
  102. package/dist/esm/config/dist/esm/defaultValues/dictionary.mjs.map +0 -1
  103. package/dist/esm/config/dist/esm/defaultValues/editor.mjs +0 -14
  104. package/dist/esm/config/dist/esm/defaultValues/editor.mjs.map +0 -1
  105. package/dist/esm/config/dist/esm/defaultValues/internationalization.mjs +0 -11
  106. package/dist/esm/config/dist/esm/defaultValues/internationalization.mjs.map +0 -1
  107. package/dist/esm/config/dist/esm/defaultValues/log.mjs +0 -9
  108. package/dist/esm/config/dist/esm/defaultValues/log.mjs.map +0 -1
  109. package/dist/esm/config/dist/esm/defaultValues/routing.mjs +0 -8
  110. package/dist/esm/config/dist/esm/defaultValues/routing.mjs.map +0 -1
  111. package/dist/esm/config/dist/esm/loadEnvFile.mjs +0 -24
  112. package/dist/esm/config/dist/esm/loadEnvFile.mjs.map +0 -1
  113. package/dist/esm/config/dist/esm/loadExternalFile/bundleFile.mjs +0 -23
  114. package/dist/esm/config/dist/esm/loadExternalFile/bundleFile.mjs.map +0 -1
  115. package/dist/esm/config/dist/esm/loadExternalFile/loadExternalFile.mjs +0 -47
  116. package/dist/esm/config/dist/esm/loadExternalFile/loadExternalFile.mjs.map +0 -1
  117. package/dist/esm/config/dist/esm/loadExternalFile/parseFileContent.mjs +0 -63
  118. package/dist/esm/config/dist/esm/loadExternalFile/parseFileContent.mjs.map +0 -1
  119. package/dist/esm/config/dist/esm/loadExternalFile/transpileTSToMJS.mjs +0 -44
  120. package/dist/esm/config/dist/esm/loadExternalFile/transpileTSToMJS.mjs.map +0 -1
  121. package/dist/esm/config/dist/esm/logger.mjs +0 -45
  122. package/dist/esm/config/dist/esm/logger.mjs.map +0 -1
  123. package/dist/esm/config/dist/esm/types/dist/esm/_virtual/rolldown_runtime.mjs +0 -14
  124. package/dist/esm/config/dist/esm/types/dist/esm/_virtual/rolldown_runtime.mjs.map +0 -1
  125. package/dist/esm/config/dist/esm/types/dist/esm/locales.mjs +0 -1128
  126. package/dist/esm/config/dist/esm/types/dist/esm/locales.mjs.map +0 -1
  127. package/dist/esm/config/dist/esm/utils/ESMxCJSHelpers.mjs +0 -25
  128. package/dist/esm/config/dist/esm/utils/ESMxCJSHelpers.mjs.map +0 -1
  129. package/dist/esm/config/dist/esm/utils/cache.mjs +0 -263
  130. package/dist/esm/config/dist/esm/utils/cache.mjs.map +0 -1
  131. package/dist/esm/config/dist/esm/utils/getPackageJsonPath.mjs +0 -33
  132. package/dist/esm/config/dist/esm/utils/getPackageJsonPath.mjs.map +0 -1
  133. package/dist/esm/config/dist/esm/utils/normalizePath.mjs +0 -16
  134. package/dist/esm/config/dist/esm/utils/normalizePath.mjs.map +0 -1
  135. package/dist/esm/core/dist/esm/dictionaryManipulator/editDictionaryByKeyPath.mjs +0 -60
  136. package/dist/esm/core/dist/esm/dictionaryManipulator/editDictionaryByKeyPath.mjs.map +0 -1
  137. package/dist/esm/core/dist/esm/dictionaryManipulator/getContentNodeByKeyPath.mjs +0 -17
  138. package/dist/esm/core/dist/esm/dictionaryManipulator/getContentNodeByKeyPath.mjs.map +0 -1
  139. package/dist/esm/core/dist/esm/dictionaryManipulator/renameContentNodeByKeyPath.mjs +0 -38
  140. package/dist/esm/core/dist/esm/dictionaryManipulator/renameContentNodeByKeyPath.mjs.map +0 -1
  141. package/dist/esm/core/dist/esm/types/dist/esm/nodeType.mjs +0 -24
  142. package/dist/esm/core/dist/esm/types/dist/esm/nodeType.mjs.map +0 -1
  143. package/dist/esm/editor/dist/esm/compareUrls.mjs +0 -38
  144. package/dist/esm/editor/dist/esm/compareUrls.mjs.map +0 -1
  145. package/dist/esm/editor/dist/esm/mergeIframeClick.mjs +0 -21
  146. package/dist/esm/editor/dist/esm/mergeIframeClick.mjs.map +0 -1
  147. package/dist/esm/editor/dist/esm/messagesKeys.mjs +0 -18
  148. package/dist/esm/editor/dist/esm/messagesKeys.mjs.map +0 -1
  149. package/dist/esm/types/dist/esm/nodeType.mjs +0 -24
  150. package/dist/esm/types/dist/esm/nodeType.mjs.map +0 -1
  151. package/dist/types/FocusDictionaryContext copy.d.ts +0 -23
  152. package/dist/types/FocusDictionaryContext copy.d.ts.map +0 -1
  153. package/dist/types/FocusDictionaryServerContext.d.ts +0 -9
  154. package/dist/types/FocusDictionaryServerContext.d.ts.map +0 -1
  155. package/dist/types/FocusDictionaryUnmergedContext.d.ts +0 -43
  156. package/dist/types/FocusDictionaryUnmergedContext.d.ts.map +0 -1
  157. package/dist/types/index.d.ts.map +0 -1
@@ -1,38 +0,0 @@
1
- const require_nodeType = require('../types/dist/esm/nodeType.cjs');
2
-
3
- //#region ../core/dist/esm/dictionaryManipulator/renameContentNodeByKeyPath.mjs
4
- const renameContentNodeByKeyPath = (dictionaryContent, newKey, keyPath) => {
5
- let currentValue = dictionaryContent;
6
- let parentValue = null;
7
- let lastKey = null;
8
- for (const keyObj of keyPath) {
9
- parentValue = currentValue;
10
- if (keyObj.type === require_nodeType.NodeType.Object || keyObj.type === require_nodeType.NodeType.Array) {
11
- lastKey = keyObj.key;
12
- currentValue = currentValue[keyObj.key];
13
- }
14
- if (keyObj.type === require_nodeType.NodeType.Translation || keyObj.type === require_nodeType.NodeType.Enumeration || keyObj.type === require_nodeType.NodeType.Condition) {
15
- lastKey = keyObj.type;
16
- currentValue = currentValue[keyObj.type][keyObj.key];
17
- }
18
- if (keyObj.type === require_nodeType.NodeType.Markdown || keyObj.type === require_nodeType.NodeType.ReactNode || keyObj.type === require_nodeType.NodeType.Insertion || keyObj.type === require_nodeType.NodeType.File) {
19
- lastKey = keyObj.type;
20
- currentValue = currentValue[keyObj.type];
21
- }
22
- }
23
- if (parentValue && lastKey !== null) if (Array.isArray(parentValue)) parentValue[lastKey] = currentValue;
24
- else {
25
- const newParentValue = {};
26
- for (const key of Object.keys(parentValue)) if (key === lastKey && typeof newKey !== "undefined") newParentValue[newKey] = currentValue;
27
- else newParentValue[key] = parentValue[key];
28
- Object.keys(parentValue).forEach((key) => {
29
- delete parentValue[key];
30
- });
31
- Object.assign(parentValue, newParentValue);
32
- }
33
- return dictionaryContent;
34
- };
35
-
36
- //#endregion
37
- exports.renameContentNodeByKeyPath = renameContentNodeByKeyPath;
38
- //# sourceMappingURL=renameContentNodeByKeyPath.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"renameContentNodeByKeyPath.cjs","names":["NodeType"],"sources":["../../../../../../../core/dist/esm/dictionaryManipulator/renameContentNodeByKeyPath.mjs"],"sourcesContent":["import { NodeType } from \"../types/dist/esm/nodeType.mjs\";\n\n//#region src/dictionaryManipulator/renameContentNodeByKeyPath.ts\nconst renameContentNodeByKeyPath = (dictionaryContent, newKey, keyPath) => {\n\tlet currentValue = dictionaryContent;\n\tlet parentValue = null;\n\tlet lastKey = null;\n\tfor (const keyObj of keyPath) {\n\t\tparentValue = currentValue;\n\t\tif (keyObj.type === NodeType.Object || keyObj.type === NodeType.Array) {\n\t\t\tlastKey = keyObj.key;\n\t\t\tcurrentValue = currentValue[keyObj.key];\n\t\t}\n\t\tif (keyObj.type === NodeType.Translation || keyObj.type === NodeType.Enumeration || keyObj.type === NodeType.Condition) {\n\t\t\tlastKey = keyObj.type;\n\t\t\tcurrentValue = currentValue[keyObj.type][keyObj.key];\n\t\t}\n\t\tif (keyObj.type === NodeType.Markdown || keyObj.type === NodeType.ReactNode || keyObj.type === NodeType.Insertion || keyObj.type === NodeType.File) {\n\t\t\tlastKey = keyObj.type;\n\t\t\tcurrentValue = currentValue[keyObj.type];\n\t\t}\n\t}\n\tif (parentValue && lastKey !== null) if (Array.isArray(parentValue)) parentValue[lastKey] = currentValue;\n\telse {\n\t\tconst newParentValue = {};\n\t\tfor (const key of Object.keys(parentValue)) if (key === lastKey && typeof newKey !== \"undefined\") newParentValue[newKey] = currentValue;\n\t\telse newParentValue[key] = parentValue[key];\n\t\tObject.keys(parentValue).forEach((key) => {\n\t\t\tdelete parentValue[key];\n\t\t});\n\t\tObject.assign(parentValue, newParentValue);\n\t}\n\treturn dictionaryContent;\n};\n\n//#endregion\nexport { renameContentNodeByKeyPath };\n//# sourceMappingURL=renameContentNodeByKeyPath.mjs.map"],"mappings":";;;AAGA,MAAM,8BAA8B,mBAAmB,QAAQ,YAAY;CAC1E,IAAI,eAAe;CACnB,IAAI,cAAc;CAClB,IAAI,UAAU;AACd,MAAK,MAAM,UAAU,SAAS;AAC7B,gBAAc;AACd,MAAI,OAAO,SAASA,0BAAS,UAAU,OAAO,SAASA,0BAAS,OAAO;AACtE,aAAU,OAAO;AACjB,kBAAe,aAAa,OAAO;;AAEpC,MAAI,OAAO,SAASA,0BAAS,eAAe,OAAO,SAASA,0BAAS,eAAe,OAAO,SAASA,0BAAS,WAAW;AACvH,aAAU,OAAO;AACjB,kBAAe,aAAa,OAAO,MAAM,OAAO;;AAEjD,MAAI,OAAO,SAASA,0BAAS,YAAY,OAAO,SAASA,0BAAS,aAAa,OAAO,SAASA,0BAAS,aAAa,OAAO,SAASA,0BAAS,MAAM;AACnJ,aAAU,OAAO;AACjB,kBAAe,aAAa,OAAO;;;AAGrC,KAAI,eAAe,YAAY,KAAM,KAAI,MAAM,QAAQ,YAAY,CAAE,aAAY,WAAW;MACvF;EACJ,MAAM,iBAAiB,EAAE;AACzB,OAAK,MAAM,OAAO,OAAO,KAAK,YAAY,CAAE,KAAI,QAAQ,WAAW,OAAO,WAAW,YAAa,gBAAe,UAAU;MACtH,gBAAe,OAAO,YAAY;AACvC,SAAO,KAAK,YAAY,CAAC,SAAS,QAAQ;AACzC,UAAO,YAAY;IAClB;AACF,SAAO,OAAO,aAAa,eAAe;;AAE3C,QAAO"}
@@ -1,25 +0,0 @@
1
-
2
- //#region ../core/dist/esm/types/dist/esm/nodeType.mjs
3
- let NodeType = /* @__PURE__ */ function(NodeType$1) {
4
- NodeType$1["Translation"] = "translation";
5
- NodeType$1["Enumeration"] = "enumeration";
6
- NodeType$1["Condition"] = "condition";
7
- NodeType$1["Insertion"] = "insertion";
8
- NodeType$1["File"] = "file";
9
- NodeType$1["Object"] = "object";
10
- NodeType$1["Array"] = "array";
11
- NodeType$1["Nested"] = "nested";
12
- NodeType$1["ReactNode"] = "reactNode";
13
- NodeType$1["Markdown"] = "markdown";
14
- NodeType$1["Text"] = "text";
15
- NodeType$1["Number"] = "number";
16
- NodeType$1["Boolean"] = "boolean";
17
- NodeType$1["Gender"] = "gender";
18
- NodeType$1["Null"] = "null";
19
- NodeType$1["Unknown"] = "unknown";
20
- return NodeType$1;
21
- }({});
22
-
23
- //#endregion
24
- exports.NodeType = NodeType;
25
- //# sourceMappingURL=nodeType.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nodeType.cjs","names":[],"sources":["../../../../../../../../../core/dist/esm/types/dist/esm/nodeType.mjs"],"sourcesContent":["//#region ../types/dist/esm/nodeType.mjs\nlet NodeType = /* @__PURE__ */ function(NodeType$1) {\n\tNodeType$1[\"Translation\"] = \"translation\";\n\tNodeType$1[\"Enumeration\"] = \"enumeration\";\n\tNodeType$1[\"Condition\"] = \"condition\";\n\tNodeType$1[\"Insertion\"] = \"insertion\";\n\tNodeType$1[\"File\"] = \"file\";\n\tNodeType$1[\"Object\"] = \"object\";\n\tNodeType$1[\"Array\"] = \"array\";\n\tNodeType$1[\"Nested\"] = \"nested\";\n\tNodeType$1[\"ReactNode\"] = \"reactNode\";\n\tNodeType$1[\"Markdown\"] = \"markdown\";\n\tNodeType$1[\"Text\"] = \"text\";\n\tNodeType$1[\"Number\"] = \"number\";\n\tNodeType$1[\"Boolean\"] = \"boolean\";\n\tNodeType$1[\"Gender\"] = \"gender\";\n\tNodeType$1[\"Null\"] = \"null\";\n\tNodeType$1[\"Unknown\"] = \"unknown\";\n\treturn NodeType$1;\n}({});\nconst formatNodeType = (nodeType, content, additionalAttributes) => ({\n\t...additionalAttributes,\n\tnodeType,\n\t[nodeType]: content\n});\n\n//#endregion\nexport { NodeType, formatNodeType };\n//# sourceMappingURL=nodeType.mjs.map"],"mappings":";;AACA,IAAI,WAA2B,yBAAS,YAAY;AACnD,YAAW,iBAAiB;AAC5B,YAAW,iBAAiB;AAC5B,YAAW,eAAe;AAC1B,YAAW,eAAe;AAC1B,YAAW,UAAU;AACrB,YAAW,YAAY;AACvB,YAAW,WAAW;AACtB,YAAW,YAAY;AACvB,YAAW,eAAe;AAC1B,YAAW,cAAc;AACzB,YAAW,UAAU;AACrB,YAAW,YAAY;AACvB,YAAW,aAAa;AACxB,YAAW,YAAY;AACvB,YAAW,UAAU;AACrB,YAAW,aAAa;AACxB,QAAO;EACN,EAAE,CAAC"}
@@ -1,39 +0,0 @@
1
-
2
- //#region ../editor/dist/esm/compareUrls.mjs
3
- /**
4
- * Compare two URLs for equality.
5
- * This function is used to determine if a message originates from the same origin.
6
- *
7
- * ```js
8
- * // Example usage
9
- * console.log(compareUrls("http://localhost:5173/", "http://localhost:5173")); // true
10
- * console.log(compareUrls("http://localhost:5173", "http://localhost:5173?myParam=true")); // true
11
- * console.log(compareUrls("http://localhost:5173/subpath", "http://localhost:5173")); // true
12
- * console.log(compareUrls("http://localhost:5172", "http://localhost:5173")); // false
13
- * ```
14
- *
15
- * @param url1 - The first URL to compare.
16
- * @param url2 - The second URL to compare.
17
- * @returns Whether the two URLs are equal.
18
- */
19
- const compareUrls = (url1, url2) => {
20
- try {
21
- const parsedUrl1 = new URL(url1);
22
- const parsedUrl2 = new URL(url2);
23
- if (parsedUrl1.protocol !== parsedUrl2.protocol || parsedUrl1.hostname !== parsedUrl2.hostname || parsedUrl1.port !== parsedUrl2.port) return false;
24
- const path1 = parsedUrl1.pathname.replace(/\/$/, "");
25
- const path2 = parsedUrl2.pathname.replace(/\/$/, "");
26
- if (path1 !== "" && path2 !== "" && path1 !== path2) return false;
27
- return true;
28
- } catch (error) {
29
- console.error("Invalid URL(s)", error, {
30
- url1,
31
- url2
32
- });
33
- return false;
34
- }
35
- };
36
-
37
- //#endregion
38
- exports.compareUrls = compareUrls;
39
- //# sourceMappingURL=compareUrls.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compareUrls.cjs","names":[],"sources":["../../../../../../editor/dist/esm/compareUrls.mjs"],"sourcesContent":["//#region src/compareUrls.ts\n/**\n* Compare two URLs for equality.\n* This function is used to determine if a message originates from the same origin.\n*\n* ```js\n* // Example usage\n* console.log(compareUrls(\"http://localhost:5173/\", \"http://localhost:5173\")); // true\n* console.log(compareUrls(\"http://localhost:5173\", \"http://localhost:5173?myParam=true\")); // true\n* console.log(compareUrls(\"http://localhost:5173/subpath\", \"http://localhost:5173\")); // true\n* console.log(compareUrls(\"http://localhost:5172\", \"http://localhost:5173\")); // false\n* ```\n*\n* @param url1 - The first URL to compare.\n* @param url2 - The second URL to compare.\n* @returns Whether the two URLs are equal.\n*/\nconst compareUrls = (url1, url2) => {\n\ttry {\n\t\tconst parsedUrl1 = new URL(url1);\n\t\tconst parsedUrl2 = new URL(url2);\n\t\tif (parsedUrl1.protocol !== parsedUrl2.protocol || parsedUrl1.hostname !== parsedUrl2.hostname || parsedUrl1.port !== parsedUrl2.port) return false;\n\t\tconst path1 = parsedUrl1.pathname.replace(/\\/$/, \"\");\n\t\tconst path2 = parsedUrl2.pathname.replace(/\\/$/, \"\");\n\t\tif (path1 !== \"\" && path2 !== \"\" && path1 !== path2) return false;\n\t\treturn true;\n\t} catch (error) {\n\t\tconsole.error(\"Invalid URL(s)\", error, {\n\t\t\turl1,\n\t\t\turl2\n\t\t});\n\t\treturn false;\n\t}\n};\n\n//#endregion\nexport { compareUrls };\n//# sourceMappingURL=compareUrls.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,MAAM,eAAe,MAAM,SAAS;AACnC,KAAI;EACH,MAAM,aAAa,IAAI,IAAI,KAAK;EAChC,MAAM,aAAa,IAAI,IAAI,KAAK;AAChC,MAAI,WAAW,aAAa,WAAW,YAAY,WAAW,aAAa,WAAW,YAAY,WAAW,SAAS,WAAW,KAAM,QAAO;EAC9I,MAAM,QAAQ,WAAW,SAAS,QAAQ,OAAO,GAAG;EACpD,MAAM,QAAQ,WAAW,SAAS,QAAQ,OAAO,GAAG;AACpD,MAAI,UAAU,MAAM,UAAU,MAAM,UAAU,MAAO,QAAO;AAC5D,SAAO;UACC,OAAO;AACf,UAAQ,MAAM,kBAAkB,OAAO;GACtC;GACA;GACA,CAAC;AACF,SAAO"}
@@ -1,22 +0,0 @@
1
-
2
- //#region ../editor/dist/esm/mergeIframeClick.mjs
3
- const mergeIframeClick = (event) => {
4
- const simulatedMouseDownEvent = new MouseEvent("mousedown", {
5
- bubbles: true,
6
- cancelable: true,
7
- view: window
8
- });
9
- const simulatedClickEvent = new MouseEvent("click", {
10
- bubbles: true,
11
- cancelable: true,
12
- view: window
13
- });
14
- Object.assign(simulatedClickEvent, { iframeData: event });
15
- Object.assign(simulatedMouseDownEvent, { iframeData: event });
16
- window.dispatchEvent(simulatedClickEvent);
17
- window.dispatchEvent(simulatedMouseDownEvent);
18
- };
19
-
20
- //#endregion
21
- exports.mergeIframeClick = mergeIframeClick;
22
- //# sourceMappingURL=mergeIframeClick.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mergeIframeClick.cjs","names":[],"sources":["../../../../../../editor/dist/esm/mergeIframeClick.mjs"],"sourcesContent":["//#region src/mergeIframeClick.ts\nconst mergeIframeClick = (event) => {\n\tconst simulatedMouseDownEvent = new MouseEvent(\"mousedown\", {\n\t\tbubbles: true,\n\t\tcancelable: true,\n\t\tview: window\n\t});\n\tconst simulatedClickEvent = new MouseEvent(\"click\", {\n\t\tbubbles: true,\n\t\tcancelable: true,\n\t\tview: window\n\t});\n\tObject.assign(simulatedClickEvent, { iframeData: event });\n\tObject.assign(simulatedMouseDownEvent, { iframeData: event });\n\twindow.dispatchEvent(simulatedClickEvent);\n\twindow.dispatchEvent(simulatedMouseDownEvent);\n};\n\n//#endregion\nexport { mergeIframeClick };\n//# sourceMappingURL=mergeIframeClick.mjs.map"],"mappings":";;AACA,MAAM,oBAAoB,UAAU;CACnC,MAAM,0BAA0B,IAAI,WAAW,aAAa;EAC3D,SAAS;EACT,YAAY;EACZ,MAAM;EACN,CAAC;CACF,MAAM,sBAAsB,IAAI,WAAW,SAAS;EACnD,SAAS;EACT,YAAY;EACZ,MAAM;EACN,CAAC;AACF,QAAO,OAAO,qBAAqB,EAAE,YAAY,OAAO,CAAC;AACzD,QAAO,OAAO,yBAAyB,EAAE,YAAY,OAAO,CAAC;AAC7D,QAAO,cAAc,oBAAoB;AACzC,QAAO,cAAc,wBAAwB"}
@@ -1,19 +0,0 @@
1
-
2
- //#region ../editor/dist/esm/messagesKeys.mjs
3
- let MessageKey = /* @__PURE__ */ function(MessageKey$1) {
4
- MessageKey$1["INTLAYER_CONFIGURATION"] = "INTLAYER_CONFIGURATION";
5
- MessageKey$1["INTLAYER_CURRENT_LOCALE"] = "INTLAYER_CURRENT_LOCALE";
6
- MessageKey$1["INTLAYER_EDITOR_ENABLED"] = "INTLAYER_EDITOR_ENABLED";
7
- MessageKey$1["INTLAYER_URL_CHANGE"] = "INTLAYER_URL_CHANGE";
8
- MessageKey$1["INTLAYER_HOVERED_CONTENT_CHANGED"] = "INTLAYER_HOVERED_CONTENT_CHANGED";
9
- MessageKey$1["INTLAYER_FOCUSED_CONTENT_CHANGED"] = "INTLAYER_FOCUSED_CONTENT_CHANGED";
10
- MessageKey$1["INTLAYER_LOCALE_DICTIONARIES_CHANGED"] = "INTLAYER_LOCALE_DICTIONARIES_CHANGED";
11
- MessageKey$1["INTLAYER_DISTANT_DICTIONARIES_CHANGED"] = "INTLAYER_DISTANT_DICTIONARIES_CHANGED";
12
- MessageKey$1["INTLAYER_EDITED_CONTENT_CHANGED"] = "INTLAYER_EDITED_CONTENT_CHANGED";
13
- MessageKey$1["INTLAYER_IFRAME_CLICKED"] = "INTLAYER_IFRAME_CLICKED";
14
- return MessageKey$1;
15
- }({});
16
-
17
- //#endregion
18
- exports.MessageKey = MessageKey;
19
- //# sourceMappingURL=messagesKeys.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"messagesKeys.cjs","names":[],"sources":["../../../../../../editor/dist/esm/messagesKeys.mjs"],"sourcesContent":["//#region src/messagesKeys.ts\nlet MessageKey = /* @__PURE__ */ function(MessageKey$1) {\n\tMessageKey$1[\"INTLAYER_CONFIGURATION\"] = \"INTLAYER_CONFIGURATION\";\n\tMessageKey$1[\"INTLAYER_CURRENT_LOCALE\"] = \"INTLAYER_CURRENT_LOCALE\";\n\tMessageKey$1[\"INTLAYER_EDITOR_ENABLED\"] = \"INTLAYER_EDITOR_ENABLED\";\n\tMessageKey$1[\"INTLAYER_URL_CHANGE\"] = \"INTLAYER_URL_CHANGE\";\n\tMessageKey$1[\"INTLAYER_HOVERED_CONTENT_CHANGED\"] = \"INTLAYER_HOVERED_CONTENT_CHANGED\";\n\tMessageKey$1[\"INTLAYER_FOCUSED_CONTENT_CHANGED\"] = \"INTLAYER_FOCUSED_CONTENT_CHANGED\";\n\tMessageKey$1[\"INTLAYER_LOCALE_DICTIONARIES_CHANGED\"] = \"INTLAYER_LOCALE_DICTIONARIES_CHANGED\";\n\tMessageKey$1[\"INTLAYER_DISTANT_DICTIONARIES_CHANGED\"] = \"INTLAYER_DISTANT_DICTIONARIES_CHANGED\";\n\tMessageKey$1[\"INTLAYER_EDITED_CONTENT_CHANGED\"] = \"INTLAYER_EDITED_CONTENT_CHANGED\";\n\tMessageKey$1[\"INTLAYER_IFRAME_CLICKED\"] = \"INTLAYER_IFRAME_CLICKED\";\n\treturn MessageKey$1;\n}({});\n\n//#endregion\nexport { MessageKey };\n//# sourceMappingURL=messagesKeys.mjs.map"],"mappings":";;AACA,IAAI,aAA6B,yBAAS,cAAc;AACvD,cAAa,4BAA4B;AACzC,cAAa,6BAA6B;AAC1C,cAAa,6BAA6B;AAC1C,cAAa,yBAAyB;AACtC,cAAa,sCAAsC;AACnD,cAAa,sCAAsC;AACnD,cAAa,0CAA0C;AACvD,cAAa,2CAA2C;AACxD,cAAa,qCAAqC;AAClD,cAAa,6BAA6B;AAC1C,QAAO;EACN,EAAE,CAAC"}
@@ -1,25 +0,0 @@
1
-
2
- //#region ../types/dist/esm/nodeType.mjs
3
- let NodeType = /* @__PURE__ */ function(NodeType$1) {
4
- NodeType$1["Translation"] = "translation";
5
- NodeType$1["Enumeration"] = "enumeration";
6
- NodeType$1["Condition"] = "condition";
7
- NodeType$1["Insertion"] = "insertion";
8
- NodeType$1["File"] = "file";
9
- NodeType$1["Object"] = "object";
10
- NodeType$1["Array"] = "array";
11
- NodeType$1["Nested"] = "nested";
12
- NodeType$1["ReactNode"] = "reactNode";
13
- NodeType$1["Markdown"] = "markdown";
14
- NodeType$1["Text"] = "text";
15
- NodeType$1["Number"] = "number";
16
- NodeType$1["Boolean"] = "boolean";
17
- NodeType$1["Gender"] = "gender";
18
- NodeType$1["Null"] = "null";
19
- NodeType$1["Unknown"] = "unknown";
20
- return NodeType$1;
21
- }({});
22
-
23
- //#endregion
24
- exports.NodeType = NodeType;
25
- //# sourceMappingURL=nodeType.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nodeType.cjs","names":[],"sources":["../../../../../../types/dist/esm/nodeType.mjs"],"sourcesContent":["//#region src/nodeType.ts\nlet NodeType = /* @__PURE__ */ function(NodeType$1) {\n\tNodeType$1[\"Translation\"] = \"translation\";\n\tNodeType$1[\"Enumeration\"] = \"enumeration\";\n\tNodeType$1[\"Condition\"] = \"condition\";\n\tNodeType$1[\"Insertion\"] = \"insertion\";\n\tNodeType$1[\"File\"] = \"file\";\n\tNodeType$1[\"Object\"] = \"object\";\n\tNodeType$1[\"Array\"] = \"array\";\n\tNodeType$1[\"Nested\"] = \"nested\";\n\tNodeType$1[\"ReactNode\"] = \"reactNode\";\n\tNodeType$1[\"Markdown\"] = \"markdown\";\n\tNodeType$1[\"Text\"] = \"text\";\n\tNodeType$1[\"Number\"] = \"number\";\n\tNodeType$1[\"Boolean\"] = \"boolean\";\n\tNodeType$1[\"Gender\"] = \"gender\";\n\tNodeType$1[\"Null\"] = \"null\";\n\tNodeType$1[\"Unknown\"] = \"unknown\";\n\treturn NodeType$1;\n}({});\nconst formatNodeType = (nodeType, content, additionalAttributes) => ({\n\t...additionalAttributes,\n\tnodeType,\n\t[nodeType]: content\n});\n\n//#endregion\nexport { NodeType, formatNodeType };\n//# sourceMappingURL=nodeType.mjs.map"],"mappings":";;AACA,IAAI,WAA2B,yBAAS,YAAY;AACnD,YAAW,iBAAiB;AAC5B,YAAW,iBAAiB;AAC5B,YAAW,eAAe;AAC1B,YAAW,eAAe;AAC1B,YAAW,UAAU;AACrB,YAAW,YAAY;AACvB,YAAW,WAAW;AACtB,YAAW,YAAY;AACvB,YAAW,eAAe;AAC1B,YAAW,cAAc;AACzB,YAAW,UAAU;AACrB,YAAW,YAAY;AACvB,YAAW,aAAa;AACxB,YAAW,YAAY;AACvB,YAAW,UAAU;AACrB,YAAW,aAAa;AACxB,QAAO;EACN,EAAE,CAAC"}
@@ -1,51 +0,0 @@
1
- 'use client';
2
-
3
-
4
- import { useCrossFrameState } from "./useCrossFrameState.mjs";
5
- import { createContext, useContext } from "react";
6
- import { jsx } from "react/jsx-runtime";
7
- import { MessageKey } from "@intlayer/editor";
8
-
9
- //#region src/FocusDictionaryContext copy.tsx
10
- const FocusDictionaryStateContext = createContext(void 0);
11
- const FocusDictionaryActionsContext = createContext(void 0);
12
- const FocusDictionaryProvider = ({ children }) => {
13
- const [focusedContent, setFocusedContent] = useCrossFrameState(MessageKey.INTLAYER_FOCUSED_CONTENT_CHANGED, null);
14
- const setFocusedContentKeyPath = (keyPath) => {
15
- setFocusedContent((prev) => {
16
- if (!prev) return prev;
17
- return {
18
- ...prev,
19
- keyPath
20
- };
21
- });
22
- };
23
- return /* @__PURE__ */ jsx(FocusDictionaryStateContext.Provider, {
24
- value: { focusedContent },
25
- children: /* @__PURE__ */ jsx(FocusDictionaryActionsContext.Provider, {
26
- value: {
27
- setFocusedContent,
28
- setFocusedContentKeyPath
29
- },
30
- children
31
- })
32
- });
33
- };
34
- const useFocusDictionaryActions = () => {
35
- const context = useContext(FocusDictionaryActionsContext);
36
- if (context === void 0) throw new Error("useFocusDictionaryActions must be used within a FocusDictionaryProvider");
37
- return context;
38
- };
39
- const useFocusDictionary = () => {
40
- const actionContext = useFocusDictionaryActions();
41
- const stateContext = useContext(FocusDictionaryStateContext);
42
- if (stateContext === void 0) throw new Error("useFocusDictionaryState must be used within a FocusDictionaryProvider");
43
- return {
44
- ...stateContext,
45
- ...actionContext
46
- };
47
- };
48
-
49
- //#endregion
50
- export { FocusDictionaryProvider, useFocusDictionary, useFocusDictionaryActions };
51
- //# sourceMappingURL=FocusDictionaryContext copy.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FocusDictionaryContext copy.mjs","names":["FocusDictionaryProvider: FC<PropsWithChildren>"],"sources":["../../src/FocusDictionaryContext copy.tsx"],"sourcesContent":["'use client';\n\nimport { MessageKey } from '@intlayer/editor';\nimport type { KeyPath } from '@intlayer/types';\nimport {\n createContext,\n type Dispatch,\n type FC,\n type PropsWithChildren,\n type SetStateAction,\n useContext,\n} from 'react';\nimport { useCrossFrameState } from './useCrossFrameState';\n\nexport type FileContent = {\n dictionaryKey: string;\n dictionaryLocalId?: string;\n keyPath?: KeyPath[];\n};\n\ntype FocusDictionaryState = {\n focusedContent: FileContent | null;\n};\n\ntype FocusDictionaryActions = {\n setFocusedContent: Dispatch<SetStateAction<FileContent | null>>;\n setFocusedContentKeyPath: (keyPath: KeyPath[]) => void;\n};\n\nconst FocusDictionaryStateContext = createContext<\n FocusDictionaryState | undefined\n>(undefined);\nconst FocusDictionaryActionsContext = createContext<\n FocusDictionaryActions | undefined\n>(undefined);\n\nexport const FocusDictionaryProvider: FC<PropsWithChildren> = ({\n children,\n}) => {\n const [focusedContent, setFocusedContent] =\n useCrossFrameState<FileContent | null>(\n MessageKey.INTLAYER_FOCUSED_CONTENT_CHANGED,\n null\n );\n\n const setFocusedContentKeyPath = (keyPath: KeyPath[]) => {\n setFocusedContent((prev) => {\n if (!prev) {\n return prev; // nothing to update if there's no focused content\n }\n return { ...prev, keyPath };\n });\n };\n\n return (\n <FocusDictionaryStateContext.Provider value={{ focusedContent }}>\n <FocusDictionaryActionsContext.Provider\n value={{ setFocusedContent, setFocusedContentKeyPath }}\n >\n {children}\n </FocusDictionaryActionsContext.Provider>\n </FocusDictionaryStateContext.Provider>\n );\n};\n\nexport const useFocusDictionaryActions = () => {\n const context = useContext(FocusDictionaryActionsContext);\n if (context === undefined) {\n throw new Error(\n 'useFocusDictionaryActions must be used within a FocusDictionaryProvider'\n );\n }\n return context;\n};\n\nexport const useFocusDictionary = () => {\n const actionContext = useFocusDictionaryActions();\n const stateContext = useContext(FocusDictionaryStateContext);\n\n if (stateContext === undefined) {\n throw new Error(\n 'useFocusDictionaryState must be used within a FocusDictionaryProvider'\n );\n }\n\n return { ...stateContext, ...actionContext };\n};\n"],"mappings":";;;;;;;;;AA6BA,MAAM,8BAA8B,cAElC,OAAU;AACZ,MAAM,gCAAgC,cAEpC,OAAU;AAEZ,MAAaA,2BAAkD,EAC7D,eACI;CACJ,MAAM,CAAC,gBAAgB,qBACrB,mBACE,WAAW,kCACX,KACD;CAEH,MAAM,4BAA4B,YAAuB;AACvD,qBAAmB,SAAS;AAC1B,OAAI,CAAC,KACH,QAAO;AAET,UAAO;IAAE,GAAG;IAAM;IAAS;IAC3B;;AAGJ,QACE,oBAAC,4BAA4B;EAAS,OAAO,EAAE,gBAAgB;YAC7D,oBAAC,8BAA8B;GAC7B,OAAO;IAAE;IAAmB;IAA0B;GAErD;IACsC;GACJ;;AAI3C,MAAa,kCAAkC;CAC7C,MAAM,UAAU,WAAW,8BAA8B;AACzD,KAAI,YAAY,OACd,OAAM,IAAI,MACR,0EACD;AAEH,QAAO;;AAGT,MAAa,2BAA2B;CACtC,MAAM,gBAAgB,2BAA2B;CACjD,MAAM,eAAe,WAAW,4BAA4B;AAE5D,KAAI,iBAAiB,OACnB,OAAM,IAAI,MACR,wEACD;AAGH,QAAO;EAAE,GAAG;EAAc,GAAG;EAAe"}
@@ -1,21 +0,0 @@
1
- 'use client';
2
-
3
-
4
- import { useFocusDictionary } from "./FocusDictionaryContext.mjs";
5
- import { useState } from "react";
6
- import { NodeType } from "@intlayer/types";
7
-
8
- //#region src/FocusDictionaryServerContext.tsx
9
- const unmergedKeyPathToMergedKeyPath = (keyPath) => {
10
- if (!keyPath.find((key) => key.type === NodeType.Translation)) return keyPath;
11
- return [keyPath.find((key) => key.type === NodeType.Translation), ...keyPath.filter((key) => key.type !== NodeType.Translation)];
12
- };
13
- const useFocusUnmergedDictionary = () => {
14
- const [focusedKeyPath, setFocusedKeyPath] = useState([]);
15
- const { setFocusedContent: setMergedFocusedContent, setFocusedContentKeyPath: setMergedFocusedContentKeyPath, focusedContent: mergedFocusedContent } = useFocusDictionary();
16
- return { focusedContent: unmergedKeyPathToMergedKeyPath(focusedKeyPath) };
17
- };
18
-
19
- //#endregion
20
- export { useFocusUnmergedDictionary };
21
- //# sourceMappingURL=FocusDictionaryServerContext.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FocusDictionaryServerContext.mjs","names":[],"sources":["../../src/FocusDictionaryServerContext.tsx"],"sourcesContent":["'use client';\n\nimport { type Dictionary, type KeyPath, NodeType } from '@intlayer/types';\nimport { useState } from 'react';\nimport { useFocusDictionary } from './FocusDictionaryContext';\n\nconst unmergedKeyPathToMergedKeyPath = (keyPath: KeyPath[]): KeyPath[] => {\n if (!keyPath.find((key) => key.type === NodeType.Translation)) return keyPath;\n\n const translationKeyPath = keyPath.find(\n (key) => key.type === NodeType.Translation\n )!;\n const otherKeyPath = keyPath.filter(\n (key) => key.type !== NodeType.Translation\n );\n\n return [translationKeyPath, ...otherKeyPath];\n};\n\nconst mergedKeyPathToUnmergedKeyPath = (\n keyPath: KeyPath[],\n dictionary: Dictionary\n): KeyPath[] => {\n if (!keyPath.find((key) => key.type === NodeType.Translation)) return keyPath;\n\n const translationKeyPath = keyPath.find(\n (key) => key.type === NodeType.Translation\n )!;\n const otherKeyPath = keyPath.filter(\n (key) => key.type !== NodeType.Translation\n );\n\n // it should insert the translation key path at the end and then end -1, end -2, etc.\n const candidates = Object(otherKeyPath.length).map((_, index) =>\n otherKeyPath.slice(0, index + 1)\n );\n\n for (const candidate of candidates) {\n const result = getContentNodeByKeyPath(dictionary.content, candidate);\n\n if (result) {\n return candidate;\n }\n }\n\n return null;\n};\n\nexport const useFocusUnmergedDictionary = () => {\n const [focusedKeyPath, setFocusedKeyPath] = useState<KeyPath[]>([]);\n\n const {\n setFocusedContent: setMergedFocusedContent,\n setFocusedContentKeyPath: setMergedFocusedContentKeyPath,\n focusedContent: mergedFocusedContent,\n } = useFocusDictionary();\n\n const focusedContent = unmergedKeyPathToMergedKeyPath(focusedKeyPath);\n\n return { focusedContent };\n};\n"],"mappings":";;;;;;;;AAMA,MAAM,kCAAkC,YAAkC;AACxE,KAAI,CAAC,QAAQ,MAAM,QAAQ,IAAI,SAAS,SAAS,YAAY,CAAE,QAAO;AAStE,QAAO,CAPoB,QAAQ,MAChC,QAAQ,IAAI,SAAS,SAAS,YAChC,EAK2B,GAJP,QAAQ,QAC1B,QAAQ,IAAI,SAAS,SAAS,YAChC,CAE2C;;AAgC9C,MAAa,mCAAmC;CAC9C,MAAM,CAAC,gBAAgB,qBAAqB,SAAoB,EAAE,CAAC;CAEnE,MAAM,EACJ,mBAAmB,yBACnB,0BAA0B,gCAC1B,gBAAgB,yBACd,oBAAoB;AAIxB,QAAO,EAAE,gBAFc,+BAA+B,eAAe,EAE5C"}
@@ -1,93 +0,0 @@
1
- 'use client';
2
-
3
-
4
- import { useFocusDictionary, useFocusDictionaryActions } from "./FocusDictionaryContext.mjs";
5
- import { createContext, useContext, useMemo } from "react";
6
- import { jsx } from "react/jsx-runtime";
7
- import { getContentNodeByKeyPath } from "@intlayer/core";
8
- import { NodeType } from "@intlayer/types";
9
-
10
- //#region src/FocusDictionaryUnmergedContext.tsx
11
- /**
12
- * Transforms a keypath from unmerged dictionary format to merged dictionary format.
13
- * In merged format, translation keys come first.
14
- *
15
- * Example:
16
- * Unmerged: [{ type: 'object', key: 'title' }, { type: 'translation', key: 'fr' }]
17
- * Merged: [{ type: 'translation', key: 'fr' }, { type: 'object', key: 'title' }]
18
- */
19
- const unmergedKeyPathToMergedKeyPath = (keyPath) => {
20
- if (!keyPath || keyPath.length === 0) return keyPath;
21
- const translationKeyPath = keyPath.find((key) => key.type === NodeType.Translation);
22
- if (!translationKeyPath) return keyPath;
23
- return [translationKeyPath, ...keyPath.filter((key) => key.type !== NodeType.Translation)];
24
- };
25
- /**
26
- * Transforms a keypath from merged dictionary format to unmerged dictionary format.
27
- * In unmerged format, translation keys are placed at the appropriate nesting level.
28
- *
29
- * Example:
30
- * Merged: [{ type: 'translation', key: 'fr' }, { type: 'object', key: 'title' }]
31
- * Unmerged: [{ type: 'object', key: 'title' }, { type: 'translation', key: 'fr' }]
32
- */
33
- const mergedKeyPathToUnmergedKeyPath = (keyPath, dictionary) => {
34
- if (!keyPath || keyPath.length === 0) return keyPath;
35
- const translationKeyPath = keyPath.find((key) => key.type === NodeType.Translation);
36
- if (!translationKeyPath) return keyPath;
37
- const otherKeyPaths = keyPath.filter((key) => key.type !== NodeType.Translation);
38
- if (dictionary?.content) for (let i = otherKeyPaths.length; i >= 0; i--) {
39
- const candidateKeyPath = [
40
- ...otherKeyPaths.slice(0, i),
41
- translationKeyPath,
42
- ...otherKeyPaths.slice(i)
43
- ];
44
- try {
45
- if (getContentNodeByKeyPath(dictionary.content, candidateKeyPath)) return candidateKeyPath;
46
- } catch {}
47
- }
48
- return [...otherKeyPaths, translationKeyPath];
49
- };
50
- const FocusDictionaryUnmergedStateContext = createContext(void 0);
51
- const FocusDictionaryUnmergedActionsContext = createContext(void 0);
52
- const FocusDictionaryUnmergedProvider = ({ children }) => {
53
- const { focusedContent, setFocusedContent } = useFocusDictionary();
54
- const { setFocusedContentKeyPath: setMergedKeyPath } = useFocusDictionaryActions();
55
- const focusedUnmergedKeyPath = useMemo(() => {
56
- if (!focusedContent?.keyPath) return void 0;
57
- return focusedContent.keyPath;
58
- }, [focusedContent?.keyPath]);
59
- const setFocusedUnmergedKeyPath = (keyPath) => {
60
- setMergedKeyPath(unmergedKeyPathToMergedKeyPath(keyPath));
61
- };
62
- return /* @__PURE__ */ jsx(FocusDictionaryUnmergedStateContext.Provider, {
63
- value: {
64
- focusedContent,
65
- focusedUnmergedKeyPath
66
- },
67
- children: /* @__PURE__ */ jsx(FocusDictionaryUnmergedActionsContext.Provider, {
68
- value: {
69
- setFocusedContent,
70
- setFocusedUnmergedKeyPath
71
- },
72
- children
73
- })
74
- });
75
- };
76
- const useFocusDictionaryUnmergedActions = () => {
77
- const context = useContext(FocusDictionaryUnmergedActionsContext);
78
- if (context === void 0) throw new Error("useFocusDictionaryUnmergedActions must be used within a FocusDictionaryUnmergedProvider");
79
- return context;
80
- };
81
- const useFocusDictionaryUnmerged = () => {
82
- const actionContext = useFocusDictionaryUnmergedActions();
83
- const stateContext = useContext(FocusDictionaryUnmergedStateContext);
84
- if (stateContext === void 0) throw new Error("useFocusDictionaryUnmerged must be used within a FocusDictionaryUnmergedProvider");
85
- return {
86
- ...stateContext,
87
- ...actionContext
88
- };
89
- };
90
-
91
- //#endregion
92
- export { FocusDictionaryUnmergedProvider, mergedKeyPathToUnmergedKeyPath, unmergedKeyPathToMergedKeyPath, useFocusDictionaryUnmerged, useFocusDictionaryUnmergedActions };
93
- //# sourceMappingURL=FocusDictionaryUnmergedContext.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FocusDictionaryUnmergedContext.mjs","names":["FocusDictionaryUnmergedProvider: FC<PropsWithChildren>"],"sources":["../../src/FocusDictionaryUnmergedContext.tsx"],"sourcesContent":["'use client';\n\nimport { getContentNodeByKeyPath } from '@intlayer/core';\nimport type { Dictionary, KeyPath } from '@intlayer/types';\nimport { NodeType } from '@intlayer/types';\nimport {\n createContext,\n type Dispatch,\n type FC,\n type PropsWithChildren,\n type SetStateAction,\n useContext,\n useMemo,\n} from 'react';\nimport {\n type FileContent,\n useFocusDictionary,\n useFocusDictionaryActions,\n} from './FocusDictionaryContext';\n\n/**\n * Transforms a keypath from unmerged dictionary format to merged dictionary format.\n * In merged format, translation keys come first.\n *\n * Example:\n * Unmerged: [{ type: 'object', key: 'title' }, { type: 'translation', key: 'fr' }]\n * Merged: [{ type: 'translation', key: 'fr' }, { type: 'object', key: 'title' }]\n */\nconst unmergedKeyPathToMergedKeyPath = (keyPath: KeyPath[]): KeyPath[] => {\n if (!keyPath || keyPath.length === 0) return keyPath;\n\n const translationKeyPath = keyPath.find(\n (key) => key.type === NodeType.Translation\n );\n\n // If no translation key, return as is\n if (!translationKeyPath) return keyPath;\n\n const otherKeyPaths = keyPath.filter(\n (key) => key.type !== NodeType.Translation\n );\n\n // Translation key comes first in merged format\n return [translationKeyPath, ...otherKeyPaths];\n};\n\n/**\n * Transforms a keypath from merged dictionary format to unmerged dictionary format.\n * In unmerged format, translation keys are placed at the appropriate nesting level.\n *\n * Example:\n * Merged: [{ type: 'translation', key: 'fr' }, { type: 'object', key: 'title' }]\n * Unmerged: [{ type: 'object', key: 'title' }, { type: 'translation', key: 'fr' }]\n */\nconst mergedKeyPathToUnmergedKeyPath = (\n keyPath: KeyPath[],\n dictionary?: Dictionary\n): KeyPath[] => {\n if (!keyPath || keyPath.length === 0) return keyPath;\n\n const translationKeyPath = keyPath.find(\n (key) => key.type === NodeType.Translation\n );\n\n // If no translation key, return as is\n if (!translationKeyPath) return keyPath;\n\n const otherKeyPaths = keyPath.filter(\n (key) => key.type !== NodeType.Translation\n );\n\n // If we have a dictionary, try to find the correct position for the translation key\n if (dictionary?.content) {\n // Try inserting the translation key at different positions from end to start\n // to find where it should be placed in the unmerged structure\n for (let i = otherKeyPaths.length; i >= 0; i--) {\n const candidateKeyPath = [\n ...otherKeyPaths.slice(0, i),\n translationKeyPath,\n ...otherKeyPaths.slice(i),\n ];\n\n try {\n const result = getContentNodeByKeyPath(\n dictionary.content,\n candidateKeyPath\n );\n if (result) {\n return candidateKeyPath;\n }\n } catch {\n // Continue trying other positions\n }\n }\n }\n\n // Default: translation key at the end (most common unmerged format)\n return [...otherKeyPaths, translationKeyPath];\n};\n\nexport type FocusDictionaryUnmergedState = {\n focusedContent: FileContent | null;\n focusedUnmergedKeyPath: KeyPath[] | undefined;\n};\n\nexport type FocusDictionaryUnmergedActions = {\n setFocusedContent: Dispatch<SetStateAction<FileContent | null>>;\n setFocusedUnmergedKeyPath: (keyPath: KeyPath[]) => void;\n};\n\nconst FocusDictionaryUnmergedStateContext = createContext<\n FocusDictionaryUnmergedState | undefined\n>(undefined);\n\nconst FocusDictionaryUnmergedActionsContext = createContext<\n FocusDictionaryUnmergedActions | undefined\n>(undefined);\n\nexport const FocusDictionaryUnmergedProvider: FC<PropsWithChildren> = ({\n children,\n}) => {\n const { focusedContent, setFocusedContent } = useFocusDictionary();\n const { setFocusedContentKeyPath: setMergedKeyPath } =\n useFocusDictionaryActions();\n\n const focusedUnmergedKeyPath = useMemo(() => {\n if (!focusedContent?.keyPath) return undefined;\n // The focusedContent.keyPath from FocusDictionaryContext is in merged format\n // We don't transform it here because we don't have the dictionary\n // The consumer should use setFocusedUnmergedKeyPath with a dictionary\n return focusedContent.keyPath;\n }, [focusedContent?.keyPath]);\n\n const setFocusedUnmergedKeyPath = (keyPath: KeyPath[]) => {\n // Transform unmerged keypath to merged keypath before setting it\n const mergedKeyPath = unmergedKeyPathToMergedKeyPath(keyPath);\n setMergedKeyPath(mergedKeyPath);\n };\n\n return (\n <FocusDictionaryUnmergedStateContext.Provider\n value={{ focusedContent, focusedUnmergedKeyPath }}\n >\n <FocusDictionaryUnmergedActionsContext.Provider\n value={{ setFocusedContent, setFocusedUnmergedKeyPath }}\n >\n {children}\n </FocusDictionaryUnmergedActionsContext.Provider>\n </FocusDictionaryUnmergedStateContext.Provider>\n );\n};\n\nexport const useFocusDictionaryUnmergedActions = () => {\n const context = useContext(FocusDictionaryUnmergedActionsContext);\n if (context === undefined) {\n throw new Error(\n 'useFocusDictionaryUnmergedActions must be used within a FocusDictionaryUnmergedProvider'\n );\n }\n return context;\n};\n\nexport const useFocusDictionaryUnmerged = () => {\n const actionContext = useFocusDictionaryUnmergedActions();\n const stateContext = useContext(FocusDictionaryUnmergedStateContext);\n\n if (stateContext === undefined) {\n throw new Error(\n 'useFocusDictionaryUnmerged must be used within a FocusDictionaryUnmergedProvider'\n );\n }\n\n return { ...stateContext, ...actionContext };\n};\n\n// Export the mapper functions for use elsewhere\nexport { unmergedKeyPathToMergedKeyPath, mergedKeyPathToUnmergedKeyPath };\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4BA,MAAM,kCAAkC,YAAkC;AACxE,KAAI,CAAC,WAAW,QAAQ,WAAW,EAAG,QAAO;CAE7C,MAAM,qBAAqB,QAAQ,MAChC,QAAQ,IAAI,SAAS,SAAS,YAChC;AAGD,KAAI,CAAC,mBAAoB,QAAO;AAOhC,QAAO,CAAC,oBAAoB,GALN,QAAQ,QAC3B,QAAQ,IAAI,SAAS,SAAS,YAChC,CAG4C;;;;;;;;;;AAW/C,MAAM,kCACJ,SACA,eACc;AACd,KAAI,CAAC,WAAW,QAAQ,WAAW,EAAG,QAAO;CAE7C,MAAM,qBAAqB,QAAQ,MAChC,QAAQ,IAAI,SAAS,SAAS,YAChC;AAGD,KAAI,CAAC,mBAAoB,QAAO;CAEhC,MAAM,gBAAgB,QAAQ,QAC3B,QAAQ,IAAI,SAAS,SAAS,YAChC;AAGD,KAAI,YAAY,QAGd,MAAK,IAAI,IAAI,cAAc,QAAQ,KAAK,GAAG,KAAK;EAC9C,MAAM,mBAAmB;GACvB,GAAG,cAAc,MAAM,GAAG,EAAE;GAC5B;GACA,GAAG,cAAc,MAAM,EAAE;GAC1B;AAED,MAAI;AAKF,OAJe,wBACb,WAAW,SACX,iBACD,CAEC,QAAO;UAEH;;AAOZ,QAAO,CAAC,GAAG,eAAe,mBAAmB;;AAa/C,MAAM,sCAAsC,cAE1C,OAAU;AAEZ,MAAM,wCAAwC,cAE5C,OAAU;AAEZ,MAAaA,mCAA0D,EACrE,eACI;CACJ,MAAM,EAAE,gBAAgB,sBAAsB,oBAAoB;CAClE,MAAM,EAAE,0BAA0B,qBAChC,2BAA2B;CAE7B,MAAM,yBAAyB,cAAc;AAC3C,MAAI,CAAC,gBAAgB,QAAS,QAAO;AAIrC,SAAO,eAAe;IACrB,CAAC,gBAAgB,QAAQ,CAAC;CAE7B,MAAM,6BAA6B,YAAuB;AAGxD,mBADsB,+BAA+B,QAAQ,CAC9B;;AAGjC,QACE,oBAAC,oCAAoC;EACnC,OAAO;GAAE;GAAgB;GAAwB;YAEjD,oBAAC,sCAAsC;GACrC,OAAO;IAAE;IAAmB;IAA2B;GAEtD;IAC8C;GACJ;;AAInD,MAAa,0CAA0C;CACrD,MAAM,UAAU,WAAW,sCAAsC;AACjE,KAAI,YAAY,OACd,OAAM,IAAI,MACR,0FACD;AAEH,QAAO;;AAGT,MAAa,mCAAmC;CAC9C,MAAM,gBAAgB,mCAAmC;CACzD,MAAM,eAAe,WAAW,oCAAoC;AAEpE,KAAI,iBAAiB,OACnB,OAAM,IAAI,MACR,mFACD;AAGH,QAAO;EAAE,GAAG;EAAc,GAAG;EAAe"}
@@ -1,8 +0,0 @@
1
- //#region rolldown:runtime
2
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
3
- if (typeof require !== "undefined") return require.apply(this, arguments);
4
- throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function.");
5
- });
6
-
7
- //#endregion
8
- export { __require };
@@ -1,11 +0,0 @@
1
- import { __require as __require$1 } from "../../../../_virtual/rolldown_runtime.mjs";
2
-
3
- //#region ../config/dist/esm/_virtual/rolldown_runtime.mjs
4
- var __require = /* @__PURE__ */ ((x) => typeof __require$1 !== "undefined" ? __require$1 : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof __require$1 !== "undefined" ? __require$1 : a)[b] }) : x)(function(x) {
5
- if (typeof __require$1 !== "undefined") return __require$1.apply(this, arguments);
6
- throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function.");
7
- });
8
-
9
- //#endregion
10
- export { __require };
11
- //# sourceMappingURL=rolldown_runtime.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rolldown_runtime.mjs","names":[],"sources":["../../../../../../../config/dist/esm/_virtual/rolldown_runtime.mjs"],"sourcesContent":["//#region rolldown:runtime\nvar __defProp = Object.defineProperty;\nvar __export = (all) => {\n\tlet target = {};\n\tfor (var name in all) __defProp(target, name, {\n\t\tget: all[name],\n\t\tenumerable: true\n\t});\n\treturn target;\n};\nvar __require = /* @__PURE__ */ ((x) => typeof require !== \"undefined\" ? require : typeof Proxy !== \"undefined\" ? new Proxy(x, { get: (a, b) => (typeof require !== \"undefined\" ? require : a)[b] }) : x)(function(x) {\n\tif (typeof require !== \"undefined\") return require.apply(this, arguments);\n\tthrow Error(\"Calling `require` for \\\"\" + x + \"\\\" in an environment that doesn't expose the `require` function.\");\n});\n\n//#endregion\nexport { __export, __require };"],"mappings":";;;AAUA,IAAI,YAA4B,kBAAE,MAAM,uBAAmB,4BAAwB,OAAO,UAAU,cAAc,IAAI,MAAM,GAAG,EAAE,MAAM,GAAG,OAAO,uBAAmB,4BAAwB,GAAG,IAAI,CAAC,GAAG,GAAG,SAAS,GAAG;AACrN,KAAI,uBAAmB,YAAa,oBAAe,MAAM,MAAM,UAAU;AACzE,OAAM,MAAM,6BAA6B,IAAI,mEAAmE;EAC/G"}
@@ -1,8 +0,0 @@
1
- import { getConfiguration } from "./configFile/getConfiguration.mjs";
2
-
3
- //#region ../config/dist/esm/built.mjs
4
- var built_default = getConfiguration();
5
-
6
- //#endregion
7
- export { built_default };
8
- //# sourceMappingURL=built.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"built.mjs","names":[],"sources":["../../../../../../config/dist/esm/built.mjs"],"sourcesContent":["import { getConfiguration } from \"./configFile/getConfiguration.mjs\";\n\n//#region src/built.ts\nconst configuration = getConfiguration();\nvar built_default = configuration;\n\n//#endregion\nexport { built_default as default };\n//# sourceMappingURL=built.mjs.map"],"mappings":";;;AAIA,IAAI,gBADkB,kBAAkB"}
@@ -1,118 +0,0 @@
1
- import { normalizePath } from "../utils/normalizePath.mjs";
2
- import { CACHE, IMPORT_MODE, OPTIMIZE, OUTPUT_FORMAT, TRAVERSE_PATTERN } from "../defaultValues/build.mjs";
3
- import { CACHE_DIR, CONFIG_DIR, CONTENT_DIR, DICTIONARIES_DIR, DYNAMIC_DICTIONARIES_DIR, EXCLUDED_PATHS, FETCH_DICTIONARIES_DIR, FILE_EXTENSIONS, MAIN_DIR, MODULE_AUGMENTATION_DIR, REMOTE_DICTIONARIES_DIR, TYPES_DIR, UNMERGED_DICTIONARIES_DIR, WATCH } from "../defaultValues/content.mjs";
4
- import { FILL } from "../defaultValues/dictionary.mjs";
5
- import { APPLICATION_URL, BACKEND_URL, CMS_URL, DICTIONARY_PRIORITY_STRATEGY, EDITOR_URL, IS_ENABLED, LIVE_SYNC, LIVE_SYNC_PORT, PORT } from "../defaultValues/editor.mjs";
6
- import { DEFAULT_LOCALE, LOCALES, REQUIRED_LOCALES, STRICT_MODE } from "../defaultValues/internationalization.mjs";
7
- import { MODE, PREFIX } from "../defaultValues/log.mjs";
8
- import { BASE_PATH, ROUTING_MODE, STORAGE } from "../defaultValues/routing.mjs";
9
- import { isAbsolute, join } from "node:path";
10
-
11
- //#region ../config/dist/esm/configFile/buildConfigurationFields.mjs
12
- let storedConfiguration;
13
- const buildInternationalizationFields = (customConfiguration) => ({
14
- locales: customConfiguration?.locales ?? LOCALES,
15
- requiredLocales: customConfiguration?.requiredLocales ?? customConfiguration?.locales ?? REQUIRED_LOCALES,
16
- strictMode: customConfiguration?.strictMode ?? STRICT_MODE,
17
- defaultLocale: customConfiguration?.defaultLocale ?? DEFAULT_LOCALE
18
- });
19
- const buildRoutingFields = (customConfiguration) => ({
20
- mode: customConfiguration?.mode ?? ROUTING_MODE,
21
- storage: customConfiguration?.storage ?? STORAGE,
22
- basePath: customConfiguration?.basePath ?? BASE_PATH
23
- });
24
- const buildContentFields = (customConfiguration, baseDir) => {
25
- const notDerivedContentConfig = {
26
- fileExtensions: customConfiguration?.fileExtensions ?? FILE_EXTENSIONS,
27
- baseDir: customConfiguration?.baseDir ?? baseDir ?? process.cwd(),
28
- excludedPath: customConfiguration?.excludedPath ?? EXCLUDED_PATHS,
29
- watch: customConfiguration?.watch ?? WATCH,
30
- formatCommand: customConfiguration?.formatCommand
31
- };
32
- const optionalJoinBaseDir = (path) => {
33
- if (isAbsolute(path)) return path;
34
- return join(notDerivedContentConfig.baseDir, path);
35
- };
36
- const baseDirDerivedConfiguration = {
37
- contentDir: (customConfiguration?.contentDir ?? CONTENT_DIR).map(optionalJoinBaseDir),
38
- moduleAugmentationDir: optionalJoinBaseDir(customConfiguration?.moduleAugmentationDir ?? MODULE_AUGMENTATION_DIR),
39
- unmergedDictionariesDir: optionalJoinBaseDir(customConfiguration?.unmergedDictionariesDir ?? UNMERGED_DICTIONARIES_DIR),
40
- remoteDictionariesDir: optionalJoinBaseDir(customConfiguration?.remoteDictionariesDir ?? REMOTE_DICTIONARIES_DIR),
41
- dictionariesDir: optionalJoinBaseDir(customConfiguration?.dictionariesDir ?? DICTIONARIES_DIR),
42
- dynamicDictionariesDir: optionalJoinBaseDir(customConfiguration?.dynamicDictionariesDir ?? DYNAMIC_DICTIONARIES_DIR),
43
- fetchDictionariesDir: optionalJoinBaseDir(customConfiguration?.fetchDictionariesDir ?? FETCH_DICTIONARIES_DIR),
44
- typesDir: optionalJoinBaseDir(customConfiguration?.typesDir ?? TYPES_DIR),
45
- mainDir: optionalJoinBaseDir(customConfiguration?.mainDir ?? MAIN_DIR),
46
- configDir: optionalJoinBaseDir(customConfiguration?.configDir ?? CONFIG_DIR),
47
- cacheDir: optionalJoinBaseDir(customConfiguration?.cacheDir ?? CACHE_DIR)
48
- };
49
- const patternsConfiguration = {
50
- watchedFilesPattern: notDerivedContentConfig.fileExtensions.map((ext) => `/**/*${ext}`),
51
- watchedFilesPatternWithPath: notDerivedContentConfig.fileExtensions.flatMap((ext) => baseDirDerivedConfiguration.contentDir.map((contentDir) => `${normalizePath(contentDir)}/**/*${ext}`)),
52
- outputFilesPatternWithPath: `${normalizePath(baseDirDerivedConfiguration.dictionariesDir)}/**/*.json`
53
- };
54
- return {
55
- ...notDerivedContentConfig,
56
- ...baseDirDerivedConfiguration,
57
- ...patternsConfiguration
58
- };
59
- };
60
- const buildEditorFields = (customConfiguration) => ({
61
- applicationURL: customConfiguration?.applicationURL ?? APPLICATION_URL,
62
- editorURL: customConfiguration?.editorURL ?? EDITOR_URL,
63
- cmsURL: customConfiguration?.cmsURL ?? CMS_URL,
64
- backendURL: customConfiguration?.backendURL ?? BACKEND_URL,
65
- port: customConfiguration?.port ?? PORT,
66
- enabled: customConfiguration?.enabled ?? IS_ENABLED,
67
- clientId: customConfiguration?.clientId ?? void 0,
68
- clientSecret: customConfiguration?.clientSecret ?? void 0,
69
- dictionaryPriorityStrategy: customConfiguration?.dictionaryPriorityStrategy ?? DICTIONARY_PRIORITY_STRATEGY,
70
- liveSync: customConfiguration?.liveSync ?? LIVE_SYNC,
71
- liveSyncPort: customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT,
72
- liveSyncURL: customConfiguration?.liveSyncURL ?? `http://localhost:${customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT}`
73
- });
74
- const buildLogFields = (customConfiguration, logFunctions) => ({
75
- mode: customConfiguration?.mode ?? MODE,
76
- prefix: customConfiguration?.prefix ?? PREFIX,
77
- error: logFunctions?.error,
78
- log: logFunctions?.log,
79
- info: logFunctions?.info,
80
- warn: logFunctions?.warn
81
- });
82
- const buildAiFields = (customConfiguration) => ({
83
- provider: customConfiguration?.provider,
84
- apiKey: customConfiguration?.apiKey,
85
- model: customConfiguration?.model,
86
- temperature: customConfiguration?.temperature,
87
- applicationContext: customConfiguration?.applicationContext
88
- });
89
- const buildBuildFields = (customConfiguration) => ({
90
- optimize: customConfiguration?.optimize ?? OPTIMIZE,
91
- importMode: customConfiguration?.importMode ?? IMPORT_MODE,
92
- traversePattern: customConfiguration?.traversePattern ?? TRAVERSE_PATTERN,
93
- outputFormat: customConfiguration?.outputFormat ?? OUTPUT_FORMAT,
94
- cache: customConfiguration?.cache ?? CACHE,
95
- require: customConfiguration?.require
96
- });
97
- const buildDictionaryFields = (customConfiguration) => ({ fill: customConfiguration?.fill ?? FILL });
98
- /**
99
- * Build the configuration fields by merging the default values with the custom configuration
100
- */
101
- const buildConfigurationFields = (customConfiguration, baseDir, logFunctions) => {
102
- storedConfiguration = {
103
- internationalization: buildInternationalizationFields(customConfiguration?.internationalization),
104
- routing: buildRoutingFields(customConfiguration?.routing),
105
- content: buildContentFields(customConfiguration?.content, baseDir),
106
- editor: buildEditorFields(customConfiguration?.editor),
107
- log: buildLogFields(customConfiguration?.log, logFunctions),
108
- ai: buildAiFields(customConfiguration?.ai),
109
- build: buildBuildFields(customConfiguration?.build),
110
- dictionary: buildDictionaryFields(customConfiguration?.dictionary),
111
- plugins: customConfiguration?.plugins
112
- };
113
- return storedConfiguration;
114
- };
115
-
116
- //#endregion
117
- export { buildConfigurationFields };
118
- //# sourceMappingURL=buildConfigurationFields.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"buildConfigurationFields.mjs","names":[],"sources":["../../../../../../../config/dist/esm/configFile/buildConfigurationFields.mjs"],"sourcesContent":["import { normalizePath } from \"../utils/normalizePath.mjs\";\nimport { CACHE, IMPORT_MODE, OPTIMIZE, OUTPUT_FORMAT, TRAVERSE_PATTERN } from \"../defaultValues/build.mjs\";\nimport { CACHE_DIR, CONFIG_DIR, CONTENT_DIR, DICTIONARIES_DIR, DYNAMIC_DICTIONARIES_DIR, EXCLUDED_PATHS, FETCH_DICTIONARIES_DIR, FILE_EXTENSIONS, MAIN_DIR, MODULE_AUGMENTATION_DIR, REMOTE_DICTIONARIES_DIR, TYPES_DIR, UNMERGED_DICTIONARIES_DIR, WATCH } from \"../defaultValues/content.mjs\";\nimport { FILL } from \"../defaultValues/dictionary.mjs\";\nimport { APPLICATION_URL, BACKEND_URL, CMS_URL, DICTIONARY_PRIORITY_STRATEGY, EDITOR_URL, IS_ENABLED, LIVE_SYNC, LIVE_SYNC_PORT, PORT } from \"../defaultValues/editor.mjs\";\nimport { DEFAULT_LOCALE, LOCALES, REQUIRED_LOCALES, STRICT_MODE } from \"../defaultValues/internationalization.mjs\";\nimport { MODE, PREFIX } from \"../defaultValues/log.mjs\";\nimport { BASE_PATH, ROUTING_MODE, STORAGE } from \"../defaultValues/routing.mjs\";\nimport { isAbsolute, join } from \"node:path\";\n\n//#region src/configFile/buildConfigurationFields.ts\nlet storedConfiguration;\nconst buildInternationalizationFields = (customConfiguration) => ({\n\tlocales: customConfiguration?.locales ?? LOCALES,\n\trequiredLocales: customConfiguration?.requiredLocales ?? customConfiguration?.locales ?? REQUIRED_LOCALES,\n\tstrictMode: customConfiguration?.strictMode ?? STRICT_MODE,\n\tdefaultLocale: customConfiguration?.defaultLocale ?? DEFAULT_LOCALE\n});\nconst buildRoutingFields = (customConfiguration) => ({\n\tmode: customConfiguration?.mode ?? ROUTING_MODE,\n\tstorage: customConfiguration?.storage ?? STORAGE,\n\tbasePath: customConfiguration?.basePath ?? BASE_PATH\n});\nconst buildContentFields = (customConfiguration, baseDir) => {\n\tconst notDerivedContentConfig = {\n\t\tfileExtensions: customConfiguration?.fileExtensions ?? FILE_EXTENSIONS,\n\t\tbaseDir: customConfiguration?.baseDir ?? baseDir ?? process.cwd(),\n\t\texcludedPath: customConfiguration?.excludedPath ?? EXCLUDED_PATHS,\n\t\twatch: customConfiguration?.watch ?? WATCH,\n\t\tformatCommand: customConfiguration?.formatCommand\n\t};\n\tconst optionalJoinBaseDir = (path) => {\n\t\tif (isAbsolute(path)) return path;\n\t\treturn join(notDerivedContentConfig.baseDir, path);\n\t};\n\tconst baseDirDerivedConfiguration = {\n\t\tcontentDir: (customConfiguration?.contentDir ?? CONTENT_DIR).map(optionalJoinBaseDir),\n\t\tmoduleAugmentationDir: optionalJoinBaseDir(customConfiguration?.moduleAugmentationDir ?? MODULE_AUGMENTATION_DIR),\n\t\tunmergedDictionariesDir: optionalJoinBaseDir(customConfiguration?.unmergedDictionariesDir ?? UNMERGED_DICTIONARIES_DIR),\n\t\tremoteDictionariesDir: optionalJoinBaseDir(customConfiguration?.remoteDictionariesDir ?? REMOTE_DICTIONARIES_DIR),\n\t\tdictionariesDir: optionalJoinBaseDir(customConfiguration?.dictionariesDir ?? DICTIONARIES_DIR),\n\t\tdynamicDictionariesDir: optionalJoinBaseDir(customConfiguration?.dynamicDictionariesDir ?? DYNAMIC_DICTIONARIES_DIR),\n\t\tfetchDictionariesDir: optionalJoinBaseDir(customConfiguration?.fetchDictionariesDir ?? FETCH_DICTIONARIES_DIR),\n\t\ttypesDir: optionalJoinBaseDir(customConfiguration?.typesDir ?? TYPES_DIR),\n\t\tmainDir: optionalJoinBaseDir(customConfiguration?.mainDir ?? MAIN_DIR),\n\t\tconfigDir: optionalJoinBaseDir(customConfiguration?.configDir ?? CONFIG_DIR),\n\t\tcacheDir: optionalJoinBaseDir(customConfiguration?.cacheDir ?? CACHE_DIR)\n\t};\n\tconst patternsConfiguration = {\n\t\twatchedFilesPattern: notDerivedContentConfig.fileExtensions.map((ext) => `/**/*${ext}`),\n\t\twatchedFilesPatternWithPath: notDerivedContentConfig.fileExtensions.flatMap((ext) => baseDirDerivedConfiguration.contentDir.map((contentDir) => `${normalizePath(contentDir)}/**/*${ext}`)),\n\t\toutputFilesPatternWithPath: `${normalizePath(baseDirDerivedConfiguration.dictionariesDir)}/**/*.json`\n\t};\n\treturn {\n\t\t...notDerivedContentConfig,\n\t\t...baseDirDerivedConfiguration,\n\t\t...patternsConfiguration\n\t};\n};\nconst buildEditorFields = (customConfiguration) => ({\n\tapplicationURL: customConfiguration?.applicationURL ?? APPLICATION_URL,\n\teditorURL: customConfiguration?.editorURL ?? EDITOR_URL,\n\tcmsURL: customConfiguration?.cmsURL ?? CMS_URL,\n\tbackendURL: customConfiguration?.backendURL ?? BACKEND_URL,\n\tport: customConfiguration?.port ?? PORT,\n\tenabled: customConfiguration?.enabled ?? IS_ENABLED,\n\tclientId: customConfiguration?.clientId ?? void 0,\n\tclientSecret: customConfiguration?.clientSecret ?? void 0,\n\tdictionaryPriorityStrategy: customConfiguration?.dictionaryPriorityStrategy ?? DICTIONARY_PRIORITY_STRATEGY,\n\tliveSync: customConfiguration?.liveSync ?? LIVE_SYNC,\n\tliveSyncPort: customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT,\n\tliveSyncURL: customConfiguration?.liveSyncURL ?? `http://localhost:${customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT}`\n});\nconst buildLogFields = (customConfiguration, logFunctions) => ({\n\tmode: customConfiguration?.mode ?? MODE,\n\tprefix: customConfiguration?.prefix ?? PREFIX,\n\terror: logFunctions?.error,\n\tlog: logFunctions?.log,\n\tinfo: logFunctions?.info,\n\twarn: logFunctions?.warn\n});\nconst buildAiFields = (customConfiguration) => ({\n\tprovider: customConfiguration?.provider,\n\tapiKey: customConfiguration?.apiKey,\n\tmodel: customConfiguration?.model,\n\ttemperature: customConfiguration?.temperature,\n\tapplicationContext: customConfiguration?.applicationContext\n});\nconst buildBuildFields = (customConfiguration) => ({\n\toptimize: customConfiguration?.optimize ?? OPTIMIZE,\n\timportMode: customConfiguration?.importMode ?? IMPORT_MODE,\n\ttraversePattern: customConfiguration?.traversePattern ?? TRAVERSE_PATTERN,\n\toutputFormat: customConfiguration?.outputFormat ?? OUTPUT_FORMAT,\n\tcache: customConfiguration?.cache ?? CACHE,\n\trequire: customConfiguration?.require\n});\nconst buildDictionaryFields = (customConfiguration) => ({ fill: customConfiguration?.fill ?? FILL });\n/**\n* Build the configuration fields by merging the default values with the custom configuration\n*/\nconst buildConfigurationFields = (customConfiguration, baseDir, logFunctions) => {\n\tstoredConfiguration = {\n\t\tinternationalization: buildInternationalizationFields(customConfiguration?.internationalization),\n\t\trouting: buildRoutingFields(customConfiguration?.routing),\n\t\tcontent: buildContentFields(customConfiguration?.content, baseDir),\n\t\teditor: buildEditorFields(customConfiguration?.editor),\n\t\tlog: buildLogFields(customConfiguration?.log, logFunctions),\n\t\tai: buildAiFields(customConfiguration?.ai),\n\t\tbuild: buildBuildFields(customConfiguration?.build),\n\t\tdictionary: buildDictionaryFields(customConfiguration?.dictionary),\n\t\tplugins: customConfiguration?.plugins\n\t};\n\treturn storedConfiguration;\n};\n\n//#endregion\nexport { buildConfigurationFields };\n//# sourceMappingURL=buildConfigurationFields.mjs.map"],"mappings":";;;;;;;;;;;AAWA,IAAI;AACJ,MAAM,mCAAmC,yBAAyB;CACjE,SAAS,qBAAqB,WAAW;CACzC,iBAAiB,qBAAqB,mBAAmB,qBAAqB,WAAW;CACzF,YAAY,qBAAqB,cAAc;CAC/C,eAAe,qBAAqB,iBAAiB;CACrD;AACD,MAAM,sBAAsB,yBAAyB;CACpD,MAAM,qBAAqB,QAAQ;CACnC,SAAS,qBAAqB,WAAW;CACzC,UAAU,qBAAqB,YAAY;CAC3C;AACD,MAAM,sBAAsB,qBAAqB,YAAY;CAC5D,MAAM,0BAA0B;EAC/B,gBAAgB,qBAAqB,kBAAkB;EACvD,SAAS,qBAAqB,WAAW,WAAW,QAAQ,KAAK;EACjE,cAAc,qBAAqB,gBAAgB;EACnD,OAAO,qBAAqB,SAAS;EACrC,eAAe,qBAAqB;EACpC;CACD,MAAM,uBAAuB,SAAS;AACrC,MAAI,WAAW,KAAK,CAAE,QAAO;AAC7B,SAAO,KAAK,wBAAwB,SAAS,KAAK;;CAEnD,MAAM,8BAA8B;EACnC,aAAa,qBAAqB,cAAc,aAAa,IAAI,oBAAoB;EACrF,uBAAuB,oBAAoB,qBAAqB,yBAAyB,wBAAwB;EACjH,yBAAyB,oBAAoB,qBAAqB,2BAA2B,0BAA0B;EACvH,uBAAuB,oBAAoB,qBAAqB,yBAAyB,wBAAwB;EACjH,iBAAiB,oBAAoB,qBAAqB,mBAAmB,iBAAiB;EAC9F,wBAAwB,oBAAoB,qBAAqB,0BAA0B,yBAAyB;EACpH,sBAAsB,oBAAoB,qBAAqB,wBAAwB,uBAAuB;EAC9G,UAAU,oBAAoB,qBAAqB,YAAY,UAAU;EACzE,SAAS,oBAAoB,qBAAqB,WAAW,SAAS;EACtE,WAAW,oBAAoB,qBAAqB,aAAa,WAAW;EAC5E,UAAU,oBAAoB,qBAAqB,YAAY,UAAU;EACzE;CACD,MAAM,wBAAwB;EAC7B,qBAAqB,wBAAwB,eAAe,KAAK,QAAQ,QAAQ,MAAM;EACvF,6BAA6B,wBAAwB,eAAe,SAAS,QAAQ,4BAA4B,WAAW,KAAK,eAAe,GAAG,cAAc,WAAW,CAAC,OAAO,MAAM,CAAC;EAC3L,4BAA4B,GAAG,cAAc,4BAA4B,gBAAgB,CAAC;EAC1F;AACD,QAAO;EACN,GAAG;EACH,GAAG;EACH,GAAG;EACH;;AAEF,MAAM,qBAAqB,yBAAyB;CACnD,gBAAgB,qBAAqB,kBAAkB;CACvD,WAAW,qBAAqB,aAAa;CAC7C,QAAQ,qBAAqB,UAAU;CACvC,YAAY,qBAAqB,cAAc;CAC/C,MAAM,qBAAqB,QAAQ;CACnC,SAAS,qBAAqB,WAAW;CACzC,UAAU,qBAAqB,YAAY,KAAK;CAChD,cAAc,qBAAqB,gBAAgB,KAAK;CACxD,4BAA4B,qBAAqB,8BAA8B;CAC/E,UAAU,qBAAqB,YAAY;CAC3C,cAAc,qBAAqB,gBAAgB;CACnD,aAAa,qBAAqB,eAAe,oBAAoB,qBAAqB,gBAAgB;CAC1G;AACD,MAAM,kBAAkB,qBAAqB,kBAAkB;CAC9D,MAAM,qBAAqB,QAAQ;CACnC,QAAQ,qBAAqB,UAAU;CACvC,OAAO,cAAc;CACrB,KAAK,cAAc;CACnB,MAAM,cAAc;CACpB,MAAM,cAAc;CACpB;AACD,MAAM,iBAAiB,yBAAyB;CAC/C,UAAU,qBAAqB;CAC/B,QAAQ,qBAAqB;CAC7B,OAAO,qBAAqB;CAC5B,aAAa,qBAAqB;CAClC,oBAAoB,qBAAqB;CACzC;AACD,MAAM,oBAAoB,yBAAyB;CAClD,UAAU,qBAAqB,YAAY;CAC3C,YAAY,qBAAqB,cAAc;CAC/C,iBAAiB,qBAAqB,mBAAmB;CACzD,cAAc,qBAAqB,gBAAgB;CACnD,OAAO,qBAAqB,SAAS;CACrC,SAAS,qBAAqB;CAC9B;AACD,MAAM,yBAAyB,yBAAyB,EAAE,MAAM,qBAAqB,QAAQ,MAAM;;;;AAInG,MAAM,4BAA4B,qBAAqB,SAAS,iBAAiB;AAChF,uBAAsB;EACrB,sBAAsB,gCAAgC,qBAAqB,qBAAqB;EAChG,SAAS,mBAAmB,qBAAqB,QAAQ;EACzD,SAAS,mBAAmB,qBAAqB,SAAS,QAAQ;EAClE,QAAQ,kBAAkB,qBAAqB,OAAO;EACtD,KAAK,eAAe,qBAAqB,KAAK,aAAa;EAC3D,IAAI,cAAc,qBAAqB,GAAG;EAC1C,OAAO,iBAAiB,qBAAqB,MAAM;EACnD,YAAY,sBAAsB,qBAAqB,WAAW;EAClE,SAAS,qBAAqB;EAC9B;AACD,QAAO"}