1
0
mirror of https://shylinux.com/x/volcanos synced 2025-04-25 16:58:06 +08:00
This commit is contained in:
IT 老营长 @云轩领航-创始人 2023-06-04 21:27:44 +08:00
parent e56c93ffbc
commit d276fb2efd
4 changed files with 31 additions and 11 deletions

View File

@ -141,8 +141,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
can.core.Item(meta.feature, function(key, cb) { cb.help && sub.user.trans(sub, kit.Dict(key, cb.help)) }) 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)) 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) 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) }), meta.inputs && sub.onappend._option(sub, meta, sub._option, meta.msg), can.base.isFunc(cb) && cb(sub)
can.base.isFunc(cb) && cb(sub)
sub._legend && (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) { can.misc.Event(event, sub, function(msg) { can.user.carte(event, sub, sub.onaction, sub.onaction.list.concat([[ctx.ACTION].concat(can.core.Item(meta.feature._trans))]), function(event, button) { can.misc.Event(event, sub, function(msg) {
msg.RunAction(event, can.core.Value(sub, chat._OUTPUTS_CURRENT), [ctx.ACTION, button]) || msg.RunAction(event, sub, [ctx.ACTION, button]) || sub.runAction(event, button) msg.RunAction(event, can.core.Value(sub, chat._OUTPUTS_CURRENT), [ctx.ACTION, button]) || msg.RunAction(event, sub, [ctx.ACTION, button]) || sub.runAction(event, button)
@ -152,7 +151,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
sub.isCmdMode() && sub.Conf(can.misc.Search(can)) sub.isCmdMode() && sub.Conf(can.misc.Search(can))
if (can.user.isMobile && !can.user.isLandscape()) { return } if (can.user.isMobile && !can.user.isLandscape()) { return }
if (can.page.ClassList.has(can, sub._target, html.OUTPUT)) { return } if (can.page.ClassList.has(can, sub._target, html.OUTPUT)) { return }
sub.isCmdMode() && !can.base.isIn(meta.index, web.CODE_VIMER, web.CODE_INNER, web.WIKI_WORD, web.CHAT_MACOS_DESKTOP) && can.page.insertBefore(can, can.user.header(can), sub._output, sub._fields) sub.isCmdMode() && !can.base.isIn(meta.index, web.CODE_VIMER, web.CODE_INNER, web.CHAT_MACOS_DESKTOP) && can.page.insertBefore(can, can.user.header(can), sub._output, sub._fields)
}); return sub }); return sub
}, },
_option: function(can, meta, option, skip) { var index = -1, args = can.base.Obj(meta.args||meta.arg, []), opts = can.base.Obj(meta.opts, {}) _option: function(can, meta, option, skip) { var index = -1, args = can.base.Obj(meta.args||meta.arg, []), opts = can.base.Obj(meta.opts, {})
@ -193,11 +192,11 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
}, can._inputs = can._inputs||{}, can._inputs[item.name] = sub, sub.sup = can }, can._inputs = can._inputs||{}, can._inputs[item.name] = sub, sub.sup = can
can.core.ItemCB(sub.onaction, function(key, cb) { sub._target[key] = function(event) { can.misc.Event(event, can, function(msg) { cb(event, sub, sub._target) })} }) can.core.ItemCB(sub.onaction, function(key, cb) { sub._target[key] = function(event) { can.misc.Event(event, can, function(msg) { cb(event, sub, sub._target) })} })
can.core.ItemCB(item, function(key, cb) { sub._target[key] = function(event) { can.misc.Event(event, can, function(msg) { cb(event, sub, sub._target) })} }) can.core.ItemCB(item, function(key, cb) { sub._target[key] = function(event) { can.misc.Event(event, can, function(msg) { cb(event, sub, sub._target) })} })
item.action && can.onappend.figure(sub, item, sub._target, function(_sub, value) { can.Update() }); if (skip) { return } item.action && can.onappend.figure(sub, item, sub._target, function(_sub, value) { can.Update() }); if (skip === true) { return }
item.type == html.BUTTON && item.action == ice.AUTO && can.base.isUndefined(can._delay_init) && (auto = sub._target), next() item.type == html.BUTTON && item.action == ice.AUTO && can.base.isUndefined(can._delay_init) && (auto = sub._target), next()
can.Conf(ice.AUTO) == item.name && (auto = sub._target) can.Conf(ice.AUTO) == item.name && (auto = sub._target)
}) })
}; var auto; can.core.Next(can.core.Value(can, [chat.ONIMPORT, mdb.LIST])||meta.inputs, add, function() { can.Conf(ice.AUTO) == "delay" || auto && auto.click() }) }; var auto; can.core.Next(can.core.Value(can, [chat.ONIMPORT, mdb.LIST])||meta.inputs, add, function() { skip || can.Conf(ice.AUTO) == "delay" || auto && auto.click() })
}, },
_action: function(can, list, action, meta) { meta = meta||can.onaction||{}, action = action||can._action, can.onmotion.clear(can, action) _action: function(can, list, action, meta) { meta = meta||can.onaction||{}, action = action||can._action, can.onmotion.clear(can, action)
function run(event, button) { can.misc.Event(event, can, function(msg) { var _can = can._fields? can.sup: can function run(event, button) { can.misc.Event(event, can, function(msg) { var _can = can._fields? can.sup: can

View File

@ -3,6 +3,9 @@ const PROJECT_HIDE = "web.code.inner:project", TABVIEW_HIDE = "web.code.inner:ta
const CURRENT_FILE = "web.code.inner:currentFile", SELECT_LINE = "web.code.inner:selectLine" const CURRENT_FILE = "web.code.inner:currentFile", SELECT_LINE = "web.code.inner:selectLine"
const VIEW_CREATE = "tabview.view.create", VIEW_REMOVE = "tabview.view.remove", LINE_SELECT = "tabview.line.select" const VIEW_CREATE = "tabview.view.create", VIEW_REMOVE = "tabview.view.remove", LINE_SELECT = "tabview.line.select"
Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb) { var paths = can.core.Split(can.Option(nfs.PATH), mdb.FS); can.Option(nfs.PATH, paths[0]) Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb) { var paths = can.core.Split(can.Option(nfs.PATH), mdb.FS); can.Option(nfs.PATH, paths[0])
switch (can.Mode()) {
case "result": msg.result = msg.result||[can._output.innerHTML], can.Mode(chat.SIMPLE)
}
can.core.List(paths.concat(can.core.Split(msg.Option(nfs.REPOS))), function(p) { if (can.base.endWith(p, "-story/", "-dict/")) { return } can.core.List(paths.concat(can.core.Split(msg.Option(nfs.REPOS))), function(p) { if (can.base.endWith(p, "-story/", "-dict/")) { return }
if (p && paths.indexOf(p) == -1 && p[0] != nfs.PS) { paths.push(p) } if (p && paths.indexOf(p) == -1 && p[0] != nfs.PS) { paths.push(p) }
}), can.onmotion.clear(can), can.onappend.style(can, code.INNER), can.sup.onimport._process = function() {} }), can.onmotion.clear(can), can.onappend.style(can, code.INNER), can.sup.onimport._process = function() {}
@ -13,6 +16,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb) { var paths = can.core.Sp
switch (can.Mode()) { switch (can.Mode()) {
case chat.SIMPLE: // no break case chat.SIMPLE: // no break
case chat.FLOAT: can.onmotion.hidden(can, can.ui.project); break case chat.FLOAT: can.onmotion.hidden(can, can.ui.project); break
make
case chat.CMD: can.misc.sessionStorage(can, PROJECT_HIDE) == html.HIDE && can.onmotion.hidden(can, can.ui.project) case chat.CMD: can.misc.sessionStorage(can, PROJECT_HIDE) == html.HIDE && can.onmotion.hidden(can, can.ui.project)
if (can.misc.sessionStorage(can, TABVIEW_HIDE) == html.HIDE) { can.onmotion.hidden(can, can.ui.project), can.onmotion.hidden(can, can.ui.tabs) } if (can.misc.sessionStorage(can, TABVIEW_HIDE) == html.HIDE) { can.onmotion.hidden(can, can.ui.project), can.onmotion.hidden(can, can.ui.tabs) }
can.onappend.style(can, html.OUTPUT) can.onappend.style(can, html.OUTPUT)
@ -160,12 +164,12 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb) { var paths = can.core.Sp
if (can.base.isFunc(cb)) { return {name: name, _trans: can.onfigure._trans? can.onfigure._trans[name]||"": "", _init: function(target, zone) { return cb(can, target, zone, path) }} } if (can.base.isFunc(cb)) { return {name: name, _trans: can.onfigure._trans? can.onfigure._trans[name]||"": "", _init: function(target, zone) { return cb(can, target, zone, path) }} }
}), can.ui.project) }, }), can.ui.project) },
profile: function(can, msg) { var _msg = can.db.tabview[can.onexport.keys(can)]; _msg.Option(html.WIDTH, msg.Option(html.WIDTH)), border = 1 profile: function(can, msg) { var _msg = can.db.tabview[can.onexport.keys(can)]; _msg.Option(html.WIDTH, msg.Option(html.WIDTH)), border = 1
var height = (can.ui.content._root||can.ui.content).offsetHeight, width = can.onexport.size(can, _msg.Option(html.WIDTH)||0.5, can.ConfWidth()-can.ui.project.offsetWidth)+border
if (msg.Result().indexOf("<iframe src=") > -1) { if (_msg._profile != can.ui._profile) { can.page.Remove(can, _msg._profile) } if (msg.Result().indexOf("<iframe src=") > -1) { if (_msg._profile != can.ui._profile) { can.page.Remove(can, _msg._profile) }
var src = can.page.Select(can, can.page.Create(can, html.DIV, msg.Result()), html.IFRAME, function(target) { return target.src })[0] var src = can.page.Select(can, can.page.Create(can, html.DIV, msg.Result()), html.IFRAME, function(target) { return target.src })[0]
can.ui.profile = _msg._profile = can.page.Append(can, can.ui._profile.parentNode, [{view: [html.PROFILE, html.IFRAME], src: src}])._target can.ui.profile = _msg._profile = can.page.Append(can, can.ui._profile.parentNode, [{view: [html.PROFILE, html.IFRAME], src: src, style: {height: height, width: width}}])._target
can.onmotion.toggle(can, can.ui.profile, true), can.onimport.layout(can) can.onmotion.toggle(can, can.ui.profile, true), can.onmotion.delay(can, function() { can.onimport.layout(can)})
} else { } else {
var height = (can.ui.content._root||can.ui.content).offsetHeight, width = can.onexport.size(can, _msg.Option(html.WIDTH)||0.5, can.ConfWidth()-can.ui.project.offsetWidth)+border
can.page.style(can, can.ui.profile, html.MAX_HEIGHT, height, html.MAX_WIDTH, width), can.ui.profile = _msg._profile = can.ui._profile can.page.style(can, can.ui.profile, html.MAX_HEIGHT, height, html.MAX_WIDTH, width), can.ui.profile = _msg._profile = can.ui._profile
can.onimport.process(can, msg, can.ui.profile, height, width-border, function(sub) { can.page.style(can, sub._output, html.MAX_WIDTH, ""), can.ui.profile._plugin = _msg._profile = sub can.onimport.process(can, msg, can.ui.profile, height, width-border, function(sub) { can.page.style(can, sub._output, html.MAX_WIDTH, ""), can.ui.profile._plugin = _msg._profile = sub
if (sub._index == web.WIKI_WORD) { can.page.style(can, can.ui.profile, html.WIDTH, width+border, html.MAX_WIDTH, width+border), can.onimport.layout(can); return } if (sub._index == web.WIKI_WORD) { can.page.style(can, can.ui.profile, html.WIDTH, width+border, html.MAX_WIDTH, width+border), can.onimport.layout(can); return }
@ -289,6 +293,11 @@ Volcanos(chat.ONSYNTAX, {_init: function(can, msg, cb) { var key = can.onexport.
if (can.onexport.parse(can) == nfs.SVG) { msg.Option(ctx.INDEX, web.WIKI_DRAW+mdb.FS+path+file) } if (can.onexport.parse(can) == nfs.SVG) { msg.Option(ctx.INDEX, web.WIKI_DRAW+mdb.FS+path+file) }
if (msg.Option(ctx.INDEX)) { return can.onsyntax._index(can, msg, function(target) { can.ui.content = target, cb(msg._content = content._root? (target._root = content._root): target) }, content._root? content: can.ui._profile.parentNode) } if (msg.Option(ctx.INDEX)) { return can.onsyntax._index(can, msg, function(target) { can.ui.content = target, cb(msg._content = content._root? (target._root = content._root): target) }, content._root? content: can.ui._profile.parentNode) }
function show(p) { function show(p) {
p && p.include && can.core.List(p.include, function(from) {
can.core.Item(can.onsyntax[from].keyword, function(key, value) {
p.keyword[key] = p.keyword[key] || value
})
})
if (!content._root && can.db.history.length > 1) { content = can.ui.content = can.page.insertBefore(can, [{view: html.CONTENT, style: {width: can.ui.content.offsetWidth}}], can.ui._profile), content._cache_key = key } if (!content._root && can.db.history.length > 1) { content = can.ui.content = can.page.insertBefore(can, [{view: html.CONTENT, style: {width: can.ui.content.offsetWidth}}], can.ui._profile), content._cache_key = key }
content._max = 0, content._msg = msg, msg.__content = content, can.page.Appends(can, content, [{view: ["tips", "", msg.Option(nfs.FILE)]}]) content._max = 0, content._msg = msg, msg.__content = content, can.page.Appends(can, content, [{view: ["tips", "", msg.Option(nfs.FILE)]}])
if (msg.Length() > 0) { can.onsyntax._change(can, msg), can.onaction.rerankLine(can, "tr.line:not(.delete)>td.line") if (msg.Length() > 0) { can.onsyntax._change(can, msg), can.onaction.rerankLine(can, "tr.line:not(.delete)>td.line")

View File

@ -185,13 +185,18 @@ Volcanos(chat.ONSYNTAX, {
}, },
}, mod: {prefix: {"//": code.COMMENT}, keyword: {"go": code.KEYWORD, "module": code.KEYWORD, "require": code.KEYWORD, "replace": code.KEYWORD}}, sum: {}, }, mod: {prefix: {"//": code.COMMENT}, keyword: {"go": code.KEYWORD, "module": code.KEYWORD, "require": code.KEYWORD, "replace": code.KEYWORD}}, sum: {},
js: {prefix: {"// ": code.COMMENT}, regexp: {"[A-Z_0-9]+": code.CONSTANT}, keyword: { js: {prefix: {"// ": code.COMMENT}, regexp: {"[A-Z_0-9]+": code.CONSTANT}, keyword: {
"import": code.KEYWORD, "from": code.KEYWORD,
"var": code.KEYWORD, "function": code.KEYWORD, "typeof": code.KEYWORD, "const": code.KEYWORD, "new": code.KEYWORD, "delete": code.KEYWORD, "var": code.KEYWORD, "function": code.KEYWORD, "typeof": code.KEYWORD, "const": code.KEYWORD, "new": code.KEYWORD, "delete": code.KEYWORD,
"if": code.KEYWORD, "else": code.KEYWORD, "if": code.KEYWORD, "else": code.KEYWORD,
"for": code.KEYWORD, "in": code.KEYWORD, "while": code.KEYWORD, "break": code.KEYWORD, "continue": code.KEYWORD, "for": code.KEYWORD, "in": code.KEYWORD, "while": code.KEYWORD, "break": code.KEYWORD, "continue": code.KEYWORD,
"switch": code.KEYWORD, "case": code.KEYWORD, "default": code.KEYWORD, "switch": code.KEYWORD, "case": code.KEYWORD, "default": code.KEYWORD,
"return": code.KEYWORD, "try": code.KEYWORD, "catch": code.KEYWORD, "debugger": code.KEYWORD, "return": code.KEYWORD, "try": code.KEYWORD, "catch": code.KEYWORD, "debugger": code.KEYWORD,
"import": code.KEYWORD, "from": code.KEYWORD, "export": code.KEYWORD, "default": code.KEYWORD,
"async": code.KEYWORD, "await": code.KEYWORD,
"class": code.KEYWORD, "static": code.KEYWORD,
"let": code.KEYWORD,
"true": code.CONSTANT, "false": code.CONSTANT, "null": code.CONSTANT, "undefined": code.CONSTANT, "true": code.CONSTANT, "false": code.CONSTANT, "null": code.CONSTANT, "undefined": code.CONSTANT,
"Array": code.DATATYPE, "JSON": code.DATATYPE, "Date": code.DATATYPE, "Math": code.DATATYPE, "XMLHttpRequest": code.DATATYPE, "WebSocket": code.DATATYPE, "Array": code.DATATYPE, "JSON": code.DATATYPE, "Date": code.DATATYPE, "Math": code.DATATYPE, "XMLHttpRequest": code.DATATYPE, "WebSocket": code.DATATYPE,
"window": code.OBJECT, "console": code.OBJECT, "navigator": code.OBJECT, "window": code.OBJECT, "console": code.OBJECT, "navigator": code.OBJECT,
@ -227,7 +232,9 @@ Volcanos(chat.ONSYNTAX, {
ls[0] && push(opts.block+nfs.PT+ls[0]) ls[0] && push(opts.block+nfs.PT+ls[0])
} }
}, },
}, json: {}, }, json: {split: {operator: "{[:,]}"}, keyword: {
"true": code.CONSTANT, "false": code.CONSTANT,
}},
css: {prefix: {"// ": code.COMMENT, "/* ": code.COMMENT}, split: {operator: "{[(.,:;&>=)]}"}, css: {prefix: {"// ": code.COMMENT, "/* ": code.COMMENT}, split: {operator: "{[(.,:;&>=)]}"},
func: function(can, push, text) { text.indexOf("/* ") == 0 && push(can.base.trimPrefix(can.base.trimSuffix(text, " */"), "/* ")) }, func: function(can, push, text) { text.indexOf("/* ") == 0 && push(can.base.trimPrefix(can.base.trimSuffix(text, " */"), "/* ")) },
regexp: { regexp: {
@ -259,6 +266,10 @@ Volcanos(chat.ONSYNTAX, {
"float": code.FUNCTION, "clear": code.FUNCTION, "both": code.CONSTANT, "float": code.FUNCTION, "clear": code.FUNCTION, "both": code.CONSTANT,
"transition": code.FUNCTION, "transform": code.FUNCTION, "translate": code.FUNCTION, "rotate": code.FUNCTION, "transition": code.FUNCTION, "transform": code.FUNCTION, "translate": code.FUNCTION, "rotate": code.FUNCTION,
"padding-bottom": code.FUNCTION,
"background": code.FUNCTION,
"background-size": code.FUNCTION,
"background-position": code.FUNCTION,
"background-color": code.FUNCTION, "color": code.FUNCTION, "caret-color": code.FUNCTION, "background-color": code.FUNCTION, "color": code.FUNCTION, "caret-color": code.FUNCTION,
"font-family": code.FUNCTION, "font-style": code.FUNCTION, "font-weight": code.FUNCTION, "font-size": code.FUNCTION, "font-family": code.FUNCTION, "font-style": code.FUNCTION, "font-weight": code.FUNCTION, "font-size": code.FUNCTION,
"line-height": code.FUNCTION, "text-align": code.FUNCTION, "tab-size": code.FUNCTION, "white-space": code.FUNCTION, "line-height": code.FUNCTION, "text-align": code.FUNCTION, "tab-size": code.FUNCTION, "white-space": code.FUNCTION,
@ -313,8 +324,8 @@ Volcanos(chat.ONSYNTAX, {
"DOCTYPE": code.KEYWORD, "html": code.KEYWORD, "head": code.KEYWORD, "body": code.KEYWORD, "DOCTYPE": code.KEYWORD, "html": code.KEYWORD, "head": code.KEYWORD, "body": code.KEYWORD,
"meta": code.KEYWORD, "title": code.KEYWORD, "link": code.KEYWORD, "script": code.KEYWORD, "meta": code.KEYWORD, "title": code.KEYWORD, "link": code.KEYWORD, "script": code.KEYWORD,
"src": code.FUNCTION, "href": code.FUNCTION, "rel": code.FUNCTION, "style": code.FUNCTION, "width": code.FUNCTION, "height": code.FUNCTION, "src": code.FUNCTION, "href": code.FUNCTION, "rel": code.FUNCTION, "style": code.FUNCTION, "width": code.FUNCTION, "height": code.FUNCTION,
"class": code.FUNCTION,
"button": code.KEYWORD,
"fieldset": code.KEYWORD, "legend": code.KEYWORD, "form": code.KEYWORD, "fieldset": code.KEYWORD, "legend": code.KEYWORD, "form": code.KEYWORD,
"h1": code.KEYWORD, "h2": code.KEYWORD, "h3": code.KEYWORD, "h1": code.KEYWORD, "h2": code.KEYWORD, "h3": code.KEYWORD,
"p": code.KEYWORD, "a": code.KEYWORD, "br": code.KEYWORD, "hr": code.KEYWORD, "p": code.KEYWORD, "a": code.KEYWORD, "br": code.KEYWORD, "hr": code.KEYWORD,

View File

@ -29,3 +29,4 @@ div.story[data-type=spark_tabs] { margin-top:20px; }
div.story[data-type=spark_tabs]>div.tabs>div.item { font-style:italic; padding:5px 20px; height:32px; float:left; } div.story[data-type=spark_tabs]>div.tabs>div.item { font-style:italic; padding:5px 20px; height:32px; float:left; }
div.story[data-type=spark_tabs]>div.tabs>div.item.select { border-bottom:blue solid 2px; } div.story[data-type=spark_tabs]>div.tabs>div.item.select { border-bottom:blue solid 2px; }
div.story[data-type=spark_tabs]>div.story:not(.select) { display:none; } div.story[data-type=spark_tabs]>div.story:not(.select) { display:none; }
fieldset.word>div.output>fieldset.web.code.inner.output div.output { border-left:blue solid 5px; }