tinacms 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.
@@ -25,6 +25,9 @@ export interface DocumentNode {
25
25
  }
26
26
  export interface DocumentForm {
27
27
  _values: Object;
28
+ _sys?: {
29
+ hasReferences?: boolean;
30
+ };
28
31
  }
29
32
  export interface DocumentSys {
30
33
  _sys: {
package/dist/index.d.ts CHANGED
@@ -53,7 +53,7 @@ export type TinaCollection = Collection;
53
53
  export type TinaCloudSchema = Schema;
54
54
  export declare const defineSchema: (config: Schema) => Schema<false>;
55
55
  export declare const defineLegacyConfig: (config: Omit<TinaCMSProviderDefaultProps, "children">) => Omit<TinaCMSProviderDefaultProps, "children">;
56
- interface MediaStoreClass {
56
+ export interface MediaStoreClass {
57
57
  new (...args: any[]): MediaStore;
58
58
  }
59
59
  export declare const defineStaticConfig: (config: Config<(cms: TinaCMS) => TinaCMS, formifyCallback, DocumentCreatorCallback, MediaStoreClass>) => Config<(cms: TinaCMS) => TinaCMS, formifyCallback, import("./hooks/use-content-creator").DocumentCreatorArgs, MediaStoreClass, undefined>;
package/dist/index.js CHANGED
@@ -862,13 +862,23 @@ var __publicField = (obj, key, value) => {
862
862
  className,
863
863
  ...props
864
864
  }) => {
865
+ if (typeof children === "string") {
866
+ return /* @__PURE__ */ React__namespace.createElement(
867
+ "span",
868
+ {
869
+ className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0 ${className}`,
870
+ ...props,
871
+ dangerouslySetInnerHTML: { __html: children }
872
+ }
873
+ );
874
+ }
865
875
  return /* @__PURE__ */ React__namespace.createElement(
866
876
  "span",
867
877
  {
868
878
  className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0 ${className}`,
869
- ...props,
870
- dangerouslySetInnerHTML: { __html: children }
871
- }
879
+ ...props
880
+ },
881
+ children
872
882
  );
873
883
  };
874
884
  const FieldError = ({
@@ -5726,10 +5736,11 @@ flowchart TD
5726
5736
  return /* @__PURE__ */ React.createElement(
5727
5737
  "button",
5728
5738
  {
5729
- className: `w-8 px-1 py-2.5 flex items-center justify-center hover:bg-gray-50 text-gray-200 hover:text-red-500 ${disabled && "pointer-events-none opacity-30 cursor-not-allowed"}`,
5739
+ type: "button",
5740
+ className: `w-8 px-1 py-2.5 flex items-center justify-center text-gray-200 hover:opacity-100 opacity-30 hover:bg-gray-50 ${disabled && "pointer-events-none opacity-30 cursor-not-allowed"}`,
5730
5741
  onClick
5731
5742
  },
5732
- /* @__PURE__ */ React.createElement(TrashIcon, { className: "fill-current transition-colors ease-out duration-100" })
5743
+ /* @__PURE__ */ React.createElement(TrashIcon, { className: "h-5 w-auto fill-current text-red-500 transition-colors duration-150 ease-out" })
5733
5744
  );
5734
5745
  };
5735
5746
  const DragHandle = ({ isDragging }) => {
@@ -10332,7 +10343,7 @@ flowchart TD
10332
10343
  "Event Log"
10333
10344
  ));
10334
10345
  };
10335
- const version = "2.4.0";
10346
+ const version = "2.5.1";
10336
10347
  const Nav = ({
10337
10348
  isLocalMode,
10338
10349
  className = "",
@@ -30112,6 +30123,7 @@ mutation addPendingDocumentMutation(
30112
30123
  relativePath
30113
30124
  filename
30114
30125
  extension
30126
+ hasReferences
30115
30127
  }
30116
30128
  }
30117
30129
  }
@@ -30203,6 +30215,9 @@ mutation addPendingDocumentMutation(
30203
30215
  document(collection:$collection, relativePath:$relativePath) {
30204
30216
  ... on Document {
30205
30217
  _values
30218
+ _sys {
30219
+ hasReferences
30220
+ }
30206
30221
  }
30207
30222
  }
30208
30223
  }`;
@@ -31929,6 +31944,23 @@ This will work when developing locally but NOT when deployed to production.
31929
31944
  DeleteModal,
31930
31945
  {
31931
31946
  filename: vars.relativePath,
31947
+ checkRefsFunc: async () => {
31948
+ var _a2, _b2;
31949
+ try {
31950
+ const doc = await admin.fetchDocument(
31951
+ collection.name,
31952
+ vars.relativePath,
31953
+ true
31954
+ );
31955
+ return (_b2 = (_a2 = doc == null ? void 0 : doc.document) == null ? void 0 : _a2._sys) == null ? void 0 : _b2.hasReferences;
31956
+ } catch (error) {
31957
+ cms.alerts.error(
31958
+ "Document was not found, ask a developer for help or check the console for an error message"
31959
+ );
31960
+ console.error(error);
31961
+ throw error;
31962
+ }
31963
+ },
31932
31964
  deleteFunc: async () => {
31933
31965
  try {
31934
31966
  await admin.deleteDocument(vars);
@@ -31937,6 +31969,12 @@ This will work when developing locally but NOT when deployed to production.
31937
31969
  );
31938
31970
  reFetchCollection();
31939
31971
  } catch (error) {
31972
+ if (error.message.indexOf("has references")) {
31973
+ cms.alerts.error(
31974
+ error.message.split("\n ").filter(Boolean)[1]
31975
+ );
31976
+ return;
31977
+ }
31940
31978
  cms.alerts.warn(
31941
31979
  "Document was not deleted, ask a developer for help or check the console for an error message"
31942
31980
  );
@@ -31988,6 +32026,12 @@ This will work when developing locally but NOT when deployed to production.
31988
32026
  cms.alerts.info("Document was successfully renamed");
31989
32027
  reFetchCollection();
31990
32028
  } catch (error) {
32029
+ if (error.message.indexOf("has references")) {
32030
+ cms.alerts.error(
32031
+ error.message.split("\n ").filter(Boolean)[1]
32032
+ );
32033
+ return;
32034
+ }
31991
32035
  cms.alerts.warn(
31992
32036
  "Document was not renamed, ask a developer for help or check the console for an error message"
31993
32037
  );
@@ -32461,8 +32505,19 @@ This will work when developing locally but NOT when deployed to production.
32461
32505
  const NoDocumentsPlaceholder = () => {
32462
32506
  return /* @__PURE__ */ React.createElement("div", { className: "text-center px-5 py-3 flex flex-col items-center justify-center shadow border border-gray-100 bg-gray-50 border-b border-gray-200 w-full max-w-full rounded-lg" }, /* @__PURE__ */ React.createElement("p", { className: "text-base italic font-medium text-gray-300" }, "No documents found."));
32463
32507
  };
32464
- const DeleteModal = ({ close: close2, deleteFunc, filename }) => {
32465
- return /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(PopupModal, null, /* @__PURE__ */ React.createElement(ModalHeader, { close: close2 }, "Delete ", filename), /* @__PURE__ */ React.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React.createElement("p", null, `Are you sure you want to delete ${filename}?`)), /* @__PURE__ */ React.createElement(ModalActions, null, /* @__PURE__ */ React.createElement(Button$1, { style: { flexGrow: 2 }, onClick: close2 }, "Cancel"), /* @__PURE__ */ React.createElement(
32508
+ const DeleteModal = ({
32509
+ close: close2,
32510
+ deleteFunc,
32511
+ checkRefsFunc,
32512
+ filename
32513
+ }) => {
32514
+ const [hasRefs, setHasRefs] = React.useState();
32515
+ React.useEffect(() => {
32516
+ checkRefsFunc().then((result) => {
32517
+ setHasRefs(result);
32518
+ });
32519
+ }, [filename, checkRefsFunc]);
32520
+ return /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(PopupModal, null, /* @__PURE__ */ React.createElement(ModalHeader, { close: close2 }, "Delete ", filename), /* @__PURE__ */ React.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React.createElement("p", null, `Are you sure you want to delete ${filename}?${hasRefs ? " References to this document will also be deleted." : ""}`)), /* @__PURE__ */ React.createElement(ModalActions, null, /* @__PURE__ */ React.createElement(Button$1, { style: { flexGrow: 2 }, onClick: close2 }, "Cancel"), /* @__PURE__ */ React.createElement(
32466
32521
  Button$1,
32467
32522
  {
32468
32523
  style: { flexGrow: 3 },
package/dist/index.mjs CHANGED
@@ -889,13 +889,23 @@ const FieldDescription = ({
889
889
  className,
890
890
  ...props
891
891
  }) => {
892
+ if (typeof children === "string") {
893
+ return /* @__PURE__ */ React.createElement(
894
+ "span",
895
+ {
896
+ className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0 ${className}`,
897
+ ...props,
898
+ dangerouslySetInnerHTML: { __html: children }
899
+ }
900
+ );
901
+ }
892
902
  return /* @__PURE__ */ React.createElement(
893
903
  "span",
894
904
  {
895
905
  className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0 ${className}`,
896
- ...props,
897
- dangerouslySetInnerHTML: { __html: children }
898
- }
906
+ ...props
907
+ },
908
+ children
899
909
  );
900
910
  };
901
911
  const FieldError = ({
@@ -5753,10 +5763,11 @@ const ItemDeleteButton = ({ onClick, disabled = false }) => {
5753
5763
  return /* @__PURE__ */ React__default.createElement(
5754
5764
  "button",
5755
5765
  {
5756
- className: `w-8 px-1 py-2.5 flex items-center justify-center hover:bg-gray-50 text-gray-200 hover:text-red-500 ${disabled && "pointer-events-none opacity-30 cursor-not-allowed"}`,
5766
+ type: "button",
5767
+ className: `w-8 px-1 py-2.5 flex items-center justify-center text-gray-200 hover:opacity-100 opacity-30 hover:bg-gray-50 ${disabled && "pointer-events-none opacity-30 cursor-not-allowed"}`,
5757
5768
  onClick
5758
5769
  },
5759
- /* @__PURE__ */ React__default.createElement(TrashIcon, { className: "fill-current transition-colors ease-out duration-100" })
5770
+ /* @__PURE__ */ React__default.createElement(TrashIcon, { className: "h-5 w-auto fill-current text-red-500 transition-colors duration-150 ease-out" })
5760
5771
  );
5761
5772
  };
5762
5773
  const DragHandle = ({ isDragging }) => {
@@ -10359,7 +10370,7 @@ const SyncStatus = ({ cms, setEventsOpen }) => {
10359
10370
  "Event Log"
10360
10371
  ));
10361
10372
  };
10362
- const version = "2.4.0";
10373
+ const version = "2.5.1";
10363
10374
  const Nav = ({
10364
10375
  isLocalMode,
10365
10376
  className = "",
@@ -30139,6 +30150,7 @@ class TinaAdminApi {
30139
30150
  relativePath
30140
30151
  filename
30141
30152
  extension
30153
+ hasReferences
30142
30154
  }
30143
30155
  }
30144
30156
  }
@@ -30230,6 +30242,9 @@ class TinaAdminApi {
30230
30242
  document(collection:$collection, relativePath:$relativePath) {
30231
30243
  ... on Document {
30232
30244
  _values
30245
+ _sys {
30246
+ hasReferences
30247
+ }
30233
30248
  }
30234
30249
  }
30235
30250
  }`;
@@ -31956,6 +31971,23 @@ const CollectionListPage = () => {
31956
31971
  DeleteModal,
31957
31972
  {
31958
31973
  filename: vars.relativePath,
31974
+ checkRefsFunc: async () => {
31975
+ var _a2, _b2;
31976
+ try {
31977
+ const doc = await admin.fetchDocument(
31978
+ collection.name,
31979
+ vars.relativePath,
31980
+ true
31981
+ );
31982
+ return (_b2 = (_a2 = doc == null ? void 0 : doc.document) == null ? void 0 : _a2._sys) == null ? void 0 : _b2.hasReferences;
31983
+ } catch (error) {
31984
+ cms.alerts.error(
31985
+ "Document was not found, ask a developer for help or check the console for an error message"
31986
+ );
31987
+ console.error(error);
31988
+ throw error;
31989
+ }
31990
+ },
31959
31991
  deleteFunc: async () => {
31960
31992
  try {
31961
31993
  await admin.deleteDocument(vars);
@@ -31964,6 +31996,12 @@ const CollectionListPage = () => {
31964
31996
  );
31965
31997
  reFetchCollection();
31966
31998
  } catch (error) {
31999
+ if (error.message.indexOf("has references")) {
32000
+ cms.alerts.error(
32001
+ error.message.split("\n ").filter(Boolean)[1]
32002
+ );
32003
+ return;
32004
+ }
31967
32005
  cms.alerts.warn(
31968
32006
  "Document was not deleted, ask a developer for help or check the console for an error message"
31969
32007
  );
@@ -32015,6 +32053,12 @@ const CollectionListPage = () => {
32015
32053
  cms.alerts.info("Document was successfully renamed");
32016
32054
  reFetchCollection();
32017
32055
  } catch (error) {
32056
+ if (error.message.indexOf("has references")) {
32057
+ cms.alerts.error(
32058
+ error.message.split("\n ").filter(Boolean)[1]
32059
+ );
32060
+ return;
32061
+ }
32018
32062
  cms.alerts.warn(
32019
32063
  "Document was not renamed, ask a developer for help or check the console for an error message"
32020
32064
  );
@@ -32488,8 +32532,19 @@ const Breadcrumb = ({ folder, navigate, collectionName }) => {
32488
32532
  const NoDocumentsPlaceholder = () => {
32489
32533
  return /* @__PURE__ */ React__default.createElement("div", { className: "text-center px-5 py-3 flex flex-col items-center justify-center shadow border border-gray-100 bg-gray-50 border-b border-gray-200 w-full max-w-full rounded-lg" }, /* @__PURE__ */ React__default.createElement("p", { className: "text-base italic font-medium text-gray-300" }, "No documents found."));
32490
32534
  };
32491
- const DeleteModal = ({ close: close2, deleteFunc, filename }) => {
32492
- return /* @__PURE__ */ React__default.createElement(Modal, null, /* @__PURE__ */ React__default.createElement(PopupModal, null, /* @__PURE__ */ React__default.createElement(ModalHeader, { close: close2 }, "Delete ", filename), /* @__PURE__ */ React__default.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React__default.createElement("p", null, `Are you sure you want to delete ${filename}?`)), /* @__PURE__ */ React__default.createElement(ModalActions, null, /* @__PURE__ */ React__default.createElement(Button$1, { style: { flexGrow: 2 }, onClick: close2 }, "Cancel"), /* @__PURE__ */ React__default.createElement(
32535
+ const DeleteModal = ({
32536
+ close: close2,
32537
+ deleteFunc,
32538
+ checkRefsFunc,
32539
+ filename
32540
+ }) => {
32541
+ const [hasRefs, setHasRefs] = React__default.useState();
32542
+ useEffect(() => {
32543
+ checkRefsFunc().then((result) => {
32544
+ setHasRefs(result);
32545
+ });
32546
+ }, [filename, checkRefsFunc]);
32547
+ return /* @__PURE__ */ React__default.createElement(Modal, null, /* @__PURE__ */ React__default.createElement(PopupModal, null, /* @__PURE__ */ React__default.createElement(ModalHeader, { close: close2 }, "Delete ", filename), /* @__PURE__ */ React__default.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React__default.createElement("p", null, `Are you sure you want to delete ${filename}?${hasRefs ? " References to this document will also be deleted." : ""}`)), /* @__PURE__ */ React__default.createElement(ModalActions, null, /* @__PURE__ */ React__default.createElement(Button$1, { style: { flexGrow: 2 }, onClick: close2 }, "Cancel"), /* @__PURE__ */ React__default.createElement(
32493
32548
  Button$1,
32494
32549
  {
32495
32550
  style: { flexGrow: 3 },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinacms",
3
- "version": "2.4.0",
3
+ "version": "2.5.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "exports": {
@@ -60,21 +60,21 @@
60
60
  "typings": "dist/index.d.ts",
61
61
  "license": "Apache-2.0",
62
62
  "dependencies": {
63
- "@ariakit/react": "^0.4.11",
64
- "@floating-ui/dom": "^1.6.11",
63
+ "@ariakit/react": "^0.4.13",
64
+ "@floating-ui/dom": "^1.6.12",
65
65
  "@floating-ui/react-dom": "^2.1.2",
66
- "@graphql-inspector/core": "^6.1.0",
66
+ "@graphql-inspector/core": "^6.2.0",
67
67
  "@headlessui/react": "2.1.8",
68
68
  "@heroicons/react": "^1.0.6",
69
69
  "@monaco-editor/react": "4.4.5",
70
- "@radix-ui/react-checkbox": "^1.1.1",
71
- "@radix-ui/react-dialog": "^1.1.1",
72
- "@radix-ui/react-dropdown-menu": "^2.1.1",
73
- "@radix-ui/react-popover": "^1.1.1",
70
+ "@radix-ui/react-checkbox": "^1.1.2",
71
+ "@radix-ui/react-dialog": "^1.1.2",
72
+ "@radix-ui/react-dropdown-menu": "^2.1.2",
73
+ "@radix-ui/react-popover": "^1.1.2",
74
74
  "@radix-ui/react-separator": "^1.1.0",
75
75
  "@radix-ui/react-slot": "^1.1.0",
76
76
  "@radix-ui/react-toolbar": "^1.1.0",
77
- "@radix-ui/react-tooltip": "^1.1.2",
77
+ "@radix-ui/react-tooltip": "^1.1.4",
78
78
  "@react-hook/window-size": "^3.1.1",
79
79
  "@udecode/cn": "^33.0.0",
80
80
  "@udecode/plate": "^36.5.9",
@@ -94,7 +94,7 @@
94
94
  "@udecode/plate-table": "36.5.8",
95
95
  "class-variance-authority": "^0.7.0",
96
96
  "clsx": "^2.1.1",
97
- "cmdk": "^1.0.0",
97
+ "cmdk": "^1.0.4",
98
98
  "color-string": "^1.9.1",
99
99
  "crypto-js": "^4.2.0",
100
100
  "date-fns": "2.30.0",
@@ -125,18 +125,18 @@
125
125
  "slate-history": "^0.100.0",
126
126
  "slate-hyperscript": "^0.100.0",
127
127
  "slate-react": "^0.107.1",
128
- "tailwind-merge": "^2.5.2",
128
+ "tailwind-merge": "^2.5.4",
129
129
  "webfontloader": "1.6.28",
130
130
  "yup": "^1.4.0",
131
131
  "zod": "^3.23.8",
132
- "@tinacms/mdx": "1.5.1",
133
- "@tinacms/schema-tools": "1.6.7",
134
- "@tinacms/search": "1.0.34"
132
+ "@tinacms/mdx": "1.5.2",
133
+ "@tinacms/schema-tools": "1.6.8",
134
+ "@tinacms/search": "1.0.35"
135
135
  },
136
136
  "devDependencies": {
137
- "@graphql-tools/utils": "^10.5.4",
137
+ "@graphql-tools/utils": "^10.5.6",
138
138
  "@testing-library/dom": "^10.4.0",
139
- "@testing-library/jest-dom": "^6.5.0",
139
+ "@testing-library/jest-dom": "^6.6.3",
140
140
  "@testing-library/react": "^16.0.1",
141
141
  "@testing-library/user-event": "^14.5.2",
142
142
  "@types/atob": "^2.1.4",
@@ -144,14 +144,14 @@
144
144
  "@types/color-string": "^1.5.5",
145
145
  "@types/lodash.debounce": "^4.0.9",
146
146
  "@types/lodash.get": "^4.4.9",
147
- "@types/node": "^22.7.4",
147
+ "@types/node": "^22.9.0",
148
148
  "@types/prop-types": "^15.7.13",
149
- "@types/react": "^18.3.10",
149
+ "@types/react": "^18.3.12",
150
150
  "@types/react-beautiful-dnd": "^13.1.8",
151
151
  "@types/react-color": "^3.0.12",
152
- "@types/react-dom": "^18.3.0",
152
+ "@types/react-dom": "^18.3.1",
153
153
  "@types/yup": "^0.32.0",
154
- "happy-dom": "^14.12.3",
154
+ "happy-dom": "15.10.2",
155
155
  "identity-obj-proxy": "^3.0.0",
156
156
  "isomorphic-fetch": "^3.0.0",
157
157
  "jest-file-snapshot": "^0.7.0",
@@ -160,11 +160,11 @@
160
160
  "react-dom": "^18.3.1",
161
161
  "react-is": "^18.3.1",
162
162
  "tsc-alias": "^1.8.10",
163
- "tslib": "^2.7.0",
164
- "typescript": "^5.6.2",
165
- "vite": "^5.4.8",
166
- "vitest": "^2.1.1",
167
- "@tinacms/scripts": "1.3.0"
163
+ "tslib": "^2.8.1",
164
+ "typescript": "^5.6.3",
165
+ "vite": "^5.4.11",
166
+ "vitest": "^2.1.5",
167
+ "@tinacms/scripts": "1.3.1"
168
168
  },
169
169
  "peerDependencies": {
170
170
  "react": ">=16.14.0",