@aiquants/directory-tree 1.11.0 → 1.12.0
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.cjs +2 -2
- package/dist/index.js +90 -89
- package/dist/src/DirectoryTree.d.ts.map +1 -1
- package/dist/src/types.d.ts +10 -0
- package/dist/src/types.d.ts.map +1 -1
- package/dist/tests/test-setup.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/src/test-setup.d.ts.map +0 -1
- /package/dist/{src → tests}/test-setup.d.ts +0 -0
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react"),Be=require("@aiquants/virtualscroll"),ye=require("@heroicons/react/24/solid"),He=require("@phosphor-icons/react"),A=require("tailwind-merge");var me={exports:{}},ie={};var _e;function We(){if(_e)return ie;_e=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function a(l,n,o){var i=null;if(o!==void 0&&(i=""+o),n.key!==void 0&&(i=""+n.key),"key"in n){o={};for(var y in n)y!=="key"&&(o[y]=n[y])}else o=n;return n=o.ref,{$$typeof:e,type:l,key:i,ref:n!==void 0?n:null,props:o}}return ie.Fragment=r,ie.jsx=a,ie.jsxs=a,ie}var ce={};var Pe;function Ve(){return Pe||(Pe=1,process.env.NODE_ENV!=="production"&&(function(){function e(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===J?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case s:return"Fragment";case _:return"Profiler";case m:return"StrictMode";case L:return"Suspense";case k:return"SuspenseList";case N:return"Activity"}if(typeof t=="object")switch(typeof t.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case u:return"Portal";case E:return t.displayName||"Context";case P:return(t._context.displayName||"Context")+".Consumer";case f:var h=t.render;return t=t.displayName,t||(t=h.displayName||h.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case M:return h=t.displayName||null,h!==null?h:e(t.type)||"Memo";case j:h=t._payload,t=t._init;try{return e(t(h))}catch{}}return null}function r(t){return""+t}function a(t){try{r(t);var h=!1}catch{h=!0}if(h){h=console;var w=h.error,T=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return w.call(h,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",T),r(t)}}function l(t){if(t===s)return"<>";if(typeof t=="object"&&t!==null&&t.$$typeof===j)return"<...>";try{var h=e(t);return h?"<"+h+">":"<...>"}catch{return"<...>"}}function n(){var t=Y.A;return t===null?null:t.getOwner()}function o(){return Error("react-stack-top-frame")}function i(t){if(F.call(t,"key")){var h=Object.getOwnPropertyDescriptor(t,"key").get;if(h&&h.isReactWarning)return!1}return t.key!==void 0}function y(t,h){function w(){G||(G=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",h))}w.isReactWarning=!0,Object.defineProperty(t,"key",{get:w,configurable:!0})}function x(){var t=e(this.type);return K[t]||(K[t]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),t=this.props.ref,t!==void 0?t:null}function p(t,h,w,T,te,ae){var C=w.ref;return t={$$typeof:I,type:t,key:h,props:w,_owner:T},(C!==void 0?C:null)!==null?Object.defineProperty(t,"ref",{enumerable:!1,get:x}):Object.defineProperty(t,"ref",{enumerable:!1,value:null}),t._store={},Object.defineProperty(t._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(t,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(t,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:te}),Object.defineProperty(t,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ae}),Object.freeze&&(Object.freeze(t.props),Object.freeze(t)),t}function c(t,h,w,T,te,ae){var C=h.children;if(C!==void 0)if(T)if(B(C)){for(T=0;T<C.length;T++)g(C[T]);Object.freeze&&Object.freeze(C)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else g(C);if(F.call(h,"key")){C=e(t);var z=Object.keys(h).filter(function(pe){return pe!=="key"});T=0<z.length?"{key: someKey, "+z.join(": ..., ")+": ...}":"{key: someKey}",Z[C+T]||(z=0<z.length?"{"+z.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
2
|
let props = %s;
|
|
3
3
|
<%s {...props} />
|
|
4
4
|
React keys must be passed directly to JSX without using spread:
|
|
5
5
|
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,T,C,z,C),Z[C+T]=!0)}if(C=null,w!==void 0&&(a(w),C=""+w),i(h)&&(a(h.key),C=""+h.key),"key"in h){w={};for(var oe in h)oe!=="key"&&(w[oe]=h[oe])}else w=h;return C&&y(w,typeof t=="function"?t.displayName||t.name||"Unknown":t),p(t,C,w,n(),te,ae)}function g(t){b(t)?t._store&&(t._store.validated=1):typeof t=="object"&&t!==null&&t.$$typeof===j&&(t._payload.status==="fulfilled"?b(t._payload.value)&&t._payload.value._store&&(t._payload.value._store.validated=1):t._store&&(t._store.validated=1))}function b(t){return typeof t=="object"&&t!==null&&t.$$typeof===I}var v=d,I=Symbol.for("react.transitional.element"),u=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),m=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),P=Symbol.for("react.consumer"),E=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),N=Symbol.for("react.activity"),J=Symbol.for("react.client.reference"),Y=v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=Object.prototype.hasOwnProperty,B=Array.isArray,V=console.createTask?console.createTask:function(){return null};v={react_stack_bottom_frame:function(t){return t()}};var G,K={},ee=v.react_stack_bottom_frame.bind(v,o)(),$=V(l(o)),Z={};ie.Fragment=s,ie.jsx=function(t,h,w){var T=1e4>Y.recentlyCreatedOwnerStacks++;return c(t,h,w,!1,T?Error("react-stack-top-frame"):ee,T?V(l(t)):$)},ie.jsxs=function(t,h,w){var T=1e4>Y.recentlyCreatedOwnerStacks++;return c(t,h,w,!0,T?Error("react-stack-top-frame"):ee,T?V(l(t)):$)}})()),ie}var Te;function Ve(){return Te||(Te=1,process.env.NODE_ENV==="production"?me.exports=He():me.exports=We()),me.exports}var R=Ve();const Xe=(e,r,a)=>{const l=[];for(let n=r;n<a;n++){const o=e[n];if(!(!o||o.length===0))for(const i of o)l.push(i)}return l},qe=(e,r,a)=>{const l=[];for(let n=r;n<a;n++){const o=e[n];if(!(!o||o.length===0))for(const i of o)l.push(i)}return l},Je=(e,r,a,l)=>{const n=Math.max(1,Math.floor(r*l)),o=Math.max(1,Math.floor(a*l));(e.width!==n||e.height!==o)&&(e.width=n,e.height=o);const i=e.style;i.width!==`${r}px`&&(i.width=`${r}px`),i.height!==`${a}px`&&(i.height=`${a}px`)},Ge=(e,r,a)=>{e.lineWidth=a,e.beginPath();for(const l of r)e.moveTo(l.x1,l.y1),e.lineTo(l.x2,l.y2);e.stroke()},ze=(e,r)=>{const a=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!a)return null;let l=a[1];l.length===3&&(l=l.split("").map(y=>y+y).join(""));const n=Number.parseInt(l.slice(0,2),16),o=Number.parseInt(l.slice(2,4),16),i=Number.parseInt(l.slice(4,6),16);return`rgba(${n}, ${o}, ${i}, ${r})`},Ue=(e,r,a,l)=>{if(r.length===0)return;const n=ze(a,.14),o=e.strokeStyle,i=e.fillStyle,y=e.lineWidth,x=e.lineCap,p=e.lineJoin;e.strokeStyle=a,e.lineCap="round",e.lineJoin="round";for(const c of r){const g=l??c.size,b=Math.max(0,g/2),v=Math.max(1,Math.round(g*.08)),I=Math.max(1,Math.round(g*.14)),u=Math.max(0,b-v*.8),s=Math.max(0,u*.55);n&&(e.fillStyle=n,e.beginPath(),e.arc(c.centerX,c.centerY,u,0,Math.PI*2),e.fill()),e.lineWidth=v,e.beginPath(),e.arc(c.centerX,c.centerY,Math.max(0,b-v*.3),0,Math.PI*2),e.stroke(),e.lineWidth=I,e.beginPath(),e.moveTo(c.centerX-s,c.centerY),e.lineTo(c.centerX+s,c.centerY),e.stroke(),c.isExpanded||(e.beginPath(),e.moveTo(c.centerX,c.centerY-s),e.lineTo(c.centerX,c.centerY+s),e.stroke())}e.strokeStyle=o,e.fillStyle=i,e.lineWidth=y,e.lineCap=x,e.lineJoin=p},Me=d.memo(({segmentsByItem:e,glyphsByItem:r,itemHeight:a,width:l,viewportHeight:n,scrollPosition:o,color:i="#a0aec0",strokeWidth:y=1,renderStartIndex:x,renderEndIndex:p,lookaheadEndIndex:c,devicePixelRatio:g,expandGlyphColor:b,expandGlyphSize:v})=>{const I=d.useRef(null),u=d.useRef(null),s=d.useRef({segmentsByItem:e,glyphsByItem:r,itemHeight:a,width:l,viewportHeight:n,scrollPosition:o,color:i,strokeWidth:y,renderStartIndex:x,renderEndIndex:p,lookaheadEndIndex:c,devicePixelRatio:g,expandGlyphColor:b,expandGlyphSize:v}),m=d.useCallback(()=>{u.current=null;const P=I.current;if(!P)return;const E=P.getContext("2d");if(!E)return;const f=s.current;if(f.width<=0||f.viewportHeight<=0){E.clearRect(0,0,P.width,P.height);return}const L=Number.isFinite(f.devicePixelRatio??NaN)?f.devicePixelRatio:typeof window<"u"&&window.devicePixelRatio||1;Je(P,f.width,f.viewportHeight,L);const k=f.segmentsByItem.length,M=typeof f.renderStartIndex=="number"&&Number.isFinite(f.renderStartIndex)?Math.max(0,Math.floor(f.renderStartIndex)):Math.max(0,Math.floor(f.scrollPosition/f.itemHeight)),j=Math.min(k,Math.ceil((f.scrollPosition+f.viewportHeight)/f.itemHeight)),N=(()=>{if(typeof f.renderEndIndex=="number"&&Number.isFinite(f.renderEndIndex)){const B=Math.floor(f.renderEndIndex);return Math.max(Math.min(k,B+1),M)}return Math.max(j,M)})(),J=(()=>{if(typeof f.lookaheadEndIndex=="number"&&Number.isFinite(f.lookaheadEndIndex)){const B=Math.floor(f.lookaheadEndIndex),V=Math.min(k,B+1);return Math.max(V,N)}return Math.max(j,N)})(),Y=Xe(f.segmentsByItem,M,J),F=qe(f.glyphsByItem,M,J);E.save(),E.scale(L,L),E.clearRect(0,0,f.width,f.viewportHeight),E.translate(0,-f.scrollPosition),E.strokeStyle=f.color,Ge(E,Y,f.strokeWidth),Ue(E,F,f.expandGlyphColor??f.color,f.expandGlyphSize),E.restore()},[]),_=d.useCallback(()=>{u.current===null&&(u.current=window.requestAnimationFrame(m))},[m]);return d.useEffect(()=>{s.current={segmentsByItem:e,glyphsByItem:r,itemHeight:a,width:l,viewportHeight:n,scrollPosition:o,color:i,strokeWidth:y,renderStartIndex:x,renderEndIndex:p,lookaheadEndIndex:c,devicePixelRatio:g,expandGlyphColor:b,expandGlyphSize:v},_()},[e,r,a,l,n,o,i,y,x,p,c,g,b,v,_]),d.useEffect(()=>()=>{u.current!==null&&(window.cancelAnimationFrame(u.current),u.current=null)},[]),R.jsx("canvas",{ref:I,className:"pointer-events-none absolute top-0 left-0 z-0"})});Me.displayName="TreeLineCanvas";const O={container:"directory-tree-container relative h-full transition-opacity duration-300 overflow-y-hidden pb-[5px] pr-[3px]",containerPending:"opacity-70",entry:"directory-tree-entry flex items-center cursor-pointer relative select-none",entryHover:A.twMerge("directory-tree-entry--hover hover:bg-gray-400/15","dark:hover:bg-gray-200/10"),entrySelected:A.twMerge("directory-tree-entry--selected bg-blue-400/10","dark:bg-blue-400/15"),entryItemSelected:A.twMerge("directory-tree-entry--item-selected bg-blue-400/20 shadow-[0_0_0_1px_rgba(59,130,246,0.3)]","dark:bg-blue-400/25 dark:shadow-[0_0_0_1px_rgba(96,165,250,0.4)]"),expandIcon:A.twMerge("directory-tree-expand-icon w-5 h-5 flex-shrink-0 flex items-center justify-center","text-gray-500","dark:text-gray-400"),expandIconSelected:A.twMerge("directory-tree-expand-icon--selected text-blue-700","dark:text-blue-400"),typeIcon:A.twMerge("directory-tree-type-icon w-5 h-5 flex-shrink-0 flex items-center justify-center","text-gray-500","dark:text-gray-400"),typeIconSelected:A.twMerge("directory-tree-type-icon--selected text-blue-700","dark:text-blue-400"),name:A.twMerge("directory-tree-name overflow-hidden text-ellipsis whitespace-nowrap ml-1","text-gray-700","dark:text-gray-200"),nameDirectory:"directory-tree-name--directory",nameSelected:A.twMerge("directory-tree-name--selected text-blue-800 font-medium","dark:text-blue-300")},Ze={msOverflowStyle:"none",scrollbarWidth:"none"},Qe=()=>{let e=document.getElementById("directory-tree-webkit-scrollbar-hide");e||(e=document.createElement("style"),e.id="directory-tree-webkit-scrollbar-hide",e.textContent=".directory-tree-container::-webkit-scrollbar { display: none; }",document.head.appendChild(e))},Ke=(e,r,a,l)=>{const n=[],o=[];let i=0;const y=(x,p,c)=>{for(let g=0;g<x.length;g++){const b=x[g],v=g===x.length-1,I=[...c,v],u=b.children!==void 0,s=u&&r(b.absolutePath,b.relativePath);let m=p,_=I,P=c;l&&(m=p-1,_=I.slice(1),P=c.slice(1)),n.push({entry:b,indentLevel:m,parentIsLast:_}),a&&(m>i&&(i=m),o.push({id:b.absolutePath,name:b.name,absolutePath:b.absolutePath,indentLevel:m,isLastChild:v,isDirectory:u,isExpanded:s,ancestorIsLast:[...P],hideLines:l&&p===0})),u&&s&&b.children&&y(b.children,p+1,I)}};return y(e,0,[]),{flatItems:n,lineItems:o,maxIndent:i}},et=(e,r,a,l,n)=>{const o=l?.renderStart??Math.max(0,Math.floor(n/ne)),i=r>0?Math.ceil(r/ne)+a:a,y=e>0?Math.min(e-1,o+i):o,x=l?.renderEnd??y,p=e>0?Math.min(e-1,x+a):x;return{renderStart:o,renderEnd:x,lookaheadEnd:p}},tt=({isDirectory:e,isExpanded:r,showExpandIcons:a,useCanvasExpandIcons:l,expandIconSize:n})=>{const o=n?{width:n,height:n}:void 0,i=n?"":"h-4 w-4";return!(a&&e)||l?R.jsx("span",{className:i,style:o,"aria-hidden":"true"}):r?R.jsx(ye.ChevronDownIcon,{className:i,style:o}):R.jsx(ye.ChevronRightIcon,{className:i,style:o})},rt=Ye.VirtualScroll,nt=e=>e.slice((e.lastIndexOf(".")-1>>>0)+2).toLowerCase(),at=(e,r,a,l,n)=>{if(e.length===0)return{segmentsByItem:[],glyphsByItem:[]};const o=Array.from({length:e.length},()=>[]),i=Array.from({length:e.length},()=>[]),y=l?typeof n=="number"&&Number.isFinite(n)&&n>0?n:Math.max(8,Math.min(a*.9,r*.7)):0,x=3;for(let p=0;p<e.length;p++){const c=e[p];if(c.hideLines)continue;const g=[],b=p*r,v=b+r/2,I=y>0?y/2+2:a/1.5;for(let m=0;m<c.indentLevel;m++){if(c.ancestorIsLast[m]??!1)continue;let P=!1;for(let E=p;E<e.length;E++){const f=e[E];if(f.indentLevel>m&&f.ancestorIsLast.length>m&&!f.ancestorIsLast[m]){P=!0;break}if(E>p&&f.indentLevel===m)break}if(P){const E=m*a+a/2+x;g.push({key:`${c.id}-ancestor-${m}`,x1:E,y1:b,x2:E,y2:b+r,itemIndex:p})}}const u=c.indentLevel*a,s=u+a/2+x;if(c.isDirectory?g.push({key:`${c.id}-connector-top`,x1:s,y1:b,x2:s,y2:v-I,itemIndex:p}):g.push({key:`${c.id}-connector-top`,x1:s,y1:b,x2:s,y2:v,itemIndex:p}),!c.isDirectory&&c.isLastChild&&g.push({key:`${c.id}-connector-horizontal`,x1:s,y1:v,x2:u+a+x,y2:v,itemIndex:p}),c.isLastChild||(c.isDirectory?g.push({key:`${c.id}-connector-bottom`,x1:s,y1:v+I,x2:s,y2:b+r,itemIndex:p}):g.push({key:`${c.id}-connector-bottom`,x1:s,y1:v,x2:s,y2:b+r,itemIndex:p})),o[p]=g,l&&c.isDirectory){const m=y,_=s,P=v;i[p]=[{key:`${c.id}-glyph`,itemIndex:p,centerX:_,centerY:P,size:m,isExpanded:c.isExpanded}]}}return{segmentsByItem:o,glyphsByItem:i}},ge=(e,r)=>{if(e==null||typeof e=="boolean")return null;if(typeof e=="function")return console.warn(`[DirectoryTree] Function returned by renderer for "${r}". Return a node.`),null;if(typeof e=="object"){if("then"in e)return console.warn(`[DirectoryTree] Promise returned for "${r}". Not supported.`),null;if(Array.isArray(e)){const l=e.map(n=>ge(n,r)).filter(Boolean);return l.length?l:null}const a=e.type;if(a&&a.$$typeof===Symbol.for("react.lazy"))return console.warn(`[DirectoryTree] Lazy component for "${r}". Not supported.`),null}return e},ot=(e,r)=>{const{entry:a,isDirectory:l,isExpanded:n,extension:o}=e;let i;return a.icon!==void 0?i=a.icon:l?i=n&&r?.directoryExpanded||r?.directory||R.jsx(ye.FolderIcon,{className:"h-4 w-4"}):o&&r?.fileByExtension?.[o]?i=r.fileByExtension[o]:i=r?.file||(o==="md"?R.jsx(ye.DocumentTextIcon,{className:"h-4 w-4"}):R.jsx(Be.FileIcon,{className:"h-4 w-4"})),ge(typeof i=="function"?i(e):i,a.absolutePath)},ve=d.memo(({entry:e,indentLevel:r,isDirOpen:a,parentIsLast:l,renderChildren:n=!0,expansion:{toggleDirectory:o,onToggleDirectoryRecursive:i},selection:{onFileSelect:y,selectedPath:x,mode:p="none",selectedItems:c,onSelectionChange:g},visual:{iconOverrides:b,showExpandIcons:v=!0,showDirectoryIcons:I=!0,showFileIcons:u=!0,useCanvasExpandIcons:s=!1,expandIconSize:m}})=>{const _=d.useRef(null),[P,E]=d.useState(null),[f,L]=d.useState(!1);d.useEffect(()=>()=>{_.current&&window.clearTimeout(_.current)},[]);const k=e.children!==void 0,M=k&&a(e.absolutePath,e.relativePath),j=e.absolutePath===x,N=!k&&c?.has(e.absolutePath),J=k?void 0:nt(e.name);d.useEffect(()=>{E(M&&e.children?e.children:null)},[M,e.children]);const Y=d.useCallback($=>{if($.stopPropagation(),p!=="none"&&!k&&g&&g(e.absolutePath,!N),!k)return y(e.absolutePath,e.relativePath);_.current?(window.clearTimeout(_.current),_.current=null,i(e)):_.current=window.setTimeout(()=>{o(e.absolutePath,e.relativePath),_.current=null},500)},[k,e,i,o,y,p,g,N]),F=A.twMerge(O.entry,f&&O.entryHover,j&&O.entrySelected,N&&O.entryItemSelected),B=A.twMerge(O.expandIcon,(j||N)&&O.expandIconSelected),V=A.twMerge(O.typeIcon,(j||N)&&O.typeIconSelected),G=A.twMerge(O.name,k&&O.nameDirectory,(j||N)&&O.nameSelected),K=tt({isDirectory:k,isExpanded:M,showExpandIcons:v,useCanvasExpandIcons:s,expandIconSize:m}),ee=(k?I:u)?ot({entry:e,isDirectory:k,isExpanded:M,isSelected:j,isItemSelected:!!N,extension:J},b):null;return R.jsxs(d.Fragment,{children:[R.jsxs("div",{className:F,style:{paddingLeft:`${Math.max(0,r*ce)}px`,transform:r<0?`translateX(${r*ce}px)`:void 0,width:r<0?`calc(100% + ${Math.abs(r*ce)}px)`:void 0,height:`${ne}px`},"data-entry-type":k?"directory":"file","data-entry-expanded":k?String(M):void 0,"data-entry-selected":j?"true":void 0,"data-entry-item-selected":N?"true":void 0,onClick:Y,onMouseEnter:()=>L(!0),onMouseLeave:()=>L(!1),onKeyDown:$=>$.key==="Enter"&&Y($),tabIndex:0,role:"treeitem","aria-expanded":k?M:void 0,"aria-label":`${e.name} (${k?"directory":"file"})`,children:[(v||s)&&R.jsx("span",{className:B,children:K}),(k?I:u)&&R.jsx("span",{className:V,children:ee}),R.jsx("span",{className:G,"data-entry-type":k?"directory":"file","data-entry-role":"name",children:e.label??e.name})]}),M&&P&&n&&R.jsx("fieldset",{children:P.map(($,Z)=>R.jsx(ve,{entry:$,indentLevel:r+1,isDirOpen:a,parentIsLast:[...l,Z===P.length-1],expansion:{toggleDirectory:o,onToggleDirectoryRecursive:i},selection:{onFileSelect:y,selectedPath:x,mode:p,selectedItems:c,onSelectionChange:g},visual:{iconOverrides:b,showExpandIcons:v,showDirectoryIcons:I,showFileIcons:u,useCanvasExpandIcons:s,expandIconSize:m}},$.absolutePath))})]},e.absolutePath)},(e,r)=>{if(e.entry!==r.entry)return!1;const a=e.entry.children!==void 0,l=r.entry.children!==void 0,n=a&&e.isDirOpen(e.entry.absolutePath,e.entry.relativePath),o=l&&r.isDirOpen(r.entry.absolutePath,r.entry.relativePath);return e.indentLevel===r.indentLevel&&n===o&&e.selection.selectedPath===r.selection.selectedPath&&e.selection.mode===r.selection.mode&&e.selection.selectedItems===r.selection.selectedItems&&e.visual.iconOverrides===r.visual.iconOverrides&&e.visual.showExpandIcons===r.visual.showExpandIcons&&e.visual.showDirectoryIcons===r.visual.showDirectoryIcons&&e.visual.showFileIcons===r.visual.showFileIcons&&e.visual.useCanvasExpandIcons===r.visual.useCanvasExpandIcons&&e.visual.expandIconSize===r.visual.expandIconSize&&e.parentIsLast.length===r.parentIsLast.length&&e.parentIsLast.every((i,y)=>i===r.parentIsLast[y])});ve.displayName="DirectoryEntryItem";const ne=20,ce=16,Ce=12,Ne=e=>{const r=[];if(e.children)for(const a of e.children)a.type==="directory"&&(r.push(a.absolutePath),r.push(...Ne(a)));return r},st=({entries:e,expansion:{toggle:r,isExpanded:a,expandMultiple:l,collapseMultiple:n,isPending:o,alwaysExpanded:i=!1,doubleClickAction:y="recursive"},selection:{onFileSelect:x,selectedPath:p,mode:c="none",selectedItems:g,onSelectionChange:b},visual:{className:v,style:I,lineColor:u="#A0AEC0",showTreeLines:s=!0,showExpandIcons:m=!0,showDirectoryIcons:_=!0,showFileIcons:P=!0,iconOverrides:E,expandIconSize:f,removeRootIndent:L=!1}={},virtualScroll:k})=>{const[M,j]=d.useState(!1),N=d.useRef(null),J=d.useRef(null),[Y,F]=d.useState(0),[B,V]=d.useState(null),{overscanCount:G=15,className:K,background:ee,onScroll:$,onRangeChange:Z,initialScrollIndex:t,initialScrollOffset:h,tapScrollCircleOptions:w,scrollBarWidth:T,enableThumbDrag:te,enableTrackClick:ae,enableArrowButtons:C,enablePointerDrag:z,callbackThrottleMs:oe=5,inertiaOptions:pe,contentInsets:je,onItemFocus:Oe,viewportHeightOverride:H,enableScrollToTopBottomButtons:Ae}=k??{},[ue,xe]=d.useState(typeof h=="number"?h:0),$e=d.useCallback((S,X)=>{xe(S),$?.(S,X)},[$]),De=d.useCallback((S,X,W,D,q,se)=>{V(U=>U&&U.renderStart===S&&U.renderEnd===X?U:{renderStart:S,renderEnd:X}),Z?.(S,X,W,D,q,se)},[Z]);d.useEffect(()=>{typeof h=="number"&&xe(h)},[h]),d.useEffect(()=>{j(!0),Qe()},[]),d.useEffect(()=>{if(typeof H=="number"){F(D=>Math.abs(D-H)>1?H:D);return}const S=N.current;if(!S)return F(0);(()=>{const D=S.clientHeight;F(q=>Math.abs(q-D)>1?D:q)})();const W=new ResizeObserver(D=>{for(const q of D)q.target===S&&F(se=>Math.abs(se-q.contentRect.height)>1?q.contentRect.height:se)});return W.observe(S),()=>W.disconnect()},[H]);const Q=typeof H=="number"?H:Y,re=d.useCallback((S,X)=>i||(M?a(S):!1),[M,a,i]),Ee=A.twMerge(O.container,o&&O.containerPending,v),ke=d.useMemo(()=>({...Ze,...I??{},...typeof H=="number"?{height:H,minHeight:H}:{}}),[I,H]),Le=d.useCallback((S,X)=>{const W=[S.absolutePath,...Ne(S)],D=X||y;if(W.every(U=>re(U)))return n(W);if(W.every(U=>!re(U))||D==="recursive")return l(W);if(D==="toggle")return n(W);console.warn(`[DirectoryTree] Unknown double click action: ${D}. No action taken.`)},[re,l,n,y]),{flatItems:de,lineItems:be,maxIndent:we}=d.useMemo(()=>Ke(e,re,s,L),[e,re,s,L]),fe=d.useMemo(()=>!s||be.length===0?{segmentsByItem:[],glyphsByItem:[]}:at(be,ne,ce,s,f??Ce),[be,s,f]),he=d.useMemo(()=>!s||e.length===0?0:(we+2)*ce,[e.length,we,s]),{renderStart:Se,renderEnd:Ie,lookaheadEnd:Re}=d.useMemo(()=>et(de.length,Q,G,B,ue),[de.length,Q,G,B,ue]),Fe=d.useMemo(()=>!s||he<=0||Q<=0||fe.segmentsByItem.length===0?null:R.jsx("div",{className:"pointer-events-none absolute inset-0 z-0","aria-hidden":"true",children:R.jsx("div",{className:"absolute top-0 left-0",style:{width:he,height:Q},children:R.jsx(Me,{segmentsByItem:fe.segmentsByItem,glyphsByItem:fe.glyphsByItem,itemHeight:ne,width:he,viewportHeight:Q,scrollPosition:ue,color:u,expandGlyphColor:u,expandGlyphSize:f??Ce,renderStartIndex:Se,renderEndIndex:Ie,lookaheadEndIndex:Re})})}),[he,Q,Se,Ie,Re,ue,fe,u,s,f]);return e.length===0?R.jsx("div",{className:Ee,style:ke}):R.jsx("div",{ref:N,className:Ee,style:ke,role:"tree",children:R.jsx(rt,{ref:J,itemCount:de.length,getItem:S=>de[S],getItemHeight:()=>ne,viewportSize:Q,overscanCount:G,onScroll:$e,onRangeChange:De,className:K,background:R.jsxs(R.Fragment,{children:[Fe,ee]}),initialScrollIndex:t,initialScrollOffset:h,tapScrollCircleOptions:w,scrollBarWidth:T,enableThumbDrag:te,enableTrackClick:ae,enableArrowButtons:C,onItemFocus:Oe,enablePointerDrag:z,callbackThrottleMs:oe,inertiaOptions:pe,contentInsets:je,enableScrollToTopBottomButtons:Ae,children:S=>S&&R.jsx(ve,{entry:S.entry,indentLevel:S.indentLevel,isDirOpen:re,parentIsLast:S.parentIsLast,renderChildren:!1,expansion:{toggleDirectory:r,onToggleDirectoryRecursive:Le},selection:{onFileSelect:x,selectedPath:p??null,mode:c,selectedItems:g,onSelectionChange:b},visual:{iconOverrides:E,showExpandIcons:m,showDirectoryIcons:_,showFileIcons:P,useCanvasExpandIcons:s,expandIconSize:f}},S.entry.absolutePath)})})},lt=({initialExpanded:e=new Set,storageKey:r}={})=>{const[a,l]=d.useTransition(),[n,o]=d.useState(()=>{if(typeof window<"u"&&r)try{const u=window.localStorage.getItem(r);if(u){const s=JSON.parse(u);return new Set(s)}}catch(u){console.error("[useDirectoryTreeState] Error reading from localStorage",u)}return e}),i=d.useCallback(u=>{l(()=>{o(s=>{const m=new Set(s);return u(m),m})})},[]),y=d.useCallback((u,s)=>{i(m=>{for(const _ of u)s(m,_)})},[i]);d.useEffect(()=>{if(r&&typeof window<"u")try{window.localStorage.setItem(r,JSON.stringify(Array.from(n)))}catch(u){console.warn(`Error setting localStorage key "${r}":`,u)}},[n,r]);const x=d.useCallback(u=>{y([u],(s,m)=>{s.has(m)?s.delete(m):s.add(m)})},[y]),p=d.useCallback(u=>{y([u],(s,m)=>{s.add(m)})},[y]),c=d.useCallback(u=>{y([u],(s,m)=>{s.delete(m)})},[y]),g=d.useCallback(u=>{y(u,(s,m)=>{s.delete(m)})},[y]),b=d.useCallback(u=>{y(u,(s,m)=>{s.add(m)})},[y]),v=d.useCallback(()=>{i(u=>{u.clear()})},[i]),I=d.useCallback(u=>n.has(u),[n]);return{expanded:n,toggle:x,expand:p,collapse:c,collapseMultiple:g,expandMultiple:b,collapseAll:v,isExpanded:I,isPending:a}};exports.DirectoryTree=st;exports.directoryTreeClasses=O;exports.useDirectoryTreeState=lt;
|
|
6
|
+
<%s key={someKey} {...props} />`,T,C,z,C),Z[C+T]=!0)}if(C=null,w!==void 0&&(a(w),C=""+w),i(h)&&(a(h.key),C=""+h.key),"key"in h){w={};for(var oe in h)oe!=="key"&&(w[oe]=h[oe])}else w=h;return C&&y(w,typeof t=="function"?t.displayName||t.name||"Unknown":t),p(t,C,w,n(),te,ae)}function g(t){b(t)?t._store&&(t._store.validated=1):typeof t=="object"&&t!==null&&t.$$typeof===j&&(t._payload.status==="fulfilled"?b(t._payload.value)&&t._payload.value._store&&(t._payload.value._store.validated=1):t._store&&(t._store.validated=1))}function b(t){return typeof t=="object"&&t!==null&&t.$$typeof===I}var v=d,I=Symbol.for("react.transitional.element"),u=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),m=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),P=Symbol.for("react.consumer"),E=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),N=Symbol.for("react.activity"),J=Symbol.for("react.client.reference"),Y=v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=Object.prototype.hasOwnProperty,B=Array.isArray,V=console.createTask?console.createTask:function(){return null};v={react_stack_bottom_frame:function(t){return t()}};var G,K={},ee=v.react_stack_bottom_frame.bind(v,o)(),$=V(l(o)),Z={};ce.Fragment=s,ce.jsx=function(t,h,w){var T=1e4>Y.recentlyCreatedOwnerStacks++;return c(t,h,w,!1,T?Error("react-stack-top-frame"):ee,T?V(l(t)):$)},ce.jsxs=function(t,h,w){var T=1e4>Y.recentlyCreatedOwnerStacks++;return c(t,h,w,!0,T?Error("react-stack-top-frame"):ee,T?V(l(t)):$)}})()),ce}var Te;function Xe(){return Te||(Te=1,process.env.NODE_ENV==="production"?me.exports=We():me.exports=Ve()),me.exports}var R=Xe();const qe=(e,r,a)=>{const l=[];for(let n=r;n<a;n++){const o=e[n];if(!(!o||o.length===0))for(const i of o)l.push(i)}return l},Je=(e,r,a)=>{const l=[];for(let n=r;n<a;n++){const o=e[n];if(!(!o||o.length===0))for(const i of o)l.push(i)}return l},Ge=(e,r,a,l)=>{const n=Math.max(1,Math.floor(r*l)),o=Math.max(1,Math.floor(a*l));(e.width!==n||e.height!==o)&&(e.width=n,e.height=o);const i=e.style;i.width!==`${r}px`&&(i.width=`${r}px`),i.height!==`${a}px`&&(i.height=`${a}px`)},ze=(e,r,a)=>{e.lineWidth=a,e.beginPath();for(const l of r)e.moveTo(l.x1,l.y1),e.lineTo(l.x2,l.y2);e.stroke()},Ue=(e,r)=>{const a=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!a)return null;let l=a[1];l.length===3&&(l=l.split("").map(y=>y+y).join(""));const n=Number.parseInt(l.slice(0,2),16),o=Number.parseInt(l.slice(2,4),16),i=Number.parseInt(l.slice(4,6),16);return`rgba(${n}, ${o}, ${i}, ${r})`},Ze=(e,r,a,l)=>{if(r.length===0)return;const n=Ue(a,.14),o=e.strokeStyle,i=e.fillStyle,y=e.lineWidth,x=e.lineCap,p=e.lineJoin;e.strokeStyle=a,e.lineCap="round",e.lineJoin="round";for(const c of r){const g=l??c.size,b=Math.max(0,g/2),v=Math.max(1,Math.round(g*.08)),I=Math.max(1,Math.round(g*.14)),u=Math.max(0,b-v*.8),s=Math.max(0,u*.55);n&&(e.fillStyle=n,e.beginPath(),e.arc(c.centerX,c.centerY,u,0,Math.PI*2),e.fill()),e.lineWidth=v,e.beginPath(),e.arc(c.centerX,c.centerY,Math.max(0,b-v*.3),0,Math.PI*2),e.stroke(),e.lineWidth=I,e.beginPath(),e.moveTo(c.centerX-s,c.centerY),e.lineTo(c.centerX+s,c.centerY),e.stroke(),c.isExpanded||(e.beginPath(),e.moveTo(c.centerX,c.centerY-s),e.lineTo(c.centerX,c.centerY+s),e.stroke())}e.strokeStyle=o,e.fillStyle=i,e.lineWidth=y,e.lineCap=x,e.lineJoin=p},Me=d.memo(({segmentsByItem:e,glyphsByItem:r,itemHeight:a,width:l,viewportHeight:n,scrollPosition:o,color:i="#a0aec0",strokeWidth:y=1,renderStartIndex:x,renderEndIndex:p,lookaheadEndIndex:c,devicePixelRatio:g,expandGlyphColor:b,expandGlyphSize:v})=>{const I=d.useRef(null),u=d.useRef(null),s=d.useRef({segmentsByItem:e,glyphsByItem:r,itemHeight:a,width:l,viewportHeight:n,scrollPosition:o,color:i,strokeWidth:y,renderStartIndex:x,renderEndIndex:p,lookaheadEndIndex:c,devicePixelRatio:g,expandGlyphColor:b,expandGlyphSize:v}),m=d.useCallback(()=>{u.current=null;const P=I.current;if(!P)return;const E=P.getContext("2d");if(!E)return;const f=s.current;if(f.width<=0||f.viewportHeight<=0){E.clearRect(0,0,P.width,P.height);return}const L=Number.isFinite(f.devicePixelRatio??NaN)?f.devicePixelRatio:typeof window<"u"&&window.devicePixelRatio||1;Ge(P,f.width,f.viewportHeight,L);const k=f.segmentsByItem.length,M=typeof f.renderStartIndex=="number"&&Number.isFinite(f.renderStartIndex)?Math.max(0,Math.floor(f.renderStartIndex)):Math.max(0,Math.floor(f.scrollPosition/f.itemHeight)),j=Math.min(k,Math.ceil((f.scrollPosition+f.viewportHeight)/f.itemHeight)),N=(()=>{if(typeof f.renderEndIndex=="number"&&Number.isFinite(f.renderEndIndex)){const B=Math.floor(f.renderEndIndex);return Math.max(Math.min(k,B+1),M)}return Math.max(j,M)})(),J=(()=>{if(typeof f.lookaheadEndIndex=="number"&&Number.isFinite(f.lookaheadEndIndex)){const B=Math.floor(f.lookaheadEndIndex),V=Math.min(k,B+1);return Math.max(V,N)}return Math.max(j,N)})(),Y=qe(f.segmentsByItem,M,J),F=Je(f.glyphsByItem,M,J);E.save(),E.scale(L,L),E.clearRect(0,0,f.width,f.viewportHeight),E.translate(0,-f.scrollPosition),E.strokeStyle=f.color,ze(E,Y,f.strokeWidth),Ze(E,F,f.expandGlyphColor??f.color,f.expandGlyphSize),E.restore()},[]),_=d.useCallback(()=>{u.current===null&&(u.current=window.requestAnimationFrame(m))},[m]);return d.useEffect(()=>{s.current={segmentsByItem:e,glyphsByItem:r,itemHeight:a,width:l,viewportHeight:n,scrollPosition:o,color:i,strokeWidth:y,renderStartIndex:x,renderEndIndex:p,lookaheadEndIndex:c,devicePixelRatio:g,expandGlyphColor:b,expandGlyphSize:v},_()},[e,r,a,l,n,o,i,y,x,p,c,g,b,v,_]),d.useEffect(()=>()=>{u.current!==null&&(window.cancelAnimationFrame(u.current),u.current=null)},[]),R.jsx("canvas",{ref:I,className:"pointer-events-none absolute top-0 left-0 z-0"})});Me.displayName="TreeLineCanvas";const O={container:"directory-tree-container relative h-full transition-opacity duration-300 overflow-y-hidden pb-[5px] pr-[3px]",containerPending:"opacity-70",entry:"directory-tree-entry flex items-center cursor-pointer relative select-none",entryHover:A.twMerge("directory-tree-entry--hover hover:bg-gray-400/15","dark:hover:bg-gray-200/10"),entrySelected:A.twMerge("directory-tree-entry--selected bg-blue-400/10","dark:bg-blue-400/15"),entryItemSelected:A.twMerge("directory-tree-entry--item-selected bg-blue-400/20 shadow-[0_0_0_1px_rgba(59,130,246,0.3)]","dark:bg-blue-400/25 dark:shadow-[0_0_0_1px_rgba(96,165,250,0.4)]"),expandIcon:A.twMerge("directory-tree-expand-icon w-5 h-5 flex-shrink-0 flex items-center justify-center","text-gray-500","dark:text-gray-400"),expandIconSelected:A.twMerge("directory-tree-expand-icon--selected text-blue-700","dark:text-blue-400"),typeIcon:A.twMerge("directory-tree-type-icon w-5 h-5 flex-shrink-0 flex items-center justify-center","text-gray-500","dark:text-gray-400"),typeIconSelected:A.twMerge("directory-tree-type-icon--selected text-blue-700","dark:text-blue-400"),name:A.twMerge("directory-tree-name overflow-hidden text-ellipsis whitespace-nowrap ml-1","text-gray-700","dark:text-gray-200"),nameDirectory:"directory-tree-name--directory",nameSelected:A.twMerge("directory-tree-name--selected text-blue-800 font-medium","dark:text-blue-300")},Qe={msOverflowStyle:"none",scrollbarWidth:"none"},Ke=()=>{let e=document.getElementById("directory-tree-webkit-scrollbar-hide");e||(e=document.createElement("style"),e.id="directory-tree-webkit-scrollbar-hide",e.textContent=".directory-tree-container::-webkit-scrollbar { display: none; }",document.head.appendChild(e))},et=(e,r,a,l)=>{const n=[],o=[];let i=0;const y=(x,p,c)=>{for(let g=0;g<x.length;g++){const b=x[g],v=g===x.length-1,I=[...c,v],u=b.children!==void 0,s=u&&r(b.absolutePath,b.relativePath);let m=p,_=I,P=c;l&&(m=p-1,_=I.slice(1),P=c.slice(1)),n.push({entry:b,indentLevel:m,parentIsLast:_}),a&&(m>i&&(i=m),o.push({id:b.absolutePath,name:b.name,absolutePath:b.absolutePath,indentLevel:m,isLastChild:v,isDirectory:u,isExpanded:s,ancestorIsLast:[...P],hideLines:l&&p===0})),u&&s&&b.children&&y(b.children,p+1,I)}};return y(e,0,[]),{flatItems:n,lineItems:o,maxIndent:i}},tt=(e,r,a,l,n)=>{const o=l?.renderStart??Math.max(0,Math.floor(n/ne)),i=r>0?Math.ceil(r/ne)+a:a,y=e>0?Math.min(e-1,o+i):o,x=l?.renderEnd??y,p=e>0?Math.min(e-1,x+a):x;return{renderStart:o,renderEnd:x,lookaheadEnd:p}},rt=({isDirectory:e,isExpanded:r,showExpandIcons:a,useCanvasExpandIcons:l,expandIconSize:n})=>{const o=n?{width:n,height:n}:void 0,i=n?"":"h-4 w-4";return!(a&&e)||l?R.jsx("span",{className:i,style:o,"aria-hidden":"true"}):r?R.jsx(ye.ChevronDownIcon,{className:i,style:o}):R.jsx(ye.ChevronRightIcon,{className:i,style:o})},nt=Be.VirtualScroll,at=e=>e.slice((e.lastIndexOf(".")-1>>>0)+2).toLowerCase(),ot=(e,r,a,l,n)=>{if(e.length===0)return{segmentsByItem:[],glyphsByItem:[]};const o=Array.from({length:e.length},()=>[]),i=Array.from({length:e.length},()=>[]),y=l?typeof n=="number"&&Number.isFinite(n)&&n>0?n:Math.max(8,Math.min(a*.9,r*.7)):0,x=3;for(let p=0;p<e.length;p++){const c=e[p];if(c.hideLines)continue;const g=[],b=p*r,v=b+r/2,I=y>0?y/2+2:a/1.5;for(let m=0;m<c.indentLevel;m++){if(c.ancestorIsLast[m]??!1)continue;let P=!1;for(let E=p;E<e.length;E++){const f=e[E];if(f.indentLevel>m&&f.ancestorIsLast.length>m&&!f.ancestorIsLast[m]){P=!0;break}if(E>p&&f.indentLevel===m)break}if(P){const E=m*a+a/2+x;g.push({key:`${c.id}-ancestor-${m}`,x1:E,y1:b,x2:E,y2:b+r,itemIndex:p})}}const u=c.indentLevel*a,s=u+a/2+x;if(c.isDirectory?g.push({key:`${c.id}-connector-top`,x1:s,y1:b,x2:s,y2:v-I,itemIndex:p}):g.push({key:`${c.id}-connector-top`,x1:s,y1:b,x2:s,y2:v,itemIndex:p}),!c.isDirectory&&c.isLastChild&&g.push({key:`${c.id}-connector-horizontal`,x1:s,y1:v,x2:u+a+x,y2:v,itemIndex:p}),c.isLastChild||(c.isDirectory?g.push({key:`${c.id}-connector-bottom`,x1:s,y1:v+I,x2:s,y2:b+r,itemIndex:p}):g.push({key:`${c.id}-connector-bottom`,x1:s,y1:v,x2:s,y2:b+r,itemIndex:p})),o[p]=g,l&&c.isDirectory){const m=y,_=s,P=v;i[p]=[{key:`${c.id}-glyph`,itemIndex:p,centerX:_,centerY:P,size:m,isExpanded:c.isExpanded}]}}return{segmentsByItem:o,glyphsByItem:i}},ge=(e,r)=>{if(e==null||typeof e=="boolean")return null;if(typeof e=="function")return console.warn(`[DirectoryTree] Function returned by renderer for "${r}". Return a node.`),null;if(typeof e=="object"){if("then"in e)return console.warn(`[DirectoryTree] Promise returned for "${r}". Not supported.`),null;if(Array.isArray(e)){const l=e.map(n=>ge(n,r)).filter(Boolean);return l.length?l:null}const a=e.type;if(a&&a.$$typeof===Symbol.for("react.lazy"))return console.warn(`[DirectoryTree] Lazy component for "${r}". Not supported.`),null}return e},st=(e,r)=>{const{entry:a,isDirectory:l,isExpanded:n,extension:o}=e;let i;return a.icon!==void 0?i=a.icon:l?i=n&&r?.directoryExpanded||r?.directory||R.jsx(ye.FolderIcon,{className:"h-4 w-4"}):o&&r?.fileByExtension?.[o]?i=r.fileByExtension[o]:i=r?.file||(o==="md"?R.jsx(ye.DocumentTextIcon,{className:"h-4 w-4"}):R.jsx(He.FileIcon,{className:"h-4 w-4"})),ge(typeof i=="function"?i(e):i,a.absolutePath)},ve=d.memo(({entry:e,indentLevel:r,isDirOpen:a,parentIsLast:l,renderChildren:n=!0,expansion:{toggleDirectory:o,onToggleDirectoryRecursive:i},selection:{onFileSelect:y,selectedPath:x,mode:p="none",selectedItems:c,onSelectionChange:g},visual:{iconOverrides:b,showExpandIcons:v=!0,showDirectoryIcons:I=!0,showFileIcons:u=!0,useCanvasExpandIcons:s=!1,expandIconSize:m}})=>{const _=d.useRef(null),[P,E]=d.useState(null),[f,L]=d.useState(!1);d.useEffect(()=>()=>{_.current&&window.clearTimeout(_.current)},[]);const k=e.children!==void 0,M=k&&a(e.absolutePath,e.relativePath),j=e.absolutePath===x,N=!k&&c?.has(e.absolutePath),J=k?void 0:at(e.name);d.useEffect(()=>{E(M&&e.children?e.children:null)},[M,e.children]);const Y=d.useCallback($=>{if($.stopPropagation(),p!=="none"&&!k&&g&&g(e.absolutePath,!N),!k)return y(e.absolutePath,e.relativePath);_.current?(window.clearTimeout(_.current),_.current=null,i(e)):_.current=window.setTimeout(()=>{o(e.absolutePath,e.relativePath),_.current=null},500)},[k,e,i,o,y,p,g,N]),F=A.twMerge(O.entry,f&&O.entryHover,j&&O.entrySelected,N&&O.entryItemSelected,e.className),B=A.twMerge(O.expandIcon,(j||N)&&O.expandIconSelected),V=A.twMerge(O.typeIcon,(j||N)&&O.typeIconSelected),G=A.twMerge(O.name,k&&O.nameDirectory,(j||N)&&O.nameSelected),K=rt({isDirectory:k,isExpanded:M,showExpandIcons:v,useCanvasExpandIcons:s,expandIconSize:m}),ee=(k?I:u)?st({entry:e,isDirectory:k,isExpanded:M,isSelected:j,isItemSelected:!!N,extension:J},b):null;return R.jsxs(d.Fragment,{children:[R.jsxs("div",{className:F,style:{paddingLeft:`${Math.max(0,r*ue)}px`,transform:r<0?`translateX(${r*ue}px)`:void 0,width:r<0?`calc(100% + ${Math.abs(r*ue)}px)`:void 0,height:`${ne}px`,...e.style},"data-entry-type":k?"directory":"file","data-entry-expanded":k?String(M):void 0,"data-entry-selected":j?"true":void 0,"data-entry-item-selected":N?"true":void 0,onClick:Y,onMouseEnter:()=>L(!0),onMouseLeave:()=>L(!1),onKeyDown:$=>$.key==="Enter"&&Y($),tabIndex:0,role:"treeitem","aria-expanded":k?M:void 0,"aria-label":`${e.name} (${k?"directory":"file"})`,children:[(v||s)&&R.jsx("span",{className:B,children:K}),(k?I:u)&&R.jsx("span",{className:V,children:ee}),R.jsx("span",{className:G,"data-entry-type":k?"directory":"file","data-entry-role":"name",children:e.label??e.name})]}),M&&P&&n&&R.jsx("fieldset",{children:P.map(($,Z)=>R.jsx(ve,{entry:$,indentLevel:r+1,isDirOpen:a,parentIsLast:[...l,Z===P.length-1],expansion:{toggleDirectory:o,onToggleDirectoryRecursive:i},selection:{onFileSelect:y,selectedPath:x,mode:p,selectedItems:c,onSelectionChange:g},visual:{iconOverrides:b,showExpandIcons:v,showDirectoryIcons:I,showFileIcons:u,useCanvasExpandIcons:s,expandIconSize:m}},$.absolutePath))})]},e.absolutePath)},(e,r)=>{if(e.entry!==r.entry)return!1;const a=e.entry.children!==void 0,l=r.entry.children!==void 0,n=a&&e.isDirOpen(e.entry.absolutePath,e.entry.relativePath),o=l&&r.isDirOpen(r.entry.absolutePath,r.entry.relativePath);return e.indentLevel===r.indentLevel&&n===o&&e.selection.selectedPath===r.selection.selectedPath&&e.selection.mode===r.selection.mode&&e.selection.selectedItems===r.selection.selectedItems&&e.visual.iconOverrides===r.visual.iconOverrides&&e.visual.showExpandIcons===r.visual.showExpandIcons&&e.visual.showDirectoryIcons===r.visual.showDirectoryIcons&&e.visual.showFileIcons===r.visual.showFileIcons&&e.visual.useCanvasExpandIcons===r.visual.useCanvasExpandIcons&&e.visual.expandIconSize===r.visual.expandIconSize&&e.parentIsLast.length===r.parentIsLast.length&&e.parentIsLast.every((i,y)=>i===r.parentIsLast[y])});ve.displayName="DirectoryEntryItem";const ne=20,lt=()=>ne,ue=16,Ce=12,Ne=e=>{const r=[];if(e.children)for(const a of e.children)a.type==="directory"&&(r.push(a.absolutePath),r.push(...Ne(a)));return r},it=({entries:e,expansion:{toggle:r,isExpanded:a,expandMultiple:l,collapseMultiple:n,isPending:o,alwaysExpanded:i=!1,doubleClickAction:y="recursive"},selection:{onFileSelect:x,selectedPath:p,mode:c="none",selectedItems:g,onSelectionChange:b},visual:{className:v,style:I,lineColor:u="#A0AEC0",showTreeLines:s=!0,showExpandIcons:m=!0,showDirectoryIcons:_=!0,showFileIcons:P=!0,iconOverrides:E,expandIconSize:f,removeRootIndent:L=!1}={},virtualScroll:k})=>{const[M,j]=d.useState(!1),N=d.useRef(null),J=d.useRef(null),[Y,F]=d.useState(0),[B,V]=d.useState(null),{overscanCount:G=15,className:K,background:ee,onScroll:$,onRangeChange:Z,initialScrollIndex:t,initialScrollOffset:h,tapScrollCircleOptions:w,scrollBarWidth:T,enableThumbDrag:te,enableTrackClick:ae,enableArrowButtons:C,enablePointerDrag:z,callbackThrottleMs:oe=5,inertiaOptions:pe,contentInsets:je,onItemFocus:Oe,viewportHeightOverride:H,enableScrollToTopBottomButtons:Ae}=k??{},[de,xe]=d.useState(typeof h=="number"?h:0),$e=d.useCallback((S,X)=>{xe(S),$?.(S,X)},[$]),De=d.useCallback((S,X,W,D,q,le)=>{V(U=>U&&U.renderStart===S&&U.renderEnd===X?U:{renderStart:S,renderEnd:X}),Z?.(S,X,W,D,q,le)},[Z]);d.useEffect(()=>{typeof h=="number"&&xe(h)},[h]),d.useEffect(()=>{j(!0),Ke()},[]),d.useEffect(()=>{if(typeof H=="number"){F(D=>Math.abs(D-H)>1?H:D);return}const S=N.current;if(!S)return F(0);(()=>{const D=S.clientHeight;F(q=>Math.abs(q-D)>1?D:q)})();const W=new ResizeObserver(D=>{for(const q of D)q.target===S&&F(le=>Math.abs(le-q.contentRect.height)>1?q.contentRect.height:le)});return W.observe(S),()=>W.disconnect()},[H]);const Q=typeof H=="number"?H:Y,re=d.useCallback((S,X)=>i||(M?a(S):!1),[M,a,i]),Ee=A.twMerge(O.container,o&&O.containerPending,v),ke=d.useMemo(()=>({...Qe,...I??{},...typeof H=="number"?{height:H,minHeight:H}:{}}),[I,H]),Le=d.useCallback((S,X)=>{const W=[S.absolutePath,...Ne(S)],D=X||y;if(W.every(U=>re(U)))return n(W);if(W.every(U=>!re(U))||D==="recursive")return l(W);if(D==="toggle")return n(W);console.warn(`[DirectoryTree] Unknown double click action: ${D}. No action taken.`)},[re,l,n,y]),{flatItems:se,lineItems:be,maxIndent:we}=d.useMemo(()=>et(e,re,s,L),[e,re,s,L]),fe=d.useMemo(()=>!s||be.length===0?{segmentsByItem:[],glyphsByItem:[]}:ot(be,ne,ue,s,f??Ce),[be,s,f]),he=d.useMemo(()=>!s||e.length===0?0:(we+2)*ue,[e.length,we,s]),{renderStart:Se,renderEnd:Ie,lookaheadEnd:Re}=d.useMemo(()=>tt(se.length,Q,G,B,de),[se.length,Q,G,B,de]),Fe=d.useMemo(()=>!s||he<=0||Q<=0||fe.segmentsByItem.length===0?null:R.jsx("div",{className:"pointer-events-none absolute inset-0 z-0","aria-hidden":"true",children:R.jsx("div",{className:"absolute top-0 left-0",style:{width:he,height:Q},children:R.jsx(Me,{segmentsByItem:fe.segmentsByItem,glyphsByItem:fe.glyphsByItem,itemHeight:ne,width:he,viewportHeight:Q,scrollPosition:de,color:u,expandGlyphColor:u,expandGlyphSize:f??Ce,renderStartIndex:Se,renderEndIndex:Ie,lookaheadEndIndex:Re})})}),[he,Q,Se,Ie,Re,de,fe,u,s,f]),Ye=d.useCallback(S=>se[S],[se]);return e.length===0?R.jsx("div",{className:Ee,style:ke}):R.jsx("div",{ref:N,className:Ee,style:ke,role:"tree",children:R.jsx(nt,{ref:J,itemCount:se.length,getItem:Ye,getItemHeight:lt,viewportSize:Q,overscanCount:G,onScroll:$e,onRangeChange:De,className:K,background:R.jsxs(R.Fragment,{children:[Fe,ee]}),initialScrollIndex:t,initialScrollOffset:h,tapScrollCircleOptions:w,scrollBarWidth:T,enableThumbDrag:te,enableTrackClick:ae,enableArrowButtons:C,onItemFocus:Oe,enablePointerDrag:z,callbackThrottleMs:oe,inertiaOptions:pe,contentInsets:je,enableScrollToTopBottomButtons:Ae,children:S=>S&&R.jsx(ve,{entry:S.entry,indentLevel:S.indentLevel,isDirOpen:re,parentIsLast:S.parentIsLast,renderChildren:!1,expansion:{toggleDirectory:r,onToggleDirectoryRecursive:Le},selection:{onFileSelect:x,selectedPath:p??null,mode:c,selectedItems:g,onSelectionChange:b},visual:{iconOverrides:E,showExpandIcons:m,showDirectoryIcons:_,showFileIcons:P,useCanvasExpandIcons:s,expandIconSize:f}},S.entry.absolutePath)})})},ct=({initialExpanded:e=new Set,storageKey:r}={})=>{const[a,l]=d.useTransition(),[n,o]=d.useState(()=>{if(typeof window<"u"&&r)try{const u=window.localStorage.getItem(r);if(u){const s=JSON.parse(u);return new Set(s)}}catch(u){console.error("[useDirectoryTreeState] Error reading from localStorage",u)}return e}),i=d.useCallback(u=>{l(()=>{o(s=>{const m=new Set(s);return u(m),m})})},[]),y=d.useCallback((u,s)=>{i(m=>{for(const _ of u)s(m,_)})},[i]);d.useEffect(()=>{if(r&&typeof window<"u")try{window.localStorage.setItem(r,JSON.stringify(Array.from(n)))}catch(u){console.warn(`Error setting localStorage key "${r}":`,u)}},[n,r]);const x=d.useCallback(u=>{y([u],(s,m)=>{s.has(m)?s.delete(m):s.add(m)})},[y]),p=d.useCallback(u=>{y([u],(s,m)=>{s.add(m)})},[y]),c=d.useCallback(u=>{y([u],(s,m)=>{s.delete(m)})},[y]),g=d.useCallback(u=>{y(u,(s,m)=>{s.delete(m)})},[y]),b=d.useCallback(u=>{y(u,(s,m)=>{s.add(m)})},[y]),v=d.useCallback(()=>{i(u=>{u.clear()})},[i]),I=d.useCallback(u=>n.has(u),[n]);return{expanded:n,toggle:x,expand:p,collapse:c,collapseMultiple:g,expandMultiple:b,collapseAll:v,isExpanded:I,isPending:a}};exports.DirectoryTree=it;exports.directoryTreeClasses=O;exports.useDirectoryTreeState=ct;
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { VirtualScroll as
|
|
3
|
-
import { FolderIcon as
|
|
4
|
-
import { FileIcon as
|
|
1
|
+
import Xe, { memo as Me, useRef as se, useCallback as j, useEffect as Z, useState as ee, useMemo as ae, Fragment as Je, useTransition as Ge } from "react";
|
|
2
|
+
import { VirtualScroll as ze } from "@aiquants/virtualscroll";
|
|
3
|
+
import { FolderIcon as Ue, DocumentTextIcon as qe, ChevronDownIcon as Ze, ChevronRightIcon as Qe } from "@heroicons/react/24/solid";
|
|
4
|
+
import { FileIcon as Ke } from "@phosphor-icons/react";
|
|
5
5
|
import { twMerge as M } from "tailwind-merge";
|
|
6
|
-
var ge = { exports: {} },
|
|
6
|
+
var ge = { exports: {} }, fe = {};
|
|
7
7
|
var Ne;
|
|
8
|
-
function
|
|
9
|
-
if (Ne) return
|
|
8
|
+
function et() {
|
|
9
|
+
if (Ne) return fe;
|
|
10
10
|
Ne = 1;
|
|
11
11
|
var e = Symbol.for("react.transitional.element"), r = Symbol.for("react.fragment");
|
|
12
12
|
function o(l, n, a) {
|
|
@@ -24,11 +24,11 @@ function Ke() {
|
|
|
24
24
|
props: a
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
return
|
|
27
|
+
return fe.Fragment = r, fe.jsx = o, fe.jsxs = o, fe;
|
|
28
28
|
}
|
|
29
|
-
var
|
|
29
|
+
var he = {};
|
|
30
30
|
var je;
|
|
31
|
-
function
|
|
31
|
+
function tt() {
|
|
32
32
|
return je || (je = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
33
33
|
function e(t) {
|
|
34
34
|
if (t == null) return null;
|
|
@@ -46,7 +46,7 @@ function et() {
|
|
|
46
46
|
return "Suspense";
|
|
47
47
|
case E:
|
|
48
48
|
return "SuspenseList";
|
|
49
|
-
case
|
|
49
|
+
case C:
|
|
50
50
|
return "Activity";
|
|
51
51
|
}
|
|
52
52
|
if (typeof t == "object")
|
|
@@ -223,7 +223,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
223
223
|
function p(t) {
|
|
224
224
|
return typeof t == "object" && t !== null && t.$$typeof === S;
|
|
225
225
|
}
|
|
226
|
-
var g =
|
|
226
|
+
var g = Xe, S = Symbol.for("react.transitional.element"), u = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), h = Symbol.for("react.strict_mode"), R = Symbol.for("react.profiler"), _ = Symbol.for("react.consumer"), x = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), L = Symbol.for("react.suspense"), E = Symbol.for("react.suspense_list"), N = Symbol.for("react.memo"), A = Symbol.for("react.lazy"), C = Symbol.for("react.activity"), G = Symbol.for("react.client.reference"), Y = g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, F = Object.prototype.hasOwnProperty, B = Array.isArray, V = console.createTask ? console.createTask : function() {
|
|
227
227
|
return null;
|
|
228
228
|
};
|
|
229
229
|
g = {
|
|
@@ -235,7 +235,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
235
235
|
g,
|
|
236
236
|
a
|
|
237
237
|
)(), O = V(l(a)), Q = {};
|
|
238
|
-
|
|
238
|
+
he.Fragment = s, he.jsx = function(t, f, I) {
|
|
239
239
|
var P = 1e4 > Y.recentlyCreatedOwnerStacks++;
|
|
240
240
|
return c(
|
|
241
241
|
t,
|
|
@@ -245,7 +245,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
245
245
|
P ? Error("react-stack-top-frame") : re,
|
|
246
246
|
P ? V(l(t)) : O
|
|
247
247
|
);
|
|
248
|
-
},
|
|
248
|
+
}, he.jsxs = function(t, f, I) {
|
|
249
249
|
var P = 1e4 > Y.recentlyCreatedOwnerStacks++;
|
|
250
250
|
return c(
|
|
251
251
|
t,
|
|
@@ -256,14 +256,14 @@ React keys must be passed directly to JSX without using spread:
|
|
|
256
256
|
P ? V(l(t)) : O
|
|
257
257
|
);
|
|
258
258
|
};
|
|
259
|
-
})()),
|
|
259
|
+
})()), he;
|
|
260
260
|
}
|
|
261
261
|
var Ce;
|
|
262
|
-
function
|
|
263
|
-
return Ce || (Ce = 1, process.env.NODE_ENV === "production" ? ge.exports =
|
|
262
|
+
function rt() {
|
|
263
|
+
return Ce || (Ce = 1, process.env.NODE_ENV === "production" ? ge.exports = et() : ge.exports = tt()), ge.exports;
|
|
264
264
|
}
|
|
265
|
-
var w =
|
|
266
|
-
const
|
|
265
|
+
var w = rt();
|
|
266
|
+
const nt = (e, r, o) => {
|
|
267
267
|
const l = [];
|
|
268
268
|
for (let n = r; n < o; n++) {
|
|
269
269
|
const a = e[n];
|
|
@@ -272,7 +272,7 @@ const rt = (e, r, o) => {
|
|
|
272
272
|
l.push(i);
|
|
273
273
|
}
|
|
274
274
|
return l;
|
|
275
|
-
},
|
|
275
|
+
}, ot = (e, r, o) => {
|
|
276
276
|
const l = [];
|
|
277
277
|
for (let n = r; n < o; n++) {
|
|
278
278
|
const a = e[n];
|
|
@@ -281,17 +281,17 @@ const rt = (e, r, o) => {
|
|
|
281
281
|
l.push(i);
|
|
282
282
|
}
|
|
283
283
|
return l;
|
|
284
|
-
},
|
|
284
|
+
}, at = (e, r, o, l) => {
|
|
285
285
|
const n = Math.max(1, Math.floor(r * l)), a = Math.max(1, Math.floor(o * l));
|
|
286
286
|
(e.width !== n || e.height !== a) && (e.width = n, e.height = a);
|
|
287
287
|
const i = e.style;
|
|
288
288
|
i.width !== `${r}px` && (i.width = `${r}px`), i.height !== `${o}px` && (i.height = `${o}px`);
|
|
289
|
-
},
|
|
289
|
+
}, st = (e, r, o) => {
|
|
290
290
|
e.lineWidth = o, e.beginPath();
|
|
291
291
|
for (const l of r)
|
|
292
292
|
e.moveTo(l.x1, l.y1), e.lineTo(l.x2, l.y2);
|
|
293
293
|
e.stroke();
|
|
294
|
-
},
|
|
294
|
+
}, lt = (e, r) => {
|
|
295
295
|
const o = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());
|
|
296
296
|
if (!o)
|
|
297
297
|
return null;
|
|
@@ -299,10 +299,10 @@ const rt = (e, r, o) => {
|
|
|
299
299
|
l.length === 3 && (l = l.split("").map((m) => m + m).join(""));
|
|
300
300
|
const n = Number.parseInt(l.slice(0, 2), 16), a = Number.parseInt(l.slice(2, 4), 16), i = Number.parseInt(l.slice(4, 6), 16);
|
|
301
301
|
return `rgba(${n}, ${a}, ${i}, ${r})`;
|
|
302
|
-
},
|
|
302
|
+
}, it = (e, r, o, l) => {
|
|
303
303
|
if (r.length === 0)
|
|
304
304
|
return;
|
|
305
|
-
const n =
|
|
305
|
+
const n = lt(o, 0.14), a = e.strokeStyle, i = e.fillStyle, m = e.lineWidth, v = e.lineCap, y = e.lineJoin;
|
|
306
306
|
e.strokeStyle = o, e.lineCap = "round", e.lineJoin = "round";
|
|
307
307
|
for (const c of r) {
|
|
308
308
|
const b = l ?? c.size, p = Math.max(0, b / 2), g = Math.max(1, Math.round(b * 0.08)), S = Math.max(1, Math.round(b * 0.14)), u = Math.max(0, p - g * 0.8), s = Math.max(0, u * 0.55);
|
|
@@ -325,7 +325,7 @@ const rt = (e, r, o) => {
|
|
|
325
325
|
devicePixelRatio: b,
|
|
326
326
|
expandGlyphColor: p,
|
|
327
327
|
expandGlyphSize: g
|
|
328
|
-
}), h =
|
|
328
|
+
}), h = j(() => {
|
|
329
329
|
u.current = null;
|
|
330
330
|
const _ = S.current;
|
|
331
331
|
if (!_)
|
|
@@ -339,8 +339,8 @@ const rt = (e, r, o) => {
|
|
|
339
339
|
return;
|
|
340
340
|
}
|
|
341
341
|
const L = Number.isFinite(d.devicePixelRatio ?? NaN) ? d.devicePixelRatio : typeof window < "u" && window.devicePixelRatio || 1;
|
|
342
|
-
|
|
343
|
-
const E = d.segmentsByItem.length, N = typeof d.renderStartIndex == "number" && Number.isFinite(d.renderStartIndex) ? Math.max(0, Math.floor(d.renderStartIndex)) : Math.max(0, Math.floor(d.scrollPosition / d.itemHeight)), A = Math.min(E, Math.ceil((d.scrollPosition + d.viewportHeight) / d.itemHeight)),
|
|
342
|
+
at(_, d.width, d.viewportHeight, L);
|
|
343
|
+
const E = d.segmentsByItem.length, N = typeof d.renderStartIndex == "number" && Number.isFinite(d.renderStartIndex) ? Math.max(0, Math.floor(d.renderStartIndex)) : Math.max(0, Math.floor(d.scrollPosition / d.itemHeight)), A = Math.min(E, Math.ceil((d.scrollPosition + d.viewportHeight) / d.itemHeight)), C = (() => {
|
|
344
344
|
if (typeof d.renderEndIndex == "number" && Number.isFinite(d.renderEndIndex)) {
|
|
345
345
|
const B = Math.floor(d.renderEndIndex);
|
|
346
346
|
return Math.max(Math.min(E, B + 1), N);
|
|
@@ -349,12 +349,12 @@ const rt = (e, r, o) => {
|
|
|
349
349
|
})(), G = (() => {
|
|
350
350
|
if (typeof d.lookaheadEndIndex == "number" && Number.isFinite(d.lookaheadEndIndex)) {
|
|
351
351
|
const B = Math.floor(d.lookaheadEndIndex), V = Math.min(E, B + 1);
|
|
352
|
-
return Math.max(V,
|
|
352
|
+
return Math.max(V, C);
|
|
353
353
|
}
|
|
354
|
-
return Math.max(A,
|
|
355
|
-
})(), Y =
|
|
356
|
-
x.save(), x.scale(L, L), x.clearRect(0, 0, d.width, d.viewportHeight), x.translate(0, -d.scrollPosition), x.strokeStyle = d.color,
|
|
357
|
-
}, []), R =
|
|
354
|
+
return Math.max(A, C);
|
|
355
|
+
})(), Y = nt(d.segmentsByItem, N, G), F = ot(d.glyphsByItem, N, G);
|
|
356
|
+
x.save(), x.scale(L, L), x.clearRect(0, 0, d.width, d.viewportHeight), x.translate(0, -d.scrollPosition), x.strokeStyle = d.color, st(x, Y, d.strokeWidth), it(x, F, d.expandGlyphColor ?? d.color, d.expandGlyphSize), x.restore();
|
|
357
|
+
}, []), R = j(() => {
|
|
358
358
|
u.current === null && (u.current = window.requestAnimationFrame(h));
|
|
359
359
|
}, [h]);
|
|
360
360
|
return Z(() => {
|
|
@@ -398,13 +398,13 @@ const D = {
|
|
|
398
398
|
name: M("directory-tree-name overflow-hidden text-ellipsis whitespace-nowrap ml-1", "text-gray-700", "dark:text-gray-200"),
|
|
399
399
|
nameDirectory: "directory-tree-name--directory",
|
|
400
400
|
nameSelected: M("directory-tree-name--selected text-blue-800 font-medium", "dark:text-blue-300")
|
|
401
|
-
},
|
|
401
|
+
}, ct = {
|
|
402
402
|
msOverflowStyle: "none",
|
|
403
403
|
scrollbarWidth: "none"
|
|
404
|
-
},
|
|
404
|
+
}, ut = () => {
|
|
405
405
|
let e = document.getElementById("directory-tree-webkit-scrollbar-hide");
|
|
406
406
|
e || (e = document.createElement("style"), e.id = "directory-tree-webkit-scrollbar-hide", e.textContent = ".directory-tree-container::-webkit-scrollbar { display: none; }", document.head.appendChild(e));
|
|
407
|
-
},
|
|
407
|
+
}, dt = (e, r, o, l) => {
|
|
408
408
|
const n = [], a = [];
|
|
409
409
|
let i = 0;
|
|
410
410
|
const m = (v, y, c) => {
|
|
@@ -425,13 +425,13 @@ const D = {
|
|
|
425
425
|
}
|
|
426
426
|
};
|
|
427
427
|
return m(e, 0, []), { flatItems: n, lineItems: a, maxIndent: i };
|
|
428
|
-
},
|
|
428
|
+
}, ft = (e, r, o, l, n) => {
|
|
429
429
|
const a = l?.renderStart ?? Math.max(0, Math.floor(n / le)), i = r > 0 ? Math.ceil(r / le) + o : o, m = e > 0 ? Math.min(e - 1, a + i) : a, v = l?.renderEnd ?? m, y = e > 0 ? Math.min(e - 1, v + o) : v;
|
|
430
430
|
return { renderStart: a, renderEnd: v, lookaheadEnd: y };
|
|
431
|
-
},
|
|
431
|
+
}, ht = ({ isDirectory: e, isExpanded: r, showExpandIcons: o, useCanvasExpandIcons: l, expandIconSize: n }) => {
|
|
432
432
|
const a = n ? { width: n, height: n } : void 0, i = n ? "" : "h-4 w-4";
|
|
433
|
-
return !(o && e) || l ? /* @__PURE__ */ w.jsx("span", { className: i, style: a, "aria-hidden": "true" }) : r ? /* @__PURE__ */ w.jsx(
|
|
434
|
-
},
|
|
433
|
+
return !(o && e) || l ? /* @__PURE__ */ w.jsx("span", { className: i, style: a, "aria-hidden": "true" }) : r ? /* @__PURE__ */ w.jsx(Ze, { className: i, style: a }) : /* @__PURE__ */ w.jsx(Qe, { className: i, style: a });
|
|
434
|
+
}, mt = ze, yt = (e) => e.slice((e.lastIndexOf(".") - 1 >>> 0) + 2).toLowerCase(), pt = (e, r, o, l, n) => {
|
|
435
435
|
if (e.length === 0)
|
|
436
436
|
return { segmentsByItem: [], glyphsByItem: [] };
|
|
437
437
|
const a = Array.from({ length: e.length }, () => []), i = Array.from({ length: e.length }, () => []), m = l ? typeof n == "number" && Number.isFinite(n) && n > 0 ? n : Math.max(8, Math.min(o * 0.9, r * 0.7)) : 0, v = 3;
|
|
@@ -532,10 +532,10 @@ const D = {
|
|
|
532
532
|
return console.warn(`[DirectoryTree] Lazy component for "${r}". Not supported.`), null;
|
|
533
533
|
}
|
|
534
534
|
return e;
|
|
535
|
-
},
|
|
535
|
+
}, bt = (e, r) => {
|
|
536
536
|
const { entry: o, isDirectory: l, isExpanded: n, extension: a } = e;
|
|
537
537
|
let i;
|
|
538
|
-
return o.icon !== void 0 ? i = o.icon : l ? i = n && r?.directoryExpanded || r?.directory || /* @__PURE__ */ w.jsx(
|
|
538
|
+
return o.icon !== void 0 ? i = o.icon : l ? i = n && r?.directoryExpanded || r?.directory || /* @__PURE__ */ w.jsx(Ue, { className: "h-4 w-4" }) : a && r?.fileByExtension?.[a] ? i = r.fileByExtension[a] : i = r?.file || (a === "md" ? /* @__PURE__ */ w.jsx(qe, { className: "h-4 w-4" }) : /* @__PURE__ */ w.jsx(Ke, { className: "h-4 w-4" })), Ee(typeof i == "function" ? i(e) : i, o.absolutePath);
|
|
539
539
|
}, Ie = Me(
|
|
540
540
|
({
|
|
541
541
|
entry: e,
|
|
@@ -554,34 +554,35 @@ const D = {
|
|
|
554
554
|
},
|
|
555
555
|
[]
|
|
556
556
|
);
|
|
557
|
-
const E = e.children !== void 0, N = E && o(e.absolutePath, e.relativePath), A = e.absolutePath === v,
|
|
557
|
+
const E = e.children !== void 0, N = E && o(e.absolutePath, e.relativePath), A = e.absolutePath === v, C = !E && c?.has(e.absolutePath), G = E ? void 0 : yt(e.name);
|
|
558
558
|
Z(() => {
|
|
559
559
|
x(N && e.children ? e.children : null);
|
|
560
560
|
}, [N, e.children]);
|
|
561
|
-
const Y =
|
|
561
|
+
const Y = j(
|
|
562
562
|
(O) => {
|
|
563
|
-
if (O.stopPropagation(), y !== "none" && !E && b && b(e.absolutePath, !
|
|
563
|
+
if (O.stopPropagation(), y !== "none" && !E && b && b(e.absolutePath, !C), !E) return m(e.absolutePath, e.relativePath);
|
|
564
564
|
R.current ? (window.clearTimeout(R.current), R.current = null, i(e)) : R.current = window.setTimeout(() => {
|
|
565
565
|
a(e.absolutePath, e.relativePath), R.current = null;
|
|
566
566
|
}, 500);
|
|
567
567
|
},
|
|
568
|
-
[E, e, i, a, m, y, b,
|
|
569
|
-
), F = M(D.entry, d && D.entryHover, A && D.entrySelected,
|
|
570
|
-
return /* @__PURE__ */ w.jsxs(
|
|
568
|
+
[E, e, i, a, m, y, b, C]
|
|
569
|
+
), F = M(D.entry, d && D.entryHover, A && D.entrySelected, C && D.entryItemSelected, e.className), B = M(D.expandIcon, (A || C) && D.expandIconSelected), V = M(D.typeIcon, (A || C) && D.typeIconSelected), z = M(D.name, E && D.nameDirectory, (A || C) && D.nameSelected), te = ht({ isDirectory: E, isExpanded: N, showExpandIcons: g, useCanvasExpandIcons: s, expandIconSize: h }), re = (E ? S : u) ? bt({ entry: e, isDirectory: E, isExpanded: N, isSelected: A, isItemSelected: !!C, extension: G }, p) : null;
|
|
570
|
+
return /* @__PURE__ */ w.jsxs(Je, { children: [
|
|
571
571
|
/* @__PURE__ */ w.jsxs(
|
|
572
572
|
"div",
|
|
573
573
|
{
|
|
574
574
|
className: F,
|
|
575
575
|
style: {
|
|
576
|
-
paddingLeft: `${Math.max(0, r *
|
|
577
|
-
transform: r < 0 ? `translateX(${r *
|
|
578
|
-
width: r < 0 ? `calc(100% + ${Math.abs(r *
|
|
579
|
-
height: `${le}px
|
|
576
|
+
paddingLeft: `${Math.max(0, r * me)}px`,
|
|
577
|
+
transform: r < 0 ? `translateX(${r * me}px)` : void 0,
|
|
578
|
+
width: r < 0 ? `calc(100% + ${Math.abs(r * me)}px)` : void 0,
|
|
579
|
+
height: `${le}px`,
|
|
580
|
+
...e.style
|
|
580
581
|
},
|
|
581
582
|
"data-entry-type": E ? "directory" : "file",
|
|
582
583
|
"data-entry-expanded": E ? String(N) : void 0,
|
|
583
584
|
"data-entry-selected": A ? "true" : void 0,
|
|
584
|
-
"data-entry-item-selected":
|
|
585
|
+
"data-entry-item-selected": C ? "true" : void 0,
|
|
585
586
|
onClick: Y,
|
|
586
587
|
onMouseEnter: () => L(!0),
|
|
587
588
|
onMouseLeave: () => L(!1),
|
|
@@ -626,20 +627,20 @@ const D = {
|
|
|
626
627
|
}
|
|
627
628
|
);
|
|
628
629
|
Ie.displayName = "DirectoryEntryItem";
|
|
629
|
-
const le = 20,
|
|
630
|
+
const le = 20, gt = () => le, me = 16, Ae = 12, $e = (e) => {
|
|
630
631
|
const r = [];
|
|
631
632
|
if (e.children)
|
|
632
633
|
for (const o of e.children)
|
|
633
634
|
o.type === "directory" && (r.push(o.absolutePath), r.push(...$e(o)));
|
|
634
635
|
return r;
|
|
635
|
-
},
|
|
636
|
+
}, St = ({
|
|
636
637
|
entries: e,
|
|
637
638
|
expansion: { toggle: r, isExpanded: o, expandMultiple: l, collapseMultiple: n, isPending: a, alwaysExpanded: i = !1, doubleClickAction: m = "recursive" },
|
|
638
639
|
selection: { onFileSelect: v, selectedPath: y, mode: c = "none", selectedItems: b, onSelectionChange: p },
|
|
639
640
|
visual: { className: g, style: S, lineColor: u = "#A0AEC0", showTreeLines: s = !0, showExpandIcons: h = !0, showDirectoryIcons: R = !0, showFileIcons: _ = !0, iconOverrides: x, expandIconSize: d, removeRootIndent: L = !1 } = {},
|
|
640
641
|
virtualScroll: E
|
|
641
642
|
}) => {
|
|
642
|
-
const [N, A] = ee(!1),
|
|
643
|
+
const [N, A] = ee(!1), C = se(null), G = se(null), [Y, F] = ee(0), [B, V] = ee(null), {
|
|
643
644
|
overscanCount: z = 15,
|
|
644
645
|
className: te,
|
|
645
646
|
background: re,
|
|
@@ -659,27 +660,27 @@ const le = 20, he = 16, Ae = 12, $e = (e) => {
|
|
|
659
660
|
onItemFocus: Le,
|
|
660
661
|
viewportHeightOverride: H,
|
|
661
662
|
enableScrollToTopBottomButtons: Fe
|
|
662
|
-
} = E ?? {}, [
|
|
663
|
+
} = E ?? {}, [ye, ke] = ee(typeof f == "number" ? f : 0), Ye = j(
|
|
663
664
|
(k, X) => {
|
|
664
665
|
ke(k), O?.(k, X);
|
|
665
666
|
},
|
|
666
667
|
[O]
|
|
667
|
-
), Be =
|
|
668
|
-
(k, X, W, $, J,
|
|
669
|
-
V((q) => q && q.renderStart === k && q.renderEnd === X ? q : { renderStart: k, renderEnd: X }), Q?.(k, X, W, $, J,
|
|
668
|
+
), Be = j(
|
|
669
|
+
(k, X, W, $, J, de) => {
|
|
670
|
+
V((q) => q && q.renderStart === k && q.renderEnd === X ? q : { renderStart: k, renderEnd: X }), Q?.(k, X, W, $, J, de);
|
|
670
671
|
},
|
|
671
672
|
[Q]
|
|
672
673
|
);
|
|
673
674
|
Z(() => {
|
|
674
675
|
typeof f == "number" && ke(f);
|
|
675
676
|
}, [f]), Z(() => {
|
|
676
|
-
A(!0),
|
|
677
|
+
A(!0), ut();
|
|
677
678
|
}, []), Z(() => {
|
|
678
679
|
if (typeof H == "number") {
|
|
679
680
|
F(($) => Math.abs($ - H) > 1 ? H : $);
|
|
680
681
|
return;
|
|
681
682
|
}
|
|
682
|
-
const k =
|
|
683
|
+
const k = C.current;
|
|
683
684
|
if (!k) return F(0);
|
|
684
685
|
(() => {
|
|
685
686
|
const $ = k.clientHeight;
|
|
@@ -687,18 +688,18 @@ const le = 20, he = 16, Ae = 12, $e = (e) => {
|
|
|
687
688
|
})();
|
|
688
689
|
const W = new ResizeObserver(($) => {
|
|
689
690
|
for (const J of $)
|
|
690
|
-
J.target === k && F((
|
|
691
|
+
J.target === k && F((de) => Math.abs(de - J.contentRect.height) > 1 ? J.contentRect.height : de);
|
|
691
692
|
});
|
|
692
693
|
return W.observe(k), () => W.disconnect();
|
|
693
694
|
}, [H]);
|
|
694
|
-
const K = typeof H == "number" ? H : Y, oe =
|
|
695
|
+
const K = typeof H == "number" ? H : Y, oe = j((k, X) => i || (N ? o(k) : !1), [N, o, i]), Se = M(D.container, a && D.containerPending, g), we = ae(
|
|
695
696
|
() => ({
|
|
696
|
-
...
|
|
697
|
+
...ct,
|
|
697
698
|
...S ?? {},
|
|
698
699
|
...typeof H == "number" ? { height: H, minHeight: H } : {}
|
|
699
700
|
}),
|
|
700
701
|
[S, H]
|
|
701
|
-
), He =
|
|
702
|
+
), He = j(
|
|
702
703
|
(k, X) => {
|
|
703
704
|
const W = [k.absolutePath, ...$e(k)], $ = X || m;
|
|
704
705
|
if (W.every((q) => oe(q))) return n(W);
|
|
@@ -707,10 +708,10 @@ const le = 20, he = 16, Ae = 12, $e = (e) => {
|
|
|
707
708
|
console.warn(`[DirectoryTree] Unknown double click action: ${$}. No action taken.`);
|
|
708
709
|
},
|
|
709
710
|
[oe, l, n, m]
|
|
710
|
-
), { flatItems:
|
|
711
|
-
() => !s || xe.length === 0 ? { segmentsByItem: [], glyphsByItem: [] } :
|
|
711
|
+
), { flatItems: ue, lineItems: xe, maxIndent: Re } = ae(() => dt(e, oe, s, L), [e, oe, s, L]), pe = ae(
|
|
712
|
+
() => !s || xe.length === 0 ? { segmentsByItem: [], glyphsByItem: [] } : pt(xe, le, me, s, d ?? Ae),
|
|
712
713
|
[xe, s, d]
|
|
713
|
-
), be = ae(() => !s || e.length === 0 ? 0 : (Re + 2) *
|
|
714
|
+
), be = ae(() => !s || e.length === 0 ? 0 : (Re + 2) * me, [e.length, Re, s]), { renderStart: _e, renderEnd: Pe, lookaheadEnd: Te } = ae(() => ft(ue.length, K, z, B, ye), [ue.length, K, z, B, ye]), We = ae(() => !s || be <= 0 || K <= 0 || pe.segmentsByItem.length === 0 ? null : /* @__PURE__ */ w.jsx("div", { className: "pointer-events-none absolute inset-0 z-0", "aria-hidden": "true", children: /* @__PURE__ */ w.jsx("div", { className: "absolute top-0 left-0", style: { width: be, height: K }, children: /* @__PURE__ */ w.jsx(
|
|
714
715
|
Oe,
|
|
715
716
|
{
|
|
716
717
|
segmentsByItem: pe.segmentsByItem,
|
|
@@ -718,7 +719,7 @@ const le = 20, he = 16, Ae = 12, $e = (e) => {
|
|
|
718
719
|
itemHeight: le,
|
|
719
720
|
width: be,
|
|
720
721
|
viewportHeight: K,
|
|
721
|
-
scrollPosition:
|
|
722
|
+
scrollPosition: ye,
|
|
722
723
|
color: u,
|
|
723
724
|
expandGlyphColor: u,
|
|
724
725
|
expandGlyphSize: d ?? Ae,
|
|
@@ -726,14 +727,14 @@ const le = 20, he = 16, Ae = 12, $e = (e) => {
|
|
|
726
727
|
renderEndIndex: Pe,
|
|
727
728
|
lookaheadEndIndex: Te
|
|
728
729
|
}
|
|
729
|
-
) }) }), [be, K, _e, Pe, Te,
|
|
730
|
-
return e.length === 0 ? /* @__PURE__ */ w.jsx("div", { className: Se, style: we }) : /* @__PURE__ */ w.jsx("div", { ref:
|
|
731
|
-
|
|
730
|
+
) }) }), [be, K, _e, Pe, Te, ye, pe, u, s, d]), Ve = j((k) => ue[k], [ue]);
|
|
731
|
+
return e.length === 0 ? /* @__PURE__ */ w.jsx("div", { className: Se, style: we }) : /* @__PURE__ */ w.jsx("div", { ref: C, className: Se, style: we, role: "tree", children: /* @__PURE__ */ w.jsx(
|
|
732
|
+
mt,
|
|
732
733
|
{
|
|
733
734
|
ref: G,
|
|
734
|
-
itemCount:
|
|
735
|
-
getItem:
|
|
736
|
-
getItemHeight:
|
|
735
|
+
itemCount: ue.length,
|
|
736
|
+
getItem: Ve,
|
|
737
|
+
getItemHeight: gt,
|
|
737
738
|
viewportSize: K,
|
|
738
739
|
overscanCount: z,
|
|
739
740
|
onScroll: Ye,
|
|
@@ -779,8 +780,8 @@ const le = 20, he = 16, Ae = 12, $e = (e) => {
|
|
|
779
780
|
)
|
|
780
781
|
}
|
|
781
782
|
) });
|
|
782
|
-
},
|
|
783
|
-
const [o, l] =
|
|
783
|
+
}, wt = ({ initialExpanded: e = /* @__PURE__ */ new Set(), storageKey: r } = {}) => {
|
|
784
|
+
const [o, l] = Ge(), [n, a] = ee(() => {
|
|
784
785
|
if (typeof window < "u" && r)
|
|
785
786
|
try {
|
|
786
787
|
const u = window.localStorage.getItem(r);
|
|
@@ -792,14 +793,14 @@ const le = 20, he = 16, Ae = 12, $e = (e) => {
|
|
|
792
793
|
console.error("[useDirectoryTreeState] Error reading from localStorage", u);
|
|
793
794
|
}
|
|
794
795
|
return e;
|
|
795
|
-
}), i =
|
|
796
|
+
}), i = j((u) => {
|
|
796
797
|
l(() => {
|
|
797
798
|
a((s) => {
|
|
798
799
|
const h = new Set(s);
|
|
799
800
|
return u(h), h;
|
|
800
801
|
});
|
|
801
802
|
});
|
|
802
|
-
}, []), m =
|
|
803
|
+
}, []), m = j(
|
|
803
804
|
(u, s) => {
|
|
804
805
|
i((h) => {
|
|
805
806
|
for (const R of u)
|
|
@@ -816,46 +817,46 @@ const le = 20, he = 16, Ae = 12, $e = (e) => {
|
|
|
816
817
|
console.warn(`Error setting localStorage key "${r}":`, u);
|
|
817
818
|
}
|
|
818
819
|
}, [n, r]);
|
|
819
|
-
const v =
|
|
820
|
+
const v = j(
|
|
820
821
|
(u) => {
|
|
821
822
|
m([u], (s, h) => {
|
|
822
823
|
s.has(h) ? s.delete(h) : s.add(h);
|
|
823
824
|
});
|
|
824
825
|
},
|
|
825
826
|
[m]
|
|
826
|
-
), y =
|
|
827
|
+
), y = j(
|
|
827
828
|
(u) => {
|
|
828
829
|
m([u], (s, h) => {
|
|
829
830
|
s.add(h);
|
|
830
831
|
});
|
|
831
832
|
},
|
|
832
833
|
[m]
|
|
833
|
-
), c =
|
|
834
|
+
), c = j(
|
|
834
835
|
(u) => {
|
|
835
836
|
m([u], (s, h) => {
|
|
836
837
|
s.delete(h);
|
|
837
838
|
});
|
|
838
839
|
},
|
|
839
840
|
[m]
|
|
840
|
-
), b =
|
|
841
|
+
), b = j(
|
|
841
842
|
(u) => {
|
|
842
843
|
m(u, (s, h) => {
|
|
843
844
|
s.delete(h);
|
|
844
845
|
});
|
|
845
846
|
},
|
|
846
847
|
[m]
|
|
847
|
-
), p =
|
|
848
|
+
), p = j(
|
|
848
849
|
(u) => {
|
|
849
850
|
m(u, (s, h) => {
|
|
850
851
|
s.add(h);
|
|
851
852
|
});
|
|
852
853
|
},
|
|
853
854
|
[m]
|
|
854
|
-
), g =
|
|
855
|
+
), g = j(() => {
|
|
855
856
|
i((u) => {
|
|
856
857
|
u.clear();
|
|
857
858
|
});
|
|
858
|
-
}, [i]), S =
|
|
859
|
+
}, [i]), S = j((u) => n.has(u), [n]);
|
|
859
860
|
return {
|
|
860
861
|
expanded: n,
|
|
861
862
|
toggle: v,
|
|
@@ -869,7 +870,7 @@ const le = 20, he = 16, Ae = 12, $e = (e) => {
|
|
|
869
870
|
};
|
|
870
871
|
};
|
|
871
872
|
export {
|
|
872
|
-
|
|
873
|
+
St as DirectoryTree,
|
|
873
874
|
D as directoryTreeClasses,
|
|
874
|
-
|
|
875
|
+
wt as useDirectoryTreeState
|
|
875
876
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DirectoryTree.d.ts","sourceRoot":"","sources":["../../src/DirectoryTree.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAMR,kBAAkB,EAMrB,MAAM,YAAY,CAAA;AAEnB;;;GAGG;AACH,QAAA,MAAM,oBAAoB;;;;;;;;;;;;;;CA8BzB,CAAA;
|
|
1
|
+
{"version":3,"file":"DirectoryTree.d.ts","sourceRoot":"","sources":["../../src/DirectoryTree.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAMR,kBAAkB,EAMrB,MAAM,YAAY,CAAA;AAEnB;;;GAGG;AACH,QAAA,MAAM,oBAAoB;;;;;;;;;;;;;;CA8BzB,CAAA;AAijBD;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,qaAM3B,kBAAkB,4CAmOpB,CAAA;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAA"}
|
package/dist/src/types.d.ts
CHANGED
|
@@ -20,6 +20,16 @@ export type DirectoryEntry = {
|
|
|
20
20
|
relativePath: string;
|
|
21
21
|
children?: DirectoryEntry[];
|
|
22
22
|
icon?: DirectoryTreeIconRenderer;
|
|
23
|
+
/**
|
|
24
|
+
* Optional CSS class name for the entry.
|
|
25
|
+
* エントリ用のオプション CSS クラス名。
|
|
26
|
+
*/
|
|
27
|
+
className?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Optional inline styles for the entry.
|
|
30
|
+
* エントリ用のオプションのインラインスタイル。
|
|
31
|
+
*/
|
|
32
|
+
style?: CSSProperties;
|
|
23
33
|
};
|
|
24
34
|
/**
|
|
25
35
|
* Context object passed to icon renderer functions.
|
package/dist/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAErE;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,cAAc,GAAG;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,IAAI,EAAE,MAAM,GAAG,WAAW,CAAA;IAC1B,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAA;IAC3B,IAAI,CAAC,EAAE,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,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A;IACb,cAAc,EAAE,MAAM,CAAA;IACtB,cAAc,EAAE,MAAM,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,eAAe,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-setup.d.ts","sourceRoot":"","sources":["../../tests/test-setup.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,2BAA2B,CAAA"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test-setup.d.ts","sourceRoot":"","sources":["../../src/test-setup.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,2BAA2B,CAAA"}
|
|
File without changes
|