@@ -52,73 +52,116 @@ You can clone a more detailed example from [GitHub](https://github.com/LiteCode-
5252VFS comes with a typescript definition file.
5353
5454``` ts
55- interface FileExplorerProps {
56- deleteConfirmationClassName? : string ;
57- fileInputClassName? : string ;
58- fileInputStyle? : React .CSSProperties ;
59- contextMenuClassName? : string ;
60- contextMenuHrColor? : string ;
61- contextMenuClickableAreaClassName? : string ;
62- fileActionsBtnClassName? : string ;
63- projectName? : string ;
64- fileActionsDisableCollapse? : true ;
65- fileActionsDisableTooltip? : true ;
66- fileActionsDisableDownload? : true ;
67- folderCollapseBtnClassname? : string ;
68- folderCollapseBtnStyle? : React .CSSProperties ;
69- folderThreeDotPrimaryClass? : string ;
70- folderThreeDotSecondaryClass? : string ;
71- folderClickableAreaClassName? : string ;
72- folderSelectedClickableAreaClassName? : string ;
73- folderContextSelectedClickableAreaClassName? : string ;
74- itemTitleClassName? : string ;
75- structureContainerClassName? : string ;
76- containerHeight? : string ;
77- onItemSelected? : (item : { id: string ; type: ItemType }) => void ;
78- onNewItemClick? : (parentFolderId : string , type : ItemType ) => void ;
79- onAreaCollapsed? : (collapsed : boolean ) => void ;
80- onItemContextSelected? : (item : { id: string ; type: ItemType }) => void ;
81- onNodeDeleted? : (id : string ) => void ;
82- onNewItemCreated? : (id : string ) => void ;
83- validExtensions: string [];
84- }
85-
86- interface TabsProps {
87- containerClassName? : string ;
88- tabClassName? : string ;
89- selectedTabClassName? : string ;
90- onTabClick? : (id : string ) => void ;
91- onTabClose? : (id : string ) => void ;
92- }
93-
94- interface SearchInputProps {
95- className? : string ;
96- style? : React .CSSProperties ;
97- onSearchFiles? : (searchTerm : string , searchResults : SearchResults ) => void ;
98- }
99-
100- interface BreadcrumbsProps {
101- containerClassName? : string ;
102- textClassName? : string ;
103- miniFolderCollapseBtnClassName? : string ;
104- miniFolderCollapseBtnStyle? : React .CSSProperties ;
105- miniFolderContainerClassName? : string ;
106- itemTitleClassName? : string ;
107- onBreadcrumbFileClick? : (id : string ) => void ;
108- }
109-
110- interface SearchResultProps {
111- highlightedTextClassName? : string ;
112- headerClassName? : string ;
113- headerStyle? : React .CSSProperties ;
114- titleClassName? : string ;
115- }
116-
117- type FileTreeType = Record <string , {
55+ declare module " @litecode-ide/virtual-file-system" {
56+ type ItemType = " file" | " folder" ;
57+
58+ interface BreadcrumbsProps {
59+ containerClassName? : string ;
60+ textClassName? : string ;
61+ miniFolderCollapseBtnClassName? : string ;
62+ miniFolderCollapseBtnStyle? : React .CSSProperties ;
63+ miniFolderContainerClassName? : string ;
64+ itemTitleClassName? : string ;
65+ onBreadcrumbFileClick? : (id : string ) => void ;
66+ }
67+
68+ interface StructureProps {
69+ deleteConfirmationClassName? : string ;
70+ fileInputClassName? : string ;
71+ fileInputStyle? : React .CSSProperties ;
72+ contextMenuClassName? : string ;
73+ contextMenuHrColor? : string ;
74+ contextMenuClickableAreaClassName? : string ;
75+ fileActionsBtnClassName? : string ;
76+ projectName? : string ;
77+ fileActionsDisableCollapse? : true ;
78+ fileActionsDisableTooltip? : true ;
79+ fileActionsDisableDownload? : true ;
80+ folderCollapseBtnClassname? : string ;
81+ folderCollapseBtnStyle? : React .CSSProperties ;
82+ folderThreeDotPrimaryClass? : string ;
83+ folderThreeDotSecondaryClass? : string ;
84+ folderClickableAreaClassName? : string ;
85+ folderSelectedClickableAreaClassName? : string ;
86+ folderContextSelectedClickableAreaClassName? : string ;
87+ itemTitleClassName? : string ;
88+ structureContainerClassName? : string ;
89+ containerHeight? : string ;
90+ onItemSelected? : (item : { id: string ; type: ItemType }) => void ;
91+ onNewItemClick? : (parentFolderId : string , type : ItemType ) => void ;
92+ onAreaCollapsed? : (collapsed : boolean ) => void ;
93+ onItemContextSelected? : (item : { id: string ; type: ItemType }) => void ;
94+ onNodeDeleted? : (id : string ) => void ;
95+ onNewItemCreated? : (id : string ) => void ;
96+ validExtensions: string [];
97+ }
98+
99+ interface TabsProps {
100+ containerClassName? : string ;
101+ tabClassName? : string ;
102+ selectedTabClassName? : string ;
103+ onTabClick? : (id : string ) => void ;
104+ onTabClose? : (id : string ) => void ;
105+ }
106+
107+ interface MatchingFile {
118108 id: string ;
119- content: string ;
120- }>;
109+ name: string ;
110+ extension: string ;
111+ matches: MatchingLine [];
112+ }
121113
114+ interface MatchingLine {
115+ line: number ;
116+ content: string ;
117+ }
118+
119+ interface SearchResults {
120+ files: MatchingFile [];
121+ numOfResults: number ;
122+ numOfLines: number ;
123+ }
124+
125+ interface SearchInputProps {
126+ className? : string ;
127+ style? : React .CSSProperties ;
128+ onSearchFiles? : (searchTerm : string , searchResults : SearchResults ) => void ;
129+ }
130+
131+ interface SearchContainerProps {
132+ highlightedTextClassName? : string ;
133+ headerClassName? : string ;
134+ headerStyle? : React .CSSProperties ;
135+ titleClassName? : string ;
136+ searchResultClicked: (fileId : string , line : number ) => void ;
137+ }
138+
139+ const FileExplorer: React .FC <StructureProps >;
140+ const TabsList: React .FC <TabsProps >;
141+ const SearchInput: React .FC <SearchInputProps >;
142+ const Breadcrumbs: React .FC <BreadcrumbsProps >;
143+ const SearchResults: React .FC <SearchContainerProps >;
144+ const updateFile: (id : string , content : string ) => void ;
145+ const getFileTree: () => Record <
146+ string ,
147+ {
148+ id: string ;
149+ content: string ;
150+ }
151+ >;
152+ const getSelectedFile: () => string ;
153+
154+ export {
155+ FileExplorer ,
156+ TabsList ,
157+ SearchResults ,
158+ Breadcrumbs ,
159+ SearchInput ,
160+ getFileTree ,
161+ updateFile ,
162+ getSelectedFile ,
163+ };
164+ }
122165```
123166
124167## Contributing
0 commit comments