diff --git a/desktop/sources/index.html b/desktop/sources/index.html index d3a5353..955ce4b 100644 --- a/desktop/sources/index.html +++ b/desktop/sources/index.html @@ -45,6 +45,7 @@ ronin.controller.add("default","View","Zoom Out",() => { ronin.modZoom(-0.25) },"CmdOrCtrl+-") ronin.controller.add("default","View","Zoom Reset",() => { ronin.modZoom(1,true) },"CmdOrCtrl+0") ronin.controller.add("default","View","Toggle Commander",() => { ronin.commander.toggle(); },"CmdOrCtrl+K"); + ronin.controller.add("default","View","Expand Commander",() => { ronin.commander.toggle(true); },"CmdOrCtrl+Shift+K"); ronin.controller.add("default","Project","Run",() => { ronin.commander.run(); },"CmdOrCtrl+R"); ronin.controller.add("default","Project","Reload Run",() => { ronin.source.revert(); ronin.commander.run(); },"CmdOrCtrl+Shift+R"); ronin.controller.add("default","Project", "Animate",() => { ronin.animate(!ronin.always); },"CmdOrCtrl+Shift+T"); diff --git a/desktop/sources/links/main.css b/desktop/sources/links/main.css index 8abe5c2..4a9d7de 100644 --- a/desktop/sources/links/main.css +++ b/desktop/sources/links/main.css @@ -7,6 +7,7 @@ body { margin:0px; padding:0px; overflow:hidden; font-family:"input_mono_regular #ronin #wrapper #commander { z-index: 9000;position: relative;width: 310px;height: calc(100vh - 60px);-webkit-app-region: no-drag;padding-right: 30px;transition: margin-left 250ms;} #ronin #wrapper #commander textarea { background: none; width: 100%; height: calc(100vh - 105px); resize: none; font-size: 12px;line-height: 15px; padding-right: 15px} #ronin #wrapper #commander div#status { position: absolute; bottom: 0px; text-transform: lowercase;} +#ronin.expand #wrapper #commander { width:100%; } #ronin.hidden #wrapper #commander { margin-left:-331px; } #ronin canvas#surface,#ronin canvas#guide { position: absolute; top:0px; -webkit-user-select: none;-webkit-app-region: no-drag; background-image: url("data:image/svg+xml;utf8,"); background-size: 10px 10px; background-position: -4px -4px; width:100%; height:100%; left:340px; transition: left 250ms} diff --git a/desktop/sources/scripts/commander.js b/desktop/sources/scripts/commander.js index b7aae9b..5dbbbf7 100644 --- a/desktop/sources/scripts/commander.js +++ b/desktop/sources/scripts/commander.js @@ -188,9 +188,9 @@ function Commander (ronin) { // Display - this.show = function () { + this.show = function (expand = false) { if (this.isVisible === true) { return } - ronin.el.className = '' + ronin.el.className = expand ? 'expand' : '' this.isVisible = true } @@ -200,9 +200,9 @@ function Commander (ronin) { this.isVisible = false } - this.toggle = function () { + this.toggle = function (expand = false) { if (this.isVisible !== true) { - this.show() + this.show(expand) } else { this.hide() } diff --git a/desktop/sources/scripts/library.js b/desktop/sources/scripts/library.js index 7bd7b3e..f15c2bd 100644 --- a/desktop/sources/scripts/library.js +++ b/desktop/sources/scripts/library.js @@ -60,6 +60,12 @@ function Library (ronin) { return rect } + // Strings + + this.concat = function (...items) { + return items.reduce((acc, item) => { return `${acc}${item}` }, '') + } + // Math this.add = (...args) => { // Adds values. @@ -319,7 +325,17 @@ function Library (ronin) { return ronin.surface.open(path) } - this.folder = (path = ronin.source.path) => { // Returns the content of a folder path. + // File System + + this.path = (path = ronin.source.path) => { // Returns the content of a folder path. + return path + } + + this.folder = (path = this.path()) => { // Returns the path of the current folder. + return require('path').dirname(path) + } + + this.ls = (path = this.folder()) => { // Returns the content of a folder path. return fs.existsSync(path) ? fs.readdirSync(path) : [] } diff --git a/examples/animate.lisp b/examples/animate.lisp index ed3eadf..4adaf64 100644 --- a/examples/animate.lisp +++ b/examples/animate.lisp @@ -1,13 +1,17 @@ ; animate - ( - (clear) - (def t (sin (div (time) 100))) - - (def pos (add 200 30 (mul 30 t))) - (defn square (a) (rect a a a a)) - (stroke (square pos) 1 "red") - + (clear) + (def t + (sin + (div + (time) 100))) + (def pos + (add 200 30 + (mul 30 t))) + (defn square + (a) + (rect a a a a)) + (stroke + (square pos) 1 "red") ; set false to stop - (animate true) -) \ No newline at end of file + (animate true)) \ No newline at end of file diff --git a/examples/fs.lisp b/examples/fs.lisp new file mode 100644 index 0000000..0c624bb --- /dev/null +++ b/examples/fs.lisp @@ -0,0 +1,11 @@ +; filesystem +( + ; get files + (def files + (ls + (folder))) + ; print files count + (echo + (concat "Current folder: " + (folder) " contains " + (len files) " files")))) \ No newline at end of file