@neutralinojs/lib
Advanced tools
Comparing version 3.8.2-nightly-20230123 to 3.8.2-nightly-20230124
@@ -1,1 +0,1 @@ | ||
"use strict";function e(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))}function t(){return d("extensions.getStats")}Object.defineProperty(exports,"__esModule",{value:!0});var n=Object.freeze({__proto__:null,dispatch:function(n,o,i){return new Promise(((r,s)=>e(this,void 0,void 0,(function*(){let e=yield t();if(e.loaded.includes(n))if(e.connected.includes(n))try{let e=yield d("extensions.dispatch",{extensionId:n,event:o,data:i});r(e)}catch(e){s(e)}else!function(e,t){e in c?c[e].push(t):c[e]=[t]}(n,{method:"extensions.dispatch",data:{extensionId:n,event:o,data:i},resolve:r,reject:s});else s({code:"NE_EX_EXTNOTL",message:`${n} is not loaded`})}))))},broadcast:function(e,t){return d("extensions.broadcast",{event:e,data:t})},getStats:t});function o(e,t){return window.addEventListener(e,t),Promise.resolve({success:!0,message:"Event listener added"})}function i(e,t){let n=new CustomEvent(e,{detail:t});return window.dispatchEvent(n),Promise.resolve({success:!0,message:"Message dispatched"})}let r,s={},a=[],c={};function u(){window.NL_TOKEN&&sessionStorage.setItem("NL_TOKEN",window.NL_TOKEN),r=new WebSocket(`ws://${window.location.hostname}:${window.NL_PORT}`),function(){if(o("ready",(()=>e(this,void 0,void 0,(function*(){if(yield l(a),!window.NL_EXTENABLED)return;let e=yield t();for(let t of e.connected)i("extensionReady",t)})))),o("extClientConnect",(e=>{i("extensionReady",e.detail)})),!window.NL_EXTENABLED)return;o("extensionReady",(t=>e(this,void 0,void 0,(function*(){t.detail in c&&(yield l(c[t.detail]),delete c[t.detail])}))))}(),function(){r.addEventListener("message",(e=>{var t,n;const o=JSON.parse(e.data);o.id&&o.id in s?((null===(t=o.data)||void 0===t?void 0:t.error)?(s[o.id].reject(o.data.error),"NE_RT_INVTOKN"==o.data.error.code&&(r.close(),document.body.innerText="",document.write("<code>NE_RT_INVTOKN</code>: Neutralinojs application configuration prevents accepting native calls from this client."))):(null===(n=o.data)||void 0===n?void 0:n.success)&&s[o.id].resolve(o.data.hasOwnProperty("returnValue")?o.data.returnValue:o.data),delete s[o.id]):o.event&&i(o.event,o.data)})),r.addEventListener("open",(t=>e(this,void 0,void 0,(function*(){i("ready")})))),r.addEventListener("close",(t=>e(this,void 0,void 0,(function*(){i("serverOffline",{code:"NE_CL_NSEROFF",message:"Neutralino server is offline. Try restarting the application"})}))))}()}function d(e,t){return new Promise(((n,o)=>{if((null==r?void 0:r.readyState)!=WebSocket.OPEN)return i={method:e,data:t,resolve:n,reject:o},void a.push(i);var i;const c="10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))),u=window.NL_TOKEN||sessionStorage.getItem("NL_TOKEN")||"";s[c]={resolve:n,reject:o},r.send(JSON.stringify({id:c,method:e,data:t,accessToken:u}))}))}function l(t){return e(this,void 0,void 0,(function*(){for(;t.length>0;){let e=t.shift();try{let t=yield d(e.method,e.data);e.resolve(t)}catch(t){e.reject(t)}}}))}function f(e,t){return d("filesystem.writeBinaryFile",{path:e,data:p(t)})}function p(e){let t=new Uint8Array(e),n="";for(let e of t)n+=String.fromCharCode(e);return window.btoa(n)}var g,w,m=Object.freeze({__proto__:null,createDirectory:function(e){return d("filesystem.createDirectory",{path:e})},removeDirectory:function(e){return d("filesystem.removeDirectory",{path:e})},writeFile:function(e,t){return d("filesystem.writeFile",{path:e,data:t})},appendFile:function(e,t){return d("filesystem.appendFile",{path:e,data:t})},writeBinaryFile:f,appendBinaryFile:function(e,t){return d("filesystem.appendBinaryFile",{path:e,data:p(t)})},readFile:function(e,t){return d("filesystem.readFile",Object.assign({path:e},t))},readBinaryFile:function(e,t){return new Promise(((n,o)=>{d("filesystem.readBinaryFile",Object.assign({path:e},t)).then((e=>{let t=window.atob(e),o=t.length,i=new Uint8Array(o);for(let e=0;e<o;e++)i[e]=t.charCodeAt(e);n(i.buffer)})).catch((e=>{o(e)}))}))},openFile:function(e){return d("filesystem.openFile",{path:e})},updateOpenedFile:function(e,t,n){return d("filesystem.updateOpenedFile",{id:e,event:t,data:n})},getOpenedFileInfo:function(e){return d("filesystem.getOpenedFileInfo",{id:e})},removeFile:function(e){return d("filesystem.removeFile",{path:e})},readDirectory:function(e){return d("filesystem.readDirectory",{path:e})},copyFile:function(e,t){return d("filesystem.copyFile",{source:e,destination:t})},moveFile:function(e,t){return d("filesystem.moveFile",{source:e,destination:t})},getStats:function(e){return d("filesystem.getStats",{path:e})}});function v(e,t){return d("os.execCommand",Object.assign({command:e},t))}!function(e){e.WARNING="WARNING",e.ERROR="ERROR",e.INFO="INFO",e.QUESTION="QUESTION"}(g||(g={})),function(e){e.OK="OK",e.OK_CANCEL="OK_CANCEL",e.YES_NO="YES_NO",e.YES_NO_CANCEL="YES_NO_CANCEL",e.RETRY_CANCEL="RETRY_CANCEL",e.ABORT_RETRY_IGNORE="ABORT_RETRY_IGNORE"}(w||(w={}));var _=Object.freeze({__proto__:null,get Icon(){return g},get MessageBoxChoice(){return w},execCommand:v,spawnProcess:function(e){return d("os.spawnProcess",{command:e})},updateSpawnedProcess:function(e,t,n){return d("os.updateSpawnedProcess",{id:e,event:t,data:n})},getSpawnedProcesses:function(){return d("os.getSpawnedProcesses")},getEnv:function(e){return d("os.getEnv",{key:e})},getEnvs:function(){return d("os.getEnvs")},showOpenDialog:function(e,t){return d("os.showOpenDialog",Object.assign({title:e},t))},showFolderDialog:function(e,t){return d("os.showFolderDialog",Object.assign({title:e},t))},showSaveDialog:function(e,t){return d("os.showSaveDialog",Object.assign({title:e},t))},showNotification:function(e,t,n){return d("os.showNotification",{title:e,content:t,icon:n})},showMessageBox:function(e,t,n,o){return d("os.showMessageBox",{title:e,content:t,choice:n,icon:o})},setTray:function(e){return d("os.setTray",e)},open:function(e){return d("os.open",{url:e})},getPath:function(e){return d("os.getPath",{name:e})}});var h=Object.freeze({__proto__:null,getMemoryInfo:function(){return d("computer.getMemoryInfo")},getArch:function(){return d("computer.getArch")},getKernelInfo:function(){return d("computer.getKernelInfo")},getOSInfo:function(){return d("computer.getOSInfo")},getCPUInfo:function(){return d("computer.getCPUInfo")},getDisplays:function(){return d("computer.getDisplays")},getMousePosition:function(){return d("computer.getMousePosition")}});var y,O=Object.freeze({__proto__:null,setData:function(e,t){return d("storage.setData",{key:e,data:t})},getData:function(e){return d("storage.getData",{key:e})},getKeys:function(){return d("storage.getKeys")}});function N(e,t){return d("debug.log",{message:e,type:t})}!function(e){e.WARNING="WARNING",e.ERROR="ERROR",e.INFO="INFO"}(y||(y={}));var E=Object.freeze({__proto__:null,get LoggerType(){return y},log:N});function b(e){return d("app.exit",{code:e})}var R=Object.freeze({__proto__:null,exit:b,killProcess:function(){return d("app.killProcess")},restartProcess:function(t){return new Promise((n=>e(this,void 0,void 0,(function*(){let e=window.NL_ARGS.reduce(((e,t)=>e+=" "+t),"");(null==t?void 0:t.args)&&(e+=" "+t.args),yield v(e,{background:!0}),b(),n()}))))},getConfig:function(){return d("app.getConfig")},broadcast:function(e,t){return d("app.broadcast",{event:e,data:t})}});const x=new WeakMap;function T(e,t){return d("window.move",{x:e,y:t})}function P(){return d("window.getSize")}var S=Object.freeze({__proto__:null,setTitle:function(e){return d("window.setTitle",{title:e})},getTitle:function(){return d("window.getTitle")},maximize:function(){return d("window.maximize")},unmaximize:function(){return d("window.unmaximize")},isMaximized:function(){return d("window.isMaximized")},minimize:function(){return d("window.minimize")},setFullScreen:function(){return d("window.setFullScreen")},exitFullScreen:function(){return d("window.exitFullScreen")},isFullScreen:function(){return d("window.isFullScreen")},show:function(){return d("window.show")},hide:function(){return d("window.hide")},isVisible:function(){return d("window.isVisible")},focus:function(){return d("window.focus")},setIcon:function(e){return d("window.setIcon",{icon:e})},move:T,setDraggableRegion:function(t){return new Promise(((n,o)=>{const i=t instanceof Element?t:document.getElementById(t);let r=0,s=0;if(!i)return o({code:"NE_WD_DOMNOTF",message:"Unable to find DOM element"});if(x.has(i))return o({code:"NE_WD_ALRDREL",message:"This DOM element is already an active draggable region"});function a(t){return e(this,void 0,void 0,(function*(){yield T(t.screenX-r,t.screenY-s)}))}function c(e){0===e.button&&(r=e.clientX,s=e.clientY,i.addEventListener("pointermove",a),i.setPointerCapture(e.pointerId))}function u(e){i.removeEventListener("pointermove",a),i.releasePointerCapture(e.pointerId)}i.addEventListener("pointerdown",c),i.addEventListener("pointerup",u),x.set(i,{pointerdown:c,pointerup:u}),n({success:!0,message:"Draggable region was activated"})}))},unsetDraggableRegion:function(e){return new Promise(((t,n)=>{const o=e instanceof Element?e:document.getElementById(e);if(!o)return n({code:"NE_WD_DOMNOTF",message:"Unable to find DOM element"});if(!x.has(o))return n({code:"NE_WD_NOTDRRE",message:"DOM element is not an active draggable region"});const{pointerdown:i,pointerup:r}=x.get(o);o.removeEventListener("pointerdown",i),o.removeEventListener("pointerup",r),x.delete(o),t({success:!0,message:"Draggable region was deactivated"})}))},setSize:function(t){return new Promise(((n,o)=>e(this,void 0,void 0,(function*(){let e=yield P();d("window.setSize",t=Object.assign(Object.assign({},e),t)).then((e=>{n(e)})).catch((e=>{o(e)}))}))))},getSize:P,getPosition:function(){return d("window.getPosition")},setAlwaysOnTop:function(e){return d("window.setAlwaysOnTop",{onTop:e})},create:function(e,t){return new Promise(((n,o)=>{function i(e){return"string"!=typeof e||(e=e.trim()).includes(" ")&&(e=`"${e}"`),e}let r=window.NL_ARGS.reduce(((e,t,n)=>((t.includes("--path=")||t.includes("--debug-mode")||t.includes("--load-dir-res")||0==n)&&(e+=" "+i(t)),e)),"");r+=" --url="+i(e);for(let e in t){if("processArgs"==e)continue;r+=` --window${e.replace(/[A-Z]|^[a-z]/g,(e=>"-"+e.toLowerCase()))}=${i(t[e])}`}t&&t.processArgs&&(r+=" "+t.processArgs),v(r,{background:!0}).then((e=>{n(e)})).catch((e=>{o(e)}))}))}});var D=Object.freeze({__proto__:null,broadcast:function(e,t){return d("events.broadcast",{event:e,data:t})},on:o,off:function(e,t){return window.removeEventListener(e,t),Promise.resolve({success:!0,message:"Event listener removed"})},dispatch:i});let L=null;var I=Object.freeze({__proto__:null,checkForUpdates:function(t){return new Promise(((n,o)=>e(this,void 0,void 0,(function*(){if(!t)return o({code:"NE_RT_NATRTER",message:"Missing require parameter: url"});try{let e=yield fetch(t);L=JSON.parse(yield e.text()),!function(e){return!!(e.applicationId&&e.applicationId==window.NL_APPID&&e.version&&e.resourcesURL)}(L)?o({code:"NE_UP_CUPDMER",message:"Invalid update manifest or mismatching applicationId"}):n(L)}catch(e){o({code:"NE_UP_CUPDERR",message:"Unable to fetch update manifest"})}}))))},install:function(){return new Promise(((t,n)=>e(this,void 0,void 0,(function*(){if(!L)return n({code:"NE_UP_UPDNOUF",message:"No update manifest loaded"});try{let e=yield fetch(L.resourcesURL),n=yield e.arrayBuffer();yield f(window.NL_PATH+"/resources.neu",n),t({success:!0,message:"Update installed. Restart the process to see updates"})}catch(e){n({code:"NE_UP_UPDINER",message:"Update installation error"})}}))))}});var F=Object.freeze({__proto__:null,readText:function(e,t){return d("clipboard.readText",{key:e,data:t})},writeText:function(e){return d("clipboard.writeText",{data:e})}});var C=Object.freeze({__proto__:null,getMethods:function(){return d("custom.getMethods")}});let A=!1;exports.app=R,exports.clipboard=F,exports.computer=h,exports.custom=C,exports.debug=E,exports.events=D,exports.extensions=n,exports.filesystem=m,exports.init=function(t={}){if(t=Object.assign({exportCustomMethods:!0},t),!A){if(u(),window.NL_ARGS.find((e=>"--neu-dev-auto-reload"==e))&&o("neuDev_reloadApp",(()=>e(this,void 0,void 0,(function*(){yield N("Reloading the application..."),location.reload()})))),t.exportCustomMethods&&window.NL_CMETHODS&&window.NL_CMETHODS.length>0)for(let e of window.NL_CMETHODS)Neutralino.custom[e]=(...t)=>{let n={};for(let[e,o]of t.entries())n="object"!=typeof o||Array.isArray(o)||null==o?Object.assign(Object.assign({},n),{["arg"+e]:o}):Object.assign(Object.assign({},n),o);return d("custom."+e,n)};window.NL_CVERSION="3.8.2-nightly-20230123",window.NL_CCOMMIT="590d453ef302521346740453b9ffe169689c8a00",A=!0}},exports.os=_,exports.storage=O,exports.updater=I,exports.window=S; | ||
"use strict";function e(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))}function t(){return d("extensions.getStats")}Object.defineProperty(exports,"__esModule",{value:!0});var n=Object.freeze({__proto__:null,dispatch:function(n,o,i){return new Promise(((r,s)=>e(this,void 0,void 0,(function*(){let e=yield t();if(e.loaded.includes(n))if(e.connected.includes(n))try{let e=yield d("extensions.dispatch",{extensionId:n,event:o,data:i});r(e)}catch(e){s(e)}else!function(e,t){e in c?c[e].push(t):c[e]=[t]}(n,{method:"extensions.dispatch",data:{extensionId:n,event:o,data:i},resolve:r,reject:s});else s({code:"NE_EX_EXTNOTL",message:`${n} is not loaded`})}))))},broadcast:function(e,t){return d("extensions.broadcast",{event:e,data:t})},getStats:t});function o(e,t){return window.addEventListener(e,t),Promise.resolve({success:!0,message:"Event listener added"})}function i(e,t){let n=new CustomEvent(e,{detail:t});return window.dispatchEvent(n),Promise.resolve({success:!0,message:"Message dispatched"})}let r,s={},a=[],c={};function u(){window.NL_TOKEN&&sessionStorage.setItem("NL_TOKEN",window.NL_TOKEN),r=new WebSocket(`ws://${window.location.hostname}:${window.NL_PORT}`),function(){if(o("ready",(()=>e(this,void 0,void 0,(function*(){if(yield l(a),!window.NL_EXTENABLED)return;let e=yield t();for(let t of e.connected)i("extensionReady",t)})))),o("extClientConnect",(e=>{i("extensionReady",e.detail)})),!window.NL_EXTENABLED)return;o("extensionReady",(t=>e(this,void 0,void 0,(function*(){t.detail in c&&(yield l(c[t.detail]),delete c[t.detail])}))))}(),function(){r.addEventListener("message",(e=>{var t,n;const o=JSON.parse(e.data);o.id&&o.id in s?((null===(t=o.data)||void 0===t?void 0:t.error)?(s[o.id].reject(o.data.error),"NE_RT_INVTOKN"==o.data.error.code&&(r.close(),document.body.innerText="",document.write("<code>NE_RT_INVTOKN</code>: Neutralinojs application configuration prevents accepting native calls from this client."))):(null===(n=o.data)||void 0===n?void 0:n.success)&&s[o.id].resolve(o.data.hasOwnProperty("returnValue")?o.data.returnValue:o.data),delete s[o.id]):o.event&&i(o.event,o.data)})),r.addEventListener("open",(t=>e(this,void 0,void 0,(function*(){i("ready")})))),r.addEventListener("close",(t=>e(this,void 0,void 0,(function*(){i("serverOffline",{code:"NE_CL_NSEROFF",message:"Neutralino server is offline. Try restarting the application"})}))))}()}function d(e,t){return new Promise(((n,o)=>{if((null==r?void 0:r.readyState)!=WebSocket.OPEN)return i={method:e,data:t,resolve:n,reject:o},void a.push(i);var i;const c="10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))),u=window.NL_TOKEN||sessionStorage.getItem("NL_TOKEN")||"";s[c]={resolve:n,reject:o},r.send(JSON.stringify({id:c,method:e,data:t,accessToken:u}))}))}function l(t){return e(this,void 0,void 0,(function*(){for(;t.length>0;){let e=t.shift();try{let t=yield d(e.method,e.data);e.resolve(t)}catch(t){e.reject(t)}}}))}function f(e,t){return d("filesystem.writeBinaryFile",{path:e,data:p(t)})}function p(e){let t=new Uint8Array(e),n="";for(let e of t)n+=String.fromCharCode(e);return window.btoa(n)}var g,w,m=Object.freeze({__proto__:null,createDirectory:function(e){return d("filesystem.createDirectory",{path:e})},removeDirectory:function(e){return d("filesystem.removeDirectory",{path:e})},writeFile:function(e,t){return d("filesystem.writeFile",{path:e,data:t})},appendFile:function(e,t){return d("filesystem.appendFile",{path:e,data:t})},writeBinaryFile:f,appendBinaryFile:function(e,t){return d("filesystem.appendBinaryFile",{path:e,data:p(t)})},readFile:function(e,t){return d("filesystem.readFile",Object.assign({path:e},t))},readBinaryFile:function(e,t){return new Promise(((n,o)=>{d("filesystem.readBinaryFile",Object.assign({path:e},t)).then((e=>{let t=window.atob(e),o=t.length,i=new Uint8Array(o);for(let e=0;e<o;e++)i[e]=t.charCodeAt(e);n(i.buffer)})).catch((e=>{o(e)}))}))},openFile:function(e){return d("filesystem.openFile",{path:e})},updateOpenedFile:function(e,t,n){return d("filesystem.updateOpenedFile",{id:e,event:t,data:n})},getOpenedFileInfo:function(e){return d("filesystem.getOpenedFileInfo",{id:e})},removeFile:function(e){return d("filesystem.removeFile",{path:e})},readDirectory:function(e){return d("filesystem.readDirectory",{path:e})},copyFile:function(e,t){return d("filesystem.copyFile",{source:e,destination:t})},moveFile:function(e,t){return d("filesystem.moveFile",{source:e,destination:t})},getStats:function(e){return d("filesystem.getStats",{path:e})}});function v(e,t){return d("os.execCommand",Object.assign({command:e},t))}!function(e){e.WARNING="WARNING",e.ERROR="ERROR",e.INFO="INFO",e.QUESTION="QUESTION"}(g||(g={})),function(e){e.OK="OK",e.OK_CANCEL="OK_CANCEL",e.YES_NO="YES_NO",e.YES_NO_CANCEL="YES_NO_CANCEL",e.RETRY_CANCEL="RETRY_CANCEL",e.ABORT_RETRY_IGNORE="ABORT_RETRY_IGNORE"}(w||(w={}));var _=Object.freeze({__proto__:null,get Icon(){return g},get MessageBoxChoice(){return w},execCommand:v,spawnProcess:function(e){return d("os.spawnProcess",{command:e})},updateSpawnedProcess:function(e,t,n){return d("os.updateSpawnedProcess",{id:e,event:t,data:n})},getSpawnedProcesses:function(){return d("os.getSpawnedProcesses")},getEnv:function(e){return d("os.getEnv",{key:e})},getEnvs:function(){return d("os.getEnvs")},showOpenDialog:function(e,t){return d("os.showOpenDialog",Object.assign({title:e},t))},showFolderDialog:function(e,t){return d("os.showFolderDialog",Object.assign({title:e},t))},showSaveDialog:function(e,t){return d("os.showSaveDialog",Object.assign({title:e},t))},showNotification:function(e,t,n){return d("os.showNotification",{title:e,content:t,icon:n})},showMessageBox:function(e,t,n,o){return d("os.showMessageBox",{title:e,content:t,choice:n,icon:o})},setTray:function(e){return d("os.setTray",e)},open:function(e){return d("os.open",{url:e})},getPath:function(e){return d("os.getPath",{name:e})}});var h=Object.freeze({__proto__:null,getMemoryInfo:function(){return d("computer.getMemoryInfo")},getArch:function(){return d("computer.getArch")},getKernelInfo:function(){return d("computer.getKernelInfo")},getOSInfo:function(){return d("computer.getOSInfo")},getCPUInfo:function(){return d("computer.getCPUInfo")},getDisplays:function(){return d("computer.getDisplays")},getMousePosition:function(){return d("computer.getMousePosition")}});var y,O=Object.freeze({__proto__:null,setData:function(e,t){return d("storage.setData",{key:e,data:t})},getData:function(e){return d("storage.getData",{key:e})},getKeys:function(){return d("storage.getKeys")}});function N(e,t){return d("debug.log",{message:e,type:t})}!function(e){e.WARNING="WARNING",e.ERROR="ERROR",e.INFO="INFO"}(y||(y={}));var E=Object.freeze({__proto__:null,get LoggerType(){return y},log:N});function b(e){return d("app.exit",{code:e})}var R=Object.freeze({__proto__:null,exit:b,killProcess:function(){return d("app.killProcess")},restartProcess:function(t){return new Promise((n=>e(this,void 0,void 0,(function*(){let e=window.NL_ARGS.reduce(((e,t)=>e+=" "+t),"");(null==t?void 0:t.args)&&(e+=" "+t.args),yield v(e,{background:!0}),b(),n()}))))},getConfig:function(){return d("app.getConfig")},broadcast:function(e,t){return d("app.broadcast",{event:e,data:t})}});const x=new WeakMap;function T(e,t){return d("window.move",{x:e,y:t})}function P(){return d("window.getSize")}var S=Object.freeze({__proto__:null,setTitle:function(e){return d("window.setTitle",{title:e})},getTitle:function(){return d("window.getTitle")},maximize:function(){return d("window.maximize")},unmaximize:function(){return d("window.unmaximize")},isMaximized:function(){return d("window.isMaximized")},minimize:function(){return d("window.minimize")},setFullScreen:function(){return d("window.setFullScreen")},exitFullScreen:function(){return d("window.exitFullScreen")},isFullScreen:function(){return d("window.isFullScreen")},show:function(){return d("window.show")},hide:function(){return d("window.hide")},isVisible:function(){return d("window.isVisible")},focus:function(){return d("window.focus")},setIcon:function(e){return d("window.setIcon",{icon:e})},move:T,setDraggableRegion:function(t){return new Promise(((n,o)=>{const i=t instanceof Element?t:document.getElementById(t);let r=0,s=0;if(!i)return o({code:"NE_WD_DOMNOTF",message:"Unable to find DOM element"});if(x.has(i))return o({code:"NE_WD_ALRDREL",message:"This DOM element is already an active draggable region"});function a(t){return e(this,void 0,void 0,(function*(){yield T(t.screenX-r,t.screenY-s)}))}function c(e){0===e.button&&(r=e.clientX,s=e.clientY,i.addEventListener("pointermove",a),i.setPointerCapture(e.pointerId))}function u(e){i.removeEventListener("pointermove",a),i.releasePointerCapture(e.pointerId)}i.addEventListener("pointerdown",c),i.addEventListener("pointerup",u),x.set(i,{pointerdown:c,pointerup:u}),n({success:!0,message:"Draggable region was activated"})}))},unsetDraggableRegion:function(e){return new Promise(((t,n)=>{const o=e instanceof Element?e:document.getElementById(e);if(!o)return n({code:"NE_WD_DOMNOTF",message:"Unable to find DOM element"});if(!x.has(o))return n({code:"NE_WD_NOTDRRE",message:"DOM element is not an active draggable region"});const{pointerdown:i,pointerup:r}=x.get(o);o.removeEventListener("pointerdown",i),o.removeEventListener("pointerup",r),x.delete(o),t({success:!0,message:"Draggable region was deactivated"})}))},setSize:function(t){return new Promise(((n,o)=>e(this,void 0,void 0,(function*(){let e=yield P();d("window.setSize",t=Object.assign(Object.assign({},e),t)).then((e=>{n(e)})).catch((e=>{o(e)}))}))))},getSize:P,getPosition:function(){return d("window.getPosition")},setAlwaysOnTop:function(e){return d("window.setAlwaysOnTop",{onTop:e})},create:function(e,t){return new Promise(((n,o)=>{function i(e){return"string"!=typeof e||(e=e.trim()).includes(" ")&&(e=`"${e}"`),e}let r=window.NL_ARGS.reduce(((e,t,n)=>((t.includes("--path=")||t.includes("--debug-mode")||t.includes("--load-dir-res")||0==n)&&(e+=" "+i(t)),e)),"");r+=" --url="+i(e);for(let e in t){if("processArgs"==e)continue;r+=` --window${e.replace(/[A-Z]|^[a-z]/g,(e=>"-"+e.toLowerCase()))}=${i(t[e])}`}t&&t.processArgs&&(r+=" "+t.processArgs),v(r,{background:!0}).then((e=>{n(e)})).catch((e=>{o(e)}))}))}});var D=Object.freeze({__proto__:null,broadcast:function(e,t){return d("events.broadcast",{event:e,data:t})},on:o,off:function(e,t){return window.removeEventListener(e,t),Promise.resolve({success:!0,message:"Event listener removed"})},dispatch:i});let L=null;var I=Object.freeze({__proto__:null,checkForUpdates:function(t){return new Promise(((n,o)=>e(this,void 0,void 0,(function*(){if(!t)return o({code:"NE_RT_NATRTER",message:"Missing require parameter: url"});try{let e=yield fetch(t);L=JSON.parse(yield e.text()),!function(e){return!!(e.applicationId&&e.applicationId==window.NL_APPID&&e.version&&e.resourcesURL)}(L)?o({code:"NE_UP_CUPDMER",message:"Invalid update manifest or mismatching applicationId"}):n(L)}catch(e){o({code:"NE_UP_CUPDERR",message:"Unable to fetch update manifest"})}}))))},install:function(){return new Promise(((t,n)=>e(this,void 0,void 0,(function*(){if(!L)return n({code:"NE_UP_UPDNOUF",message:"No update manifest loaded"});try{let e=yield fetch(L.resourcesURL),n=yield e.arrayBuffer();yield f(window.NL_PATH+"/resources.neu",n),t({success:!0,message:"Update installed. Restart the process to see updates"})}catch(e){n({code:"NE_UP_UPDINER",message:"Update installation error"})}}))))}});var F=Object.freeze({__proto__:null,readText:function(e,t){return d("clipboard.readText",{key:e,data:t})},writeText:function(e){return d("clipboard.writeText",{data:e})}});var C=Object.freeze({__proto__:null,getMethods:function(){return d("custom.getMethods")}});let A=!1;exports.app=R,exports.clipboard=F,exports.computer=h,exports.custom=C,exports.debug=E,exports.events=D,exports.extensions=n,exports.filesystem=m,exports.init=function(t={}){if(t=Object.assign({exportCustomMethods:!0},t),!A){if(u(),window.NL_ARGS.find((e=>"--neu-dev-auto-reload"==e))&&o("neuDev_reloadApp",(()=>e(this,void 0,void 0,(function*(){yield N("Reloading the application..."),location.reload()})))),t.exportCustomMethods&&window.NL_CMETHODS&&window.NL_CMETHODS.length>0)for(let e of window.NL_CMETHODS)Neutralino.custom[e]=(...t)=>{let n={};for(let[e,o]of t.entries())n="object"!=typeof o||Array.isArray(o)||null==o?Object.assign(Object.assign({},n),{["arg"+e]:o}):Object.assign(Object.assign({},n),o);return d("custom."+e,n)};window.NL_CVERSION="3.8.2-nightly-20230124",window.NL_CCOMMIT="590d453ef302521346740453b9ffe169689c8a00",A=!0}},exports.os=_,exports.storage=O,exports.updater=I,exports.window=S; |
@@ -1,2 +0,2 @@ | ||
// Type definitions for Neutralino 3.8.2-nightly-20230123 | ||
// Type definitions for Neutralino 3.8.2-nightly-20230124 | ||
// Project: https://github.com/neutralinojs | ||
@@ -309,3 +309,3 @@ // Definitions project: https://github.com/neutralinojs/neutralino.js | ||
/** Neutralinojs client version */ | ||
declare const NL_CVERSION: "3.8.2-nightly-20230123"; | ||
declare const NL_CVERSION: "3.8.2-nightly-20230124"; | ||
@@ -312,0 +312,0 @@ /** Current working directory */ |
@@ -1,1 +0,1 @@ | ||
var Neutralino=function(e){"use strict";function t(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{u(o.next(e))}catch(e){r(e)}}function a(e){try{u(o.throw(e))}catch(e){r(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((o=o.apply(e,t||[])).next())}))}function n(){return l("extensions.getStats")}var o={__proto__:null,dispatch:function(e,o,i){return new Promise(((r,s)=>t(this,void 0,void 0,(function*(){let t=yield n();if(t.loaded.includes(e))if(t.connected.includes(e))try{let t=yield l("extensions.dispatch",{extensionId:e,event:o,data:i});r(t)}catch(e){s(e)}else!function(e,t){e in c?c[e].push(t):c[e]=[t]}(e,{method:"extensions.dispatch",data:{extensionId:e,event:o,data:i},resolve:r,reject:s});else s({code:"NE_EX_EXTNOTL",message:`${e} is not loaded`})}))))},broadcast:function(e,t){return l("extensions.broadcast",{event:e,data:t})},getStats:n};function i(e,t){return window.addEventListener(e,t),Promise.resolve({success:!0,message:"Event listener added"})}function r(e,t){let n=new CustomEvent(e,{detail:t});return window.dispatchEvent(n),Promise.resolve({success:!0,message:"Message dispatched"})}let s,a={},u=[],c={};function d(){window.NL_TOKEN&&sessionStorage.setItem("NL_TOKEN",window.NL_TOKEN),s=new WebSocket(`ws://${window.location.hostname}:${window.NL_PORT}`),function(){if(i("ready",(()=>t(this,void 0,void 0,(function*(){if(yield f(u),!window.NL_EXTENABLED)return;let e=yield n();for(let t of e.connected)r("extensionReady",t)})))),i("extClientConnect",(e=>{r("extensionReady",e.detail)})),!window.NL_EXTENABLED)return;i("extensionReady",(e=>t(this,void 0,void 0,(function*(){e.detail in c&&(yield f(c[e.detail]),delete c[e.detail])}))))}(),function(){s.addEventListener("message",(e=>{var t,n;const o=JSON.parse(e.data);o.id&&o.id in a?((null===(t=o.data)||void 0===t?void 0:t.error)?(a[o.id].reject(o.data.error),"NE_RT_INVTOKN"==o.data.error.code&&(s.close(),document.body.innerText="",document.write("<code>NE_RT_INVTOKN</code>: Neutralinojs application configuration prevents accepting native calls from this client."))):(null===(n=o.data)||void 0===n?void 0:n.success)&&a[o.id].resolve(o.data.hasOwnProperty("returnValue")?o.data.returnValue:o.data),delete a[o.id]):o.event&&r(o.event,o.data)})),s.addEventListener("open",(e=>t(this,void 0,void 0,(function*(){r("ready")})))),s.addEventListener("close",(e=>t(this,void 0,void 0,(function*(){r("serverOffline",{code:"NE_CL_NSEROFF",message:"Neutralino server is offline. Try restarting the application"})}))))}()}function l(e,t){return new Promise(((n,o)=>{if((null==s?void 0:s.readyState)!=WebSocket.OPEN)return i={method:e,data:t,resolve:n,reject:o},void u.push(i);var i;const r="10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))),c=window.NL_TOKEN||sessionStorage.getItem("NL_TOKEN")||"";a[r]={resolve:n,reject:o},s.send(JSON.stringify({id:r,method:e,data:t,accessToken:c}))}))}function f(e){return t(this,void 0,void 0,(function*(){for(;e.length>0;){let t=e.shift();try{let e=yield l(t.method,t.data);t.resolve(e)}catch(e){t.reject(e)}}}))}function p(e,t){return l("filesystem.writeBinaryFile",{path:e,data:g(t)})}function g(e){let t=new Uint8Array(e),n="";for(let e of t)n+=String.fromCharCode(e);return window.btoa(n)}var w,m,v={__proto__:null,createDirectory:function(e){return l("filesystem.createDirectory",{path:e})},removeDirectory:function(e){return l("filesystem.removeDirectory",{path:e})},writeFile:function(e,t){return l("filesystem.writeFile",{path:e,data:t})},appendFile:function(e,t){return l("filesystem.appendFile",{path:e,data:t})},writeBinaryFile:p,appendBinaryFile:function(e,t){return l("filesystem.appendBinaryFile",{path:e,data:g(t)})},readFile:function(e,t){return l("filesystem.readFile",Object.assign({path:e},t))},readBinaryFile:function(e,t){return new Promise(((n,o)=>{l("filesystem.readBinaryFile",Object.assign({path:e},t)).then((e=>{let t=window.atob(e),o=t.length,i=new Uint8Array(o);for(let e=0;e<o;e++)i[e]=t.charCodeAt(e);n(i.buffer)})).catch((e=>{o(e)}))}))},openFile:function(e){return l("filesystem.openFile",{path:e})},updateOpenedFile:function(e,t,n){return l("filesystem.updateOpenedFile",{id:e,event:t,data:n})},getOpenedFileInfo:function(e){return l("filesystem.getOpenedFileInfo",{id:e})},removeFile:function(e){return l("filesystem.removeFile",{path:e})},readDirectory:function(e){return l("filesystem.readDirectory",{path:e})},copyFile:function(e,t){return l("filesystem.copyFile",{source:e,destination:t})},moveFile:function(e,t){return l("filesystem.moveFile",{source:e,destination:t})},getStats:function(e){return l("filesystem.getStats",{path:e})}};function _(e,t){return l("os.execCommand",Object.assign({command:e},t))}!function(e){e.WARNING="WARNING",e.ERROR="ERROR",e.INFO="INFO",e.QUESTION="QUESTION"}(w||(w={})),function(e){e.OK="OK",e.OK_CANCEL="OK_CANCEL",e.YES_NO="YES_NO",e.YES_NO_CANCEL="YES_NO_CANCEL",e.RETRY_CANCEL="RETRY_CANCEL",e.ABORT_RETRY_IGNORE="ABORT_RETRY_IGNORE"}(m||(m={}));var h={__proto__:null,get Icon(){return w},get MessageBoxChoice(){return m},execCommand:_,spawnProcess:function(e){return l("os.spawnProcess",{command:e})},updateSpawnedProcess:function(e,t,n){return l("os.updateSpawnedProcess",{id:e,event:t,data:n})},getSpawnedProcesses:function(){return l("os.getSpawnedProcesses")},getEnv:function(e){return l("os.getEnv",{key:e})},getEnvs:function(){return l("os.getEnvs")},showOpenDialog:function(e,t){return l("os.showOpenDialog",Object.assign({title:e},t))},showFolderDialog:function(e,t){return l("os.showFolderDialog",Object.assign({title:e},t))},showSaveDialog:function(e,t){return l("os.showSaveDialog",Object.assign({title:e},t))},showNotification:function(e,t,n){return l("os.showNotification",{title:e,content:t,icon:n})},showMessageBox:function(e,t,n,o){return l("os.showMessageBox",{title:e,content:t,choice:n,icon:o})},setTray:function(e){return l("os.setTray",e)},open:function(e){return l("os.open",{url:e})},getPath:function(e){return l("os.getPath",{name:e})}};var y={__proto__:null,getMemoryInfo:function(){return l("computer.getMemoryInfo")},getArch:function(){return l("computer.getArch")},getKernelInfo:function(){return l("computer.getKernelInfo")},getOSInfo:function(){return l("computer.getOSInfo")},getCPUInfo:function(){return l("computer.getCPUInfo")},getDisplays:function(){return l("computer.getDisplays")},getMousePosition:function(){return l("computer.getMousePosition")}};var N,E={__proto__:null,setData:function(e,t){return l("storage.setData",{key:e,data:t})},getData:function(e){return l("storage.getData",{key:e})},getKeys:function(){return l("storage.getKeys")}};function O(e,t){return l("debug.log",{message:e,type:t})}!function(e){e.WARNING="WARNING",e.ERROR="ERROR",e.INFO="INFO"}(N||(N={}));var R={__proto__:null,get LoggerType(){return N},log:O};function T(e){return l("app.exit",{code:e})}var b={__proto__:null,exit:T,killProcess:function(){return l("app.killProcess")},restartProcess:function(e){return new Promise((n=>t(this,void 0,void 0,(function*(){let t=window.NL_ARGS.reduce(((e,t)=>e+=" "+t),"");(null==e?void 0:e.args)&&(t+=" "+e.args),yield _(t,{background:!0}),T(),n()}))))},getConfig:function(){return l("app.getConfig")},broadcast:function(e,t){return l("app.broadcast",{event:e,data:t})}};const P=new WeakMap;function S(e,t){return l("window.move",{x:e,y:t})}function D(){return l("window.getSize")}var L={__proto__:null,setTitle:function(e){return l("window.setTitle",{title:e})},getTitle:function(){return l("window.getTitle")},maximize:function(){return l("window.maximize")},unmaximize:function(){return l("window.unmaximize")},isMaximized:function(){return l("window.isMaximized")},minimize:function(){return l("window.minimize")},setFullScreen:function(){return l("window.setFullScreen")},exitFullScreen:function(){return l("window.exitFullScreen")},isFullScreen:function(){return l("window.isFullScreen")},show:function(){return l("window.show")},hide:function(){return l("window.hide")},isVisible:function(){return l("window.isVisible")},focus:function(){return l("window.focus")},setIcon:function(e){return l("window.setIcon",{icon:e})},move:S,setDraggableRegion:function(e){return new Promise(((n,o)=>{const i=e instanceof Element?e:document.getElementById(e);let r=0,s=0;if(!i)return o({code:"NE_WD_DOMNOTF",message:"Unable to find DOM element"});if(P.has(i))return o({code:"NE_WD_ALRDREL",message:"This DOM element is already an active draggable region"});function a(e){return t(this,void 0,void 0,(function*(){yield S(e.screenX-r,e.screenY-s)}))}function u(e){0===e.button&&(r=e.clientX,s=e.clientY,i.addEventListener("pointermove",a),i.setPointerCapture(e.pointerId))}function c(e){i.removeEventListener("pointermove",a),i.releasePointerCapture(e.pointerId)}i.addEventListener("pointerdown",u),i.addEventListener("pointerup",c),P.set(i,{pointerdown:u,pointerup:c}),n({success:!0,message:"Draggable region was activated"})}))},unsetDraggableRegion:function(e){return new Promise(((t,n)=>{const o=e instanceof Element?e:document.getElementById(e);if(!o)return n({code:"NE_WD_DOMNOTF",message:"Unable to find DOM element"});if(!P.has(o))return n({code:"NE_WD_NOTDRRE",message:"DOM element is not an active draggable region"});const{pointerdown:i,pointerup:r}=P.get(o);o.removeEventListener("pointerdown",i),o.removeEventListener("pointerup",r),P.delete(o),t({success:!0,message:"Draggable region was deactivated"})}))},setSize:function(e){return new Promise(((n,o)=>t(this,void 0,void 0,(function*(){let t=yield D();l("window.setSize",e=Object.assign(Object.assign({},t),e)).then((e=>{n(e)})).catch((e=>{o(e)}))}))))},getSize:D,getPosition:function(){return l("window.getPosition")},setAlwaysOnTop:function(e){return l("window.setAlwaysOnTop",{onTop:e})},create:function(e,t){return new Promise(((n,o)=>{function i(e){return"string"!=typeof e||(e=e.trim()).includes(" ")&&(e=`"${e}"`),e}let r=window.NL_ARGS.reduce(((e,t,n)=>((t.includes("--path=")||t.includes("--debug-mode")||t.includes("--load-dir-res")||0==n)&&(e+=" "+i(t)),e)),"");r+=" --url="+i(e);for(let e in t){if("processArgs"==e)continue;r+=` --window${e.replace(/[A-Z]|^[a-z]/g,(e=>"-"+e.toLowerCase()))}=${i(t[e])}`}t&&t.processArgs&&(r+=" "+t.processArgs),_(r,{background:!0}).then((e=>{n(e)})).catch((e=>{o(e)}))}))}};var I={__proto__:null,broadcast:function(e,t){return l("events.broadcast",{event:e,data:t})},on:i,off:function(e,t){return window.removeEventListener(e,t),Promise.resolve({success:!0,message:"Event listener removed"})},dispatch:r};let F=null;var C={__proto__:null,checkForUpdates:function(e){return new Promise(((n,o)=>t(this,void 0,void 0,(function*(){if(!e)return o({code:"NE_RT_NATRTER",message:"Missing require parameter: url"});try{let t=yield fetch(e);F=JSON.parse(yield t.text()),!function(e){return!!(e.applicationId&&e.applicationId==window.NL_APPID&&e.version&&e.resourcesURL)}(F)?o({code:"NE_UP_CUPDMER",message:"Invalid update manifest or mismatching applicationId"}):n(F)}catch(e){o({code:"NE_UP_CUPDERR",message:"Unable to fetch update manifest"})}}))))},install:function(){return new Promise(((e,n)=>t(this,void 0,void 0,(function*(){if(!F)return n({code:"NE_UP_UPDNOUF",message:"No update manifest loaded"});try{let t=yield fetch(F.resourcesURL),n=yield t.arrayBuffer();yield p(window.NL_PATH+"/resources.neu",n),e({success:!0,message:"Update installed. Restart the process to see updates"})}catch(e){n({code:"NE_UP_UPDINER",message:"Update installation error"})}}))))}};var x={__proto__:null,readText:function(e,t){return l("clipboard.readText",{key:e,data:t})},writeText:function(e){return l("clipboard.writeText",{data:e})}};var A={__proto__:null,getMethods:function(){return l("custom.getMethods")}};let M=!1;return e.app=b,e.clipboard=x,e.computer=y,e.custom=A,e.debug=R,e.events=I,e.extensions=o,e.filesystem=v,e.init=function(e={}){if(e=Object.assign({exportCustomMethods:!0},e),!M){if(d(),window.NL_ARGS.find((e=>"--neu-dev-auto-reload"==e))&&i("neuDev_reloadApp",(()=>t(this,void 0,void 0,(function*(){yield O("Reloading the application..."),location.reload()})))),e.exportCustomMethods&&window.NL_CMETHODS&&window.NL_CMETHODS.length>0)for(let e of window.NL_CMETHODS)Neutralino.custom[e]=(...t)=>{let n={};for(let[e,o]of t.entries())n="object"!=typeof o||Array.isArray(o)||null==o?Object.assign(Object.assign({},n),{["arg"+e]:o}):Object.assign(Object.assign({},n),o);return l("custom."+e,n)};window.NL_CVERSION="3.8.2-nightly-20230123",window.NL_CCOMMIT="590d453ef302521346740453b9ffe169689c8a00",M=!0}},e.os=h,e.storage=E,e.updater=C,e.window=L,e}({}); | ||
var Neutralino=function(e){"use strict";function t(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{u(o.next(e))}catch(e){r(e)}}function a(e){try{u(o.throw(e))}catch(e){r(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((o=o.apply(e,t||[])).next())}))}function n(){return l("extensions.getStats")}var o={__proto__:null,dispatch:function(e,o,i){return new Promise(((r,s)=>t(this,void 0,void 0,(function*(){let t=yield n();if(t.loaded.includes(e))if(t.connected.includes(e))try{let t=yield l("extensions.dispatch",{extensionId:e,event:o,data:i});r(t)}catch(e){s(e)}else!function(e,t){e in c?c[e].push(t):c[e]=[t]}(e,{method:"extensions.dispatch",data:{extensionId:e,event:o,data:i},resolve:r,reject:s});else s({code:"NE_EX_EXTNOTL",message:`${e} is not loaded`})}))))},broadcast:function(e,t){return l("extensions.broadcast",{event:e,data:t})},getStats:n};function i(e,t){return window.addEventListener(e,t),Promise.resolve({success:!0,message:"Event listener added"})}function r(e,t){let n=new CustomEvent(e,{detail:t});return window.dispatchEvent(n),Promise.resolve({success:!0,message:"Message dispatched"})}let s,a={},u=[],c={};function d(){window.NL_TOKEN&&sessionStorage.setItem("NL_TOKEN",window.NL_TOKEN),s=new WebSocket(`ws://${window.location.hostname}:${window.NL_PORT}`),function(){if(i("ready",(()=>t(this,void 0,void 0,(function*(){if(yield f(u),!window.NL_EXTENABLED)return;let e=yield n();for(let t of e.connected)r("extensionReady",t)})))),i("extClientConnect",(e=>{r("extensionReady",e.detail)})),!window.NL_EXTENABLED)return;i("extensionReady",(e=>t(this,void 0,void 0,(function*(){e.detail in c&&(yield f(c[e.detail]),delete c[e.detail])}))))}(),function(){s.addEventListener("message",(e=>{var t,n;const o=JSON.parse(e.data);o.id&&o.id in a?((null===(t=o.data)||void 0===t?void 0:t.error)?(a[o.id].reject(o.data.error),"NE_RT_INVTOKN"==o.data.error.code&&(s.close(),document.body.innerText="",document.write("<code>NE_RT_INVTOKN</code>: Neutralinojs application configuration prevents accepting native calls from this client."))):(null===(n=o.data)||void 0===n?void 0:n.success)&&a[o.id].resolve(o.data.hasOwnProperty("returnValue")?o.data.returnValue:o.data),delete a[o.id]):o.event&&r(o.event,o.data)})),s.addEventListener("open",(e=>t(this,void 0,void 0,(function*(){r("ready")})))),s.addEventListener("close",(e=>t(this,void 0,void 0,(function*(){r("serverOffline",{code:"NE_CL_NSEROFF",message:"Neutralino server is offline. Try restarting the application"})}))))}()}function l(e,t){return new Promise(((n,o)=>{if((null==s?void 0:s.readyState)!=WebSocket.OPEN)return i={method:e,data:t,resolve:n,reject:o},void u.push(i);var i;const r="10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))),c=window.NL_TOKEN||sessionStorage.getItem("NL_TOKEN")||"";a[r]={resolve:n,reject:o},s.send(JSON.stringify({id:r,method:e,data:t,accessToken:c}))}))}function f(e){return t(this,void 0,void 0,(function*(){for(;e.length>0;){let t=e.shift();try{let e=yield l(t.method,t.data);t.resolve(e)}catch(e){t.reject(e)}}}))}function p(e,t){return l("filesystem.writeBinaryFile",{path:e,data:g(t)})}function g(e){let t=new Uint8Array(e),n="";for(let e of t)n+=String.fromCharCode(e);return window.btoa(n)}var w,m,v={__proto__:null,createDirectory:function(e){return l("filesystem.createDirectory",{path:e})},removeDirectory:function(e){return l("filesystem.removeDirectory",{path:e})},writeFile:function(e,t){return l("filesystem.writeFile",{path:e,data:t})},appendFile:function(e,t){return l("filesystem.appendFile",{path:e,data:t})},writeBinaryFile:p,appendBinaryFile:function(e,t){return l("filesystem.appendBinaryFile",{path:e,data:g(t)})},readFile:function(e,t){return l("filesystem.readFile",Object.assign({path:e},t))},readBinaryFile:function(e,t){return new Promise(((n,o)=>{l("filesystem.readBinaryFile",Object.assign({path:e},t)).then((e=>{let t=window.atob(e),o=t.length,i=new Uint8Array(o);for(let e=0;e<o;e++)i[e]=t.charCodeAt(e);n(i.buffer)})).catch((e=>{o(e)}))}))},openFile:function(e){return l("filesystem.openFile",{path:e})},updateOpenedFile:function(e,t,n){return l("filesystem.updateOpenedFile",{id:e,event:t,data:n})},getOpenedFileInfo:function(e){return l("filesystem.getOpenedFileInfo",{id:e})},removeFile:function(e){return l("filesystem.removeFile",{path:e})},readDirectory:function(e){return l("filesystem.readDirectory",{path:e})},copyFile:function(e,t){return l("filesystem.copyFile",{source:e,destination:t})},moveFile:function(e,t){return l("filesystem.moveFile",{source:e,destination:t})},getStats:function(e){return l("filesystem.getStats",{path:e})}};function _(e,t){return l("os.execCommand",Object.assign({command:e},t))}!function(e){e.WARNING="WARNING",e.ERROR="ERROR",e.INFO="INFO",e.QUESTION="QUESTION"}(w||(w={})),function(e){e.OK="OK",e.OK_CANCEL="OK_CANCEL",e.YES_NO="YES_NO",e.YES_NO_CANCEL="YES_NO_CANCEL",e.RETRY_CANCEL="RETRY_CANCEL",e.ABORT_RETRY_IGNORE="ABORT_RETRY_IGNORE"}(m||(m={}));var h={__proto__:null,get Icon(){return w},get MessageBoxChoice(){return m},execCommand:_,spawnProcess:function(e){return l("os.spawnProcess",{command:e})},updateSpawnedProcess:function(e,t,n){return l("os.updateSpawnedProcess",{id:e,event:t,data:n})},getSpawnedProcesses:function(){return l("os.getSpawnedProcesses")},getEnv:function(e){return l("os.getEnv",{key:e})},getEnvs:function(){return l("os.getEnvs")},showOpenDialog:function(e,t){return l("os.showOpenDialog",Object.assign({title:e},t))},showFolderDialog:function(e,t){return l("os.showFolderDialog",Object.assign({title:e},t))},showSaveDialog:function(e,t){return l("os.showSaveDialog",Object.assign({title:e},t))},showNotification:function(e,t,n){return l("os.showNotification",{title:e,content:t,icon:n})},showMessageBox:function(e,t,n,o){return l("os.showMessageBox",{title:e,content:t,choice:n,icon:o})},setTray:function(e){return l("os.setTray",e)},open:function(e){return l("os.open",{url:e})},getPath:function(e){return l("os.getPath",{name:e})}};var y={__proto__:null,getMemoryInfo:function(){return l("computer.getMemoryInfo")},getArch:function(){return l("computer.getArch")},getKernelInfo:function(){return l("computer.getKernelInfo")},getOSInfo:function(){return l("computer.getOSInfo")},getCPUInfo:function(){return l("computer.getCPUInfo")},getDisplays:function(){return l("computer.getDisplays")},getMousePosition:function(){return l("computer.getMousePosition")}};var N,E={__proto__:null,setData:function(e,t){return l("storage.setData",{key:e,data:t})},getData:function(e){return l("storage.getData",{key:e})},getKeys:function(){return l("storage.getKeys")}};function O(e,t){return l("debug.log",{message:e,type:t})}!function(e){e.WARNING="WARNING",e.ERROR="ERROR",e.INFO="INFO"}(N||(N={}));var R={__proto__:null,get LoggerType(){return N},log:O};function T(e){return l("app.exit",{code:e})}var b={__proto__:null,exit:T,killProcess:function(){return l("app.killProcess")},restartProcess:function(e){return new Promise((n=>t(this,void 0,void 0,(function*(){let t=window.NL_ARGS.reduce(((e,t)=>e+=" "+t),"");(null==e?void 0:e.args)&&(t+=" "+e.args),yield _(t,{background:!0}),T(),n()}))))},getConfig:function(){return l("app.getConfig")},broadcast:function(e,t){return l("app.broadcast",{event:e,data:t})}};const P=new WeakMap;function S(e,t){return l("window.move",{x:e,y:t})}function D(){return l("window.getSize")}var L={__proto__:null,setTitle:function(e){return l("window.setTitle",{title:e})},getTitle:function(){return l("window.getTitle")},maximize:function(){return l("window.maximize")},unmaximize:function(){return l("window.unmaximize")},isMaximized:function(){return l("window.isMaximized")},minimize:function(){return l("window.minimize")},setFullScreen:function(){return l("window.setFullScreen")},exitFullScreen:function(){return l("window.exitFullScreen")},isFullScreen:function(){return l("window.isFullScreen")},show:function(){return l("window.show")},hide:function(){return l("window.hide")},isVisible:function(){return l("window.isVisible")},focus:function(){return l("window.focus")},setIcon:function(e){return l("window.setIcon",{icon:e})},move:S,setDraggableRegion:function(e){return new Promise(((n,o)=>{const i=e instanceof Element?e:document.getElementById(e);let r=0,s=0;if(!i)return o({code:"NE_WD_DOMNOTF",message:"Unable to find DOM element"});if(P.has(i))return o({code:"NE_WD_ALRDREL",message:"This DOM element is already an active draggable region"});function a(e){return t(this,void 0,void 0,(function*(){yield S(e.screenX-r,e.screenY-s)}))}function u(e){0===e.button&&(r=e.clientX,s=e.clientY,i.addEventListener("pointermove",a),i.setPointerCapture(e.pointerId))}function c(e){i.removeEventListener("pointermove",a),i.releasePointerCapture(e.pointerId)}i.addEventListener("pointerdown",u),i.addEventListener("pointerup",c),P.set(i,{pointerdown:u,pointerup:c}),n({success:!0,message:"Draggable region was activated"})}))},unsetDraggableRegion:function(e){return new Promise(((t,n)=>{const o=e instanceof Element?e:document.getElementById(e);if(!o)return n({code:"NE_WD_DOMNOTF",message:"Unable to find DOM element"});if(!P.has(o))return n({code:"NE_WD_NOTDRRE",message:"DOM element is not an active draggable region"});const{pointerdown:i,pointerup:r}=P.get(o);o.removeEventListener("pointerdown",i),o.removeEventListener("pointerup",r),P.delete(o),t({success:!0,message:"Draggable region was deactivated"})}))},setSize:function(e){return new Promise(((n,o)=>t(this,void 0,void 0,(function*(){let t=yield D();l("window.setSize",e=Object.assign(Object.assign({},t),e)).then((e=>{n(e)})).catch((e=>{o(e)}))}))))},getSize:D,getPosition:function(){return l("window.getPosition")},setAlwaysOnTop:function(e){return l("window.setAlwaysOnTop",{onTop:e})},create:function(e,t){return new Promise(((n,o)=>{function i(e){return"string"!=typeof e||(e=e.trim()).includes(" ")&&(e=`"${e}"`),e}let r=window.NL_ARGS.reduce(((e,t,n)=>((t.includes("--path=")||t.includes("--debug-mode")||t.includes("--load-dir-res")||0==n)&&(e+=" "+i(t)),e)),"");r+=" --url="+i(e);for(let e in t){if("processArgs"==e)continue;r+=` --window${e.replace(/[A-Z]|^[a-z]/g,(e=>"-"+e.toLowerCase()))}=${i(t[e])}`}t&&t.processArgs&&(r+=" "+t.processArgs),_(r,{background:!0}).then((e=>{n(e)})).catch((e=>{o(e)}))}))}};var I={__proto__:null,broadcast:function(e,t){return l("events.broadcast",{event:e,data:t})},on:i,off:function(e,t){return window.removeEventListener(e,t),Promise.resolve({success:!0,message:"Event listener removed"})},dispatch:r};let F=null;var C={__proto__:null,checkForUpdates:function(e){return new Promise(((n,o)=>t(this,void 0,void 0,(function*(){if(!e)return o({code:"NE_RT_NATRTER",message:"Missing require parameter: url"});try{let t=yield fetch(e);F=JSON.parse(yield t.text()),!function(e){return!!(e.applicationId&&e.applicationId==window.NL_APPID&&e.version&&e.resourcesURL)}(F)?o({code:"NE_UP_CUPDMER",message:"Invalid update manifest or mismatching applicationId"}):n(F)}catch(e){o({code:"NE_UP_CUPDERR",message:"Unable to fetch update manifest"})}}))))},install:function(){return new Promise(((e,n)=>t(this,void 0,void 0,(function*(){if(!F)return n({code:"NE_UP_UPDNOUF",message:"No update manifest loaded"});try{let t=yield fetch(F.resourcesURL),n=yield t.arrayBuffer();yield p(window.NL_PATH+"/resources.neu",n),e({success:!0,message:"Update installed. Restart the process to see updates"})}catch(e){n({code:"NE_UP_UPDINER",message:"Update installation error"})}}))))}};var x={__proto__:null,readText:function(e,t){return l("clipboard.readText",{key:e,data:t})},writeText:function(e){return l("clipboard.writeText",{data:e})}};var A={__proto__:null,getMethods:function(){return l("custom.getMethods")}};let M=!1;return e.app=b,e.clipboard=x,e.computer=y,e.custom=A,e.debug=R,e.events=I,e.extensions=o,e.filesystem=v,e.init=function(e={}){if(e=Object.assign({exportCustomMethods:!0},e),!M){if(d(),window.NL_ARGS.find((e=>"--neu-dev-auto-reload"==e))&&i("neuDev_reloadApp",(()=>t(this,void 0,void 0,(function*(){yield O("Reloading the application..."),location.reload()})))),e.exportCustomMethods&&window.NL_CMETHODS&&window.NL_CMETHODS.length>0)for(let e of window.NL_CMETHODS)Neutralino.custom[e]=(...t)=>{let n={};for(let[e,o]of t.entries())n="object"!=typeof o||Array.isArray(o)||null==o?Object.assign(Object.assign({},n),{["arg"+e]:o}):Object.assign(Object.assign({},n),o);return l("custom."+e,n)};window.NL_CVERSION="3.8.2-nightly-20230124",window.NL_CCOMMIT="590d453ef302521346740453b9ffe169689c8a00",M=!0}},e.os=h,e.storage=E,e.updater=C,e.window=L,e}({}); |
{ | ||
"name": "@neutralinojs/lib", | ||
"version": "3.8.2-nightly-20230123", | ||
"version": "3.8.2-nightly-20230124", | ||
"description": "JavaScript API for Neutralinojs", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package