OSDN Git Service

Bundle app/kish as a Default App [0.2.0] dev/bundle-kish
authormtsgi <oq@live.jp>
Sun, 11 Aug 2019 16:54:53 +0000 (01:54 +0900)
committermtsgi <oq@live.jp>
Sun, 11 Aug 2019 16:54:53 +0000 (01:54 +0900)
15 files changed:
app/kish/README.md [new file with mode: 0644]
app/kish/bg.jpg [new file with mode: 0644]
app/kish/default.html [new file with mode: 0644]
app/kish/define.json [new file with mode: 0644]
app/kish/icon-simple.png [new file with mode: 0644]
app/kish/icon.png [new file with mode: 0644]
app/kish/kish.css [new file with mode: 0644]
app/kish/kish.js [new file with mode: 0644]
app/kish/kish_config.json [new file with mode: 0644]
app/kish/kishrc.json [new file with mode: 0644]
app/kish/logo-colored.png [new file with mode: 0644]
app/kish/logo-white.png [new file with mode: 0644]
app/kish/logo.png [new file with mode: 0644]
config/apps.json
config/desktop.json

diff --git a/app/kish/README.md b/app/kish/README.md
new file mode 100644 (file)
index 0000000..50eff45
--- /dev/null
@@ -0,0 +1,2 @@
+# kish
+kish is Powerful Shell for kit.
diff --git a/app/kish/bg.jpg b/app/kish/bg.jpg
new file mode 100644 (file)
index 0000000..eeeb42d
Binary files /dev/null and b/app/kish/bg.jpg differ
diff --git a/app/kish/default.html b/app/kish/default.html
new file mode 100644 (file)
index 0000000..ce9f736
--- /dev/null
@@ -0,0 +1,12 @@
+<div id="kish-wrapper" data-simplebar>
+    <div id="kish-out" class="kit-selectable">
+        <div class="kish-item">
+            <span id="kish-logo" alt="kish CLI" style="height: 20px;margin-top: 5px"></span>
+        </div>
+    </div>
+</div>
+<div id="kish-form">
+        <input type="text" id="kish-input" class="kit-selectable" autocomplete="off">
+        <i class="fa fa-chevron-right" id="kish-indicator"></i>
+</div>
+<span id="kish-curcmd">kish</span>
\ No newline at end of file
diff --git a/app/kish/define.json b/app/kish/define.json
new file mode 100644 (file)
index 0000000..b2167d6
--- /dev/null
@@ -0,0 +1,22 @@
+{
+    "id": "kish",
+    "name": "kish",
+    "icon": "icon.png",
+    "version": "0.3.0",
+    "author": "kit",
+
+    "size": {
+        "width": 600,
+        "height": 350
+    },
+
+    "support": {
+        "fullscreen": true
+    },
+
+    "resize": true,
+
+    "view": "default.html",
+    "script": "kish.js",
+    "css": "kish.css"
+}
\ No newline at end of file
diff --git a/app/kish/icon-simple.png b/app/kish/icon-simple.png
new file mode 100644 (file)
index 0000000..3d7e556
Binary files /dev/null and b/app/kish/icon-simple.png differ
diff --git a/app/kish/icon.png b/app/kish/icon.png
new file mode 100644 (file)
index 0000000..eacb6a9
Binary files /dev/null and b/app/kish/icon.png differ
diff --git a/app/kish/kish.css b/app/kish/kish.css
new file mode 100644 (file)
index 0000000..925c85b
--- /dev/null
@@ -0,0 +1,121 @@
+.winc-kish {
+  padding: 0;
+  background: transparent;
+       backdrop-filter: blur(10px);
+}
+
+#kish-form {
+  background: rgba(255, 255, 255, .8);
+}
+
+#kish-input {
+  position: absolute;
+  bottom: 0;
+  box-sizing: border-box;
+  font-family: 'Noto Sans JP', sans-serif;
+  width: 100%;
+  border: none;
+  background: transparent;
+  padding: 6px;
+  padding-left: 25px;
+  font-size: 20px;
+  font-weight: 100;
+  color: #f0f0f0;
+  transition: .3s all ease-out;
+  text-shadow: 0 1px 3px #202020;
+  background: rgba(0, 0, 0, .5);
+  box-shadow: inset 0 0 0 0 transparent, inset 0 0 0 0 transparent;
+}
+
+#kish-input:focus {
+  outline: none;
+  background: rgba(0, 0, 0, .8);
+  background-size: cover;
+  background-attachment: fixed;
+  box-shadow: 0 0 10px 0 #202020;
+}
+
+#kish-indicator {
+  position: absolute;
+  bottom: 13px;
+  left: 10px;
+  color: #f0f0f0;
+}
+
+#kish-wrapper {
+  overflow: scroll;
+  background-image: url(bg.jpg);
+  background-size: cover;
+  background-attachment: fixed;
+  font-size: 20px;
+  text-shadow: 0 1px 2px rgba(0, 0, 0, .8);
+  color: #f0f0f0;
+  font-weight: 400;
+}
+
+#kish-out {
+  background-image: url(logo-white.png);
+  background-repeat: no-repeat;
+  background-position: top right;
+  background-size: 150px;
+  min-height: 100px;
+  display: flex;
+  flex-flow: column nowrap;
+  margin-bottom: 44px;
+}
+
+#kish-logo {
+  display: inline-block;
+  background-image: url(logo-white.png);
+  background-size: contain;
+  height: 40px;
+  width: 68px;
+}
+
+.kish-item {
+  padding: 0 5px;
+  transition: .2s all ease-out;
+}
+
+.kish-item:hover {
+  background: rgba(0, 0, 0, .3);
+}
+
+.kish-from {
+  font-size: 13px;
+  padding: 0 4px;
+  background: rgba(255, 255, 255, .3);
+  position: relative;
+  top: -3px;
+  box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .5);
+  border-radius: 4px;
+  margin-right: 4px;
+}
+
+#kish-curcmd{
+  display: none;
+  position: absolute;
+  left: 8px;
+  bottom: 52px;
+  background: #12bf12;
+  color: #ffffff;
+  border-radius: 4px;
+  font-size: 14px;
+  padding: 2px 6px;
+  box-shadow: 0 1px 3px 0 rgba(0,0,0,.4);
+}
+
+#kish-curcmd:after{
+  content: "";
+  position: absolute;
+  top: 100%;
+  left: 50%;
+  margin-left: -5px;
+  border: 5px solid transparent;
+  border-top: 7px solid #12bf12;
+}
+
+.kish-highlight{
+  padding: 0 5px;
+  color: #ceffb8;
+}
\ No newline at end of file
diff --git a/app/kish/kish.js b/app/kish/kish.js
new file mode 100644 (file)
index 0000000..0e5ee5d
--- /dev/null
@@ -0,0 +1,183 @@
+((_pid) => {
+
+    $.getJSON( System.launchpath[_pid] + "kish_config.json", (data) => {
+        let props = ["background","font-family","font-size","font-weight","color","text-align","text-shadow","background-size","background-attachment","backdrop-filter"];
+        KWS.resize(_pid, data.width || "", data.height || "");
+        if( data.styles ) for( let i in data.styles ){
+            if( props.includes(i) ){
+                S.dom( _pid, "#kish-wrapper" ).css( i, data.styles[i] );
+                if( i == "backdrop-filter" ) S.dom( _pid ).css( i, data.styles[i] );
+            }
+        }
+    });
+
+    let kishHistory = [], kishCur = -1;
+
+    const Kish = new function(){
+        this.dir = "~";
+
+        this.cat = function(arg){
+            let path = arg.split(" ", 1), _r = "";
+            if( S.userarea[path] ) _r = "<pre><code>" + JSON.stringify( System.userarea[path].data + "</code></pre>", null, 4 );
+            else _r = "File not found: " + path;
+            return _r;
+        }
+
+        this.clear = function(arg){
+            let args = arg.split(" ");
+            let num = Number(args[0]);
+            if( !num ) S.dom(_pid, "#kish-out").html("");
+            return false;
+        }
+    
+        this.echo = function(arg){
+            _r = arg;
+            if( typeof arg == "object" ) _r = JSON.stringify(arg, null, 4);
+            return _r;
+        }
+
+        this.eval = (arg) => { return eval(arg) }
+    
+        this.exec = function(arg){
+            let cmd = arg.split(" ", 1);
+            let args = "";
+            kishHistory.unshift( arg );
+            kishCur = -1;
+            if( arg.indexOf(" ") != -1 ) args = arg.substring( arg.indexOf(" ") + 1 );
+            S.dom(_pid, "#kish-out").append( "<div class='kish-item'><i class='fa fa-dollar-sign'></i><span class='kish-highlight'>" + cmd + "</span>" + args + "</div>" );
+            if( !Kish[cmd] ){
+                S.dom(_pid, "#kish-out").append( "<div class='kish-item'><i class='fa fa-angle-double-right'></i> kishコマンドは存在しません: " + cmd + "</div>" );
+                return false;  
+            }
+            let exec = "Kish." + cmd + "('" + args + "')";
+            try {
+                let rtn = eval(exec)
+                if( typeof rtn == "object" ) rtn = JSON.stringify(rtn, null, 4);
+                if( rtn ) S.dom(_pid, "#kish-out").append( "<div class='kish-item'><span class='kish-from'>" +cmd+ "</span><i class='fa fa-angle-double-right'></i> " + rtn + "</div>" );            
+            }
+            catch (error) {
+                S.dom(_pid, "#kish-out").append( "<div class='kish-item'><span class='kish-from'>" +cmd+ "</span><i class='fa fa-exclamation-triangle'></i> " + error + "</div>" );
+            }
+    
+        }
+
+        this.exit = function(){
+            System.close(_pid);
+        }
+
+        this.install = function(arg){
+            let args = arg.split(" ");
+            let iobj = new Object();
+            $.getJSON( args[0] + "define.json" , function( data ){
+                iobj.path = args[0];
+                iobj.id = data.id;
+                iobj.name = data.name;
+                iobj.icon = args[0] + data.icon;
+                System.installed.push(iobj);
+                localStorage.setItem("kit-installed", JSON.stringify(System.installed));
+                Kish.print("An app was installed from " + args[0], "install");
+                $.getJSON("config/apps.json", System.initLauncher);
+
+            }).fail( function() {
+                Kish.print("Faild to install an app from " + args[0], "install");
+            } );
+            return "Start installing...";
+        }
+    
+        this.kish = function(){
+            return "kish v0.3.0";
+        }
+
+        this.launch = function(arg){
+            args = arg.split(" ");
+            System.launchpath[processID] = System.appdir + args[0];
+            $.getJSON( "./app/" + args[0] + "/define.json", appData ).fail( function() {
+                System.launchpath[processID] = args[0];
+                $.getJSON( args[0] + "/define.json", appData ).fail( function() {
+                    Kish.print("Faild to launch an App: " + args[0], "launch");
+                } );
+            } );
+        }
+
+        this.load = function(arg){
+        }
+
+        this.ls = function(){
+            let _r = "<i>path ~</i><br>";
+            for( let i in System.userarea ){
+                _r += "- " + i + "<br>";
+            }
+            return _r;
+        }
+
+        this.open = function(arg){
+            if( !arg ) return "ファイル名を指定してください";
+            else System.open(arg);
+        }
+
+        this.print = function(arg, from){
+            let _from = "";
+            if( from ){
+                _from = "<span class='kish-from'>" +from+ "</span><i class='fa fa-angle-double-right'></i> "
+            }
+            S.dom(_pid, "#kish-out").append( "<div class='kish-item'>" + _from + arg + "</div>" );          
+        }
+
+        this.uninstall = function(arg){
+            let count = 0;
+            for( let i in System.installed ){
+                if( System.installed[i].path == arg ){
+                    System.installed.splice(i, 1);
+                    count ++;
+                }
+            }
+            localStorage.setItem("kit-installed", JSON.stringify(System.installed));
+            $.getJSON("config/apps.json", System.initLauncher);
+            return count + "app(s) was uninstalled from kit.";
+        }
+
+        this.ver = function(){
+            return System.version;
+        }
+    }
+
+    $.getJSON( System.launchpath[_pid] + "kishrc.json", (data) => {
+        for( let i of data.rc ) Kish.exec(i);
+    });
+
+    S.dom(_pid, "#kish-input").on( "keypress keyup keydown", (e) => {
+        let input = S.dom(_pid, "#kish-input").val().split(" ");
+
+        if( typeof Kish[ input[0] ] == "function" ){
+            S.dom(_pid, "#kish-curcmd").show().text( input[0] );
+        }
+        else S.dom(_pid, "#kish-curcmd").hide();
+
+        if( e.keyCode == 13 && S.dom(_pid, "#kish-input").val() ){
+            Kish.exec( S.dom(_pid, "#kish-input").val() );
+            S.dom(_pid, "#kish-input").val("");
+        }
+    } );
+
+    S.dom(_pid, "#kish-input").on( "keydown", (e) => {
+        if( e.keyCode == 38 ){
+            if( kishCur < kishHistory.length - 1 ){
+                kishCur ++;
+                S.dom(_pid, "#kish-input").val( kishHistory[kishCur] );
+            }
+        }
+        else if( e.keyCode == 40 ){
+            if( kishCur > 0 ){
+                kishCur --;
+                S.dom(_pid, "#kish-input").val( kishHistory[kishCur] );
+            }
+            else if( kishCur == 0 ){
+                kishCur = -1;
+                S.dom(_pid, "#kish-input").val( "" );
+            }
+        }
+    });
+
+    KWS.changeWindowTitle(_pid, "(kish)"+ System.username);
+    App.changeWindowTitle(_pid, "(kish)"+ System.username);
+})(pid);
\ No newline at end of file
diff --git a/app/kish/kish_config.json b/app/kish/kish_config.json
new file mode 100644 (file)
index 0000000..9326791
--- /dev/null
@@ -0,0 +1,16 @@
+{
+    "width": "",
+    "height": "",
+    "styles": {
+        "background": "",
+        "background-size": "",
+        "background-attachment": "",
+        "backdrop-filter": "",
+        "font-family": "",
+        "font-size": "",
+        "font-weight": "",
+        "color": "",
+        "text-align": "",
+        "text-shadow": ""
+    }
+}
\ No newline at end of file
diff --git a/app/kish/kishrc.json b/app/kish/kishrc.json
new file mode 100644 (file)
index 0000000..1021376
--- /dev/null
@@ -0,0 +1,4 @@
+{
+    "rc": [
+    ]
+}
\ No newline at end of file
diff --git a/app/kish/logo-colored.png b/app/kish/logo-colored.png
new file mode 100644 (file)
index 0000000..a56c5a1
Binary files /dev/null and b/app/kish/logo-colored.png differ
diff --git a/app/kish/logo-white.png b/app/kish/logo-white.png
new file mode 100644 (file)
index 0000000..7f7dd95
Binary files /dev/null and b/app/kish/logo-white.png differ
diff --git a/app/kish/logo.png b/app/kish/logo.png
new file mode 100644 (file)
index 0000000..ab22475
Binary files /dev/null and b/app/kish/logo.png differ
index af139e8..3046307 100644 (file)
         "icon": "./app/help/icon.png"
     },
 
+    "kish": {
+        "name": "kish",
+        "icon": "./app/kish/icon.png"
+    },
+
     "ntflist": {
         "name": "通知履歴",
         "icon": "./app/ntflist/icon.png"
index 2d2f661..153afb7 100644 (file)
         "icon": "./app/console/icon.png"
     },
 
+    "kish": {
+        "name": "kish",
+        "icon": "./app/kish/icon.png"
+    },
+
     "ytplayer": {
         "name": "動画閲覧",
         "icon": "./app/ytplayer/icon.png"