tinacms 0.0.0-b67f55a-20250513032422 → 0.0.0-b782a89-20250521051922
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 +53 -14
- package/dist/index.mjs +53 -14
- 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/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.7";
|
|
10890
10890
|
const Nav = ({
|
|
10891
10891
|
isLocalMode,
|
|
10892
10892
|
className = "",
|
|
@@ -13969,11 +13969,11 @@ flowchart TD
|
|
|
13969
13969
|
}
|
|
13970
13970
|
);
|
|
13971
13971
|
Editor.displayName = "Editor";
|
|
13972
|
-
const TooltipProvider = TooltipPrimitive__namespace.Provider;
|
|
13973
|
-
const Tooltip = TooltipPrimitive__namespace.Root;
|
|
13974
|
-
const TooltipTrigger = TooltipPrimitive__namespace.Trigger;
|
|
13972
|
+
const TooltipProvider$1 = TooltipPrimitive__namespace.Provider;
|
|
13973
|
+
const Tooltip$1 = TooltipPrimitive__namespace.Root;
|
|
13974
|
+
const TooltipTrigger$1 = TooltipPrimitive__namespace.Trigger;
|
|
13975
13975
|
const TooltipPortal = TooltipPrimitive__namespace.Portal;
|
|
13976
|
-
const TooltipContent = cn$1.withCn(
|
|
13976
|
+
const TooltipContent$1 = cn$1.withCn(
|
|
13977
13977
|
cn$1.withProps(TooltipPrimitive__namespace.Content, {
|
|
13978
13978
|
sideOffset: 4
|
|
13979
13979
|
}),
|
|
@@ -13987,7 +13987,7 @@ flowchart TD
|
|
|
13987
13987
|
}, []);
|
|
13988
13988
|
const component = /* @__PURE__ */ React.createElement(Component, { ref, ...props });
|
|
13989
13989
|
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)));
|
|
13990
|
+
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
13991
|
}
|
|
13992
13992
|
return component;
|
|
13993
13993
|
});
|
|
@@ -15120,7 +15120,7 @@ flowchart TD
|
|
|
15120
15120
|
});
|
|
15121
15121
|
}
|
|
15122
15122
|
},
|
|
15123
|
-
/* @__PURE__ */ React.createElement(TooltipProvider, null, /* @__PURE__ */ React.createElement(
|
|
15123
|
+
/* @__PURE__ */ React.createElement(TooltipProvider$1, null, /* @__PURE__ */ React.createElement(
|
|
15124
15124
|
ToolbarProvider,
|
|
15125
15125
|
{
|
|
15126
15126
|
tinaForm,
|
|
@@ -32651,6 +32651,22 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
32651
32651
|
};
|
|
32652
32652
|
const PageBody = ({ children }) => /* @__PURE__ */ React.createElement("div", { className: "py-8 px-6 xl:px-12" }, children);
|
|
32653
32653
|
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));
|
|
32654
|
+
const TooltipProvider = TooltipPrimitive__namespace.Provider;
|
|
32655
|
+
const Tooltip = TooltipPrimitive__namespace.Root;
|
|
32656
|
+
const TooltipTrigger = TooltipPrimitive__namespace.Trigger;
|
|
32657
|
+
const TooltipContent = React__namespace.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ React__namespace.createElement(TooltipPrimitive__namespace.Portal, null, /* @__PURE__ */ React__namespace.createElement(
|
|
32658
|
+
TooltipPrimitive__namespace.Content,
|
|
32659
|
+
{
|
|
32660
|
+
ref,
|
|
32661
|
+
sideOffset,
|
|
32662
|
+
className: cn(
|
|
32663
|
+
"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]",
|
|
32664
|
+
className
|
|
32665
|
+
),
|
|
32666
|
+
...props
|
|
32667
|
+
}
|
|
32668
|
+
)));
|
|
32669
|
+
TooltipContent.displayName = TooltipPrimitive__namespace.Content.displayName;
|
|
32654
32670
|
const folderRegex = /^.*\/~\/*(.*)$/;
|
|
32655
32671
|
const parentFolder = (folder) => {
|
|
32656
32672
|
return {
|
|
@@ -33091,10 +33107,14 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
33091
33107
|
size: "small"
|
|
33092
33108
|
},
|
|
33093
33109
|
"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" },
|
|
33110
|
+
)))), 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
33111
|
reactRouterDom.Link,
|
|
33096
33112
|
{
|
|
33097
33113
|
onMouseDown: (evt) => {
|
|
33114
|
+
if (collection.templates) {
|
|
33115
|
+
evt.preventDefault();
|
|
33116
|
+
return;
|
|
33117
|
+
}
|
|
33098
33118
|
setVars((old) => ({
|
|
33099
33119
|
...old,
|
|
33100
33120
|
collection: collectionName,
|
|
@@ -33104,12 +33124,32 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
33104
33124
|
evt.stopPropagation();
|
|
33105
33125
|
},
|
|
33106
33126
|
to: "/collections/new-folder",
|
|
33107
|
-
className:
|
|
33127
|
+
className: cn(
|
|
33128
|
+
"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",
|
|
33129
|
+
collection.templates && "opacity-50 pointer-events-none cursor-not-allowed"
|
|
33130
|
+
),
|
|
33131
|
+
"aria-disabled": !!collection.templates,
|
|
33132
|
+
tabIndex: collection.templates ? -1 : 0
|
|
33108
33133
|
},
|
|
33109
33134
|
/* @__PURE__ */ React.createElement(FaFolder, { className: "mr-2" }),
|
|
33110
|
-
"Add Folder"
|
|
33111
|
-
|
|
33112
|
-
|
|
33135
|
+
"Add Folder"
|
|
33136
|
+
))), collection.templates && /* @__PURE__ */ React.createElement(
|
|
33137
|
+
TooltipContent,
|
|
33138
|
+
{
|
|
33139
|
+
side: "top",
|
|
33140
|
+
align: "center"
|
|
33141
|
+
},
|
|
33142
|
+
/* @__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(
|
|
33143
|
+
"a",
|
|
33144
|
+
{
|
|
33145
|
+
href: "https://tina.io/docs/reference/templates",
|
|
33146
|
+
target: "_blank",
|
|
33147
|
+
rel: "noopener noreferrer",
|
|
33148
|
+
className: "underline text-blue-500"
|
|
33149
|
+
},
|
|
33150
|
+
"https://tina.io/docs/reference/templates"
|
|
33151
|
+
))
|
|
33152
|
+
)))), !collection.templates && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
33113
33153
|
reactRouterDom.Link,
|
|
33114
33154
|
{
|
|
33115
33155
|
to: `/${folder.fullyQualifiedName ? [
|
|
@@ -33128,7 +33168,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
33128
33168
|
/* @__PURE__ */ React.createElement(FaFile, { className: "mr-2" }),
|
|
33129
33169
|
"Add Files",
|
|
33130
33170
|
" "
|
|
33131
|
-
)), collection.templates &&
|
|
33171
|
+
)), collection.templates && /* @__PURE__ */ React.createElement(
|
|
33132
33172
|
TemplateMenu,
|
|
33133
33173
|
{
|
|
33134
33174
|
collectionName,
|
|
@@ -35082,4 +35122,3 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
35082
35122
|
exports2.wrapFieldsWithMeta = wrapFieldsWithMeta;
|
|
35083
35123
|
Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
35084
35124
|
});
|
|
35085
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.mjs
CHANGED
|
@@ -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.7";
|
|
10917
10917
|
const Nav = ({
|
|
10918
10918
|
isLocalMode,
|
|
10919
10919
|
className = "",
|
|
@@ -13996,11 +13996,11 @@ const Editor = React__default.forwardRef(
|
|
|
13996
13996
|
}
|
|
13997
13997
|
);
|
|
13998
13998
|
Editor.displayName = "Editor";
|
|
13999
|
-
const TooltipProvider = TooltipPrimitive.Provider;
|
|
14000
|
-
const Tooltip = TooltipPrimitive.Root;
|
|
14001
|
-
const TooltipTrigger = TooltipPrimitive.Trigger;
|
|
13999
|
+
const TooltipProvider$1 = TooltipPrimitive.Provider;
|
|
14000
|
+
const Tooltip$1 = TooltipPrimitive.Root;
|
|
14001
|
+
const TooltipTrigger$1 = TooltipPrimitive.Trigger;
|
|
14002
14002
|
const TooltipPortal = TooltipPrimitive.Portal;
|
|
14003
|
-
const TooltipContent = withCn(
|
|
14003
|
+
const TooltipContent$1 = withCn(
|
|
14004
14004
|
withProps(TooltipPrimitive.Content, {
|
|
14005
14005
|
sideOffset: 4
|
|
14006
14006
|
}),
|
|
@@ -14014,7 +14014,7 @@ function withTooltip(Component) {
|
|
|
14014
14014
|
}, []);
|
|
14015
14015
|
const component = /* @__PURE__ */ React__default.createElement(Component, { ref, ...props });
|
|
14016
14016
|
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)));
|
|
14017
|
+
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
14018
|
}
|
|
14019
14019
|
return component;
|
|
14020
14020
|
});
|
|
@@ -15147,7 +15147,7 @@ const RichEditor = ({ input, tinaForm, field }) => {
|
|
|
15147
15147
|
});
|
|
15148
15148
|
}
|
|
15149
15149
|
},
|
|
15150
|
-
/* @__PURE__ */ React__default.createElement(TooltipProvider, null, /* @__PURE__ */ React__default.createElement(
|
|
15150
|
+
/* @__PURE__ */ React__default.createElement(TooltipProvider$1, null, /* @__PURE__ */ React__default.createElement(
|
|
15151
15151
|
ToolbarProvider,
|
|
15152
15152
|
{
|
|
15153
15153
|
tinaForm,
|
|
@@ -32678,6 +32678,22 @@ const PageHeader = ({
|
|
|
32678
32678
|
};
|
|
32679
32679
|
const PageBody = ({ children }) => /* @__PURE__ */ React__default.createElement("div", { className: "py-8 px-6 xl:px-12" }, children);
|
|
32680
32680
|
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));
|
|
32681
|
+
const TooltipProvider = TooltipPrimitive.Provider;
|
|
32682
|
+
const Tooltip = TooltipPrimitive.Root;
|
|
32683
|
+
const TooltipTrigger = TooltipPrimitive.Trigger;
|
|
32684
|
+
const TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ React.createElement(TooltipPrimitive.Portal, null, /* @__PURE__ */ React.createElement(
|
|
32685
|
+
TooltipPrimitive.Content,
|
|
32686
|
+
{
|
|
32687
|
+
ref,
|
|
32688
|
+
sideOffset,
|
|
32689
|
+
className: cn(
|
|
32690
|
+
"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]",
|
|
32691
|
+
className
|
|
32692
|
+
),
|
|
32693
|
+
...props
|
|
32694
|
+
}
|
|
32695
|
+
)));
|
|
32696
|
+
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
32681
32697
|
const folderRegex = /^.*\/~\/*(.*)$/;
|
|
32682
32698
|
const parentFolder = (folder) => {
|
|
32683
32699
|
return {
|
|
@@ -33118,10 +33134,14 @@ const CollectionListPage = () => {
|
|
|
33118
33134
|
size: "small"
|
|
33119
33135
|
},
|
|
33120
33136
|
"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" },
|
|
33137
|
+
)))), 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
33138
|
Link,
|
|
33123
33139
|
{
|
|
33124
33140
|
onMouseDown: (evt) => {
|
|
33141
|
+
if (collection.templates) {
|
|
33142
|
+
evt.preventDefault();
|
|
33143
|
+
return;
|
|
33144
|
+
}
|
|
33125
33145
|
setVars((old) => ({
|
|
33126
33146
|
...old,
|
|
33127
33147
|
collection: collectionName,
|
|
@@ -33131,12 +33151,32 @@ const CollectionListPage = () => {
|
|
|
33131
33151
|
evt.stopPropagation();
|
|
33132
33152
|
},
|
|
33133
33153
|
to: "/collections/new-folder",
|
|
33134
|
-
className:
|
|
33154
|
+
className: cn(
|
|
33155
|
+
"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",
|
|
33156
|
+
collection.templates && "opacity-50 pointer-events-none cursor-not-allowed"
|
|
33157
|
+
),
|
|
33158
|
+
"aria-disabled": !!collection.templates,
|
|
33159
|
+
tabIndex: collection.templates ? -1 : 0
|
|
33135
33160
|
},
|
|
33136
33161
|
/* @__PURE__ */ React__default.createElement(FaFolder, { className: "mr-2" }),
|
|
33137
|
-
"Add Folder"
|
|
33138
|
-
|
|
33139
|
-
|
|
33162
|
+
"Add Folder"
|
|
33163
|
+
))), collection.templates && /* @__PURE__ */ React__default.createElement(
|
|
33164
|
+
TooltipContent,
|
|
33165
|
+
{
|
|
33166
|
+
side: "top",
|
|
33167
|
+
align: "center"
|
|
33168
|
+
},
|
|
33169
|
+
/* @__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(
|
|
33170
|
+
"a",
|
|
33171
|
+
{
|
|
33172
|
+
href: "https://tina.io/docs/reference/templates",
|
|
33173
|
+
target: "_blank",
|
|
33174
|
+
rel: "noopener noreferrer",
|
|
33175
|
+
className: "underline text-blue-500"
|
|
33176
|
+
},
|
|
33177
|
+
"https://tina.io/docs/reference/templates"
|
|
33178
|
+
))
|
|
33179
|
+
)))), !collection.templates && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
|
|
33140
33180
|
Link,
|
|
33141
33181
|
{
|
|
33142
33182
|
to: `/${folder.fullyQualifiedName ? [
|
|
@@ -33155,7 +33195,7 @@ const CollectionListPage = () => {
|
|
|
33155
33195
|
/* @__PURE__ */ React__default.createElement(FaFile, { className: "mr-2" }),
|
|
33156
33196
|
"Add Files",
|
|
33157
33197
|
" "
|
|
33158
|
-
)), collection.templates &&
|
|
33198
|
+
)), collection.templates && /* @__PURE__ */ React__default.createElement(
|
|
33159
33199
|
TemplateMenu,
|
|
33160
33200
|
{
|
|
33161
33201
|
collectionName,
|
|
@@ -35103,4 +35143,3 @@ export {
|
|
|
35103
35143
|
wrapFieldWithNoHeader,
|
|
35104
35144
|
wrapFieldsWithMeta
|
|
35105
35145
|
};
|
|
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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tinacms",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-b782a89-20250521051922",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"exports": {
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"@radix-ui/react-separator": "^1.1.2",
|
|
75
75
|
"@radix-ui/react-slot": "^1.1.2",
|
|
76
76
|
"@radix-ui/react-toolbar": "^1.1.2",
|
|
77
|
-
"@radix-ui/react-tooltip": "^1.
|
|
77
|
+
"@radix-ui/react-tooltip": "^1.2.6",
|
|
78
78
|
"@react-hook/window-size": "^3.1.1",
|
|
79
79
|
"@udecode/cn": "^33.0.0",
|
|
80
80
|
"@udecode/plate": "^36.5.9",
|
|
@@ -129,9 +129,9 @@
|
|
|
129
129
|
"webfontloader": "1.6.28",
|
|
130
130
|
"yup": "^1.6.1",
|
|
131
131
|
"zod": "^3.24.2",
|
|
132
|
-
"@tinacms/
|
|
133
|
-
"@tinacms/
|
|
134
|
-
"@tinacms/search": "
|
|
132
|
+
"@tinacms/mdx": "0.0.0-b782a89-20250521051922",
|
|
133
|
+
"@tinacms/schema-tools": "0.0.0-b782a89-20250521051922",
|
|
134
|
+
"@tinacms/search": "0.0.0-b782a89-20250521051922"
|
|
135
135
|
},
|
|
136
136
|
"devDependencies": {
|
|
137
137
|
"@graphql-tools/utils": "^10.8.1",
|
|
@@ -164,7 +164,7 @@
|
|
|
164
164
|
"typescript": "^5.7.3",
|
|
165
165
|
"vite": "^5.4.14",
|
|
166
166
|
"vitest": "^2.1.9",
|
|
167
|
-
"@tinacms/scripts": "
|
|
167
|
+
"@tinacms/scripts": "0.0.0-b782a89-20250521051922"
|
|
168
168
|
},
|
|
169
169
|
"peerDependencies": {
|
|
170
170
|
"react": ">=16.14.0",
|
package/dist/client.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sources":["../src/unifiedClient/index.ts","../src/cache/node-cache.ts"],"sourcesContent":["import type { Config } from '@tinacms/schema-tools';\nimport AsyncLock from 'async-lock';\nimport type { GraphQLError } from 'graphql';\nimport type { Cache } from '../cache/index';\n\nexport const TINA_HOST = 'content.tinajs.io';\nexport interface TinaClientArgs<GenQueries = Record<string, unknown>> {\n url: string;\n token?: string;\n queries: (client: TinaClient<GenQueries>) => GenQueries;\n errorPolicy?: Config['client']['errorPolicy'];\n cacheDir?: string;\n}\nexport type TinaClientRequestArgs = {\n variables?: Record<string, any>;\n query: string;\n errorPolicy?: 'throw' | 'include';\n} & Partial<Omit<TinaClientArgs, 'queries'>>;\n\nexport type TinaClientURLParts = {\n host: string;\n clientId: string;\n branch: string;\n isLocalClient: boolean;\n};\n\n/**\n * Replaces the part of a URL after 'github/' with a specified replacement string.\n *\n * @param {string} url The original URL.\n * @param {string} replacement The string to replace the part after 'github/'.\n * @returns {string} The modified URL, or the original URL if 'github/' is not found.\n */\nfunction replaceGithubPathSplit(url: string, replacement: string) {\n const parts = url.split('github/');\n if (parts.length > 1 && replacement) {\n return parts[0] + 'github/' + replacement;\n } else {\n return url;\n }\n}\n\nexport class TinaClient<GenQueries> {\n public apiUrl: string;\n public readonlyToken?: string;\n public queries: GenQueries;\n public errorPolicy: Config['client']['errorPolicy'];\n initialized = false;\n cacheLock: AsyncLock | undefined;\n cacheDir: string;\n cache: Cache;\n\n constructor({\n token,\n url,\n queries,\n errorPolicy,\n cacheDir,\n }: TinaClientArgs<GenQueries>) {\n this.apiUrl = url;\n this.readonlyToken = token?.trim();\n this.queries = queries(this);\n this.errorPolicy = errorPolicy || 'throw';\n this.cacheDir = cacheDir || '';\n }\n\n async init() {\n if (this.initialized) {\n return;\n }\n try {\n if (\n this.cacheDir &&\n typeof window === 'undefined' &&\n typeof require !== 'undefined'\n ) {\n const { NodeCache } = await import('../cache/node-cache');\n this.cache = await NodeCache(this.cacheDir);\n this.cacheLock = new AsyncLock();\n }\n } catch (e) {\n console.error(e);\n }\n this.initialized = true;\n }\n\n public async request<DataType extends Record<string, any> = any>(\n { errorPolicy, ...args }: TinaClientRequestArgs,\n options: { fetchOptions?: Parameters<typeof fetch>[1] }\n ) {\n await this.init();\n const errorPolicyDefined = errorPolicy || this.errorPolicy;\n const headers = new Headers();\n if (this.readonlyToken) {\n headers.append('X-API-KEY', this.readonlyToken);\n }\n headers.append('Content-Type', 'application/json');\n if (options?.fetchOptions) {\n if (options?.fetchOptions?.headers) {\n Object.entries(options.fetchOptions.headers).forEach(([key, value]) => {\n headers.append(key, value);\n });\n }\n }\n const { headers: _, ...providedFetchOptions } = options?.fetchOptions || {};\n\n const bodyString = JSON.stringify({\n query: args.query,\n variables: args?.variables || {},\n });\n\n const optionsObject: Parameters<typeof fetch>[1] = {\n method: 'POST',\n headers,\n body: bodyString,\n redirect: 'follow',\n ...providedFetchOptions,\n };\n\n // Look for the header and change to use this branch instead of the build time generated branch.\n // This comes from the clients fetch options:\n //client.queries.collection({}, {\n // fetchOptions: {\n // headers: {\n // 'x-branch': cookieStore.get('x-branch')?.value,\n // },\n // },\n //})\n const draftBranch = headers.get('x-branch');\n const url = replaceGithubPathSplit(args?.url || this.apiUrl, draftBranch);\n\n let key = '';\n let result: {\n data: DataType;\n errors: GraphQLError[] | null;\n query: string;\n };\n if (this.cache) {\n key = this.cache.makeKey(bodyString);\n await this.cacheLock.acquire(key, async () => {\n result = await this.cache.get(key);\n if (!result) {\n result = await requestFromServer<DataType>(\n url,\n args.query,\n optionsObject,\n errorPolicyDefined\n );\n await this.cache.set(key, result);\n }\n });\n } else {\n result = await requestFromServer<DataType>(\n url,\n args.query,\n optionsObject,\n errorPolicyDefined\n );\n }\n\n return result;\n }\n}\n\nasync function requestFromServer<DataType extends Record<string, any> = any>(\n url: string,\n query: string,\n optionsObject: RequestInit,\n errorPolicyDefined: 'throw' | 'include'\n) {\n const res = await fetch(url, optionsObject);\n if (!res.ok) {\n let additionalInfo = '';\n if (res.status === 401) {\n additionalInfo =\n 'Please check that your client ID, URL and read only token are configured properly.';\n }\n\n throw new Error(\n `Server responded with status code ${res.status}, ${res.statusText}. ${\n additionalInfo ? additionalInfo : ''\n } Please see our FAQ for more information: https://tina.io/docs/errors/faq/`\n );\n }\n const json = await res.json();\n if (json.errors && errorPolicyDefined === 'throw') {\n throw new Error(\n `Unable to fetch, please see our FAQ for more information: https://tina.io/docs/errors/faq/\n Errors: \\n\\t${json.errors.map((error) => error.message).join('\\n')}`\n );\n }\n const result = {\n data: json?.data as DataType,\n errors: (json?.errors || null) as GraphQLError[] | null,\n query,\n };\n return result;\n}\n\nexport function createClient<GenQueries>(args: TinaClientArgs<GenQueries>) {\n const client = new TinaClient<ReturnType<typeof args.queries>>(args);\n return client;\n}\n","import type { Cache } from './index';\n\n// Create the cache directory if it doesn't exist.\n// Returns the path of the cache directory.\nexport const makeCacheDir = async (\n dir: string,\n fs: any,\n path: any,\n os: any\n) => {\n const pathParts = dir.split(path.sep).filter(Boolean);\n const cacheHash = pathParts[pathParts.length - 1];\n const rootUser = pathParts[0];\n let cacheDir = dir;\n\n // Check if the root directory exists. If not, create the cache in the tmp directory.\n if (!fs.existsSync(path.join(path.sep, rootUser))) {\n cacheDir = path.join(os.tmpdir(), cacheHash);\n }\n\n try {\n fs.mkdirSync(cacheDir, { recursive: true });\n } catch (error) {\n throw new Error(`Failed to create cache directory: ${error.message}`);\n }\n\n return cacheDir;\n};\n\nexport const NodeCache = async (dir: string): Promise<Cache> => {\n // TODO: These will need to be changed from using require to import when we eventually move to ESM\n const fs = require('node:fs');\n const path = require('node:path');\n const os = require('node:os');\n\n const { createHash } = require('node:crypto');\n const cacheDir = await makeCacheDir(dir, fs, path, os);\n\n return {\n makeKey: (key: any) => {\n const input =\n key && key instanceof Object ? JSON.stringify(key) : key || '';\n return createHash('sha256').update(input).digest('hex');\n },\n get: async (key: string) => {\n let readValue: object | undefined;\n\n const cacheFilename = `${cacheDir}/${key}`;\n try {\n const data = await fs.promises.readFile(cacheFilename, 'utf-8');\n readValue = JSON.parse(data);\n } catch (e) {\n if (e.code !== 'ENOENT') {\n console.error(\n `Failed to read cache file to ${cacheFilename}: ${e.message}`\n );\n }\n }\n\n return readValue;\n },\n set: async (key: string, value: any) => {\n const cacheFilename = `${cacheDir}/${key}`;\n try {\n await fs.promises.writeFile(cacheFilename, JSON.stringify(value), {\n encoding: 'utf-8',\n flag: 'wx', // Don't overwrite existing caches\n });\n } catch (e) {\n if (e.code !== 'EEXIST') {\n console.error(\n `Failed to write cache file to ${cacheFilename}: ${e.message}`\n );\n }\n }\n },\n };\n};\n"],"names":["NodeCache","key"],"mappings":";;;;AAKa,QAAA,YAAY;AA4BzB,WAAS,uBAAuB,KAAa,aAAqB;AAC1D,UAAA,QAAQ,IAAI,MAAM,SAAS;AAC7B,QAAA,MAAM,SAAS,KAAK,aAAa;AAC5B,aAAA,MAAM,CAAC,IAAI,YAAY;AAAA,IAAA,OACzB;AACE,aAAA;AAAA,IACT;AAAA,EACF;AAAA,EAEO,MAAM,WAAuB;AAAA,IAUlC,YAAY;AAAA,MACV;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA,GAC6B;AAXjB,WAAA,cAAA;AAYZ,WAAK,SAAS;AACT,WAAA,gBAAgB,+BAAO;AACvB,WAAA,UAAU,QAAQ,IAAI;AAC3B,WAAK,cAAc,eAAe;AAClC,WAAK,WAAW,YAAY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AAM,gBAAgB,GAAG,QAAQ,IAAI,GAAG;AACpC,YAAA;AACF,gBAAM,GAAG,SAAS,UAAU,eAAe,KAAK,UAAU,KAAK,GAAG;AAAA,YAChE,UAAU;AAAA,YACV,MAAM;AAAA;AAAA,UAAA,CACP;AAAA,iBACM,GAAG;AACN,cAAA,EAAE,SAAS,UAAU;AACf,oBAAA;AAAA,cACN,iCAAiC,aAAa,KAAK,EAAE,OAAO;AAAA,YAAA;AAAA,UAEhE;AAAA,QACF;AAAA,MACF;AAAA,IAAA;AAAA,EAEJ;;;;;;;;;;;"}
|
package/dist/client.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.mjs","sources":["../src/unifiedClient/index.ts"],"sourcesContent":["import type { Config } from '@tinacms/schema-tools';\nimport AsyncLock from 'async-lock';\nimport type { GraphQLError } from 'graphql';\nimport type { Cache } from '../cache/index';\n\nexport const TINA_HOST = 'content.tinajs.io';\nexport interface TinaClientArgs<GenQueries = Record<string, unknown>> {\n url: string;\n token?: string;\n queries: (client: TinaClient<GenQueries>) => GenQueries;\n errorPolicy?: Config['client']['errorPolicy'];\n cacheDir?: string;\n}\nexport type TinaClientRequestArgs = {\n variables?: Record<string, any>;\n query: string;\n errorPolicy?: 'throw' | 'include';\n} & Partial<Omit<TinaClientArgs, 'queries'>>;\n\nexport type TinaClientURLParts = {\n host: string;\n clientId: string;\n branch: string;\n isLocalClient: boolean;\n};\n\n/**\n * Replaces the part of a URL after 'github/' with a specified replacement string.\n *\n * @param {string} url The original URL.\n * @param {string} replacement The string to replace the part after 'github/'.\n * @returns {string} The modified URL, or the original URL if 'github/' is not found.\n */\nfunction replaceGithubPathSplit(url: string, replacement: string) {\n const parts = url.split('github/');\n if (parts.length > 1 && replacement) {\n return parts[0] + 'github/' + replacement;\n } else {\n return url;\n }\n}\n\nexport class TinaClient<GenQueries> {\n public apiUrl: string;\n public readonlyToken?: string;\n public queries: GenQueries;\n public errorPolicy: Config['client']['errorPolicy'];\n initialized = false;\n cacheLock: AsyncLock | undefined;\n cacheDir: string;\n cache: Cache;\n\n constructor({\n token,\n url,\n queries,\n errorPolicy,\n cacheDir,\n }: TinaClientArgs<GenQueries>) {\n this.apiUrl = url;\n this.readonlyToken = token?.trim();\n this.queries = queries(this);\n this.errorPolicy = errorPolicy || 'throw';\n this.cacheDir = cacheDir || '';\n }\n\n async init() {\n if (this.initialized) {\n return;\n }\n try {\n if (\n this.cacheDir &&\n typeof window === 'undefined' &&\n typeof require !== 'undefined'\n ) {\n const { NodeCache } = await import('../cache/node-cache');\n this.cache = await NodeCache(this.cacheDir);\n this.cacheLock = new AsyncLock();\n }\n } catch (e) {\n console.error(e);\n }\n this.initialized = true;\n }\n\n public async request<DataType extends Record<string, any> = any>(\n { errorPolicy, ...args }: TinaClientRequestArgs,\n options: { fetchOptions?: Parameters<typeof fetch>[1] }\n ) {\n await this.init();\n const errorPolicyDefined = errorPolicy || this.errorPolicy;\n const headers = new Headers();\n if (this.readonlyToken) {\n headers.append('X-API-KEY', this.readonlyToken);\n }\n headers.append('Content-Type', 'application/json');\n if (options?.fetchOptions) {\n if (options?.fetchOptions?.headers) {\n Object.entries(options.fetchOptions.headers).forEach(([key, value]) => {\n headers.append(key, value);\n });\n }\n }\n const { headers: _, ...providedFetchOptions } = options?.fetchOptions || {};\n\n const bodyString = JSON.stringify({\n query: args.query,\n variables: args?.variables || {},\n });\n\n const optionsObject: Parameters<typeof fetch>[1] = {\n method: 'POST',\n headers,\n body: bodyString,\n redirect: 'follow',\n ...providedFetchOptions,\n };\n\n // Look for the header and change to use this branch instead of the build time generated branch.\n // This comes from the clients fetch options:\n //client.queries.collection({}, {\n // fetchOptions: {\n // headers: {\n // 'x-branch': cookieStore.get('x-branch')?.value,\n // },\n // },\n //})\n const draftBranch = headers.get('x-branch');\n const url = replaceGithubPathSplit(args?.url || this.apiUrl, draftBranch);\n\n let key = '';\n let result: {\n data: DataType;\n errors: GraphQLError[] | null;\n query: string;\n };\n if (this.cache) {\n key = this.cache.makeKey(bodyString);\n await this.cacheLock.acquire(key, async () => {\n result = await this.cache.get(key);\n if (!result) {\n result = await requestFromServer<DataType>(\n url,\n args.query,\n optionsObject,\n errorPolicyDefined\n );\n await this.cache.set(key, result);\n }\n });\n } else {\n result = await requestFromServer<DataType>(\n url,\n args.query,\n optionsObject,\n errorPolicyDefined\n );\n }\n\n return result;\n }\n}\n\nasync function requestFromServer<DataType extends Record<string, any> = any>(\n url: string,\n query: string,\n optionsObject: RequestInit,\n errorPolicyDefined: 'throw' | 'include'\n) {\n const res = await fetch(url, optionsObject);\n if (!res.ok) {\n let additionalInfo = '';\n if (res.status === 401) {\n additionalInfo =\n 'Please check that your client ID, URL and read only token are configured properly.';\n }\n\n throw new Error(\n `Server responded with status code ${res.status}, ${res.statusText}. ${\n additionalInfo ? additionalInfo : ''\n } Please see our FAQ for more information: https://tina.io/docs/errors/faq/`\n );\n }\n const json = await res.json();\n if (json.errors && errorPolicyDefined === 'throw') {\n throw new Error(\n `Unable to fetch, please see our FAQ for more information: https://tina.io/docs/errors/faq/\n Errors: \\n\\t${json.errors.map((error) => error.message).join('\\n')}`\n );\n }\n const result = {\n data: json?.data as DataType,\n errors: (json?.errors || null) as GraphQLError[] | null,\n query,\n };\n return result;\n}\n\nexport function createClient<GenQueries>(args: TinaClientArgs<GenQueries>) {\n const client = new TinaClient<ReturnType<typeof args.queries>>(args);\n return client;\n}\n"],"names":["key"],"mappings":";AAKO,MAAM,YAAY;AA4BzB,SAAS,uBAAuB,KAAa,aAAqB;AAC1D,QAAA,QAAQ,IAAI,MAAM,SAAS;AAC7B,MAAA,MAAM,SAAS,KAAK,aAAa;AAC5B,WAAA,MAAM,CAAC,IAAI,YAAY;AAAA,EAAA,OACzB;AACE,WAAA;AAAA,EACT;AACF;AAEO,MAAM,WAAuB;AAAA,EAUlC,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,GAC6B;AAXjB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