tinacms 3.7.3 → 3.7.4

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 (2) hide show
  1. package/dist/index.js +62 -36
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -33939,8 +33939,12 @@ const MermaidElementWithRef = ({ config }) => {
33939
33939
  const mermaidRef = useRef(null);
33940
33940
  useEffect(() => {
33941
33941
  if (mermaidRef.current) {
33942
- mermaid.initialize({ startOnLoad: true });
33943
- mermaid.init();
33942
+ const renderMermaid = async () => {
33943
+ await mermaid.run({
33944
+ nodes: [mermaidRef.current.querySelector(".mermaid")]
33945
+ });
33946
+ };
33947
+ renderMermaid();
33944
33948
  }
33945
33949
  }, [config]);
33946
33950
  return /* @__PURE__ */ React__default.createElement("div", { contentEditable: false, className: "border-border border-b pt-10" }, /* @__PURE__ */ React__default.createElement("div", { ref: mermaidRef }, /* @__PURE__ */ React__default.createElement("pre", { className: "mermaid not-tina-prose" }, config)));
@@ -33973,15 +33977,28 @@ const CodeBlockElement = withRef$1(
33973
33977
  if (element.lang !== "mermaid") {
33974
33978
  return;
33975
33979
  }
33976
- if (mermaid.parse(codeLineToString(element))) {
33977
- setCodeBlockError(null);
33978
- }
33979
- }, [element.children]);
33980
- mermaid.parseError = (err) => {
33981
- setCodeBlockError(
33982
- String(err.message) || "An error occurred while parsing the diagram."
33983
- );
33984
- };
33980
+ let isCancelled = false;
33981
+ const validateMermaid = async () => {
33982
+ try {
33983
+ await mermaid.parse(
33984
+ codeLineToString(element)
33985
+ );
33986
+ if (!isCancelled) {
33987
+ setCodeBlockError(null);
33988
+ }
33989
+ } catch (err) {
33990
+ if (!isCancelled) {
33991
+ setCodeBlockError(
33992
+ String(err.message) || "An error occurred while parsing the diagram."
33993
+ );
33994
+ }
33995
+ }
33996
+ };
33997
+ validateMermaid();
33998
+ return () => {
33999
+ isCancelled = true;
34000
+ };
34001
+ }, [element.children, element.lang]);
33985
34002
  return /* @__PURE__ */ React__default.createElement(
33986
34003
  PlateElement,
33987
34004
  {
@@ -38289,29 +38306,27 @@ class Form {
38289
38306
  const templateName = namePath.slice(0, currentPathIndex + 2).join(".");
38290
38307
  if ((item == null ? void 0 : item.type) === "img") {
38291
38308
  const imageName = namePath.slice(0, currentPathIndex + 2).join(".");
38309
+ const imageBaseName = templateName.replace(/\.props$/, "");
38292
38310
  return {
38293
- ...formOrObjectField,
38294
- // name: [formOrObjectField.name, 'img'].join('.'),
38311
+ label: "Image",
38295
38312
  name: [imageName].join("."),
38296
38313
  fields: [
38297
38314
  {
38298
38315
  type: "image",
38299
- // label: 'URL',
38300
- name: [templateName, "url"].join("."),
38316
+ label: "URL",
38317
+ name: [imageBaseName, "url"].join("."),
38301
38318
  component: "image"
38302
38319
  },
38303
38320
  {
38304
38321
  type: "string",
38305
38322
  label: "Alt",
38306
- name: [templateName.replace(/\.props$/, ""), "alt"].join("."),
38323
+ name: [imageBaseName, "alt"].join("."),
38307
38324
  component: "text"
38308
38325
  },
38309
38326
  {
38310
38327
  type: "string",
38311
38328
  label: "Caption",
38312
- name: [templateName.replace(/\.props$/, ""), "caption"].join(
38313
- "."
38314
- ),
38329
+ name: [imageBaseName, "caption"].join("."),
38315
38330
  component: "text"
38316
38331
  }
38317
38332
  ]
@@ -40220,19 +40235,19 @@ const RadioOption = ({ checked, htmlFor, children, ...props }) => /* @__PURE__ *
40220
40235
  /* @__PURE__ */ React.createElement(
40221
40236
  "span",
40222
40237
  {
40223
- className: `relative h-[19px] w-[19px] rounded border text-indigo-600 focus:ring-indigo-500 transition ease-out duration-150 ${checked ? "border-blue-500 bg-blue-500 shadow-sm group-hover:bg-blue-400 group-hover:border-blue-400" : "border-gray-200 bg-white shadow-inner group-hover:bg-gray-100"}`
40238
+ className: `relative flex h-[19px] w-[19px] items-center justify-center rounded-full border transition ease-out duration-150 ${checked ? "border-blue-500 bg-white shadow-sm group-hover:border-blue-400" : "border-gray-300 bg-white group-hover:border-blue-300"}`
40224
40239
  },
40225
40240
  /* @__PURE__ */ React.createElement(
40226
- BiCheck,
40241
+ "span",
40227
40242
  {
40228
- className: `absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[17px] h-[17px] transition ease-out duration-150 ${checked ? "opacity-100 text-white group-hover:opacity-80" : "text-blue-500 opacity-0 grou-hover:opacity-30"}`
40243
+ className: `h-[9px] w-[9px] rounded-full bg-blue-500 transition ease-out duration-150 ${checked ? "scale-100 opacity-100 group-hover:bg-blue-400" : "scale-75 opacity-0"}`
40229
40244
  }
40230
40245
  )
40231
40246
  ),
40232
40247
  /* @__PURE__ */ React.createElement(
40233
40248
  "span",
40234
40249
  {
40235
- className: `relative transition ease-out duration-150 ${checked ? "text-gray-800 opacity-100" : "text-gray-700 opacity-70 group-hover:opacity-100"}`
40250
+ className: `relative transition ease-out duration-150 ${checked ? "text-gray-800 opacity-100" : "text-gray-700 opacity-100 group-hover:text-gray-800"}`
40236
40251
  },
40237
40252
  children
40238
40253
  )
@@ -48025,7 +48040,7 @@ const NavProvider = ({
48025
48040
  const name = "tinacms";
48026
48041
  const type = "module";
48027
48042
  const typings = "dist/index.d.ts";
48028
- const version$1 = "3.7.3";
48043
+ const version$1 = "3.7.4";
48029
48044
  const main = "dist/index.js";
48030
48045
  const module = "./dist/index.js";
48031
48046
  const exports = {
@@ -48125,7 +48140,7 @@ const dependencies = {
48125
48140
  "graphql-tag": "catalog:",
48126
48141
  "is-hotkey": "catalog:",
48127
48142
  "lucide-react": "catalog:",
48128
- mermaid: "9.3.0",
48143
+ mermaid: "^11.12.2",
48129
48144
  moment: "catalog:",
48130
48145
  "moment-timezone": "^0.6.0",
48131
48146
  "monaco-editor": "catalog:",
@@ -66292,7 +66307,7 @@ const WorkflowProgressIndicator = ({
66292
66307
  "a",
66293
66308
  {
66294
66309
  className: "underline text-tina-orange-dark font-medium text-xs",
66295
- href: "https://tina.io/docs/tinacloud/editorial-workflow",
66310
+ href: "https://tina.io/docs/r/editorial-workflow",
66296
66311
  target: "_blank"
66297
66312
  },
66298
66313
  "Learn more about Editorial Workflow"
@@ -66392,7 +66407,7 @@ const CreateBranchModal = ({
66392
66407
  "a",
66393
66408
  {
66394
66409
  className: "underline text-tina-orange-dark font-medium",
66395
- href: "https://tina.io/docs/tinacloud/editorial-workflow",
66410
+ href: "https://tina.io/docs/r/editorial-workflow",
66396
66411
  target: "_blank"
66397
66412
  },
66398
66413
  "Editorial Workflow"
@@ -125383,6 +125398,16 @@ const ScreenPage = () => {
125383
125398
  } })));
125384
125399
  });
125385
125400
  };
125401
+ const TROUBLESHOOTING_URL = "https://tina.io/docs/tinacloud/troubleshooting";
125402
+ const ErrorModalContent = (props) => {
125403
+ const { title, message } = props;
125404
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", null, title), /* @__PURE__ */ React__default.createElement("p", null, message), /* @__PURE__ */ React__default.createElement("a", { href: TROUBLESHOOTING_URL, target: "_blank", rel: "noopener noreferrer" }, "Learn more"));
125405
+ };
125406
+ const showErrorModal = (title, message, cms) => {
125407
+ if (cms.alerts.all.some((a2) => a2.level === "error"))
125408
+ return;
125409
+ cms.alerts.error(() => /* @__PURE__ */ React__default.createElement(ErrorModalContent, { title, message }));
125410
+ };
125386
125411
  const getBackendType = (client) => {
125387
125412
  var _a2, _b, _c;
125388
125413
  if (!client)
@@ -125501,21 +125526,22 @@ const CheckSchema = ({
125501
125526
  localSchema: schemaJson
125502
125527
  }).then((isSchemaMatchedToCloud) => {
125503
125528
  if (isSchemaMatchedToCloud === false) {
125504
- cms.alerts.error(
125505
- `GraphQL Schema Mismatch - Editing may not work.
125506
-
125507
- If you just switched branches, try going back to the previous branch.
125508
-
125509
- If you just pushed changes to the branch, try pulling the latest changes.
125510
-
125511
- For more information, please see https://tina.io/docs/tinacloud/troubleshooting`
125529
+ showErrorModal(
125530
+ "GraphQL Schema Mismatch",
125531
+ "Editing may not work. If you just switched branches, try going back to the previous branch. If you just pushed changes, try pulling the latest.",
125532
+ cms
125512
125533
  );
125513
125534
  }
125514
125535
  }).catch((error2) => {
125515
125536
  if (error2.message.includes("has not been indexed by TinaCloud")) {
125516
125537
  setSchemaMissingError(true);
125517
125538
  } else {
125518
- cms.alerts.error(`Unexpected error checking schema: ${error2}`);
125539
+ console.error("Unexpected error checking schema:", error2);
125540
+ showErrorModal(
125541
+ "Unexpected Error",
125542
+ "An unexpected error occurred while validating your Tina schema. If after refreshing the issue persists, reach out to us on Discord.",
125543
+ cms
125544
+ );
125519
125545
  throw error2;
125520
125546
  }
125521
125547
  });
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "tinacms",
3
3
  "type": "module",
4
4
  "typings": "dist/index.d.ts",
5
- "version": "3.7.3",
5
+ "version": "3.7.4",
6
6
  "main": "dist/index.js",
7
7
  "module": "./dist/index.js",
8
8
  "exports": {
@@ -93,7 +93,7 @@
93
93
  "graphql-tag": "^2.12.6",
94
94
  "is-hotkey": "^0.2.0",
95
95
  "lucide-react": "^0.424.0",
96
- "mermaid": "9.3.0",
96
+ "mermaid": "^11.12.2",
97
97
  "moment": "2.29.4",
98
98
  "moment-timezone": "^0.6.0",
99
99
  "monaco-editor": "0.31.0",
@@ -114,9 +114,9 @@
114
114
  "webfontloader": "1.6.28",
115
115
  "yup": "^1.6.1",
116
116
  "zod": "^3.24.2",
117
+ "@tinacms/mdx": "2.1.2",
117
118
  "@tinacms/schema-tools": "2.7.2",
118
- "@tinacms/search": "1.2.10",
119
- "@tinacms/mdx": "2.1.2"
119
+ "@tinacms/search": "1.2.11"
120
120
  },
121
121
  "devDependencies": {
122
122
  "@graphql-tools/utils": "^10.8.1",