intlayer-editor 7.3.1 → 7.3.2-canary.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.
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vue-M1-XqLgv.js","assets/css-BtVcDqlU.js","assets/javascript-DLs729Nk.js","assets/typescript-Cju7JbYj.js","assets/json-D07AUpjp.js","assets/html-derivative-Cswrtqyq.js","assets/html-BOjX3v2Q.js","assets/bundle-web-XpyHnbkn.js","assets/index-DfNZ8e5l.js","assets/index-UvWk4YN-.css"])))=>i.map(i=>d[i]);
2
- import { r as reactExports, j as jsxRuntimeExports, C as CodeDefault, _ as __vitePreload } from "./index-DfNZ8e5l.js";
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vue-M1-XqLgv.js","assets/css-BtVcDqlU.js","assets/javascript-DLs729Nk.js","assets/typescript-Cju7JbYj.js","assets/json-D07AUpjp.js","assets/html-derivative-Cswrtqyq.js","assets/html-BOjX3v2Q.js","assets/bundle-web-CwhZ9yJS.js","assets/index-D-1HlMJm.js","assets/index-UvWk4YN-.css"])))=>i.map(i=>d[i]);
2
+ import { r as reactExports, j as jsxRuntimeExports, C as CodeDefault, _ as __vitePreload } from "./index-D-1HlMJm.js";
3
3
  const languageCache = /* @__PURE__ */ new Map();
4
4
  const themeCache = /* @__PURE__ */ new Map();
5
5
  const loadLanguage = async (lang) => {
@@ -60,7 +60,7 @@ const loadTheme = async (themeName) => {
60
60
  const highlightCode = async (code, lang, isDarkMode) => {
61
61
  const themeName = isDarkMode ? "github-dark" : "github-light";
62
62
  const [{ codeToHtml }, languageModule, themeModule] = await Promise.all([
63
- __vitePreload(() => import("./bundle-web-XpyHnbkn.js"), true ? __vite__mapDeps([7,8,9]) : void 0),
63
+ __vitePreload(() => import("./bundle-web-CwhZ9yJS.js"), true ? __vite__mapDeps([7,8,9]) : void 0),
64
64
  loadLanguage(lang),
65
65
  loadTheme(themeName)
66
66
  ]);
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-ChYFFmg7.js","assets/html-BOjX3v2Q.js","assets/javascript-DLs729Nk.js","assets/css-BtVcDqlU.js","assets/angular-ts-CpuGw9DZ.js","assets/scss-Dq-LbI_c.js","assets/astro-B0lt4qz0.js","assets/json-D07AUpjp.js","assets/typescript-Cju7JbYj.js","assets/postcss-kj1IbjVd.js","assets/tsx-B9RA6cgQ.js","assets/blade-DtOFwYfC.js","assets/html-derivative-Cswrtqyq.js","assets/xml-BMzZeaqs.js","assets/java-BfXh-0uJ.js","assets/sql-DzUuSofg.js","assets/coffee-DJkIX6_2.js","assets/cpp-zh2ePAE_.js","assets/regexp-BxWeO75u.js","assets/glsl-CGsiYPcu.js","assets/c-C4VtT7JA.js","assets/graphql-oNSp8dGZ.js","assets/jsx-BPmvoin2.js","assets/haml-BJ44RGT2.js","assets/handlebars-DTnHNTeU.js","assets/yaml-B_vW5iTY.js","assets/http-B1QlEqj7.js","assets/bash-Bz2gZrDc.js","assets/hurl-Br_hZn4E.js","assets/csv-Ba84L8e5.js","assets/jinja-BAZ4h1JD.js","assets/jison-Bwp1bXaL.js","assets/julia-D0f5tMoo.js","assets/python-CrdIx4PZ.js","assets/r-oprfD2-9.js","assets/marko-rwefYVra.js","assets/less-BAzLMJNR.js","assets/mdc-ucHOH9Vl.js","assets/markdown-F_EULe_G.js","assets/php-CI-6KGJr.js","assets/pug-C-LeC0-n.js","assets/svelte-CYSO_rLN.js","assets/ts-tags-DCkNjov3.js","assets/vue-M1-XqLgv.js","assets/vue-html-BzXE5pTE.js","assets/vue-vine-BT_ihGGO.js","assets/stylus-DXFa_2Jl.js"])))=>i.map(i=>d[i]);
2
- import { _ as __vitePreload } from "./index-DfNZ8e5l.js";
2
+ import { _ as __vitePreload } from "./index-D-1HlMJm.js";
3
3
  let ShikiError$2 = class ShikiError extends Error {
4
4
  constructor(message) {
5
5
  super(message);
@@ -12527,6 +12527,25 @@ function requireCompilerRuntime() {
12527
12527
  return compilerRuntime.exports;
12528
12528
  }
12529
12529
  var compilerRuntimeExports = /* @__PURE__ */ requireCompilerRuntime();
12530
+ const logger = (content2, details) => {
12531
+ const isVerbose = details?.isVerbose ?? false;
12532
+ const mode = details?.config?.mode ?? "default";
12533
+ const level = details?.level ?? "info";
12534
+ const prefix = details?.config?.prefix ? details?.config?.prefix : void 0;
12535
+ const log = details?.config?.log ?? console.log;
12536
+ const info = details?.config?.info ?? console.info;
12537
+ const warn = details?.config?.warn ?? console.warn;
12538
+ const error = details?.config?.error ?? console.error;
12539
+ const debug = details?.config?.debug ?? console.debug;
12540
+ if (mode === "disabled") return;
12541
+ if (isVerbose && mode !== "verbose") return;
12542
+ const flatContent = prefix ? [prefix, ...[content2].flat()] : [content2].flat();
12543
+ if (level === "debug") return debug(...flatContent);
12544
+ if (level === "info") return info(...flatContent);
12545
+ if (level === "warn") return warn(...flatContent);
12546
+ if (level === "error") return error(...flatContent);
12547
+ log(...flatContent);
12548
+ };
12530
12549
  let ANSIColors = /* @__PURE__ */ function(ANSIColors$1) {
12531
12550
  ANSIColors$1["RESET"] = "\x1B[0m";
12532
12551
  ANSIColors$1["GREY"] = "\x1B[90m";
@@ -12544,6 +12563,14 @@ let ANSIColors = /* @__PURE__ */ function(ANSIColors$1) {
12544
12563
  ANSIColors$1["BOLD"] = "\x1B[1m";
12545
12564
  return ANSIColors$1;
12546
12565
  }({});
12566
+ const getAppLogger = (configuration2, globalDetails) => (content2, details) => logger(content2, {
12567
+ ...details ?? {},
12568
+ config: {
12569
+ ...configuration2?.log,
12570
+ ...globalDetails?.config,
12571
+ ...details?.config ?? {}
12572
+ }
12573
+ });
12547
12574
  var __defProp$2 = Object.defineProperty;
12548
12575
  var __export$1 = (all, symbols) => {
12549
12576
  let target = {};
@@ -13729,12 +13756,40 @@ const getNesting = (dictionaryKey, path, props) => {
13729
13756
  }
13730
13757
  return dictionary;
13731
13758
  };
13732
- const getTranslation = (languageContent, locale, fallback) => {
13733
- let result = languageContent[locale];
13734
- if (fallback && !result) result = languageContent[fallback];
13759
+ const deepMergeWithFallback = (target, fallback) => {
13760
+ if (target === void 0) return fallback;
13761
+ if (fallback === void 0 || target === null || typeof target !== "object") return target;
13762
+ if (Array.isArray(target)) {
13763
+ if (!Array.isArray(fallback)) return target;
13764
+ return target.map((item, index2) => deepMergeWithFallback(item, fallback[index2]));
13765
+ }
13766
+ if (typeof fallback !== "object" || fallback === null) return target;
13767
+ const result = { ...target };
13768
+ const fallbackObj = fallback;
13769
+ const allKeys = /* @__PURE__ */ new Set([...Object.keys(result), ...Object.keys(fallbackObj)]);
13770
+ for (const key2 of allKeys) result[key2] = deepMergeWithFallback(result[key2], fallbackObj[key2]);
13771
+ return result;
13772
+ };
13773
+ const resolveLocaleContent = (languageContent, locale) => {
13774
+ const exactResult = languageContent[locale];
13775
+ if (exactResult !== void 0) return exactResult;
13776
+ const [languageSubtag] = locale.split("-");
13777
+ if (languageSubtag !== locale) {
13778
+ const subtagResult = languageContent[languageSubtag];
13779
+ if (subtagResult !== void 0) return subtagResult;
13780
+ }
13781
+ };
13782
+ const getTranslation = (languageContent, locale, fallback, onContentNotFound) => {
13783
+ const result = resolveLocaleContent(languageContent, locale);
13784
+ const fallbackResult = fallback ? resolveLocaleContent(languageContent, fallback) : void 0;
13785
+ if (result === void 0) {
13786
+ if (fallback) onContentNotFound?.(locale, fallback);
13787
+ return fallbackResult;
13788
+ }
13789
+ if (fallbackResult !== void 0) return deepMergeWithFallback(result, fallbackResult);
13735
13790
  return result;
13736
13791
  };
13737
- const translationPlugin = (locale, fallback) => ({
13792
+ const translationPlugin = (locale, fallback, onContentNotFound) => ({
13738
13793
  id: "translation-plugin",
13739
13794
  canHandle: (node) => typeof node === "object" && node?.nodeType === NodeType.Translation,
13740
13795
  transform: (node, props, deepTransformNode2) => {
@@ -13750,7 +13805,9 @@ const translationPlugin = (locale, fallback) => ({
13750
13805
  };
13751
13806
  result[key2] = deepTransformNode2(result[key2], childProps);
13752
13807
  }
13753
- return getTranslation(result, locale, fallback);
13808
+ return getTranslation(result, locale, fallback, (locale$1, fallback$1) => {
13809
+ onContentNotFound?.(locale$1, fallback$1, props.keyPath);
13810
+ });
13754
13811
  }
13755
13812
  });
13756
13813
  const enumerationPlugin = {
@@ -13840,16 +13897,26 @@ const filePlugin = {
13840
13897
  const internationalization = { "locales": ["en", "en-GB", "fr", "es", "de", "ja", "ko", "zh", "it", "pt", "hi", "ar", "ru"], "defaultLocale": "en" };
13841
13898
  const routing = { "mode": "prefix-no-default", "storage": ["cookie", "header"] };
13842
13899
  const editor$1 = { "applicationURL": "", "editorURL": "http://localhost:8000", "cmsURL": "https://intlayer.org", "backendURL": "https://back.intlayer.org", "port": 8e3, "enabled": true, "dictionaryPriorityStrategy": "local_first", "liveSync": true, "liveSyncPort": 4e3, "liveSyncURL": "http://localhost:4000" };
13900
+ const build = { "importMode": "static" };
13843
13901
  const configuration = {
13844
13902
  internationalization,
13845
13903
  routing,
13846
- editor: editor$1
13904
+ editor: editor$1,
13905
+ build
13847
13906
  };
13848
13907
  const getContent = (node, nodeProps, locale) => {
13849
13908
  const defaultLocale = configuration?.internationalization?.defaultLocale;
13909
+ const importMode = configuration?.build?.importMode;
13850
13910
  const plugins = [
13851
13911
  insertionPlugin,
13852
- translationPlugin(locale ?? defaultLocale, defaultLocale),
13912
+ translationPlugin(locale ?? defaultLocale, defaultLocale, (locale$1, fallback, keyPath) => {
13913
+ const logger2 = getAppLogger();
13914
+ if (importMode === "dynamic") logger2([
13915
+ `The locale ${locale$1} is not found, using fallback ${fallback}. Key path: ${keyPath.join(".")}.`,
13916
+ `In dynamic mode, intlayer will not load the fallback content in production, it will throw an error, or lead to undefined content.`,
13917
+ "You can detect missing content using the `npx intlayer test` command"
13918
+ ], { level: "error" });
13919
+ }),
13853
13920
  enumerationPlugin,
13854
13921
  conditionPlugin,
13855
13922
  nestedPlugin,
@@ -46528,7 +46595,7 @@ const FormLabelLayout = ({ children, isRequired, info, htmlFor, className }) =>
46528
46595
  }), info && /* @__PURE__ */ jsxRuntimeExports.jsx(InformationTag, { content: info })]
46529
46596
  });
46530
46597
  const FormItemLayout = ({ label, description, isRequired, info, children, showErrorMessage = true, htmlFor }) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Form.Item, {
46531
- className: "flex w-full flex-col gap-2 px-1 py-2",
46598
+ className: "flex w-full flex-col flex-wrap gap-2 px-1 py-2",
46532
46599
  children: [
46533
46600
  (description || label) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
46534
46601
  className: "flex flex-col gap-1 p-1 leading-none",
@@ -49617,7 +49684,7 @@ const CodeDefault = ({ children }) => /* @__PURE__ */ jsxRuntimeExports.jsx("div
49617
49684
  }, `line-${index2}-${line.slice(0, 10)}`)) })
49618
49685
  })
49619
49686
  });
49620
- const CodeBlockShiki = reactExports.lazy(() => __vitePreload(() => import("./CodeBlockShiki-C8Ml9WUx.js"), true ? [] : void 0).then((mod) => ({ default: mod.CodeBlockShiki })));
49687
+ const CodeBlockShiki = reactExports.lazy(() => __vitePreload(() => import("./CodeBlockShiki-CVgh8Zn9.js"), true ? [] : void 0).then((mod) => ({ default: mod.CodeBlockShiki })));
49621
49688
  const CodeBlock = ({ className, onChange, isEditable, children, lang, isDarkMode, ...props }) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
49622
49689
  className: cn$2("flex w-full min-w-0 max-w-full overflow-x-auto", className),
49623
49690
  ...props,
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>Intlayer Editor</title>
8
- <script type="module" crossorigin src="/assets/index-DfNZ8e5l.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-D-1HlMJm.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-UvWk4YN-.css">
10
10
  </head>
11
11
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intlayer-editor",
3
- "version": "7.3.1",
3
+ "version": "7.3.2-canary.0",
4
4
  "private": false,
5
5
  "description": "Integrate the Intlayer visual editor into your Intlayer projects, enabling CMS-like content management with multilingual support.",
6
6
  "keywords": [
@@ -85,32 +85,32 @@
85
85
  "typecheck": "tsc --project ./server/tsconfig.types.json --noEmit"
86
86
  },
87
87
  "dependencies": {
88
- "@intlayer/api": "7.3.1",
89
- "@intlayer/chokidar": "7.3.1",
90
- "@intlayer/config": "7.3.1",
91
- "@intlayer/core": "7.3.1",
92
- "@intlayer/design-system": "7.3.1",
93
- "@intlayer/editor-react": "7.3.1",
94
- "@intlayer/types": "7.3.1",
95
- "@intlayer/unmerged-dictionaries-entry": "7.3.1",
88
+ "@intlayer/api": "7.3.2-canary.0",
89
+ "@intlayer/chokidar": "7.3.2-canary.0",
90
+ "@intlayer/config": "7.3.2-canary.0",
91
+ "@intlayer/core": "7.3.2-canary.0",
92
+ "@intlayer/design-system": "7.3.2-canary.0",
93
+ "@intlayer/editor-react": "7.3.2-canary.0",
94
+ "@intlayer/types": "7.3.2-canary.0",
95
+ "@intlayer/unmerged-dictionaries-entry": "7.3.2-canary.0",
96
96
  "@tanstack/react-query": "5.90.10",
97
97
  "compression": "1.8.1",
98
98
  "cookie-parser": "1.4.7",
99
99
  "cors": "2.8.5",
100
100
  "express": "5.1.0",
101
- "express-intlayer": "7.3.1",
101
+ "express-intlayer": "7.3.2-canary.0",
102
102
  "framer-motion": "12.23.24",
103
103
  "fuse.js": "7.1.0",
104
104
  "helmet": "8.1.0",
105
- "intlayer": "7.3.1",
105
+ "intlayer": "7.3.2-canary.0",
106
106
  "lucide-react": "0.554.0",
107
107
  "mime": "4.1.0",
108
108
  "react": "19.2.0",
109
109
  "react-dom": "19.2.0",
110
- "react-intlayer": "7.3.1",
110
+ "react-intlayer": "7.3.2-canary.0",
111
111
  "react-router-dom": "7.9.5",
112
112
  "rimraf": "6.1.2",
113
- "vite-intlayer": "7.3.1"
113
+ "vite-intlayer": "7.3.2-canary.0"
114
114
  },
115
115
  "devDependencies": {
116
116
  "@tailwindcss/vite": "4.1.16",
@@ -135,13 +135,13 @@
135
135
  "peerDependencies": {
136
136
  "clsx": "2.1.1",
137
137
  "framer-motion": "12.23.24",
138
- "intlayer": "7.3.1",
138
+ "intlayer": "7.3.2-canary.0",
139
139
  "react": ">=16.0.0",
140
140
  "react-dom": ">=16.0.0",
141
- "react-intlayer": "7.3.1",
141
+ "react-intlayer": "7.3.2-canary.0",
142
142
  "react-router-dom": ">=6.0.0",
143
143
  "tailwind-merge": "3.4.0",
144
- "vite-intlayer": "7.3.1"
144
+ "vite-intlayer": "7.3.2-canary.0"
145
145
  },
146
146
  "engines": {
147
147
  "node": ">=14.18"