diff --git a/frame.js b/frame.js
index a555a013..c010d722 100644
--- a/frame.js
+++ b/frame.js
@@ -398,8 +398,8 @@ 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 = html.FLOW, FLEX = html.FLEX
- var count = 0, ui = {size: {}}; type = type||FLEX
+ layout: function(can, list, type, target) { const FLOW = html.FLOW, FLEX = html.FLEX
+ var count = 0, ui = {size: {}}; type = type||FLEX, target = target||can._output
function append(target, type, list) { can.page.ClassList.add(can, target, [html.LAYOUT, type]), can.core.List(list, function(item) {
if (can.base.isString(item)) {
ui[item] = can.page.Append(can, target, [item])._target
@@ -508,48 +508,18 @@ Volcanos(chat.ONLAYOUT, {_init: function(can, target) { target = target||can._ro
figure: function(event, can, target, right, max) { if (!event || !event.target) { return {} } target = target||can._fields||can._target
var rect = event.target == document.body? {left: can.page.width()/2, top: can.page.height()/2, right: can.page.width()/2, bottom: can.page.height()/2}:
(event.currentTarget||event.target).getBoundingClientRect()
- // event.target.getBoundingClientRect()
var layout = right? {left: rect.right, top: rect.top}: {left: rect.left, top: rect.bottom}
can.getActionSize(function(left, top, width, height) { left = left||0, top = top||0, height = can.base.Max(height, can.page.height()-top)
- // can.page.style(can, target, html.MAX_HEIGHT, max? height*max: top+height-layout.top)
if (max && layout.top-top > height*max) {
can.page.style(can, target, html.MAX_HEIGHT, layout.top-top-(rect.bottom-rect.top))
layout.top = layout.top-target.offsetHeight-(rect.bottom-rect.top)
} else {
if (!right) { can.page.style(can, target, html.MAX_HEIGHT, max? height*max: top+height-layout.top) }
- // can.page.style(can, target, html.MAX_HEIGHT, top+height-layout.top)
if (layout.top+target.offsetHeight > top+height) { layout.top = top+height-target.offsetHeight }
}
if (layout.left+target.offsetWidth > left+width) { layout.left = left+width-target.offsetWidth }
}); return can.onmotion.move(can, target, layout), layout
},
-
- display: function(can, target) { return can.page.Appends(can, target||can._output, [{view: [html.LAYOUT, html.TABLE], list: [
- {type: html.TR, list: [chat.CONTENT]}, {type: html.TR, list: [chat.DISPLAY]},
- ]}]) },
- profile: function(can, target) {
- function toggle(view) { var show = view.style.display == html.NONE
- can.onmotion.toggle(can, view, show), view._toggle? view._toggle(event, show): can.onimport.layout && can.onimport.layout(can); return show
- } var gt = "❯", lt = "❮", down = lt, up = gt, button = {}
- var ui = can.page.Append(can, target||can._output, [{view: [html.LAYOUT, html.TABLE], list: [
- {view: [chat.PROJECT, html.TD], list: [chat.PROJECT]}, {type: html.TD, list: [ {type: html.TR, list: [{type: html.TR, list: [
- {view: [chat.CONTENT, html.TD], list: [chat.CONTENT,
- {view: [[html.TOGGLE, chat.PROJECT]], list: [{text: [gt, html.DIV]}], _init: function(target) {
- button[chat.PROJECT] = {target: target, show: lt, hide: gt}, target.onclick = function() { toggle(ui.project) }
- }},
- {view: [[html.TOGGLE, chat.PROFILE]], list: [{text: [lt, html.DIV]}], _init: function(target) {
- button[chat.PROFILE] = {target: target, show: gt, hide: lt}, target.onclick = function() { toggle(ui.profile) }
- }},
- {view: [[html.TOGGLE, chat.DISPLAY]], list: [{text: [up, html.DIV]}], _init: function(target) {
- button[chat.DISPLAY] = {target: target, show: down, hide: up}, target.onclick = function() { toggle(ui.display) }
- }},
- ]}, {view: [chat.PROFILE, html.TD], list: [chat.PROFILE]},
- ]}]}, {view: [chat.DISPLAY, html.TR], list: [chat.DISPLAY]} ]}
- ] }]); function set(meta, button) { can.page.Appends(can, meta.target, [{text: [button, html.DIV]}]) }
- can.core.List([chat.PROJECT, chat.DISPLAY, chat.PROFILE], function(item) { var meta = button[item]
- ui[item]._hide = function() { set(meta, meta.hide) }, ui[item]._show = function() { set(meta, meta.show) }
- }); return can.ui = ui
- },
})
Volcanos(chat.ONMOTION, {_init: function(can, target) {
target.onclick = function(event) { if (can.page.tagis(event.target, html.SELECT, html.INPUT, html.TEXTAREA)) { return }
diff --git a/index.css b/index.css
index 492c8ee7..fce80d8a 100644
--- a/index.css
+++ b/index.css
@@ -1,4 +1,4 @@
-* { transition:background-color ease-in 3s; }
+// * { transition:background-color ease-in 5s; }
* { 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; }
@@ -45,8 +45,7 @@ table.content.action th:last-child { position:sticky; right:2px; }
table.content.action td:last-child { background-color:steelblue; max-width:200px; position:sticky; right:2px; }
table.content.full { width:100%; }
div.code { background-color:#5066b945; font-size:14px; }
-div.story[data-type=spark] { background-color:#2169a9a6; color:white; padding:5px 10px; border-left:blue solid 5px; }
-// div.story[data-type=spark] { background-color:#2169a9a6; color:white; padding:5px 10px; border-left:blue solid 5px; margin:10px; }
+div.story[data-type=spark] { padding:5px 10px; border-left:blue solid 5px; }
table.content div.story[data-type=spark] { margin:0; }
h1 { text-align:center; margin:20px 0; } h2 { margin:20px 0; } h3 { margin:20px 0; } ul { padding-left:40px; margin:20px 0; }
hr, td.hr { border-bottom:gray dashed 1px; margin:5px; }
@@ -91,7 +90,6 @@ fieldset.input.date div.output td span.lunar.fest { color:red; }
fieldset.input.date div.status { text-align:center; }
/* float */
body div.float { background-color:#061c3ceb; padding:5px; overflow:auto; }
-// body div.float { background-color:#061c3ceb; padding:5px; overflow:auto; top:100px; }
body>div.toast div.title { color:blue; float:left; }
body>div.toast div.duration { color:gray; float:right; }
body>div.toast div.content { color:blue; text-align:center; }
@@ -128,29 +126,11 @@ table.content, div.item, div.code, div.story[data-type=spark] { font-family:mono
fieldset>div.action>div.tabs { font-style:italic; line-height:22px; padding:5px; height:32px; }
fieldset>div.status>div.item { padding:5px; height:31px; float:left; }
fieldset>div.status>div.item>label { font-size:0.6rem; }
-/* display */
-fieldset>form.option, fieldset>div.action { display:contents; } form.option.hide, div.action.hide { display:none; }
-form.option>div.item>label, div.action>div.item>label, .hidden, .hide { display:none; }
-form.option>div.cmd, form.option>div.textarea { width:100%; } textarea { resize:vertical; }
-legend, form.option, form.option>div.item, div.action, div.action>div.item, div.action>div.tabs, fieldset>div.status>div.item, div.layout.flex>* { float:left; }
-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, div.carte, fieldset.input { overflow:auto; }
-div.output, fieldset>div.status, div.item.textarea, div.project div.item, div.content:not(.item), div.code, div.story[data-type=spark] { clear:both; }
-fieldset>div.status>legend { margin-left:2px; margin-right:0; height:30px; float:right; clear:none; }
-fieldset.Action>div.output>fieldset.plugin:not(.output):not(.float):not(.full):not(.cmd) { padding:10px; margin:10px; }
-fieldset.Action>div.output>fieldset.plugin:not(.float):not(.full):not(.cmd)>legend { float:none; }
-fieldset.auto, fieldset.full, fieldset.float, div.float { position:fixed; z-index:10; }
-fieldset.plug { position:absolute; bottom:0; right:0; } fieldset.cmd fieldset.plug { position:fixed; bottom:32px; right:0; }
-fieldset.plug div.output table.content { width:100%; }
-// fieldset.plugin>div.output>fieldset.story { position:sticky; left:0; }
-div.output { position:relative; }
-div.tabs { position:relative; }
-div.tabs span.icon { margin-left:10px; visibility:hidden; }
-div.tabs span.icon:hover { background-color:aliceblue; color:black; }
-div.tabs>div:hover span.icon { visibility:visible; }
-div.action>div.tabs:hover span.icon { visibility:visible; }
-div.tabs>div.select span.icon { visibility:visible; }
-fieldset>div.output>div.code { position:sticky; left:0; }
-div.plug { font-style:italic; }
+body.light span.keyword { color:darkblue; }
+body.light span.function { color:darkcyan; }
+body.dark span.function { color:lightgreen; }
+body.dark span.keyword { color:royalblue; }
+/* icon */
div.item.text { position:relative; }
div.item.text>span.icon.delete { font-size:20px; line-height:28px; position:absolute; top:2px; right:10px; visibility:hidden; }
div.item.text:hover>span.icon.delete { visibility:visible; }
@@ -164,36 +144,90 @@ form.option>div.icon.prev { font-size:18px; }
form.option>div.icon.lt { font-size:20px; line-height:30px; }
form.option>div.icon:hover { background-color:white; }
form.option>div.item.button>span.icon { line-height:30px; font-size:26px; padding:0 5px; height:32px; display:none; }
-fieldset.cmd>form.option>div.item.button>span.icon { display:unset; }
+fieldset.plug>form.option>div.icon { margin-left:5px; }
+fieldset.story>form.option>div.icon { display:block; }
+fieldset.story>form.option>div.item.button.icons { display:none; }
fieldset.story>form.option>div.item.button>span.icon { display:unset; }
fieldset:not(.float)>form.option>div.text>span.value { display:none; }
fieldset.float div.item.text:hover>span.icon.delete { visibility:hidden; }
-fieldset.float>form.option>div.text>input { display:none; }
-fieldset.float>form.option>div.text>span.value { padding:7px; height:32px; display:block; }
-/* fieldset.float>form.option>div.item.button { display:none; } */
-fieldset.story>form.option>div.icon { display:block; }
fieldset.float>form.option>div.icon { display:block; }
+fieldset.float>form.option>div.item.button.icons { display:none; }
+fieldset.float>form.option>div.text>span.value { padding:7px; height:32px; display:block; }
+fieldset.float>form.option>div.text>input { display:none; }
fieldset.full>form.option>div.icon { display:block; }
fieldset.full>form.option>div.icon.delete { display:block; }
-fieldset.cmd>form.option>div.icon { display:block; }
-fieldset.story>form.option>div.item.button.icons { display:none; }
-fieldset.float>form.option>div.item.button.icons { display:none; }
fieldset.full>form.option>div.item.button.icons { display:none; }
+fieldset.cmd>form.option>div.icon { display:block; }
+fieldset.cmd>form.option>div.item.button>span.icon { display:unset; }
fieldset.cmd>form.option>div.item.button.icons { display:none; }
-
-fieldset.plug>form.option>div.icon { margin-left:5px; }
+body.windows form.option>div.icon { font-size:21px; }
+body.windows fieldset.inner.cmd>div.output>div.layout.flow>div.tabs div.website.icon { line-height:36px; }
+/* svg */
+/* svg rect { transition:fill ease-in 5s; } */
+svg text { font-size:24px; font-family:monospace; }
+svg rect { stroke-width:2; }
+svg line { stroke-width:2; }
+svg path { stroke-width:2; }
+svg g[font-size] text { font-size:unset; }
+svg g[stroke-width] rect { stroke-width:unset; }
+svg g[stroke-width] line { stroke-width:unset; }
+svg g[stroke-width] path { stroke-width:unset; }
+body.dark svg text { stroke:silver; fill:silver; }
+body.dark svg rect { stroke:silver; fill:black; }
+body.dark svg line { stroke:silver; }
+body.dark svg path { stroke:silver; }
+body.light svg text { stroke:black; fill:black; }
+body.light svg rect { stroke:black; fill:white; }
+body.light svg line { stroke:black; }
+body.light svg path { stroke:black; }
+body.light svg g[fill] text { fill:unset; }
+body.light svg g[stroke] text { stroke:unset; }
+body.light svg g[stroke] line { stroke:unset; }
+body.light svg g[stroke] path { stroke:unset; }
+body.light svg g[stroke] rect { stroke:unset; }
+body.light svg g[fill] rect { fill:unset; }
+body.dark svg g[fill] text { fill:unset; }
+body.dark svg g[stroke] text { stroke:unset; }
+body.dark svg g[stroke] line { stroke:unset; }
+body.dark svg g[stroke] path { stroke:unset; }
+body.dark svg g[stroke] rect { stroke:unset; }
+body.dark svg g[fill] rect { fill:unset; }
+/* display */
+fieldset>form.option, fieldset>div.action { display:contents; } form.option.hide, div.action.hide { display:none; }
+form.option>div.item>label, div.action>div.item>label, .hidden, .hide { display:none; }
+form.option>div.cmd, form.option>div.textarea { width:100%; } textarea { resize:vertical; }
+legend, form.option, form.option>div.item, div.action, div.action>div.item, div.action>div.tabs, fieldset>div.status>div.item, div.layout.flex>* { float:left; }
+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, div.carte, fieldset.input { overflow:auto; }
+div.output, fieldset>div.status, div.item.textarea, div.project div.item, div.content:not(.item), div.code, div.story[data-type=spark] { clear:both; }
+fieldset>div.status>legend { margin-left:2px; margin-right:0; height:30px; float:right; clear:none; }
+fieldset.Action>div.output>fieldset.plugin:not(.output):not(.float):not(.full):not(.cmd) { padding:10px; margin:10px; }
+fieldset.Action>div.output>fieldset.plugin:not(.float):not(.full):not(.cmd)>legend { float:none; }
+fieldset.auto, fieldset.full, fieldset.float, div.float { position:fixed; z-index:10; }
+fieldset.plug { position:absolute; bottom:0; right:0; } fieldset.cmd fieldset.plug { position:fixed; bottom:32px; right:0; }
+fieldset.plug div.output table.content { width:100%; }
+div.output { position:relative; }
+div.tabs { position:relative; }
+div.tabs span.icon { margin-left:10px; visibility:hidden; }
+div.tabs span.icon:hover { background-color:aliceblue; color:black; }
+div.tabs>div:hover span.icon { visibility:visible; }
+div.action>div.tabs:hover span.icon { visibility:visible; }
+div.tabs>div.select span.icon { visibility:visible; }
+fieldset>div.output>div.code { position:sticky; left:0; }
+div.plug { font-style:italic; }
div.carte.select.float { border-radius:0; }
div.carte.select.float>div.item { text-align:center; }
div.item.select span { margin-left:-20px; margin-right:10px; }
div.item.select input { border-radius:0; min-width:60px; }
div.project div.zone div.list { clear:both; }
+div.layout.flex>div.output { float:left; clear:none; }
+fieldset>div.layout { clear:both; }
/* hover */
legend:hover { background-color:skyblue; }
select:hover { background-color:gray; color:cyan; }
div.tabs div:hover, div.tabs div.select { background-color:transparent; }
div.item:hover, div.item.select, span.item:hover, table.content tr:hover, table.content tr.select, h1:hover, h2:hover, h3:hover { background-color:steelblue; }
div.carte div.item:hover, 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; }
+// div.story[data-type=spark] span:hover { background-color:deepskyblue; box-shadow:4px 4px 20px 4px #29318e; }
select, input[type=text], textarea { box-shadow:4px 4px 20px 4px #626bd0; }
body.black input[type=text], body.black textarea { background-color:#243783bd; color:white; outline:none; }
legend, select, input[type=button], div.tabs, div.item, span.item, th, table.content td, h1, h2, h3 { cursor:pointer; }
@@ -308,17 +342,15 @@ fieldset.plugin.parse.cmd>div.status { display:none; }
fieldset.plugin.inner.cmd>legend { display:none; }
fieldset.plugin.inner.cmd>div.action { display:none; }
fieldset.plugin.inner.cmd>form.option { display:none; }
-// fieldset.plugin.inner.cmd fieldset.xterm>form.option>div.item.text>input { width:320px; }
fieldset.plan div.output table.content { height:100%; width:100%; }
fieldset.xterm div.output { border-left:gray solid 1px; border-top:gray solid 1px; }
-fieldset.xterm div.output.select { border:blue solid 1px; }
+fieldset.xterm div.layout div.output.select { border:blue solid 1px; }
fieldset.xterm div.action>div.tabs.select { color:blue; }
fieldset.xterm.output>div.output { overflow:hidden; }
-div.layout.flex>div.output { float:left; clear:none; }
-fieldset>div.layout { clear:both; }
-
+fieldset.draw div.output svg { margin-bottom:-4px; }
fieldset.draw.trend div.output svg { background-color:#1b5b738c; }
-fieldset.draw.trend div.output { overflow:hidden; }
+fieldset.draw.spide div.output svg text { cursor:pointer; }
+fieldset.draw.spide div.output svg path { stroke-width:1; }
fieldset.web.code.git.status>div.output table.content { width:100%; }
fieldset.web.code.inner.cmd>div.output { overflow:hidden; }
fieldset.web.chat.iframe>div.output { overflow:hidden; }
@@ -365,11 +397,3 @@ div.content::-webkit-scrollbar { width:0 !important; height:0 !important; }
div.carte::-webkit-scrollbar { width:0 !important; height:0 !important; }
div.status::-webkit-scrollbar { width:0 !important; height:0 !important; }
div.toggle::-webkit-scrollbar { width:0 !important; height:0 !important; }
-
-body.windows form.option>div.icon { font-size:21px; }
-body.windows fieldset.inner.cmd>div.output>div.layout.flow>div.tabs div.website.icon { line-height:36px; }
-
-body.light span.keyword { color:darkblue; }
-body.light span.function { color:darkcyan; }
-body.dark span.keyword { color:royalblue; }
-body.dark span.function { color:lightgreen; }
diff --git a/panel/action.js b/panel/action.js
index 6fb2bae8..36a0a4cb 100644
--- a/panel/action.js
+++ b/panel/action.js
@@ -40,9 +40,9 @@ Volcanos(chat.ONACTION, {_init: function(can, target) {
}}])._target; can._toggle = target
can.misc.sessionStorage(can, "river:hide") == ice.TRUE && target.click()
}); if (!can.Conf(chat.TOOL) && !can.user.mod.isCmd) { return } can._names = location.pathname
- can.Conf(chat.TOOL)? can.onappend.layout(can, can._output, FLOW, can.core.List(can.Conf(chat.TOOL), function(item, index, list) { item.type = chat.PLUGIN
+ can.Conf(chat.TOOL)? can.onappend.layout(can, can.core.List(can.Conf(chat.TOOL), function(item, index, list) { item.type = chat.PLUGIN
if (list.length == 1) { can.user.title(item.index), can.onaction._onaction_cmd(can), item.mode = chat.CMD, item.opts = can.misc.Search(can) } return item
- })).layout(window.innerHeight, window.innerWidth): can.runAction(can.request(), ctx.COMMAND, [], function(msg) {
+ }), FLOW).layout(window.innerHeight, window.innerWidth): can.runAction(can.request(), ctx.COMMAND, [], function(msg) {
if (msg.Length() == 1) { can.onaction._onaction_cmd(can) } can.onimport._init(can, msg)
})
},
diff --git a/plugin/local/chat/div.js b/plugin/local/chat/div.js
index 280c88a3..af9a2439 100644
--- a/plugin/local/chat/div.js
+++ b/plugin/local/chat/div.js
@@ -40,7 +40,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) {
}, can.ui.profile)
},
layout: function(can, target) { target = target||can._output
- can.onmotion.clear(can, target), can.onlayout.profile(can, target), can.ui.project._target = can.ui.content
+ can.onmotion.clear(can, target), can.onappend.layout(can, null, "", target), can.ui.project._target = can.ui.content
var width = can.ConfWidth()-320, height = can.ConfHeight()
if (can.isCmdMode()) {
width = can.page.width(), height = can.page.height(), can.user.title(can._list.meta.name)
diff --git a/plugin/local/chat/location.js b/plugin/local/chat/location.js
index 751f294a..eb434cd8 100644
--- a/plugin/local/chat/location.js
+++ b/plugin/local/chat/location.js
@@ -1,5 +1,5 @@
Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) {
- can.onmotion.clear(can), can.onlayout.profile(can), can.base.isFunc(cb) && cb(msg)
+ can.onmotion.clear(can), can.onappend.layout(can), can.base.isFunc(cb) && cb(msg)
!can.isCmdMode() && can.ConfHeight(window.innerHeight - 5*html.ACTION_HEIGHT - 5*html.PLUGIN_MARGIN)
can.user.isMobile && can.ConfHeight(window.innerHeight-html.ACTION_HEIGHT)
can.user.isMobile && can.onmotion.hidden(can, can.ui.project)
diff --git a/plugin/local/code/inner.js b/plugin/local/code/inner.js
index 79638ff2..00249759 100644
--- a/plugin/local/code/inner.js
+++ b/plugin/local/code/inner.js
@@ -13,7 +13,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
if (p && paths.indexOf(p) == -1 && p[0] != ice.PS) { paths.push(p) }
})
can.db = {paths: paths, tabview: {}, history: [], _history: [], toolkit: {}}, can.onengine.plugin(can, can.onplugin), can.sup.onimport._process = function() {}
- can.ui = can.onappend.layout(can, can._output, "", [html.PROJECT, [html.TABS, nfs.PATH, [html.CONTENT, html.PROFILE], html.DISPLAY, html.PLUG]])
+ can.ui = can.onappend.layout(can, [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, can.onmotion.hidden(can, can.ui.plug)
switch (can.Mode()) {
case chat.SIMPLE: // no break
@@ -313,7 +313,7 @@ Volcanos(chat.ONSYNTAX, {_init: function(can, msg, cb) {
}).join("")); return line
},
})
-Volcanos(chat.ONACTION, {list: ["调试", "首页", "官网", "源码", "百度"],
+Volcanos(chat.ONACTION, {
_getLine: function(can, line) { return can.page.Select(can, can.ui.content, "tr.line>td.line", function(td, index) { if (td.parentNode == line || index+1 == line) { return td.parentNode } })[0] },
appendLine: function(can, value) { var ui = can.page.Append(can, can.ui._content, [{view: [nfs.LINE, html.TR], list: [
{view: [nfs.LINE, html.TD, ++can.db.max], onclick: function(event) {
@@ -347,8 +347,8 @@ Volcanos(chat.ONACTION, {list: ["调试", "首页", "官网", "源码", "百度"
},
searchLine: function(event, can, value) {
var offset = 0; can.page.Select(can, can.ui.content, "tr.line", function(tr) {
- tr == can.current.line && can.page.Select(can, tr, "td.text>span", function(span) { offset += span.innerText.length
- span == event.target && can.runAction(can.request(event, {name: value, text: can.current.text(), offset: offset-1}, can.Option()), code.NAVIGATE, [], function(msg) {
+ tr == can.current.line && can.page.Select(can, tr, "td.text>span", function(span) { offset += span.innerText.length;
+ (span == event.target || span.innerText == value) && can.runAction(can.request(event, {name: value, text: can.current.text(), offset: offset-1}, can.Option()), code.NAVIGATE, [], function(msg) {
msg.Append(nfs.FILE)? can.onimport.tabview(can, msg.Append(nfs.PATH), msg.Append(nfs.FILE), msg.Append(nfs.LINE)): can.user.toastFailure(can, "not found "+value)
})
}), can.page.Select(can, tr, "td.text", function(td) { offset += td.innerText.length+1 })
diff --git a/plugin/local/code/inner/syntax.js b/plugin/local/code/inner/syntax.js
index 72bf691c..3cc28600 100644
--- a/plugin/local/code/inner/syntax.js
+++ b/plugin/local/code/inner/syntax.js
@@ -239,7 +239,7 @@ Volcanos(chat.ONSYNTAX, {
"border": code.FUNCTION, "border-left": code.FUNCTION, "border-top": code.FUNCTION, "border-right": code.FUNCTION, "border-bottom": code.FUNCTION,
"margin": code.FUNCTION, "margin-left": code.FUNCTION, "margin-top": code.FUNCTION, "margin-right": code.FUNCTION, "margin-bottom": code.FUNCTION,
"display": code.FUNCTION, "visibility": code.FUNCTION, "overflow": code.FUNCTION, "position": code.FUNCTION, "z-index": code.FUNCTION, "box-sizing": code.FUNCTION, "border-box": code.CONSTANT,
- "height": code.FUNCTION, "width": code.FUNCTION, "min-width": code.FUNCTION, "max-height": code.FUNCTION,
+ "height": code.FUNCTION, "width": code.FUNCTION, "min-width": code.FUNCTION, "max-width": code.FUNCTION, "max-height": code.FUNCTION,
"left": code.FUNCTION, "top": code.FUNCTION, "right": code.FUNCTION, "bottom": code.FUNCTION,
"border-radius": code.FUNCTION, "outline": code.FUNCTION, "box-shadow": code.FUNCTION,
@@ -253,6 +253,7 @@ Volcanos(chat.ONSYNTAX, {
"line-height": code.FUNCTION, "text-align": code.FUNCTION, "tab-size": code.FUNCTION, "white-space": code.FUNCTION,
"monospace": code.CONSTANT, "italic": code.CONSTANT, "bold": code.CONSTANT, "center": code.CONSTANT,
"cursor": code.FUNCTION, "pointer": code.CONSTANT,
+ "stroke-width": code.FUNCTION, "stroke": code.FUNCTION, "fill": code.FUNCTION,
"dark": code.CONSTANT, "light": code.CONSTANT, "transparent": code.CONSTANT,
"black": code.CONSTANT, "white": code.CONSTANT, "blue": code.CONSTANT, "red": code.CONSTANT, "yellow": code.CONSTANT,
diff --git a/plugin/local/code/vimer.js b/plugin/local/code/vimer.js
index cc684847..4f51f994 100644
--- a/plugin/local/code/vimer.js
+++ b/plugin/local/code/vimer.js
@@ -12,6 +12,11 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.require(["i
}, onkeyup: function(event) { can.onimport._value(can); if (event.metaKey) { return } can.onaction._complete(event, can)
}, onfocus: function(event) { can.current.line.appendChild(can.ui.complete)
}, onclick: function(event) { can.onkeymap._insert(event, can)
+ if (event.metaKey) { var target = event.target, begin = target.selectionStart, end = begin, reg = /[a-zA-Z0-9]/
+ for (begin; begin > 0; begin--) { if (!reg.test(target.value.slice(begin, begin+1))) { begin++; break } }
+ for (end; end < target.value.length; end++) { if (!reg.test(target.value.slice(end, end+1))) { break } }
+ can.onaction.searchLine(event, can, target.value.slice(begin, end))
+ }
}}, {view: [[code.COMPLETE]]},
]); can.ui.current = ui.current, can.ui.complete = ui.complete, can.onkeymap._plugin(can) },
_value: function(can) { can.onimport.__tabPath(can, true), can.db.mode == mdb.INSERT && can.onmotion.delay(can, function() { can.current.text(can.ui.current.value) }) },
diff --git a/plugin/local/code/xterm.js b/plugin/local/code/xterm.js
index 8cc1b491..9f1b4881 100644
--- a/plugin/local/code/xterm.js
+++ b/plugin/local/code/xterm.js
@@ -30,7 +30,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb) { can.page.requireModules
can.onmotion.delay(can, function() { var output = tabs._output; can.onaction.select(can, output._root||output) })
}, function() { can.onaction.delete(can, tabs._output) }); return tabs._output = output, output._tabs = tabs
},
- _theme: function(can, item) { return can.base.Obj(item.theme)||(can.getHeaderTheme() == html.LIGHT? {background: cli.WHITE, foreground: cli.BLACK, cursor: cli.BLUE}: {}) },
+ _theme: function(can, item) { return can.base.Obj(item.theme)||(can.getHeaderTheme() == html.LIGHT? {background: cli.WHITE, foreground: cli.BLACK, cursor: cli.BLUE}: {foreground:"silver", cursor: "silver"}) },
_connect: function(can, item, output, tabs, text) { var term = new Terminal({tabStopWidth: 4, cursorBlink: true, theme: can.onimport._theme(can, item)})
term._item = item, term._output = output, output._term = term, output._tabs || (tabs? (output._tabs = tabs): can.onimport._tabs(can, item, output))
var fitAddon = new FitAddon.FitAddon(); term.loadAddon(fitAddon), term._fit = fitAddon, can.onmotion.delay(can, function() { fitAddon.fit() })
diff --git a/plugin/local/team/plan.js b/plugin/local/team/plan.js
index 52f5b27b..1e7a47bc 100644
--- a/plugin/local/team/plan.js
+++ b/plugin/local/team/plan.js
@@ -1,5 +1,5 @@
Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear(can, target), can._display_heights = {}
- can.ui = can.onlayout.profile(can), can.onmotion.hidden(can, can.ui.project), can.onmotion.hidden(can, can.ui.profile)
+ can.ui = can.onappend.layout(can), can.onmotion.hidden(can, can.ui.project), can.onmotion.hidden(can, can.ui.profile)
can.onimport[can.Option("scale")||team.WEEK](can, msg), can.onimport.layout(can)
},
_content: function(can, msg, head, list, key, get, set) { var begin_time = can.base.Date(can.Option(team.BEGIN_TIME)); can.sup.task && (can.sup.task._target = null)
@@ -70,7 +70,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear(
can.onimport._content(can, msg, head, list, key, get, set)
},
week: function(can, msg) { var head = can.onexport.head(can, team.HOUR)
- var list = [0]; for (var i = 7; i < 24; i++) { list.push(can.base.Number(i, 2)) }
+ var list = [0]; for (var i = 7; i < 24; i++) { list.push(can.base.Number(i, 2)+":00") }
function key(time) { return time.getDay()+" "+can.base.Number(time.getHours(), 2) }
function get(begin_time, col, row, hash) { return hash[col-1+" "+list[row]] }
function set(begin_time, col, row) { return can.base.Time(can.base.DateAdd(begin_time, -begin_time.getDay()+col-1), "%y-%m-%d ")+list[row] }
diff --git a/plugin/local/wiki/draw.css b/plugin/local/wiki/draw.css
index 850d6f35..99e275be 100644
--- a/plugin/local/wiki/draw.css
+++ b/plugin/local/wiki/draw.css
@@ -1,27 +1,5 @@
-fieldset.plugin>div.output div.project { border-right:gray solid 1px; max-width:240px; }
-fieldset.plugin>div.output div.profile { border-left:gray solid 1px; max-width:240px; }
+fieldset.plugin>div.output>div.project { border-right:gray solid 1px; min-width:120px; max-width:240px; }
+fieldset.plugin>div.output div.profile { border-left:gray solid 1px; }
fieldset.plugin>div.output div.display { border-top:gray solid 1px; }
-svg rect { transition:fill ease-in 5s; }
fieldset.draw>form.option>div.item.pid>input { width:60px; }
-fieldset.draw svg text { font-size:24px; font-family:monospace; }
-fieldset.draw svg rect { stroke-width:2; }
-fieldset.draw svg line { stroke-width:2; }
-fieldset.draw svg g[font-size] text { font-size:unset; }
-fieldset.draw svg g[stroke-width] rect { stroke-width:unset; }
-fieldset.draw svg g[stroke-width] line { stroke-width:unset; }
-body.dark fieldset.draw svg text { stroke:white; fill:white; }
-body.dark fieldset.draw svg rect { stroke:white; fill:black; }
-body.dark fieldset.draw svg line { stroke:white; }
-body.light fieldset.draw svg text { stroke:black; fill:black; }
-body.light fieldset.draw svg rect { stroke:black; fill:white; }
-body.light fieldset.draw svg line { stroke:black; }
-body.light fieldset.draw svg g[fill] text { fill:unset; }
-body.light fieldset.draw svg g[stroke] text { stroke:unset; }
-body.light fieldset.draw svg g[stroke] line { stroke:unset; }
-body.light fieldset.draw svg g[stroke] rect { stroke:unset; }
-body.light fieldset.draw svg g[fill] rect { fill:unset; }
-body.dark fieldset.draw svg g[fill] text { fill:unset; }
-body.dark fieldset.draw svg g[stroke] text { stroke:unset; }
-body.dark fieldset.draw svg g[stroke] line { stroke:unset; }
-body.dark fieldset.draw svg g[stroke] rect { stroke:unset; }
-body.dark fieldset.draw svg g[fill] rect { fill:unset; }
+fieldset.draw>div.output>div.layout>div.layout>div.profile { max-width:240px; }
diff --git a/plugin/local/wiki/draw.js b/plugin/local/wiki/draw.js
index 2242b874..4b074152 100644
--- a/plugin/local/wiki/draw.js
+++ b/plugin/local/wiki/draw.js
@@ -1,6 +1,6 @@
Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear(can); var pid = can.misc.SearchHash(can)[0]
can.svg = null, can.group = null, can.temp = null, can.current = null, can.points = [], can._display_heights = {}
- if (can._index == web.WIKI_DRAW) { can.ui = can.onappend.layout(can, can._output) } else { can.ui = {content: can._output} }
+ if (can._index == web.WIKI_DRAW) { can.ui = can.onappend.layout(can) } else { can.ui = {content: can._output} }
can.page.Modify(can, can.ui.content, msg.Results()||can.onexport.content(can))
can.page.Select(can, can.ui.content, html.SVG, function(target) { can.svg = can.group = can.onimport._block(can, target), can.onimport._group(can, target)
can.page.Select(can, target, mdb.FOREACH, function(target) { can.onimport._block(can, target), can.page.tagis(target, svg.G) && target.Value(html.CLASS) && can.onimport._group(can, target) })
@@ -24,7 +24,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear(
},
_group: function(can, target) { if (!can.ui.project) { return } var name = target.Groups()
return name && can.onimport.item(can, {name: name}, function(event) { can.group = target, can.Status(svg.GROUP, name), can.onaction.show(event, can)
- can.core.List([svg.FONT_SIZE, svg.STROKE_WIDTH, svg.STROKE, svg.FILL], function(key) { can.Action(key, target.Value(key)||ice.AUTO) })
+ can.core.List([svg.FONT_SIZE, svg.STROKE_WIDTH, svg.STROKE, svg.FILL], function(key) { can.Action(key, target.Value(key)||key) })
}, function(event) { can.user.carteRight(event, can, can.onaction, can.onaction.menu_list) }, can.ui.project)
},
_profile: function(can, target) { if (!can.ui.profile) { return } can.misc.SearchHash(can, can.Option(svg.PID, can.svg.Value(svg.PID, can.onexport._pid(can, target))))
@@ -44,9 +44,10 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear(
if (can.onmotion.cache(can, function() { return target.Value(svg.PID) }, can.ui.display)) { return } if (!target.Value(ctx.INDEX)) { return }
can.onappend.plugin(can, {index: target.Value(ctx.INDEX), args: target.Value(ctx.ARGS), height: can.ConfHeight()/2-2*html.ACTION_HEIGHT}, function(sub) {
sub.run = function(event, cmds, cb) { sub.ConfHeight(can.ConfHeight()/2-2*html.ACTION_HEIGHT), can.runActionCommand(event, target.Value(ctx.INDEX), cmds, cb) }
- sub.onexport.output = function() { can.onmotion.delay(can, function() { can.page.style(can, sub._output, html.MAX_HEIGHT, "")
+ sub.onexport.output = function() { can.onmotion.delay(can, function() {
+ can.page.style(can, sub._output, html.MAX_HEIGHT, "")
sub.onimport.size(sub, can._display_heights[target.Value(svg.PID)] = can.base.Max(sub._target.offsetHeight, can.ConfHeight()/2), can.ConfWidth()-can.ui.project.offsetWidth, true)
- can.onimport.layout(can)
+ can.onimport.layout(can), can.page.style(can, sub._output, html.MAX_HEIGHT, sub.ConfHeight())
}) }
}, can.ui.display), can.onmotion.toggle(can, can.ui.display, true)
},
@@ -67,12 +68,15 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear(
},
}, [""])
Volcanos(chat.ONACTION, {list: [[svg.GRID, 10, 1, 2, 3, 4, 5, 10, 20],
- [svg.FONT_SIZE, ice.AUTO, 12, 16, 18, 24, 32], [svg.STROKE_WIDTH, ice.AUTO, 1, 2, 3, 4, 5],
- [svg.STROKE, ice.AUTO, cli.RED, cli.YELLOW, cli.GREEN, cli.CYAN, cli.BLUE, cli.PURPLE, cli.BLACK, cli.WHITE],
- [svg.FILL, ice.AUTO, cli.RED, cli.YELLOW, cli.GREEN, cli.CYAN, cli.BLUE, cli.PURPLE, cli.BLACK, cli.WHITE, cli.TRANSPARENT],
+ [svg.FONT_SIZE, svg.FONT_SIZE, 12, 16, 18, 24, 32], [svg.STROKE_WIDTH, svg.STROKE_WIDTH, 1, 2, 3, 4, 5],
+ [svg.STROKE, svg.STROKE, cli.RED, cli.YELLOW, cli.GREEN, cli.CYAN, cli.BLUE, cli.PURPLE, cli.BLACK, cli.WHITE],
+ [svg.FILL, svg.FILL, cli.RED, cli.YELLOW, cli.GREEN, cli.CYAN, cli.BLUE, cli.PURPLE, cli.BLACK, cli.WHITE, cli.TRANSPARENT],
[svg.GO, ice.RUN, ice.AUTO, "manual"], [ice.MODE, web.DRAW, web.RESIZE],
[svg.SHAPE, svg.RECT, svg.TEXT, svg.RECT, svg.LINE, svg.BLOCK, svg.CIRCLE, svg.ELLIPSE],
- ], _change: function(can, key, value) { can.Action(key, value), can.group.Value(key, value) },
+ ], _change: function(can, key, value) {
+ value == "" && (value = key), can.Action(key, value)
+ key == value && (value = ice.AUTO), can.group.Value(key, value)
+ },
"font-size": function(event, can, key, value) { can.onaction._change(can, key, value) },
"stroke-width": function(event, can, key, value) { can.onaction._change(can, key, value) },
stroke: function(event, can, key, value) { can.onaction._change(can, key, value) },
diff --git a/plugin/local/wiki/feel.js b/plugin/local/wiki/feel.js
index a3e58576..1416281e 100644
--- a/plugin/local/wiki/feel.js
+++ b/plugin/local/wiki/feel.js
@@ -1,6 +1,6 @@
Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.clear(can), can.dir_root = msg.Option(nfs.DIR_ROOT)
can._path = can.request(), can.list = [], msg.Table(function(value) { can.base.endWith(value.path, ice.PS)? can._path.Push(value): can.list.push(value) })
- can.ui = can.onappend.layout(can, can._output, "", [html.PROJECT, html.DISPLAY])
+ can.ui = can.onappend.layout(can, [html.PROJECT, html.DISPLAY])
can._path.Table(function(item) { item.name = item.path
can.onimport.item(can, item, function() { can.Option(nfs.PATH, item.path), can.Update() }, function() {}, can.ui.project)
}), cb(msg), can.onimport.page(can, can.list, can.begin = parseInt(msg.Option(cli.BEGIN)||"0"))
diff --git a/plugin/local/wiki/word.css b/plugin/local/wiki/word.css
index 0d326d3b..020f4f03 100644
--- a/plugin/local/wiki/word.css
+++ b/plugin/local/wiki/word.css
@@ -13,15 +13,7 @@ fieldset.word a { word-break:break-all; }
fieldset.word img { word-break:break-all; }
fieldset.word svg.story.auto defs marker { stroke:red; fill:red; }
-fieldset.word svg.story.auto rect { stroke:yellow; fill:black; }
-fieldset.word svg.story.auto text { stroke:yellow; fill:yellow; }
-fieldset.word svg.story.auto line { stroke:red; stroke-width:1; }
-fieldset.word svg.story.auto path { stroke:red; stroke-width:1; }
body.white fieldset.word svg.story.auto defs marker { stroke:red; fill:red; }
-body.white fieldset.word svg.story.auto rect { stroke:blue; fill:yellow; }
-body.white fieldset.word svg.story.auto text { stroke:blue; fill:blue; }
-body.white fieldset.word svg.story.auto line { stroke:red; stroke-width:1; }
-body.white fieldset.word svg.story.auto path { stroke:red; stroke-width:1; }
fieldset.word.play.float>div.action { display:contents; }
fieldset.word.play.float>div.status { clear:none; }
@@ -37,11 +29,5 @@ fieldset.word.cmd>form.option { display:none; }
fieldset.word.cmd>div.action { display:none; }
fieldset.word.cmd>div.status { display:none; }
-div.story[data-type=spark] label {
- -webkit-user-select:none; /*webkit浏览器*/
- -khtml-user-select:none; /*早期浏览器*/
- -moz-user-select:none; /*火狐*/
- -ms-user-select:none; /*IE10*/
- user-select:none;
-}
+div.story[data-type=spark] label { user-select:none; }
diff --git a/plugin/story/form.css b/plugin/story/form.css
deleted file mode 100644
index 5cb578a6..00000000
--- a/plugin/story/form.css
+++ /dev/null
@@ -1,3 +0,0 @@
-div.output.form div.item {
- padding:40px;
-}
diff --git a/plugin/story/form.js b/plugin/story/form.js
deleted file mode 100644
index c5b21cc8..00000000
--- a/plugin/story/form.js
+++ /dev/null
@@ -1,60 +0,0 @@
-Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) {
- can.page.ClassList.add(can, target, "form")
- msg.Push("type", "text")
- msg.Push("name", "name")
- msg.Push("value", "harveyshao")
- msg.Push("action", "key")
-
- msg.Push("type", "text")
- msg.Push("name", "age")
- msg.Push("value", "18")
- msg.Push("action", "")
-
- msg.Push("type", "select")
- msg.Push("name", "male")
- msg.Push("value", "male,female")
- msg.Push("action", "")
-
- msg.Push("type", "textarea")
- msg.Push("name", "intro")
- msg.Push("value", "program")
- msg.Push("action", "")
-
- msg.Push("type", "button")
- msg.Push("name", "submit")
- msg.Push("value", "提交")
- msg.Push("action", "")
-
- var action = ""; msg.Table(function(value, index, array) {
- switch (value.type) {
- case html.BUTTON: action = action||value.name
- can.page.Append(can, target, [{view: "item", list: [
- {view: ["input"], list: [{type: html.INPUT, style: {width: (can.ConfWidth()-90)/2}, data: {type: value.type, value: value.value}, onclick: function(event) {
- var args = [ctx.ACTION, action]
- can.page.Select(can, target, ".args", function(item) { args.push(item.name, item.value)})
- can.run(event, args)
- }}]},
- ]}])
- break
- case html.SELECT:
- can.page.Append(can, target, [{view: "item", list: [
- {view: ["label"], list: [{text: value.name}]},
- {view: ["input"], list: [{type: html.SELECT, className: "args", style: {width: can.ConfWidth()-100},
- data: value, list: can.core.List(can.core.Split(value.value), function(v) { return {type: html.OPTION, name: v, value: v, inner: v} }) }]},
- ]}])
- break
- case html.TEXTAREA:
- can.page.Append(can, target, [{view: "item", list: [
- {view: ["label"], list: [{text: value.name}]},
- {view: ["input"], list: [{type: html.TEXTAREA, className: "args", style: {width: can.ConfWidth()-100}, data: value}]},
- ]}])
- break
- default:
- can.page.Append(can, target, [{view: "item", list: [
- {view: ["label"], list: [{text: value.name}]},
- {view: ["input"], list: [{type: "input", className: "args", style: {width: can.ConfWidth()-100}, data: value}]},
- ]}])
- }
- })
- },
-}, [""])
diff --git a/plugin/story/json.css b/plugin/story/json.css
index aefad24e..72c29b5f 100644
--- a/plugin/story/json.css
+++ b/plugin/story/json.css
@@ -1,8 +1,6 @@
-div.output.json div.item:hover { background-color:transparent; }
-div.output.json div.item div.item { padding-left:15px; border:#0000000d solid 1px; border-left:lightblue dashed 1px; margin-left:5px; }
-div.output.json div.item div.item:hover { color:unset; border:gray solid 1px; }
-div.output.json div.item span.nonce { color:#9cbeca4f; cursor:pointer; }
+div.output.json div.item:hover { background-color:transparent; color:unset; }
+div.output.json div.item div.item { padding-left:15px; border:transparent solid 1px; border-left:lightblue dashed 1px; margin-left:5px; }
+div.output.json div.item div.item:hover { border:gray solid 1px; }
+div.output.json div.item label.nonce { color:#9cbeca4f; }
div.output.json div.item span.string { color:orange; }
-// div.output.json div.item span.key { color:yellow; }
-// body.white div.output.json div.item span.key { color:blue; }
-// body.light div.output.json div.item span.key { color:blue; }
+div.output.json label { user-select:none; }
\ No newline at end of file
diff --git a/plugin/story/json.js b/plugin/story/json.js
index 19e5f3df..b977131e 100644
--- a/plugin/story/json.js
+++ b/plugin/story/json.js
@@ -1,45 +1,30 @@
-Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) {
- can.page.ClassList.add(can, target, "json")
- can.onmotion.clear(can, target)
- can.onappend.table(can, msg), can.onimport.show(can, can.base.Obj(msg.Result(), {}), target)
- can.base.isFunc(cb) && cb(msg)
+Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear(can, target)
+ can.onappend.style(can, nfs.JSON, can._output), can.onimport.show(can, can.base.Obj(msg.Result(), {}), target)
},
show: function(can, data, target) {
function show(data, target, index, total) { var list
switch (typeof data) {
- case lang.OBJECT:
- if (data == null) {
- list = can.page.Append(can, target, [{text: "null"}]).item
- break
- }
+ case code.OBJECT: if (data == null) { can.page.Append(can, target, [{text: "null"}]); break }
function wrap(begin, end, add, cb) {
can.page.Append(can, target, [{text: begin}])
- add && can.page.Append(can, target, [{text: ["...", html.SPAN, "nonce"]}]), cb()
+ add && can.page.Append(can, target, [{text: ["...", html.LABEL, "nonce"]}]), cb()
can.page.Append(can, target, [{text: end}])
}
function toggle(list) { list && can.onmotion.toggle(can, list) }
- function _item() {
- list = list || can.page.Append(can, target, [{view: html.LIST}]).list
- return can.page.Append(can, list, [{view: html.ITEM}]).item
- }
-
- if (can.base.isArray(data)) { // 数组
+ function _item() { return can.page.Append(can, list = list || can.page.Append(can, target, [html.LIST])._target, [html.ITEM])._target }
+ if (can.base.isArray(data)) {
wrap("[", "]", data.length > 0, function() { can.core.List(data, function(value, index) { var item = _item()
show(value, item, index, data.length)
}) })
- } else { // 对象
- var length = can.core.Item(data).length, count = 0
+ } else { var length = can.core.Item(data).length, count = 0
wrap("{", "}", length > 0, function() { can.core.Item(data, function(key, value) { var item = _item()
- can.page.Append(can, item, [{text: ['"'+key+'"', html.SPAN, "key"], onclick: function(event) { toggle(sub) }}, {text: ': '}])
+ can.page.Append(can, item, [{text: ['"'+key+'"'], onclick: function(event) { toggle(sub) }}, {text: ": "}])
var sub = show(value, item, count++, length)
}) })
- }
- break
- case lang.STRING: /* 字串 */ can.page.Append(can, target, [{text: ['"'+data+'"', html.SPAN, lang.STRING]}]); break
- default: /* 其它 */ can.page.Append(can, target, [{text: [''+data+'', html.SPAN, "const"]}])
- }
- (index < total-1) && can.page.Append(can, target, [{text: ice.FS}])
- return list
- }; show(data, can.page.Append(can, target, [{view: html.ITEM}]).item, 0, 0)
+ } break
+ case code.STRING: can.page.Append(can, target, [{text: ['"'+data+'"', "", code.STRING]}]); break
+ default: can.page.Append(can, target, [{text: [''+data+'', "", code.CONSTANT]}])
+ } (index < total-1) && can.page.Append(can, target, [{text: ice.FS}]); return list
+ }; show(data, can.page.Append(can, target, [html.ITEM])._target, 0, 0)
},
}, [""])
diff --git a/plugin/story/parse.js b/plugin/story/parse.js
deleted file mode 100644
index f144012a..00000000
--- a/plugin/story/parse.js
+++ /dev/null
@@ -1,157 +0,0 @@
-Volcanos(chat.ONAPPEND, {list: ["{", "}", html.HEAD, html.LEFT, html.MAIN, html.FOOT],
- _parse: function(can, text, name, height) { var stack = [{_deep: -1, list: []}], finish = false
- can.core.List(can.core.Split(text, ice.NL, ice.NL, ice.NL), function(line) { if (line == "" || finish) { return }
- var deep = 0; for (var i = 0; i < line.length; i++) { if (line[i] == ice.SP) { deep++ } else if (line[i] == ice.TB) { deep += 4 } else { break } }
- for (var i = stack.length-1; i > 0; i--) { if (deep <= stack[i]._deep) { stack.pop() } }
-
- var ls = can.core.Split(line); if (ls[0] == "return ") { return finish = true }
- var item = {_deep: deep, list: []}; var list = stack[stack.length-1]; list.list.push(item); if (deep > list._deep) { stack.push(item) }
- can.onappend.list.indexOf(ls[0]) > -1 || can.onappend[ls[0]]? item.type = ls[0]: item.name = ls[0]
- for (var i = 1; i < ls.length; i += 2) { can.core.Value(item, ls[i], ls[i+1]) }
- })
- return {type: name, style: {height: height||can.ConfHeight()||can.page.height()}, list: stack[0].list}
- },
- parse: function(can, list, target, keys, data, type) { target = target||can._output, data = data||{}
- if (!list) { return } else if (can.base.isArray(list)) {
- return can.core.List(list, function(meta, index) { return can.onappend.parse(can, meta, target, keys, data, type) })
-
- } else if (can.base.isString(list)) {
- var ls = can.core.Split(list, "", ":=@"); if (ls.length == 1) {
- var meta = type? {type: type, name: ls[0]}: {type: ls[0]}
- } else {
- var meta = {name: ls[0]}; for (var i = 1; i < ls.length; i += 2) { switch (ls[i]) {
- case ice.AT: meta.action = ls[i+1]; break
- case ice.EQ: meta.value = ls[i+1]; break
- case ice.DF: meta.type = ls[i+1]; break
- } }
- }
-
- } else if (can.base.isObject(list)) { var meta = list }
-
- var item = {view: meta.type}; switch (meta.type) {
- case html.HEAD: meta.subtype = html.MENU
- meta.init = function(target) { can.page.ClassList.add(can, target, html.LAYOUT), data.head = target }
- break
- case "{": if (meta._deep > 0) { return }
- item.view = meta.type = html.LEFT // no break
- case html.LEFT: meta.subtype = html.ITEM
- meta.init = function(target) { can.page.ClassList.add(can, target, html.LAYOUT), data.left = target
- can.onmotion.delay(can, function() { var height = target.parentNode.offsetHeight
- can.page.Select(can, target.parentNode, can.page.Keys(html.DIV_LAYOUT_HEAD, html.DIV_LAYOUT_FOOT), function(item) {
- if (item.parentNode == target.parentNode) {
- height -= item.offsetHeight // 高度
- }
- }), can.page.style(can, target, html.HEIGHT, height-40)
- })
- }
- break
- case "}": if (meta._deep > 0) { return }
- item.view = meta.type = html.MAIN // no break
- case html.MAIN:
- meta.init = function(target) { can.page.ClassList.add(can, target, html.LAYOUT)
- can.onmotion.delay(can, function() { var height = target.parentNode.offsetHeight
- can.page.Select(can, target.parentNode, can.page.Keys(html.DIV_LAYOUT_HEAD, html.DIV_LAYOUT_FOOT), function(item) {
- if (item.parentNode == target.parentNode) {
- height -= item.offsetHeight // 高度
- }
- }), can.page.style(can, target, html.HEIGHT, height)
- }, data.main? 10: 100)
- can.onmotion.delay(can, function() { var width = target.parentNode.offsetWidth
- can.page.Select(can, target.parentNode, html.DIV_LAYOUT_LEFT, function(item) {
- if (item.parentNode == target.parentNode) {
- width -= item.offsetWidth // 宽度
- }
- }), can.page.style(can, target, html.WIDTH, width)
- }, data.main? 10: 100)
-
- if (!data.main) { data.main = target
- can.onmotion.delay(can, function() { data.main_init && data.main_init() }, 300)
- }
- }
- break
- case html.FOOT: meta.subtype = html.MENU
- meta.init = function(target) { can.page.ClassList.add(can, target, html.LAYOUT), data.foot = target }
- break
- default: var cb = can.onappend[meta.type]; cb && cb(can, item, meta, target, data)
- }
- if (can.base.isObject(meta.style)) { item.style = meta.style }
- if (can.base.isString(meta.style)) { item.className = meta.style }
-
- meta.keys = meta.keys||can.core.Keys(keys, meta.name||meta.type)
- var cb = can.onappend[type]; !can.onappend[meta.type] && cb && cb(can, item, meta, target, data)
- item._init = item._init||function(target) { meta.list && can.onappend.parse(can, meta.list, target, meta.keys, data, meta.subtype||type) }
- item.target = can.page.Append(can, target, [item])._target; meta.init && meta.init(item.target)
- can.core.ItemCB(meta, function(key, cb) { item.target[key] = can.base.isFunc(cb)? cb: function(event) { can.onengine.signal(can, cb, can.request(event, meta)) } })
- },
- username: function(can, item, meta, target) {
- can.base.Copy(item, {view: [aaa.USERNAME, html.DIV], list: [{view: [html.NAME, html.DIV, can.user.info.usernick]}, {view: [html.ICON, html.DIV], list: [{img: can.user.info.avatar}]}]})
- },
- menu: function(can, item, meta, target) {
- can.base.Copy(item, meta.list && meta.list.length > 0? {view: [html.MENU, html.DIV, meta.name], onmouseenter: function(event) {
- can.user.carte(event, can, {}, can.core.List(meta.list, function(item) { return item.name }), function(event, button, meta) {
- can.onengine.signal(can, button) || can.onengine.signal(can, html.MENU, can.request(event, {item: button}))
- })
- }, _init: function() {}}: {view: [html.MENU, html.DIV, meta.name], onclick: function(event) {
- can.onengine.signal(can, meta.name) || can.onengine.signal(can, html.MENU, can.request(event, {item: meta.name}))
- }, _init: function() {}})
- },
- item: function(can, item, meta, target, data) { item.view = item.view||html.LIST
- if (decodeURIComponent(location.hash) == "#"+meta.keys) {
- data.main_init = function() { can.onappend._show(can, meta, data) }
- }
- if (meta.action == ice.AUTO && !location.hash) {
- data.main_init = function() { can.onappend._show(can, meta, data) }
- }
-
- can.base.Copy(item, {view: "some", list: [{view: [html.ITEM, html.DIV, meta.name||meta], onclick: function(event) {
- can.onappend._show(can, meta, data), can.onkeymap.prevent(event), event.target.nextSibling && can.onmotion.toggle(can, event.target.nextSibling)
- }}, {view: html.LIST, _init: function(target) { meta.list && can.onappend.parse(can, meta.list, target, meta.keys, data, html.ITEM) }}], _init: function() {}})
- },
- tabs: function(can, item, meta, target) {
- item.list = [{view: "name"}, {view: html.PAGE}], item._init = function(_target, ui) {
- can.page.Append(can, ui.page, [{view: html.INPUT, list: [{type: html.INPUT, onkeyup: function(event) {
- can.page.Select(can, _target, [html.DIV_PAGE, html.DIV_ITEM], function(item) {
- can.page.ClassList.set(can, item, html.HIDE, item.innerText.indexOf(event.target.value) == -1)
- })
- }}]}])
- can.core.List(meta.list, function(item, index) {
- can.page.Append(can, ui.name, [{view: [html.ITEM, html.DIV, item.name||item], onclick: function(event) {
- can.onmotion.select(can, _target, [[html.DIV_PAGE, html.DIV_LIST]], index)
- can.onmotion.select(can, ui.name, html.DIV_ITEM, index)
- ui.page.scrollTo(0, 0)
- }}])
- can.page.Append(can, ui.page, [{view: [html.ITEM, html.DIV, item.name], onclick: function(event) {
- can.page.ClassList.neg(can, event.target.nextSibling, html.SELECT)
- can.onmotion.select(can, ui.name, html.DIV_ITEM, index)
- }}, {view: [html.LIST], _init: function(target) {
- can.onappend.parse(can, item.list, target, can.core.Keys(meta.keys, item.name), data, html.ITEM)
- }}])
- })
- can.onmotion.delay(can, function() { var height = target.offsetHeight
- can.page.style(can, ui.page, html.HEIGHT, height-10-(meta.style? 0: ui.name.offsetHeight))
- can.page.style(can, _target, html.HEIGHT, height-10)
- }), can.page.Select(can, ui.name, html.DIV_ITEM)[0].click()
- }
- },
- _show: function(can, meta, data) { var target = data.main
- if (!meta.index) { return }
- var url = can.misc.MergeURL(can, {pod: can.misc.Search(can, "pod"), cmd: meta.index})
- if (meta.action == "push") { return can.user.jumps(url) }
- if (meta.action == "open") { return can.user.open(url) }
-
- location.hash = meta.keys
- if (can.onmotion.cache(can, function() { return meta.keys }, target)) { return }
-
- if (can.base.Ext(meta.index) == nfs.ZML || can.base.Ext(meta.index) == nfs.IML) {
- return can.page.Append(can, target, [{type: html.IFRAME, src: "/chat/cmd/"+meta.index, height: target.offsetHeight, width: target.offsetWidth}])
- }
-
- can.onappend.plugin(can, {index: meta.index, args: can.base.Obj(meta.args)}, function(sub) {
- sub.run = function(event, cmds, cb) { can.runActionCommand(event, sub._index||meta.index, cmds, cb) }
- sub.ConfHeight(target.offsetHeight-3*html.ACTION_HEIGHT-6*html.PLUGIN_MARGIN), sub.ConfWidth(target.offsetWidth-4*html.PLUGIN_MARGIN)
- can.page.style(can, sub._output, html.MAX_HEIGHT, sub.ConfHeight())
- can.page.style(can, sub._output, html.MAX_WIDTH, sub.ConfWidth())
- }, target)
- },
-})
-
diff --git a/plugin/story/pie.js b/plugin/story/pie.js
index 58b2c928..f87b0259 100644
--- a/plugin/story/pie.js
+++ b/plugin/story/pie.js
@@ -1,11 +1,19 @@
-Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb) { can.page.requireDraw(can, function() {
+Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb) { can.page.requireDraw(can, function() { can.list = can.onimport._data(can, msg, can.Conf(mdb.FIELD))
+ can.core.List(can.list, function(item) { msg.Push(cli.COLOR, ' ').Push("weight", parseInt(item.span*100/360)+"%") })
can.onaction.list = [], can.ui.display = can.page.Append(can, can._output, [html.DISPLAY])._target
can.onappend.table(can, msg, null, can.ui.display), can.page.Select(can, can.ui.display, html.TR, function(tr, index) {
can.page.Modify(can, tr, {onmouseenter: function(event) { can._draw(index-1) }})
- }), can.base.isFunc(cb) && cb(msg), can.onappend._status(can, [].concat(msg.append, ["weight"]))
+ }), can.base.isFunc(cb) && cb(msg), can.onappend._status(can, msg.append)
}) },
- _draw: function(can, msg, field, color, x, y, r, margin, which) { if (which == can._last) { return } can._last = which, field = field||mdb.VALUE
- if (msg.Length() == 1) { return can.onimport.draw(can, {shape: svg.CIRCLE, points: [{x: x, y: y}, {x: x, y: y+r}], style: {fill: color[0]}}) }
+ _data: function(can, msg, field) { var list = []
+ var color = ["#3300FF", "#2196F3", "#4CAF50", "#CDDC39", "#FFEB3B", "#9C27B0", "#795548", "#607D8B", "#CC33FF"]
+ var total = 0; msg.Table(function(value) { total += can.onimport._parseInt(can, value[field]) })
+ var begin = 0; msg[cli.COLOR] = [], msg["weight"] = [], msg.Table(function(value, index) {
+ list.push({span: can.onimport._parseInt(can, value[field])/total*360, color: color[index%color.length], value: value})
+ }); return list
+ },
+ _draw: function(can, x, y, r, margin, which) { if (which == can._last) { return } can._last = which
+ if (can.list.length == 1) { return can.onimport.draw(can, {shape: svg.CIRCLE, points: [{x: x, y: y}, {x: x, y: y+r}], style: {fill: "blue"}}) }
function pos(x, y, r, angle) { angle -= 90; return [x + r * Math.cos(angle * Math.PI / 180), y + r * Math.sin(angle * Math.PI / 180)] }
function pie(x, y, r, begin, span, color, cb) { can.onimport.draw(can, {shape: svg.PATH, style: kit.Dict(
svg.STROKE, color, svg.FILL, color, "d", can.base.joins([
@@ -13,12 +21,9 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb) { can.page.requireDraw(ca
], ice.SP, ice.FS),
), onmouseenter: function(event) { can.base.isFunc(cb) && cb(event) } }) }
can.onmotion.clear(can, can.svg), can.svg.Value(mdb.COUNT, 0)
- var total = 0; msg.Table(function(value) { total += can.onimport._parseInt(can, value[field]) })
- var begin = 0; msg[cli.COLOR] = [], msg["weight"] = [], msg.Table(function(value, index) { var span = can.onimport._parseInt(can, value[field])/total*360
- var p = index==which? pos(x, y, margin, begin+span/2): [x, y], c = color[index%color.length]
- pie(p[0], p[1], r, begin, span, c, function(event) { can.onimport._draw(can, msg, field, color, x, y, r, margin, index) }), begin += span
- msg.Push(cli.COLOR, ' ').Push("weight", parseInt(span*100/360)+"%")
- if (index == which) { can.Status(value), can.Status("weight", parseInt(span*100/360)+"%") }
+ var begin = 0; can.core.List(can.list, function(item, index) { var p = index==which? pos(x, y, margin, begin+item.span/2): [x, y]
+ pie(p[0], p[1], r, begin, item.span, item.color, function(event) { can.onimport._draw(can, x, y, r, margin, index) }), begin += item.span
+ index == which && can.Status(item.value)
})
},
_parseInt: function(can, value) { value = value.toLowerCase()
@@ -28,9 +33,8 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb) { can.page.requireDraw(ca
if (can.base.endWith(value, "m")) { return parseInt(value)*1000000 }
return parseInt(value)
},
- layout: function(can) { var color = ["#3300FF", "#2196F3", "#4CAF50", "#CDDC39", "#FFEB3B", "#9C27B0", "#795548", "#607D8B", "#CC33FF"]
+ layout: function(can) {
var height = can.base.Max(can.ConfHeight(), can.ConfWidth()/2), margin = 20, r = height/2-margin; can.svg.Val(html.WIDTH, height), can.svg.Val(html.HEIGHT, height)
- can._draw = function(which) { can.onimport._draw(can, can._msg, can.Conf(mdb.FIELD), color, r+margin, r+margin, r, margin, which) }, can._draw(0)
- // can.page.style(can, can.ui.project, html.MAX_WIDTH, can.ConfWidth()-height)
+ can._draw = function(which) { can.onimport._draw(can, r+margin, r+margin, r, margin, which) }, can._draw(0)
},
})
diff --git a/plugin/story/spide.js b/plugin/story/spide.js
index c00940bd..c4640bf0 100644
--- a/plugin/story/spide.js
+++ b/plugin/story/spide.js
@@ -51,7 +51,6 @@ Volcanos(chat.ONACTION, {list: [[ice.VIEW, "横向", "纵向"], [html.SIZE, 24,
})
},
})
-Volcanos(chat.ONEXPORT, {list: ["time", "count"]})
Volcanos(chat.ONDETAIL, {
onclick: function(event, can, tree) {
if (tree.list.length > 0 || tree.name.endsWith(can.Conf(lex.SPLIT))) { return tree.hide = !tree.hide, can.onaction[can.Action(ice.VIEW)||"横向"](event, can) }
@@ -63,7 +62,7 @@ Volcanos(chat.ONDETAIL, {
},
plugin: function(can, index, args, prefix) { can.onappend.plugin(can, {mode: chat.FLOAT, index: index, args: args}, function(sub) {
can.getActionSize(function(left, top, width, height) { var margin = 100; left = left||0, top = top||0
- sub.onimport.size(sub, height/2-margin-html.ACTION_HEIGHT, width, true), can.onmotion.move(can, sub._target, {left: left, top: top+margin})
+ sub.onimport.size(sub, height-margin-html.ACTION_HEIGHT, width, true), can.onmotion.move(can, sub._target, {left: left, top: top+margin})
}), sub.onaction.close = function() { can.page.Remove(can, sub._target) }
}) },
})
diff --git a/plugin/story/trend.js b/plugin/story/trend.js
index c57c746c..08f8475e 100644
--- a/plugin/story/trend.js
+++ b/plugin/story/trend.js
@@ -70,7 +70,9 @@ Volcanos(chat.ONACTION, {list: [[ice.VIEW, "趋势图", "柱状图", "折线图"
margin: function(event, can) { can.onimport.layout(can) },
speed: function(event, can) { can.onimport.layout(can) },
})
-Volcanos(chat.ONDETAIL, { onmouseenter: function(event, can, item) { can.Status(item) }, })
+Volcanos(chat.ONDETAIL, {
+ onmouseenter: function(event, can, item) { can.Status(item) },
+})
Volcanos(chat.ONEXPORT, {list: ["from", "commit", "total", "max", "date", "text", "add", "del"],
height: function(can) { var height = can.Action(html.HEIGHT)
if (height == ice.AUTO) { height = can.ConfHeight() } if (height < 200) { height = 200 }
diff --git a/plugin/story/video.js b/plugin/story/video.js
deleted file mode 100644
index c75fb187..00000000
--- a/plugin/story/video.js
+++ /dev/null
@@ -1,46 +0,0 @@
-Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) {
- can.onimport.select(can, msg)
- can.onmotion.clear(can), can.base.isFunc(cb) && cb(msg)
- can.onappend.table(can, msg), can.onappend.board(can, msg)
- can.onmotion.delay(can, function() { can.onaction.play(event, can) })
- can.page.Select(can, can._output, "td a", function(a) {
- can.page.Modify(can, a, {target: ""})
- })
- },
- select: function(can, msg) {
- msg.Clear(), can.page.Select(can, can._root._target, can.Option("tags"), function(a, index) {
- msg.Push(mdb.INDEX, index)
- msg.Push(mdb.NAME, a.innerText)
- msg.Push(mdb.LINK, a.href)
- a.href == location.href && can.onmotion.delay(can, function() {
- can.page.Select(can, can._output, html.TR, function(tr, i) {
- i-1 == index && can.page.ClassList.add(can, tr, "select")
- })
- })
- })
- msg.Option(ice.MSG_STATUS, JSON.stringify([
- {name: "time", value: can.base.Time(null, "%y-%m-%d %H:%M:%S")},
- {name: "count", value: msg.Length()},
- ]))
- },
-})
-Volcanos(chat.ONACTION, {
- next: function(event, can) { var msg = can._msg
- msg.Table(function(line, index) {
- if (line.link == location.href) {
- location.href = msg.link[index+1]
- }
- })
- },
- play: function(event, can) {
- can.page.Select(can, can._root._target, html.VIDEO, function(video) {
- video.playbackRate = parseFloat(can.Option("rate"))
- video.currentTime = parseInt(can.Option("skip"))
- video.ontimeupdate = function(event) { can.misc.Event(event, can, function(msg) {
- if (video.currentTime > parseInt(can.Option("next"))) {
- can.onaction.next(event, can)
- }
- }) }, video.play(), video.requestFullscreen()
- })
- },
-})
diff --git a/proto.js b/proto.js
index 8a2665f4..3f9ed463 100644
--- a/proto.js
+++ b/proto.js
@@ -139,8 +139,9 @@ var log = {
var code = {
FAVOR: "favor", XTERM: "xterm", INNER: "inner", VIMER: "vimer",
WEBPACK: "webpack", BINPACK: "binpack", AUTOGEN: "autogen", COMPILE: "compile", PUBLISH: "publish",
- COMMENT: "comment", KEYWORD: "keyword", PACKAGE: "package", DATATYPE: "datatype", FUNCTION: "function", CONSTANT: "constant", STRING: "string", OBJECT: "object",
- SPACE: "space", UNDEFINED: "undefined", STRING: "string", NUMBER: "number", BOOLEAN: "boolean", FUNCTION: "function", OBJECT: "object", ARRAY: "array",
+ COMMENT: "comment", KEYWORD: "keyword",
+ PACKAGE: "package", DATATYPE: "datatype", FUNCTION: "function", CONSTANT: "constant",
+ STRING: "string", NUMBER: "number", BOOLEAN: "boolean", OBJECT: "object", ARRAY: "array",
TEMPLATE: "template", COMPLETE: "complete", NAVIGATE: "navigate", CURRENT: "current",
PULL: "pull", PUSH: "push",
}