tinacms 0.0.0-f03fd62-20241023052950 → 0.0.0-f696c7d-20241104134240
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 +11 -18
- package/dist/client.mjs +1 -1
- package/dist/index.js +111 -33
- package/dist/index.mjs +111 -33
- package/dist/{node-cache-065e42a2.mjs → node-cache-4c336858.mjs} +11 -13
- package/dist/toolkit/fields/plugins/wrap-field-with-meta.d.ts +8 -0
- package/package.json +4 -4
- package/dist/__vite-browser-external-d06ac358.mjs +0 -4
package/dist/admin/types.d.ts
CHANGED
package/dist/client.js
CHANGED
|
@@ -105,16 +105,12 @@
|
|
|
105
105
|
const client = new TinaClient(args);
|
|
106
106
|
return client;
|
|
107
107
|
}
|
|
108
|
-
const makeCacheDir = async (dir, fs) => {
|
|
109
|
-
const
|
|
110
|
-
const os = await Promise.resolve().then(() => __viteBrowserExternal$1);
|
|
111
|
-
if (typeof dir !== "string" || !dir.trim()) {
|
|
112
|
-
throw new Error("Invalid directory path");
|
|
113
|
-
}
|
|
114
|
-
const pathParts = dir.split(path.sep);
|
|
108
|
+
const makeCacheDir = async (dir, fs, path, os) => {
|
|
109
|
+
const pathParts = dir.split(path.sep).filter(Boolean);
|
|
115
110
|
const cacheHash = pathParts[pathParts.length - 1];
|
|
111
|
+
const rootUser = pathParts[0];
|
|
116
112
|
let cacheDir = dir;
|
|
117
|
-
if (!fs.existsSync(
|
|
113
|
+
if (!fs.existsSync(path.join(path.sep, rootUser))) {
|
|
118
114
|
cacheDir = path.join(os.tmpdir(), cacheHash);
|
|
119
115
|
}
|
|
120
116
|
try {
|
|
@@ -125,10 +121,11 @@
|
|
|
125
121
|
return cacheDir;
|
|
126
122
|
};
|
|
127
123
|
const NodeCache = async (dir) => {
|
|
128
|
-
const fs =
|
|
129
|
-
|
|
130
|
-
const
|
|
131
|
-
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);
|
|
132
129
|
return {
|
|
133
130
|
makeKey: (key) => {
|
|
134
131
|
const input = key && key instanceof Object ? JSON.stringify(key) : key || "";
|
|
@@ -156,12 +153,8 @@
|
|
|
156
153
|
};
|
|
157
154
|
const nodeCache = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
158
155
|
__proto__: null,
|
|
159
|
-
NodeCache
|
|
160
|
-
|
|
161
|
-
const __viteBrowserExternal = {};
|
|
162
|
-
const __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
163
|
-
__proto__: null,
|
|
164
|
-
default: __viteBrowserExternal
|
|
156
|
+
NodeCache,
|
|
157
|
+
makeCacheDir
|
|
165
158
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
166
159
|
exports2.TINA_HOST = TINA_HOST;
|
|
167
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(
|
|
@@ -5791,27 +5807,35 @@ flowchart TD
|
|
|
5791
5807
|
))))
|
|
5792
5808
|
))));
|
|
5793
5809
|
};
|
|
5794
|
-
const Group =
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5810
|
+
const Group = wrapFieldWithNoHeader(
|
|
5811
|
+
({ tinaForm, field }) => {
|
|
5812
|
+
const cms = useCMS$1();
|
|
5813
|
+
return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(
|
|
5814
|
+
Header,
|
|
5815
|
+
{
|
|
5816
|
+
onClick: () => {
|
|
5817
|
+
const state = tinaForm.finalForm.getState();
|
|
5818
|
+
if (state.invalid === true) {
|
|
5819
|
+
cms.alerts.error("Cannot navigate away from an invalid form.");
|
|
5820
|
+
return;
|
|
5821
|
+
}
|
|
5822
|
+
cms.dispatch({
|
|
5823
|
+
type: "forms:set-active-field-name",
|
|
5824
|
+
value: { formId: tinaForm.id, fieldName: field.name }
|
|
5825
|
+
});
|
|
5805
5826
|
}
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5827
|
+
},
|
|
5828
|
+
field.label || field.name,
|
|
5829
|
+
field.description && /* @__PURE__ */ React__namespace.createElement(
|
|
5830
|
+
"span",
|
|
5831
|
+
{
|
|
5832
|
+
className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0`,
|
|
5833
|
+
dangerouslySetInnerHTML: { __html: field.description }
|
|
5834
|
+
}
|
|
5835
|
+
)
|
|
5836
|
+
));
|
|
5837
|
+
}
|
|
5838
|
+
);
|
|
5815
5839
|
const Header = ({ onClick, children }) => {
|
|
5816
5840
|
return /* @__PURE__ */ React__namespace.createElement("div", { className: "pt-1 mb-5" }, /* @__PURE__ */ React__namespace.createElement(
|
|
5817
5841
|
"button",
|
|
@@ -10308,7 +10332,7 @@ flowchart TD
|
|
|
10308
10332
|
"Event Log"
|
|
10309
10333
|
));
|
|
10310
10334
|
};
|
|
10311
|
-
const version = "2.
|
|
10335
|
+
const version = "2.4.0";
|
|
10312
10336
|
const Nav = ({
|
|
10313
10337
|
isLocalMode,
|
|
10314
10338
|
className = "",
|
|
@@ -12839,15 +12863,14 @@ flowchart TD
|
|
|
12839
12863
|
fields: fieldGroup.fields
|
|
12840
12864
|
}
|
|
12841
12865
|
) : /* @__PURE__ */ React__namespace.createElement(NoFieldsPlaceholder, null)
|
|
12842
|
-
)), !hideFooter && /* @__PURE__ */ React__namespace.createElement("div", { className: "relative flex-none w-full h-16 px-
|
|
12866
|
+
)), !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
12867
|
ResetForm,
|
|
12844
12868
|
{
|
|
12845
12869
|
pristine,
|
|
12846
12870
|
reset: async () => {
|
|
12847
12871
|
finalForm2.reset();
|
|
12848
12872
|
await tinaForm.reset();
|
|
12849
|
-
}
|
|
12850
|
-
style: { flexGrow: 1 }
|
|
12873
|
+
}
|
|
12851
12874
|
},
|
|
12852
12875
|
tinaForm.buttons.reset
|
|
12853
12876
|
), /* @__PURE__ */ React__namespace.createElement(
|
|
@@ -12856,8 +12879,7 @@ flowchart TD
|
|
|
12856
12879
|
onClick: safeHandleSubmit,
|
|
12857
12880
|
disabled: !canSubmit,
|
|
12858
12881
|
busy: submitting,
|
|
12859
|
-
variant: "primary"
|
|
12860
|
-
style: { flexGrow: 3 }
|
|
12882
|
+
variant: "primary"
|
|
12861
12883
|
},
|
|
12862
12884
|
submitting && /* @__PURE__ */ React__namespace.createElement(LoadingDots, null),
|
|
12863
12885
|
!submitting && tinaForm.buttons.save
|
|
@@ -14427,6 +14449,7 @@ flowchart TD
|
|
|
14427
14449
|
ToolbarButton,
|
|
14428
14450
|
{
|
|
14429
14451
|
showArrow: false,
|
|
14452
|
+
"data-testid": "rich-text-editor-overflow-menu-button",
|
|
14430
14453
|
className: "lg:min-w-[130px]",
|
|
14431
14454
|
isDropdown: true,
|
|
14432
14455
|
pressed: openState.open,
|
|
@@ -14480,7 +14503,17 @@ flowchart TD
|
|
|
14480
14503
|
};
|
|
14481
14504
|
const RawMarkdownToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
|
|
14482
14505
|
const { props } = useRawMarkdownToolbarButton();
|
|
14483
|
-
return /* @__PURE__ */ React.createElement(
|
|
14506
|
+
return /* @__PURE__ */ React.createElement(
|
|
14507
|
+
ToolbarButton,
|
|
14508
|
+
{
|
|
14509
|
+
ref,
|
|
14510
|
+
tooltip: "Link",
|
|
14511
|
+
...rest,
|
|
14512
|
+
...props,
|
|
14513
|
+
"data-testid": "markdown-button"
|
|
14514
|
+
},
|
|
14515
|
+
/* @__PURE__ */ React.createElement(Icons.raw, null)
|
|
14516
|
+
);
|
|
14484
14517
|
});
|
|
14485
14518
|
function TableDropdownMenu(props) {
|
|
14486
14519
|
const tableSelected = plateCommon.useEditorSelector(
|
|
@@ -30079,6 +30112,7 @@ mutation addPendingDocumentMutation(
|
|
|
30079
30112
|
relativePath
|
|
30080
30113
|
filename
|
|
30081
30114
|
extension
|
|
30115
|
+
hasReferences
|
|
30082
30116
|
}
|
|
30083
30117
|
}
|
|
30084
30118
|
}
|
|
@@ -30170,6 +30204,9 @@ mutation addPendingDocumentMutation(
|
|
|
30170
30204
|
document(collection:$collection, relativePath:$relativePath) {
|
|
30171
30205
|
... on Document {
|
|
30172
30206
|
_values
|
|
30207
|
+
_sys {
|
|
30208
|
+
hasReferences
|
|
30209
|
+
}
|
|
30173
30210
|
}
|
|
30174
30211
|
}
|
|
30175
30212
|
}`;
|
|
@@ -31896,6 +31933,23 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31896
31933
|
DeleteModal,
|
|
31897
31934
|
{
|
|
31898
31935
|
filename: vars.relativePath,
|
|
31936
|
+
checkRefsFunc: async () => {
|
|
31937
|
+
var _a2, _b2;
|
|
31938
|
+
try {
|
|
31939
|
+
const doc = await admin.fetchDocument(
|
|
31940
|
+
collection.name,
|
|
31941
|
+
vars.relativePath,
|
|
31942
|
+
true
|
|
31943
|
+
);
|
|
31944
|
+
return (_b2 = (_a2 = doc == null ? void 0 : doc.document) == null ? void 0 : _a2._sys) == null ? void 0 : _b2.hasReferences;
|
|
31945
|
+
} catch (error) {
|
|
31946
|
+
cms.alerts.error(
|
|
31947
|
+
"Document was not found, ask a developer for help or check the console for an error message"
|
|
31948
|
+
);
|
|
31949
|
+
console.error(error);
|
|
31950
|
+
throw error;
|
|
31951
|
+
}
|
|
31952
|
+
},
|
|
31899
31953
|
deleteFunc: async () => {
|
|
31900
31954
|
try {
|
|
31901
31955
|
await admin.deleteDocument(vars);
|
|
@@ -31904,6 +31958,12 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31904
31958
|
);
|
|
31905
31959
|
reFetchCollection();
|
|
31906
31960
|
} catch (error) {
|
|
31961
|
+
if (error.message.indexOf("has references")) {
|
|
31962
|
+
cms.alerts.error(
|
|
31963
|
+
error.message.split("\n ").filter(Boolean)[1]
|
|
31964
|
+
);
|
|
31965
|
+
return;
|
|
31966
|
+
}
|
|
31907
31967
|
cms.alerts.warn(
|
|
31908
31968
|
"Document was not deleted, ask a developer for help or check the console for an error message"
|
|
31909
31969
|
);
|
|
@@ -31955,6 +32015,12 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31955
32015
|
cms.alerts.info("Document was successfully renamed");
|
|
31956
32016
|
reFetchCollection();
|
|
31957
32017
|
} catch (error) {
|
|
32018
|
+
if (error.message.indexOf("has references")) {
|
|
32019
|
+
cms.alerts.error(
|
|
32020
|
+
error.message.split("\n ").filter(Boolean)[1]
|
|
32021
|
+
);
|
|
32022
|
+
return;
|
|
32023
|
+
}
|
|
31958
32024
|
cms.alerts.warn(
|
|
31959
32025
|
"Document was not renamed, ask a developer for help or check the console for an error message"
|
|
31960
32026
|
);
|
|
@@ -32428,8 +32494,19 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
32428
32494
|
const NoDocumentsPlaceholder = () => {
|
|
32429
32495
|
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
32496
|
};
|
|
32431
|
-
const DeleteModal = ({
|
|
32432
|
-
|
|
32497
|
+
const DeleteModal = ({
|
|
32498
|
+
close: close2,
|
|
32499
|
+
deleteFunc,
|
|
32500
|
+
checkRefsFunc,
|
|
32501
|
+
filename
|
|
32502
|
+
}) => {
|
|
32503
|
+
const [hasRefs, setHasRefs] = React.useState();
|
|
32504
|
+
React.useEffect(() => {
|
|
32505
|
+
checkRefsFunc().then((result) => {
|
|
32506
|
+
setHasRefs(result);
|
|
32507
|
+
});
|
|
32508
|
+
}, [filename, checkRefsFunc]);
|
|
32509
|
+
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
32510
|
Button$1,
|
|
32434
32511
|
{
|
|
32435
32512
|
style: { flexGrow: 3 },
|
|
@@ -33796,6 +33873,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
33796
33873
|
exports2.useScreenPlugin = useScreenPlugin;
|
|
33797
33874
|
exports2.useTinaAuthRedirect = useTinaAuthRedirect;
|
|
33798
33875
|
exports2.wrapFieldWithError = wrapFieldWithError;
|
|
33876
|
+
exports2.wrapFieldWithNoHeader = wrapFieldWithNoHeader;
|
|
33799
33877
|
exports2.wrapFieldsWithMeta = wrapFieldsWithMeta;
|
|
33800
33878
|
Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
33801
33879
|
});
|
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(
|
|
@@ -5818,27 +5834,35 @@ const BlockSelector = ({
|
|
|
5818
5834
|
))))
|
|
5819
5835
|
))));
|
|
5820
5836
|
};
|
|
5821
|
-
const Group =
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5837
|
+
const Group = wrapFieldWithNoHeader(
|
|
5838
|
+
({ tinaForm, field }) => {
|
|
5839
|
+
const cms = useCMS$1();
|
|
5840
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
5841
|
+
Header,
|
|
5842
|
+
{
|
|
5843
|
+
onClick: () => {
|
|
5844
|
+
const state = tinaForm.finalForm.getState();
|
|
5845
|
+
if (state.invalid === true) {
|
|
5846
|
+
cms.alerts.error("Cannot navigate away from an invalid form.");
|
|
5847
|
+
return;
|
|
5848
|
+
}
|
|
5849
|
+
cms.dispatch({
|
|
5850
|
+
type: "forms:set-active-field-name",
|
|
5851
|
+
value: { formId: tinaForm.id, fieldName: field.name }
|
|
5852
|
+
});
|
|
5832
5853
|
}
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5854
|
+
},
|
|
5855
|
+
field.label || field.name,
|
|
5856
|
+
field.description && /* @__PURE__ */ React.createElement(
|
|
5857
|
+
"span",
|
|
5858
|
+
{
|
|
5859
|
+
className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0`,
|
|
5860
|
+
dangerouslySetInnerHTML: { __html: field.description }
|
|
5861
|
+
}
|
|
5862
|
+
)
|
|
5863
|
+
));
|
|
5864
|
+
}
|
|
5865
|
+
);
|
|
5842
5866
|
const Header = ({ onClick, children }) => {
|
|
5843
5867
|
return /* @__PURE__ */ React.createElement("div", { className: "pt-1 mb-5" }, /* @__PURE__ */ React.createElement(
|
|
5844
5868
|
"button",
|
|
@@ -10335,7 +10359,7 @@ const SyncStatus = ({ cms, setEventsOpen }) => {
|
|
|
10335
10359
|
"Event Log"
|
|
10336
10360
|
));
|
|
10337
10361
|
};
|
|
10338
|
-
const version = "2.
|
|
10362
|
+
const version = "2.4.0";
|
|
10339
10363
|
const Nav = ({
|
|
10340
10364
|
isLocalMode,
|
|
10341
10365
|
className = "",
|
|
@@ -12866,15 +12890,14 @@ const FormBuilder = ({
|
|
|
12866
12890
|
fields: fieldGroup.fields
|
|
12867
12891
|
}
|
|
12868
12892
|
) : /* @__PURE__ */ React.createElement(NoFieldsPlaceholder, null)
|
|
12869
|
-
)), !hideFooter && /* @__PURE__ */ React.createElement("div", { className: "relative flex-none w-full h-16 px-
|
|
12893
|
+
)), !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
12894
|
ResetForm,
|
|
12871
12895
|
{
|
|
12872
12896
|
pristine,
|
|
12873
12897
|
reset: async () => {
|
|
12874
12898
|
finalForm.reset();
|
|
12875
12899
|
await tinaForm.reset();
|
|
12876
|
-
}
|
|
12877
|
-
style: { flexGrow: 1 }
|
|
12900
|
+
}
|
|
12878
12901
|
},
|
|
12879
12902
|
tinaForm.buttons.reset
|
|
12880
12903
|
), /* @__PURE__ */ React.createElement(
|
|
@@ -12883,8 +12906,7 @@ const FormBuilder = ({
|
|
|
12883
12906
|
onClick: safeHandleSubmit,
|
|
12884
12907
|
disabled: !canSubmit,
|
|
12885
12908
|
busy: submitting,
|
|
12886
|
-
variant: "primary"
|
|
12887
|
-
style: { flexGrow: 3 }
|
|
12909
|
+
variant: "primary"
|
|
12888
12910
|
},
|
|
12889
12911
|
submitting && /* @__PURE__ */ React.createElement(LoadingDots, null),
|
|
12890
12912
|
!submitting && tinaForm.buttons.save
|
|
@@ -14454,6 +14476,7 @@ function OverflowMenu({
|
|
|
14454
14476
|
ToolbarButton,
|
|
14455
14477
|
{
|
|
14456
14478
|
showArrow: false,
|
|
14479
|
+
"data-testid": "rich-text-editor-overflow-menu-button",
|
|
14457
14480
|
className: "lg:min-w-[130px]",
|
|
14458
14481
|
isDropdown: true,
|
|
14459
14482
|
pressed: openState.open,
|
|
@@ -14507,7 +14530,17 @@ const useRawMarkdownToolbarButton = () => {
|
|
|
14507
14530
|
};
|
|
14508
14531
|
const RawMarkdownToolbarButton = withRef(({ clear, ...rest }, ref) => {
|
|
14509
14532
|
const { props } = useRawMarkdownToolbarButton();
|
|
14510
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
14533
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
14534
|
+
ToolbarButton,
|
|
14535
|
+
{
|
|
14536
|
+
ref,
|
|
14537
|
+
tooltip: "Link",
|
|
14538
|
+
...rest,
|
|
14539
|
+
...props,
|
|
14540
|
+
"data-testid": "markdown-button"
|
|
14541
|
+
},
|
|
14542
|
+
/* @__PURE__ */ React__default.createElement(Icons.raw, null)
|
|
14543
|
+
);
|
|
14511
14544
|
});
|
|
14512
14545
|
function TableDropdownMenu(props) {
|
|
14513
14546
|
const tableSelected = useEditorSelector(
|
|
@@ -30106,6 +30139,7 @@ class TinaAdminApi {
|
|
|
30106
30139
|
relativePath
|
|
30107
30140
|
filename
|
|
30108
30141
|
extension
|
|
30142
|
+
hasReferences
|
|
30109
30143
|
}
|
|
30110
30144
|
}
|
|
30111
30145
|
}
|
|
@@ -30197,6 +30231,9 @@ class TinaAdminApi {
|
|
|
30197
30231
|
document(collection:$collection, relativePath:$relativePath) {
|
|
30198
30232
|
... on Document {
|
|
30199
30233
|
_values
|
|
30234
|
+
_sys {
|
|
30235
|
+
hasReferences
|
|
30236
|
+
}
|
|
30200
30237
|
}
|
|
30201
30238
|
}
|
|
30202
30239
|
}`;
|
|
@@ -31923,6 +31960,23 @@ const CollectionListPage = () => {
|
|
|
31923
31960
|
DeleteModal,
|
|
31924
31961
|
{
|
|
31925
31962
|
filename: vars.relativePath,
|
|
31963
|
+
checkRefsFunc: async () => {
|
|
31964
|
+
var _a2, _b2;
|
|
31965
|
+
try {
|
|
31966
|
+
const doc = await admin.fetchDocument(
|
|
31967
|
+
collection.name,
|
|
31968
|
+
vars.relativePath,
|
|
31969
|
+
true
|
|
31970
|
+
);
|
|
31971
|
+
return (_b2 = (_a2 = doc == null ? void 0 : doc.document) == null ? void 0 : _a2._sys) == null ? void 0 : _b2.hasReferences;
|
|
31972
|
+
} catch (error) {
|
|
31973
|
+
cms.alerts.error(
|
|
31974
|
+
"Document was not found, ask a developer for help or check the console for an error message"
|
|
31975
|
+
);
|
|
31976
|
+
console.error(error);
|
|
31977
|
+
throw error;
|
|
31978
|
+
}
|
|
31979
|
+
},
|
|
31926
31980
|
deleteFunc: async () => {
|
|
31927
31981
|
try {
|
|
31928
31982
|
await admin.deleteDocument(vars);
|
|
@@ -31931,6 +31985,12 @@ const CollectionListPage = () => {
|
|
|
31931
31985
|
);
|
|
31932
31986
|
reFetchCollection();
|
|
31933
31987
|
} catch (error) {
|
|
31988
|
+
if (error.message.indexOf("has references")) {
|
|
31989
|
+
cms.alerts.error(
|
|
31990
|
+
error.message.split("\n ").filter(Boolean)[1]
|
|
31991
|
+
);
|
|
31992
|
+
return;
|
|
31993
|
+
}
|
|
31934
31994
|
cms.alerts.warn(
|
|
31935
31995
|
"Document was not deleted, ask a developer for help or check the console for an error message"
|
|
31936
31996
|
);
|
|
@@ -31982,6 +32042,12 @@ const CollectionListPage = () => {
|
|
|
31982
32042
|
cms.alerts.info("Document was successfully renamed");
|
|
31983
32043
|
reFetchCollection();
|
|
31984
32044
|
} catch (error) {
|
|
32045
|
+
if (error.message.indexOf("has references")) {
|
|
32046
|
+
cms.alerts.error(
|
|
32047
|
+
error.message.split("\n ").filter(Boolean)[1]
|
|
32048
|
+
);
|
|
32049
|
+
return;
|
|
32050
|
+
}
|
|
31985
32051
|
cms.alerts.warn(
|
|
31986
32052
|
"Document was not renamed, ask a developer for help or check the console for an error message"
|
|
31987
32053
|
);
|
|
@@ -32455,8 +32521,19 @@ const Breadcrumb = ({ folder, navigate, collectionName }) => {
|
|
|
32455
32521
|
const NoDocumentsPlaceholder = () => {
|
|
32456
32522
|
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
32523
|
};
|
|
32458
|
-
const DeleteModal = ({
|
|
32459
|
-
|
|
32524
|
+
const DeleteModal = ({
|
|
32525
|
+
close: close2,
|
|
32526
|
+
deleteFunc,
|
|
32527
|
+
checkRefsFunc,
|
|
32528
|
+
filename
|
|
32529
|
+
}) => {
|
|
32530
|
+
const [hasRefs, setHasRefs] = React__default.useState();
|
|
32531
|
+
useEffect(() => {
|
|
32532
|
+
checkRefsFunc().then((result) => {
|
|
32533
|
+
setHasRefs(result);
|
|
32534
|
+
});
|
|
32535
|
+
}, [filename, checkRefsFunc]);
|
|
32536
|
+
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
32537
|
Button$1,
|
|
32461
32538
|
{
|
|
32462
32539
|
style: { flexGrow: 3 },
|
|
@@ -33818,5 +33895,6 @@ export {
|
|
|
33818
33895
|
useScreenPlugin,
|
|
33819
33896
|
useTinaAuthRedirect,
|
|
33820
33897
|
wrapFieldWithError,
|
|
33898
|
+
wrapFieldWithNoHeader,
|
|
33821
33899
|
wrapFieldsWithMeta
|
|
33822
33900
|
};
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
const makeCacheDir = async (dir, fs) => {
|
|
2
|
-
const
|
|
3
|
-
const os = await import("./__vite-browser-external-d06ac358.mjs");
|
|
4
|
-
if (typeof dir !== "string" || !dir.trim()) {
|
|
5
|
-
throw new Error("Invalid directory path");
|
|
6
|
-
}
|
|
7
|
-
const pathParts = dir.split(path.sep);
|
|
1
|
+
const makeCacheDir = async (dir, fs, path, os) => {
|
|
2
|
+
const pathParts = dir.split(path.sep).filter(Boolean);
|
|
8
3
|
const cacheHash = pathParts[pathParts.length - 1];
|
|
4
|
+
const rootUser = pathParts[0];
|
|
9
5
|
let cacheDir = dir;
|
|
10
|
-
if (!fs.existsSync(
|
|
6
|
+
if (!fs.existsSync(path.join(path.sep, rootUser))) {
|
|
11
7
|
cacheDir = path.join(os.tmpdir(), cacheHash);
|
|
12
8
|
}
|
|
13
9
|
try {
|
|
@@ -18,10 +14,11 @@ const makeCacheDir = async (dir, fs) => {
|
|
|
18
14
|
return cacheDir;
|
|
19
15
|
};
|
|
20
16
|
const NodeCache = async (dir) => {
|
|
21
|
-
const fs =
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
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);
|
|
25
22
|
return {
|
|
26
23
|
makeKey: (key) => {
|
|
27
24
|
const input = key && key instanceof Object ? JSON.stringify(key) : key || "";
|
|
@@ -48,5 +45,6 @@ const NodeCache = async (dir) => {
|
|
|
48
45
|
};
|
|
49
46
|
};
|
|
50
47
|
export {
|
|
51
|
-
NodeCache
|
|
48
|
+
NodeCache,
|
|
49
|
+
makeCacheDir
|
|
52
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": "0.0.0-
|
|
3
|
+
"version": "0.0.0-f696c7d-20241104134240",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"exports": {
|
|
@@ -129,9 +129,9 @@
|
|
|
129
129
|
"webfontloader": "1.6.28",
|
|
130
130
|
"yup": "^1.4.0",
|
|
131
131
|
"zod": "^3.23.8",
|
|
132
|
-
"@tinacms/mdx": "
|
|
133
|
-
"@tinacms/schema-tools": "
|
|
134
|
-
"@tinacms/search": "
|
|
132
|
+
"@tinacms/mdx": "0.0.0-f696c7d-20241104134240",
|
|
133
|
+
"@tinacms/schema-tools": "0.0.0-f696c7d-20241104134240",
|
|
134
|
+
"@tinacms/search": "0.0.0-f696c7d-20241104134240"
|
|
135
135
|
},
|
|
136
136
|
"devDependencies": {
|
|
137
137
|
"@graphql-tools/utils": "^10.5.4",
|