tinacms 2.7.7 → 2.7.8
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/components/ui/tooltip.d.ts +7 -0
- package/dist/admin/pages/CollectionListPage.d.ts +2 -2
- package/dist/client.js +0 -1
- package/dist/client.mjs +0 -1
- package/dist/index.js +105 -35
- package/dist/index.mjs +106 -36
- package/dist/node-cache-5e8db9f0.mjs +0 -1
- package/dist/react.js +0 -1
- package/dist/react.mjs +0 -1
- package/dist/rich-text/index.js +0 -1
- package/dist/rich-text/index.mjs +0 -1
- package/dist/rich-text/prism.js +0 -1
- package/dist/rich-text/prism.mjs +0 -1
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/transforms/is-url.d.ts +1 -2
- package/dist/toolkit/form-builder/form-builder.d.ts +11 -0
- package/package.json +6 -6
- package/dist/client.js.map +0 -1
- package/dist/client.mjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/node-cache-5e8db9f0.mjs.map +0 -1
- package/dist/react.js.map +0 -1
- package/dist/react.mjs.map +0 -1
- package/dist/rich-text/index.js.map +0 -1
- package/dist/rich-text/index.mjs.map +0 -1
- package/dist/rich-text/prism.js.map +0 -1
- package/dist/rich-text/prism.mjs.map +0 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
declare const TooltipProvider: React.FC<TooltipPrimitive.TooltipProviderProps>;
|
|
4
|
+
declare const Tooltip: React.FC<TooltipPrimitive.TooltipProps>;
|
|
5
|
+
declare const TooltipTrigger: React.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
declare const TooltipContent: React.ForwardRefExoticComponent<Omit<TooltipPrimitive.TooltipContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import type { Collection } from '@tinacms/schema-tools';
|
|
2
|
+
import { type TinaCMS } from '@tinacms/toolkit';
|
|
1
3
|
import React from 'react';
|
|
2
4
|
import { type NavigateFunction } from 'react-router-dom';
|
|
3
|
-
import { type TinaCMS } from '@tinacms/toolkit';
|
|
4
5
|
import type { CollectionResponse, DocumentSys } from '../types';
|
|
5
|
-
import type { Collection } from '@tinacms/schema-tools';
|
|
6
6
|
export declare const handleNavigate: (navigate: NavigateFunction, cms: TinaCMS, collection: CollectionResponse, collectionDefinition: Collection<true>, document: DocumentSys) => Promise<any>;
|
|
7
7
|
declare const CollectionListPage: () => React.JSX.Element;
|
|
8
8
|
export default CollectionListPage;
|
package/dist/client.js
CHANGED
package/dist/client.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -10886,7 +10886,7 @@ flowchart TD
|
|
|
10886
10886
|
"Event Log"
|
|
10887
10887
|
));
|
|
10888
10888
|
};
|
|
10889
|
-
const version = "2.7.
|
|
10889
|
+
const version = "2.7.8";
|
|
10890
10890
|
const Nav = ({
|
|
10891
10891
|
isLocalMode,
|
|
10892
10892
|
className = "",
|
|
@@ -12761,11 +12761,11 @@ flowchart TD
|
|
|
12761
12761
|
}
|
|
12762
12762
|
};
|
|
12763
12763
|
return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, createBranchModalOpen && /* @__PURE__ */ React__namespace.createElement(
|
|
12764
|
-
|
|
12764
|
+
CreateBranchModal,
|
|
12765
12765
|
{
|
|
12766
12766
|
safeSubmit,
|
|
12767
12767
|
crudType: tinaForm.crudType,
|
|
12768
|
-
|
|
12768
|
+
path: tinaForm.relativePath,
|
|
12769
12769
|
values: tinaForm.values,
|
|
12770
12770
|
close: () => setCreateBranchModalOpen(false)
|
|
12771
12771
|
}
|
|
@@ -12881,6 +12881,22 @@ flowchart TD
|
|
|
12881
12881
|
relativePath: relativePath2,
|
|
12882
12882
|
values,
|
|
12883
12883
|
crudType
|
|
12884
|
+
}) => /* @__PURE__ */ React__namespace.createElement(
|
|
12885
|
+
CreateBranchModal,
|
|
12886
|
+
{
|
|
12887
|
+
close: close2,
|
|
12888
|
+
safeSubmit,
|
|
12889
|
+
path: relativePath2,
|
|
12890
|
+
values,
|
|
12891
|
+
crudType
|
|
12892
|
+
}
|
|
12893
|
+
);
|
|
12894
|
+
const CreateBranchModal = ({
|
|
12895
|
+
close: close2,
|
|
12896
|
+
safeSubmit,
|
|
12897
|
+
path,
|
|
12898
|
+
values,
|
|
12899
|
+
crudType
|
|
12884
12900
|
}) => {
|
|
12885
12901
|
const cms = useCMS$1();
|
|
12886
12902
|
const tinaApi = cms.api.tina;
|
|
@@ -12889,7 +12905,7 @@ flowchart TD
|
|
|
12889
12905
|
const [error, setError] = React__namespace.useState("");
|
|
12890
12906
|
const onCreateBranch = (newBranchName2) => {
|
|
12891
12907
|
localStorage.setItem("tina.createBranchState", "starting");
|
|
12892
|
-
localStorage.setItem("tina.createBranchState.fullPath",
|
|
12908
|
+
localStorage.setItem("tina.createBranchState.fullPath", path);
|
|
12893
12909
|
localStorage.setItem(
|
|
12894
12910
|
"tina.createBranchState.values",
|
|
12895
12911
|
JSON.stringify(values)
|
|
@@ -13969,11 +13985,11 @@ flowchart TD
|
|
|
13969
13985
|
}
|
|
13970
13986
|
);
|
|
13971
13987
|
Editor.displayName = "Editor";
|
|
13972
|
-
const TooltipProvider = TooltipPrimitive__namespace.Provider;
|
|
13973
|
-
const Tooltip = TooltipPrimitive__namespace.Root;
|
|
13974
|
-
const TooltipTrigger = TooltipPrimitive__namespace.Trigger;
|
|
13988
|
+
const TooltipProvider$1 = TooltipPrimitive__namespace.Provider;
|
|
13989
|
+
const Tooltip$1 = TooltipPrimitive__namespace.Root;
|
|
13990
|
+
const TooltipTrigger$1 = TooltipPrimitive__namespace.Trigger;
|
|
13975
13991
|
const TooltipPortal = TooltipPrimitive__namespace.Portal;
|
|
13976
|
-
const TooltipContent = cn$1.withCn(
|
|
13992
|
+
const TooltipContent$1 = cn$1.withCn(
|
|
13977
13993
|
cn$1.withProps(TooltipPrimitive__namespace.Content, {
|
|
13978
13994
|
sideOffset: 4
|
|
13979
13995
|
}),
|
|
@@ -13987,7 +14003,7 @@ flowchart TD
|
|
|
13987
14003
|
}, []);
|
|
13988
14004
|
const component = /* @__PURE__ */ React.createElement(Component, { ref, ...props });
|
|
13989
14005
|
if (tooltip && mounted) {
|
|
13990
|
-
return /* @__PURE__ */ React.createElement(Tooltip, { ...tooltipProps }, /* @__PURE__ */ React.createElement(TooltipTrigger, { asChild: true }, component), /* @__PURE__ */ React.createElement(TooltipPortal, null, /* @__PURE__ */ React.createElement(TooltipContent, { ...tooltipContentProps }, tooltip)));
|
|
14006
|
+
return /* @__PURE__ */ React.createElement(Tooltip$1, { ...tooltipProps }, /* @__PURE__ */ React.createElement(TooltipTrigger$1, { asChild: true }, component), /* @__PURE__ */ React.createElement(TooltipPortal, null, /* @__PURE__ */ React.createElement(TooltipContent$1, { ...tooltipContentProps }, tooltip)));
|
|
13991
14007
|
}
|
|
13992
14008
|
return component;
|
|
13993
14009
|
});
|
|
@@ -15026,6 +15042,7 @@ flowchart TD
|
|
|
15026
15042
|
}
|
|
15027
15043
|
const protocolAndDomainRE = /^(?:\w+:)?\/\/(\S+)$/;
|
|
15028
15044
|
const emailLintRE = /mailto:([^?\\]+)/;
|
|
15045
|
+
const telLintRE = /tel:([\d-]+)/;
|
|
15029
15046
|
const localhostDomainRE = /^localhost[\d:?]*(?:[^\d:?]\S*)?$/;
|
|
15030
15047
|
const nonLocalhostDomainRE = /^[^\s.]+\.\S{2,}$/;
|
|
15031
15048
|
const localUrlRE = /^\/\S+/;
|
|
@@ -15038,24 +15055,24 @@ flowchart TD
|
|
|
15038
15055
|
}
|
|
15039
15056
|
const generalMatch = string.match(protocolAndDomainRE);
|
|
15040
15057
|
const emailLinkMatch = string.match(emailLintRE);
|
|
15058
|
+
const telLinkMatch = string.match(telLintRE);
|
|
15041
15059
|
const localUrlMatch = string.match(localUrlRE);
|
|
15042
|
-
|
|
15043
|
-
if (!match) {
|
|
15044
|
-
return false;
|
|
15045
|
-
}
|
|
15046
|
-
if (localUrlMatch) {
|
|
15060
|
+
if (emailLinkMatch || telLinkMatch || localUrlMatch) {
|
|
15047
15061
|
return true;
|
|
15048
15062
|
}
|
|
15049
|
-
|
|
15050
|
-
|
|
15051
|
-
|
|
15052
|
-
|
|
15053
|
-
|
|
15054
|
-
|
|
15055
|
-
|
|
15056
|
-
|
|
15063
|
+
if (generalMatch) {
|
|
15064
|
+
const everythingAfterProtocol = generalMatch[1];
|
|
15065
|
+
if (!everythingAfterProtocol) {
|
|
15066
|
+
return false;
|
|
15067
|
+
}
|
|
15068
|
+
try {
|
|
15069
|
+
new URL(string);
|
|
15070
|
+
} catch {
|
|
15071
|
+
return false;
|
|
15072
|
+
}
|
|
15073
|
+
return localhostDomainRE.test(everythingAfterProtocol) || nonLocalhostDomainRE.test(everythingAfterProtocol);
|
|
15057
15074
|
}
|
|
15058
|
-
return
|
|
15075
|
+
return false;
|
|
15059
15076
|
};
|
|
15060
15077
|
const RichEditor = ({ input, tinaForm, field }) => {
|
|
15061
15078
|
var _a;
|
|
@@ -15120,7 +15137,7 @@ flowchart TD
|
|
|
15120
15137
|
});
|
|
15121
15138
|
}
|
|
15122
15139
|
},
|
|
15123
|
-
/* @__PURE__ */ React.createElement(TooltipProvider, null, /* @__PURE__ */ React.createElement(
|
|
15140
|
+
/* @__PURE__ */ React.createElement(TooltipProvider$1, null, /* @__PURE__ */ React.createElement(
|
|
15124
15141
|
ToolbarProvider,
|
|
15125
15142
|
{
|
|
15126
15143
|
tinaForm,
|
|
@@ -32651,6 +32668,22 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
32651
32668
|
};
|
|
32652
32669
|
const PageBody = ({ children }) => /* @__PURE__ */ React.createElement("div", { className: "py-8 px-6 xl:px-12" }, children);
|
|
32653
32670
|
const PageBodyNarrow = ({ children }) => /* @__PURE__ */ React.createElement("div", { className: "py-10 px-6 xl:px-12" }, /* @__PURE__ */ React.createElement("div", { className: "w-full mx-auto max-w-screen-xl" }, children));
|
|
32671
|
+
const TooltipProvider = TooltipPrimitive__namespace.Provider;
|
|
32672
|
+
const Tooltip = TooltipPrimitive__namespace.Root;
|
|
32673
|
+
const TooltipTrigger = TooltipPrimitive__namespace.Trigger;
|
|
32674
|
+
const TooltipContent = React__namespace.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ React__namespace.createElement(TooltipPrimitive__namespace.Portal, null, /* @__PURE__ */ React__namespace.createElement(
|
|
32675
|
+
TooltipPrimitive__namespace.Content,
|
|
32676
|
+
{
|
|
32677
|
+
ref,
|
|
32678
|
+
sideOffset,
|
|
32679
|
+
className: cn(
|
|
32680
|
+
"z-[10000] overflow-hidden rounded-md bg-[#FFF] px-3 py-1.5 text-xs text-[#504E5E] shadow-sm animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",
|
|
32681
|
+
className
|
|
32682
|
+
),
|
|
32683
|
+
...props
|
|
32684
|
+
}
|
|
32685
|
+
)));
|
|
32686
|
+
TooltipContent.displayName = TooltipPrimitive__namespace.Content.displayName;
|
|
32654
32687
|
const folderRegex = /^.*\/~\/*(.*)$/;
|
|
32655
32688
|
const parentFolder = (folder) => {
|
|
32656
32689
|
return {
|
|
@@ -32917,10 +32950,10 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
32917
32950
|
close: () => setDeleteModalOpen(false)
|
|
32918
32951
|
}
|
|
32919
32952
|
), deleteModalOpen && cms.api.tina.usingProtectedBranch() && /* @__PURE__ */ React.createElement(
|
|
32920
|
-
|
|
32953
|
+
CreateBranchModal,
|
|
32921
32954
|
{
|
|
32922
32955
|
crudType: "delete",
|
|
32923
|
-
|
|
32956
|
+
path: `${collectionExtra.path}/${vars.relativePath}`,
|
|
32924
32957
|
values: vars,
|
|
32925
32958
|
close: () => setDeleteModalOpen(false),
|
|
32926
32959
|
safeSubmit: async () => {
|
|
@@ -33091,10 +33124,14 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
33091
33124
|
size: "small"
|
|
33092
33125
|
},
|
|
33093
33126
|
"Search not configured."
|
|
33094
|
-
)))), /* @__PURE__ */ React.createElement("div", { className: "flex flex-col md:flex-row items-start md:items-end gap-2 md:gap-0 pt-4 lg:pt-0" },
|
|
33127
|
+
)))), allowCreate && /* @__PURE__ */ React.createElement("div", { className: "flex flex-col md:flex-row items-start md:items-end gap-2 md:gap-0 pt-4 lg:pt-0" }, allowCreateNestedFolder && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TooltipProvider, null, /* @__PURE__ */ React.createElement(Tooltip, null, /* @__PURE__ */ React.createElement(TooltipTrigger, { asChild: true }, /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement(
|
|
33095
33128
|
reactRouterDom.Link,
|
|
33096
33129
|
{
|
|
33097
33130
|
onMouseDown: (evt) => {
|
|
33131
|
+
if (collection.templates) {
|
|
33132
|
+
evt.preventDefault();
|
|
33133
|
+
return;
|
|
33134
|
+
}
|
|
33098
33135
|
setVars((old) => ({
|
|
33099
33136
|
...old,
|
|
33100
33137
|
collection: collectionName,
|
|
@@ -33104,12 +33141,32 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
33104
33141
|
evt.stopPropagation();
|
|
33105
33142
|
},
|
|
33106
33143
|
to: "/collections/new-folder",
|
|
33107
|
-
className:
|
|
33144
|
+
className: cn(
|
|
33145
|
+
"icon-parent inline-flex items-center font-medium focus:outline-none focus:ring-2 focus:shadow-outline text-center rounded-full justify-center transition-all duration-150 ease-out whitespace-nowrap shadow text-blue-500 bg-white hover:bg-[#f1f5f9] focus:ring-white focus:ring-blue-500 w-full md:w-auto text-sm h-10 px-6 mr-4",
|
|
33146
|
+
collection.templates && "opacity-50 pointer-events-none cursor-not-allowed"
|
|
33147
|
+
),
|
|
33148
|
+
"aria-disabled": !!collection.templates,
|
|
33149
|
+
tabIndex: collection.templates ? -1 : 0
|
|
33108
33150
|
},
|
|
33109
33151
|
/* @__PURE__ */ React.createElement(FaFolder, { className: "mr-2" }),
|
|
33110
|
-
"Add Folder"
|
|
33111
|
-
|
|
33112
|
-
|
|
33152
|
+
"Add Folder"
|
|
33153
|
+
))), collection.templates && /* @__PURE__ */ React.createElement(
|
|
33154
|
+
TooltipContent,
|
|
33155
|
+
{
|
|
33156
|
+
side: "top",
|
|
33157
|
+
align: "center"
|
|
33158
|
+
},
|
|
33159
|
+
/* @__PURE__ */ React.createElement("p", null, "Folders can’t be manually added when using templates.", /* @__PURE__ */ React.createElement("br", null), "See the docs -", " ", /* @__PURE__ */ React.createElement(
|
|
33160
|
+
"a",
|
|
33161
|
+
{
|
|
33162
|
+
href: "https://tina.io/docs/reference/templates",
|
|
33163
|
+
target: "_blank",
|
|
33164
|
+
rel: "noopener noreferrer",
|
|
33165
|
+
className: "underline text-blue-500"
|
|
33166
|
+
},
|
|
33167
|
+
"https://tina.io/docs/reference/templates"
|
|
33168
|
+
))
|
|
33169
|
+
)))), !collection.templates && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
33113
33170
|
reactRouterDom.Link,
|
|
33114
33171
|
{
|
|
33115
33172
|
to: `/${folder.fullyQualifiedName ? [
|
|
@@ -33128,7 +33185,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
33128
33185
|
/* @__PURE__ */ React.createElement(FaFile, { className: "mr-2" }),
|
|
33129
33186
|
"Add Files",
|
|
33130
33187
|
" "
|
|
33131
|
-
)), collection.templates &&
|
|
33188
|
+
)), collection.templates && /* @__PURE__ */ React.createElement(
|
|
33132
33189
|
TemplateMenu,
|
|
33133
33190
|
{
|
|
33134
33191
|
collectionName,
|
|
@@ -34243,7 +34300,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
34243
34300
|
const form = React.useMemo(() => {
|
|
34244
34301
|
return new Form({
|
|
34245
34302
|
// id is the full document path
|
|
34246
|
-
id: `${schemaCollection.path}/${relativePath2}
|
|
34303
|
+
id: schemaTools.canonicalPath(`${schemaCollection.path}/${relativePath2}`),
|
|
34247
34304
|
label: "form",
|
|
34248
34305
|
fields: formInfo.fields,
|
|
34249
34306
|
initialValues: document2._values,
|
|
@@ -34406,7 +34463,10 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
34406
34463
|
const collection = tinaApi.schema.getCollectionByFullPath(fullPath);
|
|
34407
34464
|
const api = new TinaAdminApi(cms);
|
|
34408
34465
|
const params = api.schema.transformPayload(collection.name, values);
|
|
34409
|
-
const relativePath2 =
|
|
34466
|
+
const relativePath2 = pathRelativeToCollection(
|
|
34467
|
+
collection.path,
|
|
34468
|
+
fullPath
|
|
34469
|
+
);
|
|
34410
34470
|
if (await api.isAuthenticated()) {
|
|
34411
34471
|
if (kind === "delete") {
|
|
34412
34472
|
await api.deleteDocument(values);
|
|
@@ -34472,6 +34532,16 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
34472
34532
|
), (state === "starting" || state === "creatingBranch") && /* @__PURE__ */ React.createElement("p", null, "Creating branch…"), state === "indexing" && /* @__PURE__ */ React.createElement("p", null, "Indexing Content…"), state === "submitting" && /* @__PURE__ */ React.createElement("p", null, "Saving content…"), state === "creatingPR" && /* @__PURE__ */ React.createElement("p", null, "Creating Pull Request…"), state === "error" && /* @__PURE__ */ React.createElement("p", { className: "flex items-center gap-1 text-red-700" }, /* @__PURE__ */ React.createElement(BiError, { className: "w-7 h-auto text-red-400 flex-shrink-0" }), " ", /* @__PURE__ */ React.createElement("b", null, "Error:"), " ", errorMessage, " "));
|
|
34473
34533
|
};
|
|
34474
34534
|
const Wrapper = ({ children }) => /* @__PURE__ */ React.createElement("div", { className: "w-full h-full flex flex-col justify-center items-center gap-4 p-6 text-xl text-gray-700" }, children);
|
|
34535
|
+
const pathRelativeToCollection = (collectionPath, fullPath) => {
|
|
34536
|
+
const cleanCollectionPath = schemaTools.canonicalPath(collectionPath) + "/";
|
|
34537
|
+
const cleanFullPath = schemaTools.canonicalPath(fullPath);
|
|
34538
|
+
if (cleanFullPath.startsWith(cleanCollectionPath)) {
|
|
34539
|
+
return cleanFullPath.substring(cleanCollectionPath.length);
|
|
34540
|
+
}
|
|
34541
|
+
throw new Error(
|
|
34542
|
+
`Path ${fullPath} not within collection path ${collectionPath}`
|
|
34543
|
+
);
|
|
34544
|
+
};
|
|
34475
34545
|
const Redirect = () => {
|
|
34476
34546
|
React.useEffect(() => {
|
|
34477
34547
|
if (window) {
|
|
@@ -34898,6 +34968,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
34898
34968
|
exports2.ColorField = ColorField;
|
|
34899
34969
|
exports2.ColorFieldPlugin = ColorFieldPlugin;
|
|
34900
34970
|
exports2.ColorPicker = ColorPicker;
|
|
34971
|
+
exports2.CreateBranchModal = CreateBranchModal;
|
|
34901
34972
|
exports2.CreateBranchModel = CreateBranchModel;
|
|
34902
34973
|
exports2.CursorPaginator = CursorPaginator;
|
|
34903
34974
|
exports2.DEFAULT_LOCAL_TINA_GQL_SERVER_URL = DEFAULT_LOCAL_TINA_GQL_SERVER_URL;
|
|
@@ -35082,4 +35153,3 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
35082
35153
|
exports2.wrapFieldsWithMeta = wrapFieldsWithMeta;
|
|
35083
35154
|
Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
35084
35155
|
});
|
|
35085
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.mjs
CHANGED
|
@@ -54,7 +54,7 @@ import { ELEMENT_PARAGRAPH as ELEMENT_PARAGRAPH$1 } from "@udecode/plate-paragra
|
|
|
54
54
|
import { ELEMENT_BLOCKQUOTE as ELEMENT_BLOCKQUOTE$1 } from "@udecode/plate-block-quote";
|
|
55
55
|
import { useFloatingToolbarState, offset, flip, useFloatingToolbar } from "@udecode/plate-floating";
|
|
56
56
|
import { getIntrospectionQuery, buildClientSchema, print, parse as parse$3, buildSchema } from "graphql";
|
|
57
|
-
import { TinaSchema, addNamespaceToSchema, parseURL, resolveForm, normalizePath, validateSchema } from "@tinacms/schema-tools";
|
|
57
|
+
import { TinaSchema, addNamespaceToSchema, parseURL, resolveForm, normalizePath, canonicalPath, validateSchema } from "@tinacms/schema-tools";
|
|
58
58
|
import { NAMER, resolveField } from "@tinacms/schema-tools";
|
|
59
59
|
import gql from "graphql-tag";
|
|
60
60
|
import { diff } from "@graphql-inspector/core";
|
|
@@ -10913,7 +10913,7 @@ const SyncStatus = ({ cms, setEventsOpen }) => {
|
|
|
10913
10913
|
"Event Log"
|
|
10914
10914
|
));
|
|
10915
10915
|
};
|
|
10916
|
-
const version = "2.7.
|
|
10916
|
+
const version = "2.7.8";
|
|
10917
10917
|
const Nav = ({
|
|
10918
10918
|
isLocalMode,
|
|
10919
10919
|
className = "",
|
|
@@ -12788,11 +12788,11 @@ const FormBuilder = ({
|
|
|
12788
12788
|
}
|
|
12789
12789
|
};
|
|
12790
12790
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, createBranchModalOpen && /* @__PURE__ */ React.createElement(
|
|
12791
|
-
|
|
12791
|
+
CreateBranchModal,
|
|
12792
12792
|
{
|
|
12793
12793
|
safeSubmit,
|
|
12794
12794
|
crudType: tinaForm.crudType,
|
|
12795
|
-
|
|
12795
|
+
path: tinaForm.relativePath,
|
|
12796
12796
|
values: tinaForm.values,
|
|
12797
12797
|
close: () => setCreateBranchModalOpen(false)
|
|
12798
12798
|
}
|
|
@@ -12908,6 +12908,22 @@ const CreateBranchModel = ({
|
|
|
12908
12908
|
relativePath: relativePath2,
|
|
12909
12909
|
values,
|
|
12910
12910
|
crudType
|
|
12911
|
+
}) => /* @__PURE__ */ React.createElement(
|
|
12912
|
+
CreateBranchModal,
|
|
12913
|
+
{
|
|
12914
|
+
close: close2,
|
|
12915
|
+
safeSubmit,
|
|
12916
|
+
path: relativePath2,
|
|
12917
|
+
values,
|
|
12918
|
+
crudType
|
|
12919
|
+
}
|
|
12920
|
+
);
|
|
12921
|
+
const CreateBranchModal = ({
|
|
12922
|
+
close: close2,
|
|
12923
|
+
safeSubmit,
|
|
12924
|
+
path,
|
|
12925
|
+
values,
|
|
12926
|
+
crudType
|
|
12911
12927
|
}) => {
|
|
12912
12928
|
const cms = useCMS$1();
|
|
12913
12929
|
const tinaApi = cms.api.tina;
|
|
@@ -12916,7 +12932,7 @@ const CreateBranchModel = ({
|
|
|
12916
12932
|
const [error, setError] = React.useState("");
|
|
12917
12933
|
const onCreateBranch = (newBranchName2) => {
|
|
12918
12934
|
localStorage.setItem("tina.createBranchState", "starting");
|
|
12919
|
-
localStorage.setItem("tina.createBranchState.fullPath",
|
|
12935
|
+
localStorage.setItem("tina.createBranchState.fullPath", path);
|
|
12920
12936
|
localStorage.setItem(
|
|
12921
12937
|
"tina.createBranchState.values",
|
|
12922
12938
|
JSON.stringify(values)
|
|
@@ -13996,11 +14012,11 @@ const Editor = React__default.forwardRef(
|
|
|
13996
14012
|
}
|
|
13997
14013
|
);
|
|
13998
14014
|
Editor.displayName = "Editor";
|
|
13999
|
-
const TooltipProvider = TooltipPrimitive.Provider;
|
|
14000
|
-
const Tooltip = TooltipPrimitive.Root;
|
|
14001
|
-
const TooltipTrigger = TooltipPrimitive.Trigger;
|
|
14015
|
+
const TooltipProvider$1 = TooltipPrimitive.Provider;
|
|
14016
|
+
const Tooltip$1 = TooltipPrimitive.Root;
|
|
14017
|
+
const TooltipTrigger$1 = TooltipPrimitive.Trigger;
|
|
14002
14018
|
const TooltipPortal = TooltipPrimitive.Portal;
|
|
14003
|
-
const TooltipContent = withCn(
|
|
14019
|
+
const TooltipContent$1 = withCn(
|
|
14004
14020
|
withProps(TooltipPrimitive.Content, {
|
|
14005
14021
|
sideOffset: 4
|
|
14006
14022
|
}),
|
|
@@ -14014,7 +14030,7 @@ function withTooltip(Component) {
|
|
|
14014
14030
|
}, []);
|
|
14015
14031
|
const component = /* @__PURE__ */ React__default.createElement(Component, { ref, ...props });
|
|
14016
14032
|
if (tooltip && mounted) {
|
|
14017
|
-
return /* @__PURE__ */ React__default.createElement(Tooltip, { ...tooltipProps }, /* @__PURE__ */ React__default.createElement(TooltipTrigger, { asChild: true }, component), /* @__PURE__ */ React__default.createElement(TooltipPortal, null, /* @__PURE__ */ React__default.createElement(TooltipContent, { ...tooltipContentProps }, tooltip)));
|
|
14033
|
+
return /* @__PURE__ */ React__default.createElement(Tooltip$1, { ...tooltipProps }, /* @__PURE__ */ React__default.createElement(TooltipTrigger$1, { asChild: true }, component), /* @__PURE__ */ React__default.createElement(TooltipPortal, null, /* @__PURE__ */ React__default.createElement(TooltipContent$1, { ...tooltipContentProps }, tooltip)));
|
|
14018
14034
|
}
|
|
14019
14035
|
return component;
|
|
14020
14036
|
});
|
|
@@ -15053,6 +15069,7 @@ function LinkFloatingToolbar({ state }) {
|
|
|
15053
15069
|
}
|
|
15054
15070
|
const protocolAndDomainRE = /^(?:\w+:)?\/\/(\S+)$/;
|
|
15055
15071
|
const emailLintRE = /mailto:([^?\\]+)/;
|
|
15072
|
+
const telLintRE = /tel:([\d-]+)/;
|
|
15056
15073
|
const localhostDomainRE = /^localhost[\d:?]*(?:[^\d:?]\S*)?$/;
|
|
15057
15074
|
const nonLocalhostDomainRE = /^[^\s.]+\.\S{2,}$/;
|
|
15058
15075
|
const localUrlRE = /^\/\S+/;
|
|
@@ -15065,24 +15082,24 @@ const isUrl = (string) => {
|
|
|
15065
15082
|
}
|
|
15066
15083
|
const generalMatch = string.match(protocolAndDomainRE);
|
|
15067
15084
|
const emailLinkMatch = string.match(emailLintRE);
|
|
15085
|
+
const telLinkMatch = string.match(telLintRE);
|
|
15068
15086
|
const localUrlMatch = string.match(localUrlRE);
|
|
15069
|
-
|
|
15070
|
-
if (!match) {
|
|
15071
|
-
return false;
|
|
15072
|
-
}
|
|
15073
|
-
if (localUrlMatch) {
|
|
15087
|
+
if (emailLinkMatch || telLinkMatch || localUrlMatch) {
|
|
15074
15088
|
return true;
|
|
15075
15089
|
}
|
|
15076
|
-
|
|
15077
|
-
|
|
15078
|
-
|
|
15079
|
-
|
|
15080
|
-
|
|
15081
|
-
|
|
15082
|
-
|
|
15083
|
-
|
|
15090
|
+
if (generalMatch) {
|
|
15091
|
+
const everythingAfterProtocol = generalMatch[1];
|
|
15092
|
+
if (!everythingAfterProtocol) {
|
|
15093
|
+
return false;
|
|
15094
|
+
}
|
|
15095
|
+
try {
|
|
15096
|
+
new URL(string);
|
|
15097
|
+
} catch {
|
|
15098
|
+
return false;
|
|
15099
|
+
}
|
|
15100
|
+
return localhostDomainRE.test(everythingAfterProtocol) || nonLocalhostDomainRE.test(everythingAfterProtocol);
|
|
15084
15101
|
}
|
|
15085
|
-
return
|
|
15102
|
+
return false;
|
|
15086
15103
|
};
|
|
15087
15104
|
const RichEditor = ({ input, tinaForm, field }) => {
|
|
15088
15105
|
var _a;
|
|
@@ -15147,7 +15164,7 @@ const RichEditor = ({ input, tinaForm, field }) => {
|
|
|
15147
15164
|
});
|
|
15148
15165
|
}
|
|
15149
15166
|
},
|
|
15150
|
-
/* @__PURE__ */ React__default.createElement(TooltipProvider, null, /* @__PURE__ */ React__default.createElement(
|
|
15167
|
+
/* @__PURE__ */ React__default.createElement(TooltipProvider$1, null, /* @__PURE__ */ React__default.createElement(
|
|
15151
15168
|
ToolbarProvider,
|
|
15152
15169
|
{
|
|
15153
15170
|
tinaForm,
|
|
@@ -32678,6 +32695,22 @@ const PageHeader = ({
|
|
|
32678
32695
|
};
|
|
32679
32696
|
const PageBody = ({ children }) => /* @__PURE__ */ React__default.createElement("div", { className: "py-8 px-6 xl:px-12" }, children);
|
|
32680
32697
|
const PageBodyNarrow = ({ children }) => /* @__PURE__ */ React__default.createElement("div", { className: "py-10 px-6 xl:px-12" }, /* @__PURE__ */ React__default.createElement("div", { className: "w-full mx-auto max-w-screen-xl" }, children));
|
|
32698
|
+
const TooltipProvider = TooltipPrimitive.Provider;
|
|
32699
|
+
const Tooltip = TooltipPrimitive.Root;
|
|
32700
|
+
const TooltipTrigger = TooltipPrimitive.Trigger;
|
|
32701
|
+
const TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ React.createElement(TooltipPrimitive.Portal, null, /* @__PURE__ */ React.createElement(
|
|
32702
|
+
TooltipPrimitive.Content,
|
|
32703
|
+
{
|
|
32704
|
+
ref,
|
|
32705
|
+
sideOffset,
|
|
32706
|
+
className: cn(
|
|
32707
|
+
"z-[10000] overflow-hidden rounded-md bg-[#FFF] px-3 py-1.5 text-xs text-[#504E5E] shadow-sm animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",
|
|
32708
|
+
className
|
|
32709
|
+
),
|
|
32710
|
+
...props
|
|
32711
|
+
}
|
|
32712
|
+
)));
|
|
32713
|
+
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
32681
32714
|
const folderRegex = /^.*\/~\/*(.*)$/;
|
|
32682
32715
|
const parentFolder = (folder) => {
|
|
32683
32716
|
return {
|
|
@@ -32944,10 +32977,10 @@ const CollectionListPage = () => {
|
|
|
32944
32977
|
close: () => setDeleteModalOpen(false)
|
|
32945
32978
|
}
|
|
32946
32979
|
), deleteModalOpen && cms.api.tina.usingProtectedBranch() && /* @__PURE__ */ React__default.createElement(
|
|
32947
|
-
|
|
32980
|
+
CreateBranchModal,
|
|
32948
32981
|
{
|
|
32949
32982
|
crudType: "delete",
|
|
32950
|
-
|
|
32983
|
+
path: `${collectionExtra.path}/${vars.relativePath}`,
|
|
32951
32984
|
values: vars,
|
|
32952
32985
|
close: () => setDeleteModalOpen(false),
|
|
32953
32986
|
safeSubmit: async () => {
|
|
@@ -33118,10 +33151,14 @@ const CollectionListPage = () => {
|
|
|
33118
33151
|
size: "small"
|
|
33119
33152
|
},
|
|
33120
33153
|
"Search not configured."
|
|
33121
|
-
)))), /* @__PURE__ */ React__default.createElement("div", { className: "flex flex-col md:flex-row items-start md:items-end gap-2 md:gap-0 pt-4 lg:pt-0" },
|
|
33154
|
+
)))), allowCreate && /* @__PURE__ */ React__default.createElement("div", { className: "flex flex-col md:flex-row items-start md:items-end gap-2 md:gap-0 pt-4 lg:pt-0" }, allowCreateNestedFolder && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(TooltipProvider, null, /* @__PURE__ */ React__default.createElement(Tooltip, null, /* @__PURE__ */ React__default.createElement(TooltipTrigger, { asChild: true }, /* @__PURE__ */ React__default.createElement("span", null, /* @__PURE__ */ React__default.createElement(
|
|
33122
33155
|
Link,
|
|
33123
33156
|
{
|
|
33124
33157
|
onMouseDown: (evt) => {
|
|
33158
|
+
if (collection.templates) {
|
|
33159
|
+
evt.preventDefault();
|
|
33160
|
+
return;
|
|
33161
|
+
}
|
|
33125
33162
|
setVars((old) => ({
|
|
33126
33163
|
...old,
|
|
33127
33164
|
collection: collectionName,
|
|
@@ -33131,12 +33168,32 @@ const CollectionListPage = () => {
|
|
|
33131
33168
|
evt.stopPropagation();
|
|
33132
33169
|
},
|
|
33133
33170
|
to: "/collections/new-folder",
|
|
33134
|
-
className:
|
|
33171
|
+
className: cn(
|
|
33172
|
+
"icon-parent inline-flex items-center font-medium focus:outline-none focus:ring-2 focus:shadow-outline text-center rounded-full justify-center transition-all duration-150 ease-out whitespace-nowrap shadow text-blue-500 bg-white hover:bg-[#f1f5f9] focus:ring-white focus:ring-blue-500 w-full md:w-auto text-sm h-10 px-6 mr-4",
|
|
33173
|
+
collection.templates && "opacity-50 pointer-events-none cursor-not-allowed"
|
|
33174
|
+
),
|
|
33175
|
+
"aria-disabled": !!collection.templates,
|
|
33176
|
+
tabIndex: collection.templates ? -1 : 0
|
|
33135
33177
|
},
|
|
33136
33178
|
/* @__PURE__ */ React__default.createElement(FaFolder, { className: "mr-2" }),
|
|
33137
|
-
"Add Folder"
|
|
33138
|
-
|
|
33139
|
-
|
|
33179
|
+
"Add Folder"
|
|
33180
|
+
))), collection.templates && /* @__PURE__ */ React__default.createElement(
|
|
33181
|
+
TooltipContent,
|
|
33182
|
+
{
|
|
33183
|
+
side: "top",
|
|
33184
|
+
align: "center"
|
|
33185
|
+
},
|
|
33186
|
+
/* @__PURE__ */ React__default.createElement("p", null, "Folders can’t be manually added when using templates.", /* @__PURE__ */ React__default.createElement("br", null), "See the docs -", " ", /* @__PURE__ */ React__default.createElement(
|
|
33187
|
+
"a",
|
|
33188
|
+
{
|
|
33189
|
+
href: "https://tina.io/docs/reference/templates",
|
|
33190
|
+
target: "_blank",
|
|
33191
|
+
rel: "noopener noreferrer",
|
|
33192
|
+
className: "underline text-blue-500"
|
|
33193
|
+
},
|
|
33194
|
+
"https://tina.io/docs/reference/templates"
|
|
33195
|
+
))
|
|
33196
|
+
)))), !collection.templates && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
|
|
33140
33197
|
Link,
|
|
33141
33198
|
{
|
|
33142
33199
|
to: `/${folder.fullyQualifiedName ? [
|
|
@@ -33155,7 +33212,7 @@ const CollectionListPage = () => {
|
|
|
33155
33212
|
/* @__PURE__ */ React__default.createElement(FaFile, { className: "mr-2" }),
|
|
33156
33213
|
"Add Files",
|
|
33157
33214
|
" "
|
|
33158
|
-
)), collection.templates &&
|
|
33215
|
+
)), collection.templates && /* @__PURE__ */ React__default.createElement(
|
|
33159
33216
|
TemplateMenu,
|
|
33160
33217
|
{
|
|
33161
33218
|
collectionName,
|
|
@@ -34270,7 +34327,7 @@ const RenderForm = ({
|
|
|
34270
34327
|
const form = useMemo(() => {
|
|
34271
34328
|
return new Form({
|
|
34272
34329
|
// id is the full document path
|
|
34273
|
-
id: `${schemaCollection.path}/${relativePath2}
|
|
34330
|
+
id: canonicalPath(`${schemaCollection.path}/${relativePath2}`),
|
|
34274
34331
|
label: "form",
|
|
34275
34332
|
fields: formInfo.fields,
|
|
34276
34333
|
initialValues: document2._values,
|
|
@@ -34433,7 +34490,10 @@ const IndexingPage = () => {
|
|
|
34433
34490
|
const collection = tinaApi.schema.getCollectionByFullPath(fullPath);
|
|
34434
34491
|
const api = new TinaAdminApi(cms);
|
|
34435
34492
|
const params = api.schema.transformPayload(collection.name, values);
|
|
34436
|
-
const relativePath2 =
|
|
34493
|
+
const relativePath2 = pathRelativeToCollection(
|
|
34494
|
+
collection.path,
|
|
34495
|
+
fullPath
|
|
34496
|
+
);
|
|
34437
34497
|
if (await api.isAuthenticated()) {
|
|
34438
34498
|
if (kind === "delete") {
|
|
34439
34499
|
await api.deleteDocument(values);
|
|
@@ -34499,6 +34559,16 @@ const IndexingPage = () => {
|
|
|
34499
34559
|
), (state === "starting" || state === "creatingBranch") && /* @__PURE__ */ React__default.createElement("p", null, "Creating branch…"), state === "indexing" && /* @__PURE__ */ React__default.createElement("p", null, "Indexing Content…"), state === "submitting" && /* @__PURE__ */ React__default.createElement("p", null, "Saving content…"), state === "creatingPR" && /* @__PURE__ */ React__default.createElement("p", null, "Creating Pull Request…"), state === "error" && /* @__PURE__ */ React__default.createElement("p", { className: "flex items-center gap-1 text-red-700" }, /* @__PURE__ */ React__default.createElement(BiError, { className: "w-7 h-auto text-red-400 flex-shrink-0" }), " ", /* @__PURE__ */ React__default.createElement("b", null, "Error:"), " ", errorMessage, " "));
|
|
34500
34560
|
};
|
|
34501
34561
|
const Wrapper = ({ children }) => /* @__PURE__ */ React__default.createElement("div", { className: "w-full h-full flex flex-col justify-center items-center gap-4 p-6 text-xl text-gray-700" }, children);
|
|
34562
|
+
const pathRelativeToCollection = (collectionPath, fullPath) => {
|
|
34563
|
+
const cleanCollectionPath = canonicalPath(collectionPath) + "/";
|
|
34564
|
+
const cleanFullPath = canonicalPath(fullPath);
|
|
34565
|
+
if (cleanFullPath.startsWith(cleanCollectionPath)) {
|
|
34566
|
+
return cleanFullPath.substring(cleanCollectionPath.length);
|
|
34567
|
+
}
|
|
34568
|
+
throw new Error(
|
|
34569
|
+
`Path ${fullPath} not within collection path ${collectionPath}`
|
|
34570
|
+
);
|
|
34571
|
+
};
|
|
34502
34572
|
const Redirect = () => {
|
|
34503
34573
|
React__default.useEffect(() => {
|
|
34504
34574
|
if (window) {
|
|
@@ -34918,6 +34988,7 @@ export {
|
|
|
34918
34988
|
ColorField,
|
|
34919
34989
|
ColorFieldPlugin,
|
|
34920
34990
|
ColorPicker,
|
|
34991
|
+
CreateBranchModal,
|
|
34921
34992
|
CreateBranchModel,
|
|
34922
34993
|
CursorPaginator,
|
|
34923
34994
|
DEFAULT_LOCAL_TINA_GQL_SERVER_URL,
|
|
@@ -35103,4 +35174,3 @@ export {
|
|
|
35103
35174
|
wrapFieldWithNoHeader,
|
|
35104
35175
|
wrapFieldsWithMeta
|
|
35105
35176
|
};
|
|
35106
|
-
//# sourceMappingURL=index.mjs.map
|
package/dist/react.js
CHANGED
package/dist/react.mjs
CHANGED
package/dist/rich-text/index.js
CHANGED
package/dist/rich-text/index.mjs
CHANGED
package/dist/rich-text/prism.js
CHANGED
package/dist/rich-text/prism.mjs
CHANGED