next-tinacms-dos 1.2.0 → 1.3.1
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/handlers.js +53 -33
- package/dist/index.es.js +418 -120
- package/dist/index.js +418 -120
- package/package.json +5 -4
package/dist/index.js
CHANGED
|
@@ -52679,11 +52679,13 @@
|
|
|
52679
52679
|
const ERROR_MISSING_CMS = `useCMS could not find an instance of CMS`;
|
|
52680
52680
|
const CMSContext = react.exports.createContext(null);
|
|
52681
52681
|
function useCMS$1() {
|
|
52682
|
-
const cms = react.exports.useContext(CMSContext);
|
|
52682
|
+
const { cms, dispatch, state } = react.exports.useContext(CMSContext);
|
|
52683
52683
|
if (!cms) {
|
|
52684
52684
|
throw new Error(ERROR_MISSING_CMS);
|
|
52685
52685
|
}
|
|
52686
52686
|
const [, setEnabled] = react.exports.useState(cms.enabled);
|
|
52687
|
+
cms.dispatch = dispatch;
|
|
52688
|
+
cms.state = state;
|
|
52687
52689
|
react.exports.useEffect(() => {
|
|
52688
52690
|
return cms.events.subscribe("cms", () => {
|
|
52689
52691
|
setEnabled(cms.enabled);
|
|
@@ -52743,7 +52745,8 @@
|
|
|
52743
52745
|
const roundedClasses = {
|
|
52744
52746
|
full: `rounded-full`,
|
|
52745
52747
|
left: `rounded-l-full`,
|
|
52746
|
-
right: `rounded-r-full
|
|
52748
|
+
right: `rounded-r-full`,
|
|
52749
|
+
custom: ""
|
|
52747
52750
|
};
|
|
52748
52751
|
const sizeClasses = {
|
|
52749
52752
|
small: `text-xs h-8 px-3`,
|
|
@@ -52892,12 +52895,24 @@
|
|
|
52892
52895
|
return elem(conf);
|
|
52893
52896
|
}) : elem(DefaultContext);
|
|
52894
52897
|
}
|
|
52898
|
+
function IoMdRefresh(props) {
|
|
52899
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M256 388c-72.597 0-132-59.405-132-132 0-72.601 59.403-132 132-132 36.3 0 69.299 15.4 92.406 39.601L278 234h154V80l-51.698 51.702C348.406 99.798 304.406 80 256 80c-96.797 0-176 79.203-176 176s78.094 176 176 176c81.045 0 148.287-54.134 169.401-128H378.85c-18.745 49.561-67.138 84-122.85 84z" } }] })(props);
|
|
52900
|
+
}
|
|
52901
|
+
function IoMdSync(props) {
|
|
52902
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M256 93.09V32l-80 81.454 80 81.456v-61.093c65.996 0 120 54.982 120 122.183 0 20.363-5 39.714-14.004 57.016L391 342.547c15.996-25.457 25-54.988 25-86.547 0-89.599-72.002-162.91-160-162.91zm0 285.094c-66.001 0-120-54.988-120-122.184 0-20.363 5-39.709 13.999-57.02L121 169.454C104.999 193.89 96 224.436 96 256c0 89.599 72.002 162.91 160 162.91V480l80-81.453-80-81.457v61.094z" } }] })(props);
|
|
52903
|
+
}
|
|
52895
52904
|
function BiArrowToBottom(props) {
|
|
52896
52905
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M6 18h12v2H6zm5-14v8.586L6.707 8.293 5.293 9.707 12 16.414l6.707-6.707-1.414-1.414L13 12.586V4z" } }] })(props);
|
|
52897
52906
|
}
|
|
52898
52907
|
function BiCloudUpload(props) {
|
|
52899
52908
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M13 19v-4h3l-4-5-4 5h3v4z" } }, { "tag": "path", "attr": { "d": "M7 19h2v-2H7c-1.654 0-3-1.346-3-3 0-1.404 1.199-2.756 2.673-3.015l.581-.102.192-.558C8.149 8.274 9.895 7 12 7c2.757 0 5 2.243 5 5v1h1c1.103 0 2 .897 2 2s-.897 2-2 2h-3v2h3c2.206 0 4-1.794 4-4a4.01 4.01 0 0 0-3.056-3.888C18.507 7.67 15.56 5 12 5 9.244 5 6.85 6.611 5.757 9.15 3.609 9.792 2 11.82 2 14c0 2.757 2.243 5 5 5z" } }] })(props);
|
|
52900
52909
|
}
|
|
52910
|
+
function BiCopyAlt(props) {
|
|
52911
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M20 2H10c-1.103 0-2 .897-2 2v4H4c-1.103 0-2 .897-2 2v10c0 1.103.897 2 2 2h10c1.103 0 2-.897 2-2v-4h4c1.103 0 2-.897 2-2V4c0-1.103-.897-2-2-2zM4 20V10h10l.002 10H4zm16-6h-4v-4c0-1.103-.897-2-2-2h-4V4h10v10z" } }, { "tag": "path", "attr": { "d": "M6 12h6v2H6zm0 4h6v2H6z" } }] })(props);
|
|
52912
|
+
}
|
|
52913
|
+
function BiFileBlank(props) {
|
|
52914
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M19.937 8.68c-.011-.032-.02-.063-.033-.094a.997.997 0 0 0-.196-.293l-6-6a.997.997 0 0 0-.293-.196c-.03-.014-.062-.022-.094-.033a.991.991 0 0 0-.259-.051C13.04 2.011 13.021 2 13 2H6c-1.103 0-2 .897-2 2v16c0 1.103.897 2 2 2h12c1.103 0 2-.897 2-2V9c0-.021-.011-.04-.013-.062a.99.99 0 0 0-.05-.258zM16.586 8H14V5.414L16.586 8zM6 20V4h6v5a1 1 0 0 0 1 1h5l.002 10H6z" } }] })(props);
|
|
52915
|
+
}
|
|
52901
52916
|
function BiFile(props) {
|
|
52902
52917
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M19.903 8.586a.997.997 0 0 0-.196-.293l-6-6a.997.997 0 0 0-.293-.196c-.03-.014-.062-.022-.094-.033a.991.991 0 0 0-.259-.051C13.04 2.011 13.021 2 13 2H6c-1.103 0-2 .897-2 2v16c0 1.103.897 2 2 2h12c1.103 0 2-.897 2-2V9c0-.021-.011-.04-.013-.062a.952.952 0 0 0-.051-.259c-.01-.032-.019-.063-.033-.093zM16.586 8H14V5.414L16.586 8zM6 20V4h6v5a1 1 0 0 0 1 1h5l.002 10H6z" } }, { "tag": "path", "attr": { "d": "M8 12h8v2H8zm0 4h8v2H8zm0-8h2v2H8z" } }] })(props);
|
|
52903
52918
|
}
|
|
@@ -52916,8 +52931,8 @@
|
|
|
52916
52931
|
function BiRightArrowAlt(props) {
|
|
52917
52932
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "m11.293 17.293 1.414 1.414L19.414 12l-6.707-6.707-1.414 1.414L15.586 11H6v2h9.586z" } }] })(props);
|
|
52918
52933
|
}
|
|
52919
|
-
function
|
|
52920
|
-
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0
|
|
52934
|
+
function BiX(props) {
|
|
52935
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "m16.192 6.344-4.243 4.242-4.242-4.242-1.414 1.414L10.535 12l-4.242 4.242 1.414 1.414 4.242-4.242 4.243 4.242 1.414-1.414L13.364 12l4.242-4.242z" } }] })(props);
|
|
52921
52936
|
}
|
|
52922
52937
|
React__default.createContext({
|
|
52923
52938
|
rawMode: false,
|
|
@@ -52943,9 +52958,33 @@
|
|
|
52943
52958
|
isVoid: true,
|
|
52944
52959
|
isInline: true
|
|
52945
52960
|
});
|
|
52961
|
+
const textFieldClasses = "shadow-inner focus:shadow-outline focus:border-blue-500 focus:outline-none block text-base placeholder:text-gray-300 px-3 py-2 text-gray-600 w-full bg-white border border-gray-200 transition-all ease-out duration-150 focus:text-gray-900 rounded-md";
|
|
52962
|
+
const disabledClasses = "opacity-50 pointer-events-none cursor-not-allowed";
|
|
52963
|
+
react.exports.forwardRef(({ className, disabled, ...rest }, ref) => {
|
|
52964
|
+
return /* @__PURE__ */ react.exports.createElement("input", {
|
|
52965
|
+
ref,
|
|
52966
|
+
type: "text",
|
|
52967
|
+
className: `${textFieldClasses} ${disabled ? disabledClasses : ""} ${className}`,
|
|
52968
|
+
...rest
|
|
52969
|
+
});
|
|
52970
|
+
});
|
|
52971
|
+
react.exports.forwardRef(({ ...props }, ref) => {
|
|
52972
|
+
return /* @__PURE__ */ react.exports.createElement("textarea", {
|
|
52973
|
+
...props,
|
|
52974
|
+
className: "shadow-inner text-base px-3 py-2 text-gray-600 resize-y focus:shadow-outline focus:border-blue-500 block w-full border border-gray-200 focus:text-gray-900 rounded-md",
|
|
52975
|
+
ref,
|
|
52976
|
+
style: { minHeight: "160px" }
|
|
52977
|
+
});
|
|
52978
|
+
});
|
|
52946
52979
|
function MdOutlinePhotoLibrary(props) {
|
|
52947
52980
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0V0z" } }, { "tag": "path", "attr": { "d": "M20 4v12H8V4h12m0-2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8.5 9.67l1.69 2.26 2.48-3.1L19 15H9zM2 6v14c0 1.1.9 2 2 2h14v-2H4V6H2z" } }] })(props);
|
|
52948
52981
|
}
|
|
52982
|
+
const Input = ({ ...props }) => {
|
|
52983
|
+
return /* @__PURE__ */ react.exports.createElement("input", {
|
|
52984
|
+
className: textFieldClasses,
|
|
52985
|
+
...props
|
|
52986
|
+
});
|
|
52987
|
+
};
|
|
52949
52988
|
function useCMS() {
|
|
52950
52989
|
return useCMS$1();
|
|
52951
52990
|
}
|
|
@@ -52966,8 +53005,79 @@
|
|
|
52966
53005
|
return Object.assign({}, ...(str || DEFAULT_MEDIA_UPLOAD_TYPES).split(",").map((x2) => ({ [x2]: [] })));
|
|
52967
53006
|
};
|
|
52968
53007
|
const isImage = (filename) => {
|
|
52969
|
-
return /\.(gif|jpg|jpeg|tiff|png|svg|webp)
|
|
53008
|
+
return /\.(gif|jpg|jpeg|tiff|png|svg|webp|avif)(\?.*)?$/i.test(filename);
|
|
52970
53009
|
};
|
|
53010
|
+
const absoluteImgURL = (str) => {
|
|
53011
|
+
if (str.startsWith("http"))
|
|
53012
|
+
return str;
|
|
53013
|
+
return `${window.location.origin}${str}`;
|
|
53014
|
+
};
|
|
53015
|
+
const StyledImage = ({ src }) => {
|
|
53016
|
+
const isSvg = /\.svg$/.test(src);
|
|
53017
|
+
return /* @__PURE__ */ react.exports.createElement("img", {
|
|
53018
|
+
src,
|
|
53019
|
+
className: `"block max-w-full rounded shadow overflow-hidden max-h-48 h-auto object-contain transition-opacity duration-100 ease-out m-0 bg-gray-200 bg-auto bg-center bg-no-repeat ${isSvg ? "min-w-[12rem]" : ""}`
|
|
53020
|
+
});
|
|
53021
|
+
};
|
|
53022
|
+
const StyledFile = ({ src }) => {
|
|
53023
|
+
return /* @__PURE__ */ react.exports.createElement("div", {
|
|
53024
|
+
className: "max-w-full w-full overflow-hidden flex-1 flex justify-start items-center gap-3"
|
|
53025
|
+
}, /* @__PURE__ */ react.exports.createElement("div", {
|
|
53026
|
+
className: "w-14 h-14 bg-gray-50 shadow border border-gray-100 rounded flex justify-center flex-none"
|
|
53027
|
+
}, /* @__PURE__ */ react.exports.createElement(BiFileBlank, {
|
|
53028
|
+
className: "w-3/5 h-full fill-gray-300"
|
|
53029
|
+
})), /* @__PURE__ */ react.exports.createElement("span", {
|
|
53030
|
+
className: "text-base text-left flex-1 text-gray-500 w-full break-words truncate"
|
|
53031
|
+
}, src));
|
|
53032
|
+
};
|
|
53033
|
+
react.exports.forwardRef(({ onDrop, onClear, onClick, value, src, loading }, ref) => {
|
|
53034
|
+
const cms = useCMS();
|
|
53035
|
+
const { getRootProps, getInputProps } = useDropzone({
|
|
53036
|
+
accept: dropzoneAcceptFromString(cms.media.accept || DEFAULT_MEDIA_UPLOAD_TYPES),
|
|
53037
|
+
onDrop,
|
|
53038
|
+
noClick: !!onClick
|
|
53039
|
+
});
|
|
53040
|
+
return /* @__PURE__ */ react.exports.createElement("div", {
|
|
53041
|
+
className: "w-full max-w-full",
|
|
53042
|
+
...getRootProps()
|
|
53043
|
+
}, /* @__PURE__ */ react.exports.createElement("input", {
|
|
53044
|
+
...getInputProps()
|
|
53045
|
+
}), value ? loading ? /* @__PURE__ */ react.exports.createElement(ImageLoadingIndicator, null) : /* @__PURE__ */ react.exports.createElement("div", {
|
|
53046
|
+
className: `relative w-full max-w-full flex justify-start gap-3 ${isImage(src) ? `items-start` : `items-center`}`
|
|
53047
|
+
}, /* @__PURE__ */ react.exports.createElement("button", {
|
|
53048
|
+
className: "shadow-inner focus-within:shadow-outline focus-within:border-blue-500 outline-none overflow-visible cursor-pointer border-none hover:opacity-60 transition ease-out duration-100",
|
|
53049
|
+
onClick,
|
|
53050
|
+
ref
|
|
53051
|
+
}, isImage(src) ? /* @__PURE__ */ react.exports.createElement(StyledImage, {
|
|
53052
|
+
src
|
|
53053
|
+
}) : /* @__PURE__ */ react.exports.createElement(StyledFile, {
|
|
53054
|
+
src
|
|
53055
|
+
})), onClear && /* @__PURE__ */ react.exports.createElement(DeleteImageButton, {
|
|
53056
|
+
onClick: (e2) => {
|
|
53057
|
+
e2.stopPropagation();
|
|
53058
|
+
onClear();
|
|
53059
|
+
}
|
|
53060
|
+
})) : /* @__PURE__ */ react.exports.createElement("button", {
|
|
53061
|
+
className: "outline-none relative hover:opacity-60 w-full",
|
|
53062
|
+
onClick
|
|
53063
|
+
}, loading ? /* @__PURE__ */ react.exports.createElement(ImageLoadingIndicator, null) : /* @__PURE__ */ react.exports.createElement("div", {
|
|
53064
|
+
className: "text-center rounded-[5px] bg-gray-100 text-gray-300 leading-[1.35] py-3 text-[15px] font-normal transition-all ease-out duration-100 hover:opacity-60"
|
|
53065
|
+
}, "Drag 'n' drop a file here,", /* @__PURE__ */ react.exports.createElement("br", null), "or click to select a file")));
|
|
53066
|
+
});
|
|
53067
|
+
const DeleteImageButton = ({
|
|
53068
|
+
onClick
|
|
53069
|
+
}) => {
|
|
53070
|
+
return /* @__PURE__ */ react.exports.createElement(IconButton, {
|
|
53071
|
+
variant: "white",
|
|
53072
|
+
className: "flex-none",
|
|
53073
|
+
onClick
|
|
53074
|
+
}, /* @__PURE__ */ react.exports.createElement(TrashIcon, {
|
|
53075
|
+
className: "w-7 h-auto"
|
|
53076
|
+
}));
|
|
53077
|
+
};
|
|
53078
|
+
const ImageLoadingIndicator = () => /* @__PURE__ */ react.exports.createElement("div", {
|
|
53079
|
+
className: "p-4 w-full min-h-[96px] flex flex-col justify-center items-center"
|
|
53080
|
+
}, /* @__PURE__ */ react.exports.createElement(LoadingDots, null));
|
|
52971
53081
|
const onKeyDownSoftBreak = (editor, { options: { rules = [] } }) => (event) => {
|
|
52972
53082
|
const entry = getBlockAbove(editor);
|
|
52973
53083
|
if (!entry)
|
|
@@ -54347,12 +54457,6 @@
|
|
|
54347
54457
|
}
|
|
54348
54458
|
}
|
|
54349
54459
|
const ClickableWrapper = onClickOutsideHOC(ClickOutBase);
|
|
54350
|
-
react.exports.createContext({
|
|
54351
|
-
currentBranch: null,
|
|
54352
|
-
setCurrentBranch: (branch) => {
|
|
54353
|
-
console.warn("BranchContext not initialized");
|
|
54354
|
-
}
|
|
54355
|
-
});
|
|
54356
54460
|
function CursorPaginator({
|
|
54357
54461
|
navigateNext,
|
|
54358
54462
|
navigatePrev,
|
|
@@ -54376,50 +54480,41 @@
|
|
|
54376
54480
|
className: "w-6 h-full ml-2 opacity-70"
|
|
54377
54481
|
})));
|
|
54378
54482
|
}
|
|
54379
|
-
function ListMediaItem({
|
|
54380
|
-
item,
|
|
54381
|
-
onClick,
|
|
54382
|
-
onSelect,
|
|
54383
|
-
onDelete
|
|
54384
|
-
}) {
|
|
54483
|
+
function ListMediaItem({ item, onClick, active: active2 }) {
|
|
54385
54484
|
const FileIcon = item.type === "dir" ? BiFolder : BiFile;
|
|
54485
|
+
const thumbnail = (item.thumbnails || {})["75x75"];
|
|
54386
54486
|
return /* @__PURE__ */ React__default.createElement("li", {
|
|
54387
|
-
className:
|
|
54388
|
-
onClick: () =>
|
|
54389
|
-
|
|
54487
|
+
className: `relative flex shrink-0 gap-3 items-center py-2 pl-2 pr-3 transition duration-150 ease-out cursor-pointer border-b border-gray-150 ${active2 ? "bg-gradient-to-r from-white to-gray-50/50 text-blue-500 hover:bg-gray-50" : "bg-white hover:bg-gray-50/50"}`,
|
|
54488
|
+
onClick: () => {
|
|
54489
|
+
if (!active2) {
|
|
54490
|
+
onClick(item);
|
|
54491
|
+
} else {
|
|
54492
|
+
onClick(false);
|
|
54493
|
+
}
|
|
54494
|
+
}
|
|
54495
|
+
}, item.new && /* @__PURE__ */ React__default.createElement("span", {
|
|
54496
|
+
className: "absolute top-1.5 left-1.5 rounded-full shadow bg-green-100 border border-green-200 text-[10px] tracking-wide font-bold text-green-600 px-1.5 py-0.5 z-10"
|
|
54497
|
+
}, "NEW"), /* @__PURE__ */ React__default.createElement("div", {
|
|
54390
54498
|
className: "w-20 h-20 bg-gray-50 shadow border border-gray-100 rounded overflow-hidden flex justify-center flex-shrink-0"
|
|
54391
|
-
}, isImage(
|
|
54499
|
+
}, isImage(thumbnail) ? /* @__PURE__ */ React__default.createElement("img", {
|
|
54392
54500
|
className: "object-cover w-full h-full object-center",
|
|
54393
|
-
src:
|
|
54501
|
+
src: thumbnail,
|
|
54394
54502
|
alt: item.filename
|
|
54395
54503
|
}) : /* @__PURE__ */ React__default.createElement(FileIcon, {
|
|
54396
54504
|
className: "w-3/5 h-full fill-gray-300"
|
|
54397
|
-
})), /* @__PURE__ */ React__default.createElement(
|
|
54398
|
-
className: "
|
|
54399
|
-
},
|
|
54400
|
-
size: "medium",
|
|
54401
|
-
variant: "white",
|
|
54402
|
-
onClick: () => onSelect(item)
|
|
54403
|
-
}, "Insert", " ", /* @__PURE__ */ React__default.createElement(BiArrowToBottom, {
|
|
54404
|
-
className: "ml-1 -mr-0.5 w-6 h-auto text-blue-500 opacity-70"
|
|
54405
|
-
})), onDelete && item.type === "file" && /* @__PURE__ */ React__default.createElement(IconButton, {
|
|
54406
|
-
variant: "ghost",
|
|
54407
|
-
size: "medium",
|
|
54408
|
-
onClick: () => onDelete(item)
|
|
54409
|
-
}, /* @__PURE__ */ React__default.createElement(TrashIcon, {
|
|
54410
|
-
className: "w-6 h-auto"
|
|
54411
|
-
}))));
|
|
54505
|
+
})), /* @__PURE__ */ React__default.createElement("span", {
|
|
54506
|
+
className: "text-base flex-grow w-full break-words truncate"
|
|
54507
|
+
}, item.filename));
|
|
54412
54508
|
}
|
|
54413
|
-
const Filename = ({ className = "", ...props }) => /* @__PURE__ */ React__default.createElement("span", {
|
|
54414
|
-
className: "text-base flex-grow w-full break-words truncate " + className,
|
|
54415
|
-
...props
|
|
54416
|
-
});
|
|
54417
54509
|
function GridMediaItem({ item, active: active2, onClick }) {
|
|
54418
54510
|
const FileIcon = item.type === "dir" ? BiFolder : BiFile;
|
|
54511
|
+
const thumbnail = (item.thumbnails || {})["400x400"];
|
|
54419
54512
|
return /* @__PURE__ */ React__default.createElement("li", {
|
|
54420
|
-
className: `relative pb-[100%] h-0 block
|
|
54421
|
-
}, /* @__PURE__ */ React__default.createElement("
|
|
54422
|
-
className: "absolute
|
|
54513
|
+
className: `relative pb-[100%] h-0 block border border-gray-100 rounded-md overflow-hidden flex justify-center shrink-0 w-full transition duration-150 ease-out ${active2 ? "shadow-outline" : "shadow hover:shadow-md hover:scale-103 hover:border-gray-150"} ${item.type === "dir" ? "cursor-pointer" : ""}`
|
|
54514
|
+
}, item.new && /* @__PURE__ */ React__default.createElement("span", {
|
|
54515
|
+
className: "absolute top-1.5 left-1.5 rounded-full shadow bg-green-100 border border-green-200 text-[10px] tracking-wide font-bold text-green-600 px-1.5 py-0.5 z-10"
|
|
54516
|
+
}, "NEW"), /* @__PURE__ */ React__default.createElement("button", {
|
|
54517
|
+
className: "absolute w-full h-full flex items-center justify-center bg-white",
|
|
54423
54518
|
onClick: () => {
|
|
54424
54519
|
if (!active2) {
|
|
54425
54520
|
onClick(item);
|
|
@@ -54427,9 +54522,9 @@
|
|
|
54427
54522
|
onClick(false);
|
|
54428
54523
|
}
|
|
54429
54524
|
}
|
|
54430
|
-
}, isImage(
|
|
54525
|
+
}, isImage(thumbnail) ? /* @__PURE__ */ React__default.createElement("img", {
|
|
54431
54526
|
className: "object-cover w-full h-full object-center",
|
|
54432
|
-
src:
|
|
54527
|
+
src: thumbnail,
|
|
54433
54528
|
alt: item.filename
|
|
54434
54529
|
}) : /* @__PURE__ */ React__default.createElement("div", {
|
|
54435
54530
|
className: "p-4 w-full flex flex-col gap-4 items-center justify-center"
|
|
@@ -54476,6 +54571,106 @@
|
|
|
54476
54571
|
}, part);
|
|
54477
54572
|
}));
|
|
54478
54573
|
}
|
|
54574
|
+
const DeleteModal = ({
|
|
54575
|
+
close,
|
|
54576
|
+
deleteFunc,
|
|
54577
|
+
filename
|
|
54578
|
+
}) => {
|
|
54579
|
+
return /* @__PURE__ */ React__default.createElement(Modal, null, /* @__PURE__ */ React__default.createElement(PopupModal, null, /* @__PURE__ */ React__default.createElement(ModalHeader, {
|
|
54580
|
+
close
|
|
54581
|
+
}, "Delete ", filename), /* @__PURE__ */ React__default.createElement(ModalBody, {
|
|
54582
|
+
padded: true
|
|
54583
|
+
}, /* @__PURE__ */ React__default.createElement("p", null, "Are you sure you want to delete ", /* @__PURE__ */ React__default.createElement("strong", null, filename), "?")), /* @__PURE__ */ React__default.createElement(ModalActions, null, /* @__PURE__ */ React__default.createElement(Button, {
|
|
54584
|
+
style: { flexGrow: 2 },
|
|
54585
|
+
onClick: close
|
|
54586
|
+
}, "Cancel"), /* @__PURE__ */ React__default.createElement(Button, {
|
|
54587
|
+
style: { flexGrow: 3 },
|
|
54588
|
+
variant: "danger",
|
|
54589
|
+
onClick: () => {
|
|
54590
|
+
deleteFunc();
|
|
54591
|
+
close();
|
|
54592
|
+
}
|
|
54593
|
+
}, "Delete"))));
|
|
54594
|
+
};
|
|
54595
|
+
const NewFolderModal = ({ onSubmit, close }) => {
|
|
54596
|
+
const [folderName, setFolderName] = React__default.useState("");
|
|
54597
|
+
return /* @__PURE__ */ React__default.createElement(Modal, null, /* @__PURE__ */ React__default.createElement(PopupModal, null, /* @__PURE__ */ React__default.createElement(ModalHeader, {
|
|
54598
|
+
close
|
|
54599
|
+
}, "New Folder"), /* @__PURE__ */ React__default.createElement(ModalBody, {
|
|
54600
|
+
padded: true
|
|
54601
|
+
}, /* @__PURE__ */ React__default.createElement("p", {
|
|
54602
|
+
className: "text-base text-gray-700 mb-2"
|
|
54603
|
+
}, "Please provide a name for your folder."), /* @__PURE__ */ React__default.createElement("p", {
|
|
54604
|
+
className: "text-sm text-gray-500 mb-4 italic"
|
|
54605
|
+
}, /* @__PURE__ */ React__default.createElement("span", {
|
|
54606
|
+
className: "font-bold"
|
|
54607
|
+
}, "Note"), " \u2013 If you navigate away before uploading a media item, the folder will disappear."), /* @__PURE__ */ React__default.createElement(Input, {
|
|
54608
|
+
value: folderName,
|
|
54609
|
+
placeholder: "Folder Name",
|
|
54610
|
+
required: true,
|
|
54611
|
+
onChange: (e2) => setFolderName(e2.target.value)
|
|
54612
|
+
})), /* @__PURE__ */ React__default.createElement(ModalActions, null, /* @__PURE__ */ React__default.createElement(Button, {
|
|
54613
|
+
style: { flexGrow: 2 },
|
|
54614
|
+
onClick: close
|
|
54615
|
+
}, "Cancel"), /* @__PURE__ */ React__default.createElement(Button, {
|
|
54616
|
+
disabled: !folderName,
|
|
54617
|
+
style: { flexGrow: 3 },
|
|
54618
|
+
variant: "primary",
|
|
54619
|
+
onClick: () => {
|
|
54620
|
+
if (!folderName)
|
|
54621
|
+
return;
|
|
54622
|
+
onSubmit(folderName);
|
|
54623
|
+
close();
|
|
54624
|
+
}
|
|
54625
|
+
}, "Create New Folder"))));
|
|
54626
|
+
};
|
|
54627
|
+
const SyncModal = ({ close, syncFunc, folder, branch }) => {
|
|
54628
|
+
return /* @__PURE__ */ React__default.createElement(Modal, null, /* @__PURE__ */ React__default.createElement(PopupModal, null, /* @__PURE__ */ React__default.createElement(ModalHeader, {
|
|
54629
|
+
close
|
|
54630
|
+
}, "Sync Media"), /* @__PURE__ */ React__default.createElement(ModalBody, {
|
|
54631
|
+
padded: true
|
|
54632
|
+
}, /* @__PURE__ */ React__default.createElement("p", null, `This will copy media assets from the \`${folder}\` folder on branch \`${branch}\` in your git repository to Tina Cloud's asset service. This will allow you to use these assets in your site with Tina Cloud`)), /* @__PURE__ */ React__default.createElement(ModalActions, null, /* @__PURE__ */ React__default.createElement(Button, {
|
|
54633
|
+
style: { flexGrow: 2 },
|
|
54634
|
+
onClick: close
|
|
54635
|
+
}, "Cancel"), /* @__PURE__ */ React__default.createElement(Button, {
|
|
54636
|
+
style: { flexGrow: 3 },
|
|
54637
|
+
variant: "primary",
|
|
54638
|
+
onClick: async () => {
|
|
54639
|
+
await syncFunc();
|
|
54640
|
+
close();
|
|
54641
|
+
}
|
|
54642
|
+
}, "Sync Media"))));
|
|
54643
|
+
};
|
|
54644
|
+
const CopyField = ({ label, description, value }) => {
|
|
54645
|
+
const [copied, setCopied] = React__default.useState(false);
|
|
54646
|
+
const [fadeOut, setFadeOut] = React__default.useState(false);
|
|
54647
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
54648
|
+
className: "w-full"
|
|
54649
|
+
}, label && /* @__PURE__ */ React__default.createElement("label", {
|
|
54650
|
+
className: "w-full mb-1 block flex-1 text-sm font-bold leading-5 text-gray-700"
|
|
54651
|
+
}, label), /* @__PURE__ */ React__default.createElement("span", {
|
|
54652
|
+
onClick: () => {
|
|
54653
|
+
if (copied === true)
|
|
54654
|
+
return;
|
|
54655
|
+
setCopied(true);
|
|
54656
|
+
setTimeout(() => {
|
|
54657
|
+
setFadeOut(true);
|
|
54658
|
+
}, 2500);
|
|
54659
|
+
setTimeout(() => {
|
|
54660
|
+
setCopied(false);
|
|
54661
|
+
setFadeOut(false);
|
|
54662
|
+
}, 3e3);
|
|
54663
|
+
navigator.clipboard.writeText(value);
|
|
54664
|
+
},
|
|
54665
|
+
className: `shadow-inner text-base leading-5 whitespace-normal break-all px-3 py-2 text-gray-600 w-full bg-gray-50 border border-gray-200 transition-all ease-out duration-150 rounded-md relative overflow-hidden appearance-none flex items-center w-full cursor-pointer hover:bg-white hover:text-blue-500 ${copied ? `pointer-events-none` : ``}`
|
|
54666
|
+
}, /* @__PURE__ */ React__default.createElement(BiCopyAlt, {
|
|
54667
|
+
className: "relative text-blue-500 shrink-0 w-5 h-auto mr-1.5 -ml-0.5 z-20"
|
|
54668
|
+
}), " ", value, " ", copied && /* @__PURE__ */ React__default.createElement("span", {
|
|
54669
|
+
className: `${fadeOut ? `opacity-0` : `opacity-100`} text-blue-500 transition-opacity duration-500 absolute right-0 w-full h-full px-3 py-2 bg-white bg-opacity-90 flex items-center justify-center text-center tracking-wide font-medium z-10`
|
|
54670
|
+
}, /* @__PURE__ */ React__default.createElement("span", null, "Copied to clipboard!"))), description && /* @__PURE__ */ React__default.createElement("p", {
|
|
54671
|
+
className: "mt-2 text-sm text-gray-500"
|
|
54672
|
+
}, description));
|
|
54673
|
+
};
|
|
54479
54674
|
async function poll(fn2, timeout, interval) {
|
|
54480
54675
|
const endTime = Number(new Date()) + (timeout || 2e3);
|
|
54481
54676
|
interval = interval || 100;
|
|
@@ -54524,6 +54719,8 @@
|
|
|
54524
54719
|
return "loading";
|
|
54525
54720
|
return "not-configured";
|
|
54526
54721
|
});
|
|
54722
|
+
const [deleteModalOpen, setDeleteModalOpen] = React__default.useState(false);
|
|
54723
|
+
const [newFolderModalOpen, setNewFolderModalOpen] = React__default.useState(false);
|
|
54527
54724
|
const [listError, setListError] = react.exports.useState(defaultListError);
|
|
54528
54725
|
const [directory, setDirectory] = react.exports.useState(props.directory);
|
|
54529
54726
|
const [list2, setList] = react.exports.useState({
|
|
@@ -54533,6 +54730,7 @@
|
|
|
54533
54730
|
const [showSync, setShowSync] = react.exports.useState(false);
|
|
54534
54731
|
const [viewMode, setViewMode] = react.exports.useState("grid");
|
|
54535
54732
|
const [activeItem, setActiveItem] = react.exports.useState(false);
|
|
54733
|
+
const closePreview = () => setActiveItem(false);
|
|
54536
54734
|
const [offsetHistory, setOffsetHistory] = react.exports.useState([]);
|
|
54537
54735
|
const [loadingText, setLoadingText] = react.exports.useState("");
|
|
54538
54736
|
const offset2 = offsetHistory[offsetHistory.length - 1];
|
|
@@ -54554,7 +54752,16 @@
|
|
|
54554
54752
|
const branch = (_m = cms.api.tina) == null ? void 0 : _m.branch;
|
|
54555
54753
|
function loadMedia() {
|
|
54556
54754
|
setListState("loading");
|
|
54557
|
-
cms.media.list({
|
|
54755
|
+
cms.media.list({
|
|
54756
|
+
offset: offset2,
|
|
54757
|
+
limit: cms.media.pageSize,
|
|
54758
|
+
directory,
|
|
54759
|
+
thumbnailSizes: [
|
|
54760
|
+
{ w: 75, h: 75 },
|
|
54761
|
+
{ w: 400, h: 400 },
|
|
54762
|
+
{ w: 1e3, h: 1e3 }
|
|
54763
|
+
]
|
|
54764
|
+
}).then((list22) => {
|
|
54558
54765
|
setList(list22);
|
|
54559
54766
|
setListState("loaded");
|
|
54560
54767
|
}).catch((e2) => {
|
|
@@ -54571,15 +54778,9 @@
|
|
|
54571
54778
|
if (!cms.media.isConfigured)
|
|
54572
54779
|
return;
|
|
54573
54780
|
loadMedia();
|
|
54574
|
-
return cms.events.subscribe(["media:
|
|
54781
|
+
return cms.events.subscribe(["media:delete:success", "media:pageSize"], loadMedia);
|
|
54575
54782
|
}, [offset2, directory, cms.media.isConfigured]);
|
|
54576
54783
|
const onClickMediaItem = (item) => {
|
|
54577
|
-
if (item.type === "dir") {
|
|
54578
|
-
setDirectory(item.directory === "." || item.directory === "" ? item.filename : join(item.directory, item.filename));
|
|
54579
|
-
resetOffset();
|
|
54580
|
-
}
|
|
54581
|
-
};
|
|
54582
|
-
const onClickGridMediaItem = (item) => {
|
|
54583
54784
|
if (!item) {
|
|
54584
54785
|
setActiveItem(false);
|
|
54585
54786
|
} else if (item.type === "dir") {
|
|
@@ -54592,9 +54793,7 @@
|
|
|
54592
54793
|
let deleteMediaItem;
|
|
54593
54794
|
if (allowDelete) {
|
|
54594
54795
|
deleteMediaItem = (item) => {
|
|
54595
|
-
|
|
54596
|
-
cms.media.delete(item);
|
|
54597
|
-
}
|
|
54796
|
+
cms.media.delete(item);
|
|
54598
54797
|
};
|
|
54599
54798
|
}
|
|
54600
54799
|
let selectMediaItem;
|
|
@@ -54609,15 +54808,50 @@
|
|
|
54609
54808
|
const { getRootProps, getInputProps, isDragActive } = useDropzone({
|
|
54610
54809
|
accept: dropzoneAcceptFromString(cms.media.accept || DEFAULT_MEDIA_UPLOAD_TYPES),
|
|
54611
54810
|
multiple: true,
|
|
54612
|
-
onDrop: async (files) => {
|
|
54811
|
+
onDrop: async (files, fileRejections) => {
|
|
54613
54812
|
try {
|
|
54614
54813
|
setUploading(true);
|
|
54615
|
-
await cms.media.persist(files.map((file) => {
|
|
54814
|
+
const mediaItems = await cms.media.persist(files.map((file) => {
|
|
54616
54815
|
return {
|
|
54617
54816
|
directory: directory || "/",
|
|
54618
54817
|
file
|
|
54619
54818
|
};
|
|
54620
54819
|
}));
|
|
54820
|
+
const errorCodes = {
|
|
54821
|
+
"file-invalid-type": "Invalid file type",
|
|
54822
|
+
"file-too-large": "File too large",
|
|
54823
|
+
"file-too-small": "File too small",
|
|
54824
|
+
"too-many-files": "Too many files"
|
|
54825
|
+
};
|
|
54826
|
+
const printError = (error) => {
|
|
54827
|
+
const message2 = errorCodes[error.code];
|
|
54828
|
+
if (message2) {
|
|
54829
|
+
return message2;
|
|
54830
|
+
}
|
|
54831
|
+
console.error(error);
|
|
54832
|
+
return "Unknown error";
|
|
54833
|
+
};
|
|
54834
|
+
if (fileRejections.length > 0) {
|
|
54835
|
+
const messages = [];
|
|
54836
|
+
fileRejections.map((fileRejection) => {
|
|
54837
|
+
messages.push(`${fileRejection.file.name}: ${fileRejection.errors.map((error) => printError(error)).join(", ")}`);
|
|
54838
|
+
});
|
|
54839
|
+
cms.alerts.error(() => {
|
|
54840
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, "Upload Failed. ", /* @__PURE__ */ React__default.createElement("br", null), messages.join(". "), ".");
|
|
54841
|
+
});
|
|
54842
|
+
}
|
|
54843
|
+
if (mediaItems.length !== 0) {
|
|
54844
|
+
setActiveItem(mediaItems[0]);
|
|
54845
|
+
setList((mediaList) => {
|
|
54846
|
+
return {
|
|
54847
|
+
items: [
|
|
54848
|
+
...mediaItems.map((x2) => ({ ...x2, new: true })),
|
|
54849
|
+
...mediaList.items
|
|
54850
|
+
],
|
|
54851
|
+
nextOffset: mediaList.nextOffset
|
|
54852
|
+
};
|
|
54853
|
+
});
|
|
54854
|
+
}
|
|
54621
54855
|
} catch {
|
|
54622
54856
|
}
|
|
54623
54857
|
setUploading(false);
|
|
@@ -54682,28 +54916,56 @@
|
|
|
54682
54916
|
docsLink
|
|
54683
54917
|
});
|
|
54684
54918
|
}
|
|
54685
|
-
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null,
|
|
54686
|
-
|
|
54919
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, deleteModalOpen && /* @__PURE__ */ React__default.createElement(DeleteModal, {
|
|
54920
|
+
filename: activeItem ? activeItem.filename : "",
|
|
54921
|
+
deleteFunc: () => {
|
|
54922
|
+
if (activeItem) {
|
|
54923
|
+
deleteMediaItem(activeItem);
|
|
54924
|
+
setActiveItem(false);
|
|
54925
|
+
}
|
|
54926
|
+
},
|
|
54927
|
+
close: () => setDeleteModalOpen(false)
|
|
54928
|
+
}), newFolderModalOpen && /* @__PURE__ */ React__default.createElement(NewFolderModal, {
|
|
54929
|
+
onSubmit: (name2) => {
|
|
54930
|
+
setDirectory((oldDir) => {
|
|
54931
|
+
if (oldDir) {
|
|
54932
|
+
return join(oldDir, name2);
|
|
54933
|
+
} else {
|
|
54934
|
+
return name2;
|
|
54935
|
+
}
|
|
54936
|
+
});
|
|
54937
|
+
resetOffset();
|
|
54938
|
+
},
|
|
54939
|
+
close: () => setNewFolderModalOpen(false)
|
|
54940
|
+
}), /* @__PURE__ */ React__default.createElement(MediaPickerWrap, null, /* @__PURE__ */ React__default.createElement("div", {
|
|
54941
|
+
className: "flex flex-wrap items-center bg-gray-50 border-b border-gray-150 gap-4 py-3 px-5 shadow-sm flex-shrink-0"
|
|
54687
54942
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
54688
|
-
className:
|
|
54689
|
-
}, /* @__PURE__ */ React__default.createElement(
|
|
54690
|
-
|
|
54691
|
-
|
|
54692
|
-
|
|
54693
|
-
}
|
|
54694
|
-
}, /* @__PURE__ */ React__default.createElement(BiGridAlt, {
|
|
54695
|
-
className: "w-6 h-full opacity-70"
|
|
54696
|
-
})), /* @__PURE__ */ React__default.createElement("button", {
|
|
54697
|
-
className: `relative whitespace-nowrap flex items-center justify-center flex-1 block font-medium text-base px-2 py-1 transition-all ease-out duration-150 rounded-r-md ${viewMode === "list" ? "bg-white text-blue-500 shadow" : "text-gray-400"}`,
|
|
54698
|
-
onClick: () => {
|
|
54699
|
-
setViewMode("list");
|
|
54700
|
-
}
|
|
54701
|
-
}, /* @__PURE__ */ React__default.createElement(BiListUl, {
|
|
54702
|
-
className: "w-8 h-full opacity-70"
|
|
54703
|
-
}))), /* @__PURE__ */ React__default.createElement(Breadcrumb, {
|
|
54943
|
+
className: "flex flex-1 items-center gap-4"
|
|
54944
|
+
}, /* @__PURE__ */ React__default.createElement(ViewModeToggle, {
|
|
54945
|
+
viewMode,
|
|
54946
|
+
setViewMode
|
|
54947
|
+
}), /* @__PURE__ */ React__default.createElement(Breadcrumb, {
|
|
54704
54948
|
directory,
|
|
54705
54949
|
setDirectory
|
|
54706
|
-
}),
|
|
54950
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
|
54951
|
+
className: "flex items-center gap-4"
|
|
54952
|
+
}, /* @__PURE__ */ React__default.createElement(Button, {
|
|
54953
|
+
busy: false,
|
|
54954
|
+
variant: "white",
|
|
54955
|
+
onClick: loadMedia,
|
|
54956
|
+
className: "whitespace-nowrap"
|
|
54957
|
+
}, "Refresh", /* @__PURE__ */ React__default.createElement(IoMdRefresh, {
|
|
54958
|
+
className: "w-6 h-full ml-2 opacity-70 text-blue-500"
|
|
54959
|
+
})), /* @__PURE__ */ React__default.createElement(Button, {
|
|
54960
|
+
busy: false,
|
|
54961
|
+
variant: "white",
|
|
54962
|
+
onClick: () => {
|
|
54963
|
+
setNewFolderModalOpen(true);
|
|
54964
|
+
},
|
|
54965
|
+
className: "whitespace-nowrap"
|
|
54966
|
+
}, "New Folder", /* @__PURE__ */ React__default.createElement(BiFolder, {
|
|
54967
|
+
className: "w-6 h-full ml-2 opacity-70 text-blue-500"
|
|
54968
|
+
})), !isLocal2 && hasTinaMedia && /* @__PURE__ */ React__default.createElement(Button, {
|
|
54707
54969
|
busy: false,
|
|
54708
54970
|
variant: "white",
|
|
54709
54971
|
onClick: () => {
|
|
@@ -54714,11 +54976,13 @@
|
|
|
54714
54976
|
})), /* @__PURE__ */ React__default.createElement(UploadButton, {
|
|
54715
54977
|
onClick,
|
|
54716
54978
|
uploading
|
|
54717
|
-
})), /* @__PURE__ */ React__default.createElement("div", {
|
|
54718
|
-
className: "flex h-full overflow-hidden"
|
|
54979
|
+
}))), /* @__PURE__ */ React__default.createElement("div", {
|
|
54980
|
+
className: "flex h-full overflow-hidden bg-white"
|
|
54981
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
54982
|
+
className: "flex w-full flex-col h-full @container"
|
|
54719
54983
|
}, /* @__PURE__ */ React__default.createElement("ul", {
|
|
54720
54984
|
...rootProps,
|
|
54721
|
-
className: `h-full
|
|
54985
|
+
className: `h-full grow overflow-y-auto transition duration-150 ease-out bg-gradient-to-b from-gray-50/50 to-gray-50 ${list2.items.length === 0 || viewMode === "list" && "w-full flex flex-1 flex-col justify-start -mb-px"} ${list2.items.length > 0 && viewMode === "grid" && "w-full p-4 gap-4 grid grid-cols-1 @sm:grid-cols-2 @lg:grid-cols-3 @2xl:grid-cols-4 @4xl:grid-cols-6 @6xl:grid-cols-8 auto-rows-auto content-start justify-start"} ${isDragActive ? `border-2 border-blue-500 rounded-lg` : ``}`
|
|
54722
54986
|
}, /* @__PURE__ */ React__default.createElement("input", {
|
|
54723
54987
|
...getInputProps()
|
|
54724
54988
|
}), listState === "loaded" && list2.items.length === 0 && /* @__PURE__ */ React__default.createElement(EmptyMediaList, {
|
|
@@ -54727,24 +54991,27 @@
|
|
|
54727
54991
|
key: item.id,
|
|
54728
54992
|
item,
|
|
54729
54993
|
onClick: onClickMediaItem,
|
|
54730
|
-
|
|
54731
|
-
onDelete: deleteMediaItem
|
|
54994
|
+
active: activeItem && activeItem.id === item.id
|
|
54732
54995
|
})), viewMode === "grid" && list2.items.map((item) => /* @__PURE__ */ React__default.createElement(GridMediaItem, {
|
|
54733
54996
|
key: item.id,
|
|
54734
54997
|
item,
|
|
54735
|
-
onClick:
|
|
54998
|
+
onClick: onClickMediaItem,
|
|
54736
54999
|
active: activeItem && activeItem.id === item.id
|
|
54737
|
-
}))),
|
|
54738
|
-
|
|
54739
|
-
selectMediaItem,
|
|
54740
|
-
deleteMediaItem
|
|
54741
|
-
})), /* @__PURE__ */ React__default.createElement("div", {
|
|
54742
|
-
className: "bg-gray-50 border-t border-gray-150 py-3 px-5 shadow-sm z-10"
|
|
55000
|
+
}))), /* @__PURE__ */ React__default.createElement("div", {
|
|
55001
|
+
className: "bg-gradient-to-r to-gray-50/50 from-gray-50 shrink-0 grow-0 border-t border-gray-150 py-3 px-5 shadow-sm z-10"
|
|
54743
55002
|
}, /* @__PURE__ */ React__default.createElement(CursorPaginator, {
|
|
54744
55003
|
hasNext,
|
|
54745
55004
|
navigateNext,
|
|
54746
55005
|
hasPrev,
|
|
54747
55006
|
navigatePrev
|
|
55007
|
+
}))), /* @__PURE__ */ React__default.createElement(ActiveItemPreview, {
|
|
55008
|
+
activeItem,
|
|
55009
|
+
close: closePreview,
|
|
55010
|
+
selectMediaItem,
|
|
55011
|
+
allowDelete,
|
|
55012
|
+
deleteMediaItem: () => {
|
|
55013
|
+
setDeleteModalOpen(true);
|
|
55014
|
+
}
|
|
54748
55015
|
}))), showSync && /* @__PURE__ */ React__default.createElement(SyncModal, {
|
|
54749
55016
|
folder,
|
|
54750
55017
|
branch,
|
|
@@ -54756,23 +55023,41 @@
|
|
|
54756
55023
|
}
|
|
54757
55024
|
const ActiveItemPreview = ({
|
|
54758
55025
|
activeItem,
|
|
55026
|
+
close,
|
|
54759
55027
|
selectMediaItem,
|
|
54760
|
-
deleteMediaItem
|
|
55028
|
+
deleteMediaItem,
|
|
55029
|
+
allowDelete
|
|
54761
55030
|
}) => {
|
|
55031
|
+
const thumbnail = activeItem ? (activeItem.thumbnails || {})["1000x1000"] : "";
|
|
54762
55032
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
54763
|
-
className:
|
|
54764
|
-
},
|
|
54765
|
-
className: "
|
|
54766
|
-
|
|
55033
|
+
className: `shrink-0 h-full flex flex-col items-start gap-3 overflow-y-auto bg-white border-l border-gray-100 bg-white shadow-md transition ease-out duration-150 ${activeItem ? `p-4 opacity-100 w-[35%] max-w-[560px] min-w-[240px]` : `translate-x-8 opacity-0 w-[0px]`}`
|
|
55034
|
+
}, activeItem && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", {
|
|
55035
|
+
className: "flex grow-0 shrink-0 gap-2 w-full items-center justify-between"
|
|
55036
|
+
}, /* @__PURE__ */ React__default.createElement("h3", {
|
|
55037
|
+
className: "text-lg text-gray-600 w-full max-w-full break-words block truncate flex-1"
|
|
55038
|
+
}, activeItem.filename), /* @__PURE__ */ React__default.createElement(IconButton, {
|
|
55039
|
+
variant: "ghost",
|
|
55040
|
+
className: "group grow-0 shrink-0",
|
|
55041
|
+
onClick: close
|
|
55042
|
+
}, /* @__PURE__ */ React__default.createElement(BiX, {
|
|
55043
|
+
className: `w-7 h-auto text-gray-500 opacity-50 group-hover:opacity-100 transition duration-150 ease-out`
|
|
55044
|
+
}))), isImage(thumbnail) ? /* @__PURE__ */ React__default.createElement("div", {
|
|
55045
|
+
className: "w-full max-h-[75%]"
|
|
55046
|
+
}, /* @__PURE__ */ React__default.createElement("img", {
|
|
55047
|
+
className: "block border border-gray-100 rounded-md overflow-hidden max-w-full max-h-full object-fit h-auto shadow",
|
|
55048
|
+
src: thumbnail,
|
|
54767
55049
|
alt: activeItem.filename
|
|
54768
|
-
}) : /* @__PURE__ */ React__default.createElement("span", {
|
|
55050
|
+
})) : /* @__PURE__ */ React__default.createElement("span", {
|
|
54769
55051
|
className: "p-3 border border-gray-100 rounded-md overflow-hidden bg-gray-50 shadow"
|
|
54770
55052
|
}, /* @__PURE__ */ React__default.createElement(BiFile, {
|
|
54771
55053
|
className: "w-14 h-auto fill-gray-300"
|
|
54772
|
-
})), /* @__PURE__ */ React__default.createElement("
|
|
54773
|
-
className: "
|
|
54774
|
-
},
|
|
54775
|
-
|
|
55054
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
|
55055
|
+
className: "grow h-full w-full shrink flex flex-col gap-3 items-start justify-start"
|
|
55056
|
+
}, /* @__PURE__ */ React__default.createElement(CopyField, {
|
|
55057
|
+
value: absoluteImgURL(activeItem.src),
|
|
55058
|
+
label: "URL"
|
|
55059
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
|
55060
|
+
className: "shrink-0 w-full flex flex-col justify-end items-start"
|
|
54776
55061
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
54777
55062
|
className: "flex w-full gap-3"
|
|
54778
55063
|
}, selectMediaItem && /* @__PURE__ */ React__default.createElement(Button, {
|
|
@@ -54782,14 +55067,14 @@
|
|
|
54782
55067
|
onClick: () => selectMediaItem(activeItem)
|
|
54783
55068
|
}, "Insert", /* @__PURE__ */ React__default.createElement(BiArrowToBottom, {
|
|
54784
55069
|
className: "ml-1 -mr-0.5 w-6 h-auto text-white opacity-70"
|
|
54785
|
-
})), /* @__PURE__ */ React__default.createElement(Button, {
|
|
55070
|
+
})), allowDelete && /* @__PURE__ */ React__default.createElement(Button, {
|
|
54786
55071
|
variant: "white",
|
|
54787
55072
|
size: "medium",
|
|
54788
55073
|
className: "grow max-w-[40%]",
|
|
54789
|
-
onClick:
|
|
55074
|
+
onClick: deleteMediaItem
|
|
54790
55075
|
}, "Delete", /* @__PURE__ */ React__default.createElement(TrashIcon, {
|
|
54791
55076
|
className: "ml-1 -mr-0.5 w-6 h-auto text-red-500 opacity-70"
|
|
54792
|
-
})))));
|
|
55077
|
+
}))))));
|
|
54793
55078
|
};
|
|
54794
55079
|
const UploadButton = ({ onClick, uploading }) => {
|
|
54795
55080
|
return /* @__PURE__ */ React__default.createElement(Button, {
|
|
@@ -54817,9 +55102,9 @@
|
|
|
54817
55102
|
};
|
|
54818
55103
|
const EmptyMediaList = (props) => {
|
|
54819
55104
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
54820
|
-
className: `text-
|
|
55105
|
+
className: `p-12 text-xl opacity-50 text-center`,
|
|
54821
55106
|
...props
|
|
54822
|
-
}, "Drag and
|
|
55107
|
+
}, "Drag and drop assets here", props.hasTinaMedia && " or click 'Sync' to sync your media to Tina Cloud.");
|
|
54823
55108
|
};
|
|
54824
55109
|
const DocsLink = ({ title, message: message2, docsLink, ...props }) => {
|
|
54825
55110
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
@@ -54836,22 +55121,29 @@
|
|
|
54836
55121
|
className: "font-bold text-blue-500 hover:text-blue-600 hover:underline transition-all ease-out duration-150"
|
|
54837
55122
|
}, "Learn More"));
|
|
54838
55123
|
};
|
|
54839
|
-
const
|
|
54840
|
-
|
|
54841
|
-
|
|
54842
|
-
|
|
54843
|
-
|
|
54844
|
-
}
|
|
54845
|
-
|
|
54846
|
-
|
|
54847
|
-
},
|
|
54848
|
-
|
|
54849
|
-
|
|
54850
|
-
|
|
54851
|
-
await syncFunc();
|
|
54852
|
-
close();
|
|
55124
|
+
const ViewModeToggle = ({ viewMode, setViewMode }) => {
|
|
55125
|
+
const toggleClasses = {
|
|
55126
|
+
base: "relative whitespace-nowrap flex items-center justify-center flex-1 block font-medium text-base py-1 transition-all ease-out duration-150 border",
|
|
55127
|
+
active: "bg-white text-blue-500 shadow-inner border-gray-50 border-t-gray-100",
|
|
55128
|
+
inactive: "bg-gray-50 text-gray-400 shadow border-gray-100 border-t-white"
|
|
55129
|
+
};
|
|
55130
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
55131
|
+
className: `grow-0 flex justify-between rounded-md border border-gray-100`
|
|
55132
|
+
}, /* @__PURE__ */ React__default.createElement("button", {
|
|
55133
|
+
className: `${toggleClasses.base} px-2.5 rounded-l-md ${viewMode === "grid" ? toggleClasses.active : toggleClasses.inactive}`,
|
|
55134
|
+
onClick: () => {
|
|
55135
|
+
setViewMode("grid");
|
|
54853
55136
|
}
|
|
54854
|
-
},
|
|
55137
|
+
}, /* @__PURE__ */ React__default.createElement(BiGridAlt, {
|
|
55138
|
+
className: "w-6 h-full opacity-70"
|
|
55139
|
+
})), /* @__PURE__ */ React__default.createElement("button", {
|
|
55140
|
+
className: `${toggleClasses.base} px-2 rounded-r-md ${viewMode === "list" ? toggleClasses.active : toggleClasses.inactive}`,
|
|
55141
|
+
onClick: () => {
|
|
55142
|
+
setViewMode("list");
|
|
55143
|
+
}
|
|
55144
|
+
}, /* @__PURE__ */ React__default.createElement(BiListUl, {
|
|
55145
|
+
className: "w-8 h-full opacity-70"
|
|
55146
|
+
})));
|
|
54855
55147
|
};
|
|
54856
55148
|
createScreen({
|
|
54857
55149
|
name: "Media Manager",
|
|
@@ -54863,6 +55155,12 @@
|
|
|
54863
55155
|
}
|
|
54864
55156
|
});
|
|
54865
55157
|
react.exports.createContext(-1);
|
|
55158
|
+
react.exports.createContext({
|
|
55159
|
+
currentBranch: null,
|
|
55160
|
+
setCurrentBranch: (branch) => {
|
|
55161
|
+
console.warn("BranchContext not initialized");
|
|
55162
|
+
}
|
|
55163
|
+
});
|
|
54866
55164
|
react.exports.createContext(null);
|
|
54867
55165
|
class MediaListError extends Error {
|
|
54868
55166
|
constructor(config2) {
|