tinacms 0.0.0-c1132cd-20241024060747 → 0.0.0-c45ac5d-20241213020122
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/client.js +4 -7
- package/dist/client.mjs +2 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.js +143 -28
- package/dist/index.mjs +143 -28
- package/dist/toolkit/fields/plugins/wrap-field-with-meta.d.ts +8 -0
- package/package.json +25 -26
package/dist/admin/types.d.ts
CHANGED
package/dist/client.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports
|
|
3
|
-
})(this, function(exports2
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}));
|
|
3
|
+
})(this, function(exports2) {
|
|
4
4
|
"use strict";
|
|
5
|
-
const { fetch: fetchPonyfillFN, Headers: HeadersPonyfill } = fetchPonyfill();
|
|
6
|
-
const fetchDefined = typeof fetch === "undefined" ? fetchPonyfillFN : fetch;
|
|
7
|
-
const HeadersDefined = typeof Headers === "undefined" ? HeadersPonyfill : Headers;
|
|
8
5
|
const TINA_HOST = "content.tinajs.io";
|
|
9
6
|
class TinaClient {
|
|
10
7
|
constructor({
|
|
@@ -39,7 +36,7 @@
|
|
|
39
36
|
var _a;
|
|
40
37
|
await this.init();
|
|
41
38
|
const errorPolicyDefined = errorPolicy || this.errorPolicy;
|
|
42
|
-
const headers = new
|
|
39
|
+
const headers = new Headers();
|
|
43
40
|
if (this.readonlyToken) {
|
|
44
41
|
headers.append("X-API-KEY", this.readonlyToken);
|
|
45
42
|
}
|
|
@@ -72,7 +69,7 @@
|
|
|
72
69
|
return value;
|
|
73
70
|
}
|
|
74
71
|
}
|
|
75
|
-
const res = await
|
|
72
|
+
const res = await fetch(url, optionsObject);
|
|
76
73
|
if (!res.ok) {
|
|
77
74
|
let additionalInfo = "";
|
|
78
75
|
if (res.status === 401) {
|
package/dist/client.mjs
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import fetchPonyfill from "fetch-ponyfill";
|
|
2
|
-
const { fetch: fetchPonyfillFN, Headers: HeadersPonyfill } = fetchPonyfill();
|
|
3
|
-
const fetchDefined = typeof fetch === "undefined" ? fetchPonyfillFN : fetch;
|
|
4
|
-
const HeadersDefined = typeof Headers === "undefined" ? HeadersPonyfill : Headers;
|
|
5
1
|
const TINA_HOST = "content.tinajs.io";
|
|
6
2
|
class TinaClient {
|
|
7
3
|
constructor({
|
|
@@ -36,7 +32,7 @@ class TinaClient {
|
|
|
36
32
|
var _a;
|
|
37
33
|
await this.init();
|
|
38
34
|
const errorPolicyDefined = errorPolicy || this.errorPolicy;
|
|
39
|
-
const headers = new
|
|
35
|
+
const headers = new Headers();
|
|
40
36
|
if (this.readonlyToken) {
|
|
41
37
|
headers.append("X-API-KEY", this.readonlyToken);
|
|
42
38
|
}
|
|
@@ -69,7 +65,7 @@ class TinaClient {
|
|
|
69
65
|
return value;
|
|
70
66
|
}
|
|
71
67
|
}
|
|
72
|
-
const res = await
|
|
68
|
+
const res = await fetch(url, optionsObject);
|
|
73
69
|
if (!res.ok) {
|
|
74
70
|
let additionalInfo = "";
|
|
75
71
|
if (res.status === 401) {
|
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
|
@@ -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(
|
|
@@ -846,6 +862,16 @@ var __publicField = (obj, key, value) => {
|
|
|
846
862
|
className,
|
|
847
863
|
...props
|
|
848
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
|
+
}
|
|
849
875
|
return /* @__PURE__ */ React__namespace.createElement(
|
|
850
876
|
"span",
|
|
851
877
|
{
|
|
@@ -4909,7 +4935,28 @@ flowchart TD
|
|
|
4909
4935
|
onChange,
|
|
4910
4936
|
value,
|
|
4911
4937
|
step
|
|
4912
|
-
}) => /* @__PURE__ */ React__namespace.createElement(
|
|
4938
|
+
}) => /* @__PURE__ */ React__namespace.createElement(
|
|
4939
|
+
Input,
|
|
4940
|
+
{
|
|
4941
|
+
type: "number",
|
|
4942
|
+
step,
|
|
4943
|
+
value,
|
|
4944
|
+
onChange: (event) => {
|
|
4945
|
+
const inputValue = event.target.value;
|
|
4946
|
+
const newValue = inputValue === "" ? void 0 : inputValue;
|
|
4947
|
+
if (onChange) {
|
|
4948
|
+
const syntheticEvent = {
|
|
4949
|
+
...event,
|
|
4950
|
+
target: {
|
|
4951
|
+
...event.target,
|
|
4952
|
+
value: newValue
|
|
4953
|
+
}
|
|
4954
|
+
};
|
|
4955
|
+
onChange(syntheticEvent);
|
|
4956
|
+
}
|
|
4957
|
+
}
|
|
4958
|
+
}
|
|
4959
|
+
);
|
|
4913
4960
|
function useCMS() {
|
|
4914
4961
|
return useCMS$1();
|
|
4915
4962
|
}
|
|
@@ -5710,10 +5757,11 @@ flowchart TD
|
|
|
5710
5757
|
return /* @__PURE__ */ React.createElement(
|
|
5711
5758
|
"button",
|
|
5712
5759
|
{
|
|
5713
|
-
|
|
5760
|
+
type: "button",
|
|
5761
|
+
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
5762
|
onClick
|
|
5715
5763
|
},
|
|
5716
|
-
/* @__PURE__ */ React.createElement(TrashIcon, { className: "fill-current transition-colors ease-out
|
|
5764
|
+
/* @__PURE__ */ React.createElement(TrashIcon, { className: "h-5 w-auto fill-current text-red-500 transition-colors duration-150 ease-out" })
|
|
5717
5765
|
);
|
|
5718
5766
|
};
|
|
5719
5767
|
const DragHandle = ({ isDragging }) => {
|
|
@@ -5791,27 +5839,35 @@ flowchart TD
|
|
|
5791
5839
|
))))
|
|
5792
5840
|
))));
|
|
5793
5841
|
};
|
|
5794
|
-
const Group =
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5842
|
+
const Group = wrapFieldWithNoHeader(
|
|
5843
|
+
({ tinaForm, field }) => {
|
|
5844
|
+
const cms = useCMS$1();
|
|
5845
|
+
return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(
|
|
5846
|
+
Header,
|
|
5847
|
+
{
|
|
5848
|
+
onClick: () => {
|
|
5849
|
+
const state = tinaForm.finalForm.getState();
|
|
5850
|
+
if (state.invalid === true) {
|
|
5851
|
+
cms.alerts.error("Cannot navigate away from an invalid form.");
|
|
5852
|
+
return;
|
|
5853
|
+
}
|
|
5854
|
+
cms.dispatch({
|
|
5855
|
+
type: "forms:set-active-field-name",
|
|
5856
|
+
value: { formId: tinaForm.id, fieldName: field.name }
|
|
5857
|
+
});
|
|
5805
5858
|
}
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5859
|
+
},
|
|
5860
|
+
field.label || field.name,
|
|
5861
|
+
field.description && /* @__PURE__ */ React__namespace.createElement(
|
|
5862
|
+
"span",
|
|
5863
|
+
{
|
|
5864
|
+
className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0`,
|
|
5865
|
+
dangerouslySetInnerHTML: { __html: field.description }
|
|
5866
|
+
}
|
|
5867
|
+
)
|
|
5868
|
+
));
|
|
5869
|
+
}
|
|
5870
|
+
);
|
|
5815
5871
|
const Header = ({ onClick, children }) => {
|
|
5816
5872
|
return /* @__PURE__ */ React__namespace.createElement("div", { className: "pt-1 mb-5" }, /* @__PURE__ */ React__namespace.createElement(
|
|
5817
5873
|
"button",
|
|
@@ -7977,7 +8033,10 @@ flowchart TD
|
|
|
7977
8033
|
ReactDateTimeWithStyles,
|
|
7978
8034
|
{
|
|
7979
8035
|
value: input.value,
|
|
7980
|
-
onChange:
|
|
8036
|
+
onChange: (value) => {
|
|
8037
|
+
const newValue = value === "" ? void 0 : value;
|
|
8038
|
+
input.onChange(newValue);
|
|
8039
|
+
},
|
|
7981
8040
|
dateFormat: dateFormat || DEFAULT_DATE_DISPLAY_FORMAT,
|
|
7982
8041
|
timeFormat: timeFormat || false,
|
|
7983
8042
|
inputProps: { className: textFieldClasses },
|
|
@@ -10308,7 +10367,7 @@ flowchart TD
|
|
|
10308
10367
|
"Event Log"
|
|
10309
10368
|
));
|
|
10310
10369
|
};
|
|
10311
|
-
const version = "2.
|
|
10370
|
+
const version = "2.5.1";
|
|
10312
10371
|
const Nav = ({
|
|
10313
10372
|
isLocalMode,
|
|
10314
10373
|
className = "",
|
|
@@ -14425,6 +14484,7 @@ flowchart TD
|
|
|
14425
14484
|
ToolbarButton,
|
|
14426
14485
|
{
|
|
14427
14486
|
showArrow: false,
|
|
14487
|
+
"data-testid": "rich-text-editor-overflow-menu-button",
|
|
14428
14488
|
className: "lg:min-w-[130px]",
|
|
14429
14489
|
isDropdown: true,
|
|
14430
14490
|
pressed: openState.open,
|
|
@@ -14478,7 +14538,17 @@ flowchart TD
|
|
|
14478
14538
|
};
|
|
14479
14539
|
const RawMarkdownToolbarButton = cn$1.withRef(({ clear, ...rest }, ref) => {
|
|
14480
14540
|
const { props } = useRawMarkdownToolbarButton();
|
|
14481
|
-
return /* @__PURE__ */ React.createElement(
|
|
14541
|
+
return /* @__PURE__ */ React.createElement(
|
|
14542
|
+
ToolbarButton,
|
|
14543
|
+
{
|
|
14544
|
+
ref,
|
|
14545
|
+
tooltip: "Link",
|
|
14546
|
+
...rest,
|
|
14547
|
+
...props,
|
|
14548
|
+
"data-testid": "markdown-button"
|
|
14549
|
+
},
|
|
14550
|
+
/* @__PURE__ */ React.createElement(Icons.raw, null)
|
|
14551
|
+
);
|
|
14482
14552
|
});
|
|
14483
14553
|
function TableDropdownMenu(props) {
|
|
14484
14554
|
const tableSelected = plateCommon.useEditorSelector(
|
|
@@ -30077,6 +30147,7 @@ mutation addPendingDocumentMutation(
|
|
|
30077
30147
|
relativePath
|
|
30078
30148
|
filename
|
|
30079
30149
|
extension
|
|
30150
|
+
hasReferences
|
|
30080
30151
|
}
|
|
30081
30152
|
}
|
|
30082
30153
|
}
|
|
@@ -30168,6 +30239,9 @@ mutation addPendingDocumentMutation(
|
|
|
30168
30239
|
document(collection:$collection, relativePath:$relativePath) {
|
|
30169
30240
|
... on Document {
|
|
30170
30241
|
_values
|
|
30242
|
+
_sys {
|
|
30243
|
+
hasReferences
|
|
30244
|
+
}
|
|
30171
30245
|
}
|
|
30172
30246
|
}
|
|
30173
30247
|
}`;
|
|
@@ -31894,6 +31968,23 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31894
31968
|
DeleteModal,
|
|
31895
31969
|
{
|
|
31896
31970
|
filename: vars.relativePath,
|
|
31971
|
+
checkRefsFunc: async () => {
|
|
31972
|
+
var _a2, _b2;
|
|
31973
|
+
try {
|
|
31974
|
+
const doc = await admin.fetchDocument(
|
|
31975
|
+
collection.name,
|
|
31976
|
+
vars.relativePath,
|
|
31977
|
+
true
|
|
31978
|
+
);
|
|
31979
|
+
return (_b2 = (_a2 = doc == null ? void 0 : doc.document) == null ? void 0 : _a2._sys) == null ? void 0 : _b2.hasReferences;
|
|
31980
|
+
} catch (error) {
|
|
31981
|
+
cms.alerts.error(
|
|
31982
|
+
"Document was not found, ask a developer for help or check the console for an error message"
|
|
31983
|
+
);
|
|
31984
|
+
console.error(error);
|
|
31985
|
+
throw error;
|
|
31986
|
+
}
|
|
31987
|
+
},
|
|
31897
31988
|
deleteFunc: async () => {
|
|
31898
31989
|
try {
|
|
31899
31990
|
await admin.deleteDocument(vars);
|
|
@@ -31902,6 +31993,12 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31902
31993
|
);
|
|
31903
31994
|
reFetchCollection();
|
|
31904
31995
|
} catch (error) {
|
|
31996
|
+
if (error.message.indexOf("has references")) {
|
|
31997
|
+
cms.alerts.error(
|
|
31998
|
+
error.message.split("\n ").filter(Boolean)[1]
|
|
31999
|
+
);
|
|
32000
|
+
return;
|
|
32001
|
+
}
|
|
31905
32002
|
cms.alerts.warn(
|
|
31906
32003
|
"Document was not deleted, ask a developer for help or check the console for an error message"
|
|
31907
32004
|
);
|
|
@@ -31953,6 +32050,12 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31953
32050
|
cms.alerts.info("Document was successfully renamed");
|
|
31954
32051
|
reFetchCollection();
|
|
31955
32052
|
} catch (error) {
|
|
32053
|
+
if (error.message.indexOf("has references")) {
|
|
32054
|
+
cms.alerts.error(
|
|
32055
|
+
error.message.split("\n ").filter(Boolean)[1]
|
|
32056
|
+
);
|
|
32057
|
+
return;
|
|
32058
|
+
}
|
|
31956
32059
|
cms.alerts.warn(
|
|
31957
32060
|
"Document was not renamed, ask a developer for help or check the console for an error message"
|
|
31958
32061
|
);
|
|
@@ -32426,8 +32529,19 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
32426
32529
|
const NoDocumentsPlaceholder = () => {
|
|
32427
32530
|
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."));
|
|
32428
32531
|
};
|
|
32429
|
-
const DeleteModal = ({
|
|
32430
|
-
|
|
32532
|
+
const DeleteModal = ({
|
|
32533
|
+
close: close2,
|
|
32534
|
+
deleteFunc,
|
|
32535
|
+
checkRefsFunc,
|
|
32536
|
+
filename
|
|
32537
|
+
}) => {
|
|
32538
|
+
const [hasRefs, setHasRefs] = React.useState();
|
|
32539
|
+
React.useEffect(() => {
|
|
32540
|
+
checkRefsFunc().then((result) => {
|
|
32541
|
+
setHasRefs(result);
|
|
32542
|
+
});
|
|
32543
|
+
}, [filename, checkRefsFunc]);
|
|
32544
|
+
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(
|
|
32431
32545
|
Button$1,
|
|
32432
32546
|
{
|
|
32433
32547
|
style: { flexGrow: 3 },
|
|
@@ -33794,6 +33908,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
33794
33908
|
exports2.useScreenPlugin = useScreenPlugin;
|
|
33795
33909
|
exports2.useTinaAuthRedirect = useTinaAuthRedirect;
|
|
33796
33910
|
exports2.wrapFieldWithError = wrapFieldWithError;
|
|
33911
|
+
exports2.wrapFieldWithNoHeader = wrapFieldWithNoHeader;
|
|
33797
33912
|
exports2.wrapFieldsWithMeta = wrapFieldsWithMeta;
|
|
33798
33913
|
Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
33799
33914
|
});
|
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(
|
|
@@ -873,6 +889,16 @@ const FieldDescription = ({
|
|
|
873
889
|
className,
|
|
874
890
|
...props
|
|
875
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
|
+
}
|
|
876
902
|
return /* @__PURE__ */ React.createElement(
|
|
877
903
|
"span",
|
|
878
904
|
{
|
|
@@ -4936,7 +4962,28 @@ const NumberInput = ({
|
|
|
4936
4962
|
onChange,
|
|
4937
4963
|
value,
|
|
4938
4964
|
step
|
|
4939
|
-
}) => /* @__PURE__ */ React.createElement(
|
|
4965
|
+
}) => /* @__PURE__ */ React.createElement(
|
|
4966
|
+
Input,
|
|
4967
|
+
{
|
|
4968
|
+
type: "number",
|
|
4969
|
+
step,
|
|
4970
|
+
value,
|
|
4971
|
+
onChange: (event) => {
|
|
4972
|
+
const inputValue = event.target.value;
|
|
4973
|
+
const newValue = inputValue === "" ? void 0 : inputValue;
|
|
4974
|
+
if (onChange) {
|
|
4975
|
+
const syntheticEvent = {
|
|
4976
|
+
...event,
|
|
4977
|
+
target: {
|
|
4978
|
+
...event.target,
|
|
4979
|
+
value: newValue
|
|
4980
|
+
}
|
|
4981
|
+
};
|
|
4982
|
+
onChange(syntheticEvent);
|
|
4983
|
+
}
|
|
4984
|
+
}
|
|
4985
|
+
}
|
|
4986
|
+
);
|
|
4940
4987
|
function useCMS() {
|
|
4941
4988
|
return useCMS$1();
|
|
4942
4989
|
}
|
|
@@ -5737,10 +5784,11 @@ const ItemDeleteButton = ({ onClick, disabled = false }) => {
|
|
|
5737
5784
|
return /* @__PURE__ */ React__default.createElement(
|
|
5738
5785
|
"button",
|
|
5739
5786
|
{
|
|
5740
|
-
|
|
5787
|
+
type: "button",
|
|
5788
|
+
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
5789
|
onClick
|
|
5742
5790
|
},
|
|
5743
|
-
/* @__PURE__ */ React__default.createElement(TrashIcon, { className: "fill-current transition-colors ease-out
|
|
5791
|
+
/* @__PURE__ */ React__default.createElement(TrashIcon, { className: "h-5 w-auto fill-current text-red-500 transition-colors duration-150 ease-out" })
|
|
5744
5792
|
);
|
|
5745
5793
|
};
|
|
5746
5794
|
const DragHandle = ({ isDragging }) => {
|
|
@@ -5818,27 +5866,35 @@ const BlockSelector = ({
|
|
|
5818
5866
|
))))
|
|
5819
5867
|
))));
|
|
5820
5868
|
};
|
|
5821
|
-
const Group =
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5869
|
+
const Group = wrapFieldWithNoHeader(
|
|
5870
|
+
({ tinaForm, field }) => {
|
|
5871
|
+
const cms = useCMS$1();
|
|
5872
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
5873
|
+
Header,
|
|
5874
|
+
{
|
|
5875
|
+
onClick: () => {
|
|
5876
|
+
const state = tinaForm.finalForm.getState();
|
|
5877
|
+
if (state.invalid === true) {
|
|
5878
|
+
cms.alerts.error("Cannot navigate away from an invalid form.");
|
|
5879
|
+
return;
|
|
5880
|
+
}
|
|
5881
|
+
cms.dispatch({
|
|
5882
|
+
type: "forms:set-active-field-name",
|
|
5883
|
+
value: { formId: tinaForm.id, fieldName: field.name }
|
|
5884
|
+
});
|
|
5832
5885
|
}
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5886
|
+
},
|
|
5887
|
+
field.label || field.name,
|
|
5888
|
+
field.description && /* @__PURE__ */ React.createElement(
|
|
5889
|
+
"span",
|
|
5890
|
+
{
|
|
5891
|
+
className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0`,
|
|
5892
|
+
dangerouslySetInnerHTML: { __html: field.description }
|
|
5893
|
+
}
|
|
5894
|
+
)
|
|
5895
|
+
));
|
|
5896
|
+
}
|
|
5897
|
+
);
|
|
5842
5898
|
const Header = ({ onClick, children }) => {
|
|
5843
5899
|
return /* @__PURE__ */ React.createElement("div", { className: "pt-1 mb-5" }, /* @__PURE__ */ React.createElement(
|
|
5844
5900
|
"button",
|
|
@@ -8004,7 +8060,10 @@ const DateField = wrapFieldsWithMeta(
|
|
|
8004
8060
|
ReactDateTimeWithStyles,
|
|
8005
8061
|
{
|
|
8006
8062
|
value: input.value,
|
|
8007
|
-
onChange:
|
|
8063
|
+
onChange: (value) => {
|
|
8064
|
+
const newValue = value === "" ? void 0 : value;
|
|
8065
|
+
input.onChange(newValue);
|
|
8066
|
+
},
|
|
8008
8067
|
dateFormat: dateFormat || DEFAULT_DATE_DISPLAY_FORMAT,
|
|
8009
8068
|
timeFormat: timeFormat || false,
|
|
8010
8069
|
inputProps: { className: textFieldClasses },
|
|
@@ -10335,7 +10394,7 @@ const SyncStatus = ({ cms, setEventsOpen }) => {
|
|
|
10335
10394
|
"Event Log"
|
|
10336
10395
|
));
|
|
10337
10396
|
};
|
|
10338
|
-
const version = "2.
|
|
10397
|
+
const version = "2.5.1";
|
|
10339
10398
|
const Nav = ({
|
|
10340
10399
|
isLocalMode,
|
|
10341
10400
|
className = "",
|
|
@@ -14452,6 +14511,7 @@ function OverflowMenu({
|
|
|
14452
14511
|
ToolbarButton,
|
|
14453
14512
|
{
|
|
14454
14513
|
showArrow: false,
|
|
14514
|
+
"data-testid": "rich-text-editor-overflow-menu-button",
|
|
14455
14515
|
className: "lg:min-w-[130px]",
|
|
14456
14516
|
isDropdown: true,
|
|
14457
14517
|
pressed: openState.open,
|
|
@@ -14505,7 +14565,17 @@ const useRawMarkdownToolbarButton = () => {
|
|
|
14505
14565
|
};
|
|
14506
14566
|
const RawMarkdownToolbarButton = withRef(({ clear, ...rest }, ref) => {
|
|
14507
14567
|
const { props } = useRawMarkdownToolbarButton();
|
|
14508
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
14568
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
14569
|
+
ToolbarButton,
|
|
14570
|
+
{
|
|
14571
|
+
ref,
|
|
14572
|
+
tooltip: "Link",
|
|
14573
|
+
...rest,
|
|
14574
|
+
...props,
|
|
14575
|
+
"data-testid": "markdown-button"
|
|
14576
|
+
},
|
|
14577
|
+
/* @__PURE__ */ React__default.createElement(Icons.raw, null)
|
|
14578
|
+
);
|
|
14509
14579
|
});
|
|
14510
14580
|
function TableDropdownMenu(props) {
|
|
14511
14581
|
const tableSelected = useEditorSelector(
|
|
@@ -30104,6 +30174,7 @@ class TinaAdminApi {
|
|
|
30104
30174
|
relativePath
|
|
30105
30175
|
filename
|
|
30106
30176
|
extension
|
|
30177
|
+
hasReferences
|
|
30107
30178
|
}
|
|
30108
30179
|
}
|
|
30109
30180
|
}
|
|
@@ -30195,6 +30266,9 @@ class TinaAdminApi {
|
|
|
30195
30266
|
document(collection:$collection, relativePath:$relativePath) {
|
|
30196
30267
|
... on Document {
|
|
30197
30268
|
_values
|
|
30269
|
+
_sys {
|
|
30270
|
+
hasReferences
|
|
30271
|
+
}
|
|
30198
30272
|
}
|
|
30199
30273
|
}
|
|
30200
30274
|
}`;
|
|
@@ -31921,6 +31995,23 @@ const CollectionListPage = () => {
|
|
|
31921
31995
|
DeleteModal,
|
|
31922
31996
|
{
|
|
31923
31997
|
filename: vars.relativePath,
|
|
31998
|
+
checkRefsFunc: async () => {
|
|
31999
|
+
var _a2, _b2;
|
|
32000
|
+
try {
|
|
32001
|
+
const doc = await admin.fetchDocument(
|
|
32002
|
+
collection.name,
|
|
32003
|
+
vars.relativePath,
|
|
32004
|
+
true
|
|
32005
|
+
);
|
|
32006
|
+
return (_b2 = (_a2 = doc == null ? void 0 : doc.document) == null ? void 0 : _a2._sys) == null ? void 0 : _b2.hasReferences;
|
|
32007
|
+
} catch (error) {
|
|
32008
|
+
cms.alerts.error(
|
|
32009
|
+
"Document was not found, ask a developer for help or check the console for an error message"
|
|
32010
|
+
);
|
|
32011
|
+
console.error(error);
|
|
32012
|
+
throw error;
|
|
32013
|
+
}
|
|
32014
|
+
},
|
|
31924
32015
|
deleteFunc: async () => {
|
|
31925
32016
|
try {
|
|
31926
32017
|
await admin.deleteDocument(vars);
|
|
@@ -31929,6 +32020,12 @@ const CollectionListPage = () => {
|
|
|
31929
32020
|
);
|
|
31930
32021
|
reFetchCollection();
|
|
31931
32022
|
} catch (error) {
|
|
32023
|
+
if (error.message.indexOf("has references")) {
|
|
32024
|
+
cms.alerts.error(
|
|
32025
|
+
error.message.split("\n ").filter(Boolean)[1]
|
|
32026
|
+
);
|
|
32027
|
+
return;
|
|
32028
|
+
}
|
|
31932
32029
|
cms.alerts.warn(
|
|
31933
32030
|
"Document was not deleted, ask a developer for help or check the console for an error message"
|
|
31934
32031
|
);
|
|
@@ -31980,6 +32077,12 @@ const CollectionListPage = () => {
|
|
|
31980
32077
|
cms.alerts.info("Document was successfully renamed");
|
|
31981
32078
|
reFetchCollection();
|
|
31982
32079
|
} catch (error) {
|
|
32080
|
+
if (error.message.indexOf("has references")) {
|
|
32081
|
+
cms.alerts.error(
|
|
32082
|
+
error.message.split("\n ").filter(Boolean)[1]
|
|
32083
|
+
);
|
|
32084
|
+
return;
|
|
32085
|
+
}
|
|
31983
32086
|
cms.alerts.warn(
|
|
31984
32087
|
"Document was not renamed, ask a developer for help or check the console for an error message"
|
|
31985
32088
|
);
|
|
@@ -32453,8 +32556,19 @@ const Breadcrumb = ({ folder, navigate, collectionName }) => {
|
|
|
32453
32556
|
const NoDocumentsPlaceholder = () => {
|
|
32454
32557
|
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."));
|
|
32455
32558
|
};
|
|
32456
|
-
const DeleteModal = ({
|
|
32457
|
-
|
|
32559
|
+
const DeleteModal = ({
|
|
32560
|
+
close: close2,
|
|
32561
|
+
deleteFunc,
|
|
32562
|
+
checkRefsFunc,
|
|
32563
|
+
filename
|
|
32564
|
+
}) => {
|
|
32565
|
+
const [hasRefs, setHasRefs] = React__default.useState();
|
|
32566
|
+
useEffect(() => {
|
|
32567
|
+
checkRefsFunc().then((result) => {
|
|
32568
|
+
setHasRefs(result);
|
|
32569
|
+
});
|
|
32570
|
+
}, [filename, checkRefsFunc]);
|
|
32571
|
+
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(
|
|
32458
32572
|
Button$1,
|
|
32459
32573
|
{
|
|
32460
32574
|
style: { flexGrow: 3 },
|
|
@@ -33816,5 +33930,6 @@ export {
|
|
|
33816
33930
|
useScreenPlugin,
|
|
33817
33931
|
useTinaAuthRedirect,
|
|
33818
33932
|
wrapFieldWithError,
|
|
33933
|
+
wrapFieldWithNoHeader,
|
|
33819
33934
|
wrapFieldsWithMeta
|
|
33820
33935
|
};
|
|
@@ -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-c45ac5d-20241213020122",
|
|
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,11 +94,10 @@
|
|
|
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",
|
|
101
|
-
"fetch-ponyfill": "^7.1.0",
|
|
102
101
|
"final-form": "4.20.10",
|
|
103
102
|
"final-form-arrays": "^3.1.0",
|
|
104
103
|
"final-form-set-field-data": "^1.0.2",
|
|
@@ -125,18 +124,18 @@
|
|
|
125
124
|
"slate-history": "^0.100.0",
|
|
126
125
|
"slate-hyperscript": "^0.100.0",
|
|
127
126
|
"slate-react": "^0.107.1",
|
|
128
|
-
"tailwind-merge": "^2.5.
|
|
127
|
+
"tailwind-merge": "^2.5.4",
|
|
129
128
|
"webfontloader": "1.6.28",
|
|
130
129
|
"yup": "^1.4.0",
|
|
131
130
|
"zod": "^3.23.8",
|
|
132
|
-
"@tinacms/mdx": "0.0.0-
|
|
133
|
-
"@tinacms/schema-tools": "0.0.0-
|
|
134
|
-
"@tinacms/search": "0.0.0-
|
|
131
|
+
"@tinacms/mdx": "0.0.0-c45ac5d-20241213020122",
|
|
132
|
+
"@tinacms/schema-tools": "0.0.0-c45ac5d-20241213020122",
|
|
133
|
+
"@tinacms/search": "0.0.0-c45ac5d-20241213020122"
|
|
135
134
|
},
|
|
136
135
|
"devDependencies": {
|
|
137
|
-
"@graphql-tools/utils": "^10.5.
|
|
136
|
+
"@graphql-tools/utils": "^10.5.6",
|
|
138
137
|
"@testing-library/dom": "^10.4.0",
|
|
139
|
-
"@testing-library/jest-dom": "^6.
|
|
138
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
140
139
|
"@testing-library/react": "^16.0.1",
|
|
141
140
|
"@testing-library/user-event": "^14.5.2",
|
|
142
141
|
"@types/atob": "^2.1.4",
|
|
@@ -144,14 +143,14 @@
|
|
|
144
143
|
"@types/color-string": "^1.5.5",
|
|
145
144
|
"@types/lodash.debounce": "^4.0.9",
|
|
146
145
|
"@types/lodash.get": "^4.4.9",
|
|
147
|
-
"@types/node": "^22.
|
|
146
|
+
"@types/node": "^22.9.0",
|
|
148
147
|
"@types/prop-types": "^15.7.13",
|
|
149
|
-
"@types/react": "^18.3.
|
|
148
|
+
"@types/react": "^18.3.12",
|
|
150
149
|
"@types/react-beautiful-dnd": "^13.1.8",
|
|
151
150
|
"@types/react-color": "^3.0.12",
|
|
152
|
-
"@types/react-dom": "^18.3.
|
|
151
|
+
"@types/react-dom": "^18.3.1",
|
|
153
152
|
"@types/yup": "^0.32.0",
|
|
154
|
-
"happy-dom": "
|
|
153
|
+
"happy-dom": "15.10.2",
|
|
155
154
|
"identity-obj-proxy": "^3.0.0",
|
|
156
155
|
"isomorphic-fetch": "^3.0.0",
|
|
157
156
|
"jest-file-snapshot": "^0.7.0",
|
|
@@ -160,11 +159,11 @@
|
|
|
160
159
|
"react-dom": "^18.3.1",
|
|
161
160
|
"react-is": "^18.3.1",
|
|
162
161
|
"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.
|
|
162
|
+
"tslib": "^2.8.1",
|
|
163
|
+
"typescript": "^5.6.3",
|
|
164
|
+
"vite": "^5.4.11",
|
|
165
|
+
"vitest": "^2.1.5",
|
|
166
|
+
"@tinacms/scripts": "1.3.1"
|
|
168
167
|
},
|
|
169
168
|
"peerDependencies": {
|
|
170
169
|
"react": ">=16.14.0",
|