diff --git a/ACECore/build.json b/ACECore/build.json index 74be441..6722c6f 100644 --- a/ACECore/build.json +++ b/ACECore/build.json @@ -17,8 +17,10 @@ "data": ["build","build/debug","build/release"] }, { - "name": "ts-import", - "data": ["sdk://core/ts/core.d.ts", "sdk://core/ts/jquery.d.ts","sdk://core/ts/antos.d.ts"] + "name": "ts-antos-sdk", + "data": { + "version": "2.0.x" + } }, { "name": "ts-compile", diff --git a/ACECore/build/release/ACECore.zip b/ACECore/build/release/ACECore.zip index c05bf3e..6a66ce1 100644 Binary files a/ACECore/build/release/ACECore.zip and b/ACECore/build/release/ACECore.zip differ diff --git a/About/build/release/About.zip b/About/build/release/About.zip index 4c6986f..261b059 100644 Binary files a/About/build/release/About.zip and b/About/build/release/About.zip differ diff --git a/AceDiff/build/debug/README.md b/AceDiff/build/debug/README.md index 40b6eb3..63434c4 100644 --- a/AceDiff/build/debug/README.md +++ b/AceDiff/build/debug/README.md @@ -5,4 +5,7 @@ It's built on top of google-diff-match-patch library. That lib handles the hard Github page: [https://github.com/ace-diff/ace-diff](https://github.com/ace-diff/ace-diff). -The ACE diff depends on the ACECore package. \ No newline at end of file +The ACE diff depends on the ACECore package. + +## Change logs +- v0.1.1-a: add dependencies \ No newline at end of file diff --git a/AceDiff/build/release/AceDiff.zip b/AceDiff/build/release/AceDiff.zip index 23ded27..ff75588 100644 Binary files a/AceDiff/build/release/AceDiff.zip and b/AceDiff/build/release/AceDiff.zip differ diff --git a/ActivityMonitor/build/release/ActivityMonitor.zip b/ActivityMonitor/build/release/ActivityMonitor.zip index 40ad683..cc3c1b9 100644 Binary files a/ActivityMonitor/build/release/ActivityMonitor.zip and b/ActivityMonitor/build/release/ActivityMonitor.zip differ diff --git a/Antedit/build.json b/Antedit/build.json index 6801085..caa5b7e 100644 --- a/Antedit/build.json +++ b/Antedit/build.json @@ -27,8 +27,10 @@ "require":["ts"], "jobs": [ { - "name": "ts-import", - "data": ["sdk://core/ts/core.d.ts", "sdk://core/ts/jquery.d.ts","sdk://core/ts/antos.d.ts"] + "name": "ts-antos-sdk", + "data": { + "version": "2.0.x" + } }, { "name": "ts-compile", diff --git a/Antedit/build/debug/main.js b/Antedit/build/debug/main.js index e779c3e..99b3c5a 100644 --- a/Antedit/build/debug/main.js +++ b/Antedit/build/debug/main.js @@ -1 +1 @@ -var OS;!function(t){let e,i;!function(e){let i;!function(e){class i extends t.API.VFS.BaseFileHandle{constructor(t){super(""),this.path=`${t[0].path} -> ${t[1].path}`,this.cache=t,this.basename=`${t[0].basename} -> ${t[1].basename}`,this.info={type:"file",mime:void 0,size:0,name:this.basename,path:this.path},this.ready=!0}meta(){return new Promise(async(t,e)=>{try{await Promise.all([this.cache[0].meta(),this.cache[1].meta]),t({result:this.info,error:!1})}catch(t){e(t)}})}_rd(t){return new Promise(async(t,e)=>{try{this.cache[0].cache=await this.cache[0].read(),this.cache[1].cache=await this.cache[1].read(),t(this.cache)}catch(t){e(t)}})}_wr(t,e){return this.cache=e,new Promise((t,e)=>{t({result:!0,error:!1})})}setPath(t){}}e.DiffEditorFileHandle=i}(i=e.VFS||(e.VFS={}))}(e=t.API||(t.API={})),function(t){t.BaseEditorModel=class{constructor(t,e,i){this.container=i,this.currfile="Untitled".asFileHandle(),this.tabbar=e,this.editorSetup(i),this.app=t,this.editormux=!1,this.onstatuschange=void 0,this.on("focus",()=>{this.onstatuschange&&this.onstatuschange(this.getEditorStatus())}),this.on("input",()=>this.editormux?(this.editormux=!1,!1):this.currfile.dirty?void 0:(this.currfile.dirty=!0,this.currfile.text+="*",this.tabbar.update(void 0))),this.on("changeCursor",()=>{this.onstatuschange&&this.onstatuschange(this.getEditorStatus())}),this.tabbar.ontabselect=t=>this.selecteTab($(t.data.item).index()),this.tabbar.ontabclose=t=>{const e=t.data.item;return!!e&&(e.data.dirty?(this.app.openDialog("YesNoDialog",{title:__("Close tab"),text:__("Close without saving ?")}).then(t=>t?this.closeTab(e):this.focus()),!1):this.closeTab(e))}}findTabByFile(t){const e=this.tabbar.items,i=(()=>{const i=[];for(let a=0;a(t.cache=e||"",this.newTab(t))).catch(e=>this.app.error(__("Unable to open: {0}",t.path),e)):this.newTab(t):this.tabbar.selected=e}write(){this.currfile.cache=this.getValue(),this.currfile.write("text/plain").then(t=>{this.currfile.dirty=!1,this.currfile.text=this.currfile.basename,this.tabbar.update(void 0)}).catch(t=>this.app.error(__("Unable to save file: {0}",this.currfile.path),t))}save(){return this.currfile.cache=this.getValue(),this.currfile.basename?this.write():this.saveAs()}reload(){return new Promise(async(t,e)=>{try{if("Untitled"===this.currfile.path.toString())return t(!0);if(this.currfile.dirty&&!await this.app.openDialog("YesNoDialog",{title:__("File modified"),text:__("Continue without saving ?")}))return t(!0);const e=await this.currfile.read();this.currfile.cache=e||"",this.currfile.dirty=!1,this.currfile.text=this.currfile.basename?this.currfile.basename:this.currfile.path,this.editormux=!0,this.setValue(this.currfile.cache),this.tabbar.update(void 0)}catch(t){this.app.error(__("Unable to open: {0}",this.currfile.path),t),e(t)}})}saveAs(){this.app.openDialog("FileDialog",{title:__("Save as"),file:this.currfile}).then(t=>{let e=t.file.path.asFileHandle();"file"===t.file.type&&(e=e.parent()),this.currfile.setPath(`${e.path}/${t.name}`),this.write()})}dirties(){const t=[];for(let e of Array.from(this.tabbar.items))e.dirty&&t.push(e);return t}set contextmenuHandle(t){this.container.contextmenuHandle=t}closeAll(){this.tabbar.items=[],this.openFile("Untitled".asFileHandle()),this.resetEditor()}isDirty(){return this.dirties().length>0}setTabbarCtxMenu(t,e){this.tabbar.contextmenuHandle=(i,a)=>(a.items=t,a.onmenuselect=t=>{if(e){const a=$(i.target).closest("afx-list-item");e(a[0],t.data.item.data)}},a.show(i))}}}(i=t.application||(t.application={}))}(OS||(OS={})),function(t){let e;!function(e){class i extends t.application.BaseEditorModel{constructor(t,e,i){super(t,e,i)}resetEditor(){}getTexModel(){return{model:this.editor.getModel(),position:this.editor.getPosition()}}setTextModel(t){this.editor.setModel(t.model),t.position&&(this.editor.setPosition(t.position),this.editor.revealLineInCenter(t.position.lineNumber)),this.editor==this._code_editor&&this.editor.updateOptions({readOnly:!1,domReadOnly:!1})}newTextModelFrom(t){if(Array.isArray(t.cache))return{model:{original:this.newTextModelFrom(t.cache[0]).model,modified:this.newTextModelFrom(t.cache[1]).model}};{if("Untitled"===t.path.toString())return{model:monaco.editor.createModel(t.cache,"textplain")};const e=monaco.Uri.parse(t.protocol+"://antedit/file/"+t.genealogy.join("/")),i=monaco.editor.getModel(e);return i?(i.setValue(t.cache),{model:i}):{model:monaco.editor.createModel(t.cache,void 0,e)}}}getModes(){return monaco.languages.getLanguages().map(t=>{const e=t;return t.aliases?e.text=t.aliases[0]:e.text=t.id,t})}setTheme(t){}setMode(t){if(this.editor==this._code_editor)monaco.editor.setModelLanguage(this.editor.getModel(),t.id);else for(const e of this.editor.getModel())monaco.editor.setModelLanguage(e,t.id);this.onstatuschange&&this.onstatuschange(this.getEditorStatus())}get editor(){return Array.isArray(this.currfile.cache)?this._diff_editor:this._code_editor}editorSetup(t){this.code_container=$("
").css("width","100%").css("height","100%"),this.diff_container=$("
").css("width","100%").css("height","100%").css("display","none"),$(t).append(this.code_container),$(t).append(this.diff_container),this._code_editor=monaco.editor.create(this.code_container[0],{value:"",language:"textplain",readOnly:!1,domReadOnly:!1}),this._diff_editor=monaco.editor.createDiffEditor(this.diff_container[0],{readOnly:!0}),i.modes||(i.modes={},monaco.languages.getLanguages().forEach(t=>{i.modes[t.id]=t}))}on(t,e){switch(t){case"input":this._code_editor.onDidChangeModelContent(e);break;case"focus":this._code_editor.onDidFocusEditorText(e),this._diff_editor.getOriginalEditor().onDidFocusEditorText(e),this._diff_editor.getModifiedEditor().onDidFocusEditorText(e);break;case"changeCursor":this._code_editor.onDidChangeCursorPosition(e),this._diff_editor.getOriginalEditor().onDidChangeCursorPosition(e),this._diff_editor.getModifiedEditor().onDidChangeCursorPosition(e)}}resize(){this.editor&&this.editor.layout()}focus(){Array.isArray(this.currfile.cache)?(this.code_container.hide(),this.diff_container.show()):(this.code_container.show(),this.diff_container.hide()),this.editor&&(this.editor.layout(),this.editor.focus())}getModeForPath(t){return{}}getEditorStatus(){let t=void 0;this.editor==this._code_editor?t=this.editor:(t=this.editor.getOriginalEditor(),this.editor.getModifiedEditor().hasTextFocus()&&(t=this.editor.getModifiedEditor()));const e=t.getPosition();let a=void 0;const s=t.getModel();return s&&(a=i.modes[s.getLanguageId()]),{row:e.lineNumber,column:e.column,line:s?s.getLineCount():0,langmode:{text:a?a.aliases[0]:"",mode:a},file:this.currfile.path}}getValue(){return this.editor==this._code_editor?this.editor.getValue():this.currfile.cache}setValue(t){this.editor==this._code_editor&&this.editor.setValue(t)}getEditor(){return this._code_editor}}e.MonacoEditorModel=i}(e=t.application||(t.application={}))}(OS||(OS={})),function(t){let e,i;!function(t){let e;!function(t){class e extends t.ListViewItemTag{itemlayout(){return{el:"div",children:[{el:"afx-label",ref:"label"},{el:"p",ref:"desc",id:"ext-list-item-d-p"},{el:"p",id:"ext-list-item-b-p",children:[{el:"i",ref:"intall_status"},{el:"afx-button",ref:"btn_remove"},{el:"afx-button",ref:"btn_install"}]}]}}ondatachange(){const t=this.data;if(!t)return;const e=this.refs.label;e.iconclass="bi bi-puzzle",e.text=`${t.text} - v${t.version}`;const i=this.refs.desc;$(i).text(t.description);const a=this.refs.btn_install,s=this.refs.btn_remove;t.installed?($(s).show(),s.iconclass="bi bi-trash-fill",a.iconclass="bi bi-arrow-repeat",$(this.refs.intall_status).text(__("Installed: v{0} ",t.installed).__())):($(s).hide(),a.iconclass="fa bi-cloud-download-fill",$(this.refs.intall_status).text(" "))}init(){this.closable=!1,this.data={};const t=this.refs.btn_install,e=this.refs.btn_remove;t.onbtclick=t=>{this.data.download&&this.data.install_action&&this.data.install_action(this.data.download,t=>{this.data.installed=t,this.update(void 0)})},e.onbtclick=t=>{this.data.installed&&this.data.uninstall_action&&this.data.uninstall_action(this.data.name,()=>{delete this.data.installed,this.update(void 0)})}}reload(t){this.data=this.data}}t.define("afx-antedit-ext-list-item",e)}(e=t.tag||(t.tag={}))}(e=t.GUI||(t.GUI={})),function(e){class i extends e.BaseApplication{constructor(t){super("Antedit",t),this.currdir=void 0,this.diff_buffer=[void 0,void 0]}main(){this.extensions={},this.eum=new a,this.fileview=this.find("fileview"),this.sidebar=this.find("sidebar"),this.sidebar_container=this.find("sidebar-tab-container"),this.bottombar=this.find("bottombar"),this.langstat=this.find("langstat"),this.editorstat=this.find("editorstat"),this.filestat=this.find("current-file-lbl"),this.extension_list_view=this.find("extension-list"),this.logger=new s(this.find("output-tab")),this.split_mode=!0,this.fileview.fetch=t=>new Promise((async function(e,i){let a;a="string"==typeof t?t.asFileHandle():t;try{const t=await a.read();return t.error?i(t.error):e(t.result)}catch(t){return i(__e(t))}}));let e="Untitled".asFileHandle();this.args&&this.args.length>0&&(this.addRecent(this.args[0].path),"dir"===this.args[0].type?this.currdir=this.args[0].path.asFileHandle():(e=this.args[0].path.asFileHandle(),this.currdir=e.parent())),this.setting.recent||(this.setting.recent=[]),this.setting.extension_repos||(this.setting.extension_repos=["https://raw.githubusercontent.com/lxsang/antos-antedit-extensions/master/extensions.json"]);const i=this.find("wrapper");$(i).css("visibility","hidden"),monaco.editor.setTheme("vs-dark");const n=new t.application.MonacoEditorModel(this,this.find("left-tabbar"),this.find("left-editorarea")),o=new t.application.MonacoEditorModel(this,this.find("right-tabbar"),this.find("right-editorarea"));n.setTabbarCtxMenu(this.tb_ctxmenu,(t,e)=>this.tabbar_ctx_menu_handle(t,e,n)),o.setTabbarCtxMenu(this.tb_ctxmenu,(t,e)=>this.tabbar_ctx_menu_handle(t,e,o)),this.eum.add(n).add(o),this.eum.onstatuschange=t=>this.updateStatus(t),$(i).css("visibility","visible"),this.setup(),this.eum.active.openFile(e)}get tb_ctxmenu(){return[{text:"__(Close)",id:"close"},{text:"__(Reload)",id:"reload",shortcut:"A-R"},{text:"__(Close All)",id:"close-all"},{text:"__(Move to other side)",id:"mv-side"}]}tabbar_ctx_menu_handle(t,e,i){switch(e.id){case"close":if(!t)return;i.closeTab(t);break;case"close-all":i.closeAll();break;case"reload":this.eum.active.reload();break;case"mv-side":if(!t)return;let e=this.eum.editors[0];i==e&&(e=this.eum.editors[1]),e.openFile(t.data),i.closeTab(t),0==this.split_mode&&this.toggleSplitMode()}}setup(){this.sidebar_container.selectedIndex=0,this.extension_list_view.itemtag="afx-antedit-ext-list-item",this.fileview.onfileopen=t=>{if(t.data&&t.data.path&&(this.addRecent(t.data.path),"dir"!==t.data.type))return this.eum.active.openFile(t.data.path.asFileHandle())},this.fileview.onfileselect=t=>{t.data&&t.data.path&&"dir"!==t.data.type&&this.eum.active.selectFile(t.data.path)},this.on("resize",()=>this.eum.resize()),this.on("focus",()=>this.eum.active.focus()),this.fileview.contextmenuHandle=(t,e)=>{let i=this.fileview.selectedFile;const a=[{text:"__(New file)",id:"new"},{text:"__(New folder)",id:"newdir"},{text:"__(Rename)",id:"rename"},{text:"__(Delete)",id:"delete"},{text:"__(Upload)",id:"upload"}];return i&&"file"===i.type&&(a.push({text:"__(Select for compare)",id:"diff-org"}),a.push({text:"__(Compare with selected)",id:"diff-mod"}),a.push({text:"__(Open to right)",id:"open-right"})),e.items=a,e.onmenuselect=t=>this.ctxFileMenuHandle(t),e.show(t)},this.bindKey("ALT-N",()=>this.menuAction("new")),this.bindKey("ALT-O",()=>this.menuAction("open")),this.bindKey("ALT-F",()=>this.menuAction("opendir")),this.bindKey("CTRL-S",()=>this.menuAction("save")),this.bindKey("ALT-W",()=>this.menuAction("saveas")),this.bindKey("ALT-R",()=>this.eum.active.reload()),$(".list-container",this.find("editor-main-container")).each((t,e)=>{$(e).on("wheel",t=>{e.scrollLeft+=t.originalEvent.deltaY})}),this.on("tab-opened",t=>{const e=$(t).closest(".list-container");e&&e[0]&&(e[0].scrollLeft=e[0].scrollWidth)}),this.fileview.ondragndrop=t=>{if(!t.data.from||!t.data.to)return;const e=t.data.from[0].data.path.asFileHandle(),i=t.data.to.data.path;return e.move(`${i}/${e.basename}`).then((function(a){const s=i,n=e.parent().path;s.lengththis.error(__("Unable to move file/folder"),t))},this.on("filechange",t=>{let{path:e}=t.file;return"file"===t.type&&({path:e}=t.file.parent()),this.fileview.update(e)}),this.find("logger-clear").onbtclick=()=>{this.logger.clear()},void 0===this.setting.showBottomBar&&(this.setting.showBottomBar=!1);const t={name:"Editor",text:__("Editor")},e={name:"langmode",text:__("Change language mode"),shortcut:"CTRL-K"};this.eum.addAction(t,e,async t=>{try{const t=await this.openDialog("SelectionDialog",{title:__("Select language"),data:this.eum.active.getModes()});this.eum.active.setMode(t)}catch(t){console.log(t)}}),$(this.find("txt_ext_search")).keyup(t=>this.extension_search(t)),this.loadExtensionMetaData(),this.toggleSideBar(),this.toggleSplitMode(),this.applyAllSetting()}extension_search(t){let e;const i=this.find("txt_ext_search");switch(t.which){case 37:return t.preventDefault();case 38:return this.extension_list_view.selectPrev(),t.preventDefault();case 39:return t.preventDefault();case 40:return this.extension_list_view.selectNext(),t.preventDefault();case 13:return t.preventDefault();default:var a=i.value,s=[];if(2===a.length)return void(this.extension_list_view.data=this.extension_meta_data);if(a.length<3)return;var n=new RegExp(a,"i");for(e in this.extension_meta_data)this.extension_meta_data[e].text.match(n)&&s.push(this.extension_meta_data[e]);this.extension_list_view.data=s}}refreshExtensionRepositories(){const t=[],e=this.meta().path+"/extensions/extensions.json";for(let i of[e].concat(this.setting.extension_repos))t.push(i.asFileHandle().read("json"));Promise.all(t).then(t=>{const e={};for(let i of t.shift())e[i.name]=i;this.extension_meta_data=[];for(let a of t)for(let t of a)e[t.name]&&(t.installed=e[t.name].version),t.install_action=(e,a)=>{new i.extensions.EditorExtensionMaker(this).installZip(e).then(()=>{this.loadExtensionMetaData(),a&&a(t.version),this.notify(__("Extension '{0}' installed",t.text))}).catch(e=>{this.error(__("Unable to install '{0}': {1}",t.text,e.toString()),e)})},t.uninstall_action=(t,e)=>{new i.extensions.EditorExtensionMaker(this).uninstall(t).then(()=>{this.loadExtensionMetaData(),e&&e(),this.notify(__("Extension '{0}' uninstalled",t))}).catch(e=>{this.error(__("Unable to uninstall '{0}': {1}",t,e.toString()),e)})},this.extension_meta_data.push(t);this.extension_list_view.data=this.extension_meta_data}).catch(t=>{this.error(__("Unable to read extension from repositories: {0}",t.toString()),t)})}updateStatus(t){t||(t=this.eum.active.getEditorStatus()),this.editorstat.text=__("Row {0}, col {1}, lines: {2}",t.row,t.column,t.line),t.langmode&&(this.langstat.text=t.langmode.text),this.filestat.text=t.file;let e=this.scheme;e.apptitle!=t.file&&(e.apptitle=t.file)}toggleSideBar(){this.currdir?($(this.sidebar).show(),this.fileview.path=this.currdir.path,this.refreshExtensionRepositories()):$(this.sidebar).hide(),this.trigger("resize")}showOutput(t=!1){t&&this.showBottomBar(!0),this.bottombar.selectedIndex=0}openDiff(e){const i=new t.API.VFS.DiffEditorFileHandle(e);this.eum.active.openFile(i)}applySetting(t){"showBottomBar"==t&&this.showBottomBar(this.setting.showBottomBar)}showBottomBar(t){this.setting.showBottomBar=t,t?$(this.bottombar).show():$(this.bottombar).hide(),this.trigger("resize")}toggleBottomBar(){this.showBottomBar(!this.setting.showBottomBar)}toggleSplitMode(){const t=this.find("right-panel"),e=this.eum.editors[1],i=this.eum.editors[0];if(this.split_mode){if(e.isDirty())return void this.notify(__("Unable to disable split view: Please save changes of modified files on the right panel"));e.closeAll(),$(t).hide(),this.split_mode=!1,i.focus()}else $(t).show(),this.split_mode=!0,e.openFile("Untitled".asFileHandle()),e.focus();this.trigger("resize")}fileMenu(){const t=this.setting.recent.map(t=>({text:t}));return{text:__("File"),nodes:[{text:__("New"),dataid:"new",shortcut:"A-N"},{text:__("Open Recent"),dataid:"recent",nodes:t,onchildselect:(t,e)=>{const i=t.data.item.data.text.asFileHandle();i.onready().then(t=>{t&&("dir"==t.type?(this.currdir=i,this.toggleSideBar()):this.eum.active.openFile(i))})}},{text:__("Open"),dataid:"open",shortcut:"A-O"},{text:__("Open Folder"),dataid:"opendir",shortcut:"A-F"},{text:__("Save"),dataid:"save",shortcut:"C-S"},{text:__("Save as"),dataid:"saveas",shortcut:"A-W"}],onchildselect:(t,e)=>this.menuAction(t.data.item.data.dataid,e)}}ctxFileMenuHandle(t){const e=t.data.item;if(!e)return;const i=e.data;if(!i)return;let a=this.fileview.selectedFile,s=this.currdir;switch(a&&"dir"===a.type&&(s=a.path.asFileHandle()),a&&"file"===a.type&&(s=a.path.asFileHandle().parent()),i.id){case"new":if(!s)return;this.openDialog("PromptDialog",{title:"__(New file)",label:"__(File name)"}).then(async t=>{const e=`${s.path}/${t}`.asFileHandle();try{return await e.write("text/plain"),this.fileview.update(s.path)}catch(t){return this.error(__("Fail to create: {0}",t.stack),__e(t))}});break;case"newdir":if(!s)return;this.openDialog("PromptDialog",{title:"__(New folder)",label:"__(Folder name)"}).then(async t=>{try{return await s.mk(t),this.fileview.update(s.path)}catch(t){return this.error(__("Fail to create: {0}",s.path),__e(t))}});break;case"rename":if(!a)return;this.openDialog("PromptDialog",{title:"__(Rename)",label:"__(File name)",value:a.filename}).then(async t=>{if(t!==a.filename){a=a.path.asFileHandle(),s=a.parent();try{return await a.move(`${s.path}/${t}`),this.fileview.update(s.path)}catch(t){return this.error(__("Fail to rename: {0}",a.path),__e(t))}}});break;case"delete":if(!a)return;this.openDialog("YesNoDialog",{title:"__(Delete)",iconclass:"fa fa-question-circle",text:__("Do you really want to delete: {0}?",a.filename)}).then(async t=>{if(t){a=a.path.asFileHandle(),s=a.parent();try{return await a.remove(),this.fileview.update(s.path)}catch(t){return this.error(__("Fail to delete: {0}",a.path),__e(t))}}});break;case"upload":if(!s)return;s.upload().then(t=>(this.notify(__("File uploaded to: {0}",s.path)),this.fileview.update(s.path))).catch(t=>this.error(__("Unable to upload file: {e}",t.toString()),__e(t)));break;case"diff-org":if(!a)return;this.diff_buffer[0]=a.path.asFileHandle();break;case"diff-mod":if(!a)return;if(!this.diff_buffer[0])return;this.diff_buffer[1]=a.path.asFileHandle(),this.openDiff(this.diff_buffer);break;case"open-right":if(!a||"dir"===a.type)return;0==this.split_mode&&this.toggleSplitMode(),this.eum.editors[1].openFile(a.path.asFileHandle())}}addRecent(t){this.setting.recent||(this.setting.recent=[]),this.setting.recent.includes(t)||(this.setting.recent.unshift(t),this.setting.recent.length>10&&(this.setting.recent=this.setting.recent.slice(0,10)))}menuAction(t,e){let i=this;switch(e&&(i=e),t){case"new":return i.eum.active.openFile("Untitled".asFileHandle());case"open":return i.openDialog("FileDialog",{title:__("Open file"),mimes:Array.from(i.meta().mimes).filter(t=>"dir"!==t)}).then(t=>{this.addRecent(t.file.path),i.eum.active.openFile(t.file.path.asFileHandle())});case"opendir":return i.openDialog("FileDialog",{title:__("Open folder"),mimes:["dir"]}).then((function(t){return i.addRecent(t.file.path),i.currdir=t.file.path.asFileHandle(),i.toggleSideBar()}));case"save":return i.eum.active.save();case"saveas":return i.eum.active.saveAs();default:return console.log(t)}}cleanup(t){let e;const i=this.eum.dirties();if(0!==i.length)t.preventDefault(),this.openDialog("YesNoDialog",{title:"__(Quit)",text:__("Ignore all unsaved files: {0} ?",(()=>{const t=[];for(e of Array.from(i))t.push(e.filename);return t})().join(", "))}).then(t=>{if(t){for(e of Array.from(i))e.dirty=!1;return this.quit(!1)}});else for(let t in this.extensions)this.extensions[t]&&this.extensions[t].cleanup&&this.extensions[t].cleanup()}menu(){return[this.fileMenu(),{text:"__(View)",nodes:[{text:"__(Toggle bottom bar)",dataid:"bottombar"},{text:"__(Toggle split view)",dataid:"splitview"}],onchildselect:(t,e)=>{switch(t.data.item.data.dataid){case"bottombar":return this.toggleBottomBar();case"splitview":return this.toggleSplitMode()}}}]}loadExtensionMetaData(){this.loadExtensionMetaFromFile(this.meta().path+"/extensions/extensions.json").catch(t=>this.error(__("Cannot load extension meta data"),t))}loadExtensionMetaFromFile(t){return new Promise((e,i)=>{t.asFileHandle().read("json").then(t=>{for(let e of t)for(let t of e.actions)this.eum.addAction(e,t,(t,i)=>{this.loadAndRunExtensionAction(t,i,e.root)});e()}).catch(t=>{i(__e(t))})})}loadAndRunExtensionAction(t,e,a){if(i.extensions[t])this.runExtensionAction(t,e);else{let i=`${this.meta().path}/extensions/${t}/main.js`;a&&(i=a+"/main.js"),this._api.requires(i,!0).then(()=>this.runExtensionAction(t,e)).catch(e=>this.error(__("unable to load extension: {0}",t),e))}}runExtensionAction(t,e){if(!this.extensions[t]){if(!i.extensions[t])return this.error(__("Unable to find extension: {0}",t));this.extensions[t]=new i.extensions[t](this)}if(!this.extensions[t][e])return this.error(__("Unable to find action: {0}",e));this.extensions[t].preload().then(()=>this.extensions[t][e]()).catch(t=>this.error(__("Unable to preload extension"),t))}}e.Antedit=i;class a{constructor(){this.active_editor=void 0,this.models=[]}get editors(){return this.models}set contextmenuHandle(t){for(let e of this.models)e.contextmenuHandle=t}get active(){return this.active_editor}add(t){return this.models.push(t),this.active_editor||(this.active_editor=t),t.on("focus",()=>{this.active_editor=t}),this}addAction(t,e,i){const a={id:`${t.name}:${e.name}`,label:`${t.text.__()}: ${e.text.__()}`,keybindings:[],precondition:null,keybindingContext:null,contextMenuGroupId:t.name,run:()=>i(t.name,e.name)};if(e.shortcut){const t=e.shortcut.split("-");let i=0;for(const e of t)switch(e){case"CTRL":i|=monaco.KeyMod.CtrlCmd;break;case"ALT":i|=monaco.KeyMod.Alt;break;case"SHIFT":i|=monaco.KeyMod.Shift;break;case"SUPPER":i|=monaco.KeyMod.WinCtrl;break;default:const t="Key"+e;monaco.KeyCode[t]?i|=monaco.KeyCode[t]:i=0}0!=i&&a.keybindings.push(i)}for(let t of this.models){const e=t.getEditor();e.getAction(a.id)||e.addAction(a)}}set onstatuschange(t){for(let e of this.models)e.onstatuschange=t}dirties(){let t=[];for(let e of this.models)t=t.concat(e.dirties());return t}resize(){for(let t of this.models)t.resize()}}class s{constructor(t){this.target=t}info(t){this.log("info",t,!0)}warn(t){this.log("warn",t,!0)}error(t){this.log("error",t,!0)}log(t,e,i){let a=$("
").attr("class","code-pad-log-"+t);if(i){let t=new Date,i=t.getDate()+"/"+(t.getMonth()+1)+"/"+t.getFullYear()+" "+t.getHours()+":"+t.getMinutes()+":"+t.getSeconds();a.text(`[${i}]: ${e.__()}`)}else a.text(e.__());$(this.target).append(a),$(this.target).scrollTop($(this.target)[0].scrollHeight)}print(t){t.match(/warn/i)?this.log("warn",t,!1):t.match(/error/i)?this.log("error",t,!1):this.log("info",t,!1)}clear(){$(this.target).empty()}}i.Logger=s,i.dependencies=["pkg://MonacoCore/path.js","pkg://MonacoCore/bundle/app.bundle.js"]}(i=t.application||(t.application={}))}(OS||(OS={})),function(t){class e{constructor(t,e){this.app=e,this.name=t}preload(){return t.API.require(t.application.Antedit.extensions[this.name].dependencies)}basedir(){return`${this.app.meta().path}/extensions/${this.name}`}notify(t){return this.app.notify(t)}error(t,e){return this.app.error(t,e)}logger(){return this.app.setting.showBottomBar?this.app.showOutput(!1):this.app.showOutput(!0),this.app.logger}metadata(e){return new Promise((i,a)=>{if(!this.app.currdir)return a(t.API.throwe(__("Current folder is not found")));`${this.app.currdir.path}/${e}`.asFileHandle().read("json").then(t=>{!t.root&&this.app.currdir&&(t.root=this.app.currdir.path),i(t)}).catch(s=>{this.app.openDialog("FileDialog",{title:__("Select build directory"),root:this.app.currdir.path,mimes:["dir"]}).then(t=>{`${t.file.path}/${e}`.asFileHandle().read("json").then(e=>{e.root||(e.root=t.file.path),i(e)}).catch(t=>a(t))}).catch(e=>a(t.API.throwe(__("Unable to read meta-data"))))})})}}e.dependencies=[],t.application.Antedit.extensions={},t.application.Antedit.EditorBaseExtension=e,t.application.Antedit.extensions.EditorExtensionMaker=class extends e{constructor(t){super("EditorExtensionMaker",t)}create(){this.logger().clear(),this.app.openDialog("FileDialog",{title:"__(New extension at)",file:{basename:__("ExtensionName")},mimes:["dir"]}).then(t=>this.mktpl(t.file.path,t.name))}build(e){this.logger().clear(),this.metadata("extension.json").then(async i=>{try{const a=await t.API.VFS.cat(i.javascripts.map(t=>`${i.root}/${t}`),"");await(i.root+"/build/debug/main.js").asFileHandle().setCache(a).write("text/plain"),await(i.root+"/build/debug/extension.json").asFileHandle().setCache(i.meta).write("object"),await t.API.VFS.copy(i.copies.map(t=>`${i.root}/${t}`),i.root+"/build/debug"),this.logger().info(__("Files generated in {0}",i.root+"/build/debug")),e&&e()}catch(t){return this.logger().error(__("Unable to build extension:{0}",t.stack))}}).catch(t=>this.logger().error(__("Unable to read meta-data:{0}",t.stack)))}run(){this.logger().clear(),this.metadata("extension.json").then(async e=>{if(!e||!e.meta||!e.meta.name)return this.logger().error(__("Invalid extension meta-data"));try{const i=e.root+"/build/debug/main.js";t.API.shared[i]&&delete t.API.shared[i],await t.API.requires(i),this.app.extensions[e.meta.name]&&this.app.extensions[e.meta.name].cleanup&&this.app.extensions[e.meta.name].cleanup(),this.app.extensions[e.meta.name]=new t.application.Antedit.extensions[e.meta.name](this.app);for(let t of e.meta.actions)this.app.eum.addAction(e.meta,t,(t,i)=>{this.app.loadAndRunExtensionAction(t,i,e.root+"/build")});this.app.eum.active.getEditor().trigger(e.meta.name,"editor.action.quickCommand")}catch(t){return this.logger().error(__("Unable to run extension:{0}",t.stack))}}).catch(t=>this.logger().error(__("Unable to read meta-data:{0}",t.stack)))}release(){this.logger().clear(),this.metadata("extension.json").then(async e=>{this.build(async()=>{try{await t.API.VFS.mkar(e.root+"/build/debug",`${e.root}/build/release/${e.meta.name}.zip`),this.logger().info(__("Archive created at {0}",`${e.root}/build/release/${e.meta.name}.zip`))}catch(t){return this.logger().error(__("Unable to create archive: {0}",t.stack))}})}).catch(t=>this.logger().error(__("Unable to read meta-data: {0}",t.stack)))}install(){this.logger().clear(),this.app.openDialog("FileDialog",{title:"__(Select extension archive)",mimes:[".*/zip"]}).then(async t=>{try{return await this.installZip(t.file.path),this.logger().info(__("Extension installed")),this.app.loadExtensionMetaData()}catch(t){return this.logger().error(__("Unable to install extension: {0}",t.stack))}})}installFromURL(){this.logger().clear(),this.app.openDialog("PromptDialog",{title:__("Enter URI"),label:__("Please enter extension URI:")}).then(async t=>{if(t)try{return await this.installZip(t),this.logger().info(__("Extension installed")),this.app.loadExtensionMetaData()}catch(e){return this.app.error(__("Unable to install extension: {0}",t))}})}mktpl(e,i){const a=`${e}/${i}`,s=[a,a+"/build",a+"/build/release",a+"/build/debug"],n=[["main.tpl",`${a}/${i}.js`],["meta.tpl",a+"/extension.json"]];t.API.VFS.mkdirAll(s,!0).then(async()=>{try{return await t.API.VFS.mktpl(n,this.basedir(),t=>t.format(i,`${e}/${i}`)),this.app.currdir=a.asFileHandle(),this.app.toggleSideBar(),this.app.eum.active.openFile(`${a}/${i}.js`.asFileHandle())}catch(t){return this.logger().error(__("Unable to create extension template: {0}",t.stack))}}).catch(t=>this.logger().error(__("Unable to create extension directories: {0}",t.stack)))}uninstall(t){return new Promise(async(e,i)=>{try{const i=this.app.meta().path+"/extensions",a=(i+"/extensions.json").asFileHandle(),s=await a.read("json");let n=void 0,o=void 0;for(let e in s)if(s[e].name===t){n=s[e],o=e;break}if(void 0===n)return e();await`${i}/${t}`.asFileHandle().remove(),s.splice(o,1),a.cache=s,await a.write("object"),e()}catch(t){i(t)}})}installZip(e){return new Promise(async(i,a)=>{try{await t.API.requires("os://scripts/jszip.min.js");const a=await e.asFileHandle().read("binary"),s=await JSZip.loadAsync(a),n=await s.file("extension.json").async("uint8array"),o=JSON.parse(new TextDecoder("utf-8").decode(n));await this.uninstall(o.name);const r=this.ext_dir(o.name),l=[r],h=[];for(let t in s.files)s.files[t].dir?l.push(r+"/"+t):"extension.json"!=t&&h.push(t);l.length>0?(await t.API.VFS.mkdirAll(l,!0),await this.installFiles(h,s,o)):await this.installFiles(h,s,o),i()}catch(t){a(__e(t))}})}ext_dir(t){return`${this.app.meta().path}/extensions/${t}`}installFiles(t,e,i){return 0===t.length?this.installMeta(i):new Promise(async(a,s)=>{try{const n=t.splice(0,1)[0],o=`${this.ext_dir(i.name)}/${n}`,r=await e.file(n).async("uint8array"),l=await o.asFileHandle().setCache(new Blob([r],{type:"octet/stream"})).write("text/plain");if(l.error)return s(l.error);await this.installFiles(t,e,i),a()}catch(t){s(__e(t))}})}installMeta(t){return new Promise(async(e,i)=>{const a=(this.ext_dir("")+"/extensions.json").asFileHandle();try{const s=await a.read("json"),n=[];for(let t of s)n.push(t.name);const o=n.indexOf(t.name);o>=0&&s.splice(o,1),s.push(t);try{return await a.setCache(s).write("object"),e()}catch(t){return i(__e(t))}}catch(s){try{return await a.setCache([t]).write("object"),e()}catch(t){return i(__e(t))}}})}}}(OS||(OS={}));
\ No newline at end of file
+var OS;!function(t){let e,i;!function(e){let i;!function(e){class i extends t.API.VFS.BaseFileHandle{constructor(t){super(""),this.path=`${t[0].path} -> ${t[1].path}`,this.cache=t,this.basename=`${t[0].basename} -> ${t[1].basename}`,this.info={type:"file",mime:void 0,size:0,name:this.basename,path:this.path},this.ready=!0}meta(){return new Promise(async(t,e)=>{try{await Promise.all([this.cache[0].meta(),this.cache[1].meta]),t({result:this.info,error:!1})}catch(t){e(t)}})}_rd(t){return new Promise(async(t,e)=>{try{this.cache[0].cache=await this.cache[0].read(),this.cache[1].cache=await this.cache[1].read(),t(this.cache)}catch(t){e(t)}})}_wr(t){return new Promise((t,e)=>{t({result:!0,error:!1})})}setPath(t){}}e.DiffEditorFileHandle=i}(i=e.VFS||(e.VFS={}))}(e=t.API||(t.API={})),function(t){t.BaseEditorModel=class{constructor(t,e,i){this.container=i,this.currfile="Untitled".asFileHandle(),this.tabbar=e,this.editorSetup(i),this.app=t,this.editormux=!1,this.onstatuschange=void 0,this.on("focus",()=>{this.onstatuschange&&this.onstatuschange(this.getEditorStatus())}),this.on("input",()=>this.editormux?(this.editormux=!1,!1):this.currfile.dirty?void 0:(this.currfile.dirty=!0,this.currfile.text+="*",this.tabbar.update(void 0))),this.on("changeCursor",()=>{this.onstatuschange&&this.onstatuschange(this.getEditorStatus())}),this.tabbar.ontabselect=t=>this.selecteTab($(t.data.item).index()),this.tabbar.ontabclose=t=>{const e=t.data.item;return!!e&&(e.data.dirty?(this.app.openDialog("YesNoDialog",{title:__("Close tab"),text:__("Close without saving ?")}).then(t=>t?this.closeTab(e):this.focus()),!1):this.closeTab(e))}}findTabByFile(t){const e=this.tabbar.items,i=(()=>{const i=[];for(let a=0;a(t.cache=e||"",this.newTab(t))).catch(e=>this.app.error(__("Unable to open: {0}",t.path),e)):this.newTab(t):this.tabbar.selected=e}write(){this.currfile.cache=this.getValue(),this.currfile.write("text/plain").then(t=>{this.currfile.dirty=!1,this.currfile.text=this.currfile.basename,this.tabbar.update(void 0)}).catch(t=>this.app.error(__("Unable to save file: {0}",this.currfile.path),t))}save(){return this.currfile.cache=this.getValue(),this.currfile.basename?this.write():this.saveAs()}reload(){return new Promise(async(t,e)=>{try{if("Untitled"===this.currfile.path.toString())return t(!0);if(this.currfile.dirty&&!await this.app.openDialog("YesNoDialog",{title:__("File modified"),text:__("Continue without saving ?")}))return t(!0);const e=await this.currfile.read();this.currfile.cache=e||"",this.currfile.dirty=!1,this.currfile.text=this.currfile.basename?this.currfile.basename:this.currfile.path,this.editormux=!0,this.setValue(this.currfile.cache),this.tabbar.update(void 0)}catch(t){this.app.error(__("Unable to open: {0}",this.currfile.path),t),e(t)}})}saveAs(){this.app.openDialog("FileDialog",{title:__("Save as"),file:this.currfile}).then(t=>{let e=t.file.path.asFileHandle();"file"===t.file.type&&(e=e.parent()),this.currfile.setPath(`${e.path}/${t.name}`),this.write()})}dirties(){const t=[];for(let e of Array.from(this.tabbar.items))e.dirty&&t.push(e);return t}set contextmenuHandle(t){this.container.contextmenuHandle=t}closeAll(){this.tabbar.items=[],this.openFile("Untitled".asFileHandle()),this.resetEditor()}isDirty(){return this.dirties().length>0}setTabbarCtxMenu(t,e){this.tabbar.contextmenuHandle=(i,a)=>(a.items=t,a.onmenuselect=t=>{if(e){const a=$(i.target).closest("afx-list-item");e(a[0],t.data.item.data)}},a.show(i))}}}(i=t.application||(t.application={}))}(OS||(OS={})),function(t){let e;!function(e){class i extends t.application.BaseEditorModel{constructor(t,e,i){super(t,e,i)}resetEditor(){}getTexModel(){return{model:this.editor.getModel(),position:this.editor.getPosition()}}setTextModel(t){this.editor.setModel(t.model),t.position&&(this.editor.setPosition(t.position),this.editor.revealLineInCenter(t.position.lineNumber)),this.editor==this._code_editor&&this.editor.updateOptions({readOnly:!1,domReadOnly:!1})}newTextModelFrom(t){if(Array.isArray(t.cache))return{model:{original:this.newTextModelFrom(t.cache[0]).model,modified:this.newTextModelFrom(t.cache[1]).model}};{if("Untitled"===t.path.toString())return{model:monaco.editor.createModel(t.cache,"textplain")};const e=monaco.Uri.parse(t.protocol+"://antedit/file/"+t.genealogy.join("/")),i=monaco.editor.getModel(e);return i?(i.setValue(t.cache),{model:i}):{model:monaco.editor.createModel(t.cache,void 0,e)}}}getModes(){return monaco.languages.getLanguages().map(t=>{const e=t;return t.aliases?e.text=t.aliases[0]:e.text=t.id,t})}setTheme(t){}setMode(t){if(this.editor==this._code_editor)monaco.editor.setModelLanguage(this.editor.getModel(),t.id);else for(const e of this.editor.getModel())monaco.editor.setModelLanguage(e,t.id);this.onstatuschange&&this.onstatuschange(this.getEditorStatus())}get editor(){return Array.isArray(this.currfile.cache)?this._diff_editor:this._code_editor}editorSetup(t){this.code_container=$("
").css("width","100%").css("height","100%"),this.diff_container=$("
").css("width","100%").css("height","100%").css("display","none"),$(t).append(this.code_container),$(t).append(this.diff_container),this._code_editor=monaco.editor.create(this.code_container[0],{value:"",language:"textplain",readOnly:!1,domReadOnly:!1}),this._diff_editor=monaco.editor.createDiffEditor(this.diff_container[0],{readOnly:!0}),i.modes||(i.modes={},monaco.languages.getLanguages().forEach(t=>{i.modes[t.id]=t}))}on(t,e){switch(t){case"input":this._code_editor.onDidChangeModelContent(e);break;case"focus":this._code_editor.onDidFocusEditorText(e),this._diff_editor.getOriginalEditor().onDidFocusEditorText(e),this._diff_editor.getModifiedEditor().onDidFocusEditorText(e);break;case"changeCursor":this._code_editor.onDidChangeCursorPosition(e),this._diff_editor.getOriginalEditor().onDidChangeCursorPosition(e),this._diff_editor.getModifiedEditor().onDidChangeCursorPosition(e)}}resize(){this.editor&&this.editor.layout()}focus(){Array.isArray(this.currfile.cache)?(this.code_container.hide(),this.diff_container.show()):(this.code_container.show(),this.diff_container.hide()),this.editor&&(this.editor.layout(),this.editor.focus())}getModeForPath(t){return{}}getEditorStatus(){let t=void 0;this.editor==this._code_editor?t=this.editor:(t=this.editor.getOriginalEditor(),this.editor.getModifiedEditor().hasTextFocus()&&(t=this.editor.getModifiedEditor()));const e=t.getPosition();let a=void 0;const s=t.getModel();return s&&(a=i.modes[s.getLanguageId()]),{row:e.lineNumber,column:e.column,line:s?s.getLineCount():0,langmode:{text:a?a.aliases[0]:"",mode:a},file:this.currfile.path}}getValue(){return this.editor==this._code_editor?this.editor.getValue():this.currfile.cache}setValue(t){this.editor==this._code_editor&&this.editor.setValue(t)}getEditor(){return this._code_editor}}e.MonacoEditorModel=i}(e=t.application||(t.application={}))}(OS||(OS={})),function(t){let e,i;!function(t){let e;!function(t){class e extends t.ListViewItemTag{itemlayout(){return{el:"div",children:[{el:"afx-label",ref:"label"},{el:"p",ref:"desc",id:"ext-list-item-d-p"},{el:"p",id:"ext-list-item-b-p",children:[{el:"i",ref:"intall_status"},{el:"afx-button",ref:"btn_remove"},{el:"afx-button",ref:"btn_install"}]}]}}ondatachange(){const t=this.data;if(!t)return;const e=this.refs.label;e.iconclass="bi bi-puzzle",e.text=`${t.text} - v${t.version}`;const i=this.refs.desc;$(i).text(t.description);const a=this.refs.btn_install,s=this.refs.btn_remove;t.installed?($(s).show(),s.iconclass="bi bi-trash-fill",a.iconclass="bi bi-arrow-repeat",$(this.refs.intall_status).text(__("Installed: v{0} ",t.installed).__())):($(s).hide(),a.iconclass="fa bi-cloud-download-fill",$(this.refs.intall_status).text(" "))}init(){this.closable=!1,this.data={};const t=this.refs.btn_install,e=this.refs.btn_remove;t.onbtclick=t=>{this.data.download&&this.data.install_action&&this.data.install_action(this.data.download,t=>{this.data.installed=t,this.update(void 0)})},e.onbtclick=t=>{this.data.installed&&this.data.uninstall_action&&this.data.uninstall_action(this.data.name,()=>{delete this.data.installed,this.update(void 0)})}}reload(t){this.data=this.data}}t.define("afx-antedit-ext-list-item",e)}(e=t.tag||(t.tag={}))}(e=t.GUI||(t.GUI={})),function(e){class i extends e.BaseApplication{constructor(t){super("Antedit",t),this.currdir=void 0,this.diff_buffer=[void 0,void 0]}main(){this.extensions={},this.eum=new a,this.fileview=this.find("fileview"),this.sidebar=this.find("sidebar"),this.sidebar_container=this.find("sidebar-tab-container"),this.bottombar=this.find("bottombar"),this.langstat=this.find("langstat"),this.editorstat=this.find("editorstat"),this.filestat=this.find("current-file-lbl"),this.extension_list_view=this.find("extension-list"),this.logger=new s(this.find("output-tab")),this.split_mode=!0,this.fileview.fetch=t=>new Promise((async function(e,i){let a;a="string"==typeof t?t.asFileHandle():t;try{const t=await a.read();return t.error?i(t.error):e(t.result)}catch(t){return i(__e(t))}}));let e="Untitled".asFileHandle();this.args&&this.args.length>0&&(this.addRecent(this.args[0].path),"dir"===this.args[0].type?this.currdir=this.args[0].path.asFileHandle():(e=this.args[0].path.asFileHandle(),this.currdir=e.parent())),this.setting.recent||(this.setting.recent=[]),this.setting.extension_repos||(this.setting.extension_repos=["https://raw.githubusercontent.com/lxsang/antos-antedit-extensions/master/extensions.json"]);const i=this.find("wrapper");$(i).css("visibility","hidden"),monaco.editor.setTheme("vs-dark");const n=new t.application.MonacoEditorModel(this,this.find("left-tabbar"),this.find("left-editorarea")),o=new t.application.MonacoEditorModel(this,this.find("right-tabbar"),this.find("right-editorarea"));n.setTabbarCtxMenu(this.tb_ctxmenu,(t,e)=>this.tabbar_ctx_menu_handle(t,e,n)),o.setTabbarCtxMenu(this.tb_ctxmenu,(t,e)=>this.tabbar_ctx_menu_handle(t,e,o)),this.eum.add(n).add(o),this.eum.onstatuschange=t=>this.updateStatus(t),$(i).css("visibility","visible"),this.setup(),this.eum.active.openFile(e)}get tb_ctxmenu(){return[{text:"__(Close)",id:"close"},{text:"__(Reload)",id:"reload",shortcut:"A-R"},{text:"__(Close All)",id:"close-all"},{text:"__(Move to other side)",id:"mv-side"}]}tabbar_ctx_menu_handle(t,e,i){switch(e.id){case"close":if(!t)return;i.closeTab(t);break;case"close-all":i.closeAll();break;case"reload":this.eum.active.reload();break;case"mv-side":if(!t)return;let e=this.eum.editors[0];i==e&&(e=this.eum.editors[1]),e.openFile(t.data),i.closeTab(t),0==this.split_mode&&this.toggleSplitMode()}}setup(){this.sidebar_container.selectedIndex=0,this.extension_list_view.itemtag="afx-antedit-ext-list-item",this.fileview.onfileopen=t=>{if(t.data&&t.data.path&&(this.addRecent(t.data.path),"dir"!==t.data.type))return this.eum.active.openFile(t.data.path.asFileHandle())},this.fileview.onfileselect=t=>{t.data&&t.data.path&&"dir"!==t.data.type&&this.eum.active.selectFile(t.data.path)},this.on("resize",()=>this.eum.resize()),this.on("focus",()=>this.eum.active.focus()),this.fileview.contextmenuHandle=(t,e)=>{let i=this.fileview.selectedFile;const a=[{text:"__(New file)",id:"new"},{text:"__(New folder)",id:"newdir"},{text:"__(Rename)",id:"rename"},{text:"__(Delete)",id:"delete"},{text:"__(Upload)",id:"upload"}];return i&&"file"===i.type&&(a.push({text:"__(Select for compare)",id:"diff-org"}),a.push({text:"__(Compare with selected)",id:"diff-mod"}),a.push({text:"__(Open to right)",id:"open-right"})),e.items=a,e.onmenuselect=t=>this.ctxFileMenuHandle(t),e.show(t)},this.bindKey("ALT-N",()=>this.menuAction("new")),this.bindKey("ALT-O",()=>this.menuAction("open")),this.bindKey("ALT-F",()=>this.menuAction("opendir")),this.bindKey("CTRL-S",()=>this.menuAction("save")),this.bindKey("ALT-W",()=>this.menuAction("saveas")),this.bindKey("ALT-R",()=>this.eum.active.reload()),$(".list-container",this.find("editor-main-container")).each((t,e)=>{$(e).on("wheel",t=>{e.scrollLeft+=t.originalEvent.deltaY})}),this.on("tab-opened",t=>{const e=$(t).closest(".list-container");e&&e[0]&&(e[0].scrollLeft=e[0].scrollWidth)}),this.fileview.ondragndrop=t=>{if(!t.data.from||!t.data.to)return;const e=t.data.from[0].data.path.asFileHandle(),i=t.data.to.data.path;return e.move(`${i}/${e.basename}`).then((function(a){const s=i,n=e.parent().path;s.lengththis.error(__("Unable to move file/folder"),t))},this.on("filechange",t=>{let{path:e}=t.file;return"file"===t.type&&({path:e}=t.file.parent()),this.fileview.update(e)}),this.find("logger-clear").onbtclick=()=>{this.logger.clear()},void 0===this.setting.showBottomBar&&(this.setting.showBottomBar=!1);const t={name:"Editor",text:__("Editor")},e={name:"langmode",text:__("Change language mode"),shortcut:"CTRL-K"};this.eum.addAction(t,e,async t=>{try{const t=await this.openDialog("SelectionDialog",{title:__("Select language"),data:this.eum.active.getModes()});this.eum.active.setMode(t)}catch(t){console.log(t)}}),$(this.find("txt_ext_search")).keyup(t=>this.extension_search(t)),this.loadExtensionMetaData(),this.toggleSideBar(),this.toggleSplitMode(),this.applyAllSetting()}extension_search(t){let e;const i=this.find("txt_ext_search");switch(t.which){case 37:return t.preventDefault();case 38:return this.extension_list_view.selectPrev(),t.preventDefault();case 39:return t.preventDefault();case 40:return this.extension_list_view.selectNext(),t.preventDefault();case 13:return t.preventDefault();default:var a=i.value,s=[];if(2===a.length)return void(this.extension_list_view.data=this.extension_meta_data);if(a.length<3)return;var n=new RegExp(a,"i");for(e in this.extension_meta_data)this.extension_meta_data[e].text.match(n)&&s.push(this.extension_meta_data[e]);this.extension_list_view.data=s}}refreshExtensionRepositories(){const t=[],e=this.meta().path+"/extensions/extensions.json";for(let i of[e].concat(this.setting.extension_repos))t.push(i.asFileHandle().read("json"));Promise.all(t).then(t=>{const e={};for(let i of t.shift())e[i.name]=i;this.extension_meta_data=[];for(let a of t)for(let t of a)e[t.name]&&(t.installed=e[t.name].version),t.install_action=(e,a)=>{new i.extensions.EditorExtensionMaker(this).installZip(e).then(()=>{this.loadExtensionMetaData(),a&&a(t.version),this.notify(__("Extension '{0}' installed",t.text))}).catch(e=>{this.error(__("Unable to install '{0}': {1}",t.text,e.toString()),e)})},t.uninstall_action=(t,e)=>{new i.extensions.EditorExtensionMaker(this).uninstall(t).then(()=>{this.loadExtensionMetaData(),e&&e(),this.notify(__("Extension '{0}' uninstalled",t))}).catch(e=>{this.error(__("Unable to uninstall '{0}': {1}",t,e.toString()),e)})},this.extension_meta_data.push(t);this.extension_list_view.data=this.extension_meta_data}).catch(t=>{this.error(__("Unable to read extension from repositories: {0}",t.toString()),t)})}updateStatus(t){t||(t=this.eum.active.getEditorStatus()),this.editorstat.text=__("Row {0}, col {1}, lines: {2}",t.row,t.column,t.line),t.langmode&&(this.langstat.text=t.langmode.text),this.filestat.text=t.file;let e=this.scheme;e.apptitle!=t.file&&(e.apptitle=t.file)}toggleSideBar(){this.currdir?($(this.sidebar).show(),this.fileview.path=this.currdir.path,this.refreshExtensionRepositories()):$(this.sidebar).hide(),this.trigger("resize")}showOutput(t=!1){t&&this.showBottomBar(!0),this.bottombar.selectedIndex=0}openDiff(e){const i=new t.API.VFS.DiffEditorFileHandle(e);this.eum.active.openFile(i)}applySetting(t){"showBottomBar"==t&&this.showBottomBar(this.setting.showBottomBar)}showBottomBar(t){this.setting.showBottomBar=t,t?$(this.bottombar).show():$(this.bottombar).hide(),this.trigger("resize")}toggleBottomBar(){this.showBottomBar(!this.setting.showBottomBar)}toggleSplitMode(){const t=this.find("right-panel"),e=this.eum.editors[1],i=this.eum.editors[0];if(this.split_mode){if(e.isDirty())return void this.notify(__("Unable to disable split view: Please save changes of modified files on the right panel"));e.closeAll(),$(t).hide(),this.split_mode=!1,i.focus()}else $(t).show(),this.split_mode=!0,e.openFile("Untitled".asFileHandle()),e.focus();this.trigger("resize")}fileMenu(){const t=this.setting.recent.map(t=>({text:t}));return{text:__("File"),nodes:[{text:__("New"),dataid:"new",shortcut:"A-N"},{text:__("Open Recent"),dataid:"recent",nodes:t,onchildselect:(t,e)=>{const i=t.data.item.data.text.asFileHandle();i.onready().then(t=>{t&&("dir"==t.type?(this.currdir=i,this.toggleSideBar()):this.eum.active.openFile(i))})}},{text:__("Open"),dataid:"open",shortcut:"A-O"},{text:__("Open Folder"),dataid:"opendir",shortcut:"A-F"},{text:__("Save"),dataid:"save",shortcut:"C-S"},{text:__("Save as"),dataid:"saveas",shortcut:"A-W"}],onchildselect:(t,e)=>this.menuAction(t.data.item.data.dataid,e)}}ctxFileMenuHandle(t){const e=t.data.item;if(!e)return;const i=e.data;if(!i)return;let a=this.fileview.selectedFile,s=this.currdir;switch(a&&"dir"===a.type&&(s=a.path.asFileHandle()),a&&"file"===a.type&&(s=a.path.asFileHandle().parent()),i.id){case"new":if(!s)return;this.openDialog("PromptDialog",{title:"__(New file)",label:"__(File name)"}).then(async t=>{const e=`${s.path}/${t}`.asFileHandle();try{return await e.write("text/plain"),this.fileview.update(s.path)}catch(t){return this.error(__("Fail to create: {0}",t.stack),__e(t))}});break;case"newdir":if(!s)return;this.openDialog("PromptDialog",{title:"__(New folder)",label:"__(Folder name)"}).then(async t=>{try{return await s.mk(t),this.fileview.update(s.path)}catch(t){return this.error(__("Fail to create: {0}",s.path),__e(t))}});break;case"rename":if(!a)return;this.openDialog("PromptDialog",{title:"__(Rename)",label:"__(File name)",value:a.filename}).then(async t=>{if(t!==a.filename){a=a.path.asFileHandle(),s=a.parent();try{return await a.move(`${s.path}/${t}`),this.fileview.update(s.path)}catch(t){return this.error(__("Fail to rename: {0}",a.path),__e(t))}}});break;case"delete":if(!a)return;this.openDialog("YesNoDialog",{title:"__(Delete)",iconclass:"fa fa-question-circle",text:__("Do you really want to delete: {0}?",a.filename)}).then(async t=>{if(t){a=a.path.asFileHandle(),s=a.parent();try{return await a.remove(),this.fileview.update(s.path)}catch(t){return this.error(__("Fail to delete: {0}",a.path),__e(t))}}});break;case"upload":if(!s)return;s.upload().then(t=>(this.notify(__("File uploaded to: {0}",s.path)),this.fileview.update(s.path))).catch(t=>this.error(__("Unable to upload file: {e}",t.toString()),__e(t)));break;case"diff-org":if(!a)return;this.diff_buffer[0]=a.path.asFileHandle();break;case"diff-mod":if(!a)return;if(!this.diff_buffer[0])return;this.diff_buffer[1]=a.path.asFileHandle(),this.openDiff(this.diff_buffer);break;case"open-right":if(!a||"dir"===a.type)return;0==this.split_mode&&this.toggleSplitMode(),this.eum.editors[1].openFile(a.path.asFileHandle())}}addRecent(t){this.setting.recent||(this.setting.recent=[]),this.setting.recent.includes(t)||(this.setting.recent.unshift(t),this.setting.recent.length>10&&(this.setting.recent=this.setting.recent.slice(0,10)))}menuAction(t,e){let i=this;switch(e&&(i=e),t){case"new":return i.eum.active.openFile("Untitled".asFileHandle());case"open":return i.openDialog("FileDialog",{title:__("Open file"),mimes:Array.from(i.meta().mimes).filter(t=>"dir"!==t)}).then(t=>{this.addRecent(t.file.path),i.eum.active.openFile(t.file.path.asFileHandle())});case"opendir":return i.openDialog("FileDialog",{title:__("Open folder"),mimes:["dir"]}).then((function(t){return i.addRecent(t.file.path),i.currdir=t.file.path.asFileHandle(),i.toggleSideBar()}));case"save":return i.eum.active.save();case"saveas":return i.eum.active.saveAs();default:return console.log(t)}}cleanup(t){let e;const i=this.eum.dirties();if(0!==i.length)t.preventDefault(),this.openDialog("YesNoDialog",{title:"__(Quit)",text:__("Ignore all unsaved files: {0} ?",(()=>{const t=[];for(e of Array.from(i))t.push(e.filename);return t})().join(", "))}).then(t=>{if(t){for(e of Array.from(i))e.dirty=!1;return this.quit(!1)}});else for(let t in this.extensions)this.extensions[t]&&this.extensions[t].cleanup&&this.extensions[t].cleanup()}menu(){return[this.fileMenu(),{text:"__(View)",nodes:[{text:"__(Toggle bottom bar)",dataid:"bottombar"},{text:"__(Toggle split view)",dataid:"splitview"}],onchildselect:(t,e)=>{switch(t.data.item.data.dataid){case"bottombar":return this.toggleBottomBar();case"splitview":return this.toggleSplitMode()}}}]}loadExtensionMetaData(){this.loadExtensionMetaFromFile(this.meta().path+"/extensions/extensions.json").catch(t=>this.error(__("Cannot load extension meta data"),t))}loadExtensionMetaFromFile(t){return new Promise((e,i)=>{t.asFileHandle().read("json").then(t=>{for(let e of t)for(let t of e.actions)this.eum.addAction(e,t,(t,i)=>{this.loadAndRunExtensionAction(t,i,e.root)});e()}).catch(t=>{i(__e(t))})})}loadAndRunExtensionAction(t,e,a){if(i.extensions[t])this.runExtensionAction(t,e);else{let i=`${this.meta().path}/extensions/${t}/main.js`;a&&(i=a+"/main.js"),this._api.requires(i,!0).then(()=>this.runExtensionAction(t,e)).catch(e=>this.error(__("unable to load extension: {0}",t),e))}}runExtensionAction(t,e){if(!this.extensions[t]){if(!i.extensions[t])return this.error(__("Unable to find extension: {0}",t));this.extensions[t]=new i.extensions[t](this)}if(!this.extensions[t][e])return this.error(__("Unable to find action: {0}",e));this.extensions[t].preload().then(()=>this.extensions[t][e]()).catch(t=>this.error(__("Unable to preload extension"),t))}}e.Antedit=i;class a{constructor(){this.active_editor=void 0,this.models=[]}get editors(){return this.models}set contextmenuHandle(t){for(let e of this.models)e.contextmenuHandle=t}get active(){return this.active_editor}add(t){return this.models.push(t),this.active_editor||(this.active_editor=t),t.on("focus",()=>{this.active_editor=t}),this}addAction(t,e,i){const a={id:`${t.name}:${e.name}`,label:`${t.text.__()}: ${e.text.__()}`,keybindings:[],precondition:null,keybindingContext:null,contextMenuGroupId:t.name,run:()=>i(t.name,e.name)};if(e.shortcut){const t=e.shortcut.split("-");let i=0;for(const e of t)switch(e){case"CTRL":i|=monaco.KeyMod.CtrlCmd;break;case"ALT":i|=monaco.KeyMod.Alt;break;case"SHIFT":i|=monaco.KeyMod.Shift;break;case"SUPPER":i|=monaco.KeyMod.WinCtrl;break;default:const t="Key"+e;monaco.KeyCode[t]?i|=monaco.KeyCode[t]:i=0}0!=i&&a.keybindings.push(i)}for(let t of this.models){const e=t.getEditor();e.getAction(a.id)||e.addAction(a)}}set onstatuschange(t){for(let e of this.models)e.onstatuschange=t}dirties(){let t=[];for(let e of this.models)t=t.concat(e.dirties());return t}resize(){for(let t of this.models)t.resize()}}class s{constructor(t){this.target=t}info(t){this.log("info",t,!0)}warn(t){this.log("warn",t,!0)}error(t){this.log("error",t,!0)}log(t,e,i){let a=$("
").attr("class","code-pad-log-"+t);if(i){let t=new Date,i=t.getDate()+"/"+(t.getMonth()+1)+"/"+t.getFullYear()+" "+t.getHours()+":"+t.getMinutes()+":"+t.getSeconds();a.text(`[${i}]: ${e.__()}`)}else a.text(e.__());$(this.target).append(a),$(this.target).scrollTop($(this.target)[0].scrollHeight)}print(t){t.match(/warn/i)?this.log("warn",t,!1):t.match(/error/i)?this.log("error",t,!1):this.log("info",t,!1)}clear(){$(this.target).empty()}}i.Logger=s,i.dependencies=["pkg://MonacoCore/path.js","pkg://MonacoCore/bundle/app.bundle.js"]}(i=t.application||(t.application={}))}(OS||(OS={})),function(t){class e{constructor(t,e){this.app=e,this.name=t}preload(){return t.API.require(t.application.Antedit.extensions[this.name].dependencies)}basedir(){return`${this.app.meta().path}/extensions/${this.name}`}notify(t){return this.app.notify(t)}error(t,e){return this.app.error(t,e)}logger(){return this.app.setting.showBottomBar?this.app.showOutput(!1):this.app.showOutput(!0),this.app.logger}metadata(e){return new Promise((i,a)=>{if(!this.app.currdir)return a(t.API.throwe(__("Current folder is not found")));`${this.app.currdir.path}/${e}`.asFileHandle().read("json").then(t=>{!t.root&&this.app.currdir&&(t.root=this.app.currdir.path),i(t)}).catch(s=>{this.app.openDialog("FileDialog",{title:__("Select build directory"),root:this.app.currdir.path,mimes:["dir"]}).then(t=>{`${t.file.path}/${e}`.asFileHandle().read("json").then(e=>{e.root||(e.root=t.file.path),i(e)}).catch(t=>a(t))}).catch(e=>a(t.API.throwe(__("Unable to read meta-data"))))})})}}e.dependencies=[],t.application.Antedit.extensions={},t.application.Antedit.EditorBaseExtension=e,t.application.Antedit.extensions.EditorExtensionMaker=class extends e{constructor(t){super("EditorExtensionMaker",t)}create(){this.logger().clear(),this.app.openDialog("FileDialog",{title:"__(New extension at)",file:{basename:__("ExtensionName")},mimes:["dir"]}).then(t=>this.mktpl(t.file.path,t.name))}build(e){this.logger().clear(),this.metadata("extension.json").then(async i=>{try{const a=await t.API.VFS.cat(i.javascripts.map(t=>`${i.root}/${t}`),"");await(i.root+"/build/debug/main.js").asFileHandle().setCache(a).write("text/plain"),await(i.root+"/build/debug/extension.json").asFileHandle().setCache(i.meta).write("object"),await t.API.VFS.copy(i.copies.map(t=>`${i.root}/${t}`),i.root+"/build/debug"),this.logger().info(__("Files generated in {0}",i.root+"/build/debug")),e&&e()}catch(t){return this.logger().error(__("Unable to build extension:{0}",t.stack))}}).catch(t=>this.logger().error(__("Unable to read meta-data:{0}",t.stack)))}run(){this.logger().clear(),this.metadata("extension.json").then(async e=>{if(!e||!e.meta||!e.meta.name)return this.logger().error(__("Invalid extension meta-data"));try{const i=e.root+"/build/debug/main.js";t.API.shared[i]&&delete t.API.shared[i],await t.API.requires(i),this.app.extensions[e.meta.name]&&this.app.extensions[e.meta.name].cleanup&&this.app.extensions[e.meta.name].cleanup(),this.app.extensions[e.meta.name]=new t.application.Antedit.extensions[e.meta.name](this.app);for(let t of e.meta.actions)this.app.eum.addAction(e.meta,t,(t,i)=>{this.app.loadAndRunExtensionAction(t,i,e.root+"/build")});this.app.eum.active.getEditor().trigger(e.meta.name,"editor.action.quickCommand")}catch(t){return this.logger().error(__("Unable to run extension:{0}",t.stack))}}).catch(t=>this.logger().error(__("Unable to read meta-data:{0}",t.stack)))}release(){this.logger().clear(),this.metadata("extension.json").then(async e=>{this.build(async()=>{try{await t.API.VFS.mkar(e.root+"/build/debug",`${e.root}/build/release/${e.meta.name}.zip`),this.logger().info(__("Archive created at {0}",`${e.root}/build/release/${e.meta.name}.zip`))}catch(t){return this.logger().error(__("Unable to create archive: {0}",t.stack))}})}).catch(t=>this.logger().error(__("Unable to read meta-data: {0}",t.stack)))}install(){this.logger().clear(),this.app.openDialog("FileDialog",{title:"__(Select extension archive)",mimes:[".*/zip"]}).then(async t=>{try{return await this.installZip(t.file.path),this.logger().info(__("Extension installed")),this.app.loadExtensionMetaData()}catch(t){return this.logger().error(__("Unable to install extension: {0}",t.stack))}})}installFromURL(){this.logger().clear(),this.app.openDialog("PromptDialog",{title:__("Enter URI"),label:__("Please enter extension URI:")}).then(async t=>{if(t)try{return await this.installZip(t),this.logger().info(__("Extension installed")),this.app.loadExtensionMetaData()}catch(e){return this.app.error(__("Unable to install extension: {0}",t))}})}mktpl(e,i){const a=`${e}/${i}`,s=[a,a+"/build",a+"/build/release",a+"/build/debug"],n=[["main.tpl",`${a}/${i}.js`],["meta.tpl",a+"/extension.json"]];t.API.VFS.mkdirAll(s,!0).then(async()=>{try{return await t.API.VFS.mktpl(n,this.basedir(),t=>t.format(i,`${e}/${i}`)),this.app.currdir=a.asFileHandle(),this.app.toggleSideBar(),this.app.eum.active.openFile(`${a}/${i}.js`.asFileHandle())}catch(t){return this.logger().error(__("Unable to create extension template: {0}",t.stack))}}).catch(t=>this.logger().error(__("Unable to create extension directories: {0}",t.stack)))}uninstall(t){return new Promise(async(e,i)=>{try{const i=this.app.meta().path+"/extensions",a=(i+"/extensions.json").asFileHandle(),s=await a.read("json");let n=void 0,o=void 0;for(let e in s)if(s[e].name===t){n=s[e],o=e;break}if(void 0===n)return e();await`${i}/${t}`.asFileHandle().remove(),s.splice(o,1),a.cache=s,await a.write("object"),e()}catch(t){i(t)}})}installZip(e){return new Promise(async(i,a)=>{try{await t.API.requires("os://scripts/jszip.min.js");const a=await e.asFileHandle().read("binary"),s=await JSZip.loadAsync(a),n=await s.file("extension.json").async("uint8array"),o=JSON.parse(new TextDecoder("utf-8").decode(n));await this.uninstall(o.name);const r=this.ext_dir(o.name),l=[r],h=[];for(let t in s.files)s.files[t].dir?l.push(r+"/"+t):"extension.json"!=t&&h.push(t);l.length>0?(await t.API.VFS.mkdirAll(l,!0),await this.installFiles(h,s,o)):await this.installFiles(h,s,o),i()}catch(t){a(__e(t))}})}ext_dir(t){return`${this.app.meta().path}/extensions/${t}`}installFiles(t,e,i){return 0===t.length?this.installMeta(i):new Promise(async(a,s)=>{try{const n=t.splice(0,1)[0],o=`${this.ext_dir(i.name)}/${n}`,r=await e.file(n).async("uint8array"),l=await o.asFileHandle().setCache(new Blob([r],{type:"octet/stream"})).write("text/plain");if(l.error)return s(l.error);await this.installFiles(t,e,i),a()}catch(t){s(__e(t))}})}installMeta(t){return new Promise(async(e,i)=>{const a=(this.ext_dir("")+"/extensions.json").asFileHandle();try{const s=await a.read("json"),n=[];for(let t of s)n.push(t.name);const o=n.indexOf(t.name);o>=0&&s.splice(o,1),s.push(t);try{return await a.setCache(s).write("object"),e()}catch(t){return i(__e(t))}}catch(s){try{return await a.setCache([t]).write("object"),e()}catch(t){return i(__e(t))}}})}}}(OS||(OS={}));
\ No newline at end of file
diff --git a/Antedit/build/release/Antedit.zip b/Antedit/build/release/Antedit.zip
index ae88805..8b7d352 100644
Binary files a/Antedit/build/release/Antedit.zip and b/Antedit/build/release/Antedit.zip differ
diff --git a/Antedit/ts/BaseEditorModel.ts b/Antedit/ts/BaseEditorModel.ts
index f09d2c8..151965d 100644
--- a/Antedit/ts/BaseEditorModel.ts
+++ b/Antedit/ts/BaseEditorModel.ts
@@ -59,8 +59,7 @@ namespace OS {
                     });
                 }
                 
-                protected _wr(t: string, d: any): Promise {
-                    this.cache = d;
+                protected _wr(t: string): Promise {
                     return new Promise((resolve, reject) =>
                     {
                         resolve({
diff --git a/Antedit/ts/main.ts b/Antedit/ts/main.ts
index 7e36825..4829621 100644
--- a/Antedit/ts/main.ts
+++ b/Antedit/ts/main.ts
@@ -817,7 +817,7 @@ namespace OS {
                             dataid: "recent",
                             nodes: recent,
                             onchildselect: (
-                                e: GUI.TagEventType,
+                                e: GUI.TagEventType,
                                 r: Antedit
                             ) => {
                                 const handle = e.data.item.data.text.asFileHandle();
@@ -849,7 +849,7 @@ namespace OS {
                         },
                     ],
                     onchildselect: (
-                        e: GUI.TagEventType,
+                        e: GUI.TagEventType,
                         r: Antedit
                     ) => {
                         return this.menuAction(e.data.item.data.dataid, r);
@@ -866,9 +866,9 @@ namespace OS {
              * @memberof Antedit
              */
             private ctxFileMenuHandle(
-                e: GUI.TagEventType
+                e: GUI.TagEventType
             ): void {
-                const el = e.data.item as GUI.tag.MenuEntryTag;
+                const el = e.data.item;
                 if (!el) {
                     return;
                 }
@@ -1150,7 +1150,7 @@ namespace OS {
                             }
                         ],
                         onchildselect: (
-                            e: GUI.TagEventType,
+                            e: GUI.TagEventType,
                             r: EditorFileHandle
                         ) => {
                             switch (e.data.item.data.dataid) {
diff --git a/Antunnel/build/release/Antunnel.zip b/Antunnel/build/release/Antunnel.zip
index e6bd64c..114cac6 100644
Binary files a/Antunnel/build/release/Antunnel.zip and b/Antunnel/build/release/Antunnel.zip differ
diff --git a/AntunnelPlugins/build.json b/AntunnelPlugins/build.json
index 13cd03a..2c1de80 100644
--- a/AntunnelPlugins/build.json
+++ b/AntunnelPlugins/build.json
@@ -17,8 +17,10 @@
                     "data": ["build","build/debug","build/release"]
                 },
                 {
-                    "name": "ts-import",
-                    "data": ["sdk://core/ts/core.d.ts", "sdk://core/ts/jquery.d.ts","sdk://core/ts/antos.d.ts"]
+                    "name": "ts-antos-sdk",
+                    "data": {
+                        "version": "2.0.x"
+                    }
                 },
                 {
                     "name": "ts-compile",
diff --git a/AntunnelPlugins/build/release/AntunnelPlugins.zip b/AntunnelPlugins/build/release/AntunnelPlugins.zip
index 7b7bd35..6e557b6 100644
Binary files a/AntunnelPlugins/build/release/AntunnelPlugins.zip and b/AntunnelPlugins/build/release/AntunnelPlugins.zip differ
diff --git a/Archive/build/release/Archive.zip b/Archive/build/release/Archive.zip
index 216bde7..24f870c 100644
Binary files a/Archive/build/release/Archive.zip and b/Archive/build/release/Archive.zip differ
diff --git a/Blogger/build/release/Blogger.zip b/Blogger/build/release/Blogger.zip
index 231996c..797d1e4 100644
Binary files a/Blogger/build/release/Blogger.zip and b/Blogger/build/release/Blogger.zip differ
diff --git a/Booklet/build/release/Booklet.zip b/Booklet/build/release/Booklet.zip
index 5b0f395..d65be05 100644
Binary files a/Booklet/build/release/Booklet.zip and b/Booklet/build/release/Booklet.zip differ
diff --git a/Clipper/build/release/Clipper.zip b/Clipper/build/release/Clipper.zip
index 06cf468..1736785 100644
Binary files a/Clipper/build/release/Clipper.zip and b/Clipper/build/release/Clipper.zip differ
diff --git a/CodePad/build.json b/CodePad/build.json
index ef86276..d435634 100644
--- a/CodePad/build.json
+++ b/CodePad/build.json
@@ -17,8 +17,10 @@
                     "data": ["build","build/debug","build/release"]
                 },
                 {
-                    "name": "ts-import",
-                    "data": ["sdk://core/ts/core.d.ts", "sdk://core/ts/jquery.d.ts","sdk://core/ts/antos.d.ts"]
+                    "name": "ts-antos-sdk",
+                    "data": {
+                        "version": "2.0.x"
+                    }
                 },
                 {
                     "name": "ts-compile",
diff --git a/CodePad/build/release/CodePad.zip b/CodePad/build/release/CodePad.zip
index 2cfac08..7438996 100644
Binary files a/CodePad/build/release/CodePad.zip and b/CodePad/build/release/CodePad.zip differ
diff --git a/CodePad/ts/main.ts b/CodePad/ts/main.ts
index 225f5f7..679c5f4 100644
--- a/CodePad/ts/main.ts
+++ b/CodePad/ts/main.ts
@@ -244,7 +244,7 @@ namespace OS {
                         {
                             text: __("Change theme"),
                             onmenuselect: async (
-                                e: GUI.TagEventType
+                                e: GUI.TagEventType
                             ) => {
                                 try{
                                     const themes = this.eum.active.getThemes();
@@ -263,7 +263,7 @@ namespace OS {
                         {
                             text: __("Change language mode"),
                             onmenuselect: async (
-                                e: GUI.TagEventType
+                                e: GUI.TagEventType
                             ) => {
                                 try{
                                     const modes = this.eum.active.getModes().map(v => {
@@ -284,7 +284,7 @@ namespace OS {
                             text: __("Build with AntOSDK"),
                             shortcut: " (CTRL-ALT-B)",
                             onmenuselect: async (
-                                e: GUI.TagEventType
+                                e: GUI.TagEventType
                             ) => {
                                 try{
                                     this.build();
@@ -542,7 +542,7 @@ namespace OS {
                             dataid: "recent",
                             nodes: recent,
                             onchildselect: (
-                                e: GUI.TagEventType,
+                                e: GUI.TagEventType,
                                 r: CodePad
                             ) => {
                                 const handle = e.data.item.data.text.asFileHandle();
@@ -574,7 +574,7 @@ namespace OS {
                         },
                     ],
                     onchildselect: (
-                        e: GUI.TagEventType,
+                        e: GUI.TagEventType,
                         r: CodePad
                     ) => {
                         return this.menuAction(e.data.item.data.dataid, r);
@@ -591,9 +591,9 @@ namespace OS {
              * @memberof CodePad
              */
             private ctxFileMenuHandle(
-                e: GUI.TagEventType
+                e: GUI.TagEventType
             ): void {
-                const el = e.data.item as GUI.tag.MenuEntryTag;
+                const el = e.data.item;
                 if (!el) {
                     return;
                 }
@@ -845,7 +845,7 @@ namespace OS {
                             }
                         ],
                         onchildselect: (
-                            e: GUI.TagEventType,
+                            e: GUI.TagEventType,
                             r: EditorFileHandle
                         ) => {
                             switch (e.data.item.data.dataid) {
diff --git a/DiffEditor/build/release/DiffEditor.zip b/DiffEditor/build/release/DiffEditor.zip
index 26a6bca..fc6762e 100644
Binary files a/DiffEditor/build/release/DiffEditor.zip and b/DiffEditor/build/release/DiffEditor.zip differ
diff --git a/Docify/build.json b/Docify/build.json
index ae3e803..6ed4d77 100644
--- a/Docify/build.json
+++ b/Docify/build.json
@@ -33,8 +33,10 @@
             ],
             "jobs": [
                 {
-                    "name": "ts-import",
-                    "data": ["sdk://core/ts/core.d.ts", "sdk://core/ts/jquery.d.ts","sdk://core/ts/antos.d.ts"]
+                    "name": "ts-antos-sdk",
+                    "data": {
+                        "version": "2.0.x"
+                    }
                 },
                 {
                     "name": "ts-compile",
diff --git a/Docify/build/release/Docify.zip b/Docify/build/release/Docify.zip
index d47517e..0b5285e 100644
Binary files a/Docify/build/release/Docify.zip and b/Docify/build/release/Docify.zip differ
diff --git a/GPClient/build/release/GPClient.zip b/GPClient/build/release/GPClient.zip
index 6b2b2b3..5b8fe6f 100644
Binary files a/GPClient/build/release/GPClient.zip and b/GPClient/build/release/GPClient.zip differ
diff --git a/GitGraph/build.json b/GitGraph/build.json
index e6c775b..4ad777b 100644
--- a/GitGraph/build.json
+++ b/GitGraph/build.json
@@ -17,8 +17,10 @@
                     "data": ["build","build/debug","build/release"]
                 },
                 {
-                    "name": "ts-import",
-                    "data": ["sdk://core/ts/core.d.ts", "sdk://core/ts/jquery.d.ts","sdk://core/ts/antos.d.ts"]
+                    "name": "ts-antos-sdk",
+                    "data": {
+                        "version": "2.0.x"
+                    }
                 },
                 {
                     "name": "ts-compile",
diff --git a/GitGraph/build/release/GitGraph.zip b/GitGraph/build/release/GitGraph.zip
index 305eda0..02d0e65 100644
Binary files a/GitGraph/build/release/GitGraph.zip and b/GitGraph/build/release/GitGraph.zip differ
diff --git a/GraphEditor/build/release/GraphEditor.zip b/GraphEditor/build/release/GraphEditor.zip
index 31ec827..98bb6c2 100644
Binary files a/GraphEditor/build/release/GraphEditor.zip and b/GraphEditor/build/release/GraphEditor.zip differ
diff --git a/ImageEditor/build/release/ImageEditor.zip b/ImageEditor/build/release/ImageEditor.zip
index d986222..60d014a 100644
Binary files a/ImageEditor/build/release/ImageEditor.zip and b/ImageEditor/build/release/ImageEditor.zip differ
diff --git a/LibreOffice/build.json b/LibreOffice/build.json
index dbdd827..d1a93ca 100644
--- a/LibreOffice/build.json
+++ b/LibreOffice/build.json
@@ -17,8 +17,10 @@
                     "data": ["build","build/debug","build/release"]
                 },
                 {
-                    "name": "ts-import",
-                    "data": ["sdk://core/ts/core.d.ts", "sdk://core/ts/jquery.d.ts","sdk://core/ts/antos.d.ts"]
+                    "name": "ts-antos-sdk",
+                    "data": {
+                        "version": "2.0.x"
+                    }
                 },
                 {
                     "name": "ts-compile",
diff --git a/LibreOffice/build/release/LibreOffice.zip b/LibreOffice/build/release/LibreOffice.zip
index 2b1d691..ebad086 100644
Binary files a/LibreOffice/build/release/LibreOffice.zip and b/LibreOffice/build/release/LibreOffice.zip differ
diff --git a/LuaPlayground/build/release/LuaPlayground.zip b/LuaPlayground/build/release/LuaPlayground.zip
index d41dd51..9024c62 100644
Binary files a/LuaPlayground/build/release/LuaPlayground.zip and b/LuaPlayground/build/release/LuaPlayground.zip differ
diff --git a/MarkOn/build/release/MarkOn.zip b/MarkOn/build/release/MarkOn.zip
index 49997be..aa3fe1d 100644
Binary files a/MarkOn/build/release/MarkOn.zip and b/MarkOn/build/release/MarkOn.zip differ
diff --git a/MonacoCore/build/release/MonacoCore.zip b/MonacoCore/build/release/MonacoCore.zip
index 6107652..0b6c447 100644
Binary files a/MonacoCore/build/release/MonacoCore.zip and b/MonacoCore/build/release/MonacoCore.zip differ
diff --git a/OnlyOffice/build/release/OnlyOffice.zip b/OnlyOffice/build/release/OnlyOffice.zip
index e246a20..f2ba002 100644
Binary files a/OnlyOffice/build/release/OnlyOffice.zip and b/OnlyOffice/build/release/OnlyOffice.zip differ
diff --git a/Preview/build/release/Preview.zip b/Preview/build/release/Preview.zip
index 28305b3..ec870e6 100644
Binary files a/Preview/build/release/Preview.zip and b/Preview/build/release/Preview.zip differ
diff --git a/RemoteCamera/build/release/RemoteCamera.zip b/RemoteCamera/build/release/RemoteCamera.zip
index 41cb39c..e24bb1b 100644
Binary files a/RemoteCamera/build/release/RemoteCamera.zip and b/RemoteCamera/build/release/RemoteCamera.zip differ
diff --git a/RemoteDesktop/build/release/RemoteDesktop.zip b/RemoteDesktop/build/release/RemoteDesktop.zip
index e4e35c6..3e05727 100644
Binary files a/RemoteDesktop/build/release/RemoteDesktop.zip and b/RemoteDesktop/build/release/RemoteDesktop.zip differ
diff --git a/SQLiteDB/build.json b/SQLiteDB/build.json
index 480851f..c2741a8 100644
--- a/SQLiteDB/build.json
+++ b/SQLiteDB/build.json
@@ -17,8 +17,10 @@
                     "data": ["build","build/debug","build/release"]
                 },
                 {
-                    "name": "ts-import",
-                    "data": ["sdk://core/ts/core.d.ts", "sdk://core/ts/jquery.d.ts","sdk://core/ts/antos.d.ts"]
+                    "name": "ts-antos-sdk",
+                    "data": {
+                        "version": "2.0.x"
+                    }
                 },
                 {
                     "name": "ts-compile",
diff --git a/SQLiteDB/build/release/SQLiteDB.zip b/SQLiteDB/build/release/SQLiteDB.zip
index 30bc339..1850071 100644
Binary files a/SQLiteDB/build/release/SQLiteDB.zip and b/SQLiteDB/build/release/SQLiteDB.zip differ
diff --git a/ServerLogClient/build.json b/ServerLogClient/build.json
index e04e8c4..dd1cd0c 100644
--- a/ServerLogClient/build.json
+++ b/ServerLogClient/build.json
@@ -17,8 +17,10 @@
                     "data": ["build","build/debug","build/release"]
                 },
                 {
-                    "name": "ts-import",
-                    "data": ["sdk://core/ts/core.d.ts", "sdk://core/ts/jquery.d.ts","sdk://core/ts/antos.d.ts"]
+                    "name": "ts-antos-sdk",
+                    "data": {
+                        "version": "2.0.x"
+                    }
                 },
                 {
                     "name": "ts-compile",
diff --git a/ServerLogClient/build/debug/main.css b/ServerLogClient/build/debug/main.css
index cbe94df..9f16e7c 100644
--- a/ServerLogClient/build/debug/main.css
+++ b/ServerLogClient/build/debug/main.css
@@ -48,8 +48,4 @@ afx-app-window[data-id="ServerLogClient"] afx-hbox[data-id="top-header"] afx-lab
     text-align: right;
     padding-top: 5px;
     padding-right: 3px;
-}
-
-afx-app-window[data-id="ServerLogClient"] afx-hbox[data-id="top-header"] afx-label.field-label i.label-text{
-    font-weight: bold;
 }
\ No newline at end of file
diff --git a/ServerLogClient/build/debug/main.js b/ServerLogClient/build/debug/main.js
index f08a561..7631dc0 100644
--- a/ServerLogClient/build/debug/main.js
+++ b/ServerLogClient/build/debug/main.js
@@ -1 +1 @@
-var OS;!function(t){let e;!function(t){class e extends t.BaseApplication{constructor(t){super("ServerLogClient",t)}check(t){return!(!this.filter.record||!this.filter[t.severity_label]||this.filter.pattern&&!t.message.match(this.filter.pattern))}log(t){if(this.check(t)){if(this.logs.length>=this.filter.max_log){let t=this.logs.shift();$(t.el).remove()}t.el=$("

").addClass(t.severity_label),t.el.text(t.message),$(this.log_container).append(t.el),this.log_container.scrollTop=this.log_container.scrollHeight,this.logs.push(t)}}openSession(){this.sub=new Antunnel.Subscriber(this.setting.topic),this.sub.onopen=()=>{console.log("Subscribed")},this.sub.onerror=t=>{this.error(__("Unable to connect to: syslog"),t),this.sub=void 0},this.sub.onmessage=t=>{if(t.data){let e=JSON.parse(new TextDecoder("utf-8").decode(t.data));e.priority&&(e.priority=parseInt(e.priority)),e.severity&&(e.severity=parseInt(e.severity)),e.facility&&(e.facility=parseInt(e.facility)),this.log(e)}},this.sub.onclose=()=>{this.sub=void 0,this.notify(__("Connection closed")),this.quit(!0)},this.tunnel.subscribe(this.sub)}cleanup(){this.sub&&this.sub.close()}checklib(){Antunnel.tunnel?(this.tunnel=Antunnel.tunnel,this.openSession()):this._gui.pushService("Antunnel/AntunnelService").then(t=>{let e=this.systemsetting.system.tunnel_uri;e||(this.error(__("Unable to connect to the tunnel")),this.quit(!0)),Antunnel.init(e).then(t=>{this.notify(__("Tunnel now connected to the server at: {0}",e)),this.tunnel=Antunnel.tunnel,this.openSession()}).catch(t=>{Antunnel.tunnel&&(Antunnel.tunnel.close(),this.error(__("Unable to connect to the tunnel: {0}",t.toString()),t),this.quit(!0))})}).catch(t=>{this.error(__("Unable to run Antunnel service: {0}",t.toString()),t),this.quit(!0)})}main(){if(!Antunnel)return this.error(__("Antunnel library is not available")),void this.quit(!0);this.log_container=this.find("log-container"),this.logs=[],$(this.log_container).css("overflow-y","auto"),this.find("menu-level").items=[{text:__("Default level"),nodes:[{text:__("Debug"),switch:!0,checked:!0,severity:"debug"},{text:__("Notice"),switch:!0,checked:!0,severity:"notice"},{text:__("Info"),switch:!0,checked:!0,severity:"info"},{text:__("Warning"),switch:!0,checked:!0,severity:"warning"},{text:__("Error"),switch:!0,checked:!0,severity:"err"},{text:__("Critical"),switch:!0,checked:!0,severity:"crit"},{text:__("Alert"),switch:!0,checked:!0,severity:"alert"},{text:__("Emergency"),switch:!0,checked:!0,severity:"emerg"}],onchildselect:t=>{let e=t.data.item.data;this.filter[e.severity]=e.checked}}],this.filter={max_log:500,err:!0,emerg:!0,debug:!0,info:!0,notice:!0,warning:!0,crit:!0,alert:!0,pattern:void 0,record:!0};let t=this.find("txt-n-log");t.value=this.filter.max_log.toString(),$(t).on("keyup",e=>{if("Enter"===e.key){let e=parseInt(t.value);if(!isNaN(e))for(this.filter.max_log=e;this.logs.length>e;)this.logs.shift().el.remove();t.value=this.filter.max_log.toString()}}),this.find("btn-clear").onbtclick=()=>{this.logs=[],$(this.log_container).empty()};let e=this.find("txt-reg");$(e).on("keyup",t=>{if("Enter"===t.key){if(""===e.value.trim())return this.filter.pattern=void 0;try{this.filter.pattern=new RegExp(e.value,"g")}catch(t){this.error(__("Invalid regular expression: {0}",t.toString()),t),this.filter.pattern=void 0,e.value=""}}}),this.find("sw-record").onswchange=t=>{this.filter.record=t.data},this.setting.topic?this.checklib():this.openDialog("PromptDialog",{title:__("Enter topic name"),label:__("Please enter Antunnel topic name")}).then(t=>{this.setting.topic=t,this.checklib()})}}t.ServerLogClient=e,e.dependencies=["pkg://Antunnel/main.js"],e.singleton=!0}(e=t.application||(t.application={}))}(OS||(OS={})); \ No newline at end of file +var OS;!function(t){let e;!function(t){class e extends t.BaseApplication{constructor(t){super("ServerLogClient",t)}check(t){return!(!this.filter.record||!this.filter[t.severity_label]||this.filter.pattern&&!t.message.match(this.filter.pattern))}log(t){if(this.check(t)){if(this.logs.length>=this.filter.max_log){let t=this.logs.shift();$(t.el).remove()}t.el=$("

").addClass(t.severity_label),t.el.text(t.message),$(this.log_container).append(t.el),this.log_container.scrollTop=this.log_container.scrollHeight,this.logs.push(t)}}openSession(){this.sub=new Antunnel.Subscriber(this.setting.topic),this.sub.onopen=()=>{console.log("Subscribed")},this.sub.onerror=t=>{this.error(__("Unable to connect to: syslog"),t),this.sub=void 0},this.sub.onmessage=t=>{if(t.data){let e=JSON.parse(new TextDecoder("utf-8").decode(t.data));e.priority&&(e.priority=parseInt(e.priority)),e.severity&&(e.severity=parseInt(e.severity)),e.facility&&(e.facility=parseInt(e.facility)),this.log(e)}},this.sub.onclose=()=>{this.sub=void 0,this.notify(__("Connection closed")),this.quit(!0)},this.tunnel.subscribe(this.sub)}cleanup(){this.sub&&this.sub.close()}checklib(){Antunnel.tunnel?(this.tunnel=Antunnel.tunnel,this.openSession()):this._gui.pushService("Antunnel/AntunnelService").then(t=>{let e=this.systemsetting.system.tunnel_uri;e||(this.error(__("Unable to connect to the tunnel")),this.quit(!0)),Antunnel.init(e).then(t=>{this.notify(__("Tunnel now connected to the server at: {0}",e)),this.tunnel=Antunnel.tunnel,this.openSession()}).catch(t=>{Antunnel.tunnel&&(Antunnel.tunnel.close(),this.error(__("Unable to connect to the tunnel: {0}",t.toString()),t),this.quit(!0))})}).catch(t=>{this.error(__("Unable to run Antunnel service: {0}",t.toString()),t),this.quit(!0)})}main(){if(!Antunnel)return this.error(__("Antunnel library is not available")),void this.quit(!0);this.log_container=this.find("log-container"),this.logs=[],$(this.log_container).css("overflow-y","auto");let t=this.find("menu-level");t.onmenuselect=t=>{let e=t.data.item.data;this.filter[e.severity]=e.checked,console.log(this.filter)},t.items=[{text:__("Debug"),switch:!0,checked:!0,severity:"debug"},{text:__("Notice"),switch:!0,checked:!0,severity:"notice"},{text:__("Info"),switch:!0,checked:!0,severity:"info"},{text:__("Warning"),switch:!0,checked:!0,severity:"warning"},{text:__("Error"),switch:!0,checked:!0,severity:"err"},{text:__("Critical"),switch:!0,checked:!0,severity:"crit"},{text:__("Alert"),switch:!0,checked:!0,severity:"alert"},{text:__("Emergency"),switch:!0,checked:!0,severity:"emerg"}],this.filter={max_log:500,err:!0,emerg:!0,debug:!0,info:!0,notice:!0,warning:!0,crit:!0,alert:!0,pattern:void 0,record:!0};let e=this.find("txt-n-log");e.value=this.filter.max_log.toString(),$(e).on("keyup",t=>{if("Enter"===t.key){let t=parseInt(e.value);if(!isNaN(t))for(this.filter.max_log=t;this.logs.length>t;)this.logs.shift().el.remove();e.value=this.filter.max_log.toString()}}),this.find("btn-clear").onbtclick=()=>{this.logs=[],$(this.log_container).empty()};let i=this.find("txt-reg");$(i).on("keyup",t=>{if("Enter"===t.key){if(""===i.value.trim())return this.filter.pattern=void 0;try{this.filter.pattern=new RegExp(i.value,"g")}catch(t){this.error(__("Invalid regular expression: {0}",t.toString()),t),this.filter.pattern=void 0,i.value=""}}}),this.find("sw-record").onswchange=t=>{this.filter.record=t.data},this.setting.topic?this.checklib():this.openDialog("PromptDialog",{title:__("Enter topic name"),label:__("Please enter Antunnel topic name")}).then(t=>{this.setting.topic=t,this.checklib()})}}t.ServerLogClient=e,e.dependencies=["pkg://Antunnel/main.js"],e.singleton=!0}(e=t.application||(t.application={}))}(OS||(OS={})); \ No newline at end of file diff --git a/ServerLogClient/build/debug/scheme.html b/ServerLogClient/build/debug/scheme.html index 1ebbf4f..6b6cbb1 100644 --- a/ServerLogClient/build/debug/scheme.html +++ b/ServerLogClient/build/debug/scheme.html @@ -1,17 +1,15 @@ - - - - - - - - - - - -

- -
- + + + + + + + + + + +
+
+
\ No newline at end of file diff --git a/ServerLogClient/build/release/ServerLogClient.zip b/ServerLogClient/build/release/ServerLogClient.zip index 8580803..79b093c 100644 Binary files a/ServerLogClient/build/release/ServerLogClient.zip and b/ServerLogClient/build/release/ServerLogClient.zip differ diff --git a/ServerLogClient/main.css b/ServerLogClient/main.css index cbe94df..9f16e7c 100644 --- a/ServerLogClient/main.css +++ b/ServerLogClient/main.css @@ -48,8 +48,4 @@ afx-app-window[data-id="ServerLogClient"] afx-hbox[data-id="top-header"] afx-lab text-align: right; padding-top: 5px; padding-right: 3px; -} - -afx-app-window[data-id="ServerLogClient"] afx-hbox[data-id="top-header"] afx-label.field-label i.label-text{ - font-weight: bold; } \ No newline at end of file diff --git a/ServerLogClient/main.ts b/ServerLogClient/main.ts index 337e024..42e456b 100644 --- a/ServerLogClient/main.ts +++ b/ServerLogClient/main.ts @@ -186,64 +186,60 @@ namespace OS { this.logs = []; $(this.log_container) .css("overflow-y", "auto"); - let menu = this.find("menu-level") as GUI.tag.MenuTag; + let menu = this.find("menu-level") as GUI.tag.StackMenuTag; + menu.onmenuselect = (e) => { + let data = e.data.item.data; + this.filter[data.severity] = data.checked; + console.log(this.filter); + } menu.items = [ { - text: __("Default level"), - nodes: [ - { - text: __("Debug"), - switch: true, - checked: true, - severity: "debug" - }, - { - text: __("Notice"), - switch: true, - checked: true, - severity: "notice" - }, - { - text: __("Info"), - switch: true, - checked: true, - severity: "info" - }, - { - text: __("Warning"), - switch: true, - checked: true, - severity: "warning" - }, - { - text: __("Error"), - switch: true, - checked: true, - severity: "err" - }, - { - text: __("Critical"), - switch: true, - checked: true, - severity: "crit" - }, - { - text: __("Alert"), - switch: true, - checked: true, - severity: "alert" - }, - { - text: __("Emergency"), - switch: true, - checked: true, - severity: "emerg" - } - ], - onchildselect: (e) => { - let data = e.data.item.data; - this.filter[data.severity] = data.checked; - } + text: __("Debug"), + switch: true, + checked: true, + severity: "debug" + }, + { + text: __("Notice"), + switch: true, + checked: true, + severity: "notice" + }, + { + text: __("Info"), + switch: true, + checked: true, + severity: "info" + }, + { + text: __("Warning"), + switch: true, + checked: true, + severity: "warning" + }, + { + text: __("Error"), + switch: true, + checked: true, + severity: "err" + }, + { + text: __("Critical"), + switch: true, + checked: true, + severity: "crit" + }, + { + text: __("Alert"), + switch: true, + checked: true, + severity: "alert" + }, + { + text: __("Emergency"), + switch: true, + checked: true, + severity: "emerg" } ]; diff --git a/ServerLogClient/scheme.html b/ServerLogClient/scheme.html index 1ebbf4f..6b6cbb1 100644 --- a/ServerLogClient/scheme.html +++ b/ServerLogClient/scheme.html @@ -1,17 +1,15 @@ - - - - - - - - - - - -
- -
-
+ + + + + + + + + + +
+
+
\ No newline at end of file diff --git a/ShaderPlayground/build.json b/ShaderPlayground/build.json index caba844..293ecf9 100644 --- a/ShaderPlayground/build.json +++ b/ShaderPlayground/build.json @@ -17,8 +17,10 @@ "require": ["ts"], "jobs":[ { - "name": "ts-import", - "data": ["sdk://core/ts/core.d.ts", "sdk://core/ts/jquery.d.ts","sdk://core/ts/antos.d.ts"] + "name": "ts-antos-sdk", + "data": { + "version": "2.0.x" + } }, { "name": "ts-compile", diff --git a/ShaderPlayground/build/release/ShaderPlayground.zip b/ShaderPlayground/build/release/ShaderPlayground.zip index 3918dfd..649565c 100644 Binary files a/ShaderPlayground/build/release/ShaderPlayground.zip and b/ShaderPlayground/build/release/ShaderPlayground.zip differ diff --git a/ShowCase/build/release/ShowCase.zip b/ShowCase/build/release/ShowCase.zip index 985dc6c..e6a8f55 100644 Binary files a/ShowCase/build/release/ShowCase.zip and b/ShowCase/build/release/ShowCase.zip differ diff --git a/SimpleMDE/build/release/SimpleMDE.zip b/SimpleMDE/build/release/SimpleMDE.zip index 3d95f94..6639ba1 100644 Binary files a/SimpleMDE/build/release/SimpleMDE.zip and b/SimpleMDE/build/release/SimpleMDE.zip differ diff --git a/SystemControl/build/release/SystemControl.zip b/SystemControl/build/release/SystemControl.zip index d6cbb52..d041a33 100644 Binary files a/SystemControl/build/release/SystemControl.zip and b/SystemControl/build/release/SystemControl.zip differ diff --git a/TinyEditor/build/release/TinyEditor.zip b/TinyEditor/build/release/TinyEditor.zip index df90885..d47242a 100644 Binary files a/TinyEditor/build/release/TinyEditor.zip and b/TinyEditor/build/release/TinyEditor.zip differ diff --git a/VizApp/build/release/VizApp.zip b/VizApp/build/release/VizApp.zip index 765310b..46a2c3a 100644 Binary files a/VizApp/build/release/VizApp.zip and b/VizApp/build/release/VizApp.zip differ diff --git a/libantosdk/README.md b/libantosdk/README.md index 5fdf758..0d13a77 100644 --- a/libantosdk/README.md +++ b/libantosdk/README.md @@ -2,6 +2,7 @@ AntOSDK: development API for AntOS based applications/projects ## Change logs +- 0.1.2: add batch building support - 0.1.1: linux worker is renamed to backend, linux-exec job re to cmd-exec, add lua-exec job for backend lua script execution - 0.1.0: antOS SDK is no longer delivered in this package, it will be fetched directly from AntOS release site - 0.0.18: Add some public API on grid view diff --git a/libantosdk/build/debug/README.md b/libantosdk/build/debug/README.md index 5fdf758..0d13a77 100644 --- a/libantosdk/build/debug/README.md +++ b/libantosdk/build/debug/README.md @@ -2,6 +2,7 @@ AntOSDK: development API for AntOS based applications/projects ## Change logs +- 0.1.2: add batch building support - 0.1.1: linux worker is renamed to backend, linux-exec job re to cmd-exec, add lua-exec job for backend lua script execution - 0.1.0: antOS SDK is no longer delivered in this package, it will be fetched directly from AntOS release site - 0.0.18: Add some public API on grid view diff --git a/libantosdk/build/debug/main.js b/libantosdk/build/debug/main.js index 4f34b07..62aabc2 100644 --- a/libantosdk/build/debug/main.js +++ b/libantosdk/build/debug/main.js @@ -1 +1 @@ -var OS;!function(t){let e;!function(e){class i{constructor(e){this.worker=new Worker(e.asFileHandle().getlink()),this.jobs={},this.worker.onmessage=t=>{let e=t.data,i=this.jobs[e.id];i?"log"===e.type?i.logger&&(e.error?i.logger.error(e.result):!1===e.show_time&&i.logger.print?i.logger.print(e.result):i.logger.info(e.result)):(i.callback(e),delete this.jobs[e.id]):console.log("Unable to identify result of job",e.id,e)};const i={};for(const e in t.setting.system.packages){const s=t.setting.system.packages[e];i[e]={path:s.path,name:s.pkgname}}this.submit("sdk-setup",{REST:t.API.REST,pkgs:i})}newJobID(){return"job_"+Math.random().toString(36).replace(".","")}exectue_job(t,e,i,s,r){const o=this.newJobID(),n={id:o,cmd:t,data:e,root:i};this.jobs[o]={callback:s,logger:r},this.worker.postMessage(n)}submit(t,e,i,s){return new Promise((r,o)=>{this.exectue_job(t,e,i,t=>{if(t.error)return o(t.error);r(t.result)},s)})}terminate(){this.worker.terminate()}}class s{constructor(t,e){this.root=e,this.logger=t,s.worker||(s.worker=new i("pkg://libantosdk/core/worker.js"))}require(t){return this.run("sdk-import",t.map(t=>t+".worker.js"))}compile(t,e){return new Promise(async(i,s)=>{try{await this.require([t]),i(await this.run(t+"-compile",e))}catch(t){s(__e(t))}})}run(e,i){return"sdk-run-app"===e?new Promise(async(e,s)=>{try{let s=i;1==s.split("://").length&&(s=`${this.root}/${i}`);const r=await(s+"/package.json").asFileHandle().read("json");return r.text=r.name,r.path=s,r.filename=r.pkgname,r.type="app",r.mime="antos/app",r.icon&&(r.icon=`${r.path}/${r.icon}`),r.iconclass||r.icon||(r.iconclass="fa fa-adn"),this.logger.info(__("Installing...")),t.setting.system.packages[r.pkgname]=r,r.app?(this.logger.info(__("Running {0}...",r.app)),t.GUI.forceLaunch(r.app,[])):this.logger.error(__("{0} is not an application",r.pkgname)),e(void 0)}catch(t){s(t)}}):s.worker.submit(e,i,this.root,this.logger)}batch(t,e){return e.root&&(this.root=e.root),new Promise(async(i,s)=>{try{e.targets||s("No target found");for(const i of t){const t=e.targets[i];if(!t)return s(__("No target: {0}",i));if(t.depend&&await this.batch(t.depend,e),t.require&&await this.require(t.require),this.logger&&this.logger.info(__("### RUNNING STAGE: {0}###",i).__()),t.jobs)for(const e of t.jobs)await this.run(e.name,e.data)}i(void 0)}catch(t){s(t)}})}}let r;e.AntOSDKBuilder=s,function(t){class e extends t.RemoteFileHandle{constructor(t){super(t);const e="pkg://libantosdk/"+this.genealogy.join("/");this.setPath(e.asFileHandle().path)}}t.SDKFileHandle=e,t.register("^sdk$",e)}(r=e.VFS||(e.VFS={}))}(e=t.API||(t.API={}))}(OS||(OS={})),function(t){let e;!function(e){class i{constructor(t){this.target=t}info(t){this.log("info",t,!0)}warn(t){this.log("warn",t,!0)}error(t){this.log("error",t,!0)}log(t,e,i){let s=$("
").attr("class","sdk-log-"+t);if(i){let t=new Date,i=t.getDate()+"/"+(t.getMonth()+1)+"/"+t.getFullYear()+" "+t.getHours()+":"+t.getMinutes()+":"+t.getSeconds();s.text(`[${i}]: ${e.__()}`)}else s.text(e.__());$(this.target).append(s),$(this.target).scrollTop($(this.target)[0].scrollHeight)}print(t){t.match(/warn/i)?this.log("warn",t,!1):t.match(/error/i)?this.log("error",t,!1):this.log("info",t,!1)}clear(){$(this.target).empty()}}class s extends e.BaseApplication{constructor(t){super("SDKBuilder",t)}main(){this.logger=new i(this.find("container")),this.sdk=new t.API.AntOSDKBuilder(this.logger,""),this.filehandle=void 0,this.options=void 0,this.targets=this.find("target-list"),this.args&&this.args.length>0&&(this.filehandle=this.args[0].path.asFileHandle()),this.find("btnbuild").onbtclick=t=>{const e=this.targets.selectedItem;e&&this.load(this.compile([e.data.text]))},this.find("btnclear").onbtclick=t=>{this.logger.clear()},this.find("btnrefresh").onbtclick=t=>{this.open()},this.find("btnopen").onbtclick=async t=>{try{const t=await this.openDialog("FileDialog",{title:__("Select build file"),mimes:this.meta().mimes});this.filehandle=t.file.path.asFileHandle(),this.open()}catch(t){this.logger.error(t.toString())}},this.open()}open(){void 0!==this.filehandle&&this.filehandle.read("json").then(t=>{if(!t.targets)return this.logger.error(__("Invalid build file: {0}",this.filehandle.path));const e=Object.keys(t.targets).map(t=>({text:t}));this.scheme.apptitle=this.filehandle.path,this.options=t,this.options.root=this.filehandle.parent().path,this.targets.data=e,this.logger.info(__("Loaded: {0}",this.filehandle.path))}).catch(t=>this.logger.error(__("Unable to load build file: {0}: {1}",this.filehandle.path,t.toString())))}compile(t){return new Promise(async(e,i)=>{try{this.logger.clear(),await this.sdk.batch(t,this.options),e("OK")}catch(t){i(__e(t))}})}}e.SDKBuilder=s}(e=t.application||(t.application={}))}(OS||(OS={}));
\ No newline at end of file
+var OS;!function(t){let e;!function(e){class i{constructor(e){this.worker=new Worker(e.asFileHandle().getlink()),this.jobs={},this.worker.onmessage=t=>{let e=t.data,i=this.jobs[e.id];i?"log"===e.type?i.logger&&(e.error?i.logger.error(e.result):!1===e.show_time&&i.logger.print?i.logger.print(e.result):i.logger.info(e.result)):(i.callback(e),delete this.jobs[e.id]):console.log("Unable to identify result of job",e.id,e)};const i={};for(const e in t.setting.system.packages){const r=t.setting.system.packages[e];i[e]={path:r.path,name:r.pkgname}}this.submit("sdk-setup",{REST:t.API.REST,pkgs:i})}newJobID(){return"job_"+Math.random().toString(36).replace(".","")}exectue_job(t,e,i,r,o){const s=this.newJobID(),a={id:s,cmd:t,data:e,root:i};this.jobs[s]={callback:r,logger:o},this.worker.postMessage(a)}submit(t,e,i,r){return new Promise((o,s)=>{this.exectue_job(t,e,i,t=>{if(t.error)return s(t.error);o(t.result)},r)})}terminate(){this.worker.terminate()}}class r{constructor(t,e){this.root=e,this.logger=t,r.worker||(r.worker=new i("pkg://libantosdk/core/worker.js"))}require(t){return this.run("sdk-import",t.map(t=>t+".worker.js"))}compile(t,e){return new Promise(async(i,r)=>{try{await this.require([t]),i(await this.run(t+"-compile",e))}catch(t){r(__e(t))}})}run(e,i){return"sdk-run-app"===e?new Promise(async(e,r)=>{try{let r=i;1==r.split("://").length&&(r=`${this.root}/${i}`);const o=await(r+"/package.json").asFileHandle().read("json");return o.text=o.name,o.path=r,o.filename=o.pkgname,o.type="app",o.mime="antos/app",o.icon&&(o.icon=`${o.path}/${o.icon}`),o.iconclass||o.icon||(o.iconclass="fa fa-adn"),this.logger.info(__("Installing...")),t.setting.system.packages[o.pkgname]=o,o.app?(this.logger.info(__("Running {0}...",o.app)),t.GUI.forceLaunch(o.app,[])):this.logger.error(__("{0} is not an application",o.pkgname)),e(void 0)}catch(t){r(t)}}):"batch"===e?new Promise(async(t,e)=>{try{if(!i||!i.target){const t=__("No target provided for job: batch");throw this.logger.error(t),new Error(t.__())}let e=i.pwd;e||(e=this.root);const o=await e.asFileHandle().read();if(o.error)throw this.logger.error(o.error),new Error(o.error);const s=o.result.filter(t=>"dir"===t.type);for(let t of s){const e=(t.path+"/build.json").asFileHandle();try{await e.onready()}catch(e){this.logger.info(__("No build.json file found in {0}, ignore this file",t.path));continue}this.logger.info(__("########### BUILDING: {0} ###########",t.path));const o=new r(this.logger,t.path),s=await e.read("json");s.root||(s.root=t.path),await o.batch([i.target],s)}return this.logger.info(__("########### Batch building done ###########")),t(void 0)}catch(t){e(t)}}):r.worker.submit(e,i,this.root,this.logger)}batch(t,e){return e.root&&(this.root=e.root),new Promise(async(i,r)=>{try{e.targets||r("No target found");for(const i of t){const t=e.targets[i];if(!t)return r(__("No target: {0}",i));if(t.depend&&await this.batch(t.depend,e),t.require&&await this.require(t.require),this.logger&&this.logger.info(__("### RUNNING STAGE: {0}###",i).__()),t.jobs)for(const e of t.jobs)await this.run(e.name,e.data)}i(void 0)}catch(t){r(t)}})}}let o;e.AntOSDKBuilder=r,function(t){class e extends t.RemoteFileHandle{constructor(t){super(t);const e="pkg://libantosdk/"+this.genealogy.join("/");this.setPath(e.asFileHandle().path)}}t.SDKFileHandle=e,t.register("^sdk$",e)}(o=e.VFS||(e.VFS={}))}(e=t.API||(t.API={}))}(OS||(OS={})),function(t){let e;!function(e){class i{constructor(t){this.target=t}info(t){this.log("info",t,!0)}warn(t){this.log("warn",t,!0)}error(t){this.log("error",t,!0)}log(t,e,i){let r=$("
").attr("class","sdk-log-"+t);if(i){let t=new Date,i=t.getDate()+"/"+(t.getMonth()+1)+"/"+t.getFullYear()+" "+t.getHours()+":"+t.getMinutes()+":"+t.getSeconds();r.text(`[${i}]: ${e.__()}`)}else r.text(e.__());$(this.target).append(r),$(this.target).scrollTop($(this.target)[0].scrollHeight)}print(t){t.match(/warn/i)?this.log("warn",t,!1):t.match(/error/i)?this.log("error",t,!1):this.log("info",t,!1)}clear(){$(this.target).empty()}}class r extends e.BaseApplication{constructor(t){super("SDKBuilder",t)}main(){this.logger=new i(this.find("container")),this.sdk=new t.API.AntOSDKBuilder(this.logger,""),this.filehandle=void 0,this.options=void 0,this.targets=this.find("target-list"),this.args&&this.args.length>0&&(this.filehandle=this.args[0].path.asFileHandle()),this.find("btnbuild").onbtclick=t=>{const e=this.targets.selectedItem;e&&this.load(this.compile([e.data.text])).catch(t=>this.logger.error(__(t.stack)))},this.find("btnclear").onbtclick=t=>{this.logger.clear()},this.find("btnrefresh").onbtclick=t=>{this.open()},this.find("btnopen").onbtclick=async t=>{try{const t=await this.openDialog("FileDialog",{title:__("Select build file"),mimes:this.meta().mimes});this.filehandle=t.file.path.asFileHandle(),this.open()}catch(t){this.logger.error(t.toString())}},this.open()}open(){void 0!==this.filehandle&&this.filehandle.read("json").then(t=>{if(!t.targets)return this.logger.error(__("Invalid build file: {0}",this.filehandle.path));const e=Object.keys(t.targets).map(t=>({text:t}));this.scheme.apptitle=this.filehandle.path,this.options=t,this.options.root=this.filehandle.parent().path,this.targets.data=e,this.logger.info(__("Loaded: {0}",this.filehandle.path))}).catch(t=>this.logger.error(__("Unable to load build file: {0}: {1}",this.filehandle.path,t.toString())))}compile(t){return new Promise(async(e,i)=>{try{this.logger.clear(),await this.sdk.batch(t,this.options),e("OK")}catch(t){i(__e(t))}})}}e.SDKBuilder=r}(e=t.application||(t.application={}))}(OS||(OS={}));
\ No newline at end of file
diff --git a/libantosdk/build/debug/package.json b/libantosdk/build/debug/package.json
index 828f9c1..2f8487e 100644
--- a/libantosdk/build/debug/package.json
+++ b/libantosdk/build/debug/package.json
@@ -7,7 +7,7 @@
         "author": "Xuan Sang LE",
         "email": "mrsang@iohub.dev"
     },
-    "version": "0.1.1-b",
+    "version": "0.1.2-b",
     "category": "Development",
     "iconclass": "fa fa-cog",
     "mimes": [
diff --git a/libantosdk/build/release/libantosdk.zip b/libantosdk/build/release/libantosdk.zip
index 79ef70c..92d3c40 100644
Binary files a/libantosdk/build/release/libantosdk.zip and b/libantosdk/build/release/libantosdk.zip differ
diff --git a/libantosdk/package.json b/libantosdk/package.json
index 828f9c1..2f8487e 100644
--- a/libantosdk/package.json
+++ b/libantosdk/package.json
@@ -7,7 +7,7 @@
         "author": "Xuan Sang LE",
         "email": "mrsang@iohub.dev"
     },
-    "version": "0.1.1-b",
+    "version": "0.1.2-b",
     "category": "Development",
     "iconclass": "fa fa-cog",
     "mimes": [
diff --git a/libantosdk/ts/app.ts b/libantosdk/ts/app.ts
index 42524dc..fe939cd 100644
--- a/libantosdk/ts/app.ts
+++ b/libantosdk/ts/app.ts
@@ -139,7 +139,7 @@ namespace OS {
                     const selected = this.targets.selectedItem;
                     if(!selected)
                         return;
-                    this.load(this.compile([selected.data.text]));
+                    this.load(this.compile([selected.data.text])).catch((e) => this.logger.error(__(e.stack)));
                 }
 
                 (this.find("btnclear") as GUI.tag.ButtonTag).onbtclick = (e) => {
diff --git a/libantosdk/ts/main.ts b/libantosdk/ts/main.ts
index f69ba03..36ef5a8 100644
--- a/libantosdk/ts/main.ts
+++ b/libantosdk/ts/main.ts
@@ -195,6 +195,58 @@ namespace OS {
                         }
                     });
                 }
+                else if(job === "batch")
+                {
+                    return new Promise(async (resolve, reject) =>
+                    {
+                        try{
+                            if(!data || !data.target)
+                            {
+                                const err = __("No target provided for job: batch");
+                                this.logger.error(err);
+                                throw new Error(err.__());
+                            }
+                            let pwd = data.pwd;
+                            if(!pwd)
+                            {
+                                pwd = this.root;
+                            }
+                            const ret = await pwd.asFileHandle().read();
+                            if(ret.error)
+                            {
+                                this.logger.error(ret.error);
+                                throw new Error(ret.error);
+                            }
+                            const dirs = ret.result.filter(e => e.type === "dir");
+                            for(let entry of dirs)
+                            {
+                                const build_file = `${entry.path}/build.json`.asFileHandle();
+                                try {
+                                    await build_file.onready();
+                                }
+                                catch(e)
+                                {
+                                    this.logger.info(__("No build.json file found in {0}, ignore this file", entry.path));
+                                    continue;
+                                }
+                                this.logger.info(__("########### BUILDING: {0} ###########", entry.path));
+                                const sdk = new AntOSDKBuilder(this.logger,entry.path);
+                                const options = await build_file.read("json");
+                                if(!options.root)
+                                {
+                                    options.root = entry.path;
+                                }
+                                await sdk.batch([data.target], options);
+                            }
+                            this.logger.info(__("########### Batch building done ###########"));
+                            return resolve(undefined);
+                        }
+                        catch(error)
+                        {
+                            reject(error);
+                        }
+                    });
+                }
                 return AntOSDKBuilder.worker.submit(job,data, this.root, this.logger);
             }
             
diff --git a/libplotly/build/release/libplotly.zip b/libplotly/build/release/libplotly.zip
index 8a6f56b..23dc90f 100644
Binary files a/libplotly/build/release/libplotly.zip and b/libplotly/build/release/libplotly.zip differ
diff --git a/libthreejs/build/release/libthreejs.zip b/libthreejs/build/release/libthreejs.zip
index 4e270b4..fdfc7f7 100644
Binary files a/libthreejs/build/release/libthreejs.zip and b/libthreejs/build/release/libthreejs.zip differ
diff --git a/vTerm/build/release/vTerm.zip b/vTerm/build/release/vTerm.zip
index a03bfe5..af5b392 100644
Binary files a/vTerm/build/release/vTerm.zip and b/vTerm/build/release/vTerm.zip differ
diff --git a/vfsx/build.json b/vfsx/build.json
index bb66f23..d030550 100644
--- a/vfsx/build.json
+++ b/vfsx/build.json
@@ -17,8 +17,10 @@
                     "data": ["build","build/debug","build/release"]
                 },
                 {
-                    "name": "ts-import",
-                    "data": ["sdk://core/ts/core.d.ts", "sdk://core/ts/jquery.d.ts","sdk://core/ts/antos.d.ts"]
+                    "name": "ts-antos-sdk",
+                    "data": {
+                        "version": "2.0.x"
+                    }
                 },
                 {
                     "name": "ts-compile",
diff --git a/vfsx/build/release/vfsx.zip b/vfsx/build/release/vfsx.zip
index 1ffc065..f2ae192 100644
Binary files a/vfsx/build/release/vfsx.zip and b/vfsx/build/release/vfsx.zip differ
diff --git a/xTerm/build/release/xTerm.zip b/xTerm/build/release/xTerm.zip
index 5e1a825..2cf28f6 100644
Binary files a/xTerm/build/release/xTerm.zip and b/xTerm/build/release/xTerm.zip differ