From 9da4ad469d0d3b649458427f48ff18649c4401ba Mon Sep 17 00:00:00 2001 From: Sylwester Wroblewski Date: Sun, 1 Sep 2024 22:32:54 +0200 Subject: [PATCH] Initial work on FileTree, refactor of Compile grammar service --- css/app.css | 17 +- package.json | 3 + public/favicon.ico | Bin 0 -> 9662 bytes public/favicon.png | Bin 0 -> 1876 bytes src/App.vue | 31 ++- .../FileSystemVisitors/FileSystemVisitor.ts | 93 +++++++++ src/Components/FileTree/FileTree.vue | 81 +++++--- .../FileTree/FileTreeActionButtons.vue | 60 ++++++ .../FileTreeGenerateParserDropdown.vue | 38 ---- src/Components/FileTree/FileTreeNode.vue | 116 +++++++++++ src/Components/FileTree/FileTreeNodeIcon.vue | 69 +++++++ src/Components/FileTree/FileTreeNodes.vue | 26 +++ .../FileTree/Store/FileSystemsStore.ts | 45 +++++ src/Components/HexViewer/HexViewer.vue | 4 +- .../HexViewer/Services/HexViewerActions.ts | 2 +- .../Services/HexViewerMouseActions.ts | 2 +- .../InfoPanel/ExportToJsonComponent.vue | 23 ++- src/Components/InfoPanel/InfoPanel.vue | 3 +- .../ParsedTree/Icons/OpenNodeIcon.vue | 2 +- src/Components/WelcomeModal.vue | 101 ---------- src/Components/WelcomeModal/WelcomeModal.vue | 120 ++++++++++++ .../WelcomeModal/WelcomeModalStore.ts | 34 ++++ .../CompilationModule}/CompilationError.ts | 0 .../CompilationModule/CompilerService.ts | 150 +++++++++++++++ .../CompilationModule/JsImporter.ts | 88 +++++++++ .../CompilationModule}/JsImporterError.ts | 0 .../CompilationModule/SchemaUtils.ts | 60 ++++++ .../CompilationModule/YamlParser.ts | 12 ++ .../CodeExecution/KaitaiCodeWorker.ts | 0 .../CodeExecution/KaitaiCodeWorkerWrapper.ts | 6 +- .../ParsingModule}/CodeExecution/Types.ts | 4 +- .../CodeExecution/WorkerFunctionStack.ts | 1 - .../CodeExecution/WorkerMessages.ts | 0 .../CodeExecution/WorkerResponses.ts | 0 .../ParsingModule/ParseWorkerApi.ts} | 4 +- src/FaviconSource.svg | 51 +++++ src/GlobalActions/CompileGrammar.ts | 14 ++ .../utils => GlobalActions}/ExportToJson.ts | 20 +- src/GlobalActions/LoadBinaryFile.ts | 11 ++ src/GlobalActions/LoadKsyFile.ts | 18 ++ src/GlobalActions/MainEditorOnChange.ts | 37 ++++ src/GlobalActions/ParseAction.ts | 10 + src/GlobalActions/UploadFiles.ts | 26 +++ src/Stores/AceEditorStore.ts | 25 +++ src/Stores/AppStore.ts | 41 ++++ src/extensions.ts | 16 -- src/v1/FileSystems/FileSystemHelper.ts | 18 +- src/v1/FileSystems/FileSystemManager.ts | 25 ++- src/v1/FileSystems/FileSystemsTypes.ts | 23 +-- src/v1/FileSystems/KaitaiFileSystem.ts | 42 +--- ...System.ts => OldLocalStorageFileSystem.ts} | 39 ++-- src/v1/GoldenLayout/GoldenLayoutUI.ts | 4 +- src/v1/GoldenLayout/GoldenLayoutUIConfig.ts | 2 +- src/v1/GoldenLayout/GoldenLayoutWrapper.ts | 35 +++- src/v1/app.files.ts | 82 ++------ src/v1/app.ts | 182 +----------------- src/v1/utils/Compilation/CompilerService.ts | 51 ----- src/v1/utils/Compilation/JsImporter.ts | 54 ------ src/v1/utils/Compilation/SchemaUtils.ts | 38 ---- src/v1/utils/Compilation/YamlParser.ts | 11 -- .../ObjectToIExportedValueMapper.ts | 2 +- src/v1/utils/Files/FileActionsWrapper.ts | 10 +- src/v1/utils/Misc/RegexUtils.ts | 9 - 63 files changed, 1349 insertions(+), 742 deletions(-) create mode 100644 public/favicon.ico create mode 100644 public/favicon.png create mode 100644 src/Components/FileTree/FileSystemVisitors/FileSystemVisitor.ts create mode 100644 src/Components/FileTree/FileTreeActionButtons.vue delete mode 100644 src/Components/FileTree/FileTreeGenerateParserDropdown.vue create mode 100644 src/Components/FileTree/FileTreeNode.vue create mode 100644 src/Components/FileTree/FileTreeNodeIcon.vue create mode 100644 src/Components/FileTree/FileTreeNodes.vue create mode 100644 src/Components/FileTree/Store/FileSystemsStore.ts delete mode 100644 src/Components/WelcomeModal.vue create mode 100644 src/Components/WelcomeModal/WelcomeModal.vue create mode 100644 src/Components/WelcomeModal/WelcomeModalStore.ts rename src/{v1/utils/Compilation => DataManipulation/CompilationModule}/CompilationError.ts (100%) create mode 100644 src/DataManipulation/CompilationModule/CompilerService.ts create mode 100644 src/DataManipulation/CompilationModule/JsImporter.ts rename src/{v1/utils/Compilation => DataManipulation/CompilationModule}/JsImporterError.ts (100%) create mode 100644 src/DataManipulation/CompilationModule/SchemaUtils.ts create mode 100644 src/DataManipulation/CompilationModule/YamlParser.ts rename src/{v1/Workers => DataManipulation/ParsingModule}/CodeExecution/KaitaiCodeWorker.ts (100%) rename src/{v1/Workers => DataManipulation/ParsingModule}/CodeExecution/KaitaiCodeWorkerWrapper.ts (94%) rename src/{v1/Workers => DataManipulation/ParsingModule}/CodeExecution/Types.ts (74%) rename src/{v1/Workers => DataManipulation/ParsingModule}/CodeExecution/WorkerFunctionStack.ts (93%) rename src/{v1/Workers => DataManipulation/ParsingModule}/CodeExecution/WorkerMessages.ts (100%) rename src/{v1/Workers => DataManipulation/ParsingModule}/CodeExecution/WorkerResponses.ts (100%) rename src/{v1/Workers/WorkerApi.ts => DataManipulation/ParsingModule/ParseWorkerApi.ts} (91%) create mode 100644 src/FaviconSource.svg create mode 100644 src/GlobalActions/CompileGrammar.ts rename src/{v1/utils => GlobalActions}/ExportToJson.ts (50%) create mode 100644 src/GlobalActions/LoadBinaryFile.ts create mode 100644 src/GlobalActions/LoadKsyFile.ts create mode 100644 src/GlobalActions/MainEditorOnChange.ts create mode 100644 src/GlobalActions/ParseAction.ts create mode 100644 src/GlobalActions/UploadFiles.ts create mode 100644 src/Stores/AceEditorStore.ts create mode 100644 src/Stores/AppStore.ts delete mode 100644 src/extensions.ts rename src/v1/FileSystems/{LocalStorageFileSystem.ts => OldLocalStorageFileSystem.ts} (52%) delete mode 100644 src/v1/utils/Compilation/CompilerService.ts delete mode 100644 src/v1/utils/Compilation/JsImporter.ts delete mode 100644 src/v1/utils/Compilation/SchemaUtils.ts delete mode 100644 src/v1/utils/Compilation/YamlParser.ts delete mode 100644 src/v1/utils/Misc/RegexUtils.ts diff --git a/css/app.css b/css/app.css index ccc9dac1..695d0533 100644 --- a/css/app.css +++ b/css/app.css @@ -1,19 +1,6 @@ -/*.lm_content>div { height: 100%; width: 100% }*/ -.lm_splitter.lm_horizontal .lm_drag_handle { left:-5px; width:15px } -.lm_splitter.lm_vertical .lm_drag_handle { top:-5px; height:15px } .errorWindow { background: white; font-family: Courier,monospace; font-size: 12px; white-space: pre-wrap; overflow-y: scroll; } .errorWindow>div { margin: 5px; } -#fileTree { font-family:Arial; font-size:12px } body { line-height:normal } -#fileTree { position:absolute; top:0; bottom:28px; width:100%; /*height:100%;*/ overflow: auto; } -#fileTree .jstree-node { margin-left: 14px } -#fileTree .jstree-container-ul>.jstree-node { margin-left:0 } -#fileTree .jstree-clicked { background:initial } -#fileTree .glyphicon { font-size:12px; margin-top:-1px; color:#eee; margin-right:3px } -#fileTree .jstree-icon { margin-left:3px; margin-right:5px } -#fileTree .jstree-ocl { display:none } -#fileTreeCont .footer { position:absolute; bottom:0; width:100%; padding-left:2px } -#fileTreeCont .footer .btn { width:33.3%; border-radius:0; font-size:13px; padding:3px 10px } body { color:#333 } .dropdown { position: absolute; display:none; z-index:9999 } .dropdown-menu { z-index:9999 } @@ -22,7 +9,6 @@ body { color:#333 } .dropdown .glyphicon-folder-open { margin-left:-1px; margin-right:6px } .dropdown .dropdown-menu>li>a { padding:3px 15px } .btn { padding: 5px 10px; } -.modal { color: white; } .control-label { margin-bottom:8px } .form-control { padding: 6px 12px; height:34px } .modal-footer, .modal-body { padding: 15px } @@ -35,6 +21,5 @@ body { color:#333 } #aboutWebIde { position:absolute; bottom:10px; right:10px; font-size:12px } #exportToJsonDiv, #parsedPathDiv, #selectionLengthDiv { font-size:13px; margin-top:5px } #parsedPath { word-break: break-all; } -#welcomeModalLabel { text-align:center } -#welcomeModal .licenses { font-size:12px; margin-bottom:10px } + /*.marker_match { background:rgba(80, 255, 80, 0.30); }*/ diff --git a/package.json b/package.json index cf721974..09e266bb 100644 --- a/package.json +++ b/package.json @@ -80,6 +80,9 @@ "staticPath": "samples", "staticOutPath": "samples" }, + { + "staticPath": "public" + }, { "staticPath": "LICENSE-3RD-PARTY.txt" }, diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..b5a819bac70936d47bcd791376ecc2e7f238fe08 GIT binary patch literal 9662 zcmeHNNpl-T6rNP5;s#s@N4QYM(G-$wOO_>9QIr)DV<;TrGS+I@j&0epEX$E4S&LH% zdnN3It=K|B*uhQ=9P(2P;SVIa0GH-{BRA?EX{?#n$S0hdbk9upd*9o-U%!#29io3d zJsSQ0kaqcDO*^7#+9Pz)BP~i7o}2wK#x&zK`GogKWZ1nJ4!L&1A@?72{X-W!;Op-? zZ`Tg6#6pkWZ^UW54+evGO@=%Lns@tvv0Bm1t;kV#er#;)un{-zryqap-aUO=p`|#+ zqd2c&`^jPVwTV#gJ)#VdDID@_byw#emcKa2GG_)@Ps59wF&vj9tmdpoiPdiGfUVP98~koy_x&ew#Y6)yRiXP53x_onCw$?#!ahRS#3 zuW5V!y0FsEau)_zD(7X1lg;vHUmB2PSSoq#%3z9}%PGnLo1cEy&k`q`iEqSO>5>>5 zK{g$8hBn8KHu{u@6+UV3ss1#i`+$niigeMRN%rY+%;TZ(>0k%(+#Cm-U+ifQD@wW= zVuguc?8ITjEfoUfB@Y^;}UTnS1(TiXuq*}`1*b{LYRgU#y=x|MH(4(!pb z@gz?6vdY&DU*dMpz2Rrkk=AqC;m7;jdD#Z3ti83u3J*R8`)Sp%pF$4A2x5hgv(rw; z`XsxSz6dDMvC4CPxnJVP?Xa}2?z^Q+4Icu%IN91N9+h#KbMpEPp6e9TDzq>sb4K2) zv45!2vN8|(p1gh|M+-8@*q}T|HK)Y>&SOcBfoIj$13R)A?GC=PWEVR$_*mFZ#D8kOyD`A| z7C)Ewgxu?Dz6-fU{K&sKk8ZZ9wZ{1n{Bgcg$+zY-bRrMTM;*yH&dNRN9U?6!`oM$y z9<-5%C&p!Y;?K!@0C=j@8>c2H9{2nP^*@|sPYaqv8_{jc#%xRjmZEK(=^Y*ppOuV)Jv6raO zGnoVIf114Oh!1ilu5+<<82|5tz3Kaf6Y>~qrCf&G1?Scge7}ecyOy26E7F*qY3)0x zoyHwJkK?=c_(<;qR0qE!^6#{d^_}Y*Eo!{jQ)8oQIgAOO+xYf~Z;;_(SJ`BY?HIuK z2Vh2hbe-f_p!L38zNW$(zZ2l!u-M~HRbr&t^ Hnd|*u=`Z9% literal 0 HcmV?d00001 diff --git a/public/favicon.png b/public/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..08d8e6d74ccf76838199f66c2a657428ea10591a GIT binary patch literal 1876 zcmV-a2dnsrP)pF8FWQhbW?9;ba!ELWdL_~cP?peYja~^aAhuUa%Y?FJQ@H12H{CW zK~!jg#hTl1T-6oEe|w+H%-9|~_*z6STz%O7d|kL;ELAz4LjucnYUie zRZkLI2~18-n(OKNe=7yQ($IA;qumYy*0mOY=ya~Vc>46|U~_zfz=6ZR*kgI>bu>@? z-=b^*8cu3IedPS9msbHKz>ySO?GcI~8Qs3=Q&XM4t1SXQRSb_iPTHSGDZze%6`e6wSCTMXJ>Xx$` zW~(tG*`*4rz51I~tp;_++k}3tDD$%Gq)97th4(p}%-LtU8r zyO4WqM7DMJs^HhR*X$-^IE@_5pmGjs&OryY$~Ag}z?#TnKhck9ASH}1b<`c-4r;j# z0?Jclp6ml5Ak>68m+-cOUiHw$usm*n?6Hx9Hpbo#ge}_&P&*1W@1T}FxLf!lu{78_ zO$q3{hkt1m>#;px2#k?5#z?xY0HcOAD(@5CC=$*)gmVshrSgPDw^@gP7oPxtH@$?p zziVd_KxkN2TU0pV;3HR}-GDxvaa2O=fucyv$H`L$yC3C4ivj)v8&_{Cb-{)J`y3yt4| zxv#4xeR`Kx;vhifBu#IsmOKMK*V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anel/ConverterPanel.vue"; -import FileTree from "./Components/FileTree/FileTree.vue"; import InfoPanel from "./Components/InfoPanel/InfoPanel.vue"; import UnsupportedBrowser from "./Components/UnsupportedBrowser.vue"; -import WelcomeModal from "./Components/WelcomeModal.vue"; +import WelcomeModal from "./Components/WelcomeModal/WelcomeModal.vue"; import FileDrop from "./Components/FileDrop.vue"; import NewKsyModal from "./Components/NewKsyModal.vue"; import InputContextMenu from "./Components/InputContextMenu.vue"; import HexViewer from "./Components/HexViewer/HexViewer.vue"; import ParsedTree from "./Components/ParsedTree/ParsedTree.vue"; +import FileTree from "./Components/FileTree/FileTree.vue"; +import {useAppStore} from "./Stores/AppStore"; +import {loadBinaryFileAction} from "./GlobalActions/LoadBinaryFile"; +import {loadKsyFileAction} from "./GlobalActions/LoadKsyFile"; +import {onMounted} from "vue"; +import {parseAction} from "./GlobalActions/ParseAction"; + +const store = useAppStore(); +store.$onAction(async ({name, store, args}) => { + switch (name) { + case "updateSelectedBinaryFile": { + await loadBinaryFileAction(args[0]); + await parseAction(); + return; + } + case "updateSelectedKsyFile": { + await loadKsyFileAction(args[0]); + await parseAction(); + return; + } + } +}); + +onMounted(async () => { + await loadKsyFileAction(store.selectedKsyInfo); + await loadBinaryFileAction(store.selectedBinaryInfo); + await parseAction(); +});