forked from x/volcanos
opt onappend
This commit is contained in:
parent
d107762a55
commit
65b749e9bb
51
frame.js
51
frame.js
@ -13,8 +13,9 @@ Volcanos(chat.ONENGINE, {_init: function(can, meta, list, cb, target) {
|
||||
can.core.ItemCB(sub.onaction, function(key, cb) { can.onengine.listen(can, key, function(msg) { can.core.CallFunc(cb, {can: sub, msg: msg}) }) })
|
||||
can.core.CallFunc([sub.onaction, chat._INIT], {can: sub, cb: next, target: sub._target})
|
||||
}, target)
|
||||
}, function() { can.onlayout._init(can, target), can.onmotion._init(can, target), can.onkeymap._init(can, target), can.misc.Info(can.user.title(), ice.RUN, can)
|
||||
}, function() { can.onlayout._init(can, target), can.onmotion._init(can, target), can.onkeymap._init(can, target)
|
||||
can.onengine.listen(can, chat.ONSEARCH, function(msg, arg) { arg[0] == ctx.COMMAND && can.run(msg, ["can.command"]) })
|
||||
can._path = location.href
|
||||
can.onengine.signal(can, chat.ONMAIN, can.request()), can.base.isFunc(cb) && cb(can)
|
||||
})
|
||||
can.onappend.topic(can, "dark", {topic: "black", plugin: "black", legend: "#212121", input: "#212121", output: "#0d1117", table: "black",
|
||||
@ -69,7 +70,7 @@ Volcanos(chat.ONENGINE, {_init: function(can, meta, list, cb, target) {
|
||||
}),
|
||||
listen: shy(function(can, name, cb) { arguments.callee.meta[name] = (arguments.callee.meta[name]||[]).concat(cb) }),
|
||||
signal: function(can, name, msg) { msg = msg||can.request(); var _msg = name == chat.ONREMOTE? msg.Option("_msg"): msg
|
||||
_msg.Option(ice.LOG_DISABLE) == ice.TRUE || can.misc.Log(gdb.SIGNAL, name, can._name, (msg._cmds||[]).join(ice.SP), _msg)
|
||||
_msg.Option(ice.LOG_DISABLE) == ice.TRUE || can.misc.Log(name, can._name, (msg._cmds||[]).join(ice.SP), name == chat.ONMAIN? can: _msg)
|
||||
return can.core.List(can.onengine.listen.meta[name], function(cb) { can.core.CallFunc(cb, {event: msg._event, msg: msg}) }).length
|
||||
},
|
||||
})
|
||||
@ -110,6 +111,7 @@ Volcanos(chat.ONDAEMON, {_init: function(can, name) { if (can.user.isLocalFile)
|
||||
})
|
||||
Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
meta.name = can.core.Split(meta.name||"", "\t .\n").pop()
|
||||
meta.type != chat.PANEL && meta.type != chat.INPUT && meta.index && (meta.name = meta.index.replaceAll(ice.PT, ice.SP))
|
||||
field = field||can.onappend.field(can, meta.type, meta, target)._target
|
||||
var legend = can.page.SelectOne(can, field, html.LEGEND)
|
||||
var option = can.page.SelectOne(can, field, html.FORM_OPTION)
|
||||
@ -120,7 +122,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
var sub = Volcanos(meta.name, {_root: can._root||can, _follow: can.core.Keys(can._follow, meta.name), _target: field,
|
||||
_legend: legend, _option: option, _action: action, _output: output, _status: status, _history: [], _inputs: {}, _outputs: [],
|
||||
Status: function(key, value) { if (can.base.isObject(key)) { return can.core.Item(key, sub.Status), key }
|
||||
can.page.Select(can, status, [[[html.DIV, key], html.SPAN]], function(target) {
|
||||
can.page.Select(can, status, [[[html.SPAN, key]]], function(target) {
|
||||
if (can.base.beginWith(value, ice.PS, ice.HTTP)) { value = can.page.Format(html.A, value) }
|
||||
return can.base.isUndefined(value)? (value = target.innerHTML): (target.innerHTML = value)
|
||||
}); return value
|
||||
@ -136,18 +138,18 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
can.onappend._init(can, meta, list, function(sub) { can.base.isFunc(cb) && cb(sub, true), can.onmotion.delay(can, sub.Focus) }, target)
|
||||
},
|
||||
}, list, function(sub) { sub.Conf(meta), meta.feature = can.base.Obj(meta.feature, {})
|
||||
can.onappend.style(sub, meta.index? meta.index.split(ice.PT).pop(): meta.name), can.onappend.style(sub, meta.style), can.onappend.style(sub, sub.Mode())
|
||||
can.onappend.style(sub, meta.index? meta.index.split(ice.PT): meta.name), can.onappend.style(sub, meta.style), can.onappend.style(sub, sub.Mode())
|
||||
sub._trans = can.base.Copy(sub._trans||{}, can.core.Value(sub, [chat.ONACTION, chat._TRANS]))
|
||||
can.core.Item(meta.feature, function(key, cb) { cb.help && sub.user.trans(sub, kit.Dict(key, cb.help)) })
|
||||
meta.msg && can.onmotion.delay(can, function() { var msg = sub.request(); msg.Copy(can.base.Obj(meta.msg))
|
||||
sub.onappend._output(sub, msg, meta.display||msg.Option(ice.MSG_DISPLAY)||meta.feature.display)
|
||||
}), meta.inputs && sub.onappend._option(sub, meta, sub._option, meta.msg)
|
||||
sub._legend.onclick = function(event) {
|
||||
sub._legend && (sub._legend.onclick = function(event) {
|
||||
can.user.carte(event, sub, sub.onaction, sub.onaction.list.concat([[ctx.ACTION].concat(can.core.Item(meta.feature._trans))]), function(event, button, meta) {
|
||||
if (can.request(event).RunAction(event, can.core.Value(sub, chat._OUTPUTS_CURRENT), [ctx.ACTION, button])) { return }
|
||||
can.request(event).RunAction(event, sub, [ctx.ACTION, button]) || sub.runAction(event, button)
|
||||
})
|
||||
}, can.base.isFunc(cb) && cb(sub)
|
||||
}), can.base.isFunc(cb) && cb(sub)
|
||||
}); return sub
|
||||
},
|
||||
_option: function(can, meta, option, skip) { meta = meta||{}; var index = -1, args = can.base.Obj(meta.args||meta.arg||meta.opt, []), opts = can.base.Obj(meta.opts, {})
|
||||
@ -221,7 +223,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
_status: function(can, list, status) { status = status||can._status, can.onmotion.clear(can, status)
|
||||
can.core.List(can.base.Obj(list, can.core.Value(can, [chat.ONEXPORT, mdb.LIST])), function(item) { item = can.base.isString(item)? {name: item}: item
|
||||
if (can.base.beginWith(item.value, ice.PS, ice.HTTP)) { item.value = can.page.Format(html.A, item.value, item.value.split("?")[0]) }
|
||||
can.page.Append(can, status, [{view: can.base.join([html.ITEM, item.name]), title: item.name, list: [
|
||||
can.page.Append(can, status, [{view: html.ITEM, list: [
|
||||
{text: [item.name, html.LABEL]}, {text: [": ", html.LABEL]}, {text: [(item.value == undefined? "": item.value)+"", html.SPAN, item.name]},
|
||||
], onclick: function(event) { can.user.copy(event, can, item.value) }}])
|
||||
})
|
||||
@ -259,6 +261,8 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
{type: html.DIV_TABS, list: [{type: html.DIV, name: [html.SELECT], style: [OUTPUT_STYLE]}]},
|
||||
{type: html.DIV_PATH, style: [OUTPUT_STYLE]}, {type: html.DIV_CODE, style: {border: color.border+SOLID}},
|
||||
{type: html.DIV_PATH, list: [{type: html.SPAN, style: [ITEM_HOVER_STYLE]}]},
|
||||
{type: html.DIV_PLUG, list: [{type: html.LEGEND, style: [OUTPUT_STYLE]}]},
|
||||
{type: html.DIV_PLUG, list: [{type: html.LEGEND, name: [html.SELECT], style: [PLUGIN_STYLE]}]},
|
||||
{type: "div.zone>div.item", style: [TABLE_HEAD_STYLE]}, {type: "div.zone>div.item", style: [TABLE_HEAD_HOVER_STYLE]},
|
||||
{type: "div.zone>div.list>div.zone>div.item", style: [TABLE_HEAD_STYLE]}, {type: "div.zone>div.list>div.zone>div.item", style: [TABLE_HEAD_HOVER_STYLE]},
|
||||
{type: "div.zone div.item>div.name", name: [html.HOVER], style: _fg(color.text)},
|
||||
@ -279,7 +283,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
{type: html.FIELDSET_PANEL, name: [chat.ACTION], list: [{type: html.DIV_OUTPUT, style: [OUTPUT_STYLE]}]},
|
||||
{type: html.FIELDSET_PLUGIN, style: [PLUGIN_STYLE]}, {type: html.FIELDSET_PLUGIN, list: [{type: html.DIV_STATUS, style: {"border-top": color.border+SOLID}}]},
|
||||
{type: html.FIELDSET_STORY, style: [PLUGIN_STYLE]}, {type: html.FIELDSET_STORY, list: [{type: html.DIV_STATUS, style: {"border-top": color.border+SOLID}}]},
|
||||
{type: html.FIELDSET_INPUT, style: [PLUGIN_STYLE]}, {type: html.FIELDSET_INPUT, style: _b_r(0)},
|
||||
{type: html.FIELDSET_INPUT, list: [{type: html.DIV_OUTPUT, style: [PLUGIN_STYLE]}], style: [PLUGIN_STYLE]}, {type: html.FIELDSET_INPUT, style: _b_r(0)},
|
||||
{type: html.DIV_CARTE, list: [{type: html.DIV_ITEM, style: [TABLE_HEAD_STYLE, CARTE_ITEM_STYLE]}]},
|
||||
{type: html.DIV_CARTE, list: [{type: html.DIV_ITEM, style: [CARTE_ITEM_HOVER_STYLE]}]},
|
||||
{type: html.DIV_FLOAT, style: [PLUGIN_STYLE]},
|
||||
@ -291,18 +295,17 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
}).join("; "): can.core.Item(can.base.Obj(item.style), function(key, value) { return key+": "+value }).join("; "))+" }"): "")+(item.list? render(pre+ice.SP+type, item.list): "")
|
||||
}).join(ice.NL) } can.page.Append(can, document.head, "style", {"innerText": render("body."+topic, list)})
|
||||
},
|
||||
style: function(can, style, target) { target = target||can._fields||can._target; switch (typeof style) {
|
||||
case lang.STRING: can.page.ClassList.add(can, target, style); break
|
||||
case lang.OBJECT: can.page.style(can, target, style); break
|
||||
} },
|
||||
style: function(can, style, target) { target = target||can._fields||can._target
|
||||
can.base.isObject(style) && !can.base.isArray(style)? can.page.style(can, target, style): can.page.ClassList.add(can, target, style)
|
||||
},
|
||||
field: function(can, type, item, target) { type = type||html.STORY, item = item||{}
|
||||
var name = can.core.Split(item.nick||item.name||"")[0], title = !item.help || item.help == name || can.user.language(can) == "en"? name: name+"("+can.core.Split(item.help)[0]+")"
|
||||
var name = can.core.Split(item.nick||item.name||"").pop(), title = !item.help || item.help == name || can.user.language(can) == "en"? name: name+"("+can.core.Split(item.help)[0]+")"
|
||||
return can.page.Append(can, target||can._output, [{view: [can.base.join([type||"", item.name||"", item.pos||""]), html.FIELDSET], list: [
|
||||
(name||title)&&{text: [name == "word"? item.help.split(ice.SP)[0]: title, html.LEGEND]}, {view: [html.OPTION, html.FORM]}, html.ACTION, html.OUTPUT, html.STATUS,
|
||||
]}])
|
||||
},
|
||||
input: function(can, item, value, target, style) { if (item.type == html.BR || item.type == html.HR) { return can.page.Append(can, target, [item]) }
|
||||
var input = can.page.input(can, can.base.Copy({}, item), value), title = can.Conf(can.core.Keys(ctx.FEATURE, chat.TITLE, item.name))||""; title && (input.title = title)
|
||||
var input = can.page.input(can, can.base.Copy({className: "", type: "", name: ""}, item), value), title = can.Conf(can.core.Keys(ctx.FEATURE, chat.TITLE, item.name))||""; title && (input.title = title)
|
||||
if (item.type == html.SELECT && item.value) { input._init = function(target) { target.value = value||item.value } }
|
||||
if (item.type == html.TEXT) { input.onkeydown = item.onkeydown||function(event) {
|
||||
can.onkeymap.input(event, can), can.onkeymap.selectOutput(event, can), event.key == lang.ENTER && can.onkeymap.prevent(event)
|
||||
@ -310,7 +313,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
if (item.range) { input._init = function(target) { can.onappend.figure(can, item, target, function(sub, value, old) {
|
||||
target.value = value, can.core.CallFunc([can.onaction, item.name], [event, can, item.name])
|
||||
}) } }
|
||||
return can.page.Append(can, target, ([{view: can.base.join(style||[html.ITEM, item.type]), list: [input]}]).concat(input.type == html.TEXTAREA? [{type: html.BR}]: []))[item.name]
|
||||
return can.page.Append(can, target, [{view: [style||[html.ITEM, item.type]], list: [input]}])[item.name]
|
||||
},
|
||||
table: function(can, msg, cb, target, sort) { if (!msg || msg.Length() == 0) { return } var meta = can.base.Obj(msg.Option(mdb.META))
|
||||
var table = can.page.AppendTable(can, msg, target||can._output, msg.append, cb||function(value, key, index, line, array) {
|
||||
@ -335,7 +338,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
return code.scrollBy && code.scrollBy(0, 10000), code
|
||||
},
|
||||
tools: function(can, msg, cb, target) { can.onimport.tool(can, can.base.Obj(msg.Option(ice.MSG_TOOLKIT), []), cb, target) },
|
||||
layout: function(can, target, type, list) { const FLOW = "flow", FLEX = "flex"
|
||||
layout: function(can, target, type, list) { const FLOW = html.FLOW, FLEX = html.FLEX
|
||||
switch (type||ice.AUTO) {
|
||||
case FLOW:
|
||||
case FLEX:
|
||||
@ -373,14 +376,6 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
ui.layout = function(width, height, delay) { can.onmotion.delay(can, function() { defer = [], layout(type, ui.list, width, height), defer.forEach(function(cb) { cb() }) }, delay||0) }
|
||||
ui.list = append(target, type, list||[html.PROJECT, [[html.CONTENT, html.PROFILE], html.DISPLAY]])
|
||||
return ui
|
||||
case "tabs-box":
|
||||
can.onappend.style(can, target, [html.LAYOUT, html.TABS, "box"])
|
||||
can.core.List(list, function(item) {
|
||||
var ui = can.page.Append(can, target, [{view: html.TABS, inner: item.name, onclick: function() {
|
||||
can.onmotion.toggle(can, ui.list)
|
||||
}}, {view: html.LIST, list: item.list}])
|
||||
})
|
||||
break
|
||||
case "tabs-top":
|
||||
can.onappend.style(can, target, [html.LAYOUT, html.TABS, html.TOP])
|
||||
var ui = can.page.Append(can, target, [html.TABS, html.LIST])
|
||||
@ -400,9 +395,13 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
}
|
||||
ui.append = function(item, carte) {
|
||||
var tabs = can.page.Append(can, ui.tabs, [{type: html.DIV, inner: item.name, onclick: function(event) {
|
||||
can.onmotion.select(can, ui.tabs, html.DIV, tabs), can.onmotion.select(can, ui.list, html.DIV, view)
|
||||
can.onmotion.select(can, ui.tabs, html.DIV, tabs),
|
||||
can.page.SelectChild(can, ui.list, html.DIV, function(item) {
|
||||
can.page.ClassList.set(can, item, html.HIDE, item != view)
|
||||
if (item.className == "") { delete(item.className) }
|
||||
})
|
||||
}}])._target
|
||||
var view = can.page.Append(can, ui.list, [{type: html.DIV, list: item.list}])._target
|
||||
var view = can.page.Append(can, ui.list, [{view: html.HIDE, list: item.list}])._target
|
||||
if (ui.tabs.childElementCount == 1) { tabs.click() }
|
||||
return {
|
||||
close: function() {
|
||||
|
16
index.css
16
index.css
@ -115,20 +115,25 @@ table.content, div.project, div.item, div.code, div.story[data-type=spark], svg
|
||||
div.action>div.tabs { padding:5px; height:31px; }
|
||||
div.status>div.item { padding:5px; height:30px; }
|
||||
div.status>div.item>label { font-size:0.6rem; }
|
||||
fieldset div.tabs span.icon { margin-left:10px; visibility:hidden; }
|
||||
fieldset div.tabs span.icon:hover { background-color: aliceblue; }
|
||||
fieldset div.tabs span.icon { margin-left:5px; visibility:hidden; }
|
||||
fieldset div.tabs span.icon:hover { background-color:aliceblue; color:black; }
|
||||
fieldset div.tabs>div:hover span.icon { visibility:visible; }
|
||||
fieldset div.tabs>div.select span.icon { visibility:visible; }
|
||||
fieldset div.plug { font-style:italic; }
|
||||
fieldset form.option div.icon { font-size:26px; margin-right:5px; display:none; }
|
||||
fieldset form.option div.icon:hover { background-color:white; }
|
||||
fieldset.float form.option>div.icon { display:block; }
|
||||
fieldset.full form.option>div.icon { display:block; }
|
||||
fieldset.plug form.option>div.icon { margin-left:5px; }
|
||||
fieldset.plug div.output table.content { width:100%; }
|
||||
fieldset.web.code.git.status div.output table.content { width:100%; }
|
||||
div.tabs { position:relative; }
|
||||
/* display */
|
||||
form.option, div.action { display:contents; }
|
||||
form.option>div.item>label, div.action>div.item>label, .hidden, .hide { display:none; }
|
||||
div.action, div.output, div.status, div.project, div.display, div.profile, div.content, table.content, table.content td, div.code, div.story, div.toast { overflow:auto; }
|
||||
form.option>div.textarea { width:100%; }
|
||||
form.option>div.textarea>textarea { width:100%; }
|
||||
div.action, div.output, div.status, div.project, div.display, div.profile, div.content, table.content, table.content td, div.code, div.plug, div.story, div.toast { overflow:auto; }
|
||||
legend, form.option, form.option>div.item, div.action, div.action>div.item, div.action>div.tabs, div.status>div.item { float:left; }
|
||||
div.output, div.status, div.item.textarea, div.project div.item, div.content, div.code, div.story[data-type=spark] { clear:both; }
|
||||
div.status>legend { margin-left:2px; margin-right:0; float:right; clear:none; }
|
||||
@ -137,6 +142,7 @@ fieldset.plugin:not(.float):not(.full):not(.cmd)>legend { float:none; }
|
||||
fieldset.auto, fieldset.full, fieldset.float, div.float { position:fixed; z-index:10; }
|
||||
div.code { position:sticky; left:0; }
|
||||
hr { border-bottom:gray dashed 1px; margin:5px; }
|
||||
td.hr { border-bottom:gray dashed 1px; margin:5px; }
|
||||
/* hover */
|
||||
legend:hover { background-color:skyblue; }
|
||||
select:hover { background-color:gray; color:cyan; }
|
||||
@ -260,8 +266,8 @@ fieldset.plugin.inner.cmd>legend { display:none; }
|
||||
fieldset.plugin.inner.cmd>div.action { display:none; }
|
||||
fieldset.plugin.inner.cmd>form.option { display:none; }
|
||||
fieldset.xterm div.toggle { display:none; }
|
||||
fieldset>div.output>fieldset.plug { position:absolute; bottom:0; right:0; display:none; }
|
||||
fieldset>div.output>fieldset.plug.select { display:block; }
|
||||
fieldset>div.output fieldset.plug { position:absolute; bottom:0; right:0; }
|
||||
fieldset>div.output fieldset.plug.select { display:block; }
|
||||
body.mobile fieldset.plugin>legend { border:none; }
|
||||
.unselectable { -webkit-touch-callout:none; -webkit-user-select:none; -khtml-user-select:none; -moz-user-select:none; -ms-user-select:none; -o-user-select:none; user-select:none; }
|
||||
/* layout */
|
||||
|
@ -142,7 +142,7 @@ Volcanos("misc", {Message: function(event, can) { var msg = {}
|
||||
res._target = (msg[ice.MSG_SOURCE]||[]).reverse(), res._source = (msg[ice.MSG_TARGET]||[]).reverse().slice(1)||[]
|
||||
res.append = msg.append, can.core.List(msg.append, function(key) { res[key] = msg[key] }), res.result = (msg.result||[]).concat(can.core.List(arguments))
|
||||
res.Option(ice.LOG_DISABLE, msg.Option(ice.LOG_DISABLE)) != ice.TRUE && can.misc.Log(html.WSS, ice.MSG_RESULT, msg.result||[], msg)
|
||||
var e = socket.send(JSON.stringify(res)); can.misc.Log(e)
|
||||
socket.send(JSON.stringify(res))
|
||||
}, msg.detail = data.detail, msg.Copy(data)
|
||||
try {
|
||||
msg.Option(ice.LOG_DISABLE) != ice.TRUE && can.misc.Log(html.WSS, ice.MSG_DETAIL, msg.detail, msg)
|
||||
|
@ -122,11 +122,12 @@ Volcanos("user", {info: {}, agent: {
|
||||
{view: nfs.CONTENT, list: [{view: [html.OPTION, html.TABLE], list: can.core.List(form, function(item) {
|
||||
item = can.base.isString(item)? {type: html.TEXT, name: item}: item.length > 0? {type: html.SELECT, name: item[0], values: item.slice(1)}: item
|
||||
item.type = item.type||(item.values? html.SELECT: item.name == html.TEXT? html.TEXTAREA: html.TEXT), need[item.name] = item.need
|
||||
item.onkeydown = function(event) { if (event.key == lang.ESCAPE) { event.target.blur() } }
|
||||
item._init = function(target) { if (item.type == html.PASSWORD || item.type == html.USERNAME) { return }
|
||||
if (item.name && item.name != ctx.ACTION) { target.value = msg.Option(item.name)||can.Option(item.name)||target.value||"" }
|
||||
item.mode = chat.SIMPLE, can.onappend.figure(can, can.base.Copy({run: function(event, cmds, cb) { var _msg = can.request(event, {_handle: ice.TRUE, action: msg.Option(html.ACTION)}, msg, can.Option())
|
||||
can.page.Select(can, ui.table, html.OPTION_ARGS, function(item) { item.name && item.value && _msg.Option(item.name, item.value) })
|
||||
can.run(event, cmds, cb, true)
|
||||
;(item.run||can.run)(event, cmds, cb, true)
|
||||
}, _enter: function(event) { return action.submit(event, can, html.SUBMIT), true }}, item), target)
|
||||
}; return {type: html.TR, list: [{type: html.TD, list: [{text: [item.name||"", html.LABEL]}, {text: item.need == "must"? "*": "", style: {color: cli.RED}}]}, {type: html.TD, list: [can.page.input(can, item)]}]}
|
||||
})}]}, html.ACTION,
|
||||
@ -139,7 +140,7 @@ Volcanos("user", {info: {}, agent: {
|
||||
if (item.value == "" && need[item.name] == "must") { err = true, item.focus(), can.user.toast(can, item.name+" 是必选字段, 请重新输入") }
|
||||
return item.name && args.push(item.name, item.value||""), data[item.name] = item.value||""
|
||||
}); if (err) { return } can.onkeymap.prevent(event)
|
||||
can.core.CallFunc(cb, {event: can.request(event, {_handle: ice.TRUE})._event, button: button, data: data, list: list, args: args}) || action.cancel()
|
||||
can.core.CallFunc(cb, {event: can.request(event, {_handle: ice.TRUE})._event, button: button, data: data, list: list, args: args, input: action}) || action.cancel()
|
||||
}, _target: ui._target, _engine: function(event, can, button) { action.submit(event, can, button) },
|
||||
}); can.onlayout.figure(event, can, ui._target), can.onmotion.delay(can, function() { action.focus() })
|
||||
return button === true && action.submit(event, can, html.SUBMIT), action
|
||||
|
@ -32,7 +32,7 @@ Volcanos(chat.ONACTION, {_init: function(can) { if (can.user.isExtension || can.
|
||||
ontoast: function(can, msg) { can.core.CallFunc(can.onimport.toast, {can: can, msg: msg}) },
|
||||
ondebug: function(can, msg) { can.core.CallFunc(can.onimport.debug, {can: can, msg: msg}) },
|
||||
onremote: function(can, msg) { can.core.CallFunc(can.onimport.ncmd, {can: can, msg: msg}) },
|
||||
onaction_cmd: function(can, msg) { can.onmotion.hidden(can) },
|
||||
onaction_cmd: function(can) { can.onappend.style(can, can._target, html.HIDE) },
|
||||
oncommand_focus: function(can) { can.page.Select(can, can._output, ["div.cmd", html.INPUT], function(target) { can.onmotion.focus(can, target) }) },
|
||||
})
|
||||
Volcanos(chat.ONEXPORT, {height: function(can) { return can._target.offsetHeight },
|
||||
|
@ -78,7 +78,7 @@ Volcanos(chat.ONACTION, {
|
||||
},
|
||||
onsize: function(can) { can.onimport.topic(can), can.ConfHeight(can._target.offsetHeight), can.ConfWidth(can._target.offsetWidth) },
|
||||
onstorm_select: function(can, river, storm) { can.Conf(chat.RIVER, river), can.Conf(chat.STORM, storm) },
|
||||
onaction_cmd: function(can) { can.onmotion.hidden(can) },
|
||||
onaction_cmd: function(can) { can.onappend.style(can, can._target, html.HIDE) },
|
||||
onsearch_focus: function(can) { can._search && can._search.focus() },
|
||||
onshare: function(can, msg, args) { can.user.share(can, msg, [ctx.ACTION, chat.SHARE].concat(args||[])) },
|
||||
onwebpack: function(can, msg) {
|
||||
|
@ -2,7 +2,8 @@ Volcanos(chat.ONFIGURE, {key: {
|
||||
_show: function(can, msg, cb, target, name) { if (msg.Length() == 0 || msg.Length() == 1 && msg.Append(name) == target.value) { return can.onmotion.hidden(can) }
|
||||
if (msg.append[msg.append.length-1] == ctx.ACTION) { msg.append = msg.append.slice(0, -1) }
|
||||
can.onmotion.clear(can), can.onappend.table(can, msg, function(value, key, index, line) { value = line[key]
|
||||
return {text: [value, html.TD], style: msg.append && msg.append.length == 1? kit.Dict(html.MIN_WIDTH, target.offsetWidth-16): {}, onclick: function(event) {
|
||||
return {text: [value, html.TD, value == ""? "hr": ""], style: msg.append && msg.append.length == 1? kit.Dict(html.MIN_WIDTH, target.offsetWidth-16): {}, onclick: function(event) {
|
||||
if (msg.cb && msg.cb[index]) { return msg.cb[index](value) }
|
||||
can._delay_hidden = false, cb(can, value, target.value), msg.Option(ice.MSG_PROCESS) == ice.PROCESS_AGAIN && can.onmotion.delay(can, function() { can._load(event, can, cb, target, name, value) })
|
||||
}}
|
||||
}), can.onappend._status(can, [mdb.TOTAL, mdb.INDEX]), can.Status(mdb.TOTAL, msg.Length())
|
||||
@ -22,11 +23,12 @@ Volcanos(chat.ONFIGURE, {key: {
|
||||
}) },
|
||||
onblur: function(event, can, sub) { can.onmotion.delay(can, function() {
|
||||
// sub._delay_hidden || can.onmotion.hidden(can, sub._target), sub._delay_hidden = false
|
||||
if (sub) { sub._delay_hidden || sub.close(), sub._delay_hidden = false }
|
||||
// if (sub) { sub._delay_hidden || sub.close(), sub._delay_hidden = false }
|
||||
}, 300) },
|
||||
onkeydown: function(event, can, meta, cb, target, sub, last) {
|
||||
if (event.key == lang.ENTER && meta._enter && (!can.page.tagis(event.target, html.TEXTAREA) || event.ctrlKey) && meta._enter(event)) { return sub.close() }
|
||||
if (event.key == lang.ENTER) { return last(event) }
|
||||
if (event.key == lang.ESCAPE) { return last(event) }
|
||||
if (sub.hidden()) { return }
|
||||
can.onkeymap.selectCtrlN(event, can, sub._output, "tr:not(.hidden)>td:first-child", function(td) { return cb(sub, td.innerText, target.value), td })
|
||||
|| can.onkeymap.selectInputs(event, sub, function() { sub._load(event, sub, cb, target, meta.name) }, target)
|
||||
|
@ -15,18 +15,27 @@ fieldset.inner>div.output>div.project { width:230px; }
|
||||
fieldset.inner>div.output>div.project>div.zone>div.item { letter-spacing:10px; }
|
||||
fieldset.inner>div.output>div.project>div.zone div.action>div.item { padding-right:0; width:100%; }
|
||||
fieldset.inner>div.output>div.project>div.zone div.action>div.item>input { width:100%; }
|
||||
fieldset.inner>div.output>div.layout.flow { position:relative; }
|
||||
fieldset.inner>div.output>div.layout.flow>div.tabs { display:none; }
|
||||
fieldset.inner>div.output>div.layout.flow>div.path { display:none; }
|
||||
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs { height:38px; display:block; overflow:auto; }
|
||||
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs>div { padding:10px; height:38px; float:left; }
|
||||
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs>div>span { font-style:italic; }
|
||||
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs>div>span.icon { padding:0 5px; }
|
||||
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs div.avatar { padding:0; height:38px; float:right; }
|
||||
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs div.project.icon { font-size:32px; line-height:32px; padding:0 5px; }
|
||||
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs div.create.icon { font-size:26px; line-height:32px; padding:2px 10px; }
|
||||
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs div.create.icon { font-size:18px; line-height:32px; padding:2px 10px; }
|
||||
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs div.avatar>img { height:38px; }
|
||||
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs div.time { float:right; }
|
||||
fieldset.inner.cmd>div.output>div.layout.flow>div.path { font-style:italic; padding:5px; display:block; }
|
||||
fieldset.inner.cmd>div.output>div.layout.flow>div.path span.func { margin-left:20px; }
|
||||
fieldset.inner.cmd>div.output>div.layout.flow>div.path span.view { font-size:22px; line-height:12px; padding:0 4px; float:right; cursor:pointer; }
|
||||
fieldset.inner.cmd>div.output>div.layout.flow>div.plug { height:31px; clear:both; }
|
||||
fieldset.inner.cmd>div.output>div.layout.flow>div.plug>legend { float:right; }
|
||||
fieldset.inner.cmd>div.output fieldset.plug { bottom:31px; position:absolute; }
|
||||
// fieldset.inner.cmd>div.output>div.layout.flow>fieldset.plug { display:block; }
|
||||
fieldset.inner fieldset.story form.option div.icon { display:block; }
|
||||
|
||||
|
||||
body.black fieldset.inner>div.output div.content td.text span.comment { background-color:blue; color:cyan; }
|
||||
body.white fieldset.inner.cmd>div.output { background-color:aliceblue; }
|
||||
|
@ -7,7 +7,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
|
||||
var paths = can.core.Split(can.Option(nfs.PATH), ice.FS); can.Option(nfs.PATH, paths[0])
|
||||
can.core.List(paths.concat(can.core.Split(msg.Option(nfs.REPOS))), function(p) { if (p && paths.indexOf(p) == -1 && p[0] != ice.PS) { paths.push(p) } })
|
||||
can.db = {paths: paths, tabview: {}, history: [], profile_size: {}, display_size: {}, toolkit: {}, extentions: {}}, can.onengine.plugin(can, can.onplugin)
|
||||
can.ui = can.onappend.layout(can, can._output, "", [html.PROJECT, [html.TABS, nfs.PATH, [html.CONTENT, html.PROFILE], html.DISPLAY]])
|
||||
can.ui = can.onappend.layout(can, can._output, "", [html.PROJECT, [html.TABS, nfs.PATH, [html.CONTENT, html.PROFILE], html.DISPLAY, html.PLUG]])
|
||||
can.ui._content = can.ui.content, can.ui._profile = can.ui.profile, can.ui._display = can.ui.display
|
||||
switch (can.Mode()) {
|
||||
case chat.SIMPLE: can.onmotion.hidden(can, can.ui.project); break
|
||||
@ -42,17 +42,14 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
|
||||
})
|
||||
},
|
||||
_tabs: function(can) { if (!can.isCmdMode()) { return can.ui.tabs = can._action }
|
||||
can.user.isMobile && can.page.Append(can, can.ui.tabs, [{view: [[html.ICON, html.PROJECT], html.DIV, "\u2261"], onclick: function() {
|
||||
can.onmotion.toggle(can, can.ui.project), can.onimport.layout(can)
|
||||
}}])
|
||||
can.page.Append(can, can.ui.tabs, [{view: [[html.ICON, mdb.CREATE], html.DIV, "+"], onclick: function() {
|
||||
can.page.Append(can, can.ui.tabs, [{view: [[html.ICON, mdb.CREATE], html.DIV, "\u2630"], onclick: function() {
|
||||
can.user.carte(event, can, can.onaction, can.onaction.list)
|
||||
}}])
|
||||
can.page.Append(can, can.ui.tabs, [{view: [mdb.TIME], _init: function(target) {
|
||||
can.core.Timer({interval: 100}, function() { can.page.Modify(can, target, can.user.time(can, null, "%y-%m-%d %H:%M:%S %w")) })
|
||||
can.onappend.figure(can, {action: "date", _hold: true}, target, function(sub, value) {})
|
||||
}}])
|
||||
can.page.Append(can, can.ui.tabs, [{view: [aaa.AVATAR], list: [{img: can.user.info.avatar}]}])
|
||||
can.user.info.avatar && can.page.Append(can, can.ui.tabs, [{view: [aaa.AVATAR], list: [{img: can.user.info.avatar}]}])
|
||||
},
|
||||
_tabInputs: function(can, ps, key, value, cb, target) {
|
||||
can.core.List(can.core.Split(value, ps), function(value, index, array) {
|
||||
@ -74,51 +71,28 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
|
||||
},
|
||||
_tabFunc: function(can, target) {
|
||||
can.db.tabFunc = can.db.tabFunc||{}; var last = can.db.tabFunc[can.Option(nfs.PATH)+can.Option(nfs.FILE)]||{}; can.db.tabFunc[can.Option(nfs.PATH)+can.Option(nfs.FILE)] = last
|
||||
function indent(text) { var indent = 0; for (var i = 0; i < text.length; i++) { switch (text[i]) {
|
||||
case ice.TB: indent+=4; break
|
||||
case ice.SP: indent++; break
|
||||
default: return indent
|
||||
} } }
|
||||
var carte, list = [{input: ["filter", function(event) {
|
||||
can.onkeymap.selectItems(event, can, carte._target)
|
||||
}], _init: function(target) { can.onmotion.delay(can, function() { target.focus() }) }}]
|
||||
var carte, list = [{input: ["filter", function(event) { can.onkeymap.selectItems(event, can, carte._target) }], _init: function(target) { can.onmotion.delay(can, function() { target.focus() }) }}]
|
||||
can.core.Item(last, function(key) { list.push(key) }), list.push("")
|
||||
var package = "", block = "", current = "", percent = ""
|
||||
can.page.Select(can, can.ui.content, "tr.line>td.text", function(item, index) { var text = item.innerText, _indent = indent(text)
|
||||
function push(item) { list.push(item); if (index < can.Option(nfs.LINE)) { current = list[list.length-1], percent = " = "+parseInt((index+1)*100/(can.max||1))+"%" } }
|
||||
if (can.parse == nfs.JS) {
|
||||
if (_indent == 0 && can.base.beginWith(text, "Volcanos")) {
|
||||
var ls = can.core.Split(text, "\t ({:}),"); block = can.base.trimPrefix(ls[1], "chat.").toLowerCase()
|
||||
if (text.indexOf("_init") > -1) { push(block+ice.PT+"_init"+ice.DF+(index+1)) }
|
||||
} else if (_indent == 4) {
|
||||
var ls = can.core.Split(text, "\t ({:}),"); ls[0] && push(block+ice.PT+ls[0]+ice.DF+(index+1))
|
||||
}
|
||||
} else if (can.parse == nfs.GO) {
|
||||
var ls = can.core.Split(text, "\t *", "({:})")
|
||||
if (_indent == 0) {
|
||||
switch (ls[0]) {
|
||||
case "package": package = ls[1]; break
|
||||
case "func": if (ls[1] == "(") { ls[1] = ls[2]+ice.PT+ls[5]
|
||||
if (ls[5].toLowerCase()[0] == ls[5][0]) { push("- "+ls[1]+ice.DF+(index+1)) } else { push("+ "+ls[1]+ice.DF+(index+1)) } break
|
||||
}
|
||||
case "type":
|
||||
case "var":
|
||||
if (ls[1].toLowerCase()[0] == ls[1][0]) { push("- "+ls[1]+ice.DF+(index+1)) } else { push("+ "+package+"."+ls[1]+ice.DF+(index+1)) } break
|
||||
}
|
||||
} else if (_indent == 4) {
|
||||
if (text.indexOf("MergeCommands(") > -1) { block = "cmds" } else if (text == "})") { block = "" }
|
||||
} else if (_indent == 8) {
|
||||
if (block == "cmds" && ls[1] == ice.DF) { push("+ "+package+ice.PT+ls[0]+ice.DF+(index+1)), block = package+ice.PT+ls[0] }
|
||||
} else if (_indent == 12) {
|
||||
if (block && ls[1] == ice.DF) { push("+ "+block+ice.SP+ls[0]+ice.DF+(index+1)) }
|
||||
}
|
||||
}
|
||||
}); (can.parse == nfs.JS || can.parse == nfs.GO) && can.page.Append(can, target, [{view: [[html.ITEM, "func"], html.SPAN, (current||"function")+" / "+can.max+percent], onclick: function(event) {
|
||||
carte = can.user.carte(event, can, {_style: nfs.PATH}, list, function(ev, button) {
|
||||
last[button] = true
|
||||
var func = can.onexport.func(can);
|
||||
(can.parse == nfs.JS || can.parse == nfs.GO) && can.page.Append(can, target, [{view: [[html.ITEM, "func"], html.SPAN, (func.current||"function")+" / "+can.max+func.percent], onclick: function(event) {
|
||||
carte = can.user.carte(event, can, {_style: nfs.PATH}, list.concat(func.list), function(ev, button) { last[button] = true
|
||||
can.onimport.tabview(can, can.Option(nfs.PATH), can.Option(nfs.FILE), can.core.Split(button, ice.DF)[1]), can.onmotion.clearFloat(can)
|
||||
})
|
||||
}}])
|
||||
|
||||
can.page.Append(can, can.ui.path, can.core.Item({
|
||||
"\u25E8 ": function(event) {
|
||||
if (can.page.isDisplay(can.ui.profile)) { return can.onmotion.hidden(can, can.ui.profile), can.onimport.layout(can) }
|
||||
can.onaction.show(event, can)
|
||||
},
|
||||
"\u25E8": shy({"font-size": "23px", rotate: "90deg", translate: "1px 1px"}, function(event) {
|
||||
if (can.page.isDisplay(can.ui.display)) { return can.onmotion.hidden(can, can.ui.display), can.onimport.layout(can) }
|
||||
can.onaction.exec(event, can)
|
||||
}),
|
||||
"\u25E7": function(event) { can.onmotion.toggle(can, can.ui.project), can.onimport.layout(can) },
|
||||
"\u2756": shy({"font-size": "20px", translate: "0 2px"}, function(event) { can.onaction.plug(event, can) }),
|
||||
"\u271A": shy({"font-size": "20px", translate: "0 2px"}, function(event) { can.onaction.open(event, can) }),
|
||||
}, function(text, cb) { return {text: [text, html.SPAN, html.VIEW], style: cb.meta, onclick: cb} }))
|
||||
},
|
||||
tabview: function(can, path, file, line, cb) { var key = can.onexport.keys(can, path, file)
|
||||
function isCommand() { return line == ctx.INDEX || path == ctx.COMMAND }
|
||||
@ -205,6 +179,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
|
||||
process: function(can, msg, target, height, width, cb) { can.onmotion.clear(can, target)
|
||||
if (msg.Option(ice.MSG_PROCESS) == "_field") {
|
||||
msg.Table(function(item) { item.display = msg.Option(ice.MSG_DISPLAY), item.height = height-2*html.ACTION_HEIGHT, item.width = width
|
||||
item.type = "story"
|
||||
can.onimport.plug(can, item, function(sub) {
|
||||
height && sub.ConfHeight(height-2*html.ACTION_HEIGHT), width && sub.ConfWidth(width)
|
||||
sub.onaction._output = function(_sub, _msg) { can.base.isFunc(cb) && cb(_sub, _msg) }
|
||||
@ -224,21 +199,26 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
|
||||
} return can.onmotion.toggle(can, target, true), can.onimport.layout(can), can.user.toastSuccess(can)
|
||||
},
|
||||
toolkit: function(can, meta, cb) {
|
||||
can.onimport.plug(can, meta, function(sub) { sub._delay_init = true
|
||||
can._status.appendChild(sub._legend), sub._legend.onclick = function(event) {
|
||||
if (can.page.SelectOne(can, can._status, ice.PT+html.SELECT) == event.target) {
|
||||
can.page.ClassList.del(can, event.target, html.SELECT), can.onmotion.hidden(can, sub._target)
|
||||
} else {
|
||||
can.page.SelectChild(can, can._output, can.core.Keys(html.FIELDSET, chat.PLUG), function(target) { can.onmotion.toggle(can, target, target == sub._target) })
|
||||
can.onmotion.select(can, can._status, html.LEGEND, event.target), can.onmotion.select(can, can._output, can.core.Keys(html.FIELDSET, chat.PLUG), sub._target)
|
||||
if (sub._delay_init == true) { sub._delay_init = false, can.onmotion.delay(can, function() { sub._output.innerHTML == "" && sub.Update() }) }
|
||||
can.onimport.plug(can, meta, function(sub) {
|
||||
can.onappend.style(sub, html.FLOAT)
|
||||
can.onappend.style(sub, html.HIDE)
|
||||
can.ui.plug.appendChild(sub._legend), sub._legend.onclick = function(event) {
|
||||
if (can.page.SelectOne(can, can.ui.plug, ice.PT+html.SELECT, function(target) {
|
||||
can.page.ClassList.del(can, target, html.SELECT); return target
|
||||
}) == event.target) { can.page.ClassList.add(can, sub._target, html.HIDE) } else {
|
||||
can.page.ClassList.add(can, event.target, html.SELECT)
|
||||
can.page.SelectChild(can, can.ui.plug.parentNode, can.core.Keys(html.FIELDSET, chat.PLUG), function(target) {
|
||||
if (!can.page.ClassList.set(can, target, html.HIDE, target != sub._target)) {
|
||||
if (sub._delay_init == true) { sub._delay_init = false, can.onmotion.delay(can, function() { sub._output.innerHTML == "" && sub.Update() }) }
|
||||
}
|
||||
})
|
||||
}
|
||||
}, sub._legend.onmouseenter = null
|
||||
}, sub._delay_init = true
|
||||
sub.onexport.record = function(sub, value, key, line) { if (!line.file && !line.line) { return }
|
||||
can.onimport.tabview(can, line.path||can.Option(nfs.PATH), can.base.trimPrefix(line.file, nfs.PWD)||can.Option(nfs.FILE), parseInt(line.line))
|
||||
}, sub.onaction.close = sub.select = function() { return sub._legend.click(), sub }
|
||||
sub.onimport.size(sub, can.ConfHeight()/2, can.ConfWidth()-can.ui.project.offsetWidth, true), can.base.isFunc(cb) && cb(sub)
|
||||
}, can._output)
|
||||
}, can.ui.plug.parentNode)
|
||||
},
|
||||
layout: function(can) {
|
||||
if (can.isSimpleMode()) { return can.page.style(can, can.ui.content, html.WIDTH, can.ConfWidth()) }
|
||||
@ -302,8 +282,9 @@ Volcanos(chat.ONSYNTAX, {_init: function(can, msg, cb) {
|
||||
if (can.Option(nfs.LINE) == web.DREAM) {
|
||||
return can.base.isFunc(cb) && cb(msg._content = msg._content||can.page.insertBefore(can, [{view: [html.CONTENT, html.IFRAME],
|
||||
src: can.misc.MergePodCmd(can, {pod: can.Option(nfs.FILE)}), height: can.ui.content.offsetHeight, width: can.ui.content.offsetWidth}], can.ui._content))
|
||||
} var meta = {index: msg.Option(ctx.INDEX), args: can.Option(nfs.PATH) == ctx.COMMAND && can.Option(nfs.LINE) != ctx.INDEX? [can.Option(nfs.LINE)]: []}
|
||||
} var meta = {type: "story", index: msg.Option(ctx.INDEX), args: can.Option(nfs.PATH) == ctx.COMMAND && can.Option(nfs.LINE) != ctx.INDEX? [can.Option(nfs.LINE)]: []}
|
||||
return can.onimport.plug(can, meta, function(sub) {
|
||||
can.page.ClassList.del(sub, sub._target, html.HIDE)
|
||||
sub.onaction.close = function() { can.onaction.back(can), msg._tab._close() }
|
||||
sub.onimport.title = function(_, title) { can.page.Modify(can, msg._tab, title) }
|
||||
sub.onimport._open = function(sub, msg, _arg) { var url = can.base.ParseURL(_arg), ls = url.origin.split("/chat/pod/")
|
||||
@ -368,7 +349,7 @@ Volcanos(chat.ONACTION, {
|
||||
}, prev: function() { return line.previousSibling }, next: function() { return line.nextSibling },
|
||||
line: line, text: function(text) { return text != undefined && can.onaction.modifyLine(can, line, text), item.innerText },
|
||||
}, can.onimport.history(can, {path: can.Option(nfs.PATH), file: can.Option(nfs.FILE), line: can.Option(nfs.LINE)})
|
||||
can.onexport.hash(can), scroll && can.onaction.scrollIntoView(can), can.onengine.signal(can, "tabview.line.select")
|
||||
can.onexport.hash(can), scroll && can.onaction.scrollIntoView(can), can.onengine.signal(can, "tabview.line.select", can._msg)
|
||||
})
|
||||
can.misc.localStorage(can, "web.code.inner:currentFile", can.Option(nfs.PATH)+ice.DF+can.Option(nfs.FILE)+ice.DF+can.onaction._getLineno(can, can.current.line))
|
||||
can.misc.localStorage(can, "web.code.inner:selectLine:"+can.Option(nfs.PATH)+can.Option(nfs.FILE), can.onaction._getLineno(can, can.current.line))
|
||||
@ -407,7 +388,7 @@ Volcanos(chat.ONACTION, {
|
||||
clear: function(event, can) {
|
||||
if (can.page.Select(can, can._root._target, "div.vimer.find.float", function(item) { return can.page.Remove(can, 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.page.Select(can, can.ui.plug, "legend.select", function(item) { return item.click(), item }).length > 0) { return }
|
||||
if (can.page.isDisplay(can.ui.display)) { return can.onmotion.hidden(can, can.ui.display), can.onimport.layout(can) }
|
||||
if (can.page.isDisplay(can.ui.profile)) { return can.onmotion.hidden(can, can.ui.profile), can.onimport.layout(can) }
|
||||
can.onmotion.toggle(can, can.ui.project), can.onimport.layout(can)
|
||||
@ -420,8 +401,29 @@ Volcanos(chat.ONACTION, {
|
||||
if (can.base.Ext(can.Option(nfs.FILE)) == nfs.JS) { delete(Volcanos.meta.cache[can.base.Path(ice.PS, ice.REQUIRE, can.Option(nfs.PATH), can.Option(nfs.FILE))]) }
|
||||
can.runAction(can.request(event, {_toast: "渲染中..."}), mdb.RENDER, [can.parse, can.Option(nfs.FILE), can.Option(nfs.PATH)], function(msg) { can.onimport.profile(can, msg) })
|
||||
},
|
||||
plug: function(event, can) {
|
||||
function show(value) { input.cancel()
|
||||
var sub = can.db.toolkit[value]; if (sub) { sub.select(); return }
|
||||
can.onimport.toolkit(can, {index: value}, function(sub) { can.db.toolkit[value] = sub.select() })
|
||||
}
|
||||
var input = can.user.input(event, can, [{type: html.TEXT, name: ctx.INDEX, run: function(event, cmds, cb) { can.run(event, cmds, function(msg) {
|
||||
if (cmds[0] == ctx.ACTION && cmds[1] == mdb.INPUTS && cmds[2] == ctx.INDEX) { var _msg = can.request({})
|
||||
can.core.Item(can.db.toolkit, function(index) { _msg.Push(ctx.INDEX, index).Push("cb", show) }), _msg.Push(ctx.INDEX, "")
|
||||
_msg.Copy(msg), cb(_msg)
|
||||
} else { cb(msg) }
|
||||
}, true) }}], function(list) { show(list[0]) })
|
||||
},
|
||||
open: function(event, can) {
|
||||
can.page.style(can, can.user.input(can.request(event, {paths: can.db.paths.join(ice.FS)}), can, [{name: nfs.FILE, style: {width: can.ui.content.offsetWidth/2}}], function(list) {
|
||||
var paths = can.core.List(can.db.paths, function(item) { if (can.base.endWith(item, "-story/", "-dict/")) { return } return item }).join(ice.FS)
|
||||
can.page.style(can, can.user.input(can.request(event, {paths: paths}), can, [{name: nfs.FILE, style: {width: can.ui.content.offsetWidth/2}, run: function(event, cmds, cb) {
|
||||
can.run(can.request(event, {paths: paths}), cmds, function(msg) {
|
||||
if (cmds[0] == ctx.ACTION && cmds[1] == mdb.INPUTS) { var _msg = can.request({}), func = can.onexport.func(can)
|
||||
can.core.List(func.list, function(item) { var ls = can.core.Split(item, ice.DF, ice.DF); _msg.Push(nfs.PATH, "line:"+ls[1]+":"+ls[0]) })
|
||||
can.core.Item(can.onengine.plugin.meta, function(key, value) { _msg.Push(nfs.PATH, "index:can."+key) })
|
||||
_msg.Copy(msg), cb(_msg)
|
||||
} else { cb(msg) }
|
||||
}, true)
|
||||
}}], function(list, input) { input.cancel()
|
||||
var ls = can.core.Split(list[0], ice.DF, ice.DF); switch (ls[0]) {
|
||||
case "_open": return can.runAction(event, ls[0], ls[1])
|
||||
case ctx.INDEX:
|
||||
@ -484,6 +486,45 @@ Volcanos(chat.ONEXPORT, {list: ["目录", "类型", "文件", "行号", "跳转"
|
||||
for (var i = begin; i >= 0; i--) { if (str[i].match(/[a-zA-Z0-9_.]/)) { s = str.slice(i, end) } else { break } }
|
||||
return s
|
||||
},
|
||||
func: function(can) { var list = []
|
||||
function indent(text) { var indent = 0; for (var i = 0; i < text.length; i++) { switch (text[i]) {
|
||||
case ice.TB: indent+=4; break
|
||||
case ice.SP: indent++; break
|
||||
default: return indent
|
||||
} } }
|
||||
var package = "", block = "", current = "", percent = ""
|
||||
can.page.Select(can, can.ui.content, "tr.line>td.text", function(item, index) { var text = item.innerText, _indent = indent(text)
|
||||
function push(item) { list.push(item); if (index < can.Option(nfs.LINE)) { current = list[list.length-1], percent = " = "+parseInt((index+1)*100/(can.max||1))+"%" } }
|
||||
if (can.parse == nfs.JS) {
|
||||
if (_indent == 0 && can.base.beginWith(text, "Volcanos")) {
|
||||
var ls = can.core.Split(text, "\t ({:}),"); block = can.base.trimPrefix(ls[1], "chat.").toLowerCase()
|
||||
if (text.indexOf("_init") > -1) { push(block+ice.PT+"_init"+ice.DF+(index+1)) }
|
||||
} else if (_indent == 4) {
|
||||
var ls = can.core.Split(text, "\t ({:}),"); ls[0] && push(block+ice.PT+ls[0]+ice.DF+(index+1))
|
||||
}
|
||||
} else if (can.parse == nfs.GO) {
|
||||
var ls = can.core.Split(text, "\t *", "({:})")
|
||||
if (_indent == 0) {
|
||||
switch (ls[0]) {
|
||||
case "package": package = ls[1]; break
|
||||
case "func": if (ls[1] == "(") { ls[1] = ls[2]+ice.PT+ls[5]
|
||||
if (ls[5].toLowerCase()[0] == ls[5][0]) { push("- "+ls[1]+ice.DF+(index+1)) } else { push("+ "+ls[1]+ice.DF+(index+1)) } break
|
||||
}
|
||||
case "type":
|
||||
case "var":
|
||||
if (ls[1].toLowerCase()[0] == ls[1][0]) { push("- "+ls[1]+ice.DF+(index+1)) } else { push("+ "+package+"."+ls[1]+ice.DF+(index+1)) } break
|
||||
}
|
||||
} else if (_indent == 4) {
|
||||
if (text.indexOf("MergeCommands(") > -1) { block = "cmds" } else if (text == "})") { block = "" }
|
||||
} else if (_indent == 8) {
|
||||
if (block == "cmds" && ls[1] == ice.DF) { push("+ "+package+ice.PT+ls[0]+ice.DF+(index+1)), block = package+ice.PT+ls[0] }
|
||||
} else if (_indent == 12) {
|
||||
if (block && ls[1] == ice.DF) { push("+ "+block+ice.SP+ls[0]+ice.DF+(index+1)) }
|
||||
}
|
||||
}
|
||||
})
|
||||
return {list: list, current: current, percent: percent}
|
||||
},
|
||||
})
|
||||
Volcanos(chat.ONENGINE, {
|
||||
listen: shy("监听事件", function(can, key, cb) { arguments.callee.meta[key] = (arguments.callee.meta[key]||[]).concat(cb) }),
|
||||
|
@ -474,6 +474,7 @@ Volcanos(chat.ONSYNTAX, {
|
||||
"font-size": code.FUNCTION,
|
||||
"font-family": code.FUNCTION,
|
||||
"font-weight": code.FUNCTION,
|
||||
"font-style": code.FUNCTION,
|
||||
"line-height": code.FUNCTION,
|
||||
"text-align": code.FUNCTION,
|
||||
"white-space": code.FUNCTION,
|
||||
@ -482,6 +483,7 @@ Volcanos(chat.ONSYNTAX, {
|
||||
"pointer": code.CONSTANT,
|
||||
"center": code.CONSTANT,
|
||||
"monospace": code.CONSTANT,
|
||||
"italic": code.CONSTANT,
|
||||
|
||||
"dark": code.CONSTANT,
|
||||
"light": code.CONSTANT,
|
||||
|
@ -5,6 +5,9 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) {
|
||||
can.onengine.listen(can, "tabview.line.select", function(msg) { can.onaction._selectLine(can) })
|
||||
can.onengine.plugin(can, can.onplugin), can.base.isFunc(cb) && cb(msg)
|
||||
can.ui.project.onscroll = function() { can.onmotion.clearFloat(can) }
|
||||
can.isCmdMode() && can.run({}, [ctx.ACTION, ctx.COMMAND].concat(["can.topic", "cli.qrcode", "cli.runtime", "nfs.dir", "web.code.xterm"]), function(msg) {
|
||||
msg.Table(function(value) { can.onimport.toolkit(can, value) })
|
||||
})
|
||||
}, target) })
|
||||
},
|
||||
_input: function(can) { var ui = can.page.Append(can, can.ui.content.parentNode, [
|
||||
@ -27,14 +30,13 @@ Volcanos(chat.ONFIGURE, {
|
||||
if (!list[path]) { can.page.Append(can, target, cb(item, path)), zone._total(++total) } list[path] = item
|
||||
}) }
|
||||
can.runAction({}, code.FAVOR, ["_recent_file"], function(msg) {
|
||||
msg.Push(nfs.PATH, ice.USR_VOLCANOS).Push(nfs.FILE, "frame.js")
|
||||
msg.Push(nfs.PATH, ice.USR_VOLCANOS).Push(nfs.FILE, "index.css")
|
||||
msg.Push(nfs.PATH, ice.USR_VOLCANOS).Push(nfs.FILE, "plugin/table.js")
|
||||
msg.Push(nfs.PATH, ice.USR_VOLCANOS).Push(nfs.FILE, "plugin/local/code/vimer.js")
|
||||
msg.Push(nfs.PATH, ice.USR_VOLCANOS).Push(nfs.FILE, "plugin/local/code/inner.js")
|
||||
msg.Push(nfs.PATH, ice.USR_VOLCANOS).Push(nfs.FILE, "plugin/local/code/inner.css")
|
||||
msg.Push(nfs.PATH, ice.USR_VOLCANOS).Push(nfs.FILE, "plugin/local/code/vimer.css")
|
||||
msg.Push(nfs.PATH, ice.USR_ICEBERGS).Push(nfs.FILE, "core/code/vimer.go")
|
||||
can.core.List([
|
||||
"index.css", "proto.js", "frame.js", "plugin/table.js",
|
||||
"plugin/local/code/vimer.js",
|
||||
"plugin/local/code/inner.js",
|
||||
"plugin/local/code/inner.css",
|
||||
"plugin/local/code/vimer.css",
|
||||
], function(item) { msg.Push(nfs.PATH, ice.USR_VOLCANOS).Push(nfs.FILE, item) })
|
||||
show(msg, function(item, path) { return [{text: [path.split(ice.PS).slice(-2).join(ice.PS), html.DIV, html.ITEM], onclick: function(event) {
|
||||
can.onimport.tabview(can, item.path, item.file)
|
||||
}}] })
|
||||
|
@ -160,8 +160,9 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
|
||||
}))._target
|
||||
},
|
||||
plug: function(can, meta, cb, target) { if (!meta || !meta.index) { return }
|
||||
meta.type = "plug", can.onappend.plugin(can, meta, function(sub) { sub.sup = can
|
||||
can.page.ClassList.add(can, sub._target, chat.FLOAT)
|
||||
meta.type = meta.type||"plug", meta.name = meta.index, can.onappend.plugin(can, meta, function(sub) { sub.sup = can
|
||||
// can.page.ClassList.add(can, sub._target, chat.FLOAT)
|
||||
can.page.ClassList.add(can, sub._target, html.HIDE)
|
||||
sub.ConfHeight(target.offsetHeight-2*html.ACTION_HEIGHT)
|
||||
can.page.style(can, sub._output, html.MAX_HEIGHT, sub.ConfHeight(), html.MAX_WIDTH, sub.ConfWidth())
|
||||
sub.run = function(event, cmds, cb) {
|
||||
|
4
proto.js
4
proto.js
@ -217,6 +217,10 @@ var html = {PLUGIN_MARGIN: 10, ACTION_HEIGHT: 31, ACTION_MARGIN: 200,
|
||||
HOVER: "hover", HOVER_SELECT: "hover,select",
|
||||
LIGHT: "light", DARK: "dark",
|
||||
|
||||
VIEW: "view",
|
||||
PLUG: "plug",
|
||||
DIV_PLUG: "div.plug",
|
||||
FLOW: "flow", FLEX: "flex",
|
||||
PAGE: "page", TABS: "tabs", MENU: "menu", NODE: "node",
|
||||
ZONE: "zone", LIST: "list", ITEM: "item", NAME: "name", ICON: "icon",
|
||||
HEAD: "head", LEFT: "left", MAIN: "main", FOOT: "foot", AUTO: "auto", SHOW: "show", HIDE: "hide",
|
||||
|
Loading…
x
Reference in New Issue
Block a user