Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@neutralinojs/lib

Package Overview
Dependencies
Maintainers
1
Versions
149
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@neutralinojs/lib - npm Package Compare versions

Comparing version 5.0.1 to 5.1.0

dist/neutralino.d.mts

419

dist/index.d.ts

@@ -0,5 +1,53 @@

// debug
declare enum LoggerType {
WARNING = "WARNING",
ERROR = "ERROR",
INFO = "INFO"
}
// os
declare enum Icon {
WARNING = "WARNING",
ERROR = "ERROR",
INFO = "INFO",
QUESTION = "QUESTION"
}
declare enum MessageBoxChoice {
OK = "OK",
OK_CANCEL = "OK_CANCEL",
YES_NO = "YES_NO",
YES_NO_CANCEL = "YES_NO_CANCEL",
RETRY_CANCEL = "RETRY_CANCEL",
ABORT_RETRY_IGNORE = "ABORT_RETRY_IGNORE"
}
//clipboard
declare enum ClipboardFormat {
unknown = 0,
text = 1,
image = 2
}
// NL_GLOBALS
declare enum Mode {
window = 0,
browser = 1,
cloud = 2,
chrome = 3
}
declare enum OperatingSystem {
Linux = 0,
Windows = 1,
Darwin = 2,
FreeBSD = 3,
Unknown = 4
}
declare enum Architecture {
x64 = 0,
arm = 1,
itanium = 2,
ia32 = 3,
unknown = 4
}
declare global {
interface Window {
/** Mode of the application: window, browser, cloud, or chrome */
NL_MODE: string;
NL_MODE: Mode;
/** Application port */

@@ -22,5 +70,5 @@ NL_PORT: number;

/** Operating system name: Linux, Windows, Darwin, FreeBSD, or Uknown */
NL_OS: string;
NL_OS: OperatingSystem;
/** CPU architecture: x64, arm, itanium, ia32, or unknown */
NL_ARCH: string;
NL_ARCH: Architecture;
/** Neutralinojs server version */

@@ -92,2 +140,50 @@ NL_VERSION: string;

declare namespace os {
// debug
enum LoggerType {
WARNING = "WARNING",
ERROR = "ERROR",
INFO = "INFO"
}
// os
enum Icon {
WARNING = "WARNING",
ERROR = "ERROR",
INFO = "INFO",
QUESTION = "QUESTION"
}
enum MessageBoxChoice {
OK = "OK",
OK_CANCEL = "OK_CANCEL",
YES_NO = "YES_NO",
YES_NO_CANCEL = "YES_NO_CANCEL",
RETRY_CANCEL = "RETRY_CANCEL",
ABORT_RETRY_IGNORE = "ABORT_RETRY_IGNORE"
}
//clipboard
enum ClipboardFormat {
unknown = 0,
text = 1,
image = 2
}
// NL_GLOBALS
enum Mode {
window = 0,
browser = 1,
cloud = 2,
chrome = 3
}
enum OperatingSystem {
Linux = 0,
Windows = 1,
Darwin = 2,
FreeBSD = 3,
Unknown = 4
}
enum Architecture {
x64 = 0,
arm = 1,
itanium = 2,
ia32 = 3,
unknown = 4
}
interface ExecCommandOptions {

@@ -138,16 +234,2 @@ stdIn?: string;

}
enum Icon {
WARNING = "WARNING",
ERROR = "ERROR",
INFO = "INFO",
QUESTION = "QUESTION"
}
enum MessageBoxChoice {
OK = "OK",
OK_CANCEL = "OK_CANCEL",
YES_NO = "YES_NO",
YES_NO_CANCEL = "YES_NO_CANCEL",
RETRY_CANCEL = "RETRY_CANCEL",
ABORT_RETRY_IGNORE = "ABORT_RETRY_IGNORE"
}
type KnownPath = "config" | "data" | "cache" | "documents" | "pictures" | "music" | "video" | "downloads" | "savedGames1" | "savedGames2";

@@ -171,4 +253,10 @@ function execCommand(command: string, options?: ExecCommandOptions): Promise<ExecCommandResult>;

interface MemoryInfo {
total: number;
available: number;
physical: {
total: number;
available: number;
};
virtual: {
total: number;
available: number;
};
}

@@ -222,2 +310,3 @@ interface KernelInfo {

declare namespace debug {
// debug
enum LoggerType {

@@ -228,2 +317,44 @@ WARNING = "WARNING",

}
// os
enum Icon {
WARNING = "WARNING",
ERROR = "ERROR",
INFO = "INFO",
QUESTION = "QUESTION"
}
enum MessageBoxChoice {
OK = "OK",
OK_CANCEL = "OK_CANCEL",
YES_NO = "YES_NO",
YES_NO_CANCEL = "YES_NO_CANCEL",
RETRY_CANCEL = "RETRY_CANCEL",
ABORT_RETRY_IGNORE = "ABORT_RETRY_IGNORE"
}
//clipboard
enum ClipboardFormat {
unknown = 0,
text = 1,
image = 2
}
// NL_GLOBALS
enum Mode {
window = 0,
browser = 1,
cloud = 2,
chrome = 3
}
enum OperatingSystem {
Linux = 0,
Windows = 1,
Darwin = 2,
FreeBSD = 3,
Unknown = 4
}
enum Architecture {
x64 = 0,
arm = 1,
itanium = 2,
ia32 = 3,
unknown = 4
}
function log(message: string, type?: LoggerType): Promise<void>;

@@ -330,4 +461,69 @@ }

declare namespace clipboard {
function readText(key: string, data: string): Promise<void>;
function writeText(data: string): Promise<string>;
interface ClipboardImage {
width: number;
height: number;
bpp: number;
bpr: number;
redMask: number;
greenMask: number;
blueMask: number;
redShift: number;
greenShift: number;
blueShift: number;
data: ArrayBuffer;
}
// debug
enum LoggerType {
WARNING = "WARNING",
ERROR = "ERROR",
INFO = "INFO"
}
// os
enum Icon {
WARNING = "WARNING",
ERROR = "ERROR",
INFO = "INFO",
QUESTION = "QUESTION"
}
enum MessageBoxChoice {
OK = "OK",
OK_CANCEL = "OK_CANCEL",
YES_NO = "YES_NO",
YES_NO_CANCEL = "YES_NO_CANCEL",
RETRY_CANCEL = "RETRY_CANCEL",
ABORT_RETRY_IGNORE = "ABORT_RETRY_IGNORE"
}
//clipboard
enum ClipboardFormat {
unknown = 0,
text = 1,
image = 2
}
// NL_GLOBALS
enum Mode {
window = 0,
browser = 1,
cloud = 2,
chrome = 3
}
enum OperatingSystem {
Linux = 0,
Windows = 1,
Darwin = 2,
FreeBSD = 3,
Unknown = 4
}
enum Architecture {
x64 = 0,
arm = 1,
itanium = 2,
ia32 = 3,
unknown = 4
}
function getFormat(): Promise<ClipboardFormat>;
function readText(): Promise<string>;
function readImage(): Promise<ClipboardImage | null>;
function writeText(data: string): Promise<void>;
function writeImage(image: ClipboardImage): Promise<void>;
function clear(): Promise<void>;
}

@@ -346,2 +542,181 @@ declare namespace custom {

}
export { filesystem, os, computer, storage, debug, app, window, events, extensions, updater, clipboard, custom, init, Error, ErrorCode };
interface OpenActionOptions {
url: string;
}
interface RestartOptions {
args: string;
}
interface MemoryInfo {
physical: {
total: number;
available: number;
};
virtual: {
total: number;
available: number;
};
}
interface KernelInfo {
variant: string;
version: string;
}
interface OSInfo {
name: string;
description: string;
version: string;
}
interface CPUInfo {
vendor: string;
model: string;
frequency: number;
architecture: string;
logicalThreads: number;
physicalCores: number;
physicalUnits: number;
}
interface Display {
id: number;
resolution: Resolution;
dpi: number;
bpp: number;
refreshRate: number;
}
interface Resolution {
width: number;
height: number;
}
interface MousePosition {
x: number;
y: number;
}
interface ClipboardImage {
width: number;
height: number;
bpp: number;
bpr: number;
redMask: number;
greenMask: number;
blueMask: number;
redShift: number;
greenShift: number;
blueShift: number;
data: ArrayBuffer;
}
interface ExtensionStats {
loaded: string[];
connected: string[];
}
interface DirectoryEntry {
entry: string;
path: string;
type: string;
}
interface FileReaderOptions {
pos: number;
size: number;
}
interface DirectoryReaderOptions {
recursive: boolean;
}
interface OpenedFile {
id: number;
eof: boolean;
pos: number;
lastRead: number;
}
interface Stats {
size: number;
isFile: boolean;
isDirectory: boolean;
createdAt: number;
modifiedAt: number;
}
interface Watcher {
id: number;
path: string;
}
interface ExecCommandOptions {
stdIn?: string;
background?: boolean;
cwd?: string;
}
interface ExecCommandResult {
pid: number;
stdOut: string;
stdErr: string;
exitCode: number;
}
interface SpawnedProcess {
id: number;
pid: number;
}
interface Envs {
[key: string]: string;
}
interface OpenDialogOptions {
multiSelections?: boolean;
filters?: Filter[];
defaultPath?: string;
}
interface FolderDialogOptions {
defaultPath?: string;
}
interface SaveDialogOptions {
forceOverwrite?: boolean;
filters?: Filter[];
defaultPath?: string;
}
interface Filter {
name: string;
extensions: string[];
}
interface TrayOptions {
icon: string;
menuItems: TrayMenuItem[];
}
interface TrayMenuItem {
id?: string;
text: string;
isDisabled?: boolean;
isChecked?: boolean;
}
type KnownPath = "config" | "data" | "cache" | "documents" | "pictures" | "music" | "video" | "downloads" | "savedGames1" | "savedGames2";
interface Manifest {
applicationId: string;
version: string;
resourcesURL: string;
}
interface WindowOptions extends WindowSizeOptions, WindowPosOptions {
title?: string;
icon?: string;
fullScreen?: boolean;
alwaysOnTop?: boolean;
enableInspector?: boolean;
borderless?: boolean;
maximize?: boolean;
hidden?: boolean;
maximizable?: boolean;
useSavedState?: boolean;
exitProcessOnClose?: boolean;
extendUserAgentWith?: string;
processArgs?: string;
}
interface WindowSizeOptions {
width?: number;
height?: number;
minWidth?: number;
minHeight?: number;
maxWidth?: number;
maxHeight?: number;
resizable?: boolean;
}
interface WindowPosOptions {
x: number;
y: number;
}
interface Response {
success: boolean;
message: string;
}
type Builtin = "ready" | "trayMenuItemClicked" | "windowClose" | "serverOffline" | "clientConnect" | "clientDisconnect" | "appClientConnect" | "appClientDisconnect" | "extClientConnect" | "extClientDisconnect" | "extensionReady" | "neuDev_reloadApp";
export { filesystem, os, computer, storage, debug, app, window, events, extensions, updater, clipboard, custom, init, ErrorCode, Error, OpenActionOptions, RestartOptions, MemoryInfo, KernelInfo, OSInfo, CPUInfo, Display, Resolution, MousePosition, ClipboardImage, ExtensionStats, DirectoryEntry, FileReaderOptions, DirectoryReaderOptions, OpenedFile, Stats, Watcher, InitOptions, ExecCommandOptions, ExecCommandResult, SpawnedProcess, Envs, OpenDialogOptions, FolderDialogOptions, SaveDialogOptions, Filter, TrayOptions, TrayMenuItem, KnownPath, Manifest, WindowOptions, WindowSizeOptions, WindowPosOptions, LoggerType, Icon, MessageBoxChoice, ClipboardFormat, Mode, OperatingSystem, Architecture, Response, Builtin };

2

dist/index.js

@@ -1,1 +0,1 @@

"use strict";function e(e,t,n,o){return new(n||(n=Promise))((function(r,i){function s(e){try{c(o.next(e))}catch(e){i(e)}}function a(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?r(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 l("extensions.getStats")}Object.defineProperty(exports,"__esModule",{value:!0});var n=Object.freeze({__proto__:null,dispatch:function(n,o,r){return new Promise(((i,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 l("extensions.dispatch",{extensionId:n,event:o,data:r});i(e)}catch(e){s(e)}else!function(e,t){e in u?u[e].push(t):u[e]=[t]}(n,{method:"extensions.dispatch",data:{extensionId:n,event:o,data:r},resolve:i,reject:s});else s({code:"NE_EX_EXTNOTL",message:`${n} is not loaded`})}))))},broadcast:function(e,t){return l("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 r(e,t){let n=new CustomEvent(e,{detail:t});return window.dispatchEvent(n),Promise.resolve({success:!0,message:"Message dispatched"})}function i(e){let t=window.atob(e),n=t.length,o=new Uint8Array(n);for(let e=0;e<n;e++)o[e]=t.charCodeAt(e);return o.buffer}let s,a={},c=[],u={};function d(){window.NL_TOKEN&&sessionStorage.setItem("NL_TOKEN",window.NL_TOKEN);const n=p().split(".")[1];s=new WebSocket(`ws://${window.location.hostname}:${window.NL_PORT}?connectToken=${n}`),function(){if(o("ready",(()=>e(this,void 0,void 0,(function*(){if(yield f(c),!window.NL_EXTENABLED)return;let e=yield t();for(let t of e.connected)r("extensionReady",t)})))),o("extClientConnect",(e=>{r("extensionReady",e.detail)})),!window.NL_EXTENABLED)return;o("extensionReady",(t=>e(this,void 0,void 0,(function*(){t.detail in u&&(yield f(u[t.detail]),delete u[t.detail])}))))}(),function(){s.addEventListener("message",(e=>{var t,n,o;const c=JSON.parse(e.data);c.id&&c.id in a?((null===(t=c.data)||void 0===t?void 0:t.error)?(a[c.id].reject(c.data.error),"NE_RT_INVTOKN"==c.data.error.code&&(s.close(),document.body.innerText="",document.write("<code>NE_RT_INVTOKN</code>: Neutralinojs application cannot execute native methods since <code>NL_TOKEN</code> is invalid."))):(null===(n=c.data)||void 0===n?void 0:n.success)&&a[c.id].resolve(c.data.hasOwnProperty("returnValue")?c.data.returnValue:c.data),delete a[c.id]):c.event&&("openedFile"==c.event&&"dataBinary"==(null===(o=null==c?void 0:c.data)||void 0===o?void 0:o.action)&&(c.data.data=i(c.data.data)),r(c.event,c.data))})),s.addEventListener("open",(t=>e(this,void 0,void 0,(function*(){r("ready")})))),s.addEventListener("close",(t=>e(this,void 0,void 0,(function*(){r("serverOffline",{code:"NE_CL_NSEROFF",message:"Neutralino server is offline. Try restarting the application"})})))),s.addEventListener("error",(t=>e(this,void 0,void 0,(function*(){document.body.innerText="",document.write("<code>NE_CL_IVCTOKN</code>: Neutralinojs application cannot connect with the framework core using <code>NL_TOKEN</code>.")}))))}()}function l(e,t){return new Promise(((n,o)=>{if((null==s?void 0:s.readyState)!=WebSocket.OPEN)return r={method:e,data:t,resolve:n,reject:o},void c.push(r);var r;const i="10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))),u=p();a[i]={resolve:n,reject:o},s.send(JSON.stringify({id:i,method:e,data:t,accessToken:u}))}))}function f(t){return e(this,void 0,void 0,(function*(){for(;t.length>0;){let e=t.shift();try{let t=yield l(e.method,e.data);e.resolve(t)}catch(t){e.reject(t)}}}))}function p(){return window.NL_TOKEN||sessionStorage.getItem("NL_TOKEN")||""}function w(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 m,v,_=Object.freeze({__proto__:null,createDirectory:function(e){return l("filesystem.createDirectory",{path:e})},remove:function(e){return l("filesystem.remove",{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:w,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=>{n(i(e))})).catch((e=>{o(e)}))}))},openFile:function(e){return l("filesystem.openFile",{path:e})},createWatcher:function(e){return l("filesystem.createWatcher",{path:e})},removeWatcher:function(e){return l("filesystem.removeWatcher",{id:e})},getWatchers:function(){return l("filesystem.getWatchers")},updateOpenedFile:function(e,t,n){return l("filesystem.updateOpenedFile",{id:e,event:t,data:n})},getOpenedFileInfo:function(e){return l("filesystem.getOpenedFileInfo",{id:e})},readDirectory:function(e,t){return l("filesystem.readDirectory",Object.assign({path:e},t))},copy:function(e,t){return l("filesystem.copy",{source:e,destination:t})},move:function(e,t){return l("filesystem.move",{source:e,destination:t})},getStats:function(e){return l("filesystem.getStats",{path:e})}});function h(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"}(m||(m={})),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"}(v||(v={}));var O=Object.freeze({__proto__:null,get Icon(){return m},get MessageBoxChoice(){return v},execCommand:h,spawnProcess:function(e,t){return l("os.spawnProcess",{command:e,cwd:t})},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=Object.freeze({__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=Object.freeze({__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 b(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=Object.freeze({__proto__:null,get LoggerType(){return N},log:b});function T(e){return l("app.exit",{code:e})}var P=Object.freeze({__proto__:null,exit:T,killProcess:function(){return l("app.killProcess")},restartProcess:function(t){return new Promise((n=>e(this,void 0,void 0,(function*(){let e=window.NL_ARGS.reduce(((e,t)=>(t.includes(" ")&&(t=`"${t}"`),e+=" "+t)),"");(null==t?void 0:t.args)&&(e+=" "+t.args),yield h(e,{background:!0}),T(),n()}))))},getConfig:function(){return l("app.getConfig")},broadcast:function(e,t){return l("app.broadcast",{event:e,data:t})},readProcessInput:function(e){return l("app.readProcessInput",{readAll:e})},writeProcessOutput:function(e){return l("app.writeProcessOutput",{data:e})},writeProcessError:function(e){return l("app.writeProcessError",{data:e})}});const x=new WeakMap;function L(e,t){return l("window.move",{x:e,y:t})}function S(){return l("window.getSize")}var I=Object.freeze({__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:L,center:function(){return l("window.center")},setDraggableRegion:function(t){return new Promise(((n,o)=>{const r=t instanceof Element?t:document.getElementById(t);let i=0,s=0,a=0,c=!1,u=performance.now();if(!r)return o({code:"NE_WD_DOMNOTF",message:"Unable to find DOM element"});if(x.has(r))return o({code:"NE_WD_ALRDREL",message:"This DOM element is already an active draggable region"});function d(t){return e(this,void 0,void 0,(function*(){if(c){const e=performance.now(),n=e-u;if(n<5)return;return u=e-(n-5),void(yield L(t.screenX-i,t.screenY-s))}a=Math.sqrt(t.movementX*t.movementX+t.movementY*t.movementY),a>=10&&(c=!0,r.setPointerCapture(t.pointerId))}))}function l(e){0===e.button&&(i=e.clientX,s=e.clientY,r.addEventListener("pointermove",d))}function f(e){r.removeEventListener("pointermove",d),r.releasePointerCapture(e.pointerId)}r.addEventListener("pointerdown",l),r.addEventListener("pointerup",f),x.set(r,{pointerdown:l,pointerup:f}),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:r,pointerup:i}=x.get(o);o.removeEventListener("pointerdown",r),o.removeEventListener("pointerup",i),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 S();l("window.setSize",t=Object.assign(Object.assign({},e),t)).then((e=>{n(e)})).catch((e=>{o(e)}))}))))},getSize:S,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 r(e){return"string"!=typeof e||(e=e.trim()).includes(" ")&&(e=`"${e}"`),e}t=Object.assign(Object.assign({},t),{useSavedState:!1});let i=window.NL_ARGS.reduce(((e,t,n)=>((t.includes("--path=")||t.includes("--debug-mode")||t.includes("--load-dir-res")||0==n)&&(e+=" "+r(t)),e)),"");i+=" --url="+r(e);for(let e in t){if("processArgs"==e)continue;i+=` --window${e.replace(/[A-Z]|^[a-z]/g,(e=>"-"+e.toLowerCase()))}=${r(t[e])}`}t&&t.processArgs&&(i+=" "+t.processArgs),h(i,{background:!0}).then((e=>{n(e)})).catch((e=>{o(e)}))}))}});var D=Object.freeze({__proto__:null,broadcast:function(e,t){return l("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:r});let C=null;var j=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);C=JSON.parse(yield e.text()),!function(e){return!!(e.applicationId&&e.applicationId==window.NL_APPID&&e.version&&e.resourcesURL)}(C)?o({code:"NE_UP_CUPDMER",message:"Invalid update manifest or mismatching applicationId"}):n(C)}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(!C)return n({code:"NE_UP_UPDNOUF",message:"No update manifest loaded"});try{let e=yield fetch(C.resourcesURL),n=yield e.arrayBuffer();yield w(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 A=Object.freeze({__proto__:null,readText:function(e,t){return l("clipboard.readText",{key:e,data:t})},writeText:function(e){return l("clipboard.writeText",{data:e})}});var F=Object.freeze({__proto__:null,getMethods:function(){return l("custom.getMethods")}});let M=!1;exports.app=P,exports.clipboard=A,exports.computer=y,exports.custom=F,exports.debug=R,exports.events=D,exports.extensions=n,exports.filesystem=_,exports.init=function(t={}){if(t=Object.assign({exportCustomMethods:!0},t),!M){if(d(),window.NL_ARGS.find((e=>"--neu-dev-auto-reload"==e))&&o("neuDev_reloadApp",(()=>e(this,void 0,void 0,(function*(){yield b("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 l("custom."+e,n)};window.NL_CVERSION="5.0.1",window.NL_CCOMMIT="8f0ed4cf6418bf0980a76e63d7b7813de112d16b",M=!0}},exports.os=O,exports.storage=E,exports.updater=j,exports.window=I;
"use strict";function e(e,t,n,o){return new(n||(n=Promise))((function(r,i){function s(e){try{c(o.next(e))}catch(e){i(e)}}function a(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?r(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 f("extensions.getStats")}"function"==typeof SuppressedError&&SuppressedError;var n=Object.freeze({__proto__:null,broadcast:function(e,t){return f("extensions.broadcast",{event:e,data:t})},dispatch:function(n,o,r){return new Promise(((i,s)=>e(this,void 0,void 0,(function*(){const e=yield t();if(e.loaded.includes(n))if(e.connected.includes(n))try{const e=yield f("extensions.dispatch",{extensionId:n,event:o,data:r});i(e)}catch(e){s(e)}else!function(e,t){e in d?d[e].push(t):d[e]=[t]}(n,{method:"extensions.dispatch",data:{extensionId:n,event:o,data:r},resolve:i,reject:s});else s({code:"NE_EX_EXTNOTL",message:`${n} is not loaded`})}))))},getStats:t});function o(e,t){return window.addEventListener(e,t),Promise.resolve({success:!0,message:"Event listener added"})}function r(e,t){const n=new CustomEvent(e,{detail:t});return window.dispatchEvent(n),Promise.resolve({success:!0,message:"Message dispatched"})}function i(e){const t=window.atob(e),n=t.length,o=new Uint8Array(n);for(let e=0;e<n;e++)o[e]=t.charCodeAt(e);return o.buffer}function s(e){let t=new Uint8Array(e),n="";for(let e of t)n+=String.fromCharCode(e);return window.btoa(n)}let a;const c={},u=[],d={};function l(){window.NL_TOKEN&&sessionStorage.setItem("NL_TOKEN",window.NL_TOKEN);const n=m().split(".")[1];a=new WebSocket(`ws://${window.location.hostname}:${window.NL_PORT}?connectToken=${n}`),function(){if(o("ready",(()=>e(this,void 0,void 0,(function*(){if(yield p(u),!window.NL_EXTENABLED)return;const e=yield t();for(const t of e.connected)r("extensionReady",t)})))),o("extClientConnect",(e=>{r("extensionReady",e.detail)})),!window.NL_EXTENABLED)return;o("extensionReady",(t=>e(this,void 0,void 0,(function*(){t.detail in d&&(yield p(d[t.detail]),delete d[t.detail])}))))}(),function(){a.addEventListener("message",(e=>{var t,n,o;const s=JSON.parse(e.data);s.id&&s.id in c?((null===(t=s.data)||void 0===t?void 0:t.error)?(c[s.id].reject(s.data.error),"NE_RT_INVTOKN"==s.data.error.code&&(a.close(),document.body.innerText="",document.write("<code>NE_RT_INVTOKN</code>: Neutralinojs application cannot execute native methods since <code>NL_TOKEN</code> is invalid."))):(null===(n=s.data)||void 0===n?void 0:n.success)&&c[s.id].resolve(s.data.hasOwnProperty("returnValue")?s.data.returnValue:s.data),delete c[s.id]):s.event&&("openedFile"==s.event&&"dataBinary"==(null===(o=null==s?void 0:s.data)||void 0===o?void 0:o.action)&&(s.data.data=i(s.data.data)),r(s.event,s.data))})),a.addEventListener("open",(t=>e(this,void 0,void 0,(function*(){r("ready")})))),a.addEventListener("close",(t=>e(this,void 0,void 0,(function*(){r("serverOffline",{code:"NE_CL_NSEROFF",message:"Neutralino server is offline. Try restarting the application"})})))),a.addEventListener("error",(t=>e(this,void 0,void 0,(function*(){document.body.innerText="",document.write("<code>NE_CL_IVCTOKN</code>: Neutralinojs application cannot connect with the framework core using <code>NL_TOKEN</code>.")}))))}()}function f(e,t){return new Promise(((n,o)=>{if((null==a?void 0:a.readyState)!=WebSocket.OPEN)return r={method:e,data:t,resolve:n,reject:o},void u.push(r);var r;const i="10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))),s=m();c[i]={resolve:n,reject:o},a.send(JSON.stringify({id:i,method:e,data:t,accessToken:s}))}))}function p(t){return e(this,void 0,void 0,(function*(){for(;t.length>0;){const e=t.shift();try{const t=yield f(e.method,e.data);e.resolve(t)}catch(t){e.reject(t)}}}))}function m(){return window.NL_TOKEN||sessionStorage.getItem("NL_TOKEN")||""}function w(e,t){return f("filesystem.writeBinaryFile",{path:e,data:s(t)})}var g=Object.freeze({__proto__:null,appendBinaryFile:function(e,t){return f("filesystem.appendBinaryFile",{path:e,data:s(t)})},appendFile:function(e,t){return f("filesystem.appendFile",{path:e,data:t})},copy:function(e,t){return f("filesystem.copy",{source:e,destination:t})},createDirectory:function(e){return f("filesystem.createDirectory",{path:e})},createWatcher:function(e){return f("filesystem.createWatcher",{path:e})},getOpenedFileInfo:function(e){return f("filesystem.getOpenedFileInfo",{id:e})},getStats:function(e){return f("filesystem.getStats",{path:e})},getWatchers:function(){return f("filesystem.getWatchers")},move:function(e,t){return f("filesystem.move",{source:e,destination:t})},openFile:function(e){return f("filesystem.openFile",{path:e})},readBinaryFile:function(e,t){return new Promise(((n,o)=>{f("filesystem.readBinaryFile",Object.assign({path:e},t)).then((e=>{n(i(e))})).catch((e=>{o(e)}))}))},readDirectory:function(e,t){return f("filesystem.readDirectory",Object.assign({path:e},t))},readFile:function(e,t){return f("filesystem.readFile",Object.assign({path:e},t))},remove:function(e){return f("filesystem.remove",{path:e})},removeWatcher:function(e){return f("filesystem.removeWatcher",{id:e})},updateOpenedFile:function(e,t,n){return f("filesystem.updateOpenedFile",{id:e,event:t,data:n})},writeBinaryFile:w,writeFile:function(e,t){return f("filesystem.writeFile",{path:e,data:t})}});function v(e,t){return f("os.execCommand",Object.assign({command:e},t))}var h=Object.freeze({__proto__:null,execCommand:v,getEnv:function(e){return f("os.getEnv",{key:e})},getEnvs:function(){return f("os.getEnvs")},getPath:function(e){return f("os.getPath",{name:e})},getSpawnedProcesses:function(){return f("os.getSpawnedProcesses")},open:function(e){return f("os.open",{url:e})},setTray:function(e){return f("os.setTray",e)},showFolderDialog:function(e,t){return f("os.showFolderDialog",Object.assign({title:e},t))},showMessageBox:function(e,t,n,o){return f("os.showMessageBox",{title:e,content:t,choice:n,icon:o})},showNotification:function(e,t,n){return f("os.showNotification",{title:e,content:t,icon:n})},showOpenDialog:function(e,t){return f("os.showOpenDialog",Object.assign({title:e},t))},showSaveDialog:function(e,t){return f("os.showSaveDialog",Object.assign({title:e},t))},spawnProcess:function(e,t){return f("os.spawnProcess",{command:e,cwd:t})},updateSpawnedProcess:function(e,t,n){return f("os.updateSpawnedProcess",{id:e,event:t,data:n})}});var _=Object.freeze({__proto__:null,getArch:function(){return f("computer.getArch")},getCPUInfo:function(){return f("computer.getCPUInfo")},getDisplays:function(){return f("computer.getDisplays")},getKernelInfo:function(){return f("computer.getKernelInfo")},getMemoryInfo:function(){return f("computer.getMemoryInfo")},getMousePosition:function(){return f("computer.getMousePosition")},getOSInfo:function(){return f("computer.getOSInfo")}});var y=Object.freeze({__proto__:null,getData:function(e){return f("storage.getData",{key:e})},getKeys:function(){return f("storage.getKeys")},setData:function(e,t){return f("storage.setData",{key:e,data:t})}});function O(e,t){return f("debug.log",{message:e,type:t})}var E=Object.freeze({__proto__:null,log:O});function N(e){return f("app.exit",{code:e})}var b=Object.freeze({__proto__:null,broadcast:function(e,t){return f("app.broadcast",{event:e,data:t})},exit:N,getConfig:function(){return f("app.getConfig")},killProcess:function(){return f("app.killProcess")},readProcessInput:function(e){return f("app.readProcessInput",{readAll:e})},restartProcess:function(t){return new Promise((n=>e(this,void 0,void 0,(function*(){let e=window.NL_ARGS.reduce(((e,t)=>(t.includes(" ")&&(t=`"${t}"`),e+=" "+t)),"");(null==t?void 0:t.args)&&(e+=" "+t.args),yield v(e,{background:!0}),N(),n()}))))},writeProcessError:function(e){return f("app.writeProcessError",{data:e})},writeProcessOutput:function(e){return f("app.writeProcessOutput",{data:e})}});const P=new WeakMap;function x(e,t){return f("window.move",{x:e,y:t})}function T(){return f("window.getSize")}var S=Object.freeze({__proto__:null,center:function(){return f("window.center")},create:function(e,t){return new Promise(((n,o)=>{function r(e){return"string"!=typeof e||(e=e.trim()).includes(" ")&&(e=`"${e}"`),e}t=Object.assign(Object.assign({},t),{useSavedState:!1});let i=window.NL_ARGS.reduce(((e,t,n)=>((t.includes("--path=")||t.includes("--debug-mode")||t.includes("--load-dir-res")||0==n)&&(e+=" "+r(t)),e)),"");i+=" --url="+r(e);for(let e in t){if("processArgs"==e)continue;i+=` --window${e.replace(/[A-Z]|^[a-z]/g,(e=>"-"+e.toLowerCase()))}=${r(t[e])}`}t&&t.processArgs&&(i+=" "+t.processArgs),v(i,{background:!0}).then((e=>{n(e)})).catch((e=>{o(e)}))}))},exitFullScreen:function(){return f("window.exitFullScreen")},focus:function(){return f("window.focus")},getPosition:function(){return f("window.getPosition")},getSize:T,getTitle:function(){return f("window.getTitle")},hide:function(){return f("window.hide")},isFullScreen:function(){return f("window.isFullScreen")},isMaximized:function(){return f("window.isMaximized")},isVisible:function(){return f("window.isVisible")},maximize:function(){return f("window.maximize")},minimize:function(){return f("window.minimize")},move:x,setAlwaysOnTop:function(e){return f("window.setAlwaysOnTop",{onTop:e})},setDraggableRegion:function(t){return new Promise(((n,o)=>{const r=t instanceof Element?t:document.getElementById(t);let i=0,s=0,a=0,c=!1,u=performance.now();if(!r)return o({code:"NE_WD_DOMNOTF",message:"Unable to find DOM element"});if(P.has(r))return o({code:"NE_WD_ALRDREL",message:"This DOM element is already an active draggable region"});function d(t){return e(this,void 0,void 0,(function*(){if(c){const e=performance.now(),n=e-u;if(n<5)return;return u=e-(n-5),void(yield x(t.screenX-i,t.screenY-s))}a=Math.sqrt(t.movementX*t.movementX+t.movementY*t.movementY),a>=10&&(c=!0,r.setPointerCapture(t.pointerId))}))}function l(e){0===e.button&&(i=e.clientX,s=e.clientY,r.addEventListener("pointermove",d))}function f(e){r.removeEventListener("pointermove",d),r.releasePointerCapture(e.pointerId)}r.addEventListener("pointerdown",l),r.addEventListener("pointerup",f),P.set(r,{pointerdown:l,pointerup:f}),n({success:!0,message:"Draggable region was activated"})}))},setFullScreen:function(){return f("window.setFullScreen")},setIcon:function(e){return f("window.setIcon",{icon:e})},setSize:function(t){return new Promise(((n,o)=>e(this,void 0,void 0,(function*(){let e=yield T();f("window.setSize",t=Object.assign(Object.assign({},e),t)).then((e=>{n(e)})).catch((e=>{o(e)}))}))))},setTitle:function(e){return f("window.setTitle",{title:e})},show:function(){return f("window.show")},unmaximize:function(){return f("window.unmaximize")},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:r,pointerup:i}=P.get(o);o.removeEventListener("pointerdown",r),o.removeEventListener("pointerup",i),P.delete(o),t({success:!0,message:"Draggable region was deactivated"})}))}});var D=Object.freeze({__proto__:null,broadcast:function(e,t){return f("events.broadcast",{event:e,data:t})},dispatch:r,off:function(e,t){return window.removeEventListener(e,t),Promise.resolve({success:!0,message:"Event listener removed"})},on:o});let L=null;var j=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{const 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{const e=yield fetch(L.resourcesURL),n=yield e.arrayBuffer();yield w(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 I=Object.freeze({__proto__:null,clear:function(){return f("clipboard.clear")},getFormat:function(){return f("clipboard.getFormat")},readImage:function(){return new Promise(((e,t)=>{f("clipboard.readImage").then((t=>{t&&(t.data=i(t.data)),e(t)})).catch((e=>{t(e)}))}))},readText:function(){return f("clipboard.readText")},writeImage:function(e){const t=Object.assign({},e);return(null==e?void 0:e.data)&&(t.data=s(e.data)),f("clipboard.writeImage",t)},writeText:function(e){return f("clipboard.writeText",{data:e})}});var F=Object.freeze({__proto__:null,getMethods:function(){return f("custom.getMethods")}});let R=!1;exports.app=b,exports.clipboard=I,exports.computer=_,exports.custom=F,exports.debug=E,exports.events=D,exports.extensions=n,exports.filesystem=g,exports.init=function(t={}){if(t=Object.assign({exportCustomMethods:!0},t),!R){if(l(),window.NL_ARGS.find((e=>"--neu-dev-auto-reload"==e))&&o("neuDev_reloadApp",(()=>e(this,void 0,void 0,(function*(){yield O("Reloading the application..."),location.reload()})))),t.exportCustomMethods&&window.NL_CMETHODS&&window.NL_CMETHODS.length>0)for(const e of window.NL_CMETHODS)Neutralino.custom[e]=(...t)=>{let n={};for(const[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 f("custom."+e,n)};window.NL_CVERSION="5.1.0",window.NL_CCOMMIT="425c526c318342e0e5d0f17caceef2a53049eda4",R=!0}},exports.os=h,exports.storage=y,exports.updater=j,exports.window=S;

@@ -1,2 +0,2 @@

// Type definitions for Neutralino 5.0.1
// Type definitions for Neutralino 5.1.0
// Project: https://github.com/neutralinojs

@@ -57,2 +57,50 @@ // Definitions project: https://github.com/neutralinojs/neutralino.js

namespace os {
// debug
enum LoggerType {
WARNING = "WARNING",
ERROR = "ERROR",
INFO = "INFO"
}
// os
enum Icon {
WARNING = "WARNING",
ERROR = "ERROR",
INFO = "INFO",
QUESTION = "QUESTION"
}
enum MessageBoxChoice {
OK = "OK",
OK_CANCEL = "OK_CANCEL",
YES_NO = "YES_NO",
YES_NO_CANCEL = "YES_NO_CANCEL",
RETRY_CANCEL = "RETRY_CANCEL",
ABORT_RETRY_IGNORE = "ABORT_RETRY_IGNORE"
}
//clipboard
enum ClipboardFormat {
unknown = 0,
text = 1,
image = 2
}
// NL_GLOBALS
enum Mode {
window = 0,
browser = 1,
cloud = 2,
chrome = 3
}
enum OperatingSystem {
Linux = 0,
Windows = 1,
Darwin = 2,
FreeBSD = 3,
Unknown = 4
}
enum Architecture {
x64 = 0,
arm = 1,
itanium = 2,
ia32 = 3,
unknown = 4
}
interface ExecCommandOptions {

@@ -103,16 +151,2 @@ stdIn?: string;

}
enum Icon {
WARNING = "WARNING",
ERROR = "ERROR",
INFO = "INFO",
QUESTION = "QUESTION"
}
enum MessageBoxChoice {
OK = "OK",
OK_CANCEL = "OK_CANCEL",
YES_NO = "YES_NO",
YES_NO_CANCEL = "YES_NO_CANCEL",
RETRY_CANCEL = "RETRY_CANCEL",
ABORT_RETRY_IGNORE = "ABORT_RETRY_IGNORE"
}
type KnownPath = "config" | "data" | "cache" | "documents" | "pictures" | "music" | "video" | "downloads" | "savedGames1" | "savedGames2";

@@ -136,4 +170,10 @@ function execCommand(command: string, options?: ExecCommandOptions): Promise<ExecCommandResult>;

interface MemoryInfo {
total: number;
available: number;
physical: {
total: number;
available: number;
};
virtual: {
total: number;
available: number;
};
}

@@ -187,2 +227,3 @@ interface KernelInfo {

namespace debug {
// debug
enum LoggerType {

@@ -193,2 +234,44 @@ WARNING = "WARNING",

}
// os
enum Icon {
WARNING = "WARNING",
ERROR = "ERROR",
INFO = "INFO",
QUESTION = "QUESTION"
}
enum MessageBoxChoice {
OK = "OK",
OK_CANCEL = "OK_CANCEL",
YES_NO = "YES_NO",
YES_NO_CANCEL = "YES_NO_CANCEL",
RETRY_CANCEL = "RETRY_CANCEL",
ABORT_RETRY_IGNORE = "ABORT_RETRY_IGNORE"
}
//clipboard
enum ClipboardFormat {
unknown = 0,
text = 1,
image = 2
}
// NL_GLOBALS
enum Mode {
window = 0,
browser = 1,
cloud = 2,
chrome = 3
}
enum OperatingSystem {
Linux = 0,
Windows = 1,
Darwin = 2,
FreeBSD = 3,
Unknown = 4
}
enum Architecture {
x64 = 0,
arm = 1,
itanium = 2,
ia32 = 3,
unknown = 4
}
function log(message: string, type?: LoggerType): Promise<void>;

@@ -295,4 +378,69 @@ }

namespace clipboard {
function readText(key: string, data: string): Promise<void>;
function writeText(data: string): Promise<string>;
interface ClipboardImage {
width: number;
height: number;
bpp: number;
bpr: number;
redMask: number;
greenMask: number;
blueMask: number;
redShift: number;
greenShift: number;
blueShift: number;
data: ArrayBuffer;
}
// debug
enum LoggerType {
WARNING = "WARNING",
ERROR = "ERROR",
INFO = "INFO"
}
// os
enum Icon {
WARNING = "WARNING",
ERROR = "ERROR",
INFO = "INFO",
QUESTION = "QUESTION"
}
enum MessageBoxChoice {
OK = "OK",
OK_CANCEL = "OK_CANCEL",
YES_NO = "YES_NO",
YES_NO_CANCEL = "YES_NO_CANCEL",
RETRY_CANCEL = "RETRY_CANCEL",
ABORT_RETRY_IGNORE = "ABORT_RETRY_IGNORE"
}
//clipboard
enum ClipboardFormat {
unknown = 0,
text = 1,
image = 2
}
// NL_GLOBALS
enum Mode {
window = 0,
browser = 1,
cloud = 2,
chrome = 3
}
enum OperatingSystem {
Linux = 0,
Windows = 1,
Darwin = 2,
FreeBSD = 3,
Unknown = 4
}
enum Architecture {
x64 = 0,
arm = 1,
itanium = 2,
ia32 = 3,
unknown = 4
}
function getFormat(): Promise<ClipboardFormat>;
function readText(): Promise<string>;
function readImage(): Promise<ClipboardImage | null>;
function writeText(data: string): Promise<void>;
function writeImage(image: ClipboardImage): Promise<void>;
function clear(): Promise<void>;
}

@@ -311,8 +459,263 @@ namespace custom {

}
interface OpenActionOptions {
url: string;
}
interface RestartOptions {
args: string;
}
interface MemoryInfo {
physical: {
total: number;
available: number;
};
virtual: {
total: number;
available: number;
};
}
interface KernelInfo {
variant: string;
version: string;
}
interface OSInfo {
name: string;
description: string;
version: string;
}
interface CPUInfo {
vendor: string;
model: string;
frequency: number;
architecture: string;
logicalThreads: number;
physicalCores: number;
physicalUnits: number;
}
interface Display {
id: number;
resolution: Resolution;
dpi: number;
bpp: number;
refreshRate: number;
}
interface Resolution {
width: number;
height: number;
}
interface MousePosition {
x: number;
y: number;
}
interface ClipboardImage {
width: number;
height: number;
bpp: number;
bpr: number;
redMask: number;
greenMask: number;
blueMask: number;
redShift: number;
greenShift: number;
blueShift: number;
data: ArrayBuffer;
}
interface ExtensionStats {
loaded: string[];
connected: string[];
}
interface DirectoryEntry {
entry: string;
path: string;
type: string;
}
interface FileReaderOptions {
pos: number;
size: number;
}
interface DirectoryReaderOptions {
recursive: boolean;
}
interface OpenedFile {
id: number;
eof: boolean;
pos: number;
lastRead: number;
}
interface Stats {
size: number;
isFile: boolean;
isDirectory: boolean;
createdAt: number;
modifiedAt: number;
}
interface Watcher {
id: number;
path: string;
}
interface ExecCommandOptions {
stdIn?: string;
background?: boolean;
cwd?: string;
}
interface ExecCommandResult {
pid: number;
stdOut: string;
stdErr: string;
exitCode: number;
}
interface SpawnedProcess {
id: number;
pid: number;
}
interface Envs {
[key: string]: string;
}
interface OpenDialogOptions {
multiSelections?: boolean;
filters?: Filter[];
defaultPath?: string;
}
interface FolderDialogOptions {
defaultPath?: string;
}
interface SaveDialogOptions {
forceOverwrite?: boolean;
filters?: Filter[];
defaultPath?: string;
}
interface Filter {
name: string;
extensions: string[];
}
interface TrayOptions {
icon: string;
menuItems: TrayMenuItem[];
}
interface TrayMenuItem {
id?: string;
text: string;
isDisabled?: boolean;
isChecked?: boolean;
}
type KnownPath = "config" | "data" | "cache" | "documents" | "pictures" | "music" | "video" | "downloads" | "savedGames1" | "savedGames2";
interface Manifest {
applicationId: string;
version: string;
resourcesURL: string;
}
interface WindowOptions extends WindowSizeOptions, WindowPosOptions {
title?: string;
icon?: string;
fullScreen?: boolean;
alwaysOnTop?: boolean;
enableInspector?: boolean;
borderless?: boolean;
maximize?: boolean;
hidden?: boolean;
maximizable?: boolean;
useSavedState?: boolean;
exitProcessOnClose?: boolean;
extendUserAgentWith?: string;
processArgs?: string;
}
interface WindowSizeOptions {
width?: number;
height?: number;
minWidth?: number;
minHeight?: number;
maxWidth?: number;
maxHeight?: number;
resizable?: boolean;
}
interface WindowPosOptions {
x: number;
y: number;
}
interface Response {
success: boolean;
message: string;
}
type Builtin = "ready" | "trayMenuItemClicked" | "windowClose" | "serverOffline" | "clientConnect" | "clientDisconnect" | "appClientConnect" | "appClientDisconnect" | "extClientConnect" | "extClientDisconnect" | "extensionReady" | "neuDev_reloadApp";
}
// debug
export enum LoggerType {
WARNING = 'WARNING',
ERROR = 'ERROR',
INFO = 'INFO'
}
// os
export enum Icon {
WARNING = 'WARNING',
ERROR = 'ERROR',
INFO = 'INFO',
QUESTION = 'QUESTION'
}
export enum MessageBoxChoice {
OK = 'OK',
OK_CANCEL = 'OK_CANCEL',
YES_NO = 'YES_NO',
YES_NO_CANCEL = 'YES_NO_CANCEL',
RETRY_CANCEL = 'RETRY_CANCEL',
ABORT_RETRY_IGNORE = 'ABORT_RETRY_IGNORE'
}
//clipboard
export enum ClipboardFormat {
unknown,
text,
image
}
// NL_GLOBALS
export enum Mode {
window,
browser,
cloud,
chrome
}
export enum OperatingSystem {
Linux,
Windows,
Darwin,
FreeBSD,
Unknown
}
export enum Architecture {
x64,
arm,
itanium,
ia32,
unknown
}
export interface Response {
success: boolean;
message: string;
}
export type Builtin =
'ready' |
'trayMenuItemClicked' |
'windowClose' |
'serverOffline' |
'clientConnect' |
'clientDisconnect' |
'appClientConnect' |
'appClientDisconnect' |
'extClientConnect' |
'extClientDisconnect' |
'extensionReady' |
'neuDev_reloadApp'
// --- globals ---
/** Mode of the application: window, browser, cloud, or chrome */
declare const NL_MODE: string;
declare const NL_MODE: Mode;
/** Application port */

@@ -335,5 +738,5 @@ declare const NL_PORT: number;

/** Operating system name: Linux, Windows, Darwin, FreeBSD, or Uknown */
declare const NL_OS: string;
declare const NL_OS: OperatingSystem;
/** CPU architecture: x64, arm, itanium, ia32, or unknown */
declare const NL_ARCH: string;
declare const NL_ARCH: Architecture;
/** Neutralinojs server version */

@@ -340,0 +743,0 @@ declare const NL_VERSION: string;

@@ -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{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 n(){return f("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 f("extensions.dispatch",{extensionId:e,event:o,data:i});r(t)}catch(e){s(e)}else!function(e,t){e in d?d[e].push(t):d[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 f("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"})}function s(e){let t=window.atob(e),n=t.length,o=new Uint8Array(n);for(let e=0;e<n;e++)o[e]=t.charCodeAt(e);return o.buffer}let a,c={},u=[],d={};function l(){window.NL_TOKEN&&sessionStorage.setItem("NL_TOKEN",window.NL_TOKEN);const e=w().split(".")[1];a=new WebSocket(`ws://${window.location.hostname}:${window.NL_PORT}?connectToken=${e}`),function(){if(i("ready",(()=>t(this,void 0,void 0,(function*(){if(yield p(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 d&&(yield p(d[e.detail]),delete d[e.detail])}))))}(),function(){a.addEventListener("message",(e=>{var t,n,o;const i=JSON.parse(e.data);i.id&&i.id in c?((null===(t=i.data)||void 0===t?void 0:t.error)?(c[i.id].reject(i.data.error),"NE_RT_INVTOKN"==i.data.error.code&&(a.close(),document.body.innerText="",document.write("<code>NE_RT_INVTOKN</code>: Neutralinojs application cannot execute native methods since <code>NL_TOKEN</code> is invalid."))):(null===(n=i.data)||void 0===n?void 0:n.success)&&c[i.id].resolve(i.data.hasOwnProperty("returnValue")?i.data.returnValue:i.data),delete c[i.id]):i.event&&("openedFile"==i.event&&"dataBinary"==(null===(o=null==i?void 0:i.data)||void 0===o?void 0:o.action)&&(i.data.data=s(i.data.data)),r(i.event,i.data))})),a.addEventListener("open",(e=>t(this,void 0,void 0,(function*(){r("ready")})))),a.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"})})))),a.addEventListener("error",(e=>t(this,void 0,void 0,(function*(){document.body.innerText="",document.write("<code>NE_CL_IVCTOKN</code>: Neutralinojs application cannot connect with the framework core using <code>NL_TOKEN</code>.")}))))}()}function f(e,t){return new Promise(((n,o)=>{if((null==a?void 0:a.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))),s=w();c[r]={resolve:n,reject:o},a.send(JSON.stringify({id:r,method:e,data:t,accessToken:s}))}))}function p(e){return t(this,void 0,void 0,(function*(){for(;e.length>0;){let t=e.shift();try{let e=yield f(t.method,t.data);t.resolve(e)}catch(e){t.reject(e)}}}))}function w(){return window.NL_TOKEN||sessionStorage.getItem("NL_TOKEN")||""}function g(e,t){return f("filesystem.writeBinaryFile",{path:e,data:m(t)})}function m(e){let t=new Uint8Array(e),n="";for(let e of t)n+=String.fromCharCode(e);return window.btoa(n)}var v,_,h={__proto__:null,createDirectory:function(e){return f("filesystem.createDirectory",{path:e})},remove:function(e){return f("filesystem.remove",{path:e})},writeFile:function(e,t){return f("filesystem.writeFile",{path:e,data:t})},appendFile:function(e,t){return f("filesystem.appendFile",{path:e,data:t})},writeBinaryFile:g,appendBinaryFile:function(e,t){return f("filesystem.appendBinaryFile",{path:e,data:m(t)})},readFile:function(e,t){return f("filesystem.readFile",Object.assign({path:e},t))},readBinaryFile:function(e,t){return new Promise(((n,o)=>{f("filesystem.readBinaryFile",Object.assign({path:e},t)).then((e=>{n(s(e))})).catch((e=>{o(e)}))}))},openFile:function(e){return f("filesystem.openFile",{path:e})},createWatcher:function(e){return f("filesystem.createWatcher",{path:e})},removeWatcher:function(e){return f("filesystem.removeWatcher",{id:e})},getWatchers:function(){return f("filesystem.getWatchers")},updateOpenedFile:function(e,t,n){return f("filesystem.updateOpenedFile",{id:e,event:t,data:n})},getOpenedFileInfo:function(e){return f("filesystem.getOpenedFileInfo",{id:e})},readDirectory:function(e,t){return f("filesystem.readDirectory",Object.assign({path:e},t))},copy:function(e,t){return f("filesystem.copy",{source:e,destination:t})},move:function(e,t){return f("filesystem.move",{source:e,destination:t})},getStats:function(e){return f("filesystem.getStats",{path:e})}};function N(e,t){return f("os.execCommand",Object.assign({command:e},t))}!function(e){e.WARNING="WARNING",e.ERROR="ERROR",e.INFO="INFO",e.QUESTION="QUESTION"}(v||(v={})),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"}(_||(_={}));var y={__proto__:null,get Icon(){return v},get MessageBoxChoice(){return _},execCommand:N,spawnProcess:function(e,t){return f("os.spawnProcess",{command:e,cwd:t})},updateSpawnedProcess:function(e,t,n){return f("os.updateSpawnedProcess",{id:e,event:t,data:n})},getSpawnedProcesses:function(){return f("os.getSpawnedProcesses")},getEnv:function(e){return f("os.getEnv",{key:e})},getEnvs:function(){return f("os.getEnvs")},showOpenDialog:function(e,t){return f("os.showOpenDialog",Object.assign({title:e},t))},showFolderDialog:function(e,t){return f("os.showFolderDialog",Object.assign({title:e},t))},showSaveDialog:function(e,t){return f("os.showSaveDialog",Object.assign({title:e},t))},showNotification:function(e,t,n){return f("os.showNotification",{title:e,content:t,icon:n})},showMessageBox:function(e,t,n,o){return f("os.showMessageBox",{title:e,content:t,choice:n,icon:o})},setTray:function(e){return f("os.setTray",e)},open:function(e){return f("os.open",{url:e})},getPath:function(e){return f("os.getPath",{name:e})}};var E={__proto__:null,getMemoryInfo:function(){return f("computer.getMemoryInfo")},getArch:function(){return f("computer.getArch")},getKernelInfo:function(){return f("computer.getKernelInfo")},getOSInfo:function(){return f("computer.getOSInfo")},getCPUInfo:function(){return f("computer.getCPUInfo")},getDisplays:function(){return f("computer.getDisplays")},getMousePosition:function(){return f("computer.getMousePosition")}};var O,R={__proto__:null,setData:function(e,t){return f("storage.setData",{key:e,data:t})},getData:function(e){return f("storage.getData",{key:e})},getKeys:function(){return f("storage.getKeys")}};function T(e,t){return f("debug.log",{message:e,type:t})}!function(e){e.WARNING="WARNING",e.ERROR="ERROR",e.INFO="INFO"}(O||(O={}));var b={__proto__:null,get LoggerType(){return O},log:T};function P(e){return f("app.exit",{code:e})}var L={__proto__:null,exit:P,killProcess:function(){return f("app.killProcess")},restartProcess:function(e){return new Promise((n=>t(this,void 0,void 0,(function*(){let t=window.NL_ARGS.reduce(((e,t)=>(t.includes(" ")&&(t=`"${t}"`),e+=" "+t)),"");(null==e?void 0:e.args)&&(t+=" "+e.args),yield N(t,{background:!0}),P(),n()}))))},getConfig:function(){return f("app.getConfig")},broadcast:function(e,t){return f("app.broadcast",{event:e,data:t})},readProcessInput:function(e){return f("app.readProcessInput",{readAll:e})},writeProcessOutput:function(e){return f("app.writeProcessOutput",{data:e})},writeProcessError:function(e){return f("app.writeProcessError",{data:e})}};const S=new WeakMap;function I(e,t){return f("window.move",{x:e,y:t})}function D(){return f("window.getSize")}var C={__proto__:null,setTitle:function(e){return f("window.setTitle",{title:e})},getTitle:function(){return f("window.getTitle")},maximize:function(){return f("window.maximize")},unmaximize:function(){return f("window.unmaximize")},isMaximized:function(){return f("window.isMaximized")},minimize:function(){return f("window.minimize")},setFullScreen:function(){return f("window.setFullScreen")},exitFullScreen:function(){return f("window.exitFullScreen")},isFullScreen:function(){return f("window.isFullScreen")},show:function(){return f("window.show")},hide:function(){return f("window.hide")},isVisible:function(){return f("window.isVisible")},focus:function(){return f("window.focus")},setIcon:function(e){return f("window.setIcon",{icon:e})},move:I,center:function(){return f("window.center")},setDraggableRegion:function(e){return new Promise(((n,o)=>{const i=e instanceof Element?e:document.getElementById(e);let r=0,s=0,a=0,c=!1,u=performance.now();if(!i)return o({code:"NE_WD_DOMNOTF",message:"Unable to find DOM element"});if(S.has(i))return o({code:"NE_WD_ALRDREL",message:"This DOM element is already an active draggable region"});function d(e){return t(this,void 0,void 0,(function*(){if(c){const t=performance.now(),n=t-u;if(n<5)return;return u=t-(n-5),void(yield I(e.screenX-r,e.screenY-s))}a=Math.sqrt(e.movementX*e.movementX+e.movementY*e.movementY),a>=10&&(c=!0,i.setPointerCapture(e.pointerId))}))}function l(e){0===e.button&&(r=e.clientX,s=e.clientY,i.addEventListener("pointermove",d))}function f(e){i.removeEventListener("pointermove",d),i.releasePointerCapture(e.pointerId)}i.addEventListener("pointerdown",l),i.addEventListener("pointerup",f),S.set(i,{pointerdown:l,pointerup:f}),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(!S.has(o))return n({code:"NE_WD_NOTDRRE",message:"DOM element is not an active draggable region"});const{pointerdown:i,pointerup:r}=S.get(o);o.removeEventListener("pointerdown",i),o.removeEventListener("pointerup",r),S.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();f("window.setSize",e=Object.assign(Object.assign({},t),e)).then((e=>{n(e)})).catch((e=>{o(e)}))}))))},getSize:D,getPosition:function(){return f("window.getPosition")},setAlwaysOnTop:function(e){return f("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}t=Object.assign(Object.assign({},t),{useSavedState:!1});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),N(r,{background:!0}).then((e=>{n(e)})).catch((e=>{o(e)}))}))}};var x={__proto__:null,broadcast:function(e,t){return f("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 A=null;var F={__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);A=JSON.parse(yield t.text()),!function(e){return!!(e.applicationId&&e.applicationId==window.NL_APPID&&e.version&&e.resourcesURL)}(A)?o({code:"NE_UP_CUPDMER",message:"Invalid update manifest or mismatching applicationId"}):n(A)}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(!A)return n({code:"NE_UP_UPDNOUF",message:"No update manifest loaded"});try{let t=yield fetch(A.resourcesURL),n=yield t.arrayBuffer();yield g(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 M={__proto__:null,readText:function(e,t){return f("clipboard.readText",{key:e,data:t})},writeText:function(e){return f("clipboard.writeText",{data:e})}};var j={__proto__:null,getMethods:function(){return f("custom.getMethods")}};let U=!1;return e.app=L,e.clipboard=M,e.computer=E,e.custom=j,e.debug=b,e.events=x,e.extensions=o,e.filesystem=h,e.init=function(e={}){if(e=Object.assign({exportCustomMethods:!0},e),!U){if(l(),window.NL_ARGS.find((e=>"--neu-dev-auto-reload"==e))&&i("neuDev_reloadApp",(()=>t(this,void 0,void 0,(function*(){yield T("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 f("custom."+e,n)};window.NL_CVERSION="5.0.1",window.NL_CCOMMIT="8f0ed4cf6418bf0980a76e63d7b7813de112d16b",U=!0}},e.os=y,e.storage=R,e.updater=F,e.window=C,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{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 n(){return p("extensions.getStats")}"function"==typeof SuppressedError&&SuppressedError;var o={__proto__:null,broadcast:function(e,t){return p("extensions.broadcast",{event:e,data:t})},dispatch:function(e,o,i){return new Promise(((r,s)=>t(this,void 0,void 0,(function*(){const t=yield n();if(t.loaded.includes(e))if(t.connected.includes(e))try{const t=yield p("extensions.dispatch",{extensionId:e,event:o,data:i});r(t)}catch(e){s(e)}else!function(e,t){e in l?l[e].push(t):l[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`})}))))},getStats:n};function i(e,t){return window.addEventListener(e,t),Promise.resolve({success:!0,message:"Event listener added"})}function r(e,t){const n=new CustomEvent(e,{detail:t});return window.dispatchEvent(n),Promise.resolve({success:!0,message:"Message dispatched"})}function s(e){const t=window.atob(e),n=t.length,o=new Uint8Array(n);for(let e=0;e<n;e++)o[e]=t.charCodeAt(e);return o.buffer}function a(e){let t=new Uint8Array(e),n="";for(let e of t)n+=String.fromCharCode(e);return window.btoa(n)}let c;const u={},d=[],l={};function f(){window.NL_TOKEN&&sessionStorage.setItem("NL_TOKEN",window.NL_TOKEN);const e=w().split(".")[1];c=new WebSocket(`ws://${window.location.hostname}:${window.NL_PORT}?connectToken=${e}`),function(){if(i("ready",(()=>t(this,void 0,void 0,(function*(){if(yield m(d),!window.NL_EXTENABLED)return;const e=yield n();for(const 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 l&&(yield m(l[e.detail]),delete l[e.detail])}))))}(),function(){c.addEventListener("message",(e=>{var t,n,o;const i=JSON.parse(e.data);i.id&&i.id in u?((null===(t=i.data)||void 0===t?void 0:t.error)?(u[i.id].reject(i.data.error),"NE_RT_INVTOKN"==i.data.error.code&&(c.close(),document.body.innerText="",document.write("<code>NE_RT_INVTOKN</code>: Neutralinojs application cannot execute native methods since <code>NL_TOKEN</code> is invalid."))):(null===(n=i.data)||void 0===n?void 0:n.success)&&u[i.id].resolve(i.data.hasOwnProperty("returnValue")?i.data.returnValue:i.data),delete u[i.id]):i.event&&("openedFile"==i.event&&"dataBinary"==(null===(o=null==i?void 0:i.data)||void 0===o?void 0:o.action)&&(i.data.data=s(i.data.data)),r(i.event,i.data))})),c.addEventListener("open",(e=>t(this,void 0,void 0,(function*(){r("ready")})))),c.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"})})))),c.addEventListener("error",(e=>t(this,void 0,void 0,(function*(){document.body.innerText="",document.write("<code>NE_CL_IVCTOKN</code>: Neutralinojs application cannot connect with the framework core using <code>NL_TOKEN</code>.")}))))}()}function p(e,t){return new Promise(((n,o)=>{if((null==c?void 0:c.readyState)!=WebSocket.OPEN)return i={method:e,data:t,resolve:n,reject:o},void d.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))),s=w();u[r]={resolve:n,reject:o},c.send(JSON.stringify({id:r,method:e,data:t,accessToken:s}))}))}function m(e){return t(this,void 0,void 0,(function*(){for(;e.length>0;){const t=e.shift();try{const e=yield p(t.method,t.data);t.resolve(e)}catch(e){t.reject(e)}}}))}function w(){return window.NL_TOKEN||sessionStorage.getItem("NL_TOKEN")||""}function g(e,t){return p("filesystem.writeBinaryFile",{path:e,data:a(t)})}var v={__proto__:null,appendBinaryFile:function(e,t){return p("filesystem.appendBinaryFile",{path:e,data:a(t)})},appendFile:function(e,t){return p("filesystem.appendFile",{path:e,data:t})},copy:function(e,t){return p("filesystem.copy",{source:e,destination:t})},createDirectory:function(e){return p("filesystem.createDirectory",{path:e})},createWatcher:function(e){return p("filesystem.createWatcher",{path:e})},getOpenedFileInfo:function(e){return p("filesystem.getOpenedFileInfo",{id:e})},getStats:function(e){return p("filesystem.getStats",{path:e})},getWatchers:function(){return p("filesystem.getWatchers")},move:function(e,t){return p("filesystem.move",{source:e,destination:t})},openFile:function(e){return p("filesystem.openFile",{path:e})},readBinaryFile:function(e,t){return new Promise(((n,o)=>{p("filesystem.readBinaryFile",Object.assign({path:e},t)).then((e=>{n(s(e))})).catch((e=>{o(e)}))}))},readDirectory:function(e,t){return p("filesystem.readDirectory",Object.assign({path:e},t))},readFile:function(e,t){return p("filesystem.readFile",Object.assign({path:e},t))},remove:function(e){return p("filesystem.remove",{path:e})},removeWatcher:function(e){return p("filesystem.removeWatcher",{id:e})},updateOpenedFile:function(e,t,n){return p("filesystem.updateOpenedFile",{id:e,event:t,data:n})},writeBinaryFile:g,writeFile:function(e,t){return p("filesystem.writeFile",{path:e,data:t})}};function h(e,t){return p("os.execCommand",Object.assign({command:e},t))}var _={__proto__:null,execCommand:h,getEnv:function(e){return p("os.getEnv",{key:e})},getEnvs:function(){return p("os.getEnvs")},getPath:function(e){return p("os.getPath",{name:e})},getSpawnedProcesses:function(){return p("os.getSpawnedProcesses")},open:function(e){return p("os.open",{url:e})},setTray:function(e){return p("os.setTray",e)},showFolderDialog:function(e,t){return p("os.showFolderDialog",Object.assign({title:e},t))},showMessageBox:function(e,t,n,o){return p("os.showMessageBox",{title:e,content:t,choice:n,icon:o})},showNotification:function(e,t,n){return p("os.showNotification",{title:e,content:t,icon:n})},showOpenDialog:function(e,t){return p("os.showOpenDialog",Object.assign({title:e},t))},showSaveDialog:function(e,t){return p("os.showSaveDialog",Object.assign({title:e},t))},spawnProcess:function(e,t){return p("os.spawnProcess",{command:e,cwd:t})},updateSpawnedProcess:function(e,t,n){return p("os.updateSpawnedProcess",{id:e,event:t,data:n})}};var y={__proto__:null,getArch:function(){return p("computer.getArch")},getCPUInfo:function(){return p("computer.getCPUInfo")},getDisplays:function(){return p("computer.getDisplays")},getKernelInfo:function(){return p("computer.getKernelInfo")},getMemoryInfo:function(){return p("computer.getMemoryInfo")},getMousePosition:function(){return p("computer.getMousePosition")},getOSInfo:function(){return p("computer.getOSInfo")}};var E={__proto__:null,getData:function(e){return p("storage.getData",{key:e})},getKeys:function(){return p("storage.getKeys")},setData:function(e,t){return p("storage.setData",{key:e,data:t})}};function N(e,t){return p("debug.log",{message:e,type:t})}var O={__proto__:null,log:N};function b(e){return p("app.exit",{code:e})}var P={__proto__:null,broadcast:function(e,t){return p("app.broadcast",{event:e,data:t})},exit:b,getConfig:function(){return p("app.getConfig")},killProcess:function(){return p("app.killProcess")},readProcessInput:function(e){return p("app.readProcessInput",{readAll:e})},restartProcess:function(e){return new Promise((n=>t(this,void 0,void 0,(function*(){let t=window.NL_ARGS.reduce(((e,t)=>(t.includes(" ")&&(t=`"${t}"`),e+=" "+t)),"");(null==e?void 0:e.args)&&(t+=" "+e.args),yield h(t,{background:!0}),b(),n()}))))},writeProcessError:function(e){return p("app.writeProcessError",{data:e})},writeProcessOutput:function(e){return p("app.writeProcessOutput",{data:e})}};const T=new WeakMap;function S(e,t){return p("window.move",{x:e,y:t})}function D(){return p("window.getSize")}var L={__proto__:null,center:function(){return p("window.center")},create:function(e,t){return new Promise(((n,o)=>{function i(e){return"string"!=typeof e||(e=e.trim()).includes(" ")&&(e=`"${e}"`),e}t=Object.assign(Object.assign({},t),{useSavedState:!1});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),h(r,{background:!0}).then((e=>{n(e)})).catch((e=>{o(e)}))}))},exitFullScreen:function(){return p("window.exitFullScreen")},focus:function(){return p("window.focus")},getPosition:function(){return p("window.getPosition")},getSize:D,getTitle:function(){return p("window.getTitle")},hide:function(){return p("window.hide")},isFullScreen:function(){return p("window.isFullScreen")},isMaximized:function(){return p("window.isMaximized")},isVisible:function(){return p("window.isVisible")},maximize:function(){return p("window.maximize")},minimize:function(){return p("window.minimize")},move:S,setAlwaysOnTop:function(e){return p("window.setAlwaysOnTop",{onTop:e})},setDraggableRegion:function(e){return new Promise(((n,o)=>{const i=e instanceof Element?e:document.getElementById(e);let r=0,s=0,a=0,c=!1,u=performance.now();if(!i)return o({code:"NE_WD_DOMNOTF",message:"Unable to find DOM element"});if(T.has(i))return o({code:"NE_WD_ALRDREL",message:"This DOM element is already an active draggable region"});function d(e){return t(this,void 0,void 0,(function*(){if(c){const t=performance.now(),n=t-u;if(n<5)return;return u=t-(n-5),void(yield S(e.screenX-r,e.screenY-s))}a=Math.sqrt(e.movementX*e.movementX+e.movementY*e.movementY),a>=10&&(c=!0,i.setPointerCapture(e.pointerId))}))}function l(e){0===e.button&&(r=e.clientX,s=e.clientY,i.addEventListener("pointermove",d))}function f(e){i.removeEventListener("pointermove",d),i.releasePointerCapture(e.pointerId)}i.addEventListener("pointerdown",l),i.addEventListener("pointerup",f),T.set(i,{pointerdown:l,pointerup:f}),n({success:!0,message:"Draggable region was activated"})}))},setFullScreen:function(){return p("window.setFullScreen")},setIcon:function(e){return p("window.setIcon",{icon:e})},setSize:function(e){return new Promise(((n,o)=>t(this,void 0,void 0,(function*(){let t=yield D();p("window.setSize",e=Object.assign(Object.assign({},t),e)).then((e=>{n(e)})).catch((e=>{o(e)}))}))))},setTitle:function(e){return p("window.setTitle",{title:e})},show:function(){return p("window.show")},unmaximize:function(){return p("window.unmaximize")},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(!T.has(o))return n({code:"NE_WD_NOTDRRE",message:"DOM element is not an active draggable region"});const{pointerdown:i,pointerup:r}=T.get(o);o.removeEventListener("pointerdown",i),o.removeEventListener("pointerup",r),T.delete(o),t({success:!0,message:"Draggable region was deactivated"})}))}};var x={__proto__:null,broadcast:function(e,t){return p("events.broadcast",{event:e,data:t})},dispatch:r,off:function(e,t){return window.removeEventListener(e,t),Promise.resolve({success:!0,message:"Event listener removed"})},on:i};let I=null;var F={__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{const t=yield fetch(e);I=JSON.parse(yield t.text()),!function(e){return!!(e.applicationId&&e.applicationId==window.NL_APPID&&e.version&&e.resourcesURL)}(I)?o({code:"NE_UP_CUPDMER",message:"Invalid update manifest or mismatching applicationId"}):n(I)}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(!I)return n({code:"NE_UP_UPDNOUF",message:"No update manifest loaded"});try{const t=yield fetch(I.resourcesURL),n=yield t.arrayBuffer();yield g(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 R={__proto__:null,clear:function(){return p("clipboard.clear")},getFormat:function(){return p("clipboard.getFormat")},readImage:function(){return new Promise(((e,t)=>{p("clipboard.readImage").then((t=>{t&&(t.data=s(t.data)),e(t)})).catch((e=>{t(e)}))}))},readText:function(){return p("clipboard.readText")},writeImage:function(e){const t=Object.assign({},e);return(null==e?void 0:e.data)&&(t.data=a(e.data)),p("clipboard.writeImage",t)},writeText:function(e){return p("clipboard.writeText",{data:e})}};var C={__proto__:null,getMethods:function(){return p("custom.getMethods")}};let M=!1;return e.app=P,e.clipboard=R,e.computer=y,e.custom=C,e.debug=O,e.events=x,e.extensions=o,e.filesystem=v,e.init=function(e={}){if(e=Object.assign({exportCustomMethods:!0},e),!M){if(f(),window.NL_ARGS.find((e=>"--neu-dev-auto-reload"==e))&&i("neuDev_reloadApp",(()=>t(this,void 0,void 0,(function*(){yield N("Reloading the application..."),location.reload()})))),e.exportCustomMethods&&window.NL_CMETHODS&&window.NL_CMETHODS.length>0)for(const e of window.NL_CMETHODS)Neutralino.custom[e]=(...t)=>{let n={};for(const[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 p("custom."+e,n)};window.NL_CVERSION="5.1.0",window.NL_CCOMMIT="425c526c318342e0e5d0f17caceef2a53049eda4",M=!0}},e.os=_,e.storage=E,e.updater=F,e.window=L,e}({});
{
"name": "@neutralinojs/lib",
"version": "5.0.1",
"version": "5.1.0",
"description": "JavaScript API for Neutralinojs",
"main": "./dist/index.js",
"type": "module",
"files": [

@@ -12,3 +13,5 @@ "dist"

"build": "node build.mjs",
"watch": "rollup -c -w"
"watch": "rollup -c -w",
"lint": "eslint --ignore-path .eslintignore --ext .js,.ts",
"format": "prettier --ignore-path .gitignore --write \"**/*.+(js|ts|json)\""
},

@@ -26,11 +29,16 @@ "repository": {

"devDependencies": {
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-json": "^6.1.0",
"@types/node": "^16.4.2",
"rollup": "^2.57.0",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"prettier": "^3.2.5",
"rollup": "^4.13.0",
"rollup-plugin-cleanup": "^3.2.1",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-ts": "^1.4.7",
"tslib": "^2.3.1",
"typescript": "^4.3.5"
"@rollup/plugin-terser": "^0.4.4",
"rollup-plugin-ts": "^3.4.5",
"tslib": "^2.6.2",
"typescript": "^5.4.2"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc