mirror of
https://shylinux.com/x/volcanos
synced 2025-04-28 10:02:00 +08:00
opt xterm.js
This commit is contained in:
parent
825dcefeb2
commit
8a55bd00c5
3
.gitignore
vendored
3
.gitignore
vendored
@ -5,4 +5,5 @@ page/can.js
|
|||||||
page/can.css
|
page/can.css
|
||||||
page/cache.js
|
page/cache.js
|
||||||
page/cache.css
|
page/cache.css
|
||||||
pack/
|
node_modules/
|
||||||
|
package-lock.json
|
||||||
|
6
frame.js
6
frame.js
@ -9,6 +9,8 @@ Volcanos(chat.ONENGINE, {help: "搜索引擎", _init: function(can, meta, list,
|
|||||||
}, Volcanos.meta.args = can.user.args(can)
|
}, Volcanos.meta.args = can.user.args(can)
|
||||||
can.user.title(can.misc.Search(can, chat.TITLE)||can.misc.Search(can, ice.POD)||location.host)
|
can.user.title(can.misc.Search(can, chat.TITLE)||can.misc.Search(can, ice.POD)||location.host)
|
||||||
|
|
||||||
|
window.onunload = function() { can.onengine.signal(can, "onunload") }
|
||||||
|
|
||||||
can.core.Next(list, function(item, next) { item.type = chat.PANEL
|
can.core.Next(list, function(item, next) { item.type = chat.PANEL
|
||||||
can.onappend._init(can, can.base.Copy(item, can.core.Value(can, [chat.RIVER, item.name])), item.list, function(panel) {
|
can.onappend._init(can, can.base.Copy(item, can.core.Value(can, [chat.RIVER, item.name])), item.list, function(panel) {
|
||||||
panel.run = function(event, cmds, cb) { var msg = panel.request(event); cmds = cmds||[]
|
panel.run = function(event, cmds, cb) { var msg = panel.request(event); cmds = cmds||[]
|
||||||
@ -118,7 +120,9 @@ Volcanos(chat.ONDAEMON, {help: "推荐引擎", _init: function(can, name) { if (
|
|||||||
sub.onimport._grow(sub, msg, can.page.Color(arg.join("")))
|
sub.onimport._grow(sub, msg, can.page.Color(arg.join("")))
|
||||||
},
|
},
|
||||||
toast: function(can, msg, arg) { can.core.CallFunc(can.user.toast, {can: can, msg: msg, cmds: arg}) },
|
toast: function(can, msg, arg) { can.core.CallFunc(can.user.toast, {can: can, msg: msg, cmds: arg}) },
|
||||||
pwd: function(can, msg, arg) { can.ondaemon._list[0] = arg[0] },
|
pwd: function(can, msg, arg) {
|
||||||
|
can._wss_name = can.ondaemon._list[0] = arg[0]
|
||||||
|
},
|
||||||
exit: function(can, msg, sub) { can.user.close() },
|
exit: function(can, msg, sub) { can.user.close() },
|
||||||
})
|
})
|
||||||
Volcanos(chat.ONAPPEND, {help: "渲染引擎", _init: function(can, meta, list, cb, target, field) {
|
Volcanos(chat.ONAPPEND, {help: "渲染引擎", _init: function(can, meta, list, cb, target, field) {
|
||||||
|
@ -148,6 +148,7 @@ Volcanos("misc", {help: "通信协议", Message: function(event, can) { var msg
|
|||||||
var socket = new WebSocket(can.base.MergeURL(url, args))
|
var socket = new WebSocket(can.base.MergeURL(url, args))
|
||||||
socket.onclose = function() { can.misc.Log(html.WSS, cli.CLOSE, args)
|
socket.onclose = function() { can.misc.Log(html.WSS, cli.CLOSE, args)
|
||||||
can.base.isFunc(onclose)? onclose(socket): can.core.Timer(can.base.random(3000, 1000), function() {
|
can.base.isFunc(onclose)? onclose(socket): can.core.Timer(can.base.random(3000, 1000), function() {
|
||||||
|
args.name = args.name||can._wss_name
|
||||||
can.misc.WSS(can, args, cb, onopen, onerror, onclose)
|
can.misc.WSS(can, args, cb, onopen, onerror, onclose)
|
||||||
})
|
})
|
||||||
}, socket.onerror = function() { can.misc.Log(html.WSS, cli.ERROR, args)
|
}, socket.onerror = function() { can.misc.Log(html.WSS, cli.ERROR, args)
|
||||||
|
@ -304,6 +304,8 @@ body.simple div.output.card div.item:hover { background-color:white; box-shadow:
|
|||||||
body.simple div.output.card div.item>div.title { border-bottom:solid 1px #e7e7e7; }
|
body.simple div.output.card div.item>div.title { border-bottom:solid 1px #e7e7e7; }
|
||||||
body.simple fieldset.feel.float { top:0; }
|
body.simple fieldset.feel.float { top:0; }
|
||||||
|
|
||||||
|
div.output div.row div.col { float:left; border:solid 1px green; }
|
||||||
|
|
||||||
body.white.simple div.profile { background-color:whitesmoke; }
|
body.white.simple div.profile { background-color:whitesmoke; }
|
||||||
body.white.simple div.display { background-color:whitesmoke; }
|
body.white.simple div.display { background-color:whitesmoke; }
|
||||||
body.white.simple div.code { background-color:white; color:black; border:none; }
|
body.white.simple div.code { background-color:white; color:black; border:none; }
|
||||||
|
@ -24,7 +24,7 @@ fieldset.inner>div.output td.content>div.tabs { display:none; }
|
|||||||
fieldset.inner>div.output td.content>div.path { display:none; }
|
fieldset.inner>div.output td.content>div.path { display:none; }
|
||||||
fieldset.inner div.output fieldset.toolkit { position:absolute; bottom:0px; right:0px; }
|
fieldset.inner div.output fieldset.toolkit { position:absolute; bottom:0px; right:0px; }
|
||||||
fieldset.inner>div.output fieldset.toolkit>div.output>fieldset { display:none; }
|
fieldset.inner>div.output fieldset.toolkit>div.output>fieldset { display:none; }
|
||||||
fieldset.inner>div.output fieldset.toolkit>div.output>fieldset.select { background-color:#0e3369b3; color:white; display:block; }
|
fieldset.inner>div.output fieldset.toolkit>div.output>fieldset.select { background-color:#0e3369b3; color:white; display:block; z-index:10; }
|
||||||
fieldset.inner>div.status legend { float:right; }
|
fieldset.inner>div.status legend { float:right; }
|
||||||
fieldset.inner>div.status legend.select { background-color:green; }
|
fieldset.inner>div.status legend.select { background-color:green; }
|
||||||
fieldset.inner>div.status legend:hover { background-color:green; }
|
fieldset.inner>div.status legend:hover { background-color:green; }
|
||||||
@ -43,6 +43,7 @@ body.simple fieldset.inner>div.output div.content td.line { padding-top:4px; bor
|
|||||||
body.simple fieldset.inner>div.output div.content td.text { padding-top:2px; border:solid 1px transparent; }
|
body.simple fieldset.inner>div.output div.content td.text { padding-top:2px; border:solid 1px transparent; }
|
||||||
|
|
||||||
body.white.simple fieldset.inner>div.output div.project { background-color:whitesmoke; }
|
body.white.simple fieldset.inner>div.output div.project { background-color:whitesmoke; }
|
||||||
|
body.white.simple fieldset.inner>div.output div.project.toggle { background-color:#4682b46b; }
|
||||||
body.white.simple fieldset.inner>div.output div.project div.item { color:black; }
|
body.white.simple fieldset.inner>div.output div.project div.item { color:black; }
|
||||||
body.white.simple fieldset.inner>div.output td.content>div.tabs { background-color:whitesmoke; }
|
body.white.simple fieldset.inner>div.output td.content>div.tabs { background-color:whitesmoke; }
|
||||||
body.white.simple fieldset.inner>div.output td.content>div.tabs div.tabs { background-color:lightgray; color:black; }
|
body.white.simple fieldset.inner>div.output td.content>div.tabs div.tabs { background-color:lightgray; color:black; }
|
||||||
|
@ -1,13 +1,81 @@
|
|||||||
Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, target) {
|
Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, target) {
|
||||||
can.onmotion.clear(can), can.base.isFunc(cb) && cb(msg)
|
can.onmotion.clear(can), can.onlayout.profile(can), can.base.isFunc(cb) && cb(msg)
|
||||||
can.page.style(can, html.HEIGHT, can.ConfHeight(), html.WIDTH, can.ConfWidth())
|
can.page.style(can, can.ui.content, html.HEIGHT, can.ConfHeight(can.ConfHeight()+html.ACTION_HEIGHT), html.WIDTH, can.ConfWidth())
|
||||||
can.require(["/node_modules/xterm/lib/xterm.js", "/node_modules/xterm/css/xterm.css"], function() {
|
can.page.ClassList.add(can, can.ui.project, ice.AUTO)
|
||||||
can.term = new Terminal(), can.term.open(can._output), can.term.onData(function(val) {
|
can.page.ClassList.add(can, can.ui.profile, ice.AUTO)
|
||||||
can.runAction(can.request({}, {"channel": can.Conf("channel")}), "input", [val], function() {})
|
can.onmotion.hidden(can, can.ui.project)
|
||||||
|
can.onmotion.hidden(can, can._status)
|
||||||
|
|
||||||
|
msg.Table(function(value) { can.onimport.item(can, value, function() {}, function(event) {
|
||||||
|
can.user.carteRight(event, can, {
|
||||||
|
"select": function() {
|
||||||
|
can.runAction(can.request(event, value), "select", [])
|
||||||
|
},
|
||||||
|
"rename": function() {
|
||||||
|
can.user.input(event, can, [mdb.NAME], function(args) {
|
||||||
|
can.runAction(can.request(event, value), mdb.MODIFY, args)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}) })
|
||||||
|
|
||||||
|
can.require(["/require/node_modules/xterm/lib/xterm.js", "/require/node_modules/xterm/css/xterm.css", "/require/node_modules/xterm-addon-fit/lib/xterm-addon-fit.js"], function() { can.term = {}
|
||||||
|
can.runAction({}, mdb.CREATE, ["type", "xterm", "name", "some"], function(msg) { can.onimport._connect(can, msg.Result()) })
|
||||||
|
})
|
||||||
|
},
|
||||||
|
_connect: function(can, hash, target) { var term = new Terminal({theme: {background: "#060101"}}); can.term[hash] = term
|
||||||
|
target = target||can.ui.content, target._term = term, term._target = target
|
||||||
|
var fitAddon = new FitAddon.FitAddon(); term.loadAddon(fitAddon)
|
||||||
|
term.open(target||can.ui.content), term.onResize(function(size) {
|
||||||
|
can.runAction(can.request({}, {"hash": hash}, size), "resize", [], function() {})
|
||||||
|
}), fitAddon.fit()
|
||||||
|
term.onData(function(val) {
|
||||||
|
can.runAction(can.request({}, {"hash": hash}), "input", [val], function() {})
|
||||||
|
})
|
||||||
|
var submode = false
|
||||||
|
term.onTitleChange(function(title) {
|
||||||
|
can.isCmdMode() && can.user.title(title)
|
||||||
|
can.misc.Debug("title", title)
|
||||||
|
})
|
||||||
|
term.onKey(function(e) { var event = e.domEvent
|
||||||
|
if (submode) {
|
||||||
|
switch (event.key) {
|
||||||
|
case "l":
|
||||||
|
target.nextSibling && target.nextSibling._term && target.nextSibling._term.focus()
|
||||||
|
break
|
||||||
|
case "h":
|
||||||
|
target.previousSibling && target.previousSibling._term && target.previousSibling._term.focus()
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (event.ctrlKey && event.key == "g") {
|
||||||
|
submode = true
|
||||||
|
} else {
|
||||||
|
submode = false
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
grow: function(can, msg, str) { var data = can.base.Obj(str)
|
||||||
|
var term = can.term[msg.Option(mdb.HASH)]
|
||||||
|
switch (data.type) {
|
||||||
|
case "data":
|
||||||
|
term.write(atob(data.text))
|
||||||
|
break
|
||||||
|
case "exit":
|
||||||
|
can.onmotion.clear(can, term._target)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
Volcanos(chat.ONACTION, {help: "操作数据", list: ["split"],
|
||||||
|
_trans: {split: "分屏"},
|
||||||
|
split: function(event, can) { can.request(event, {m: 2, n: 2})
|
||||||
|
can.user.input(event, can, ["m", "n"], function(data) { can.onmotion.clear(can, can.ui.content)
|
||||||
|
can.core.List(parseInt(data.m), function() { var row = can.page.Append(can, can.ui.content, [{view: "row", style: {height: can.ConfHeight()/data.m}}]).first
|
||||||
|
can.core.List(parseInt(data.n), function() { var div = can.page.Append(can, row, [{view: "col", style: {height: can.ConfHeight()/data.m, width: can.ConfWidth()/data.n-2}}]).first
|
||||||
|
can.runAction({}, mdb.CREATE, ["type", "xterm", "name", "some"], function(msg) { can.onimport._connect(can, msg.Result(), div) })
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
grow: function(can, str) {
|
|
||||||
can.term.write(atob(str))
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
@ -74,7 +74,7 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, conf, cb, ta
|
|||||||
_grow: function(can, msg, _arg) {
|
_grow: function(can, msg, _arg) {
|
||||||
sub = can.core.Value(can, chat._OUTPUTS_CURRENT)
|
sub = can.core.Value(can, chat._OUTPUTS_CURRENT)
|
||||||
if (sub && sub.onimport && sub.onimport.grow) {
|
if (sub && sub.onimport && sub.onimport.grow) {
|
||||||
sub.onimport.grow(sub, _arg)
|
sub.onimport.grow(sub, msg, _arg)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if (can.page.Select(can, can._output, html.DIV_CODE, function(div) {
|
if (can.page.Select(can, can._output, html.DIV_CODE, function(div) {
|
||||||
|
@ -73,11 +73,11 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
|||||||
}}, {view: html.LIST}]); can.onimport.list(can, item, cb, ui.list)
|
}}, {view: html.LIST}]); can.onimport.list(can, item, cb, ui.list)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
item: function(can, item, cb, cbs, target) { target = target||can._output
|
item: function(can, item, cb, cbs, target) { target = target||(can.ui && can.ui.project? can.ui.project: can._output)
|
||||||
var ui = can.page.Append(can, target, [{view: [html.ITEM, html.DIV, item.nick||item.name],
|
var ui = can.page.Append(can, target, [{view: [html.ITEM, html.DIV, item.nick||item.name],
|
||||||
onclick: function(event) { cb(event, ui.first, event.target._list && can.onmotion.toggle(can, event.target._list))
|
onclick: function(event) { cb(event, ui.first, event.target._list && can.onmotion.toggle(can, event.target._list))
|
||||||
can.onmotion.select(can, target, can.core.Keys(html.DIV, html.ITEM), ui.first)
|
can.onmotion.select(can, target, can.core.Keys(html.DIV, html.ITEM), ui.first)
|
||||||
}, onmouseenter: function(event) { cbs(event, ui.first) },
|
}, onmouseenter: function(event) { can.base.isFunc(cbs) && cbs(event, ui.first) },
|
||||||
}]); return ui.first
|
}]); return ui.first
|
||||||
},
|
},
|
||||||
itemlist: function(can, list, cb, cbs, target) {
|
itemlist: function(can, list, cb, cbs, target) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user