tinacms 2.3.0 → 2.5.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.
- package/dist/admin/types.d.ts +3 -0
- package/dist/cache/node-cache.d.ts +1 -0
- package/dist/client.js +18 -16
- package/dist/client.mjs +1 -1
- package/dist/index.js +114 -35
- package/dist/index.mjs +114 -35
- package/dist/{node-cache-7fa2452c.mjs → node-cache-4c336858.mjs} +18 -11
- package/dist/toolkit/fields/plugins/wrap-field-with-meta.d.ts +8 -0
- package/package.json +25 -25
- package/dist/__vite-browser-external-d06ac358.mjs +0 -4
package/dist/admin/types.d.ts
CHANGED
package/dist/client.js
CHANGED
|
@@ -105,21 +105,27 @@
|
|
|
105
105
|
const client = new TinaClient(args);
|
|
106
106
|
return client;
|
|
107
107
|
}
|
|
108
|
-
const makeCacheDir = async (dir, fs) => {
|
|
109
|
-
const
|
|
110
|
-
const
|
|
111
|
-
const
|
|
108
|
+
const makeCacheDir = async (dir, fs, path, os) => {
|
|
109
|
+
const pathParts = dir.split(path.sep).filter(Boolean);
|
|
110
|
+
const cacheHash = pathParts[pathParts.length - 1];
|
|
111
|
+
const rootUser = pathParts[0];
|
|
112
112
|
let cacheDir = dir;
|
|
113
|
-
if (!fs.existsSync(path.join(path.sep,
|
|
114
|
-
cacheDir = path.join(os.tmpdir(),
|
|
113
|
+
if (!fs.existsSync(path.join(path.sep, rootUser))) {
|
|
114
|
+
cacheDir = path.join(os.tmpdir(), cacheHash);
|
|
115
|
+
}
|
|
116
|
+
try {
|
|
117
|
+
fs.mkdirSync(cacheDir, { recursive: true });
|
|
118
|
+
} catch (error) {
|
|
119
|
+
throw new Error(`Failed to create cache directory: ${error.message}`);
|
|
115
120
|
}
|
|
116
|
-
fs.mkdirSync(cacheDir, { recursive: true });
|
|
117
121
|
return cacheDir;
|
|
118
122
|
};
|
|
119
123
|
const NodeCache = async (dir) => {
|
|
120
|
-
const fs =
|
|
121
|
-
const
|
|
122
|
-
const
|
|
124
|
+
const fs = require("node:fs");
|
|
125
|
+
const path = require("node:path");
|
|
126
|
+
const os = require("node:os");
|
|
127
|
+
const { createHash } = require("node:crypto");
|
|
128
|
+
const cacheDir = await makeCacheDir(dir, fs, path, os);
|
|
123
129
|
return {
|
|
124
130
|
makeKey: (key) => {
|
|
125
131
|
const input = key && key instanceof Object ? JSON.stringify(key) : key || "";
|
|
@@ -147,12 +153,8 @@
|
|
|
147
153
|
};
|
|
148
154
|
const nodeCache = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
149
155
|
__proto__: null,
|
|
150
|
-
NodeCache
|
|
151
|
-
|
|
152
|
-
const __viteBrowserExternal = {};
|
|
153
|
-
const __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
154
|
-
__proto__: null,
|
|
155
|
-
default: __viteBrowserExternal
|
|
156
|
+
NodeCache,
|
|
157
|
+
makeCacheDir
|
|
156
158
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
157
159
|
exports2.TINA_HOST = TINA_HOST;
|
|
158
160
|
exports2.TinaClient = TinaClient;
|
package/dist/client.mjs
CHANGED
|
@@ -24,7 +24,7 @@ class TinaClient {
|
|
|
24
24
|
}
|
|
25
25
|
try {
|
|
26
26
|
if (this.cacheDir && typeof window === "undefined" && typeof require !== "undefined") {
|
|
27
|
-
const { NodeCache } = await import("./node-cache-
|
|
27
|
+
const { NodeCache } = await import("./node-cache-4c336858.mjs");
|
|
28
28
|
this.cache = await NodeCache(this.cacheDir);
|
|
29
29
|
}
|
|
30
30
|
} catch (e) {
|
package/dist/index.js
CHANGED
|
@@ -774,6 +774,22 @@ var __publicField = (obj, key, value) => {
|
|
|
774
774
|
);
|
|
775
775
|
};
|
|
776
776
|
}
|
|
777
|
+
function wrapFieldWithNoHeader(Field) {
|
|
778
|
+
return (props) => {
|
|
779
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
780
|
+
FieldMeta,
|
|
781
|
+
{
|
|
782
|
+
name: props.input.name,
|
|
783
|
+
label: false,
|
|
784
|
+
description: "",
|
|
785
|
+
error: props.meta.error,
|
|
786
|
+
index: props.index,
|
|
787
|
+
tinaForm: props.tinaForm
|
|
788
|
+
},
|
|
789
|
+
/* @__PURE__ */ React__namespace.createElement(Field, { ...props })
|
|
790
|
+
);
|
|
791
|
+
};
|
|
792
|
+
}
|
|
777
793
|
function wrapFieldWithError(Field) {
|
|
778
794
|
return (props) => {
|
|
779
795
|
return /* @__PURE__ */ React__namespace.createElement(
|
|
@@ -850,9 +866,9 @@ var __publicField = (obj, key, value) => {
|
|
|
850
866
|
"span",
|
|
851
867
|
{
|
|
852
868
|
className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0 ${className}`,
|
|
853
|
-
...props
|
|
854
|
-
|
|
855
|
-
|
|
869
|
+
...props,
|
|
870
|
+
dangerouslySetInnerHTML: { __html: children }
|
|
871
|
+
}
|
|
856
872
|
);
|
|
857
873
|
};
|
|
858
874
|
const FieldError = ({
|
|
@@ -3676,7 +3692,7 @@ flowchart TD
|
|
|
3676
3692
|
};
|
|
3677
3693
|
const sizeClasses = {
|
|
3678
3694
|
small: `text-xs h-8 px-3`,
|
|
3679
|
-
medium: `text-sm h-10 px-
|
|
3695
|
+
medium: `text-sm h-10 px-8`,
|
|
3680
3696
|
custom: ``
|
|
3681
3697
|
};
|
|
3682
3698
|
return /* @__PURE__ */ React__namespace.createElement(
|
|
@@ -5710,10 +5726,11 @@ flowchart TD
|
|
|
5710
5726
|
return /* @__PURE__ */ React.createElement(
|
|
5711
5727
|
"button",
|
|
5712
5728
|
{
|
|
5713
|
-
|
|
5729
|
+
type: "button",
|
|
5730
|
+
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"}`,
|
|
5714
5731
|
onClick
|
|
5715
5732
|
},
|
|
5716
|
-
/* @__PURE__ */ React.createElement(TrashIcon, { className: "fill-current transition-colors ease-out
|
|
5733
|
+
/* @__PURE__ */ React.createElement(TrashIcon, { className: "h-5 w-auto fill-current text-red-500 transition-colors duration-150 ease-out" })
|
|
5717
5734
|
);
|
|
5718
5735
|
};
|
|
5719
5736
|
const DragHandle = ({ isDragging }) => {
|
|
@@ -5791,27 +5808,35 @@ flowchart TD
|
|
|
5791
5808
|
))))
|
|
5792
5809
|
))));
|
|
5793
5810
|
};
|
|
5794
|
-
const Group =
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5811
|
+
const Group = wrapFieldWithNoHeader(
|
|
5812
|
+
({ tinaForm, field }) => {
|
|
5813
|
+
const cms = useCMS$1();
|
|
5814
|
+
return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(
|
|
5815
|
+
Header,
|
|
5816
|
+
{
|
|
5817
|
+
onClick: () => {
|
|
5818
|
+
const state = tinaForm.finalForm.getState();
|
|
5819
|
+
if (state.invalid === true) {
|
|
5820
|
+
cms.alerts.error("Cannot navigate away from an invalid form.");
|
|
5821
|
+
return;
|
|
5822
|
+
}
|
|
5823
|
+
cms.dispatch({
|
|
5824
|
+
type: "forms:set-active-field-name",
|
|
5825
|
+
value: { formId: tinaForm.id, fieldName: field.name }
|
|
5826
|
+
});
|
|
5805
5827
|
}
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5828
|
+
},
|
|
5829
|
+
field.label || field.name,
|
|
5830
|
+
field.description && /* @__PURE__ */ React__namespace.createElement(
|
|
5831
|
+
"span",
|
|
5832
|
+
{
|
|
5833
|
+
className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0`,
|
|
5834
|
+
dangerouslySetInnerHTML: { __html: field.description }
|
|
5835
|
+
}
|
|
5836
|
+
)
|
|
5837
|
+
));
|
|
5838
|
+
}
|
|
5839
|
+
);
|
|
5815
5840
|
const Header = ({ onClick, children }) => {
|
|
5816
5841
|
return /* @__PURE__ */ React__namespace.createElement("div", { className: "pt-1 mb-5" }, /* @__PURE__ */ React__namespace.createElement(
|
|
5817
5842
|
"button",
|
|
@@ -10308,7 +10333,7 @@ flowchart TD
|
|
|
10308
10333
|
"Event Log"
|
|
10309
10334
|
));
|
|
10310
10335
|
};
|
|
10311
|
-
const version = "2.
|
|
10336
|
+
const version = "2.5.0";
|
|
10312
10337
|
const Nav = ({
|
|
10313
10338
|
isLocalMode,
|
|
10314
10339
|
className = "",
|
|
@@ -12839,15 +12864,14 @@ flowchart TD
|
|
|
12839
12864
|
fields: fieldGroup.fields
|
|
12840
12865
|
}
|
|
12841
12866
|
) : /* @__PURE__ */ React__namespace.createElement(NoFieldsPlaceholder, null)
|
|
12842
|
-
)), !hideFooter && /* @__PURE__ */ React__namespace.createElement("div", { className: "relative flex-none w-full h-16 px-
|
|
12867
|
+
)), !hideFooter && /* @__PURE__ */ React__namespace.createElement("div", { className: "relative flex-none w-full h-16 px-12 bg-white border-t border-gray-100 flex items-center justify-end" }, /* @__PURE__ */ React__namespace.createElement("div", { className: "flex-1 w-full justify-end gap-2 flex items-center max-w-form" }, tinaForm.reset && /* @__PURE__ */ React__namespace.createElement(
|
|
12843
12868
|
ResetForm,
|
|
12844
12869
|
{
|
|
12845
12870
|
pristine,
|
|
12846
12871
|
reset: async () => {
|
|
12847
12872
|
finalForm2.reset();
|
|
12848
12873
|
await tinaForm.reset();
|
|
12849
|
-
}
|
|
12850
|
-
style: { flexGrow: 1 }
|
|
12874
|
+
}
|
|
12851
12875
|
},
|
|
12852
12876
|
tinaForm.buttons.reset
|
|
12853
12877
|
), /* @__PURE__ */ React__namespace.createElement(
|
|
@@ -12856,8 +12880,7 @@ flowchart TD
|
|
|
12856
12880
|
onClick: safeHandleSubmit,
|
|
12857
12881
|
disabled: !canSubmit,
|
|
12858
12882
|
busy: submitting,
|
|
12859
|
-
variant: "primary"
|
|
12860
|
-
style: { flexGrow: 3 }
|
|
12883
|
+
variant: "primary"
|
|
12861
12884
|
},
|
|
12862
12885
|
submitting && /* @__PURE__ */ React__namespace.createElement(LoadingDots, null),
|
|
12863
12886
|
!submitting && tinaForm.buttons.save
|
|
@@ -14427,6 +14450,7 @@ flowchart TD
|
|
|
14427
14450
|
ToolbarButton,
|
|
14428
14451
|
{
|
|
14429
14452
|
showArrow: false,
|
|
14453
|
+
"data-testid": "rich-text-editor-overflow-menu-button",
|
|
14430
14454
|
className: "lg:min-w-[130px]",
|
|
14431
14455
|
isDropdown: true,
|
|
14432
14456
|
pressed: openState.open,
|
|
@@ -14480,7 +14504,17 @@ flowchart TD
|
|
|
14480
14504
|
};
|
|
14481
14505
|
const RawMarkdownToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
|
|
14482
14506
|
const { props } = useRawMarkdownToolbarButton();
|
|
14483
|
-
return /* @__PURE__ */ React.createElement(
|
|
14507
|
+
return /* @__PURE__ */ React.createElement(
|
|
14508
|
+
ToolbarButton,
|
|
14509
|
+
{
|
|
14510
|
+
ref,
|
|
14511
|
+
tooltip: "Link",
|
|
14512
|
+
...rest,
|
|
14513
|
+
...props,
|
|
14514
|
+
"data-testid": "markdown-button"
|
|
14515
|
+
},
|
|
14516
|
+
/* @__PURE__ */ React.createElement(Icons.raw, null)
|
|
14517
|
+
);
|
|
14484
14518
|
});
|
|
14485
14519
|
function TableDropdownMenu(props) {
|
|
14486
14520
|
const tableSelected = plateCommon.useEditorSelector(
|
|
@@ -30079,6 +30113,7 @@ mutation addPendingDocumentMutation(
|
|
|
30079
30113
|
relativePath
|
|
30080
30114
|
filename
|
|
30081
30115
|
extension
|
|
30116
|
+
hasReferences
|
|
30082
30117
|
}
|
|
30083
30118
|
}
|
|
30084
30119
|
}
|
|
@@ -30170,6 +30205,9 @@ mutation addPendingDocumentMutation(
|
|
|
30170
30205
|
document(collection:$collection, relativePath:$relativePath) {
|
|
30171
30206
|
... on Document {
|
|
30172
30207
|
_values
|
|
30208
|
+
_sys {
|
|
30209
|
+
hasReferences
|
|
30210
|
+
}
|
|
30173
30211
|
}
|
|
30174
30212
|
}
|
|
30175
30213
|
}`;
|
|
@@ -31896,6 +31934,23 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31896
31934
|
DeleteModal,
|
|
31897
31935
|
{
|
|
31898
31936
|
filename: vars.relativePath,
|
|
31937
|
+
checkRefsFunc: async () => {
|
|
31938
|
+
var _a2, _b2;
|
|
31939
|
+
try {
|
|
31940
|
+
const doc = await admin.fetchDocument(
|
|
31941
|
+
collection.name,
|
|
31942
|
+
vars.relativePath,
|
|
31943
|
+
true
|
|
31944
|
+
);
|
|
31945
|
+
return (_b2 = (_a2 = doc == null ? void 0 : doc.document) == null ? void 0 : _a2._sys) == null ? void 0 : _b2.hasReferences;
|
|
31946
|
+
} catch (error) {
|
|
31947
|
+
cms.alerts.error(
|
|
31948
|
+
"Document was not found, ask a developer for help or check the console for an error message"
|
|
31949
|
+
);
|
|
31950
|
+
console.error(error);
|
|
31951
|
+
throw error;
|
|
31952
|
+
}
|
|
31953
|
+
},
|
|
31899
31954
|
deleteFunc: async () => {
|
|
31900
31955
|
try {
|
|
31901
31956
|
await admin.deleteDocument(vars);
|
|
@@ -31904,6 +31959,12 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31904
31959
|
);
|
|
31905
31960
|
reFetchCollection();
|
|
31906
31961
|
} catch (error) {
|
|
31962
|
+
if (error.message.indexOf("has references")) {
|
|
31963
|
+
cms.alerts.error(
|
|
31964
|
+
error.message.split("\n ").filter(Boolean)[1]
|
|
31965
|
+
);
|
|
31966
|
+
return;
|
|
31967
|
+
}
|
|
31907
31968
|
cms.alerts.warn(
|
|
31908
31969
|
"Document was not deleted, ask a developer for help or check the console for an error message"
|
|
31909
31970
|
);
|
|
@@ -31955,6 +32016,12 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31955
32016
|
cms.alerts.info("Document was successfully renamed");
|
|
31956
32017
|
reFetchCollection();
|
|
31957
32018
|
} catch (error) {
|
|
32019
|
+
if (error.message.indexOf("has references")) {
|
|
32020
|
+
cms.alerts.error(
|
|
32021
|
+
error.message.split("\n ").filter(Boolean)[1]
|
|
32022
|
+
);
|
|
32023
|
+
return;
|
|
32024
|
+
}
|
|
31958
32025
|
cms.alerts.warn(
|
|
31959
32026
|
"Document was not renamed, ask a developer for help or check the console for an error message"
|
|
31960
32027
|
);
|
|
@@ -32428,8 +32495,19 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
32428
32495
|
const NoDocumentsPlaceholder = () => {
|
|
32429
32496
|
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."));
|
|
32430
32497
|
};
|
|
32431
|
-
const DeleteModal = ({
|
|
32432
|
-
|
|
32498
|
+
const DeleteModal = ({
|
|
32499
|
+
close: close2,
|
|
32500
|
+
deleteFunc,
|
|
32501
|
+
checkRefsFunc,
|
|
32502
|
+
filename
|
|
32503
|
+
}) => {
|
|
32504
|
+
const [hasRefs, setHasRefs] = React.useState();
|
|
32505
|
+
React.useEffect(() => {
|
|
32506
|
+
checkRefsFunc().then((result) => {
|
|
32507
|
+
setHasRefs(result);
|
|
32508
|
+
});
|
|
32509
|
+
}, [filename, checkRefsFunc]);
|
|
32510
|
+
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(
|
|
32433
32511
|
Button$1,
|
|
32434
32512
|
{
|
|
32435
32513
|
style: { flexGrow: 3 },
|
|
@@ -33796,6 +33874,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
33796
33874
|
exports2.useScreenPlugin = useScreenPlugin;
|
|
33797
33875
|
exports2.useTinaAuthRedirect = useTinaAuthRedirect;
|
|
33798
33876
|
exports2.wrapFieldWithError = wrapFieldWithError;
|
|
33877
|
+
exports2.wrapFieldWithNoHeader = wrapFieldWithNoHeader;
|
|
33799
33878
|
exports2.wrapFieldsWithMeta = wrapFieldsWithMeta;
|
|
33800
33879
|
Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
33801
33880
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -801,6 +801,22 @@ function wrapFieldsWithMeta(Field2) {
|
|
|
801
801
|
);
|
|
802
802
|
};
|
|
803
803
|
}
|
|
804
|
+
function wrapFieldWithNoHeader(Field2) {
|
|
805
|
+
return (props) => {
|
|
806
|
+
return /* @__PURE__ */ React.createElement(
|
|
807
|
+
FieldMeta,
|
|
808
|
+
{
|
|
809
|
+
name: props.input.name,
|
|
810
|
+
label: false,
|
|
811
|
+
description: "",
|
|
812
|
+
error: props.meta.error,
|
|
813
|
+
index: props.index,
|
|
814
|
+
tinaForm: props.tinaForm
|
|
815
|
+
},
|
|
816
|
+
/* @__PURE__ */ React.createElement(Field2, { ...props })
|
|
817
|
+
);
|
|
818
|
+
};
|
|
819
|
+
}
|
|
804
820
|
function wrapFieldWithError(Field2) {
|
|
805
821
|
return (props) => {
|
|
806
822
|
return /* @__PURE__ */ React.createElement(
|
|
@@ -877,9 +893,9 @@ const FieldDescription = ({
|
|
|
877
893
|
"span",
|
|
878
894
|
{
|
|
879
895
|
className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0 ${className}`,
|
|
880
|
-
...props
|
|
881
|
-
|
|
882
|
-
|
|
896
|
+
...props,
|
|
897
|
+
dangerouslySetInnerHTML: { __html: children }
|
|
898
|
+
}
|
|
883
899
|
);
|
|
884
900
|
};
|
|
885
901
|
const FieldError = ({
|
|
@@ -3703,7 +3719,7 @@ const Button$1 = ({
|
|
|
3703
3719
|
};
|
|
3704
3720
|
const sizeClasses = {
|
|
3705
3721
|
small: `text-xs h-8 px-3`,
|
|
3706
|
-
medium: `text-sm h-10 px-
|
|
3722
|
+
medium: `text-sm h-10 px-8`,
|
|
3707
3723
|
custom: ``
|
|
3708
3724
|
};
|
|
3709
3725
|
return /* @__PURE__ */ React.createElement(
|
|
@@ -5737,10 +5753,11 @@ const ItemDeleteButton = ({ onClick, disabled = false }) => {
|
|
|
5737
5753
|
return /* @__PURE__ */ React__default.createElement(
|
|
5738
5754
|
"button",
|
|
5739
5755
|
{
|
|
5740
|
-
|
|
5756
|
+
type: "button",
|
|
5757
|
+
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"}`,
|
|
5741
5758
|
onClick
|
|
5742
5759
|
},
|
|
5743
|
-
/* @__PURE__ */ React__default.createElement(TrashIcon, { className: "fill-current transition-colors ease-out
|
|
5760
|
+
/* @__PURE__ */ React__default.createElement(TrashIcon, { className: "h-5 w-auto fill-current text-red-500 transition-colors duration-150 ease-out" })
|
|
5744
5761
|
);
|
|
5745
5762
|
};
|
|
5746
5763
|
const DragHandle = ({ isDragging }) => {
|
|
@@ -5818,27 +5835,35 @@ const BlockSelector = ({
|
|
|
5818
5835
|
))))
|
|
5819
5836
|
))));
|
|
5820
5837
|
};
|
|
5821
|
-
const Group =
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5838
|
+
const Group = wrapFieldWithNoHeader(
|
|
5839
|
+
({ tinaForm, field }) => {
|
|
5840
|
+
const cms = useCMS$1();
|
|
5841
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
5842
|
+
Header,
|
|
5843
|
+
{
|
|
5844
|
+
onClick: () => {
|
|
5845
|
+
const state = tinaForm.finalForm.getState();
|
|
5846
|
+
if (state.invalid === true) {
|
|
5847
|
+
cms.alerts.error("Cannot navigate away from an invalid form.");
|
|
5848
|
+
return;
|
|
5849
|
+
}
|
|
5850
|
+
cms.dispatch({
|
|
5851
|
+
type: "forms:set-active-field-name",
|
|
5852
|
+
value: { formId: tinaForm.id, fieldName: field.name }
|
|
5853
|
+
});
|
|
5832
5854
|
}
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5855
|
+
},
|
|
5856
|
+
field.label || field.name,
|
|
5857
|
+
field.description && /* @__PURE__ */ React.createElement(
|
|
5858
|
+
"span",
|
|
5859
|
+
{
|
|
5860
|
+
className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0`,
|
|
5861
|
+
dangerouslySetInnerHTML: { __html: field.description }
|
|
5862
|
+
}
|
|
5863
|
+
)
|
|
5864
|
+
));
|
|
5865
|
+
}
|
|
5866
|
+
);
|
|
5842
5867
|
const Header = ({ onClick, children }) => {
|
|
5843
5868
|
return /* @__PURE__ */ React.createElement("div", { className: "pt-1 mb-5" }, /* @__PURE__ */ React.createElement(
|
|
5844
5869
|
"button",
|
|
@@ -10335,7 +10360,7 @@ const SyncStatus = ({ cms, setEventsOpen }) => {
|
|
|
10335
10360
|
"Event Log"
|
|
10336
10361
|
));
|
|
10337
10362
|
};
|
|
10338
|
-
const version = "2.
|
|
10363
|
+
const version = "2.5.0";
|
|
10339
10364
|
const Nav = ({
|
|
10340
10365
|
isLocalMode,
|
|
10341
10366
|
className = "",
|
|
@@ -12866,15 +12891,14 @@ const FormBuilder = ({
|
|
|
12866
12891
|
fields: fieldGroup.fields
|
|
12867
12892
|
}
|
|
12868
12893
|
) : /* @__PURE__ */ React.createElement(NoFieldsPlaceholder, null)
|
|
12869
|
-
)), !hideFooter && /* @__PURE__ */ React.createElement("div", { className: "relative flex-none w-full h-16 px-
|
|
12894
|
+
)), !hideFooter && /* @__PURE__ */ React.createElement("div", { className: "relative flex-none w-full h-16 px-12 bg-white border-t border-gray-100 flex items-center justify-end" }, /* @__PURE__ */ React.createElement("div", { className: "flex-1 w-full justify-end gap-2 flex items-center max-w-form" }, tinaForm.reset && /* @__PURE__ */ React.createElement(
|
|
12870
12895
|
ResetForm,
|
|
12871
12896
|
{
|
|
12872
12897
|
pristine,
|
|
12873
12898
|
reset: async () => {
|
|
12874
12899
|
finalForm.reset();
|
|
12875
12900
|
await tinaForm.reset();
|
|
12876
|
-
}
|
|
12877
|
-
style: { flexGrow: 1 }
|
|
12901
|
+
}
|
|
12878
12902
|
},
|
|
12879
12903
|
tinaForm.buttons.reset
|
|
12880
12904
|
), /* @__PURE__ */ React.createElement(
|
|
@@ -12883,8 +12907,7 @@ const FormBuilder = ({
|
|
|
12883
12907
|
onClick: safeHandleSubmit,
|
|
12884
12908
|
disabled: !canSubmit,
|
|
12885
12909
|
busy: submitting,
|
|
12886
|
-
variant: "primary"
|
|
12887
|
-
style: { flexGrow: 3 }
|
|
12910
|
+
variant: "primary"
|
|
12888
12911
|
},
|
|
12889
12912
|
submitting && /* @__PURE__ */ React.createElement(LoadingDots, null),
|
|
12890
12913
|
!submitting && tinaForm.buttons.save
|
|
@@ -14454,6 +14477,7 @@ function OverflowMenu({
|
|
|
14454
14477
|
ToolbarButton,
|
|
14455
14478
|
{
|
|
14456
14479
|
showArrow: false,
|
|
14480
|
+
"data-testid": "rich-text-editor-overflow-menu-button",
|
|
14457
14481
|
className: "lg:min-w-[130px]",
|
|
14458
14482
|
isDropdown: true,
|
|
14459
14483
|
pressed: openState.open,
|
|
@@ -14507,7 +14531,17 @@ const useRawMarkdownToolbarButton = () => {
|
|
|
14507
14531
|
};
|
|
14508
14532
|
const RawMarkdownToolbarButton = withRef(({ clear, ...rest }, ref) => {
|
|
14509
14533
|
const { props } = useRawMarkdownToolbarButton();
|
|
14510
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
14534
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
14535
|
+
ToolbarButton,
|
|
14536
|
+
{
|
|
14537
|
+
ref,
|
|
14538
|
+
tooltip: "Link",
|
|
14539
|
+
...rest,
|
|
14540
|
+
...props,
|
|
14541
|
+
"data-testid": "markdown-button"
|
|
14542
|
+
},
|
|
14543
|
+
/* @__PURE__ */ React__default.createElement(Icons.raw, null)
|
|
14544
|
+
);
|
|
14511
14545
|
});
|
|
14512
14546
|
function TableDropdownMenu(props) {
|
|
14513
14547
|
const tableSelected = useEditorSelector(
|
|
@@ -30106,6 +30140,7 @@ class TinaAdminApi {
|
|
|
30106
30140
|
relativePath
|
|
30107
30141
|
filename
|
|
30108
30142
|
extension
|
|
30143
|
+
hasReferences
|
|
30109
30144
|
}
|
|
30110
30145
|
}
|
|
30111
30146
|
}
|
|
@@ -30197,6 +30232,9 @@ class TinaAdminApi {
|
|
|
30197
30232
|
document(collection:$collection, relativePath:$relativePath) {
|
|
30198
30233
|
... on Document {
|
|
30199
30234
|
_values
|
|
30235
|
+
_sys {
|
|
30236
|
+
hasReferences
|
|
30237
|
+
}
|
|
30200
30238
|
}
|
|
30201
30239
|
}
|
|
30202
30240
|
}`;
|
|
@@ -31923,6 +31961,23 @@ const CollectionListPage = () => {
|
|
|
31923
31961
|
DeleteModal,
|
|
31924
31962
|
{
|
|
31925
31963
|
filename: vars.relativePath,
|
|
31964
|
+
checkRefsFunc: async () => {
|
|
31965
|
+
var _a2, _b2;
|
|
31966
|
+
try {
|
|
31967
|
+
const doc = await admin.fetchDocument(
|
|
31968
|
+
collection.name,
|
|
31969
|
+
vars.relativePath,
|
|
31970
|
+
true
|
|
31971
|
+
);
|
|
31972
|
+
return (_b2 = (_a2 = doc == null ? void 0 : doc.document) == null ? void 0 : _a2._sys) == null ? void 0 : _b2.hasReferences;
|
|
31973
|
+
} catch (error) {
|
|
31974
|
+
cms.alerts.error(
|
|
31975
|
+
"Document was not found, ask a developer for help or check the console for an error message"
|
|
31976
|
+
);
|
|
31977
|
+
console.error(error);
|
|
31978
|
+
throw error;
|
|
31979
|
+
}
|
|
31980
|
+
},
|
|
31926
31981
|
deleteFunc: async () => {
|
|
31927
31982
|
try {
|
|
31928
31983
|
await admin.deleteDocument(vars);
|
|
@@ -31931,6 +31986,12 @@ const CollectionListPage = () => {
|
|
|
31931
31986
|
);
|
|
31932
31987
|
reFetchCollection();
|
|
31933
31988
|
} catch (error) {
|
|
31989
|
+
if (error.message.indexOf("has references")) {
|
|
31990
|
+
cms.alerts.error(
|
|
31991
|
+
error.message.split("\n ").filter(Boolean)[1]
|
|
31992
|
+
);
|
|
31993
|
+
return;
|
|
31994
|
+
}
|
|
31934
31995
|
cms.alerts.warn(
|
|
31935
31996
|
"Document was not deleted, ask a developer for help or check the console for an error message"
|
|
31936
31997
|
);
|
|
@@ -31982,6 +32043,12 @@ const CollectionListPage = () => {
|
|
|
31982
32043
|
cms.alerts.info("Document was successfully renamed");
|
|
31983
32044
|
reFetchCollection();
|
|
31984
32045
|
} catch (error) {
|
|
32046
|
+
if (error.message.indexOf("has references")) {
|
|
32047
|
+
cms.alerts.error(
|
|
32048
|
+
error.message.split("\n ").filter(Boolean)[1]
|
|
32049
|
+
);
|
|
32050
|
+
return;
|
|
32051
|
+
}
|
|
31985
32052
|
cms.alerts.warn(
|
|
31986
32053
|
"Document was not renamed, ask a developer for help or check the console for an error message"
|
|
31987
32054
|
);
|
|
@@ -32455,8 +32522,19 @@ const Breadcrumb = ({ folder, navigate, collectionName }) => {
|
|
|
32455
32522
|
const NoDocumentsPlaceholder = () => {
|
|
32456
32523
|
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."));
|
|
32457
32524
|
};
|
|
32458
|
-
const DeleteModal = ({
|
|
32459
|
-
|
|
32525
|
+
const DeleteModal = ({
|
|
32526
|
+
close: close2,
|
|
32527
|
+
deleteFunc,
|
|
32528
|
+
checkRefsFunc,
|
|
32529
|
+
filename
|
|
32530
|
+
}) => {
|
|
32531
|
+
const [hasRefs, setHasRefs] = React__default.useState();
|
|
32532
|
+
useEffect(() => {
|
|
32533
|
+
checkRefsFunc().then((result) => {
|
|
32534
|
+
setHasRefs(result);
|
|
32535
|
+
});
|
|
32536
|
+
}, [filename, checkRefsFunc]);
|
|
32537
|
+
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(
|
|
32460
32538
|
Button$1,
|
|
32461
32539
|
{
|
|
32462
32540
|
style: { flexGrow: 3 },
|
|
@@ -33818,5 +33896,6 @@ export {
|
|
|
33818
33896
|
useScreenPlugin,
|
|
33819
33897
|
useTinaAuthRedirect,
|
|
33820
33898
|
wrapFieldWithError,
|
|
33899
|
+
wrapFieldWithNoHeader,
|
|
33821
33900
|
wrapFieldsWithMeta
|
|
33822
33901
|
};
|
|
@@ -1,18 +1,24 @@
|
|
|
1
|
-
const makeCacheDir = async (dir, fs) => {
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
1
|
+
const makeCacheDir = async (dir, fs, path, os) => {
|
|
2
|
+
const pathParts = dir.split(path.sep).filter(Boolean);
|
|
3
|
+
const cacheHash = pathParts[pathParts.length - 1];
|
|
4
|
+
const rootUser = pathParts[0];
|
|
5
5
|
let cacheDir = dir;
|
|
6
|
-
if (!fs.existsSync(path.join(path.sep,
|
|
7
|
-
cacheDir = path.join(os.tmpdir(),
|
|
6
|
+
if (!fs.existsSync(path.join(path.sep, rootUser))) {
|
|
7
|
+
cacheDir = path.join(os.tmpdir(), cacheHash);
|
|
8
|
+
}
|
|
9
|
+
try {
|
|
10
|
+
fs.mkdirSync(cacheDir, { recursive: true });
|
|
11
|
+
} catch (error) {
|
|
12
|
+
throw new Error(`Failed to create cache directory: ${error.message}`);
|
|
8
13
|
}
|
|
9
|
-
fs.mkdirSync(cacheDir, { recursive: true });
|
|
10
14
|
return cacheDir;
|
|
11
15
|
};
|
|
12
16
|
const NodeCache = async (dir) => {
|
|
13
|
-
const fs =
|
|
14
|
-
const
|
|
15
|
-
const
|
|
17
|
+
const fs = require("node:fs");
|
|
18
|
+
const path = require("node:path");
|
|
19
|
+
const os = require("node:os");
|
|
20
|
+
const { createHash } = require("node:crypto");
|
|
21
|
+
const cacheDir = await makeCacheDir(dir, fs, path, os);
|
|
16
22
|
return {
|
|
17
23
|
makeKey: (key) => {
|
|
18
24
|
const input = key && key instanceof Object ? JSON.stringify(key) : key || "";
|
|
@@ -39,5 +45,6 @@ const NodeCache = async (dir) => {
|
|
|
39
45
|
};
|
|
40
46
|
};
|
|
41
47
|
export {
|
|
42
|
-
NodeCache
|
|
48
|
+
NodeCache,
|
|
49
|
+
makeCacheDir
|
|
43
50
|
};
|
|
@@ -3,6 +3,14 @@ import { FieldProps } from './field-props';
|
|
|
3
3
|
import { Form } from '../../forms';
|
|
4
4
|
export type InputFieldType<ExtraFieldProps, InputProps> = FieldProps<InputProps> & ExtraFieldProps;
|
|
5
5
|
export declare function wrapFieldsWithMeta<ExtraFieldProps = {}, InputProps = {}>(Field: React.FunctionComponent<InputFieldType<ExtraFieldProps, InputProps>> | React.ComponentClass<InputFieldType<ExtraFieldProps, InputProps>>): (props: InputFieldType<ExtraFieldProps, InputProps>) => React.JSX.Element;
|
|
6
|
+
/**
|
|
7
|
+
* Same as wrapFieldsWithMeta but excludes the label, and description useful for fields that render their label and description
|
|
8
|
+
*/
|
|
9
|
+
export declare function wrapFieldWithNoHeader<ExtraFieldProps = {}, InputProps = {}>(Field: React.FunctionComponent<InputFieldType<ExtraFieldProps, InputProps>> | React.ComponentClass<InputFieldType<ExtraFieldProps, InputProps>>): (props: InputFieldType<ExtraFieldProps, InputProps>) => React.JSX.Element;
|
|
10
|
+
/**
|
|
11
|
+
* Same as above but excludes the label, useful for fields that have their own label
|
|
12
|
+
* @deprecated This function is deprecated and will be removed in future versions.
|
|
13
|
+
*/
|
|
6
14
|
export declare function wrapFieldWithError<ExtraFieldProps = {}, InputProps = {}>(Field: React.FunctionComponent<InputFieldType<ExtraFieldProps, InputProps>> | React.ComponentClass<InputFieldType<ExtraFieldProps, InputProps>>): (props: InputFieldType<ExtraFieldProps, InputProps>) => React.JSX.Element;
|
|
7
15
|
interface FieldMetaProps extends React.HTMLAttributes<HTMLElement> {
|
|
8
16
|
name: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tinacms",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
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.
|
|
64
|
-
"@floating-ui/dom": "^1.6.
|
|
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.
|
|
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.
|
|
71
|
-
"@radix-ui/react-dialog": "^1.1.
|
|
72
|
-
"@radix-ui/react-dropdown-menu": "^2.1.
|
|
73
|
-
"@radix-ui/react-popover": "^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.
|
|
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.
|
|
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.
|
|
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.
|
|
133
|
-
"@tinacms/
|
|
134
|
-
"@tinacms/
|
|
132
|
+
"@tinacms/mdx": "1.5.2",
|
|
133
|
+
"@tinacms/search": "1.0.35",
|
|
134
|
+
"@tinacms/schema-tools": "1.6.8"
|
|
135
135
|
},
|
|
136
136
|
"devDependencies": {
|
|
137
|
-
"@graphql-tools/utils": "^10.5.
|
|
137
|
+
"@graphql-tools/utils": "^10.5.6",
|
|
138
138
|
"@testing-library/dom": "^10.4.0",
|
|
139
|
-
"@testing-library/jest-dom": "^6.
|
|
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.
|
|
147
|
+
"@types/node": "^22.9.0",
|
|
148
148
|
"@types/prop-types": "^15.7.13",
|
|
149
|
-
"@types/react": "^18.3.
|
|
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.
|
|
152
|
+
"@types/react-dom": "^18.3.1",
|
|
153
153
|
"@types/yup": "^0.32.0",
|
|
154
|
-
"happy-dom": "
|
|
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.
|
|
164
|
-
"typescript": "^5.6.
|
|
165
|
-
"vite": "^5.4.
|
|
166
|
-
"vitest": "^2.1.
|
|
167
|
-
"@tinacms/scripts": "1.3.
|
|
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",
|