1
0
mirror of https://shylinux.com/x/volcanos synced 2025-04-25 08:48:06 +08:00
This commit is contained in:
harveyshao 2023-01-10 21:42:22 +08:00
parent 39042db745
commit 9148445d60
20 changed files with 422 additions and 89 deletions

119
frame.js
View File

@ -17,6 +17,11 @@ Volcanos(chat.ONENGINE, {_init: function(can, meta, list, cb, target) {
can.onengine.listen(can, chat.ONSEARCH, function(msg, arg) { arg[0] == ctx.COMMAND && can.run(msg, ["can.command"]) })
can.onengine.signal(can, chat.ONMAIN, can.request()), can.base.isFunc(cb) && cb(can)
})
// can.onappend.topic(can, "dark", {topic: "#0d1117", plugin: "#030507", input: "#212121", output: "#0d1117", table: "#060709",
can.onappend.topic(can, "dark", {topic: "#0d1117", plugin: "#030507", input: "#212121", output: "#0d1117", table: "#030507",
hover: "#3f3f46", border: "#3a3f47", label: "#c9d1d9", text: "white", warn: "red", notice: "blue"}),
can.onappend.topic(can, "light", {topic: "white", plugin: "#f3f5f6", input: "white", output: "white", table: "#f3f5f6",
hover: "#E1F2F4", border: "#0000", label: "black", text: "black", warn: "red", notice: "blue"})
},
_search: function(event, can, msg, panel, cmds, cb) {
var sub, mod = can, fun = can, key = ""; can.core.List(cmds[1].split(ice.PT), function(value) { fun && (sub = mod, mod = fun, fun = mod[value], key = value) })
@ -338,22 +343,112 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
} }), can.onfigure[input]._init && can.onfigure[input]._init(can, meta, target, _cb)
})
},
layout: function(can, target, type, list) {
topic: function(can, topic, color, style, list) { const SOLID = " solid 1px", GLASS = "#0000"
const INPUT_STYLE = "input-style", INPUT_HOVER_STYLE = "input-hover-style", GLASS_STYLE = "glass-style", OUTPUT_STYLE = "output-style"
const TABLE_HEAD_STYLE = "table-head-style", TABLE_ROW_HOVER_STYLE = "table-row-hover-style", TABLE_CELL_HOVER_STYLE = "table-cell-hover-style"
const ITEM_HOVER_STYLE = "item-hover-style", CARTE_ITEM_HOVER_STYLE = "carte-item-hover-style", CARTE_ITEM_STYLE = "carte-item-style"
const PANEL_STYLE = "panel-style", PLUGIN_STYLE = "plugin-style"
style = style||{
"input-style": {"background-color": color.input, color: color.text, border: color.border+SOLID, "border-radius": "5px", "outline": html.NONE, "box-shadow": html.NONE},
"input-hover-style": {"border": color.text+SOLID}, "glass-style": {"background-color": GLASS},
"output-style": {"background-color": color.output}, "item-hover-style": {"background-color": color.hover}, "carte-item-hover-style": {"background-color": color.hover},
"table-head-style": {"background-color": color.table, color: color.text}, "table-row-hover-style": {"background-color": color.table}, "table-cell-hover-style": {"background-color": color.hover},
"panel-style": {"background-color": color.topic, color: color.label}, "plugin-style": {"background-color": color.plugin, border: color.border+SOLID, "border-radius": "10px"},
}, list = list||[
{type: "*", style: {"color": color.label}},
{type: html.LEGEND, style: [INPUT_STYLE]},
{type: html.LEGEND, name: [html.HOVER], style: [INPUT_HOVER_STYLE]},
{type: html.SELECT, style: [INPUT_STYLE]},
{type: html.SELECT, name: [html.HOVER], style: [INPUT_HOVER_STYLE]},
{type: html.INPUT, style: [INPUT_STYLE]},
{type: html.INPUT, name: [html.HOVER], style: [INPUT_HOVER_STYLE]},
{type: "input:not([type=button])", style: {"border-radius": "0px"}},
{type: "input:not([type=button])", name: [html.HOVER], style: {border: color.notice+SOLID}},
{type: html.TEXTAREA, style: [INPUT_STYLE]},
{type: html.FORM_OPTION, list: [{type: html.DIV_ITEM, name: [html.SELECT], style: [GLASS_STYLE]}]},
{type: html.FORM_OPTION, list: [{type: html.DIV_ITEM, name: [html.HOVER], style: [GLASS_STYLE]}]},
{type: html.DIV_ACTION, list: [{type: html.DIV_ITEM, name: [html.SELECT], style: [GLASS_STYLE]}]},
{type: html.DIV_ACTION, list: [{type: html.DIV_ITEM, name: [html.HOVER], style: [GLASS_STYLE]}]},
{type: html.DIV_OUTPUT, style: [OUTPUT_STYLE]},
{type: "div.path", style: [OUTPUT_STYLE]},
{type: html.DIV_STATUS, style: {color: color.label}},
{type: html.TABLE_LAYOUT, list: [{type: html.DIV_TOGGLE, style: [ITEM_HOVER_STYLE]}]},
{type: html.TABLE_CONTENT, list: [{type: html.TH, style: [TABLE_HEAD_STYLE]}]},
{type: html.TABLE_CONTENT, name: [html.ACTION], list: [{type: "td:last-child", style: [TABLE_HEAD_STYLE]}]},
{type: html.TABLE_CONTENT, list: [{type: html.TR, name: [html.HOVER], style: [TABLE_ROW_HOVER_STYLE]}]},
{type: html.TABLE_CONTENT, list: [{type: html.TD, name: [html.HOVER], style: [TABLE_CELL_HOVER_STYLE]}]},
{type: html.TABLE_CONTENT, list: [{type: html.TD, name: [html.SELECT], style: [TABLE_CELL_HOVER_STYLE]}]},
{type: "div.zone>div.name", style: [TABLE_HEAD_STYLE]},
{type: "div.zone>div.list>div.zone>div.name", style: [TABLE_HEAD_STYLE]},
{type: "div.zone>div.list>div.zone>div.name", name: [html.HOVER], style: [ITEM_HOVER_STYLE]},
{type: html.H1, name: [html.HOVER], style: [ITEM_HOVER_STYLE]},
{type: html.H2, name: [html.HOVER], style: [ITEM_HOVER_STYLE]},
{type: html.H3, name: [html.HOVER], style: [ITEM_HOVER_STYLE]},
{type: html.LABEL, style: {color: color.label}},
{type: html.A, style: {color: color.notice}},
{type: html.DIV_CODE, style: {border: color.border+SOLID}},
{type: html.DIV_ITEM, name: [html.HOVER], style: [ITEM_HOVER_STYLE]},
{type: html.DIV_ITEM, name: [html.SELECT], style: [ITEM_HOVER_STYLE]},
{type: html.DIV_TABS, list: [{type: html.DIV, style: {"background-color": color.plugin}}]},
{type: html.DIV_TABS, list: [{type: html.DIV, name: [html.HOVER], style: [OUTPUT_STYLE]}]},
{type: html.DIV_TABS, list: [{type: html.DIV, name: [html.SELECT], style: [OUTPUT_STYLE]}]},
{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, name: [html.HOVER], style: [CARTE_ITEM_HOVER_STYLE]}]},
{type: html.DIV_FLOAT, style: [PLUGIN_STYLE]},
{type: html.FIELDSET_PANEL, style: [PANEL_STYLE]},
{type: html.FIELDSET_PANEL, list: [{type: ">"+html.DIV_OUTPUT, style: [PANEL_STYLE]}]},
{type: html.FIELDSET_PANEL, name: ["Footer"], list: [{type: html.DIV_OUTPUT, list: [{type: html.DIV_TOAST, style: [TABLE_HEAD_STYLE]}], }]},
{type: html.FIELDSET_PANEL, name: ["Footer"], list: [{type: html.DIV_OUTPUT, list: [{type: html.DIV, name: [html.HOVER], style: [ITEM_HOVER_STYLE]}], }]},
{type: html.FIELDSET_PANEL, name: ["Header"], list: [{type: html.DIV_OUTPUT, list: [{type: html.DIV, name: [html.HOVER], style: [ITEM_HOVER_STYLE]}], }]},
{type: html.FIELDSET_STORY, list: [{type: html.DIV_STATUS, style: {"border-top": color.border+SOLID}}]},
{type: html.FIELDSET_PLUGIN, list: [{type: html.DIV_STATUS, style: {"border-top": color.border+SOLID}}]},
{type: html.FIELDSET_PLUGIN, style: [PLUGIN_STYLE]},
{type: html.FIELDSET_STORY, style: [PLUGIN_STYLE]},
{type: html.FIELDSET_INPUT, style: [PLUGIN_STYLE]},
{type: html.FIELDSET_INPUT, style: {"border-radius": 0}},
// {type: html.FIELDSET_INPUT, style: {"border": color.notice+SOLID}},
]
function render(pre, list) { return can.core.List(list, function(item) { var type = item.type+can.core.List(item.name, function(name) { return (name==html.HOVER? ice.DF: ice.PT)+name }).join("")
return (item.style? (pre+ice.SP+type+" { "+(can.base.isArray(item.style)? can.core.List(item.style, function(item) {
return can.core.Item(style[item], function(key, value) { return key+": "+value }).join("; ")
}).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) }
var text = render("body."+topic, list)
console.log("what", text)
can.page.Append(can, document.head, "style", {"innerText": text})
},
layout: function(can, target, type, list) { const FLOW = "flow", FLEX = "flex"
switch (type||ice.AUTO) {
case ice.AUTO: const FLOW = "flow", FLEX = "flex"
case FLOW:
case FLEX:
case ice.AUTO: var count = 0;
type = type == "" || type == ice.AUTO? FLEX: type
var ui = {size: {}}; function append(target, type, list) { can.page.ClassList.add(can, target, [html.LAYOUT, type]),
can.core.List(list, function(item) {
if (can.base.isArray(item)) {
append(can.page.Append(can, target, [{}])._target, type==FLOW? FLEX: FLOW, item)
} else {
} else if (can.base.isObject(item)) { item._index = count++
item.layout = function(width, height) {
item.width = width
item.height = height
}
ui.size[item._index+""] = item.height||item.width
can.onappend.plugin(can, item, function(sub) {
item.layout = function(width, height) {
sub.onimport.size(sub, height, width)
}
}, target, ui[item._index+""] = can.onappend.field(can, item.type, item, target)._target)
} else if (can.base.isString(item)) {
ui[item] = can.page.Append(can, target, [item])._target
}
}); return list
}
var defer = []; function layout(type, list, width, height) { can.core.List(list, function(item) {
var defer = []; function layout(type, list, width, height) { var _width = width, _height = height; can.core.List(list, function(item) {
if (item == html.CONTENT) {
defer.push(function() { can.page.style(can, ui[item], html.HEIGHT, height, html.WIDTH, width) })
} else if (can.base.isString(item)) {
return
} else {
if (can.base.isObject(item)) { var meta = item; item = (item._index||"")+"" }
function calc(item, size, total) {
if (!ui.size[item]) {
return size
@ -367,15 +462,17 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
} else if (type == FLOW) {
can.page.style(can, ui[item], html.WIDTH, width)
if (can.base.isObject(meta)) { meta.layout(width, calc(item, ui[item].offsetHeight, height)) }
height -= calc(item, ui[item].offsetHeight, height)
} else {
can.page.style(can, ui[item], html.HEIGHT, height, html.WIDTH, calc(item, ui[item].offsetWidth, width))
width -= calc(item, ui[item].offsetWidth, width)
} else { var w = calc(item, ui[item].offsetWidth||_width/list.length, _width), h = height
if (can.base.isObject(meta)) { h = "", meta.layout(w = _width/list.length, h) }
can.page.style(can, ui[item], html.HEIGHT, h, html.WIDTH, w)
width -= w
}
}
}), can.core.List(list, function(item) { if (!can.base.isString(item)) { layout(type == FLOW? FLEX: FLOW, item, width, height) } }) }
list = append(target, FLEX, list||[html.PROJECT, [[html.CONTENT, html.PROFILE], html.DISPLAY]])
ui.layout = function(width, height) { defer = [], layout(FLEX, list, width, height), defer.forEach(function(cb) { cb() }) }
}), can.core.List(list, function(item) { if (can.base.isArray(item)) { layout(type == FLOW? FLEX: FLOW, item, width, height) } }) }
list = append(target, type, list||[html.PROJECT, [[html.CONTENT, html.PROFILE], html.DISPLAY]])
ui.layout = function(width, height) { can.onmotion.delayLong(can, function() { defer = [], layout(type, list, width, height), defer.forEach(function(cb) { cb() }) }) }
return ui
case "tabs-box":
can.page.ClassList.add(can, target, "layout tabs box")

View File

@ -228,11 +228,13 @@ Volcanos("page", {ClassList: {
} else { value[arguments[i]] = arguments[i+1] }
} return can.page.Modify(can, target, {style: value}), value
},
tagis: function(target) { var type = target.tagName.toLowerCase(); for (var i = 1; i < arguments.length; i++) { if (type == arguments[i]) { return true } } },
tagis: function(target) { if (!target || !target.tagName) { return }
var type = target.tagName.toLowerCase(); for (var i = 1; i < arguments.length; i++) { if (type == arguments[i]) { return true } }
},
editable: function(can, item, ok) { item.setAttribute("contenteditable", ok) },
draggable: function(can, item, ok) { item.setAttribute("draggable", ok) },
height: function() { return window.innerHeight },
width: function() { return window.innerWidth },
ismodkey: function(event) { return [lang.META, lang.ALT, lang.CONTROL, lang.SHIFT].indexOf(event.key) > -1 },
isDisplay: function(target) { return target.style.display != html.NONE },
isDisplay: function(target) { return target && target.style.display != html.NONE },
})

View File

@ -125,7 +125,7 @@ Volcanos("user", {info: {}, agent: {
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)
}, _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||""}, {text: item.need == "must"? "*": "", style: {color: cli.RED}}]}, {type: html.TD, list: [can.page.input(can, item)]}]}
}; 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,
]}])
var action = can.onappend._action(can, button||[html.SUBMIT, html.CANCEL], ui.action, {

View File

@ -1,8 +1,7 @@
* { box-sizing:border-box; padding:0; border:0; margin:0; }
* { tab-size:4; box-sizing:border-box; padding:0; border:0; margin:0; }
body { background-color:black; color:cyan; font-size:16px; }
legend { background-color:cadetblue; color:white; padding:0 20px; margin-right:5px; }
select { background-color:black; color:cyan; padding:0 10px; margin-right:5px; }
textarea { background-color:cyan; padding:5px; width:400px; resize:vertical; }
input:not([type=file]) { background-color:cyan; padding:0 5px; margin-right:5px; }
input:not([type=button]) { width:120px; }
input[name=date] { width:150px; }
@ -23,27 +22,31 @@ input[type=button][name=stop] { background-color:red; }
input[type=button][name=trash] { background-color:red; }
input[type=button][name=delete] { background-color:red; }
input[type=button][name=remove] { background-color:red; }
textarea { background-color:cyan; padding:5px; width:400px; resize:vertical; }
/* output */
div.output { position:relative; }
div.layout.flex>div { float:left; }
div.layout.flex>* { float:left; }
div.project div.list { margin-left:10px; }
div.project div.item { padding:2px 10px; }
div.project div.item>div.name { padding-left:20px; }
div.project div.switch { rotate:90deg; width:12px; float:left; }
div.project div.switch.open { rotate:180deg; translate:3px -3px; }
div.project div.switch { margin-top:2px; width:12px; float:left; rotate:90deg; }
div.project div.switch.open { translate:3px -3px; rotate:180deg; }
div.project div.zone>div.name { background-color:steelblue; color:white; text-align:center; padding:3px; clear:both; }
div.project div.zone>div.list>div.zone>div.name { background-color:#09466fc2; text-align:left; padding-left:20px; }
div.project div.zone>div.list>div.zone>div.name:hover { background-color:#3c7da8d9; }
div.project div.zone>div.action>div.item { float:right; clear:none; }
div.project div.zone>div.action>div.item input[type=text] { background-color:#ff000000; color:white; padding-left:10px; }
div.story[data-type=spark] { background-color:#2169a9a6; color:white; padding:5px 10px; border-left:solid 5px blue; margin:10px; }
div.code { background-color:#343a3445; color:white; padding:10px; border:solid 2px green; }
table.content thead { position:sticky; top:2px; }
table.content th { background-color:steelblue; padding:2px 5px; }
table.content td { padding:2px 5px; }
table.content.action th:last-child { position:sticky; right:2px; }
table.content.action td:last-child { background-color:steelblue; position:sticky; right:2px; }
div.code { background-color:#343a3445; color:white; padding:10px; border:solid 2px green; }
div.story[data-type=spark] { background-color:#2169a9a6; color:white; padding:5px 10px; border-left:solid 5px blue; margin:10px; }
/* fieldset */
div.tabs div { background-color:gray; }
div.tabs div:hover { background-color:#0000; }
div.tabs div.select { background-color:#0000; }
fieldset.plugin { background-color:#061c3c9e; padding:10px; margin:10px; }
fieldset.plugin>div.status { border-top:1px solid darkcyan; }
fieldset.story>div.status { border-top:1px solid darkcyan; }
@ -99,6 +102,8 @@ body>div.input td { padding:5px; }
body>div.input select { width:171px; }
body>div.input textarea { height:120px; width:171px; }
body>div.input input:not([type=button]) { width:171px; }
body>div.input div.action input[type=button] { width:80px; }
body>div.input div.action div { margin:5px; float:right; }
body>div.input.login { padding:10px; background-color:steelblue; min-width:240px; }
body>div.input.login input[type=button] { width:90px; }
body>div.upload div.item { float:left; }
@ -109,11 +114,10 @@ body>div.upload div.status div.show { float:right; }
body>div.upload div.status div.size { text-align:center; }
body>div.upload input[type=file] { width:320px; }
/* font */
* { tab-size:4; }
textarea { tab-size:2; height:62px; }
legend { font-size:1.2rem; height:31px; }
select, input { font-size:1.0rem; height:31px; }
div.project, div.item, div.code, div.story[data-type=spark], svg, table.content { font-family:monospace; white-space:pre; text-align:left; }
table.content, div.project, div.item, div.code, div.story[data-type=spark], svg { font-family:monospace; white-space:pre; text-align:left; }
div.action>div.tabs { padding:5px 10px; height:31px; }
div.status>div.item { padding:5px; height:30px; }
div.status>div.item>label { font-size:0.6rem; }
@ -124,12 +128,9 @@ ul { padding-left:40px; margin:20px 0; }
/* hover */
legend:hover { background-color:skyblue; }
select:hover { background-color:gray; color:cyan; }
input[type=button]:hover { background-color:gray; }
input:not([type=button]):not([type=file]):hover { background-color:white; }
input[name=cmd]:hover { background-color:cyan; color:black; }
div.tabs:hover, div.tabs.select, div.item:hover, div.item.select, table.content tr:hover, table.content tr.select, h1:hover, h2:hover, h3:hover { background-color:steelblue; }
div.story[data-type=spark] span:hover { background-color:deepskyblue; box-shadow:4px 4px 20px 4px #29318e; }
div.item:hover, div.item.select, table.content tr:hover, table.content tr.select, h1:hover, h2:hover, h3:hover { background-color:steelblue; }
table.content th:hover, table.content td:hover, table.content td.select { background-color:cornflowerblue; }
div.story[data-type=spark] span:hover { background-color:deepskyblue; box-shadow:4px 4px 20px 4px #29318e; }
body>div.carte div.item:hover { background-color:cornflowerblue; }
select, input[type=text], textarea { box-shadow:4px 4px 20px 4px #626bd0; }
legend, select, input[type=button], div.tabs, div.item, th, td, h1, h2, h3 { cursor:pointer; }
@ -138,19 +139,16 @@ div.title, div.story[data-type=spark] { cursor:copy; }
form.option, div.action { display:contents; }
form.option>div.item>label, div.action>div.item>label, .hidden, .hide { display:none; }
fieldset:not(.float):not(.full)>form.option input[type=button][name=close] { display:none; }
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.project div.item, div.content, div.item.textarea, div.code, div.story[data-type=spark] { clear:both; }
div.action, div.output, div.status, div.project, div.display, div.profile, div.content, div.code, div.story, table.content, table.content td, body>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.status>legend { margin-left:2px; margin-right:0; float:right; clear:none; }
fieldset.auto, fieldset.full, fieldset.float, body>div.float { position:fixed; z-index:10; }
div.status>legend { margin-left:2px; margin-right:0; float:right; clear:none; }
div.code { position:sticky; left:0; }
/* white */
body.black a { color:yellow; }
body.black { overflow:hidden; }
body.white { overflow:hidden; }
body.white { background-color:rgba(5,34,56,0.75); color:white; }
body.white select { background-color:yellowgreen; color:white; }
body.white textarea { background-color:white; }
body.white input { background-color:white; }
body.white input[name=cmd] { background-color:black; color:white; }
body.white input[type=button] { background-color:cornflowerblue; color:white; }
@ -161,17 +159,17 @@ body.white input[type=button][name=stop] { background-color:red; }
body.white input[type=button][name=trash] { background-color:red; }
body.white input[type=button][name=delete] { background-color:red; }
body.white input[type=button][name=remove] { background-color:red; }
body.white textarea { background-color:white; }
body.white table.content th { background-color:skyblue; }
body.white table.content.action td:last-child { background-color:skyblue; }
body.white div.zone>div.list>div.zone>div.name { background-color:#e8e9f3; color:black; }
body.white fieldset.panel.Search a { color:yellow; }
body.white fieldset.panel.Action { color:black; }
body.white fieldset.panel.Action div.action { color:white; }
body.white fieldset.plugin { background-color:#ffffffa1; }
body.white fieldset.float { background-color:#0e3369; color:white; }
body.white fieldset.full { background-color:#0e3369; color:white; }
body.white fieldset.full div.project div.zone>div.list>div.zone>div.name { background-color:#09466f66; color:white; }
body.white div.project div.zone>div.list>div.zone>div.name { background-color:#09466f66; color:black; }
/* white hover */
body.white fieldset.full div.zone>div.list>div.zone>div.name { background-color:#09466f66; color:white; }
body.white legend:hover { background-color:skyblue; }
body.white select:hover { background-color:#99cc667d; }
body.white input:hover { background-color:cyan; }
@ -190,33 +188,31 @@ body.white div.item.select { background-color:#4682b46b; }
body.print { -webkit-filter: grayscale(100%); }
body.print { background-color:white; color:black; }
body.print legend, body.print select, body.print input, body.print input[type=button] { background-color:white; color:black; }
body.print div.project div.zone>div.name { background-color:lightgray; }
body.print div.list div.item { background-color:white; }
body.print div.item.select { background-color:lightgray; }
body.print div.story[data-type=spark] { background-color:lightgray; }
body.print table.content th { background-color:lightgray; }
body.print table.content.action td:last-child { background-color:lightgray; }
body.print fieldset.plugin { background-color:white; color:black; }
body.print div.story[data-type=spark] { background-color:lightgray; }
body.print div.zone>div.name { background-color:lightgray; }
body.print div.item.select { background-color:lightgray; }
body.print div.list div.item { background-color:white; }
body.print fieldset.panel { background-color:white; color:black; }
body.print fieldset.draw div.output div.content svg { background-color:lightgray; }
body.print fieldset.plugin { background-color:white; color:black; }
body.print fieldset.draw div.output { background-color:lightgray; }
body.print fieldset.draw div.output div.content svg { background-color:lightgray; }
/* mobile */
body.mobile * { border-radius:0; }
body.mobile * { border-radius:0; overflow:auto; }
body.mobile legend { font-size:1.6rem; height:38px; }
body.mobile select { font-size:1.4rem; height:38px; }
body.mobile input { font-size:1.2rem; height:38px; }
body.mobile textarea { font-size:1.2rem; }
body.mobile table.content th { padding:6px 6px; }
body.mobile form.option>div.item { margin:0; height:38px; }
body.mobile div.action>div.item { margin:0; height:38px; }
body.mobile div.action { display:none; }
body.mobile table.content th { padding:6px 6px; }
body.mobile>div.carte div.item { font-size:1.6rem; }
body.mobile>div.input.login input { font-size:1.4rem; width:264px; }
body.mobile fieldset.plugin { margin:10px 0; }
body.mobile fieldset.plugin.full { margin:0; }
body.mobile fieldset.cmd>div.output { overflow:auto; }
body.mobile fieldset.input.date div.output td { padding:8px 20px; }
body.mobile fieldset.word.float>div.output>div.project { top:38px; }
body.mobile fieldset.Header.head { background-color:#000000b8; font-size:1.6rem; height:3rem; width:100%; position:fixed; top:0; }
body.mobile fieldset.Header.head div.output { height:3rem; }
body.mobile fieldset.Header.head div.output div { height:3rem; margin-left:0; }
@ -233,6 +229,8 @@ body.mobile fieldset.Footer.foot { background-color:#000000b8; font-size:1.6rem;
body.mobile fieldset.Footer.foot div.output { height:3rem; }
body.mobile fieldset.Footer.foot div.output div { height:3rem; }
body.mobile fieldset.Footer.foot input[name=cmd] { height:3rem; }
body.mobile fieldset.input.date div.output td { padding:8px 20px; }
body.mobile fieldset.word.float>div.output>div.project { top:38px; }
body.mobile.landscape fieldset.Header.head { position:unset; }
body.mobile.landscape fieldset.Header.head div.state.time { display:block; }
body.mobile.landscape fieldset.Action.main { margin-top:0; margin-bottom:0; }

View File

@ -1,4 +1,4 @@
fieldset.Action { background-color:rgba(114, 153, 162, 0.54); min-width:160px; }
fieldset.Action { min-width:160px; }
fieldset.Action>div.action { background-color:#4682b46b; width:100%; display:none; }
fieldset.Action>div.action div { font-size:1.1rem; cursor:pointer; padding:5px 20px; height:31px; float:left; }
fieldset.Action>div.action div.select { background-color:#6495ed63; }
@ -45,7 +45,7 @@ fieldset.Action>div.project.toggle {
background-color:cornsilk; opacity:0.4; color:teal; font-size:36px; padding-top:50px; height:150px; width:20px; position:fixed; top:30%;
border-top-right-radius:20px; border-bottom-right-radius:20px;
}
fieldset.Action>div.output>fieldset.plugin>legend { box-shadow:4px 4px 20px 4px #626bd0; }
// fieldset.Action>div.output>fieldset.plugin>legend { box-shadow:4px 4px 20px 4px #626bd0; }
fieldset.Action>div.output>fieldset.plugin:not(.float):not(.full)>legend { float:none; }
fieldset.Action.cmd>div.output>fieldset.plugin { padding:0; margin:0; }
fieldset.Action.cmd>div.output>fieldset.plugin>legend { padding:0 10px; float:left; }

View File

@ -100,9 +100,16 @@ Volcanos(chat.ONACTION, {_init: function(can, target) {
),
onmain: function(can) { can.onimport._share(can, can.misc.Search(can, web.SHARE)) },
onlogin: function(can) { if (!can.Conf(chat.TOOL) && !can.user.mod.isCmd) { return }
can._names = location.pathname, can.Conf(chat.TOOL)? can.core.Next(can.Conf(chat.TOOL), function(item, next) {
can.onimport._cmd(can, item, next)
}): can.runAction(can.request(), ctx.COMMAND, [], function(msg) { can.core.Next(msg.Table(), function(item, next) {
// can._names = location.pathname, can.Conf(chat.TOOL)? can.core.Next(can.Conf(chat.TOOL), function(item, next) {
// can.onimport._cmd(can, item, next)
// }): can.runAction(can.request(), ctx.COMMAND, [], function(msg) { can.core.Next(msg.Table(), function(item, next) {
can.onengine.signal(can, chat.ONACTION_CMD)
can._names = location.pathname, can.Conf(chat.TOOL)? can.onappend.layout(can, can._output, "flow", can.core.List(can.Conf(chat.TOOL), function(item) {
item.type = "plugin"
item.opts = can.misc.Search(can)
item.mode = chat.CMD; return item
})).layout(window.innerWidth, window.innerHeight): can.runAction(can.request(), ctx.COMMAND, [], function(msg) { can.core.Next(msg.Table(), function(item, next) {
can.onimport._cmd(can, item, next)
}) })
},
@ -123,7 +130,8 @@ Volcanos(chat.ONACTION, {_init: function(can, target) {
})
},
onaction_cmd: function(can, msg) { can.Conf(html.MARGIN_Y, 2*html.ACTION_HEIGHT), can.Conf(html.MARGIN_X, 0)
can.page.style(can, can._target, html.HEIGHT, can.ConfHeight(can.page.height()-can.Conf(html.MARGIN_Y)), html.WIDTH, can.ConfWidth(can.page.width()))
can.page.style(can, can._target, html.HEIGHT, can.ConfHeight(can.page.height()), html.WIDTH, can.ConfWidth(can.page.width()))
can.ConfHeight(can.page.height()-can.Conf(html.MARGIN_Y))
can.page.ClassList.add(can, can._target, can.Mode(chat.CMD)), can.page.ClassList.add(can, can._root._target, chat.SIMPLE)
},
onsearch: function(can, msg, arg) { var fields = msg.Option(ice.MSG_FIELDS).split(ice.FS)

View File

@ -7,5 +7,5 @@ fieldset.Header>div.output div.state { float:right; }
fieldset.Header>div.output div.state.avatar { padding:0; height:31px; }
fieldset.Header>div.output div.state.avatar>img { height:31px; }
fieldset.Header>div.output div.search { margin-left:20px; float:left; }
fieldset.Header>div.output div.search>input { margin-top:-5px; }
fieldset.Header>div.output div.search>input { margin-top:-5px; height:30px; }
fieldset.Header>div.output river { margin-right:100px; }

View File

@ -123,7 +123,7 @@ Volcanos(chat.ONPLUGIN, {
}),
topic: shy("界面主题", {
_init: function(can) { can.Option(chat.TOPIC, can.getHeader(chat.TOPIC)) },
}, ["topic:select=white,black", ice.RUN], function(can, msg, arg) {
}, ["topic:select=black,white,light,dark", ice.RUN], function(can, msg, arg) {
msg.Echo(can.onimport.topic(can, arg[0]))
}),
location: shy("请求地址", {

View File

@ -1,5 +1,5 @@
fieldset.Search { background-color:#041a25bd; padding:10px; display:none; position:fixed; left:0px; top:31px; }
fieldset.Search input.word { width:100%; }
fieldset.Search>div.output table { width:100%; }
fieldset.Search>div.status { border-top:1px solid darkcyan; }
// fieldset.Search>div.status { border-top:1px solid darkcyan; }
fieldset.Search>div.status { display:block; overflow:auto; }

View File

@ -5,14 +5,17 @@ fieldset.inner>div.output>div.project { width:230px; }
fieldset.inner>div.output>div.layout.flow { width:min-content; }
fieldset.inner>div.output>div.layout.flow>div.tabs { display:none; }
fieldset.inner>div.output>div.layout.flow>div.path { display:none; }
fieldset.inner>div.output div.content { color:white; font-size:16px; font-family:monospace; position:relative; }
fieldset.inner>div.output input { font-size:14px; }
fieldset.inner>div.output div.zone { font-size:14px; line-height:20px; }
fieldset.inner>div.output div.zone input { outline:none; }
fieldset.inner>div.output div.content { color:white; font-size:14px; font-family:monospace; position:relative; }
fieldset.inner>div.output div.content>tr:hover { background-color:#4682b46b; }
fieldset.inner>div.output div.content>tr.select { background-color:#4682b46b; }
fieldset.inner>div.output div.content>tr.select td.line { background-color:#6495ed63; border:solid 1px red; border-right:solid 2px red; }
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 { 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 { line-height:20px; white-space:pre; padding-left:10px; cursor:text; }
fieldset.inner>div.output div.content td.text span.comment { background-color:#0000; color:green; }
fieldset.inner>div.output div.content td.text span.keyword { color:yellow; }
fieldset.inner>div.output div.content td.text span.package { color:lightgreen; }
fieldset.inner>div.output div.content td.text span.datatype { color:cyan; }
fieldset.inner>div.output div.content td.text span.function { color:lightgreen; }
@ -20,19 +23,29 @@ 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 td.text span.object { color:cyan; }
fieldset.inner>div.output div.find.float { position:absolute; z-index:10; }
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs { background-color:#70809096; height:28px; overflow:auto; display:block; }
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs div { background-color:teal; font-family:monospace; padding:5px 15px; float:left; }
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs div:hover { background-color:#1d3349; }
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs div.select { background-color:#1d3349; }
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs div.avatar { padding:0; height:28px; float:right; }
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs div.avatar>img { height:28px; }
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs { height:38px; overflow:auto; display:block; }
// fieldset.inner.cmd>div.output>div.layout.flow>div.tabs { background-color:#70809096; height:38px; overflow:auto; display:block; }
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs div { font-family:monospace; padding:10px 30px; height:38px; float:left; }
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.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 { background-color:#1d3349; font-family:monospace; padding:5px 10px; display:block; }
fieldset.inner.cmd>div.output>div.layout.flow>div.path { font-family:monospace; padding:5px 10px; display:block; }
fieldset.inner.cmd>div.output>div.layout.flow>div.path span.item { padding:3px 12px; }
fieldset.inner.cmd>div.output>div.layout.flow>div.path span.item:hover { background-color:cornflowerblue; cursor:pointer; }
body.black fieldset.inner>div.output div.content td.text span.comment { background-color:blue; color:cyan; }
// body.white fieldset.inner.cmd>div.output>div.layout.flow>div.tabs div { padding:10px 30px; }
body.white fieldset.inner>div.output div.project div.zone>div.list>div.zone>div.name { background-color:#e8e9f3; }
body.white fieldset.inner.cmd>div.output>div.layout.flow>div.tabs { height:38px; }
body.white fieldset.inner>div.output div.zone { color:#6c6c6c; }
body.white fieldset.inner>div.output div.zone.dream { color:black; }
body.white fieldset.inner>div.output input[type=button] { background-color:#1f87d5;; }
body.white fieldset.inner>div.output div.content td.text { line-height:14px; }
body.white fieldset.inner>div.output div.content td.text span.constant { color:#876d2e; }
body.white fieldset.inner.cmd>div.output>div.layout.flow>div.tabs { background-color:#f5f5f5; }
body.white fieldset.inner.cmd>div.output>div.layout.flow>div.tabs div { background-color:#eeefee; }
body.white fieldset.inner:not(.float):not(.full)>div.output div.content { color:black; }
body.white fieldset.inner:not(.float):not(.full)>div.output div.content td.text span.keyword { color:blue; }
body.white fieldset.inner:not(.float):not(.full)>div.output div.content td.text span.datatype { color:green; }
body.white fieldset.inner:not(.float):not(.full)>div.output div.content td.text span.datatype { color:#02168e; }
body.white fieldset.inner:not(.float):not(.full)>div.output div.content td.text span.function { color:green; }
body.white fieldset.inner.cmd>div.output>div.layout.flow>div.tabs div:hover { background-color:white; }
body.white fieldset.inner.cmd>div.output>div.layout.flow>div.tabs div.select { background-color:white; }
@ -43,8 +56,8 @@ body.white fieldset.inner.cmd>div.output div.content { background-color:white; }
body.white fieldset.inner.cmd>div.output div.content tr.select { background-color:white; }
body.white fieldset.inner.cmd>div.output div.content tr.select td.line { background-color:steelblue; color:white; border:none; }
body.white fieldset.inner.cmd>div.output div.content tr.select td.text { border:solid 1px lightgray; }
body.white fieldset.inner.cmd>div.output div.content td.line { padding-top:4px; border-right:none; }
body.white fieldset.inner.cmd>div.output div.content td.text { padding-top:2px; border:solid 1px transparent; }
body.white fieldset.inner.cmd>div.output div.content td.line { background:white; padding-top:4px; border-right:none; }
body.white fieldset.inner.cmd>div.output div.content td.text { border:solid 1px transparent; }
body.white fieldset.inner>div.output div.content td.text span.string { color:royalblue; }
body.white fieldset.inner>div.output div.content td.text span.package { color:brown; }
body.mobile fieldset.inner>form.option input[name=file] { width:90px; }
@ -62,11 +75,47 @@ body.mobile fieldset.inner.cmd>div.output div.toggle.display { background-color:
}
div.project div.zone.create>div.action { display:none; }
div.project div.zone.create>div.list div.item { padding:2px; float:left; clear:none; }
div.project div.zone.create>div.list div.item input { font-family:monospace; }
div.project div.zone.create>div.list div.item input { font-family:monospace; letter-spacing:2px; }
body.webview div.project div.zone.create>div.list div.item { padding:2px; }
body.white.simple fieldset.plugin div.output.json div.item span.nonce { color:lightgray; }
fieldset.word fieldset.inner>form.option input[name=path] { width:240px; }
fieldset.Action fieldset.plugin.cmd { border:none; }
fieldset>div.output>fieldset.plug { position:absolute; bottom:0px; right:0px; }
fieldset.cmd>div.output>fieldset.plug { position:fixed; bottom:0px; right:0px; }
fieldset>div.output>fieldset.plug { display:none; }
fieldset>div.output>fieldset.plug.select { background-color:#0e3369b3; color:white; display:block; z-index:10; }
fieldset>div.output>fieldset.plug.select { background-color:#060709; color:white; display:block; z-index:10; }
fieldset.inner div.output div.complete>div {
white-space: pre;
float:left;
}
fieldset.inner div.project div.zone>div.action>div.item input[type=text] { margin-right:-10px; }
body.dark fieldset.inner div.project div.zone>div.action>div.item input[type=text] { background-color:#444444; color:white; outline:none; margin-right:-10px; }
body.dark fieldset.inner div.project div.zone>div.action>div.item input[type=text]:hover { background-color:#444444; color:white; outline:none; }
body.dark fieldset.inner>div.output div.project div.zone>div.list>div.zone>div.name { background-color:#3f3f46; }
body.dark fieldset.inner>div.output div.zone { background-color:#2a2a2a; }
body.dark fieldset.inner>div.output input { background-color:#444444; color:white; font-family:monospace; outline:none; }
body.dark fieldset.inner>div.output div.complete div.content { background-color:#2a2a2a; }
body.dark fieldset.inner>div.output div.complete table { background-color:#2a2a2a; }
body.dark fieldset.inner>div.output input[type=button] { background-color:#1d6fa8; }
body.dark fieldset.inner>div.output input:hover { background-color:#444444; color:white; outline:none; }
body.dark fieldset.inner>div.output * { font-size:14px; line-height:20px; color:#d2d2d2; }
body.dark fieldset.inner>div.output legend { font-size:1rem; line-height:2rem; color:#d2d2d2; }
body.dark fieldset.inner>div.output>div.layout.flow>div.tabs { height:40px; }
body.dark fieldset.inner>div.output>div.layout.flow>div.tabs div { padding:10px 30px; }
body.dark fieldset.inner>div.output>div.layout.flow>div.tabs div.avatar { height:40px; }
body.dark fieldset.inner>div.output div.content tr.select td.line { border:solid 0px #494949; }
body.dark fieldset.inner>div.output div.content td.line { background-color:#212121; border-right:solid 0px #494949; }
body.dark fieldset.inner>div.output div.content td.text span.keyword { color:#5e99c9; font-weight:normal; }
body.dark fieldset.inner>div.output div.content td.text span.constant { color:#bed3af; }
body.dark fieldset.inner>div.output div.content td.text span.string { color:#d19b81; }
body.dark fieldset.inner>div.output div.content td.text span.comment { background-color:#0000; color:green; }
body.dark fieldset.inner>div.output div.content td.text span.datatype { color:#d2d2d2; }
body.dark div.code { border:solid 1px cadetblue }
body.dark div.float { background-color:#2a2a2a; }
body.dark div.float input { background-color:#444444; color:white; }
body.dark div.float input:hover { background-color:#444444; }
body.dark div.float input:focus { outline:none; border:solid 1px #64afeb; }

View File

@ -12,7 +12,8 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
switch (can.Mode()) {
case chat.SIMPLE: can.onmotion.hidden(can, can.ui.project); break
case chat.FLOAT: can.onmotion.hidden(can, can.ui.project); break
case chat.CMD: can.onmotion.hidden(can, can._status), can.onimport._keydown(can) // no break
case chat.CMD: can.page.style(can, document.body, "overflow", "hidden")
can.onmotion.hidden(can, can._status), can.onimport._keydown(can) // no break
case chat.FULL: // no break
default: can.onimport.project(can, paths), can.onimport._tabs(can)
can.onmotion.delay(can, function() { can.core.Next(files.slice(1), function(file, next) {
@ -94,7 +95,9 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
}), can.ui.current && can.onmotion.toggle(can, can.ui.current, !isCommand() && !isDream())
var ls = can.file.split(ice.PS); if (ls.length > 4) { ls = [ls.slice(0, 2).join(ice.PS)+"/.../"+ls.slice(-2).join(ice.PS)] }
can.Status(kit.Dict("文件", ls.join(ice.PS), "类型", can.parse)), can.onimport.layout(can)
if (!skip) { can.onaction.selectLine(can, can.Option(nfs.LINE)), can.onaction.scrollIntoView(can) } can.base.isFunc(cb) && cb(), cb = null
// if (!skip) { can.onaction.selectLine(can, can.Option(nfs.LINE)), can.onaction.scrollIntoView(can) } can.base.isFunc(cb) && cb(), cb = null
can.onaction.selectLine(can, can.Option(nfs.LINE)), can.onaction.scrollIntoView(can)
can.base.isFunc(cb) && cb(), cb = null
})
}
function load(msg) { var skip = false; can.db.tabview[key] = msg
@ -180,11 +183,11 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
if (can.isSimpleMode()) { return can.page.style(can, can.ui.content, html.WIDTH, can.ConfWidth()) }
if (can.isCmdMode()) { can.ConfHeight(can.page.height()), can.ConfWidth(can.page.width()) }
if (can.isFloatMode()) { can.onmotion.hidden(can, can.ui.profile) }
var width = can.ConfWidth()+(can.user.isMobile && can.isCmdMode() && can.user.isLandscape()? 16: 0)-(can.user.isWindows && !can.isCmdMode()? 20: 0)
var width = can.ConfWidth()+(can.user.isWindows && !can.isCmdMode()? 20: 0)
var height = can.user.isMobile && can.isFloatMode()? can.page.height()-2*html.ACTION_HEIGHT: can.base.Min(can.ConfHeight(), 320)-1
can.user.isMobile && can.isCmdMode() && can.page.style(can, can._output, html.MAX_HEIGHT, height)
can.ui.size = {profile: can.db.profile_size[can.onexport.keys(can)]||0.5, display: can.db.display_size[can.onexport.keys(can)]||3*html.ACTION_HEIGHT}
can.ui.layout(width, height)
can.ui.layout(width-2, height)
var sub = can.ui.content._plugin; sub && sub.onimport.size(sub, can.ui.content.offsetHeight-2*html.ACTION_HEIGHT, can.ui.content.offsetWidth, true)
},
exts: function(can, url, cb) {

110
plugin/local/code/repos.css Normal file
View File

@ -0,0 +1,110 @@
fieldset.repos div.output>* {
margin:auto;
}
fieldset.repos div.output table {
border:solid 1px #e2e2e2;
border-radius:5px;
color:#4183c4;
margin-top:20px;
margin-bottom:20px;
}
fieldset.repos div.output div.branch {
float:left;
margin-left:100px;
margin-top: 20px;
}
fieldset.repos div.output div.branch span {
border:solid 1px #dddddd;
padding:10px;
}
fieldset.repos div.output div.url span.branch {
float:left;
}
fieldset.repos div.output div.url {
margin-top:10px;
margin-bottom:60px;
}
fieldset.repos div.output div.url span {
border:solid 1px #dddddd;
height:40px;
padding:10px;
float:right;
}
fieldset.repos div.output div.url span:first-child {
border:solid 1px blue;
}
fieldset.repos div.output table th {
clear:both;
background-color:#f9fafb;
height:36px;
}
fieldset.repos div.output table td {
border-bottom:solid 1px #e2e2e2;
height:36px;
}
fieldset.repos div.output table td:first-child:before {
content: "😀";
}
fieldset.repos div.output div.code {
border:solid 1px #e2e2e2;
background-color:white;
color:black;
}
fieldset.repos div.output>div.info {
width:100%;
height:200px;
background-color:#414F5C;
}
fieldset.repos div.output>div.info>span {
display:block;
}
fieldset.repos div.output>div.info>span:first-child {
padding:20px;
color:white;
font-size:20px;
}
fieldset.repos div.output>div.info {
position:relative;
}
fieldset.repos div.output>div.info div.button:first-child {
}
fieldset.repos div.output>div.info div.button {
left:30px;
position:absolute;
bottom:0px;
display:flex;
justify-content: center;
height:40px;
}
fieldset.repos div.output>div.info div.button span {
border-top-left-radius: 5px;
border-top-right-radius: 5px;
float:left;
flex:1;
text-align:center;
display:block;
width:120px;
margin:auto;
padding:10px;
height:40px;
color:white;
}
fieldset.repos div.output>div.info div.button span:first-child {
background-color:white;
color:#2596e6;
}
fieldset.repos div.output>div.commit {
margin-left:100px;
display:flex;
height:40px;
border:solid 1px #e2e2e2;
justify-content: center;
border-top:none;
}
fieldset.repos div.output>div.commit>span {
flex:1;
text-align:center;
margin:auto;
}

View File

@ -0,0 +1,25 @@
Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) {
can.page.ClassList.add(can, can._fields, "repos")
can.page.Append(can, can._output, [{view: "info", list: [{text: "localhost:9020 / golang-story"}, {view: "button", list: [{text: "code"}, {text: "Issues"}, {text: "Pusll Requests"}, {text: "Wiki"}]}]}])
can.page.Append(can, can._output, [{view: "commit", list: [{text: "56 次提交"}, {text: "3 个分支"}, {text: "5 个版本"}]}])
can.page.Append(can, can._output, [{view: "url", list: [
{text: "http://localhost:9020/x/golang-story.git"},
{text: "https"}, {text: "ssh"},
{text: "分支master", className: "branch"},
]}])
var table = can.onappend.table(can, msg)
can.onappend.board(can, msg.Option("file"))
can.page.Select(can, can._output, "div.code", function(target) {
can.page.style(can, target, "background-color", "#f0f0f0")
})
can.onappend.board(can, msg)
can.page.style(can, table, html.WIDTH, can.ConfWidth()-200)
can.page.Select(can, can._output, "div.code", function(target) {
can.page.style(can, target, html.WIDTH, can.ConfWidth()-200)
})
can.page.SelectChild(can, can._output, "*", function(target) {
can.page.style(can, target, html.WIDTH, can.ConfWidth()-200)
can.page.style(can, target, html.MARGIN_LEFT, 100)
})
}}, [""])

View File

@ -1,5 +1,5 @@
fieldset.vimer>div.output input.current {
background-color:#00000000; color:#00000000; font-family:monospace;
background-color:#0000; color:#0000; font-family:monospace;
padding-left:12px; border:none; outline:none; height:22px; position:absolute;
}
fieldset.vimer>div.output input.current.normal { caret-color:gray; }
@ -9,6 +9,12 @@ fieldset.vimer>div.output div.complete.insert { display:block; }
fieldset.vimer>div.output div.complete div.pre { color:#00000000; margin-left:5px; float:left; }
fieldset.vimer>div.output div.complete table { background-color:darkblue; }
fieldset.vimer>div.output div.complete table.content thead { display:none; }
body.white fieldset.vimer>div.output input.current.insert { caret-color:black; }
body.white fieldset.vimer>div.output input.current.normal { caret-color:lightgray; }
body.white fieldset.vimer>div.output div.complete table { background-color:aliceblue; }
body.white fieldset.vimer>div.output input.current { background-color:#0000; color:#0000; margin-left:0px; margin-top:4px; height:16px; }
body.white fieldset.vimer>div.output input.current { background-color:#0000; color:#0000; }
body.white fieldset.vimer>div.output input.current:hover { background-color:#0000; color:#0000; }
body.dark fieldset.vimer>div.output input.current { background-color:#0000; color:#0000; margin-left:-1px; margin-top:2px; height:16px; }
body.dark fieldset.vimer>div.output input.current:hover { background-color:#0000; color:#0000; }

View File

@ -15,7 +15,9 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) {
if (can.mode == mdb.NORMAL) { can.onkeymap.prevent(event), can.Status("按键", can.db._keylist.join("")) }
}, onkeyup: function(event) { can.onaction._complete(event, can) }, onfocus: function() {
var target = can.ui.complete; can.current.line.appendChild(target), can.onmotion.toggle(can, target, true)
}, onblur: function(event) { can.onmotion.hidden(can, can.ui.complete) }, onclick: function(event) { can.onkeymap._insert(event, can) }}, code.COMPLETE,
}, onblur: function(event) { can.onmotion.hidden(can, can.ui.complete) }, onclick: function(event) {
can.onkeymap._insert(event, can)
}}, code.COMPLETE,
]); can.ui.current = ui.current, can.ui.complete = ui.complete },
}, [""])
Volcanos(chat.ONFIGURE, {
@ -27,6 +29,7 @@ Volcanos(chat.ONFIGURE, {
var meta = can.Conf(); args.cmd = meta.index||can.core.Keys(meta.ctx, meta.cmd)
return can.misc.MergePodCmd(can, args, true)
}
can.onmotion.hidden(can, target)
},
recent: function(can, target, zone, path) { var total = 0
function show(msg, cb) { var list = {}; msg.Table(function(item) { var path = item.path+item.file
@ -115,7 +118,20 @@ Volcanos(chat.ONACTION, {
can.onaction._runs(can.request(event, {path: "src/website/", file: (can.base.trimSuffix(can.Option(nfs.FILE), can.base.Ext(can.Option(nfs.FILE)))+nfs.ZML).split(ice.PS).pop()}), can, button)
},
save: function(event, can, button) { can.request(event, {file: can.Option(nfs.FILE), content: can.onexport.content(can)})
can.onaction._run(event, can, button, [can.parse, can.Option(nfs.FILE), can.Option(nfs.PATH)], function() { can.user.toastSuccess(can, button, can.Option(nfs.PATH)+can.Option(nfs.FILE)) })
function imports(str) { var block = "", count = 0
can.core.List(str.split(ice.NL), function(item) {
if (can.base.endWith(item, "(") || can.base.endWith(item, "{")) { block = can.core.Split(item)[0]; return }
if (can.base.beginWith(item, ")") || can.base.beginWith(item, "}")) { block = ""; return }
if (block == "import") { count++ }
})
return count
}
can.onaction._run(event, can, button, [can.parse, can.Option(nfs.FILE), can.Option(nfs.PATH)], function(msg) {
if (can.parse == nfs.GO) { var line = can.onaction.selectLine(can); can.onmotion.clear(can, can.ui.content)
can.max = 0, can.core.List(can.ls = msg.Result().split(ice.NL), function(item) { can.onaction.appendLine(can, item) })
can.onaction.selectLine(can, line+imports(msg.Result())-imports(msg.Option("content")))
} can.user.toastSuccess(can, button, can.Option(nfs.PATH)+can.Option(nfs.FILE))
})
},
compile: function(event, can, button) { var _toast = can.user.toastProcess(can, "编译中...")
can.runAction(can.request(event), button, [], function(msg) { _toast.close(), can.ui.search && can.onmotion.hidden(can, can.ui.search._target)
@ -151,10 +167,10 @@ Volcanos(chat.ONACTION, {
"编辑器": function(event, can) { window.opencmd("cd ~/contexts; vim +"+can.Option(nfs.LINE)+" "+can.Option(nfs.PATH)+can.Option(nfs.FILE)) },
"浏览器": function(event, can) { window.openurl(location.href) },
_open: function(can, url) { can.user.isWebview? window.openurl(url): window.open(url) },
_complete: function(event, can, target) { if (event == undefined) { return } target = target||can.ui.complete
_complete: function(event, can, target) { if (event == undefined || event.type == "click") { return } target = target||can.ui.complete
var pre = can.ui.current.value.slice(0, can.ui.current.selectionStart), key = can.core.Split(pre, "\t .[]", " ").pop()||"", end = can.ui.current.value.slice(can.ui.current.selectionStart)
function update() { target._pre = pre, target._end = end, target._index = -1
can.current.line.appendChild(target), can.page.style(can, target, html.LEFT, can.ui.current.offsetLeft-1, html.MARGIN_TOP, can.ui.current.offsetHeight-1)
can.current.line.appendChild(target), can.page.style(can, target, html.LEFT, can.ui.current.offsetLeft, html.MARGIN_TOP, can.current.line.offsetHeight)
can.runAction(can.request(event, {text: pre}, can.Option()), code.COMPLETE, [], function(msg) { can.page.Appends(can, target, [{view: ["pre", html.DIV, pre]}])
if (can.parse == nfs.JS) { var msg = can.request()
var ls = can.core.Split(can.core.Split(pre, "\t (", " ").pop(), ice.PT)
@ -197,8 +213,12 @@ Volcanos(chat.ONACTION, {
},
_selectLine: function(can) { if (!can.current) { return }
can.page.Select(can, can.current.line, "td.text", function(td) { var target = can.ui.current; target.value = td.innerText
can.current.line.appendChild(target), can.page.style(can, target, html.LEFT, td.offsetLeft-2, html.TOP, td.offsetTop-1, html.WIDTH, can.base.Min(td.offsetWidth, can.ui._content.offsetWidth))
if (event && event.type == "click") { can.onkeymap._insert(event, can, 0, (event.offsetX)/12-1) } else { can.onaction.scrollHold(can, 0) }
can.current.line.appendChild(target), can.page.style(can, target, html.LEFT, td.offsetLeft-1, html.TOP, td.offsetTop, html.WIDTH, can.base.Min(td.offsetWidth, can.ui._content.offsetWidth))
can.mode == mdb.NORMAL && can.onkeymap._normal(can)
if (event && event.target && event.target.tagName && can.page.tagis(event.target, html.TD, html.SPAN)) {
can.onkeymap._insert(event, can, 0, (event.offsetX)/12-1)
can.onmotion.clear(can, can.ui.complete)
}
})
},
rerankLine: function(can, value) { can.max = can.page.Select(can, can.ui.content, "tr>td.line", function(td, index) { return td.innerText = index+1 }).length },
@ -219,10 +239,18 @@ Volcanos(chat.ONEXPORT, {list: ["目录", "模式", "按键", "类型", "文件"
Volcanos(chat.ONKEYMAP, {
_model: function(can, value) { can.Status("模式", can.mode = value), can.page.styleClass(can, can.ui.current, [code.CURRENT, can.mode]), can.page.styleClass(can, can.ui.complete, [code.COMPLETE, can.mode]) },
_plugin: function(can) { can.onkeymap._model(can, mdb.PLUGIN), can.ui.current.blur() },
_normal: function(can) { can.onkeymap._model(can, mdb.NORMAL), can.ui.current.focus() },
_normal: function(can) { can.onkeymap._model(can, mdb.NORMAL), can.onaction.scrollHold(can), can.onkeymap.prevent(event) },
_insert: function(event, can, count, begin) { can.onkeymap._model(can, mdb.INSERT), can.onaction.scrollHold(can, count, begin), can.onkeymap.prevent(event) },
_mode: {
plugin: {
Backspace: shy("删除", function(event, can, target) {
for (var p = document.getSelection().anchorNode; !can.page.tagis(p.parentNode, html.TR); p = p.parentNode) {}
var line = can.onaction._getLineno(can, p.parentNode)
for (var p = document.getSelection().extentNode; !can.page.tagis(p.parentNode, html.TR); p = p.parentNode) {}
document.getSelection().deleteFromDocument(), can.onaction.rerankLine(can), can.onaction.selectLine(can, line)
var text = can.current.text(); if (p && p.innerHTML) { can.current.text(text+p.innerText) }
can.page.Remove(can, p.parentNode), can.onaction.selectLine(can, line), can.onkeymap._insert(event, can, text.length, 0)
}),
Escape: shy("切换模式", function(event, can) { can.onaction.clear(event, can) }),
r: shy("执行命令", function(event, can) { can.onaction.exec(event, can) }),
v: shy("渲染界面", function(event, can) { can.onaction.show(event, can) }),
@ -317,6 +345,7 @@ Volcanos(chat.ONKEYMAP, {
zt: shy("将当前行拉到屏幕最上", function(can, count) { return can.current.scroll(can.current.scroll()-(count>1? count: 3)), true }),
zz: shy("将当前行拉到屏幕中间", function(can, count) { return can.current.scroll(can.current.scroll()-(count = count>1? count: can.current.window()/2)), true }),
zb: shy("将当前行拉到屏幕最下", function(can, count) { return can.current.scroll(can.current.scroll()-can.current.window()+(count>1? count: 5)), true }),
s: shy("保存文件", function(event, can) { can.onaction.save(event, can, nfs.SAVE) }),
},
normal_ctrl: {
f: shy("向下翻页", function(can, count) {
@ -355,7 +384,7 @@ Volcanos(chat.ONKEYMAP, {
}})
var line = can.onaction.insertLine(can, left+rest, can.current.next())
can.current.text(text.trimRight()||text), can.onaction.selectLine(can, line)
can.onkeymap.cursorMove(target, 0, left.length)
can.onkeymap._insert(event, can, 0, left.length)
}),
ArrowDown: shy("光标下移", function(can, target) { event.key == "ArrowDown" && can.onaction.cursorDown(can, target) }),
ArrowUp: shy("光标上移", function(can, target) { event.key == "ArrowUp" && can.onaction.cursorUp(can, target) }),

View File

@ -2,7 +2,6 @@ fieldset.plan>div.output td.content { position:relative; }
fieldset.plan>div.output table.content.plan th { font-family:unset; text-align:center; }
fieldset.plan>div.output table.content.plan td { vertical-align:top; }
fieldset.plan>div.output table.content.plan td.over { border:solid 2px red; }
fieldset.plan>div.output table.content.plan td.today { background-color:cornflowerblue; }
fieldset.plan>div.output table.content.plan td div { color:white; }
fieldset.plan>div.output table.content.plan td div.date { color:gray; }
fieldset.plan>div.output table.content.plan td div.date span.lunar { font-size:12px; }

View File

@ -21,7 +21,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear(
}}])
})
},
_task: function(can, msg, list, time) { return {type: html.TD, className: time == can.base.Time().slice(0, time.length)? "today": "",
_task: function(can, msg, list, time) { return {type: html.TD, className: time == can.base.Time().slice(0, time.length)? html.SELECT: "",
ondblclick: function(event) { can.onaction.insertTask(event, can, time+can.base.Time().slice(time.length)) },
ondrop: function(event) { can.onkeymap.prevent(event), can.drop(event, event.target, time) },
ondragover: function(event) { can.onkeymap.prevent(event), can.page.Select(can, can.ui.content, html.TD, function(td) { can.page.ClassList.set(can, td, "over", td == event.target) }) },

View File

@ -19,7 +19,8 @@ fieldset.word ul.story[data-type=endmenu] { clear:both; }
fieldset.word p.story[data-name=inner] { background-color:#4b6c8a7a; padding:4px 10px; border-left:solid 4px blue; margin:10px 0px; }
fieldset.word p.story[data-name=inner]:hover { background-color:#c10c8a; cursor:copy; }
fieldset.word table.content { display:block; max-height:400px; }
fieldset.word>div.output>fieldset.story { margin:10px; background-color:#58a4d37d; }
fieldset.word>div.output>fieldset.story { margin:10px; }
// fieldset.word>div.output>fieldset.story { margin:10px; background-color:#58a4d37d; }
fieldset.word fieldset.story.full { margin:0px; }
fieldset.word fieldset.story.float { margin:0px; }

View File

@ -119,7 +119,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
}, onclick: function(event) {
can.onmotion.focus(can, event.target)
}, _init: function(target) { zone._search = target
can.onmotion.delay(can, function() { can.page.styleWidth(can, target, can.core.Value(target.parentNode.parentNode, "parentNode.offsetWidth")-32) })
can.onmotion.delay(can, function() { can.page.styleWidth(can, target, can.core.Value(target.parentNode.parentNode, "parentNode.offsetWidth")-10) })
}}], target, {})
}},
{view: html.LIST, _init: function(target) { can.ui[zone.name] = zone

View File

@ -218,6 +218,7 @@ var html = {PLUGIN_MARGIN: 10, ACTION_HEIGHT: 31, ACTION_MARGIN: 200,
FIELDSET: "fieldset", LEGEND: "legend", OPTION: "option", ACTION: "action", OUTPUT: "output", STATUS: "status",
FORM_OPTION: "form.option", DIV_ACTION: "div.action", DIV_OUTPUT: "div.output", DIV_STATUS: "div.status",
FIELDSET_PANEL: "fieldset.panel", FIELDSET_PLUGIN: "fieldset.plugin", FIELDSET_STORY: "fieldset.story", FIELDSET_FLOAT: "fieldset.float",
FIELDSET_INPUT: "fieldset.input",
FIELDSET_HEAD: "fieldset.head", FIELDSET_FOOT: "fieldset.foot", FIELDSET_LEFT: "fieldset.left", FIELDSET_MAIN: "fieldset.main",
OPTION_ARGS: "select.args,input.args,textarea.args", INPUT_ARGS: "input.args,textarea.args", INPUT_BUTTON: "input[type=button]", INPUT_FILE: "input[type=file]",
@ -229,6 +230,7 @@ var html = {PLUGIN_MARGIN: 10, ACTION_HEIGHT: 31, ACTION_MARGIN: 200,
WSS: "wss", SVG: "svg", CANVAS: "canvas", IFRAME: "iframe",
WEBVIEW: "webview", CHROME: "chrome", MOBILE: "mobile", LANDSCAPE: "landscape",
HOVER: "hover", HOVER_SELECT: "hover,select",
CLASS: "class", DISPLAY: "display", BLOCK: "block", NONE: "none", HIDDEN: "hidden", TOGGLE: "toggle", SIZE: "size",
HEIGHT: "height", WIDTH: "width", PADDING: "padding", MARGIN: "margin", LEFT: "left", TOP: "top", RIGHT: "right", BOTTOM: "bottom",
MIN_HEIGHT: "min-height", MAX_HEIGHT: "max-height", MIN_WIDTH: "min-width", MAX_WIDTH: "max-width", MARGIN_TOP: "margin-top", MARGIN_X: "margin-x", MARGIN_Y: "margin-y",
@ -243,6 +245,10 @@ var html = {PLUGIN_MARGIN: 10, ACTION_HEIGHT: 31, ACTION_MARGIN: 200,
DIV_ZONE: "div.zone", DIV_LIST: "div.list", DIV_ITEM: "div.item", DIV_NAME: "div.name",
DIV_LAYOUT_HEAD: "div.layout.head", DIV_LAYOUT_FOOT: "div.layout.foot", DIV_LAYOUT_LEFT: "div.layout.left",
DIV_CODE: "div.code", DIV_FLOAT: "div.float", DIV_CONTENT: "div.content", TABLE_CONTENT: "table.content",
DIV_CARTE: "div.carte",
DIV_TOAST: "div.toast",
DIV_TOGGLE: "div.toggle",
TABLE_LAYOUT: "table.layout",
}
var lang = {
UNDEFINED: "undefined", STRING: "string", NUMBER: "number", BOOLEAN: "boolean", FUNCTION: "function", OBJECT: "object", ARRAY: "array",