@vis3/kit 1.1.4 → 1.1.6

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/index.mjs CHANGED
@@ -87865,15 +87865,15 @@ const nD = be.div`
87865
87865
  align-items: center;
87866
87866
  `;
87867
87867
  function qS({ url: e, data: t }) {
87868
- const [r, n] = st(!1), { previewUrl: i } = Ni(), a = () => {
87868
+ const [r, n] = st(!1), { previewUrl: i } = Ni(), a = i?.includes("?") ? "&" : "?", o = () => {
87869
87869
  n(!0);
87870
- }, o = () => {
87870
+ }, s = () => {
87871
87871
  n(!1);
87872
- }, s = Ce(() => {
87873
- const l = t?.raw_path ?? "";
87874
- return e ? r ? `${i}?path=${l}` : e.startsWith("s3://") ? `${i}?path=${e}` : !e.startsWith("http") && !e.startsWith("https") && l ? `${i}?path=${l}` : e : "";
87875
- }, [t, r, e, i]);
87876
- return /* @__PURE__ */ q(eo, { src: s, alt: s, onError: a, onLoadedData: o });
87872
+ }, l = Ce(() => {
87873
+ const u = t?.raw_path ?? "";
87874
+ return e ? r ? `${i}${a}path=${u}` : e.startsWith("s3://") ? `${i}${a}path=${e}` : !e.startsWith("http") && !e.startsWith("https") && u ? `${i}${a}path=${u}` : e : "";
87875
+ }, [t, r, e, i, a]);
87876
+ return /* @__PURE__ */ q(eo, { src: l, alt: l, onError: o, onLoadedData: s });
87877
87877
  }
87878
87878
  function M8e({ name: e, data: t }) {
87879
87879
  const { t: r } = p1();
@@ -87944,7 +87944,7 @@ function B8e({ name: e, data: t }) {
87944
87944
  return a.img_urls.map((s) => /* @__PURE__ */ q(eo, { src: s, alt: a.img_alt }, `${e}-${s}`));
87945
87945
  if (a.img_path) {
87946
87946
  let s = a.img_path;
87947
- return a.img_path.startsWith("s3://") && (s = `${r}?path=${a.img_path}`), /* @__PURE__ */ q(C1, { title: a.img_caption, children: /* @__PURE__ */ q(eo, { src: s, alt: a.img_alt }) });
87947
+ return a.img_path.startsWith("s3://") && (s = `${r}${r?.includes("?") ? "&" : "?"}path=${a.img_path}`), /* @__PURE__ */ q(C1, { title: a.img_caption, children: /* @__PURE__ */ q(eo, { src: s, alt: a.img_alt }) });
87948
87948
  }
87949
87949
  }
87950
87950
  return /* @__PURE__ */ q(ZS, { children: a.text ?? "" }, `${e}-${o}`);
@@ -88752,10 +88752,11 @@ const o9e = be(eo)`
88752
88752
  align-items: center;
88753
88753
  `;
88754
88754
  function Q9e({ type: e, className: t, name: r, value: n, extraTail: i, titleExtra: a }) {
88755
- const o = Xt(null), { onDownload: s } = Ni(), { t: l } = p1(), [u, c] = st(!1), Q = Et(() => {
88755
+ const o = Xt(null), { onDownload: s } = Ni(), { t: l } = p1(), [u, c] = st(!1), Q = Et((f) => {
88756
+ const h = f.target, m = h.naturalWidth, g = h.naturalHeight;
88756
88757
  if (o.current) {
88757
- const f = o.current.querySelector(".ant-card-body");
88758
- f && c(f.scrollHeight > f.clientHeight);
88758
+ const d = f.target.closest(".ant-card-body");
88759
+ c(m > d.clientWidth || g > d.clientHeight);
88759
88760
  }
88760
88761
  }, []), T = Ce(() => {
88761
88762
  if (e === "image")
@@ -88783,7 +88784,7 @@ function Q9e({ type: e, className: t, name: r, value: n, extraTail: i, titleExtr
88783
88784
  bodyStyle: {
88784
88785
  display: "flex",
88785
88786
  justifyContent: "center",
88786
- alignItems: u ? "start" : "center"
88787
+ alignItems: u ? "normal" : "center"
88787
88788
  },
88788
88789
  extra: /* @__PURE__ */ Ye(c9e, { children: [
88789
88790
  /* @__PURE__ */ q(Ir, { elementRef: o }),
@@ -89023,7 +89024,7 @@ function ace({
89023
89024
  );
89024
89025
  if (ae || ["jsonl"].includes(k))
89025
89026
  return /* @__PURE__ */ q(Kue, { name: v, type: k || "txt", extraTail: I, titleExtra: oe });
89026
- let W = `${p}?path=${encodeURIComponent(t)}`;
89027
+ let W = `${p}${p?.includes("?") ? "&" : "?"}path=${encodeURIComponent(t)}`;
89027
89028
  return k === "zip" && (W = t), n && "content" in n && n.content && (W = n.content), /* @__PURE__ */ q(g9e, { name: v, value: W, type: k, extraTail: I, titleExtra: oe });
89028
89029
  }, [v, I, oe, A, e, ae, X, t, C, k, n]);
89029
89030
  return /* @__PURE__ */ q(GE.Provider, { value: re, children: /* @__PURE__ */ Ye(f9e, { "data-block-id": e, style: i, className: a, children: [
package/dist/index.umd.js CHANGED
@@ -307,7 +307,7 @@ Valid keys: `+JSON.stringify(Object.keys(_),null," "));var I=se(Y,ne,re,oe,ae+"
307
307
  display: flex;
308
308
  gap: 0.5rem;
309
309
  align-items: center;
310
- `;function Uk({url:e,data:t}){const[r,n]=G.useState(!1),{previewUrl:i}=d4(),a=()=>{n(!0)},o=()=>{n(!1)},s=G.useMemo(()=>{const l=t?.raw_path??"";return e?r?`${i}?path=${l}`:e.startsWith("s3://")?`${i}?path=${e}`:!e.startsWith("http")&&!e.startsWith("https")&&l?`${i}?path=${l}`:e:""},[t,r,e,i]);return j.jsx(we.Image,{src:s,alt:s,onError:a,onLoadedData:o})}function Ose({name:e,data:t}){const{t:r}=Jt();return Array.isArray(t)?j.jsx(mse,{title:e,children:t.map(n=>{if(typeof n=="string")return j.jsx(Uk,{data:n,url:n},n);const i=n;return j.jsx(Uk,{data:n,url:i.url},i.url)})}):j.jsx(Xk,{children:r("renderer.arrayTypeRequired")})}function yse({className:e,name:t,value:r,extraTail:n}){const i=G.useRef(null),[a,{wrap:o}]=ki(),[s,l]=G.useState(r),[u,{preview:c}]=Pi(),[Q]=Mi(r);G.useEffect(()=>{l(r)},[r]);const T=G.useMemo(()=>({wrap:o??!1,value:s,onChange:l}),[o,s]);return j.jsx(t4.Provider,{value:T,children:j.jsx(R2,{ref:i,className:e,name:t,extra:j.jsxs(gse,{children:[u,!c&&a,j.jsx(K2,{elementRef:i}),!c&&Q,n]}),children:c?j.jsx(Ose,{name:t,data:s}):j.jsx(q0,{})})})}const vse={contentList:"_contentList_1avch_1"},Wk=Ee.div`
310
+ `;function Uk({url:e,data:t}){const[r,n]=G.useState(!1),{previewUrl:i}=d4(),a=i?.includes("?")?"&":"?",o=()=>{n(!0)},s=()=>{n(!1)},l=G.useMemo(()=>{const u=t?.raw_path??"";return e?r?`${i}${a}path=${u}`:e.startsWith("s3://")?`${i}${a}path=${e}`:!e.startsWith("http")&&!e.startsWith("https")&&u?`${i}${a}path=${u}`:e:""},[t,r,e,i,a]);return j.jsx(we.Image,{src:l,alt:l,onError:o,onLoadedData:s})}function Ose({name:e,data:t}){const{t:r}=Jt();return Array.isArray(t)?j.jsx(mse,{title:e,children:t.map(n=>{if(typeof n=="string")return j.jsx(Uk,{data:n,url:n},n);const i=n;return j.jsx(Uk,{data:n,url:i.url},i.url)})}):j.jsx(Xk,{children:r("renderer.arrayTypeRequired")})}function yse({className:e,name:t,value:r,extraTail:n}){const i=G.useRef(null),[a,{wrap:o}]=ki(),[s,l]=G.useState(r),[u,{preview:c}]=Pi(),[Q]=Mi(r);G.useEffect(()=>{l(r)},[r]);const T=G.useMemo(()=>({wrap:o??!1,value:s,onChange:l}),[o,s]);return j.jsx(t4.Provider,{value:T,children:j.jsx(R2,{ref:i,className:e,name:t,extra:j.jsxs(gse,{children:[u,!c&&a,j.jsx(K2,{elementRef:i}),!c&&Q,n]}),children:c?j.jsx(Ose,{name:t,data:s}):j.jsx(q0,{})})})}const vse={contentList:"_contentList_1avch_1"},Wk=Ee.div`
311
311
  padding: 0.5rem;
312
312
  `,xse=Ee.div`
313
313
  display: flex;
@@ -326,7 +326,7 @@ Valid keys: `+JSON.stringify(Object.keys(_),null," "));var I=se(Y,ne,re,oe,ae+"
326
326
  display: flex;
327
327
  gap: 0.5rem;
328
328
  align-items: center;
329
- `;function Ese({name:e,data:t}){const{previewUrl:r}=d4(),{t:n}=Jt(),i=G.useCallback((a,o)=>{if(a.text_format==="md")return j.jsx(zk,{inline:!0,value:a?.md??a?.text??""},`${e}-${o}`);if(a.type==="text")return j.jsx(Wk,{children:a?.md??a?.text??""},`${e}-${o}`);if(a.type==="image"){if(a.img_urls?.length)return a.img_urls.map(s=>j.jsx(we.Image,{src:s,alt:a.img_alt},`${e}-${s}`));if(a.img_path){let s=a.img_path;return a.img_path.startsWith("s3://")&&(s=`${r}?path=${a.img_path}`),j.jsx(we.Tooltip,{title:a.img_caption,children:j.jsx(we.Image,{src:s,alt:a.img_alt})})}}return j.jsx(Wk,{children:a.text??""},`${e}-${o}`)},[e,r]);return Array.isArray(t)?j.jsx(xse,{className:vse.contentList,title:e,children:t.map((a,o)=>j.jsxs(Lse,{children:[j.jsx(bse,{children:o+1}),i(a,o)]},o))}):j.jsx(Xk,{children:n("renderer.arrayTypeRequired")})}function Hse({className:e,name:t,value:r,extraTail:n}){const i=G.useRef(null),[a,{wrap:o}]=ki(),[s,l]=G.useState(r),[u,{preview:c}]=Pi();G.useEffect(()=>{l(r)},[r]);const Q=G.useMemo(()=>({wrap:o??!1,value:s,onChange:l}),[o,s,l]);return j.jsx(t4.Provider,{value:Q,children:j.jsx(R2,{ref:i,className:e,name:t,extra:j.jsxs(Sse,{children:[u,a,j.jsx(K2,{elementRef:i}),n]}),children:c?j.jsx(Ese,{name:t,data:s}):j.jsx(q0,{})})})}const _se=Ee.div`
329
+ `;function Ese({name:e,data:t}){const{previewUrl:r}=d4(),{t:n}=Jt(),i=G.useCallback((a,o)=>{if(a.text_format==="md")return j.jsx(zk,{inline:!0,value:a?.md??a?.text??""},`${e}-${o}`);if(a.type==="text")return j.jsx(Wk,{children:a?.md??a?.text??""},`${e}-${o}`);if(a.type==="image"){if(a.img_urls?.length)return a.img_urls.map(s=>j.jsx(we.Image,{src:s,alt:a.img_alt},`${e}-${s}`));if(a.img_path){let s=a.img_path;return a.img_path.startsWith("s3://")&&(s=`${r}${r?.includes("?")?"&":"?"}path=${a.img_path}`),j.jsx(we.Tooltip,{title:a.img_caption,children:j.jsx(we.Image,{src:s,alt:a.img_alt})})}}return j.jsx(Wk,{children:a.text??""},`${e}-${o}`)},[e,r]);return Array.isArray(t)?j.jsx(xse,{className:vse.contentList,title:e,children:t.map((a,o)=>j.jsxs(Lse,{children:[j.jsx(bse,{children:o+1}),i(a,o)]},o))}):j.jsx(Xk,{children:n("renderer.arrayTypeRequired")})}function Hse({className:e,name:t,value:r,extraTail:n}){const i=G.useRef(null),[a,{wrap:o}]=ki(),[s,l]=G.useState(r),[u,{preview:c}]=Pi();G.useEffect(()=>{l(r)},[r]);const Q=G.useMemo(()=>({wrap:o??!1,value:s,onChange:l}),[o,s,l]);return j.jsx(t4.Provider,{value:Q,children:j.jsx(R2,{ref:i,className:e,name:t,extra:j.jsxs(Sse,{children:[u,a,j.jsx(K2,{elementRef:i}),n]}),children:c?j.jsx(Ese,{name:t,data:s}):j.jsx(q0,{})})})}const _se=Ee.div`
330
330
  display: flex;
331
331
  gap: 0.5rem;
332
332
  align-items: center;
@@ -492,7 +492,7 @@ Valid keys: `+JSON.stringify(Object.keys(_),null," "));var I=se(Y,ne,re,oe,ae+"
492
492
  display: flex;
493
493
  gap: 0.5rem;
494
494
  align-items: center;
495
- `;function M7e({type:e,className:t,name:r,value:n,extraTail:i,titleExtra:a}){const o=G.useRef(null),{onDownload:s}=d4(),{t:l}=Jt(),[u,c]=G.useState(!1),Q=G.useCallback(()=>{if(o.current){const f=o.current.querySelector(".ant-card-body");f&&c(f.scrollHeight>f.clientHeight)}},[]),T=G.useMemo(()=>{if(e==="image")return j.jsx(H7e,{onLoad:Q,src:n,alt:n});if(e==="video")return j.jsx(_7e,{src:n,controls:!0});if(e==="audio")return j.jsx(w7e,{src:n,controls:!0});if(e==="pdf")return j.jsx(kf,{src:n,title:"pdf"});if(e==="mobi")return j.jsx(kf,{src:n,title:"mobi"});if(e==="epub")return j.jsx(kf,{src:n,title:"epub"});if(e==="zip")return j.jsx(C7e,{icon:j.jsx(Ls,{type:"text"}),onClick:()=>s?.(n),children:l("renderer.downloadZipFile")})},[e,n,s,l,Q]);return j.jsx(R2,{ref:o,className:t,name:r,titleExtra:a,bodyStyle:{display:"flex",justifyContent:"center",alignItems:u?"start":"center"},extra:j.jsxs(A7e,{children:[j.jsx(K2,{elementRef:o}),i]}),children:T})}function P7e(e,t){return e.map(r=>({...r,path:r.path.replace(t,"").replace(/\/$/,""),fullPath:r.path}))}const k7e="vis3-pagenation-change",D7e="vis3-path-correction",V7e=Ee.div`
495
+ `;function M7e({type:e,className:t,name:r,value:n,extraTail:i,titleExtra:a}){const o=G.useRef(null),{onDownload:s}=d4(),{t:l}=Jt(),[u,c]=G.useState(!1),Q=G.useCallback(f=>{const h=f.target,m=h.naturalWidth,g=h.naturalHeight;if(o.current){const d=f.target.closest(".ant-card-body");c(m>d.clientWidth||g>d.clientHeight)}},[]),T=G.useMemo(()=>{if(e==="image")return j.jsx(H7e,{onLoad:Q,src:n,alt:n});if(e==="video")return j.jsx(_7e,{src:n,controls:!0});if(e==="audio")return j.jsx(w7e,{src:n,controls:!0});if(e==="pdf")return j.jsx(kf,{src:n,title:"pdf"});if(e==="mobi")return j.jsx(kf,{src:n,title:"mobi"});if(e==="epub")return j.jsx(kf,{src:n,title:"epub"});if(e==="zip")return j.jsx(C7e,{icon:j.jsx(Ls,{type:"text"}),onClick:()=>s?.(n),children:l("renderer.downloadZipFile")})},[e,n,s,l,Q]);return j.jsx(R2,{ref:o,className:t,name:r,titleExtra:a,bodyStyle:{display:"flex",justifyContent:"center",alignItems:u?"normal":"center"},extra:j.jsxs(A7e,{children:[j.jsx(K2,{elementRef:o}),i]}),children:T})}function P7e(e,t){return e.map(r=>({...r,path:r.path.replace(t,"").replace(/\/$/,""),fullPath:r.path}))}const k7e="vis3-pagenation-change",D7e="vis3-path-correction",V7e=Ee.div`
496
496
  height: 100%;
497
497
  position: relative;
498
498
  min-width: calc(100% / 5);
@@ -514,4 +514,4 @@ Valid keys: `+JSON.stringify(Object.keys(_),null," "));var I=se(Y,ne,re,oe,ae+"
514
514
  cursor: help;
515
515
  `,$7e=Ee(M7e)`
516
516
  height: 100%;
517
- `;function j7e(e){if(e.startsWith("image/"))return"image";if(e.startsWith("video/"))return"video";if(e.startsWith("application/pdf"))return"pdf";if(e.startsWith("application/epub"))return"epub";if(e.startsWith("application/x-mobipocket-ebook"))return"mobi";if(e.startsWith("application/zip"))return"zip";if(e.startsWith("application/json"))return"json";if(e.startsWith("application/jsonl"))return"jsonl";if(e.startsWith("text/csv"))return"csv";if(e.startsWith("text/plain"))return"txt"}function F7e({id:e,path:t,onClose:r,dataSource:n,style:i,className:a,loading:o,onDownload:s,pageSize:l=50,pageNo:u=1,onPathCorrection:c,showGoParent:Q,showPagination:T=!0,onChange:f,closeable:h=!1,showOpenInNewTab:m=!1,onOpenInNewTab:g,renderBucketItem:d,previewUrl:p,showDownload:y=!0,onLinkClick:x,onKeyClick:O}){const v=Xd(t),{t:L}=Jt(),b=!/\.\w+$/.test(v),[S,E]=G.useState(),C=t.split("?")[0],A=G.useMemo(()=>Array.isArray(n)?P7e(n,C):[],[n,C]);G.useEffect(()=>{const W=n?.mimetype;E(W&&b?j7e(W):void 0)},[n,b]),G.useEffect(()=>{const W=te=>{x?.(te.detail.path)};return document.addEventListener("s3-path-click",W),()=>{document.removeEventListener("s3-path-click",W)}},[x]);const[w,M]=G.useState([]),P=w.length>0,N=n,B=N?.path??"",R=N?.size??0,V=ks(B.split("?")[1]),_=V?V.byte+V.size:0,D=Ud(B),Z=_<(R||0),k=G.useMemo(()=>S||Bd(t),[t,S]);G.useEffect(()=>{const W=ks(B);let te=B;Number(W?.byte)===0&&(te=B.split("?")[0]),!(!k||!B||!["jsonl","csv","txt"].includes(k))&&c?.(te)},[k,B,c]);const re=G.useCallback(W=>{f?.({pageNo:W})},[f]);G.useEffect(()=>{M([])},[v]);const oe=!k||!["image","video","audio","zip","jsonl","pdf","epub","mobi"].includes(k),ae=G.useCallback(async()=>{M([...w,V?.byte??0]),f?.({path:D})},[e,D,w,V?.byte,f]),Y=G.useCallback(async()=>{const W=w[w.length-1]??0,te=`${B.split("?")[0]}?bytes=${W},0`;M(w.slice(0,-1)),f?.({path:te})},[e,w,f,B]),X=G.useCallback(W=>{f?.({path:W,pageNo:1})},[e,f]),J=G.useCallback(()=>{let W=t;t.endsWith("/")?W=t.replace(/[^\/]+\/$/,""):W=t.replace(/[^\/]+$/,""),W==="s3://"&&(W=""),f?.({path:W,pageNo:1})},[t,e,f]),ne=G.useMemo(()=>({id:e,path:t,pathType:k,data:N,basename:v,nextable:Z&&!!D,prevable:P,onNext:ae,onPrev:Y,goParent:J,onChange:f,onClose:r,renderBucketItem:d,onDownload:s,dataSource:n,previewUrl:p,onLinkClick:x,onKeyClick:O}),[e,t,k,N,v,Z,D,P,ae,Y,J,r,n,f,d,s,p,x,O]),se=G.useMemo(()=>j.jsxs(j.Fragment,{children:[k!=="folder"&&!!t&&j.jsx(we.Popover,{title:L("renderer.fileInfo"),content:j.jsx(I7e,{size:"small",items:[{label:L("renderer.fileSize"),span:3,children:j.jsx("span",{children:Es.format("fileSize",R)})},{label:L("renderer.author"),span:3,children:j.jsx("span",{children:N?.created_by})},{label:L("renderer.lastModified"),span:3,children:N?.last_modified?Es.format("dateTime",N.last_modified,{style:"YYYY-MM-DD HH:mm:ss"}):""}]}),children:j.jsx(B7e,{})}),Q&&j.jsx(we.Tooltip,{title:L("renderer.returnToParent"),children:j.jsx(we.Button,{size:"small",type:"text",icon:j.jsx(Fh,{}),onClick:J})}),T&&j.jsxs(we.Space.Compact,{size:"small",children:[j.jsx(we.Tooltip,{title:L("renderer.prevPage"),children:j.jsx(we.Button,{disabled:u===1,onClick:()=>{f?.({pageNo:u-1})},icon:j.jsx(Y8,{})})}),j.jsx(N7e,{min:1,readOnly:!0,value:u}),j.jsx(we.Tooltip,{title:L("renderer.nextPage"),children:j.jsx(we.Button,{disabled:o||A.length<Number(l),onClick:()=>{f?.({pageNo:u+1})},icon:j.jsx(tu,{})})})]})]}),[k,t,R,N,e,J,u,o,A.length,l,re,L,n]),I=G.useMemo(()=>j.jsxs(j.Fragment,{children:[m&&j.jsx(we.Tooltip,{title:L("renderer.openInNewTab"),children:j.jsx(we.Button,{type:"text",size:"small",icon:j.jsx(Zh,{}),onClick:()=>g?.(t)})}),k!=="folder"&&y&&j.jsx(we.Tooltip,{title:L("renderer.downloadFile"),children:j.jsx(we.Button,{size:"small",type:"text",icon:j.jsx(Ls,{}),onClick:()=>s?.(C)})}),h&&j.jsxs(j.Fragment,{children:[j.jsx(we.Divider,{type:"vertical"}),j.jsx(we.Tooltip,{title:L("renderer.close"),children:j.jsx(we.Button,{size:"small",type:"text",icon:j.jsx(xs,{}),onClick:r})})]})]}),[k,e,r,u,l,t,C,L,s,y]),z=G.useMemo(()=>{if(C.endsWith("/")||!t)return j.jsx(E7e,{showBodyOnly:!Q,path:t,name:t,value:A,titleExtra:se,extraTail:I,pathWithoutQuery:C,onPathChange:X});if(oe||["jsonl"].includes(k))return j.jsx(O7e,{name:v,type:k||"txt",extraTail:I,titleExtra:se});let W=`${p}?path=${encodeURIComponent(t)}`;return k==="zip"&&(W=t),n&&"content"in n&&n.content&&(W=n.content),j.jsx($7e,{name:v,value:W,type:k,extraTail:I,titleExtra:se})},[v,I,se,A,e,oe,X,t,C,k,n]);return j.jsx(Yd.Provider,{value:ne,children:j.jsxs(V7e,{"data-block-id":e,style:i,className:a,children:[z,j.jsx(R7e,{spinning:!0,indicator:j.jsx(Uh,{spin:!0}),$visible:!!o})]})})}Se.BucketBlock=F7e,Se.FileIcon=Os,Se.I18nContext=m5,Se.I18nProvider=oN,Se.I18nextProvider=md,Se.PAGENATION_CHANGE_EVENT=k7e,Se.PATH_CORRECTION_EVENT=D7e,Se.ThemeContext=Af,Se.ThemeProvider=hse,Se.Trans=uI,Se.TransWithoutContext=Td,Se.Translation=fI,Se.borderRadius=jk,Se.buttonTokens=qk,Se.changeLanguage=sN,Se.colors=qe,Se.composeInitialProps=hd,Se.date=dI,Se.extractBucketName=cN,Se.fileTypeIconMapping=f4,Se.get=v5,Se.getBasename=Xd,Se.getBytes=ks,Se.getDefaults=lu,Se.getI18n=q6,Se.getInitialProps=dd,Se.getNextUrl=Ud,Se.getPathType=Bd,Se.gid=G6,Se.i18n=Ke,Se.initReactI18next=fd,Se.isAudio=Zd,Se.isImage=Fd,Se.isVideo=qd,Se.isZip=zd,Se.number=mI,Se.parseCsv=jd,Se.plural=OI,Se.select=gI,Se.selectOrdinal=yI,Se.setDefaults=sd,Se.setI18n=ud,Se.shadows=Fk,Se.spacing=Mr,Se.time=pI,Se.tokens=Cf,Se.typography=as,Se.useSSR=gd,Se.useTheme=Zk,Se.useTranslation=Jt,Se.withSSR=hI,Se.withTranslation=TI,Object.defineProperty(Se,Symbol.toStringTag,{value:"Module"})});
517
+ `;function j7e(e){if(e.startsWith("image/"))return"image";if(e.startsWith("video/"))return"video";if(e.startsWith("application/pdf"))return"pdf";if(e.startsWith("application/epub"))return"epub";if(e.startsWith("application/x-mobipocket-ebook"))return"mobi";if(e.startsWith("application/zip"))return"zip";if(e.startsWith("application/json"))return"json";if(e.startsWith("application/jsonl"))return"jsonl";if(e.startsWith("text/csv"))return"csv";if(e.startsWith("text/plain"))return"txt"}function F7e({id:e,path:t,onClose:r,dataSource:n,style:i,className:a,loading:o,onDownload:s,pageSize:l=50,pageNo:u=1,onPathCorrection:c,showGoParent:Q,showPagination:T=!0,onChange:f,closeable:h=!1,showOpenInNewTab:m=!1,onOpenInNewTab:g,renderBucketItem:d,previewUrl:p,showDownload:y=!0,onLinkClick:x,onKeyClick:O}){const v=Xd(t),{t:L}=Jt(),b=!/\.\w+$/.test(v),[S,E]=G.useState(),C=t.split("?")[0],A=G.useMemo(()=>Array.isArray(n)?P7e(n,C):[],[n,C]);G.useEffect(()=>{const W=n?.mimetype;E(W&&b?j7e(W):void 0)},[n,b]),G.useEffect(()=>{const W=te=>{x?.(te.detail.path)};return document.addEventListener("s3-path-click",W),()=>{document.removeEventListener("s3-path-click",W)}},[x]);const[w,M]=G.useState([]),P=w.length>0,N=n,B=N?.path??"",R=N?.size??0,V=ks(B.split("?")[1]),_=V?V.byte+V.size:0,D=Ud(B),Z=_<(R||0),k=G.useMemo(()=>S||Bd(t),[t,S]);G.useEffect(()=>{const W=ks(B);let te=B;Number(W?.byte)===0&&(te=B.split("?")[0]),!(!k||!B||!["jsonl","csv","txt"].includes(k))&&c?.(te)},[k,B,c]);const re=G.useCallback(W=>{f?.({pageNo:W})},[f]);G.useEffect(()=>{M([])},[v]);const oe=!k||!["image","video","audio","zip","jsonl","pdf","epub","mobi"].includes(k),ae=G.useCallback(async()=>{M([...w,V?.byte??0]),f?.({path:D})},[e,D,w,V?.byte,f]),Y=G.useCallback(async()=>{const W=w[w.length-1]??0,te=`${B.split("?")[0]}?bytes=${W},0`;M(w.slice(0,-1)),f?.({path:te})},[e,w,f,B]),X=G.useCallback(W=>{f?.({path:W,pageNo:1})},[e,f]),J=G.useCallback(()=>{let W=t;t.endsWith("/")?W=t.replace(/[^\/]+\/$/,""):W=t.replace(/[^\/]+$/,""),W==="s3://"&&(W=""),f?.({path:W,pageNo:1})},[t,e,f]),ne=G.useMemo(()=>({id:e,path:t,pathType:k,data:N,basename:v,nextable:Z&&!!D,prevable:P,onNext:ae,onPrev:Y,goParent:J,onChange:f,onClose:r,renderBucketItem:d,onDownload:s,dataSource:n,previewUrl:p,onLinkClick:x,onKeyClick:O}),[e,t,k,N,v,Z,D,P,ae,Y,J,r,n,f,d,s,p,x,O]),se=G.useMemo(()=>j.jsxs(j.Fragment,{children:[k!=="folder"&&!!t&&j.jsx(we.Popover,{title:L("renderer.fileInfo"),content:j.jsx(I7e,{size:"small",items:[{label:L("renderer.fileSize"),span:3,children:j.jsx("span",{children:Es.format("fileSize",R)})},{label:L("renderer.author"),span:3,children:j.jsx("span",{children:N?.created_by})},{label:L("renderer.lastModified"),span:3,children:N?.last_modified?Es.format("dateTime",N.last_modified,{style:"YYYY-MM-DD HH:mm:ss"}):""}]}),children:j.jsx(B7e,{})}),Q&&j.jsx(we.Tooltip,{title:L("renderer.returnToParent"),children:j.jsx(we.Button,{size:"small",type:"text",icon:j.jsx(Fh,{}),onClick:J})}),T&&j.jsxs(we.Space.Compact,{size:"small",children:[j.jsx(we.Tooltip,{title:L("renderer.prevPage"),children:j.jsx(we.Button,{disabled:u===1,onClick:()=>{f?.({pageNo:u-1})},icon:j.jsx(Y8,{})})}),j.jsx(N7e,{min:1,readOnly:!0,value:u}),j.jsx(we.Tooltip,{title:L("renderer.nextPage"),children:j.jsx(we.Button,{disabled:o||A.length<Number(l),onClick:()=>{f?.({pageNo:u+1})},icon:j.jsx(tu,{})})})]})]}),[k,t,R,N,e,J,u,o,A.length,l,re,L,n]),I=G.useMemo(()=>j.jsxs(j.Fragment,{children:[m&&j.jsx(we.Tooltip,{title:L("renderer.openInNewTab"),children:j.jsx(we.Button,{type:"text",size:"small",icon:j.jsx(Zh,{}),onClick:()=>g?.(t)})}),k!=="folder"&&y&&j.jsx(we.Tooltip,{title:L("renderer.downloadFile"),children:j.jsx(we.Button,{size:"small",type:"text",icon:j.jsx(Ls,{}),onClick:()=>s?.(C)})}),h&&j.jsxs(j.Fragment,{children:[j.jsx(we.Divider,{type:"vertical"}),j.jsx(we.Tooltip,{title:L("renderer.close"),children:j.jsx(we.Button,{size:"small",type:"text",icon:j.jsx(xs,{}),onClick:r})})]})]}),[k,e,r,u,l,t,C,L,s,y]),z=G.useMemo(()=>{if(C.endsWith("/")||!t)return j.jsx(E7e,{showBodyOnly:!Q,path:t,name:t,value:A,titleExtra:se,extraTail:I,pathWithoutQuery:C,onPathChange:X});if(oe||["jsonl"].includes(k))return j.jsx(O7e,{name:v,type:k||"txt",extraTail:I,titleExtra:se});let W=`${p}${p?.includes("?")?"&":"?"}path=${encodeURIComponent(t)}`;return k==="zip"&&(W=t),n&&"content"in n&&n.content&&(W=n.content),j.jsx($7e,{name:v,value:W,type:k,extraTail:I,titleExtra:se})},[v,I,se,A,e,oe,X,t,C,k,n]);return j.jsx(Yd.Provider,{value:ne,children:j.jsxs(V7e,{"data-block-id":e,style:i,className:a,children:[z,j.jsx(R7e,{spinning:!0,indicator:j.jsx(Uh,{spin:!0}),$visible:!!o})]})})}Se.BucketBlock=F7e,Se.FileIcon=Os,Se.I18nContext=m5,Se.I18nProvider=oN,Se.I18nextProvider=md,Se.PAGENATION_CHANGE_EVENT=k7e,Se.PATH_CORRECTION_EVENT=D7e,Se.ThemeContext=Af,Se.ThemeProvider=hse,Se.Trans=uI,Se.TransWithoutContext=Td,Se.Translation=fI,Se.borderRadius=jk,Se.buttonTokens=qk,Se.changeLanguage=sN,Se.colors=qe,Se.composeInitialProps=hd,Se.date=dI,Se.extractBucketName=cN,Se.fileTypeIconMapping=f4,Se.get=v5,Se.getBasename=Xd,Se.getBytes=ks,Se.getDefaults=lu,Se.getI18n=q6,Se.getInitialProps=dd,Se.getNextUrl=Ud,Se.getPathType=Bd,Se.gid=G6,Se.i18n=Ke,Se.initReactI18next=fd,Se.isAudio=Zd,Se.isImage=Fd,Se.isVideo=qd,Se.isZip=zd,Se.number=mI,Se.parseCsv=jd,Se.plural=OI,Se.select=gI,Se.selectOrdinal=yI,Se.setDefaults=sd,Se.setI18n=ud,Se.shadows=Fk,Se.spacing=Mr,Se.time=pI,Se.tokens=Cf,Se.typography=as,Se.useSSR=gd,Se.useTheme=Zk,Se.useTranslation=Jt,Se.withSSR=hI,Se.withTranslation=TI,Object.defineProperty(Se,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vis3/kit",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "scripts": {
5
5
  "build": "vite build && tsc -d --emitDeclarationOnly",
6
6
  "clean": "rimraf ./node_modules",