magic-editor-x 2.4.0 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/README.md +140 -62
  3. package/bin/magic-editor-x.mjs +55 -8
  4. package/dist/admin/{AuditPage-guB0SiGS.mjs → AuditPage-Be78C7EC.mjs} +4 -3
  5. package/dist/admin/{AuditPage-C2u6z4aN.js → AuditPage-iQzpjH8H.js} +7 -6
  6. package/dist/admin/{ConfigurationPage-DiEpF1Rr.mjs → ConfigurationPage-C9CPBfWy.mjs} +186 -6
  7. package/dist/admin/{ConfigurationPage-D6uya-J1.js → ConfigurationPage-DefuBeYO.js} +191 -11
  8. package/dist/admin/Content-BttG50Mc.mjs +360 -0
  9. package/dist/admin/Content-V5MRBsI3.js +362 -0
  10. package/dist/admin/{CustomBlocksPage-Byt10-6c.mjs → CustomBlocksPage-DB5nnCsn.mjs} +5 -4
  11. package/dist/admin/{CustomBlocksPage-DP3h_wNd.js → CustomBlocksPage-Dg2rM3F4.js} +8 -7
  12. package/dist/admin/EntryWidgets-B8YA0Zxy.mjs +199 -0
  13. package/dist/admin/EntryWidgets-BcXAAx3F.js +201 -0
  14. package/dist/admin/{MentionsWidget-sMkM9mHX.mjs → MentionsWidget-CJPZDk9Z.mjs} +2 -2
  15. package/dist/admin/{MentionsWidget-C2OCAmqq.js → MentionsWidget-DUz6YVIG.js} +2 -2
  16. package/dist/admin/{useT-CLPhBmBC.mjs → SectionCard-8ZNHkvn9.mjs} +2 -12
  17. package/dist/admin/{useT-BXJLIPN4.js → SectionCard-Bs-xiiH1.js} +0 -10
  18. package/dist/admin/{TemplatesPage-Yp4OqFE2.mjs → TemplatesPage-VsZ_Mc0R.mjs} +6 -5
  19. package/dist/admin/{TemplatesPage-DrSJdteI.js → TemplatesPage-dx4_yd_t.js} +13 -12
  20. package/dist/admin/{api-bix9RLLI.js → api-4AYzwS4-.js} +9 -1
  21. package/dist/admin/{api-2ZRpHM3d.mjs → api-CcTYyckq.mjs} +9 -1
  22. package/dist/admin/{de-zcV8D7nt.js → de-B6rdcOqQ.js} +103 -1
  23. package/dist/admin/{de-1cFMs-4c.mjs → de-BWfR2jTg.mjs} +8 -1
  24. package/dist/admin/{de-DiCZrmH8.mjs → de-Bip0sBRT.mjs} +19 -1
  25. package/dist/admin/{de-Dn8athM8.js → de-BrPR4sUB.js} +8 -1
  26. package/dist/admin/{de-CKz6CG3V.mjs → de-CQA8hOpl.mjs} +103 -1
  27. package/dist/admin/{de-CbBDnXeT.js → de-CnnxKXj7.js} +19 -1
  28. package/dist/admin/{de-BhhGss1l.js → de-Dss5POqk.js} +12 -1
  29. package/dist/admin/{de-BNPIGqhs.mjs → de-zgHCYTLH.mjs} +12 -1
  30. package/dist/admin/{en-CIZ5Ggod.js → en--JjAHbpP.js} +8 -1
  31. package/dist/admin/{en-cYzqbASF.mjs → en-BCKaVgBM.mjs} +103 -1
  32. package/dist/admin/{en-B9ApE1y1.js → en-CJ17Sp_e.js} +12 -1
  33. package/dist/admin/{en-BMWhILnj.js → en-CbGkcq0Q.js} +103 -1
  34. package/dist/admin/{en-DCPMqFIa.mjs → en-Cd6Jk-J0.mjs} +19 -1
  35. package/dist/admin/{en-CpehF0Kv.js → en-D69Fe9ZO.js} +19 -1
  36. package/dist/admin/{en-Dc9y-6n9.mjs → en-Dr58wBAo.mjs} +8 -1
  37. package/dist/admin/{en-gFLeK9Ng.mjs → en-Uhm7OouM.mjs} +12 -1
  38. package/dist/admin/entry-panel-events-0msyPrAD.js +18 -0
  39. package/dist/admin/entry-panel-events-XRuUoLZ9.mjs +19 -0
  40. package/dist/admin/{es-D2Kw6E4N.mjs → es-B2Hkkbw9.mjs} +8 -1
  41. package/dist/admin/{es-BmwBgEgz.mjs → es-BMkmfH88.mjs} +12 -1
  42. package/dist/admin/{es-Chs37IBR.mjs → es-Bz8d72Fa.mjs} +19 -1
  43. package/dist/admin/{es-CQPh8PXw.js → es-C8UotT8O.js} +103 -1
  44. package/dist/admin/{es-CawpzwyC.js → es-CcEDZpVQ.js} +19 -1
  45. package/dist/admin/{es-C0W31rl8.js → es-DJm3HFJt.js} +12 -1
  46. package/dist/admin/{es-C4IRHV5d.js → es-YvaTAtqY.js} +8 -1
  47. package/dist/admin/{es-DCamt1ek.mjs → es-pvPfNAld.mjs} +103 -1
  48. package/dist/admin/{fr-BOvvfEH7.mjs → fr-BvPjRiwr.mjs} +8 -1
  49. package/dist/admin/{fr-Dp5-XP29.mjs → fr-CKHZ0xxU.mjs} +19 -1
  50. package/dist/admin/{fr-iGeIfEcU.js → fr-CRM9VuAq.js} +12 -1
  51. package/dist/admin/{fr-CMWBNE5D.mjs → fr-CrIHmKYX.mjs} +12 -1
  52. package/dist/admin/{fr-COOsqexl.js → fr-Cx29jQ_g.js} +19 -1
  53. package/dist/admin/{fr-oW0t8bT5.mjs → fr-D4tL6Ag2.mjs} +103 -1
  54. package/dist/admin/{fr-Zkb8vfjN.js → fr-Di-U-rAH.js} +8 -1
  55. package/dist/admin/{fr-DpC44Ol8.js → fr-DrUYv2jh.js} +103 -1
  56. package/dist/admin/{index-BVjf1gVC.mjs → index-C4ksUkEm.mjs} +9183 -6353
  57. package/dist/admin/{index-64wc26Bl.js → index-C5D3VqLq.js} +9170 -6340
  58. package/dist/admin/{index-D_Fv8Non.mjs → index-CMYCZWOh.mjs} +1053 -190
  59. package/dist/admin/{index-D6Z7i8ba.js → index-DRyctF9s.js} +961 -98
  60. package/dist/admin/index.js +1 -1
  61. package/dist/admin/index.mjs +2 -2
  62. package/dist/admin/{math-vsK_06ZR.js → math-D6jmskGS.js} +1 -1
  63. package/dist/admin/{math-CIQ4Z_mY.mjs → math-DntdSWKX.mjs} +1 -1
  64. package/dist/admin/{pt-DALDvfBn.mjs → pt-B8x7v-Xw.mjs} +19 -1
  65. package/dist/admin/{pt-DXy7G1x7.js → pt-BYn2xx78.js} +19 -1
  66. package/dist/admin/{pt-Bo0Pm_Pt.js → pt-CojQcz-p.js} +103 -1
  67. package/dist/admin/{pt-uGpfRQLC.mjs → pt-CuoIihKx.mjs} +103 -1
  68. package/dist/admin/{pt-1IUyx6ae.js → pt-CzrN_3ui.js} +8 -1
  69. package/dist/admin/{pt-DFNgZ5_k.mjs → pt-DDlPJYtB.mjs} +12 -1
  70. package/dist/admin/{pt-BHmXk2d9.js → pt-DPVAycXJ.js} +12 -1
  71. package/dist/admin/{pt-etwsg3G4.mjs → pt-DdGagO99.mjs} +8 -1
  72. package/dist/admin/useT-Bpw__IXT.js +12 -0
  73. package/dist/admin/useT-Cb-R3kyA.mjs +13 -0
  74. package/dist/blocks/index.d.mts +124 -0
  75. package/dist/blocks/index.d.ts +124 -0
  76. package/dist/blocks/index.js +172 -3
  77. package/dist/blocks/index.mjs +172 -3
  78. package/dist/math/index.js +6 -2
  79. package/dist/math/index.mjs +6 -2
  80. package/dist/react/index.js +1376 -1067
  81. package/dist/react/index.mjs +1376 -1067
  82. package/dist/render/index.d.mts +22 -0
  83. package/dist/render/index.d.ts +22 -0
  84. package/dist/render/index.js +1376 -1067
  85. package/dist/render/index.mjs +1376 -1067
  86. package/dist/server/index.js +28894 -24197
  87. package/dist/server/index.mjs +28893 -24196
  88. package/dist/server/mcp-worker.js +11319 -0
  89. package/dist/vue/index.js +1376 -1067
  90. package/dist/vue/index.mjs +1376 -1067
  91. package/package.json +7 -7
  92. package/schema/magic-editor-x.schema.json +9 -1
  93. package/types/blocks.d.ts +124 -0
  94. package/types/index.d.ts +10 -1
  95. package/types/render.d.ts +22 -0
@@ -4,10 +4,11 @@ import { useIntl } from "react-intl";
4
4
  import { Flex, Typography, Button, Loader, EmptyStateLayout, Box, Badge, Table, Thead, Tr, Th, Tbody, Td, Alert, Grid, Field, SingleSelect, SingleSelectOption, TextInput } from "@strapi/design-system";
5
5
  import { ArrowClockwise, Filter } from "@strapi/icons";
6
6
  import { useFetchClient, useRBAC, useQueryParams, Page, Pagination } from "@strapi/strapi/admin";
7
- import { P as PERMISSIONS } from "./index-D_Fv8Non.mjs";
8
- import { A as API } from "./api-2ZRpHM3d.mjs";
9
- import { u as useT, P as PageShell, S as SectionCard } from "./useT-CLPhBmBC.mjs";
7
+ import { P as PERMISSIONS } from "./index-CMYCZWOh.mjs";
8
+ import { A as API } from "./api-CcTYyckq.mjs";
9
+ import { P as PageShell, S as SectionCard } from "./SectionCard-8ZNHkvn9.mjs";
10
10
  import { u as useBreakpoint } from "./useBreakpoint-DCfn6pDG.mjs";
11
+ import { u as useT } from "./useT-Cb-R3kyA.mjs";
11
12
  import { c as changeSummary, e as eventLabel, a as actorLabel, E as EVENT_LABELS } from "./auditText-DIIYVR6k.mjs";
12
13
  const ALL = "__all__";
13
14
  const UID_PATTERN = /^(api|plugin)::[a-z0-9-]{1,60}\.[a-z0-9-]{1,60}$/;
@@ -6,10 +6,11 @@ const reactIntl = require("react-intl");
6
6
  const designSystem = require("@strapi/design-system");
7
7
  const icons = require("@strapi/icons");
8
8
  const admin = require("@strapi/strapi/admin");
9
- const index = require("./index-D6Z7i8ba.js");
10
- const api = require("./api-bix9RLLI.js");
11
- const useT = require("./useT-BXJLIPN4.js");
9
+ const index = require("./index-DRyctF9s.js");
10
+ const api = require("./api-4AYzwS4-.js");
11
+ const SectionCard = require("./SectionCard-Bs-xiiH1.js");
12
12
  const useBreakpoint = require("./useBreakpoint-D30eNTkF.js");
13
+ const useT = require("./useT-Bpw__IXT.js");
13
14
  const auditText = require("./auditText-DUhWu2Nx.js");
14
15
  const ALL = "__all__";
15
16
  const UID_PATTERN = /^(api|plugin)::[a-z0-9-]{1,60}\.[a-z0-9-]{1,60}$/;
@@ -40,7 +41,7 @@ const AuditFilters = ({ t, applied, actors, active, onApply, onReset }) => {
40
41
  };
41
42
  const reset = onReset;
42
43
  return /* @__PURE__ */ jsxRuntime.jsx(
43
- useT.SectionCard,
44
+ SectionCard.SectionCard,
44
45
  {
45
46
  title: t("settings.audit.filters", "Filters"),
46
47
  action: active ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", onClick: reset, children: t("settings.audit.reset", "Reset filters") }) : null,
@@ -318,7 +319,7 @@ const AuditPage = () => {
318
319
  ] });
319
320
  }
320
321
  return /* @__PURE__ */ jsxRuntime.jsxs(
321
- useT.PageShell,
322
+ SectionCard.PageShell,
322
323
  {
323
324
  title,
324
325
  subtitle: t(
@@ -350,7 +351,7 @@ const AuditPage = () => {
350
351
  ) : null,
351
352
  filters,
352
353
  /* @__PURE__ */ jsxRuntime.jsxs(
353
- useT.SectionCard,
354
+ SectionCard.SectionCard,
354
355
  {
355
356
  title: t("settings.audit.results", "Events"),
356
357
  subtitle: state.pagination ? t("settings.audit.total", "{total, plural, one {# event} other {# events}}", {
@@ -1,14 +1,15 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { useState, useRef, useEffect, useCallback, useMemo } from "react";
3
3
  import { Box, Flex, Typography, Switch, Grid, Field, SingleSelect, SingleSelectOption, TextInput, TextButton, NumberInput, Button, Badge, Alert, IconButton } from "@strapi/design-system";
4
4
  import { useFetchClient, useClipboard, useNotification, useRBAC, Page, Form, Blocker } from "@strapi/strapi/admin";
5
5
  import { Duplicate, Play, Check } from "@strapi/icons";
6
- import { P as PERMISSIONS } from "./index-D_Fv8Non.mjs";
7
- import { u as useT, S as SectionCard, P as PageShell } from "./useT-CLPhBmBC.mjs";
6
+ import { t as tokenLabel, i as isHexColor, P as PERMISSIONS } from "./index-CMYCZWOh.mjs";
7
+ import { S as SectionCard, P as PageShell } from "./SectionCard-8ZNHkvn9.mjs";
8
8
  import { C as ConfirmAction } from "./ConfirmAction-CZjpduc3.mjs";
9
9
  import { D as DraftSync } from "./DraftSync-CUxOMG-E.mjs";
10
10
  import styled from "styled-components";
11
- import { A as API, r as readApiError } from "./api-2ZRpHM3d.mjs";
11
+ import { u as useT } from "./useT-Cb-R3kyA.mjs";
12
+ import { A as API, r as readApiError } from "./api-CcTYyckq.mjs";
12
13
  import { useIntl } from "react-intl";
13
14
  const PropertyList = ({ items }) => /* @__PURE__ */ jsx(Box, { tag: "dl", margin: 0, children: /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 3, children: items.map((item) => /* @__PURE__ */ jsxs(
14
15
  Flex,
@@ -718,6 +719,24 @@ const EnvironmentSection = ({ environment }) => {
718
719
  const collaboration = environment.collaboration || {};
719
720
  const linkSchedule = environment.linkSchedule || null;
720
721
  const privateImages = Array.isArray(environment.altTextPrivateOrigins) ? environment.altTextPrivateOrigins : [];
722
+ const mcp = environment.mcp || {};
723
+ let mcpHint;
724
+ if (mcp.active)
725
+ mcpHint = t(
726
+ "settings.environment.mcpOn",
727
+ 'AI clients connect to {path} with an admin token. Give the token the permission "Use the MCP tools" under Plugins > Magic Editor X. The tools convert, check and render content; they never read or save entries.',
728
+ { path: mcp.path || "/mcp" }
729
+ );
730
+ else if (mcp.enabled)
731
+ mcpHint = t(
732
+ "settings.environment.mcpServerOff",
733
+ "Turned on (mcp.enabled), but Strapi's MCP server is off. Set server.mcp.enabled to true in config/server and restart."
734
+ );
735
+ else
736
+ mcpHint = t(
737
+ "settings.environment.mcpOff",
738
+ "Turn on with mcp.enabled in config/plugins and server.mcp.enabled in config/server, then restart."
739
+ );
721
740
  const lastRun = linkSchedule && linkSchedule.lastRun;
722
741
  let linkScheduleHint;
723
742
  if (linkSchedule && linkSchedule.enabled) {
@@ -833,6 +852,13 @@ const EnvironmentSection = ({ environment }) => {
833
852
  "settings.environment.privateAiHint",
834
853
  "Needed for local models on localhost or a private network (ai.allowPrivateBaseUrl)."
835
854
  )
855
+ },
856
+ // 2.5: MCP tools for AI clients (config only).
857
+ {
858
+ key: "mcp",
859
+ label: t("settings.environment.mcp", "Tools for AI clients (MCP)"),
860
+ value: on(Boolean(mcp.active)),
861
+ hint: mcpHint
836
862
  }
837
863
  ]
838
864
  }
@@ -840,7 +866,7 @@ const EnvironmentSection = ({ environment }) => {
840
866
  }
841
867
  );
842
868
  };
843
- const CodeBlock = styled.pre`
869
+ const CodeBlock$1 = styled.pre`
844
870
  margin: 0;
845
871
  max-width: 100%;
846
872
  overflow-x: auto;
@@ -948,7 +974,7 @@ const CspSection = ({ csp }) => {
948
974
  /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", id: "mex-csp-snippet-label", children: codeLabel }),
949
975
  /* @__PURE__ */ jsx(IconButton, { label: t("settings.csp.copy", "Copy the snippet"), variant: "tertiary", onClick: onCopy, children: /* @__PURE__ */ jsx(Duplicate, {}) })
950
976
  ] }),
951
- /* @__PURE__ */ jsx(Box, { minWidth: 0, children: /* @__PURE__ */ jsx(CodeBlock, { ref: codeRef, tabIndex: 0, "aria-labelledby": "mex-csp-snippet-label", children: /* @__PURE__ */ jsx("code", { children: csp.snippet }) }) }),
977
+ /* @__PURE__ */ jsx(Box, { minWidth: 0, children: /* @__PURE__ */ jsx(CodeBlock$1, { ref: codeRef, tabIndex: 0, "aria-labelledby": "mex-csp-snippet-label", children: /* @__PURE__ */ jsx("code", { children: csp.snippet }) }) }),
952
978
  /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: t(
953
979
  "settings.csp.mergeHint",
954
980
  "Keep your other directives (for example the hosts of your upload provider) and restart Strapi after the change."
@@ -958,6 +984,159 @@ const CspSection = ({ csp }) => {
958
984
  }
959
985
  );
960
986
  };
987
+ const Swatch = styled.span`
988
+ display: inline-block;
989
+ flex: 0 0 auto;
990
+ width: 2.4rem;
991
+ height: 2.4rem;
992
+ border-radius: ${({ theme }) => theme.borderRadius};
993
+ border: 1px solid ${({ theme }) => theme.colors.neutral300};
994
+ background: ${({ $color }) => isHexColor($color) ? $color : "transparent"};
995
+ `;
996
+ const CodeBlock = styled.pre`
997
+ margin: 0;
998
+ max-width: 100%;
999
+ max-height: 24rem;
1000
+ overflow: auto;
1001
+ padding: ${({ theme }) => theme.spaces[4]};
1002
+ border: 1px solid ${({ theme }) => theme.colors.neutral200};
1003
+ border-radius: ${({ theme }) => theme.borderRadius};
1004
+ background: ${({ theme }) => theme.colors.neutral100};
1005
+ color: ${({ theme }) => theme.colors.neutral800};
1006
+ font-family: 'SF Mono', SFMono-Regular, ui-monospace, Menlo, Consolas, monospace;
1007
+ font-size: ${({ theme }) => theme.fontSizes[1]};
1008
+ line-height: 1.6;
1009
+ white-space: pre;
1010
+
1011
+ &:focus-visible {
1012
+ outline: 2px solid ${({ theme }) => theme.colors.primary600};
1013
+ outline-offset: 2px;
1014
+ }
1015
+ `;
1016
+ const TokenList = styled.ul`
1017
+ margin: 0;
1018
+ padding: 0;
1019
+ list-style: none;
1020
+ display: grid;
1021
+ grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
1022
+ gap: ${({ theme }) => theme.spaces[3]};
1023
+ `;
1024
+ const TokenItem = ({ token, locale, t }) => /* @__PURE__ */ jsx(Box, { tag: "li", minWidth: 0, children: /* @__PURE__ */ jsxs(Flex, { gap: 2, alignItems: "center", minWidth: 0, children: [
1025
+ /* @__PURE__ */ jsx(Swatch, { $color: token.light, title: t("settings.palette.light", "Light theme"), "aria-hidden": "true" }),
1026
+ /* @__PURE__ */ jsx(Swatch, { $color: token.dark, title: t("settings.palette.dark", "Dark theme"), "aria-hidden": "true" }),
1027
+ /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", minWidth: 0, children: [
1028
+ /* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "semiBold", textColor: "neutral800", children: tokenLabel(token, locale) }),
1029
+ /* @__PURE__ */ jsxs(Typography, { variant: "pi", textColor: "neutral600", style: { overflowWrap: "anywhere" }, children: [
1030
+ token.name,
1031
+ " · ",
1032
+ token.light,
1033
+ " / ",
1034
+ token.dark
1035
+ ] })
1036
+ ] })
1037
+ ] }) });
1038
+ const PaletteSection = ({ palette }) => {
1039
+ const t = useT();
1040
+ const { locale } = useIntl();
1041
+ const { copy } = useClipboard();
1042
+ const codeRef = useRef(null);
1043
+ const [alertOpen, setAlertOpen] = useState(true);
1044
+ if (!palette) return null;
1045
+ const colors = Array.isArray(palette.colors) ? palette.colors : [];
1046
+ const highlights = Array.isArray(palette.highlights) ? palette.highlights : [];
1047
+ const issues = Array.isArray(palette.issues) ? palette.issues : [];
1048
+ const annotations = Array.isArray(palette.annotations) ? palette.annotations : [];
1049
+ const empty = !colors.length && !highlights.length;
1050
+ const pairText = (issue) => t(
1051
+ "settings.palette.issue",
1052
+ "{mode, select, dark {Dark theme} other {Light theme}}: {pair} has contrast {ratio}:1 (needs 4.5:1)",
1053
+ {
1054
+ mode: issue.mode,
1055
+ pair: `${issue.color || t("settings.palette.defaultText", "default text")} / ${issue.highlight || t("settings.palette.page", "page background")}`,
1056
+ ratio: issue.ratio
1057
+ }
1058
+ );
1059
+ const onCopy = async () => {
1060
+ if (!await copy(palette.css) && codeRef.current) {
1061
+ const range = document.createRange();
1062
+ range.selectNodeContents(codeRef.current);
1063
+ const selection = window.getSelection();
1064
+ selection.removeAllRanges();
1065
+ selection.addRange(range);
1066
+ codeRef.current.focus();
1067
+ }
1068
+ };
1069
+ return /* @__PURE__ */ jsxs(
1070
+ SectionCard,
1071
+ {
1072
+ title: t("settings.palette.title", "Text colours and highlights"),
1073
+ subtitle: t(
1074
+ "settings.palette.subtitle",
1075
+ 'Defined in the plugin configuration (config/plugins.js, key palette). Fields offer them when the field option "Text colour and highlight" is on.'
1076
+ ),
1077
+ children: [
1078
+ empty ? /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral600", children: t(
1079
+ "settings.palette.empty",
1080
+ "No palette is configured, so editors see no colour tool. Ask your developer to add colour tokens to the plugin configuration."
1081
+ ) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
1082
+ issues.length && alertOpen ? (
1083
+ // The Alert renders its children inside a paragraph: the list follows it (no <ul> in <p>).
1084
+ /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
1085
+ /* @__PURE__ */ jsx(
1086
+ Alert,
1087
+ {
1088
+ variant: "warning",
1089
+ closeLabel: t("settings.close", "Close"),
1090
+ onClose: () => setAlertOpen(false),
1091
+ children: t(
1092
+ "settings.palette.issuesTitle",
1093
+ "{count, plural, one {# combination is} other {# combinations are}} hard to read",
1094
+ { count: issues.length }
1095
+ )
1096
+ }
1097
+ ),
1098
+ /* @__PURE__ */ jsx(Box, { tag: "ul", paddingLeft: 4, margin: 0, children: issues.slice(0, 20).map((issue) => /* @__PURE__ */ jsx(
1099
+ Typography,
1100
+ {
1101
+ tag: "li",
1102
+ variant: "omega",
1103
+ children: pairText(issue)
1104
+ },
1105
+ `${issue.mode}|${issue.color}|${issue.highlight}`
1106
+ )) })
1107
+ ] })
1108
+ ) : null,
1109
+ colors.length ? /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
1110
+ /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", tag: "h3", children: t("settings.palette.colors", "Text colours") }),
1111
+ /* @__PURE__ */ jsx(TokenList, { children: colors.map((token) => /* @__PURE__ */ jsx(TokenItem, { token, locale, t }, token.name)) })
1112
+ ] }) : null,
1113
+ highlights.length ? /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
1114
+ /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", tag: "h3", children: t("settings.palette.highlights", "Highlights") }),
1115
+ /* @__PURE__ */ jsx(TokenList, { children: highlights.map((token) => /* @__PURE__ */ jsx(TokenItem, { token, locale, t }, token.name)) })
1116
+ ] }) : null,
1117
+ /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 2, minWidth: 0, children: [
1118
+ /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", gap: 2, wrap: "wrap", children: [
1119
+ /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", id: "mex-palette-css-label", tag: "h3", children: t("settings.palette.css", "CSS for your site") }),
1120
+ /* @__PURE__ */ jsx(
1121
+ IconButton,
1122
+ {
1123
+ label: t("settings.palette.copy", "Copy the CSS"),
1124
+ variant: "tertiary",
1125
+ onClick: onCopy,
1126
+ children: /* @__PURE__ */ jsx(Duplicate, {})
1127
+ }
1128
+ )
1129
+ ] }),
1130
+ /* @__PURE__ */ jsx(Box, { minWidth: 0, children: /* @__PURE__ */ jsx(CodeBlock, { ref: codeRef, tabIndex: 0, "aria-labelledby": "mex-palette-css-label", children: /* @__PURE__ */ jsx("code", { children: palette.css }) }) })
1131
+ ] })
1132
+ ] }),
1133
+ annotations.length ? /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: t("settings.palette.annotations", 'Annotations for the field option "Annotations": {names}', {
1134
+ names: annotations.map((item) => item.name).join(", ")
1135
+ }) }) : null
1136
+ ]
1137
+ }
1138
+ );
1139
+ };
961
1140
  const hostOf = (t, baseUrl) => {
962
1141
  try {
963
1142
  return new URL(baseUrl).host || t("settings.languageTool.server", "the LanguageTool server");
@@ -1516,6 +1695,7 @@ const ConfigurationPage = () => {
1516
1695
  }
1517
1696
  ),
1518
1697
  /* @__PURE__ */ jsx(CspSection, { csp: form.dto.environment && form.dto.environment.csp }),
1698
+ /* @__PURE__ */ jsx(PaletteSection, { palette: form.dto.environment && form.dto.environment.palette }),
1519
1699
  /* @__PURE__ */ jsxs(Form, { method: "PUT", initialValues: form.saved, children: [
1520
1700
  /* @__PURE__ */ jsx(DraftSync, { values: form.draft }),
1521
1701
  /* @__PURE__ */ jsx(Blocker, {})
@@ -5,12 +5,13 @@ const ReactNamespace = require("react");
5
5
  const designSystem = require("@strapi/design-system");
6
6
  const admin = require("@strapi/strapi/admin");
7
7
  const icons = require("@strapi/icons");
8
- const index = require("./index-D6Z7i8ba.js");
9
- const useT = require("./useT-BXJLIPN4.js");
8
+ const index = require("./index-DRyctF9s.js");
9
+ const SectionCard = require("./SectionCard-Bs-xiiH1.js");
10
10
  const ConfirmAction = require("./ConfirmAction-CUhpngYU.js");
11
11
  const DraftSync = require("./DraftSync-BIA8cZgA.js");
12
12
  const styled = require("styled-components");
13
- const api = require("./api-bix9RLLI.js");
13
+ const useT = require("./useT-Bpw__IXT.js");
14
+ const api = require("./api-4AYzwS4-.js");
14
15
  const reactIntl = require("react-intl");
15
16
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
16
17
  const styled__default = /* @__PURE__ */ _interopDefault(styled);
@@ -470,7 +471,7 @@ const AiSection = ({ form, readOnly, onTest }) => {
470
471
  const defaults = dto.environment.defaults || { models: {}, baseUrls: {} };
471
472
  const keyDisabled = readOnly || ai.apiKeyFromEnvironment || !ai.canStoreApiKey;
472
473
  return /* @__PURE__ */ jsxRuntime.jsxs(
473
- useT.SectionCard,
474
+ SectionCard.SectionCard,
474
475
  {
475
476
  title: t("settings.ai.title", "AI assistant"),
476
477
  subtitle: t(
@@ -722,6 +723,24 @@ const EnvironmentSection = ({ environment }) => {
722
723
  const collaboration = environment.collaboration || {};
723
724
  const linkSchedule = environment.linkSchedule || null;
724
725
  const privateImages = Array.isArray(environment.altTextPrivateOrigins) ? environment.altTextPrivateOrigins : [];
726
+ const mcp = environment.mcp || {};
727
+ let mcpHint;
728
+ if (mcp.active)
729
+ mcpHint = t(
730
+ "settings.environment.mcpOn",
731
+ 'AI clients connect to {path} with an admin token. Give the token the permission "Use the MCP tools" under Plugins > Magic Editor X. The tools convert, check and render content; they never read or save entries.',
732
+ { path: mcp.path || "/mcp" }
733
+ );
734
+ else if (mcp.enabled)
735
+ mcpHint = t(
736
+ "settings.environment.mcpServerOff",
737
+ "Turned on (mcp.enabled), but Strapi's MCP server is off. Set server.mcp.enabled to true in config/server and restart."
738
+ );
739
+ else
740
+ mcpHint = t(
741
+ "settings.environment.mcpOff",
742
+ "Turn on with mcp.enabled in config/plugins and server.mcp.enabled in config/server, then restart."
743
+ );
725
744
  const lastRun = linkSchedule && linkSchedule.lastRun;
726
745
  let linkScheduleHint;
727
746
  if (linkSchedule && linkSchedule.enabled) {
@@ -751,7 +770,7 @@ const EnvironmentSection = ({ environment }) => {
751
770
  linkScheduleHint = parts.join(" ");
752
771
  }
753
772
  return /* @__PURE__ */ jsxRuntime.jsx(
754
- useT.SectionCard,
773
+ SectionCard.SectionCard,
755
774
  {
756
775
  title: t("settings.environment.title", "Server configuration"),
757
776
  subtitle: t(
@@ -837,6 +856,13 @@ const EnvironmentSection = ({ environment }) => {
837
856
  "settings.environment.privateAiHint",
838
857
  "Needed for local models on localhost or a private network (ai.allowPrivateBaseUrl)."
839
858
  )
859
+ },
860
+ // 2.5: MCP tools for AI clients (config only).
861
+ {
862
+ key: "mcp",
863
+ label: t("settings.environment.mcp", "Tools for AI clients (MCP)"),
864
+ value: on(Boolean(mcp.active)),
865
+ hint: mcpHint
840
866
  }
841
867
  ]
842
868
  }
@@ -844,7 +870,7 @@ const EnvironmentSection = ({ environment }) => {
844
870
  }
845
871
  );
846
872
  };
847
- const CodeBlock = styled__default.default.pre`
873
+ const CodeBlock$1 = styled__default.default.pre`
848
874
  margin: 0;
849
875
  max-width: 100%;
850
876
  overflow-x: auto;
@@ -902,7 +928,7 @@ const CspSection = ({ csp }) => {
902
928
  const allowed = t("settings.csp.allowed", "Allowed");
903
929
  const codeLabel = t("settings.csp.codeLabel", "Snippet for config/middlewares.js");
904
930
  return /* @__PURE__ */ jsxRuntime.jsxs(
905
- useT.SectionCard,
931
+ SectionCard.SectionCard,
906
932
  {
907
933
  title: t("settings.csp.title", "Content Security Policy"),
908
934
  subtitle: t(
@@ -952,7 +978,7 @@ const CspSection = ({ csp }) => {
952
978
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", id: "mex-csp-snippet-label", children: codeLabel }),
953
979
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.IconButton, { label: t("settings.csp.copy", "Copy the snippet"), variant: "tertiary", onClick: onCopy, children: /* @__PURE__ */ jsxRuntime.jsx(icons.Duplicate, {}) })
954
980
  ] }),
955
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { minWidth: 0, children: /* @__PURE__ */ jsxRuntime.jsx(CodeBlock, { ref: codeRef, tabIndex: 0, "aria-labelledby": "mex-csp-snippet-label", children: /* @__PURE__ */ jsxRuntime.jsx("code", { children: csp.snippet }) }) }),
981
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { minWidth: 0, children: /* @__PURE__ */ jsxRuntime.jsx(CodeBlock$1, { ref: codeRef, tabIndex: 0, "aria-labelledby": "mex-csp-snippet-label", children: /* @__PURE__ */ jsxRuntime.jsx("code", { children: csp.snippet }) }) }),
956
982
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: t(
957
983
  "settings.csp.mergeHint",
958
984
  "Keep your other directives (for example the hosts of your upload provider) and restart Strapi after the change."
@@ -962,6 +988,159 @@ const CspSection = ({ csp }) => {
962
988
  }
963
989
  );
964
990
  };
991
+ const Swatch = styled__default.default.span`
992
+ display: inline-block;
993
+ flex: 0 0 auto;
994
+ width: 2.4rem;
995
+ height: 2.4rem;
996
+ border-radius: ${({ theme }) => theme.borderRadius};
997
+ border: 1px solid ${({ theme }) => theme.colors.neutral300};
998
+ background: ${({ $color }) => index.isHexColor($color) ? $color : "transparent"};
999
+ `;
1000
+ const CodeBlock = styled__default.default.pre`
1001
+ margin: 0;
1002
+ max-width: 100%;
1003
+ max-height: 24rem;
1004
+ overflow: auto;
1005
+ padding: ${({ theme }) => theme.spaces[4]};
1006
+ border: 1px solid ${({ theme }) => theme.colors.neutral200};
1007
+ border-radius: ${({ theme }) => theme.borderRadius};
1008
+ background: ${({ theme }) => theme.colors.neutral100};
1009
+ color: ${({ theme }) => theme.colors.neutral800};
1010
+ font-family: 'SF Mono', SFMono-Regular, ui-monospace, Menlo, Consolas, monospace;
1011
+ font-size: ${({ theme }) => theme.fontSizes[1]};
1012
+ line-height: 1.6;
1013
+ white-space: pre;
1014
+
1015
+ &:focus-visible {
1016
+ outline: 2px solid ${({ theme }) => theme.colors.primary600};
1017
+ outline-offset: 2px;
1018
+ }
1019
+ `;
1020
+ const TokenList = styled__default.default.ul`
1021
+ margin: 0;
1022
+ padding: 0;
1023
+ list-style: none;
1024
+ display: grid;
1025
+ grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
1026
+ gap: ${({ theme }) => theme.spaces[3]};
1027
+ `;
1028
+ const TokenItem = ({ token, locale, t }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { tag: "li", minWidth: 0, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", minWidth: 0, children: [
1029
+ /* @__PURE__ */ jsxRuntime.jsx(Swatch, { $color: token.light, title: t("settings.palette.light", "Light theme"), "aria-hidden": "true" }),
1030
+ /* @__PURE__ */ jsxRuntime.jsx(Swatch, { $color: token.dark, title: t("settings.palette.dark", "Dark theme"), "aria-hidden": "true" }),
1031
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", minWidth: 0, children: [
1032
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "semiBold", textColor: "neutral800", children: index.tokenLabel(token, locale) }),
1033
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", textColor: "neutral600", style: { overflowWrap: "anywhere" }, children: [
1034
+ token.name,
1035
+ " · ",
1036
+ token.light,
1037
+ " / ",
1038
+ token.dark
1039
+ ] })
1040
+ ] })
1041
+ ] }) });
1042
+ const PaletteSection = ({ palette }) => {
1043
+ const t = useT.useT();
1044
+ const { locale } = reactIntl.useIntl();
1045
+ const { copy } = admin.useClipboard();
1046
+ const codeRef = ReactNamespace.useRef(null);
1047
+ const [alertOpen, setAlertOpen] = ReactNamespace.useState(true);
1048
+ if (!palette) return null;
1049
+ const colors = Array.isArray(palette.colors) ? palette.colors : [];
1050
+ const highlights = Array.isArray(palette.highlights) ? palette.highlights : [];
1051
+ const issues = Array.isArray(palette.issues) ? palette.issues : [];
1052
+ const annotations = Array.isArray(palette.annotations) ? palette.annotations : [];
1053
+ const empty = !colors.length && !highlights.length;
1054
+ const pairText = (issue) => t(
1055
+ "settings.palette.issue",
1056
+ "{mode, select, dark {Dark theme} other {Light theme}}: {pair} has contrast {ratio}:1 (needs 4.5:1)",
1057
+ {
1058
+ mode: issue.mode,
1059
+ pair: `${issue.color || t("settings.palette.defaultText", "default text")} / ${issue.highlight || t("settings.palette.page", "page background")}`,
1060
+ ratio: issue.ratio
1061
+ }
1062
+ );
1063
+ const onCopy = async () => {
1064
+ if (!await copy(palette.css) && codeRef.current) {
1065
+ const range = document.createRange();
1066
+ range.selectNodeContents(codeRef.current);
1067
+ const selection = window.getSelection();
1068
+ selection.removeAllRanges();
1069
+ selection.addRange(range);
1070
+ codeRef.current.focus();
1071
+ }
1072
+ };
1073
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1074
+ SectionCard.SectionCard,
1075
+ {
1076
+ title: t("settings.palette.title", "Text colours and highlights"),
1077
+ subtitle: t(
1078
+ "settings.palette.subtitle",
1079
+ 'Defined in the plugin configuration (config/plugins.js, key palette). Fields offer them when the field option "Text colour and highlight" is on.'
1080
+ ),
1081
+ children: [
1082
+ empty ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral600", children: t(
1083
+ "settings.palette.empty",
1084
+ "No palette is configured, so editors see no colour tool. Ask your developer to add colour tokens to the plugin configuration."
1085
+ ) }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1086
+ issues.length && alertOpen ? (
1087
+ // The Alert renders its children inside a paragraph: the list follows it (no <ul> in <p>).
1088
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
1089
+ /* @__PURE__ */ jsxRuntime.jsx(
1090
+ designSystem.Alert,
1091
+ {
1092
+ variant: "warning",
1093
+ closeLabel: t("settings.close", "Close"),
1094
+ onClose: () => setAlertOpen(false),
1095
+ children: t(
1096
+ "settings.palette.issuesTitle",
1097
+ "{count, plural, one {# combination is} other {# combinations are}} hard to read",
1098
+ { count: issues.length }
1099
+ )
1100
+ }
1101
+ ),
1102
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { tag: "ul", paddingLeft: 4, margin: 0, children: issues.slice(0, 20).map((issue) => /* @__PURE__ */ jsxRuntime.jsx(
1103
+ designSystem.Typography,
1104
+ {
1105
+ tag: "li",
1106
+ variant: "omega",
1107
+ children: pairText(issue)
1108
+ },
1109
+ `${issue.mode}|${issue.color}|${issue.highlight}`
1110
+ )) })
1111
+ ] })
1112
+ ) : null,
1113
+ colors.length ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
1114
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", tag: "h3", children: t("settings.palette.colors", "Text colours") }),
1115
+ /* @__PURE__ */ jsxRuntime.jsx(TokenList, { children: colors.map((token) => /* @__PURE__ */ jsxRuntime.jsx(TokenItem, { token, locale, t }, token.name)) })
1116
+ ] }) : null,
1117
+ highlights.length ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
1118
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", tag: "h3", children: t("settings.palette.highlights", "Highlights") }),
1119
+ /* @__PURE__ */ jsxRuntime.jsx(TokenList, { children: highlights.map((token) => /* @__PURE__ */ jsxRuntime.jsx(TokenItem, { token, locale, t }, token.name)) })
1120
+ ] }) : null,
1121
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, minWidth: 0, children: [
1122
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", gap: 2, wrap: "wrap", children: [
1123
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", id: "mex-palette-css-label", tag: "h3", children: t("settings.palette.css", "CSS for your site") }),
1124
+ /* @__PURE__ */ jsxRuntime.jsx(
1125
+ designSystem.IconButton,
1126
+ {
1127
+ label: t("settings.palette.copy", "Copy the CSS"),
1128
+ variant: "tertiary",
1129
+ onClick: onCopy,
1130
+ children: /* @__PURE__ */ jsxRuntime.jsx(icons.Duplicate, {})
1131
+ }
1132
+ )
1133
+ ] }),
1134
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { minWidth: 0, children: /* @__PURE__ */ jsxRuntime.jsx(CodeBlock, { ref: codeRef, tabIndex: 0, "aria-labelledby": "mex-palette-css-label", children: /* @__PURE__ */ jsxRuntime.jsx("code", { children: palette.css }) }) })
1135
+ ] })
1136
+ ] }),
1137
+ annotations.length ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: t("settings.palette.annotations", 'Annotations for the field option "Annotations": {names}', {
1138
+ names: annotations.map((item) => item.name).join(", ")
1139
+ }) }) : null
1140
+ ]
1141
+ }
1142
+ );
1143
+ };
965
1144
  const hostOf = (t, baseUrl) => {
966
1145
  try {
967
1146
  return new URL(baseUrl).host || t("settings.languageTool.server", "the LanguageTool server");
@@ -991,7 +1170,7 @@ const LanguageToolSection = ({ form, readOnly, onTest }) => {
991
1170
  keyLabel = t("settings.ai.key.status.stored", "Stored, encrypted");
992
1171
  }
993
1172
  return /* @__PURE__ */ jsxRuntime.jsxs(
994
- useT.SectionCard,
1173
+ SectionCard.SectionCard,
995
1174
  {
996
1175
  title: t("settings.languageTool.title", "Grammar check (LanguageTool)"),
997
1176
  subtitle: t(
@@ -1250,7 +1429,7 @@ const LinkScheduleSection = ({ initial, canRun, onStatus }) => {
1250
1429
  const lastRun = status.lastRun;
1251
1430
  const zone = status.tz || t("settings.linkRun.serverZone", "Server time zone");
1252
1431
  return /* @__PURE__ */ jsxRuntime.jsxs(
1253
- useT.SectionCard,
1432
+ SectionCard.SectionCard,
1254
1433
  {
1255
1434
  title: t("settings.linkRun.title", "Scheduled link check"),
1256
1435
  subtitle: t(
@@ -1454,7 +1633,7 @@ const ConfigurationPage = () => {
1454
1633
  }
1455
1634
  };
1456
1635
  return /* @__PURE__ */ jsxRuntime.jsxs(
1457
- useT.PageShell,
1636
+ SectionCard.PageShell,
1458
1637
  {
1459
1638
  title,
1460
1639
  subtitle: readOnly ? t(
@@ -1520,6 +1699,7 @@ const ConfigurationPage = () => {
1520
1699
  }
1521
1700
  ),
1522
1701
  /* @__PURE__ */ jsxRuntime.jsx(CspSection, { csp: form.dto.environment && form.dto.environment.csp }),
1702
+ /* @__PURE__ */ jsxRuntime.jsx(PaletteSection, { palette: form.dto.environment && form.dto.environment.palette }),
1523
1703
  /* @__PURE__ */ jsxRuntime.jsxs(admin.Form, { method: "PUT", initialValues: form.saved, children: [
1524
1704
  /* @__PURE__ */ jsxRuntime.jsx(DraftSync.DraftSync, { values: form.draft }),
1525
1705
  /* @__PURE__ */ jsxRuntime.jsx(admin.Blocker, {})