forked from x/volcanos
opt inner.css
This commit is contained in:
parent
bdc17cf8d1
commit
e6c9339039
29
frame.js
29
frame.js
@ -196,7 +196,8 @@ Volcanos(chat.ONAPPEND, {help: "渲染引擎", _init: function(can, meta, list,
|
||||
can.core.ItemCB(item, function(key, cb) { input._target[key] = function(event) { cb(event, input) } })
|
||||
skip? next(): can.core.CallFunc([input.onaction, chat._INIT], [input, item, next, input._target]);
|
||||
(item.action||can.core.Value(meta, [ctx.FEATURE, ctx.INPUTS])) && can.onappend.figure(input, item, input._target, function(sub, value) {
|
||||
input._target.value = value, can.Update()
|
||||
input._target.value = value, can.onmotion.focus(can, input._target)
|
||||
can.onmotion.delay(can, function() { can.Update() })
|
||||
})
|
||||
})
|
||||
}; can.core.Next(can.base.getValid(can.core.Value(can, [chat.ONIMPORT, mdb.LIST]), can.base.Obj(meta.inputs)).concat([{type: html.BUTTON, name: cli.CLOSE}]), add)
|
||||
@ -423,14 +424,13 @@ Volcanos(chat.ONAPPEND, {help: "渲染引擎", _init: function(can, meta, list,
|
||||
figure: function(can, meta, target, cbs) { if ([html.BUTTON, html.SELECT].indexOf(meta.type) > -1) { return }
|
||||
var input = meta.action||mdb.KEY; input != ice.AUTO && can.require(["/plugin/input/"+input+".js"], function(can) {
|
||||
can.core.ItemCB(can.onfigure[input], function(key, on) { var last = target[key]; target[key] = function(event) { on(event, can, meta, function(cb) {
|
||||
function _cbs(sub, value, old) { can.onmotion.hidden(can, sub._target), can.base.isFunc(cbs)? cbs(sub, value, old): target.value = value||"" }
|
||||
function _cbs(sub, value, old) { can.onmotion.hidden(can, sub._target), can.base.isFunc(cbs)? cbs(sub, value, old): target.value = value||"", can.onmotion.delay(can, function() { can.onmotion.focus(can, target) }) }
|
||||
if (target._can) { return can.onmotion.toggle(can, target._can._target), can.base.isFunc(cb) && cb(target._can, _cbs) }
|
||||
can.onappend._init(can, {type: html.INPUT, name: input, pos: chat.FLOAT, mode: meta.mode}, ["/plugin/input/"+input+".js"], function(sub) { sub.Conf(meta)
|
||||
sub.run = function(event, cmds, cb) { (meta.run||can.run)(sub.request(event, can.Option()), cmds, cb, true) }
|
||||
var layout = target.getBoundingClientRect(); can.page.style(can, sub._target, {left: layout.left, top: layout.bottom}), can.page.style(sub, sub._target, meta.style)
|
||||
can.onlayout.figure({target: target}, can, sub._target), can.page.style(sub, sub._target, meta.style)
|
||||
target._can = sub, sub.close = function() { can.page.Remove(can, sub._target), delete(target._can) }
|
||||
can.base.isFunc(cb) && cb(sub, _cbs)
|
||||
can.base.isFunc(meta._init) && meta._init(sub, sub._target)
|
||||
can.base.isFunc(cb) && cb(sub, _cbs), can.base.isFunc(meta._init) && meta._init(sub, sub._target)
|
||||
}, can._root._target)
|
||||
}, target, last) } })
|
||||
})
|
||||
@ -478,18 +478,15 @@ Volcanos(chat.ONLAYOUT, {help: "页面布局", _init: function(can, target) { ta
|
||||
background: function(can, url, target) {
|
||||
can.page.style(can, target||can._root._target, html.BACKGROUND, url == "" || url == "void"? "": 'url("'+url+'")')
|
||||
},
|
||||
|
||||
figure: function(event, can, target, right) {
|
||||
if (!event || !event.target) { return {} }
|
||||
var rect = event.target.getBoundingClientRect()
|
||||
target = target||can._fields||can._target
|
||||
figure: function(event, can, target, right) { if (!event || !event.target) { return {} } target = target||can._fields||can._target
|
||||
var rect = event.target == document.body? {left: window.innerWidth/2, top: 200, right: window.innerWidth/2, bottom: 200}: event.target.getBoundingClientRect()
|
||||
var layout = right? {left: rect.right, top: rect.top}: {left: rect.left, top: rect.bottom}
|
||||
can.getActionSize(function(left, top, width, height) {
|
||||
if (layout.top+target.offsetHeight > top+height-31) {
|
||||
layout.bottom = 31, layout.top = ""
|
||||
if (layout.top+target.offsetHeight > top+height-html.ACTION_HEIGHT) {
|
||||
layout.top = "", layout.bottom = right? html.ACTION_HEIGHT: top+height+html.ACTION_HEIGHT-rect.top
|
||||
}
|
||||
if (layout.left+target.offsetWidth > left+width) {
|
||||
layout.right = 0, layout.left = ""
|
||||
layout.left = "", layout.right = 0
|
||||
}
|
||||
})
|
||||
return can.onmotion.move(can, target, layout), layout
|
||||
@ -727,7 +724,8 @@ Volcanos(chat.ONMOTION, {help: "动态特效", _init: function(can, target) {
|
||||
can.Update(event)
|
||||
} })
|
||||
},
|
||||
selectInputTable: function(event, can, cb, target) { if (target.value == "") { return cb() }
|
||||
selectInputTable: function(event, can, cb, target) {
|
||||
// if (target.value == "") { return cb() }
|
||||
switch (event.key) {
|
||||
case lang.SHIFT:
|
||||
case lang.CONTROL:
|
||||
@ -735,6 +733,9 @@ Volcanos(chat.ONMOTION, {help: "动态特效", _init: function(can, target) {
|
||||
}
|
||||
|
||||
if (event.ctrlKey) {
|
||||
if (target._index == undefined) {
|
||||
target._index = -1, target._value = target.value
|
||||
}
|
||||
function select(order) { if (order == -1) { target.value = target._value }
|
||||
var index = 0; return can.page.Select(can, can._output, [html.TBODY, html.TR], function(tr) {
|
||||
if (can.page.ClassList.has(can, tr, html.HIDDEN)) { return }
|
||||
|
@ -76,7 +76,8 @@ fieldset.input.key { overflow:auto; }
|
||||
fieldset.input.key div.action { display:none; }
|
||||
fieldset.input.key.simple div.status { display:none; }
|
||||
fieldset.input.key.simple th { display:none; }
|
||||
fieldset.input.key.simple td { min-width:40px; text-align:center; }
|
||||
/* fieldset.input.key.simple td { min-width:40px; text-align:center; } */
|
||||
fieldset.input.key.simple td { min-width:40px; }
|
||||
fieldset.input.date div.action div.space { width:0; clear:both; }
|
||||
fieldset.input.date div.output td.prev { color:gray; }
|
||||
fieldset.input.date div.output td.next { color:gray; }
|
||||
@ -118,7 +119,7 @@ legend { font-size:1.2rem; height:31px; }
|
||||
select { font-size:1.1rem; height:31px; }
|
||||
input { font-size:1.1rem; height:27px; }
|
||||
input[type=button] { height:31px; }
|
||||
table.content th, table.content td, div.item, div.tabs, div.code, code.story, div.story[data-type=spark] { font-size:1.1rem; font-family:monospace; }
|
||||
table.content th, table.content td, div.item, div.code, code.story, div.story[data-type=spark] { font-size:1.1rem; font-family:monospace; }
|
||||
div.status>div.item>label { font-size:0.6rem; font-family:monospace; }
|
||||
div.status>div.item { padding:4px; height:22px; }
|
||||
svg { font-family:monospace; }
|
||||
@ -176,7 +177,7 @@ body.simple fieldset.River>div.output div.list div.item { background-color:white
|
||||
body.simple fieldset.River>div.output div.list div.item.select { background-color:#0152d9; color:white; }
|
||||
body.simple fieldset.River>div.output div.list div.item:hover { background-color:#0152d9; color:white; }
|
||||
|
||||
body.simple fieldset.Action>div.action { background:white; padding:10px; border-bottom: solid 1px red; height:38px; width:600px; }
|
||||
body.simple fieldset.Action>div.action { background-color:white; padding:10px; border-bottom: solid 1px red; height:38px; width:600px; }
|
||||
body.simple fieldset.Action>div.action div.tabs { padding:10px; margin:10px; }
|
||||
body.simple fieldset.Action.tabs>div.output { margin-top:58px; }
|
||||
body.simple fieldset.Action>div.output>fieldset.plugin.inner { box-shadow:none; }
|
||||
@ -195,7 +196,7 @@ body.white.simple div.output.card input[type=button]:hover { box-shadow:2px 2px
|
||||
body.white.simple div.output.card input[type=button] { box-shadow:2px 2px 6px 1px gray; color:white; }
|
||||
body.white.simple div.output.card input[type=button] { background-color:#0152d9; font-size:0.8rem; padding:5px 10px; border:none; border-radius:5px; }
|
||||
body.white.simple>div.carte { background-color:white; border:solid 1px #e7e7e7; }
|
||||
body.white.simple>div.carte div.item { font-size:1rem; }
|
||||
body.white.simple>div.carte div.item { font-size:1rem; color:black; }
|
||||
body.white.simple>div.carte div.item:hover { background-color:#0152d9; }
|
||||
body.white.simple input[type=button] { background-color:#0152d9; border:none; border-radius:5px; box-shadow:2px 2px 6px 1px gray; }
|
||||
|
||||
@ -297,5 +298,9 @@ body.white fieldset.panel.Search a { color:yellow; }
|
||||
body.black a { color:yellow; }
|
||||
div.action>div.item { float:left; clear:none; }
|
||||
|
||||
div.output td.project div.project div.zone>div.action>div.item { float:right; clear:none; padding:0; margin:0; }
|
||||
div.output td.project div.project div.zone>div.action>div.item input[type=text] { background-color:#ff000000; padding-left:10px; color:white; border:none; }
|
||||
div.project div.zone>div.name { background-color:cornflowerblue; color:white; font-family:monospace; font-size:1.1rem; text-align:center; padding:5px; clear:both; }
|
||||
div.project div.item>div.name { padding:0 16px; }
|
||||
div.project div.zone>div.action>div.item { float:right; clear:none; padding:0; margin:0; }
|
||||
div.project div.zone>div.action>div.item input[type=text] { background-color:#ff000000; padding-left:10px; color:white; border:none; }
|
||||
body.white.simple fieldset.plugin div.output.json div.item span { color:black; }
|
||||
body.white.simple fieldset.plugin div.output.json div.item span.key { color:blue; }
|
||||
|
@ -95,7 +95,7 @@ Volcanos(chat.ONEXPORT, {help: "导出数据",
|
||||
}}
|
||||
}, ui.output), can.onappend.board(can, msg.Result(), ui.output)
|
||||
}
|
||||
return can.page.style(can, ui.first, bottom? {bottom: 31, top: ""}: {}), can[name] = ui
|
||||
return can.page.style(can, ui.first, bottom? {bottom: html.ACTION_HEIGHT, top: ""}: {}), can[name] = ui
|
||||
},
|
||||
ntip: function(can) {
|
||||
can.onexport.float(can, can._tips, function() {}, "ntip")
|
||||
|
@ -1,39 +1,57 @@
|
||||
Volcanos(chat.ONFIGURE, {help: "控件详情", key: {
|
||||
_init: function(can, msg, cbs, target, name) { can.onmotion.hidden(can, can._target, msg.Length() != 0)
|
||||
_init: function(event, can, cbs, target, name, value) {
|
||||
can.runAction(event, mdb.INPUTS, [name, value||target.value], function(msg) {
|
||||
can.onfigure.key._show(can, msg, cbs, target, name)
|
||||
})
|
||||
},
|
||||
_show: function(can, msg, cbs, target, name) {
|
||||
if (!can.onmotion.toggle(can, can._target, msg.Length() != 0)) { return }
|
||||
can.onmotion.clear(can), can.onappend.table(can, msg, function(value) {
|
||||
return {text: [value, html.TD], onclick: function(event) { can.base.isFunc(cbs) && cbs(can, value, target.value) }}
|
||||
return {text: [value, html.TD], onclick: function(event) { can.base.isFunc(cbs) && cbs(can, value, target.value)
|
||||
msg.Option(ice.MSG_PROCESS) == ice.PROCESS_AGAIN && can.onmotion.delay(can, function() {
|
||||
can.onfigure.key._init(event, can, cbs, target, name, value)
|
||||
})
|
||||
}}
|
||||
}), can.onappend._status(can, [mdb.TOTAL, mdb.INDEX]), can.Status(mdb.TOTAL, msg.Length())
|
||||
can.getActionSize(function(left, top, width, height) {
|
||||
can.page.style(can, can._target, html.MAX_HEIGHT, top+height-can._target.offsetTop)
|
||||
})
|
||||
},
|
||||
_show: function(event, can, cbs, target, name, value) {
|
||||
can.runAction(event, mdb.INPUTS, [name, value||target.value], function(msg) {
|
||||
can.onfigure.key._init(can, msg, cbs, target, name)
|
||||
})
|
||||
},
|
||||
onclick: function(event, can, meta, cb, target) { can.onmotion.focus(can, target)
|
||||
cb(function(sub, cbs) {
|
||||
_make: function(event, can, meta, cb, target, last) {
|
||||
var sub = target._can; if (sub && sub._cbs) { return }
|
||||
cb(function(sub, cbs) { sub._cbs = cbs
|
||||
if (meta.msg && meta.msg.Length() > 0) {
|
||||
can.onfigure.key._init(sub, meta.msg, cbs, target, meta.name)
|
||||
can.onfigure.key._show(sub, meta.msg, cbs, target, meta.name)
|
||||
} else {
|
||||
can.onfigure.key._show(event, sub, cbs, target, meta.name)
|
||||
can.onfigure.key._init(event, sub, cbs, target, meta.name)
|
||||
}
|
||||
})
|
||||
},
|
||||
onclick: function(event, can, meta, cb, target) {
|
||||
target._can && target._can.close()
|
||||
can.onfigure.key._make(event, can, meta, cb, target)
|
||||
can.onmotion.focus(can, target)
|
||||
},
|
||||
onfocus: function(event, can, meta, cb, target, last) {
|
||||
can.onfigure.key._make(event, can, meta, cb, target)
|
||||
},
|
||||
onkeydown: function(event, can, meta, cb, target, last) {
|
||||
switch (event.key) {
|
||||
case "Escape": target._can? target._can.close(): target.blur(); return
|
||||
case "Tab": target._can && target._can.close(); return
|
||||
case "n":
|
||||
case "p": event.ctrlKey && can.onkeymap.prevent(event); break
|
||||
default: can.base.isFunc(last) && last(event, can)
|
||||
}
|
||||
can.onfigure.key._make(event, can, meta, cb, target)
|
||||
},
|
||||
onkeyup: function(event, can, meta, cb, target, last) { var sub = target._can
|
||||
sub && can.onmotion.selectInputTable(event, sub, function() {
|
||||
can.onfigure.key._show(event, sub, null, target, meta.name)
|
||||
}, target), can.base.isFunc(last) && last(event, can)
|
||||
},
|
||||
onblur: function(event, can, meta, cb, target) {
|
||||
target._hold || can.onmotion.delay(can, function() { target._can && target._can.close() }), target._hold = false
|
||||
onkeyup: function(event, can, meta, cb, target, last) {
|
||||
var sub = target._can; if (!sub) { return }
|
||||
switch (event.key) {
|
||||
case "/": can.onfigure.key._init(event, sub, meta.msg, sub._cbs, target, meta.name)
|
||||
}
|
||||
can.onmotion.selectInputTable(event, sub, function() {
|
||||
can.onfigure.key._init(event, sub, sub._cbs, target, meta.name)
|
||||
}, target)
|
||||
},
|
||||
}})
|
||||
|
@ -1,63 +1,66 @@
|
||||
fieldset.inner>form.option input[name=path] { width:80px; }
|
||||
fieldset.inner>form.option input[name=file] { width:160px; }
|
||||
|
||||
fieldset.inner>div.action>div.tabs { background-color:#5c809c5c; height:21px; }
|
||||
fieldset.inner>div.action>div.tabs:hover { background-color:#013b675c; }
|
||||
fieldset.inner>div.action>div.tabs.select { background-color:#013b675c; border-bottom:solid 2px #7999b2; font-size:1rem; height:19px; }
|
||||
fieldset.inner>div.output { color:white; }
|
||||
fieldset.inner>div.action>div.tabs.select { background-color:#013b675c; border-bottom:solid 2px #7999b2; }
|
||||
|
||||
fieldset.inner>div.output div.project div.zone>div.name { background-color:cornflowerblue; color:white; font-family:monospace; font-size:1.1rem; text-align:center; padding:5px; clear:both; }
|
||||
fieldset.inner>div.output div.project div.item>div.name { padding:0 16px; }
|
||||
|
||||
fieldset.inner>div.output div.content { color:white; font-size:1.1rem; font-family:monospace; position:relative; }
|
||||
fieldset.inner>div.output div.content { color:white; font-size:16px; font-family:monospace; position:relative; }
|
||||
fieldset.inner>div.output div.content tr.select { background-color:#0000ff6b; }
|
||||
fieldset.inner>div.output div.content tr.select td.line { background-color:blue; border:solid 1px red; border-right:solid 2px red; }
|
||||
fieldset.inner>div.output div.content td.line:hover { background-color:green; }
|
||||
fieldset.inner>div.output div.content td.line { position:sticky; left:0; text-align:right; padding:0 6px; border-right:solid 2px red; }
|
||||
fieldset.inner>div.output div.content td.text { text-align:left; white-space:pre; padding-left:10px; cursor:text; }
|
||||
fieldset.inner>div.output div.content td.line:hover { background-color:blue; }
|
||||
fieldset.inner>div.output div.content td.text { white-space:pre; padding-left:10px; cursor:text; }
|
||||
fieldset.inner>div.output div.content td.text span.comment { background-color:blue; color:cyan; }
|
||||
fieldset.inner>div.output div.content td.text span.keyword { color:yellow; font-weight:bold; }
|
||||
fieldset.inner>div.output div.content td.text span.datatype { color:lightgreen; font-weight:bold; }
|
||||
fieldset.inner>div.output div.content td.text span.function { color:cyan; font-weight:bold; }
|
||||
fieldset.inner>div.output div.content td.text span.constant { color:magenta; }
|
||||
fieldset.inner>div.output div.content td.text span.string { color:magenta; }
|
||||
fieldset.inner>div.output div.content legend { margin-right:4px; float:left; }
|
||||
/* fieldset.inner>div.output div.profile>div.output>fieldset>legend { padding:0.1rem; float:left; } */
|
||||
/* fieldset.inner>div.output div.display { border:solid 1px greenyellow; } */
|
||||
|
||||
fieldset.inner div.output fieldset.toolkit { position:absolute; bottom:0px; right:0px; }
|
||||
fieldset.inner>div.output fieldset.toolkit>div.output>fieldset { display:none; background-color:#0e3369b3; }
|
||||
fieldset.inner>div.output td.content>div.tabs { display:none; }
|
||||
fieldset.inner>div.output td.content>div.path { display:none; }
|
||||
fieldset.inner div.output fieldset.toolkit { background-color:#0e3369b3; 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.select { display:block; }
|
||||
fieldset.inner>div.output fieldset.toolkit>div.output>fieldset>legend { float:left; }
|
||||
fieldset.inner>div.output fieldset.toolkit>div.status>legend { background:#0d969f8a; padding:4px 4px; border-left:solid 2px red; float:right; }
|
||||
fieldset.inner>div.output fieldset.toolkit>div.status>legend.select { background:green; }
|
||||
fieldset.inner>div.output fieldset.toolkit>div.status>legend:hover { background:green; }
|
||||
fieldset.inner>div.status legend { background:#0d969f8a; font-size:1.1rem; padding:0px 10px; border-left:solid 2px red; height:30px; cursor:pointer; float:right; }
|
||||
fieldset.inner>div.status legend { background-color:#0d969f8a; padding:0px 10px; border-left:solid 2px red; height:30px; float:right; }
|
||||
fieldset.inner>div.status legend.select { background-color:green; }
|
||||
fieldset.inner>div.status legend:hover { background-color:green; }
|
||||
fieldset.inner>div.status { height:31px; overflow:auto; }
|
||||
fieldset.inner>div.status legend.select { background:green; }
|
||||
fieldset.inner>div.status legend:hover { background:green; }
|
||||
|
||||
fieldset.inner.float legend { height:30px; }
|
||||
fieldset.inner.float div.output { background-color:#332f1ecf; }
|
||||
fieldset.inner.float div.status { color:white; }
|
||||
|
||||
fieldset.inner.Full>legend { display:none; }
|
||||
fieldset.inner.Full>form.option { display:none; }
|
||||
fieldset.inner.Full>div.action { display:none; }
|
||||
fieldset.inner.Full>div.status { display:none; }
|
||||
fieldset.inner.Full>div.output div.profile>div.action { display:none; }
|
||||
fieldset.inner.Full>div.output div.display>div.action { display:none; }
|
||||
fieldset.inner.Full>div.output div.display>div.status { display:none; }
|
||||
|
||||
body.white fieldset.inner>div.output div.project { color:#a2dad2; }
|
||||
body.white fieldset.inner>div.output div.content { background-color:#013b675c; }
|
||||
body.white fieldset.inner>div.output div.content td.text span.string { color:#a703a7; }
|
||||
|
||||
body.simple fieldset.inner>div.output td.content>div.tabs { background-color:#546E7A; padding:0px; height:38px; overflow:auto; display:block; }
|
||||
body.simple fieldset.inner>div.output td.content>div.tabs div.tabs { background-color:#69818d; font-family:monospace; padding:10px; height:18px; float:left; }
|
||||
body.simple fieldset.inner>div.output td.content>div.tabs div.tabs.select { background-color:#455A64; box-shadow:0px 0px 5px 1px grey; }
|
||||
body.simple fieldset.inner>div.output td.content>div.path { background-color:#455A64; color:white; padding:4px 10px; margin-bottom:4px; box-shadow:0px 0px 5px 1px #90A4AE; display:block; clear:both; }
|
||||
body.simple fieldset.inner>div.output div.content td.line { padding-top:4px; border-right:none; }
|
||||
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:lightyellow; }
|
||||
body.white.simple fieldset.inner>div.output div.project div.item { color:black; }
|
||||
body.white.simple fieldset.inner>div.output div.project div.item:hover { background-color:#e3e6f1; }
|
||||
body.white.simple fieldset.inner>div.output td.content>div.tabs { background-color:#f3f3f3; }
|
||||
body.white.simple fieldset.inner>div.output td.content>div.tabs div.tabs { background-color:#ececec; color:black; }
|
||||
body.white.simple fieldset.inner>div.output td.content>div.tabs div.tabs.select { background-color: white; box-shadow:0px 0px 5px 1px grey; }
|
||||
body.white.simple fieldset.inner>div.output td.content>div.path { background-color:white; color:black; box-shadow:0px 0px 5px 1px grey; }
|
||||
body.white.simple fieldset.inner>div.output div.content { background-color:white; color:black; }
|
||||
body.white.simple fieldset.inner>div.output div.content tr.select { background-color:white; }
|
||||
body.white.simple fieldset.inner>div.output div.content tr.select td.line { background-color:white; color:black; border:none; }
|
||||
body.white.simple fieldset.inner>div.output div.content tr.select td.text { border:solid 1px #e7e7e7; }
|
||||
body.white.simple fieldset.inner>div.output div.content td.text span.string { color:#a31515; }
|
||||
body.white.simple fieldset.inner>div.output div.content td.text span.function { color:#795e26; }
|
||||
body.white.simple fieldset.inner>div.output div.content td.text span.keyword { color:blue; }
|
||||
|
||||
body.mobile fieldset.inner.float legend { height:38px; }
|
||||
body.mobile fieldset.inner>form.option input[name=file] { width:90px; }
|
||||
body.mobile fieldset.plugin.inner div.action { display:none; }
|
||||
body.mobile.landscape fieldset.plugin.inner div.action { display:contents; }
|
||||
/* body.mobile.landscape fieldset.plugin.inner form.option input[type=button] { display:none; } */
|
||||
|
||||
body.mobile.simple fieldset.inner>div.output div.toggle { display:block; }
|
||||
body.mobile.simple fieldset.inner>div.output div.toggle { background-color:lightblue; width:30px; }
|
||||
body.mobile.simple fieldset.inner>div.output div.toggle.display { background-color:lightblue; margin-top:-33px; height:30px; width:100px; }
|
||||
|
||||
.unselectable {
|
||||
-webkit-touch-callout:none;
|
||||
@ -68,54 +71,3 @@ body.mobile.landscape fieldset.plugin.inner div.action { display:contents; }
|
||||
-o-user-select:none;
|
||||
user-select:none;
|
||||
}
|
||||
|
||||
fieldset.inner>div.output td.content>div.tabs { display:none; }
|
||||
fieldset.inner>div.output td.content>div.path { display:none; }
|
||||
|
||||
body.simple fieldset.inner>div.output td.content>div.tabs { background:#546E7A; padding:0px; height:38px; overflow:auto; display:block; }
|
||||
body.simple fieldset.inner>div.output td.content>div.tabs div.tabs { background:#69818d; color:white; font-size:1rem; padding:10px; float:left; }
|
||||
body.simple fieldset.inner>div.output td.content>div.tabs div.tabs.select { background:#455A64; box-shadow:0px 0px 5px 1px grey; }
|
||||
body.simple fieldset.inner>div.output td.content>div.path {
|
||||
background:#455A64; color:white; padding:4px 10px;
|
||||
margin-bottom:4px; box-shadow:0px 0px 5px 1px #90A4AE;
|
||||
clear:both; display:block;
|
||||
}
|
||||
|
||||
body.white fieldset.inner>div.output td.content>div.tabs { background:#f3f3f3; }
|
||||
body.white fieldset.inner>div.output td.content>div.tabs div.tabs { background:#ececec; color:black; font-size:1rem; padding:10px; float:left; }
|
||||
body.white fieldset.inner>div.output td.content>div.tabs div.tabs.select { background: white; box-shadow:0px 0px 5px 1px grey; }
|
||||
body.white fieldset.inner>div.output td.content>div.path { background:white; color:black; font-family:monospace; box-shadow:0px 0px 5px 1px grey; }
|
||||
|
||||
body.simple fieldset.inner>div.output td.project div.project { width:240px; }
|
||||
body.simple fieldset.inner>div.output td.project div.project div.kind { padding:10px; }
|
||||
body.simple fieldset.inner>div.output td.project div.project div.kind { color: white; font-size: 1.2rem; font-family: monospace; height:18px; }
|
||||
body.simple fieldset.inner>div.output td.project div.project div.kind:first-child { position:sticky; top:0 }
|
||||
body.simple fieldset.inner>div.output div.content { background-color:#263238c2; font-size:16px; }
|
||||
body.simple fieldset.inner>div.output div.toggle { display:none; }
|
||||
body.simple fieldset.inner>div.output div.toggle.profile { background-color:#664f4f45; display:block; }
|
||||
|
||||
body.white.simple fieldset.inner>div.output div.project div.action div.item { float:left; width:auto; padding:unset; }
|
||||
body.white.simple fieldset.inner>div.output div.project { background:lightyellow; }
|
||||
body.white.simple fieldset.inner>div.output div.project div.item { color:black; font-size:16px; width:-webkit-fill-available; }
|
||||
body.white.simple fieldset.inner>div.output div.project div.item:hover { background:#e3e6f1; }
|
||||
body.white.simple fieldset.inner>div.output div.content { background-color:white; font-size:16px; }
|
||||
body.white.simple fieldset.inner>div.output div.content tr.select { background-color:white; }
|
||||
body.white.simple fieldset.inner>div.output div.content tr.select td.line { background-color:white; color:black; border:none; }
|
||||
body.white.simple fieldset.inner>div.output div.content tr.select td.text { border:solid 1px #e7e7e7; }
|
||||
body.white.simple fieldset.inner>div.output div.content td.line { background-color:white; color:#237893; padding-top:4px; border-right:none; }
|
||||
body.white.simple fieldset.inner>div.output div.content td.text { color:black; padding-top:2px; border:solid 1px white; }
|
||||
body.white.simple fieldset.inner>div.output div.content td.text span.string { color:#a31515; }
|
||||
body.white.simple fieldset.inner>div.output div.content td.text span.function { color:#795e26; }
|
||||
body.white.simple fieldset.inner>div.output div.content td.text span.keyword { color:blue; }
|
||||
body.white.simple td.content>div.content { background: white; box-shadow:0px 0px 5px 1px grey; }
|
||||
body.white.simple div.status { color:black; }
|
||||
|
||||
body.white.simple fieldset.plugin div.output.json div.item span { color:black; }
|
||||
body.white.simple fieldset.plugin div.output.json div.item span.key { color:blue; }
|
||||
body.simple fieldset.plugin div.output.json div.item span.string { color:magenta; }
|
||||
|
||||
body.mobile.simple fieldset.inner>div.output div.toggle { display:block; }
|
||||
body.mobile.simple fieldset.inner>div.output div.toggle { background-color:lightblue; width:30px; }
|
||||
body.mobile.simple fieldset.inner>div.output div.toggle.display { background-color:lightblue; margin-top:-33px; height:30px; width:100px; }
|
||||
|
||||
fieldset.story.inner>div.action { display:none; }
|
||||
|
@ -1,7 +1,8 @@
|
||||
Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, target) {
|
||||
var paths = can.core.Split(can.Option(nfs.PATH), ice.FS); can.Option(nfs.PATH, paths[0])
|
||||
var files = can.core.Split(can.Option(nfs.FILE), ice.FS); can.Option(nfs.FILE, files[0])
|
||||
can.tabview = can.tabview||{}, can.history = can.history||[], can.toolkit = {}, can.extentions = {}, can.profile_size = {}
|
||||
can.tabview = can.tabview||{}, can.history = can.history||[], can.toolkit = {}, can.extentions = {}
|
||||
can.profile_size = {}, can.display_size = {}
|
||||
|
||||
can.onmotion.clear(can), can.onlayout.profile(can)
|
||||
can.page.styleWidth(can, can.ui.project, 180)
|
||||
@ -18,6 +19,7 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
||||
default: if (can.ConfHeight() < 320) { can.ConfHeight(320) }
|
||||
can.onimport.project(can, paths), can.onengine.plugin(can, can.onplugin)
|
||||
can.user.isMobile && !can.user.isLandscape() && can.onmotion.hidden(can, can.ui.project)
|
||||
|
||||
can.onimport._toolkit(can, can.ui.toolkit), can.onimport._session(can, msg, function() {
|
||||
files.length > 1 && can.onmotion.delay(can, function() { can.core.Next(files.slice(1), function(file, next) {
|
||||
can.onimport.tabview(can, can.Option(nfs.PATH), file, can.Option(nfs.LINE), next)
|
||||
@ -59,8 +61,8 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
||||
cli.EXEC, function(event) { can.onaction[cli.EXEC](event, can) },
|
||||
mdb.PLUGIN, function(event) { can.user.input(event, can, [ctx.INDEX, ctx.ARGS], function(data) { can.onimport.plugin(can, data, ui.output) }) },
|
||||
html.HEIGHT, function(event) {
|
||||
can.user.input(event, can, [{name: html.HEIGHT, value: can.profile_size[can.onexport.keys(can)]*100/can.ConfHeight()||50}], function(list) {
|
||||
can.profile_size[can.onexport.keys(can)] = can.ConfHeight()*parseInt(list[0])/100
|
||||
can.user.input(event, can, [{name: html.HEIGHT, value: can.display_size[can.onexport.keys(can)]*100/can.ConfHeight()||50}], function(list) {
|
||||
can.display_size[can.onexport.keys(can)] = can.ConfHeight()*parseInt(list[0])/100
|
||||
can.onaction[cli.EXEC](event, can)
|
||||
})
|
||||
}
|
||||
@ -92,12 +94,6 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
||||
can.ui._path = can.page.insertBefore(can, [{view: "path"}], can.ui.content)
|
||||
},
|
||||
|
||||
plugin: function(can, meta, target, cb) { meta.type = "plug"
|
||||
can.onappend.plugin(can, meta, function(sub) {
|
||||
sub.run = function(event, cmds, cb) { can.runActionCommand(can.request(event, can.Option()), meta.index, cmds, cb) }
|
||||
can.base.isFunc(cb) && cb(sub)
|
||||
}, target)
|
||||
},
|
||||
layout: function(can) { if (can.isSimpleMode()) { return }
|
||||
if (can.isFloatMode()) { can.onmotion.hidden(can, can._action), can.onmotion.hidden(can, can.ui.project) }
|
||||
|
||||
@ -112,11 +108,13 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
||||
if (can.isCmdMode()) {
|
||||
var rest = can.ui.display.offsetHeight+can.ui._tabs.offsetHeight+can.ui._path.offsetHeight+4
|
||||
can.page.styleHeight(can, can.ui.content, height+2*html.ACTION_HEIGHT-rest)
|
||||
can.page.styleHeight(can, can.ui.profile_output, height+html.ACTION_HEIGHT)
|
||||
can.page.styleHeight(can, can.ui.profile_output, height+html.ACTION_HEIGHT-can.ui.display.offsetHeight)
|
||||
can.page.styleHeight(can, can.ui.project, height+2*html.ACTION_HEIGHT)
|
||||
} else { var rest = can.ui.display.offsetHeight; if (height < 320) { height = 320 }
|
||||
can.isFullMode() || (can._min_height = can._min_height||height, height >= can._min_height && (can._min_height = height))
|
||||
if (!can.isFullMode()) {
|
||||
can._min_height = can._min_height||height, height >= can._min_height && (can._min_height = height)
|
||||
can.page.style(can, can.ui.content, html.MIN_HEIGHT, can._min_height)
|
||||
}
|
||||
can.page.style(can, can.ui.content, can.user.isMobile? html.HEIGHT: html.MAX_HEIGHT, height-rest)
|
||||
can.page.styleHeight(can, can.ui.profile_output, can.ui.content.offsetHeight-html.ACTION_HEIGHT)
|
||||
can.page.styleHeight(can, can.ui.project, can.ui.content.offsetHeight+rest)
|
||||
@ -141,8 +139,7 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
||||
can.onimport.tabview(can, path, item.path) // 显示文件
|
||||
}, view), can.Status("文件数", total += msg.Length())
|
||||
}, true)
|
||||
}} }), view)
|
||||
path.length == 1 && can.onmotion.delay(can, function() { view.previousSibling.innerHTML = "" })
|
||||
}} }), view); can.onmotion.delay(can, function() { view.previousSibling.innerHTML = "" })
|
||||
}},
|
||||
{name: "module", _init: function(view) {
|
||||
can.runAction(can.request({}, {fields: ctx.INDEX}), ctx.COMMAND, [mdb.SEARCH, ctx.COMMAND], function(msg) {
|
||||
@ -152,14 +149,14 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
||||
})
|
||||
}},
|
||||
{name: "plugin", _init: function(view) {
|
||||
can.onimport.tree(can, can.core.Item(can.onengine.plugin.meta, function(key) { return {index: can.base.trimPrefix(key, "can.")} }), ctx.INDEX, ice.PT, function(event, item) {
|
||||
can.onimport.tree(can, can.core.Item(can.onengine.plugin.meta, function(key) { return {index: key} }), ctx.INDEX, ice.PT, function(event, item) {
|
||||
can.onimport.tabview(can, can.Option(nfs.PATH), item.index, ctx.INDEX) // 显示插件
|
||||
}, view)
|
||||
}},
|
||||
], can.ui.project)
|
||||
},
|
||||
tabview: function(can, path, file, line, cb, skip, skip2) { var key = can.onexport.keys(can, file, path)
|
||||
if (can.isCmdMode()) { location.hash = file+","+(line||1) }
|
||||
if (can.isCmdMode()) { location.hash = file+ice.FS+(line||1) }
|
||||
if (!skip && can.tabview[key]) { can.isCmdMode() && can.user.title(path+file)
|
||||
can._msg && can._msg.Option(nfs.LINE, can.Option(nfs.LINE)), can._msg = can.tabview[key]
|
||||
can.Option({path: path, file: file, line: line||can._msg.Option(nfs.LINE)||1})
|
||||
@ -177,20 +174,24 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
||||
},
|
||||
profile: function(can, msg) {
|
||||
var width = can.profile_size[can.onexport.keys(can)]||(can.ConfWidth()-can.ui.project.offsetWidth)/2
|
||||
msg && can.onimport.process(can, msg, can.ui.profile_output, width)
|
||||
msg && can.onmotion.delay(can, function() {
|
||||
can.onimport.process(can, msg, can.ui.profile_output, width, can.ui.profile.offsetHeight)
|
||||
can.onmotion.toggle(can, can.ui.profile, true), can.onimport.layout(can)
|
||||
}), can.onmotion.toggle(can, can.ui.profile, true), can.onimport.layout(can)
|
||||
},
|
||||
display: function(can, msg) {
|
||||
var height = can.profile_size[can.onexport.keys(can)]||{sh: can.ConfHeight()/2}[can.parse]||can.ConfHeight()/4
|
||||
msg && can.onimport.process(can, msg, can.ui.display_output, can.ConfWidth())
|
||||
can.page.style(can, can.ui.display_output, html.MAX_HEIGHT, height)
|
||||
var height = can.display_size[can.onexport.keys(can)]||{sh: can.ConfHeight()/2}[can.parse]||can.ConfHeight()/4
|
||||
msg && can.onmotion.delay(can, function() {
|
||||
can.onimport.process(can, msg, can.ui.display_output, can.ui.display.offsetWidth, height)
|
||||
can.onappend._status(can, msg.Option(ice.MSG_STATUS), can.ui.display_status)
|
||||
can.onmotion.toggle(can, can.ui.display, true), can.onimport.layout(can)
|
||||
}), can.onmotion.toggle(can, can.ui.display, true), can.onimport.layout(can)
|
||||
},
|
||||
process: function(can, msg, target, width) {
|
||||
process: function(can, msg, target, width, height) {
|
||||
can.onmotion.clear(can, target), can.user.toastSuccess(can)
|
||||
if (msg.Option(ice.MSG_PROCESS) == "_field") {
|
||||
msg.Table(function(meta) { meta.display = msg.Option(ice.MSG_DISPLAY)
|
||||
can.onimport.plugin(can, meta, target, function(sub) { width && sub.ConfWidth(width), sub.Focus() })
|
||||
can.onimport.plugin(can, meta, target, function(sub) { width && sub.ConfWidth(width), height && sub.ConfHeight(height), sub.Focus() })
|
||||
})
|
||||
} else if (msg.Option(ice.MSG_DISPLAY) != "") {
|
||||
can.onappend._output(can, msg, msg.Option(ice.MSG_DISPLAY), target, false, function(msg) { can.onimport.layout(can) })
|
||||
@ -204,13 +205,8 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
||||
sub.ConfHeight(can.ConfHeight()-4*html.ACTION_HEIGHT), sub.ConfWidth(can.ConfWidth())
|
||||
sub.page.style(sub, sub._output, html.MAX_HEIGHT, sub.ConfHeight())
|
||||
sub.page.style(sub, sub._output, html.MAX_WIDTH, sub.ConfWidth())
|
||||
sub.select = function() {
|
||||
return sub._legend.click(), sub
|
||||
}
|
||||
sub.onaction.close = function() { sub.select() }
|
||||
|
||||
can._status.appendChild(sub._legend), sub._legend.onclick = function(event) {
|
||||
if (meta.msg == true) { meta.msg = false, sub.Update() }
|
||||
if (can.page.Select(can, can._status, ice.PT+html.SELECT)[0] == event.target) {
|
||||
can.page.ClassList.del(can, event.target, html.SELECT)
|
||||
can.page.ClassList.del(can, sub._target, html.SELECT)
|
||||
@ -218,7 +214,11 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
||||
}
|
||||
can.onmotion.select(can, can.ui.toolkit.output, html.FIELDSET, sub._target), sub.Focus()
|
||||
can.onmotion.select(can, can._status, html.LEGEND, event.target)
|
||||
}, can.base.isFunc(cb) && cb(sub), sub._legend.onmouseenter = null
|
||||
if (meta.msg == true) { meta.msg = false, sub.Update() }
|
||||
}, sub.select = function() { return sub._legend.click(), sub }
|
||||
sub.onaction.close = function() { sub.select() }
|
||||
sub._legend.onmouseenter = null
|
||||
can.base.isFunc(cb) && cb(sub)
|
||||
})
|
||||
},
|
||||
exts: function(can, url, cb) {
|
||||
@ -226,35 +226,6 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
||||
can.extentions[url.split("?")[0]] = sub, can.base.isFunc(cb) && cb(sub)
|
||||
}) })
|
||||
},
|
||||
tabs: function(can, list, cb, cbs, action, each) { action = action||can._action
|
||||
return can.page.Append(can, action, can.core.List(list, function(meta) {
|
||||
return {text: [meta.name, html.DIV, html.TABS], title: meta.text, onclick: function(event) {
|
||||
can.onmotion.select(can, action, html.DIV_TABS, event.target)
|
||||
can.base.isFunc(cb) && cb(event, meta)
|
||||
}, _init: function(item) { const OVER = "over"
|
||||
function close(item) { var next = item.nextSibling||item.previousSibling
|
||||
item._close(item) || can.page.Remove(can, item), next && next.click()
|
||||
}
|
||||
can.page.Modify(can, item, {draggable: true, _close: cbs,
|
||||
onmouseenter: function(event) {
|
||||
can.user.carte(event, can, kit.Dict(
|
||||
"close tab", function(event) { close(item) },
|
||||
"close other", function(event) {
|
||||
can.page.Select(can, action, html.DIV_TABS, function(_item) { _item == item || close(_item) })
|
||||
},
|
||||
"close all", function(event) { can.page.Select(can, action, html.DIV_TABS, close) }
|
||||
), ["close tab", "close other", "close all"])
|
||||
},
|
||||
ondragstart: function(event) { var target = event.target; target.click()
|
||||
action._drop = function(event, before) { action.insertBefore(target, before) }
|
||||
},
|
||||
ondragover: function(event) { event.preventDefault(), action._drop(event, event.target) },
|
||||
ondrop: function(event) { event.preventDefault(), action._drop(event, event.target) },
|
||||
}), can.core.Timer(10, function() { item.click() })
|
||||
can.base.isFunc(each) && each(item)
|
||||
}}
|
||||
})).first
|
||||
},
|
||||
sess: function(can, sess, cb) { sess = sess||can.user.localStorage(can, "web.code.inner.sess")
|
||||
can.core.Next(sess.plug, function(item, next) { can.onimport.toolkit(can, {index: item}, function(sub) { can.toolkit[item] = sub, next() }) }, function() {
|
||||
can.core.Next(sess.exts, function(item, next) { can.onimport.exts(can, item, next) }, function() {
|
||||
@ -287,11 +258,7 @@ Volcanos(chat.ONPLUGIN, {help: "注册插件",
|
||||
})
|
||||
Volcanos(chat.ONSYNTAX, {help: "语法高亮", list: ["keyword", "prefix", "line"], _init: function(can, msg, cb, skip) {
|
||||
if (can.isCmdMode()) {
|
||||
if (msg.Option(ctx.INDEX)) {
|
||||
can.ui._path.innerText = msg.Option(nfs.FILE)
|
||||
} else {
|
||||
can.ui._path.innerText = can.base.Path(msg.Option(nfs.PATH), msg.Option(nfs.FILE))
|
||||
}
|
||||
can.ui._path.innerText = msg.Option(ctx.INDEX)? msg.Option(nfs.FILE): can.base.Path(msg.Option(nfs.PATH), msg.Option(nfs.FILE))
|
||||
}
|
||||
|
||||
if (can.onmotion.cache(can, function(cache_data) {
|
||||
@ -304,8 +271,8 @@ Volcanos(chat.ONSYNTAX, {help: "语法高亮", list: ["keyword", "prefix", "line
|
||||
var p = cache_data[can.file]; p && (can.current = p.current, can.max = p.max)
|
||||
can.page.style(can, can.ui.profile, {display: p? p.profile_display: html.NONE})
|
||||
can.page.style(can, can.ui.display, {display: p? p.display_display: html.NONE})
|
||||
can.onmotion.select(can, can._action, html.DIV_TABS, msg._tab)
|
||||
can.onmotion.select(can, can.ui._tabs, html.DIV_TABS, msg._tab)
|
||||
can.onmotion.select(can, can._action, html.DIV_TABS, msg._tab)
|
||||
can.onmotion.delay(can, function() { can.onimport.layout(can)
|
||||
msg.Option(ctx.INDEX) && can.onmotion.focus(can, can.page.Select(can, can.ui.content, html.OPTION_ARGS)[0])
|
||||
})
|
||||
@ -314,29 +281,22 @@ Volcanos(chat.ONSYNTAX, {help: "语法高亮", list: ["keyword", "prefix", "line
|
||||
return can.onaction.selectLine(null, can, msg.Option(nfs.LINE)), can.base.isFunc(cb) && cb()
|
||||
}
|
||||
|
||||
if (msg.Option(ctx.INDEX)) {
|
||||
// can.onmotion.clear(can, can.ui.content)
|
||||
can.onimport.plugin(can, {index: msg.Option(ctx.INDEX)}, can.ui.content, function(sub) {
|
||||
can.onimport.layout(can)
|
||||
can.page.style(can, sub._output, html.MAX_WIDTH, sub.ConfWidth(can.ui.content.offsetWidth-40))
|
||||
can.onmotion.clear(can, can.ui.content), can.onimport.layout(can)
|
||||
if (msg.Option(ctx.INDEX)) { return can.onimport.plugin(can, {index: msg.Option(ctx.INDEX)}, can.ui.content, function(sub) {
|
||||
can.page.style(can, sub._output, html.MAX_HEIGHT, sub.ConfHeight(can.ui.content.offsetHeight-2*html.ACTION_HEIGHT))
|
||||
can.onmotion.delay(can, function() {
|
||||
can.onmotion.focus(can, can.page.Select(can, can.ui.content, html.OPTION_ARGS)[0])
|
||||
}), can.base.isFunc(cb) && cb()
|
||||
})
|
||||
return
|
||||
}
|
||||
can.page.style(can, sub._output, html.MAX_WIDTH, sub.ConfWidth(can.ui.content.offsetWidth))
|
||||
can.onmotion.delay(can, function() { sub.Focus() }), can.base.isFunc(cb) && cb()
|
||||
}) }
|
||||
|
||||
function init(p) {
|
||||
can.max = 0, can.core.List(can.ls = msg.Result().split(ice.NL), function(item) { can.onaction.appendLine(can, item) })
|
||||
can.onaction.selectLine(null, can, msg.Option(nfs.LINE)), can.base.isFunc(cb) && cb()
|
||||
|
||||
can.onmotion.clear(can, can.ui.content)
|
||||
function init(p) { can.max = 0, can.core.List(can.ls = msg.Result().split(ice.NL), function(item) {
|
||||
can.onaction.appendLine(can, item)
|
||||
}), can.onaction.selectLine(null, can, msg.Option(nfs.LINE)), can.base.isFunc(cb) && cb()
|
||||
msg.Option(nfs.FILE).indexOf("website/") == 0 && can.onaction[cli.SHOW]({}, can)
|
||||
if (can.page.ClassList.has(can, can._fields, chat.PLUGIN)) {
|
||||
p && p.render && can.onaction[cli.SHOW]({}, can)
|
||||
p && p.engine && can.onaction[cli.EXEC]({}, can)
|
||||
}
|
||||
can.onimport.layout(can)
|
||||
}
|
||||
can.Conf("plug") && (can.onsyntax[can.parse] = can.Conf("plug"))
|
||||
var p = can.onsyntax[can.parse]; !p? can.runAction({}, mdb.PLUGIN, [can.parse, msg.Option(nfs.FILE), msg.Option(nfs.PATH)], function(msg) {
|
||||
@ -350,7 +310,7 @@ Volcanos(chat.ONSYNTAX, {help: "语法高亮", list: ["keyword", "prefix", "line
|
||||
var p = can.onsyntax[can.parse]; if (!p) { return line } p = can.onsyntax[p.link]||p, p.split = p.split||{}
|
||||
p.keyword && (line = can.core.List(can.core.Split(line, p.split.space||"\t ", p.split.operator||"{[(.,:;!|<>)]}", {detail: true}), function(item, index, array) {
|
||||
item = can.base.isObject(item)? item: {text: item}
|
||||
var text = item.text; var type = item.keyword||p.keyword[text]
|
||||
var text = item.text, type = item.keyword||p.keyword[text]
|
||||
|
||||
switch (item.type) { case html.SPACE: return text
|
||||
case lang.STRING: return wrap(lang.STRING, item.left+text+item.right)
|
||||
@ -359,13 +319,7 @@ Volcanos(chat.ONSYNTAX, {help: "语法高亮", list: ["keyword", "prefix", "line
|
||||
}).join(""))
|
||||
|
||||
p.prefix && can.core.Item(p.prefix, function(pre, type) {
|
||||
if (can.base.beginWith(line, pre)) {
|
||||
line = wrap(type, line)
|
||||
} else {
|
||||
var ls = line.split(pre); if (ls.length > 1) {
|
||||
line = ls[0] + wrap(type, pre + ls[1])
|
||||
}
|
||||
}
|
||||
if (can.base.beginWith(line, pre)) { line = wrap(type, line) }
|
||||
})
|
||||
p.suffix && can.core.Item(p.suffix, function(end, type) {
|
||||
if (can.base.endWith(line, end)) { line = wrap(type, line) }
|
||||
@ -373,27 +327,20 @@ Volcanos(chat.ONSYNTAX, {help: "语法高亮", list: ["keyword", "prefix", "line
|
||||
return line
|
||||
},
|
||||
})
|
||||
Volcanos(chat.ONKEYMAP, {help: "导入数据", _init: function(can, msg, cb, target) {
|
||||
},
|
||||
Volcanos(chat.ONKEYMAP, {help: "导入数据",
|
||||
_plugin: function(event, can) {},
|
||||
_normal: function(event, can) {},
|
||||
_insert: function(event, can) {},
|
||||
_mode: {
|
||||
plugin: {
|
||||
Escape: shy(cli.CLEAR, function(event, can) { can.actions(event, cli.CLEAR) }),
|
||||
g: shy("搜索", function(event, can) { can.actions(event, "搜索") }),
|
||||
f: shy("打开文件", function(event, can) { can.actions(event, "打开") }),
|
||||
t: shy("添加命令", function(event, can) { can.actions(event, "添加") }),
|
||||
p: shy("添加插件", function(event, can) { can.actions(event, "插件") }),
|
||||
e: shy("添加扩展", function(event, can) { can.actions(event, "扩展") }),
|
||||
|
||||
m: function(event, can) { can.actions(event, "autogen") },
|
||||
c: function(event, can) { can.actions(event, "compile") },
|
||||
w: function(event, can) { can.actions(event, "website") },
|
||||
|
||||
r: shy(cli.EXEC, function(event, can) { can.actions(event, cli.EXEC) }),
|
||||
v: shy(cli.SHOW, function(event, can) { can.actions(event, cli.SHOW) }),
|
||||
a: shy("全屏", function(event, can) { can.actions(event, "全屏") }),
|
||||
Escape: shy(cli.CLEAR, function(event, can) { can.onaction.clear(event, can) }),
|
||||
g: shy("搜索", function(event, can) { can.onaction["搜索"](event, can) }),
|
||||
f: shy("打开文件", function(event, can) { can.onaction["打开"](event, can) }),
|
||||
t: shy("添加命令", function(event, can) { can.onaction["添加"](event, can) }),
|
||||
p: shy("添加插件", function(event, can) { can.onaction["插件"](event, can) }),
|
||||
e: shy("添加扩展", function(event, can) { can.onaction["扩展"](event, can) }),
|
||||
r: shy("执行命令", function(event, can) { can.onaction[cli.EXEC](event, can) }),
|
||||
v: shy("渲染界面", function(event, can) { can.onaction[cli.SHOW](event, can) }),
|
||||
|
||||
j: function(event, can) { can.current.scroll(1) },
|
||||
k: function(event, can) { can.current.scroll(-1) },
|
||||
@ -408,11 +355,6 @@ Volcanos(chat.ONKEYMAP, {help: "导入数据", _init: function(can, msg, cb, tar
|
||||
})
|
||||
Volcanos(chat.ONACTION, {help: "控件交互", list: ["搜索", "打开", "添加", "插件", "扩展"],
|
||||
_trans: {width: "宽度", height: "高度", website: "网页"},
|
||||
load: function(event, can) {
|
||||
var file = can.base.Path("/require/", can.Option(nfs.PATH), can.Option(nfs.FILE))
|
||||
delete(Volcanos.meta.cache[file]), eval("\n_can_name = \""+file+"\"\n"+can.onexport.content(can)+"\n_can_name = \"\"\nconsole.log(\"once\")")
|
||||
},
|
||||
"刷新": function(event, can) { can.onimport.tabview(can, "src/", "main.go", "", function() {}, skip) },
|
||||
"搜索": function(event, can) {
|
||||
can.user.input(event, can, [mdb.NAME, [ctx.ACTION, nfs.TAGS, nfs.GREP, cli.MAKE]], function(data) {
|
||||
can.ui.search.Update({}, [ctx.ACTION, data.action, data.name])
|
||||
@ -421,7 +363,6 @@ Volcanos(chat.ONACTION, {help: "控件交互", list: ["搜索", "打开", "添
|
||||
"打开": function(event, can) {
|
||||
can.user.input(event, can, [nfs.FILE], function(list) {
|
||||
can.onimport.tabview(can, can.Option(nfs.PATH), list[0])
|
||||
can.onimport.project(can, can.Option(nfs.PATH))
|
||||
})
|
||||
},
|
||||
"添加": function(event, can) {
|
||||
@ -430,65 +371,47 @@ Volcanos(chat.ONACTION, {help: "控件交互", list: ["搜索", "打开", "添
|
||||
})
|
||||
},
|
||||
"插件": function(event, can) {
|
||||
can.user.input(event, can, [ctx.INDEX], function(data) {
|
||||
var sub = can.toolkit[data.index]; if (sub) { sub.select(); return }
|
||||
can.onimport.toolkit(can, data, function(sub) { can.toolkit[data.index] = sub.select() })
|
||||
can.user.input(event, can, [ctx.INDEX], function(list) {
|
||||
var sub = can.toolkit[list[0]]; if (sub) { sub.select(); return }
|
||||
can.onimport.toolkit(can, {index: list[0]}, function(sub) { can.toolkit[list[0]] = sub.select() })
|
||||
})
|
||||
},
|
||||
"扩展": function(event, can) {
|
||||
can.user.input(event, can, ["url"], function(data) {
|
||||
var sub = can.extentions[data.url]; if (sub) { sub.select(); return }
|
||||
can.onimport.exts(can, data.url, function(sub) { can.extentions[data.url] = sub.select() })
|
||||
can.user.input(event, can, ["url"], function(list) {
|
||||
var sub = can.extentions[list[0]]; if (sub) { sub.select(); return }
|
||||
can.onimport.exts(can, list[0], function(sub) { can.extentions[list[0]] = sub.select() })
|
||||
})
|
||||
},
|
||||
"保存": function(event, can) { can.onexport.sess(can), can.user.toastSuccess(can) },
|
||||
"项目": function(event, can) { can.onmotion.toggle(can, can.ui.project), can.onimport.layout(can) },
|
||||
"工具": function(event, can) { can.onmotion.toggle(can, can.ui.toolkit.fieldset) },
|
||||
exec: function(event, can) { can.onimport.display(can), can.request(event, {_toast: "执行中..."})
|
||||
can.runAction(event, mdb.ENGINE, [can.parse, can.Option(nfs.FILE), can.Option(nfs.PATH)], function(msg) {
|
||||
can.onappend._status(can, msg.Option(ice.MSG_STATUS), can.ui.display_status)
|
||||
can.onimport.display(can, msg), can.onimport.layout(can)
|
||||
})
|
||||
sess: function(event, can) {
|
||||
can.onexport.sess(can), can.user.toastSuccess(can)
|
||||
},
|
||||
show: function(event, can) { can.onimport.profile(can), can.request(event, {_toast: "渲染中..."})
|
||||
if (can.Option(nfs.FILE).indexOf("website/") == 0) {
|
||||
can.profile_size[can.onexport.keys(can)] = can.profile_size[can.onexport.keys(can)] || can.ConfWidth()*parseInt(70)/100
|
||||
}
|
||||
can.parse == nfs.JS && can.onaction[nfs.LOAD](event, can)
|
||||
load: function(event, can) {
|
||||
var file = can.base.Path("/require/", can.Option(nfs.PATH), can.Option(nfs.FILE))
|
||||
delete(Volcanos.meta.cache[file]), eval("\n_can_name = \""+file+"\"\n"+can.onexport.content(can)+"\n_can_name = \"\"\nconsole.log(\"once\")")
|
||||
can.runAction(event, mdb.RENDER, [can.parse, can.Option(nfs.FILE), can.Option(nfs.PATH)], function(msg) {
|
||||
can.onimport.profile(can, msg)
|
||||
})
|
||||
},
|
||||
show: function(event, can) { can.request(event, {_toast: "渲染中..."})
|
||||
can.runAction(event, mdb.RENDER, [can.parse, can.Option(nfs.FILE), can.Option(nfs.PATH)], function(msg) {
|
||||
can.onimport.profile(can, msg)
|
||||
})
|
||||
},
|
||||
exec: function(event, can) { can.request(event, {_toast: "执行中..."})
|
||||
can.runAction(event, mdb.ENGINE, [can.parse, can.Option(nfs.FILE), can.Option(nfs.PATH)], function(msg) {
|
||||
can.onimport.display(can, msg)
|
||||
})
|
||||
},
|
||||
clear: function(event, can) {
|
||||
if (can.page.Select(can, can._root._target, ".input.float", function(item) {
|
||||
return can.page.Remove(can, item)
|
||||
}).length > 0) { return }
|
||||
|
||||
if (can.page.Select(can, can.ui.toolkit.status, "legend.select", function(item) {
|
||||
return item.click(), item
|
||||
}).length > 0) { return }
|
||||
if (can.page.Select(can, can._status, "legend.select", function(item) {
|
||||
return item.click(), item
|
||||
}).length > 0) { return }
|
||||
if (can.page.Select(can, can._root._target, ".input.float", function(item) { return can.page.Remove(can, item) }).length > 0) { return }
|
||||
if (can.page.Select(can, can._status, "legend.select", function(item) { return item.click(), item }).length > 0) { return }
|
||||
|
||||
if (can.ui.profile.style.display == "") {
|
||||
can.onmotion.hidden(can, can.ui.profile)
|
||||
} else if (can.ui.display.style.display == "") {
|
||||
can.onmotion.hidden(can, can.ui.display)
|
||||
} else if (can.ui.project.style.display == "") {
|
||||
can.onmotion.hidden(can, can.ui.project)
|
||||
} else {
|
||||
can.onaction["全屏"](event, can)
|
||||
}
|
||||
can.onimport.layout(can)
|
||||
},
|
||||
"全屏": function(event, can) {
|
||||
if (can.page.ClassList.neg(can, can._fields, "Full")) {
|
||||
can.onmotion.hidden(can, can.ui.project)
|
||||
can.ConfHeight(can._root._height)
|
||||
} else {
|
||||
can.onmotion.toggle(can, can.ui.project, true)
|
||||
can.ConfHeight(can._root._height-2*html.ACTION_HEIGHT)
|
||||
can.onmotion.toggle(can, can.ui.project)
|
||||
}
|
||||
can.onimport.layout(can)
|
||||
},
|
||||
@ -583,9 +506,7 @@ Volcanos(chat.ONACTION, {help: "控件交互", list: ["搜索", "打开", "添
|
||||
})
|
||||
Volcanos(chat.ONEXPORT, {help: "导出数据", list: ["文件数", "解析器", "文件名", "当前行", "跳转数", "标签数"],
|
||||
sess: function(can) {
|
||||
can.user.localStorage(can, "web.code.inner.sess", {
|
||||
"plug": can.onexport.plug(can), "exts": can.onexport.exts(can), "tabs": can.onexport.tabs(can),
|
||||
})
|
||||
can.user.localStorage(can, "web.code.inner.sess", {"plug": can.onexport.plug(can), "exts": can.onexport.exts(can), "tabs": can.onexport.tabs(can)})
|
||||
},
|
||||
keys: function(can, file, path) { return (path||can.Option(nfs.PATH))+":"+(file||can.Option(nfs.FILE)) },
|
||||
tabs: function(can) { return can.core.Item(can.tabview, function(key, msg) { return key+ice.DF+msg.Option(nfs.LINE) }) },
|
||||
|
@ -89,4 +89,39 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
||||
})
|
||||
}); return node
|
||||
},
|
||||
tabs: function(can, list, cb, cbs, action, each) { action = action||can._action
|
||||
return can.page.Append(can, action, can.core.List(list, function(meta) {
|
||||
return {text: [meta.name, html.DIV, html.TABS], title: meta.text, onclick: function(event) {
|
||||
can.onmotion.select(can, action, html.DIV_TABS, event.target)
|
||||
can.base.isFunc(cb) && cb(event, meta)
|
||||
}, _init: function(item) { const OVER = "over"
|
||||
function close(item) { var next = item.nextSibling||item.previousSibling
|
||||
item._close(item) || can.page.Remove(can, item), next && next.click()
|
||||
}
|
||||
can.page.Modify(can, item, {draggable: true, _close: cbs,
|
||||
onmouseenter: function(event) {
|
||||
can.user.carte(event, can, kit.Dict(
|
||||
"close tab", function(event) { close(item) },
|
||||
"close other", function(event) {
|
||||
can.page.Select(can, action, html.DIV_TABS, function(_item) { _item == item || close(_item) })
|
||||
},
|
||||
"close all", function(event) { can.page.Select(can, action, html.DIV_TABS, close) }
|
||||
), ["close tab", "close other", "close all"])
|
||||
},
|
||||
ondragstart: function(event) { var target = event.target; target.click()
|
||||
action._drop = function(event, before) { action.insertBefore(target, before) }
|
||||
},
|
||||
ondragover: function(event) { event.preventDefault(), action._drop(event, event.target) },
|
||||
ondrop: function(event) { event.preventDefault(), action._drop(event, event.target) },
|
||||
}), can.core.Timer(10, function() { item.click() })
|
||||
can.base.isFunc(each) && each(item)
|
||||
}}
|
||||
})).first
|
||||
},
|
||||
plugin: function(can, meta, target, cb) { meta.type = "plug"
|
||||
can.onappend.plugin(can, meta, function(sub) {
|
||||
sub.run = function(event, cmds, cb) { can.runActionCommand(can.request(event, can.Option()), meta.index, cmds, cb) }
|
||||
can.base.isFunc(cb) && cb(sub)
|
||||
}, target)
|
||||
},
|
||||
})
|
||||
|
2
proto.js
2
proto.js
@ -70,7 +70,7 @@ var cli = {
|
||||
MAKE: "make", MAIN: "main", EXEC: "exec", DONE: "done",
|
||||
CODE: "code", COST: "cost", BACK: "back", FROM: "from",
|
||||
ERROR: "error", CLEAR: "clear", REFRESH: "refresh",
|
||||
SHOW: "show",
|
||||
SHOW: "show", FULL: "full",
|
||||
}
|
||||
var nfs = {
|
||||
ZML: "zml", IML: "iml", TXT: "txt",
|
||||
|
Loading…
x
Reference in New Issue
Block a user