From 8930b335b0061f868b45f2a2319242809fd47f19 Mon Sep 17 00:00:00 2001 From: shy Date: Thu, 11 Jan 2024 12:33:07 +0800 Subject: [PATCH] opt layout --- frame.js | 6 ++- index.css | 35 +++++++++-------- panel/action.css | 6 +-- panel/action.js | 77 +++++++++++++++---------------------- panel/header.css | 11 ++++++ panel/header.js | 16 +++++--- panel/river.js | 3 +- plugin/local/code/inner.css | 5 +++ plugin/local/code/vimer.js | 7 +--- plugin/state.js | 2 +- plugin/table.js | 7 +++- 11 files changed, 94 insertions(+), 81 deletions(-) diff --git a/frame.js b/frame.js index e54c6a86..cd1f098f 100644 --- a/frame.js +++ b/frame.js @@ -176,7 +176,9 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { sub._fields = can if (item.type == html.TEXT) { can.page.Append(can, sub._target.parentNode, [{text: [sub._target.value, html.SPAN, mdb.VALUE]}]) } if (item.type == html.BUTTON && can.page.isIconInput(can, item.name)) { - can.onappend.icons(can, sub._target, item.name, item.onclick||function(event) { can.Update(event, [ctx.ACTION, item.name].concat(can.page.SelectArgs(sub))) }) + can.onappend.icons(can, sub._target, item.name, item.onclick||function(event) { + can.Update(event, item.name == "refresh"? []: [ctx.ACTION, item.name].concat(can.page.SelectArgs(sub))) + }) } sub.run = function(event, cmds, cb, silent) { var msg = can.requestAction(event, item.name)._caller() msg.RunAction(event, sub, cmds) || msg.RunAction(event, can.sub, cmds) || can.Update(event, can.Input(cmds, !silent), cb, silent) @@ -232,7 +234,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { if (list.length == 0 && can.Conf("inputs").length == 0) { return meta } var _can = can._fields? can.sup: can can.user.isMobile || can.isCmdMode() || can.base.beginWith(can.ConfIndex(), "can.") || can.page.tagis(can._fields||can._target, html.FIELDSET_PANEL, html.FIELDSET_PLUG) || action == can._action && can.page.Append(can, action, - can.core.Item({full: "切换全屏", open: "打开链接"}, function(key, value) { + can.core.Item({full: "切换全屏", open: "打开链接", qrcode: "生成链接"}, function(key, value) { return {view: [[html.ITEM, html.BUTTON, key, "icons"]], list: [{icon: icon[key]}], title: can.user.trans(can, key), onclick: function(event) { _can.onaction[value](event, _can, value, _can.sub) }} diff --git a/index.css b/index.css index 4033e3c9..69278232 100644 --- a/index.css +++ b/index.css @@ -35,8 +35,8 @@ body { --river-width:var(--project-width); --project-width:230px; --input-width:120px; --button-width:60px; --action-height:32px; --status-height:var(--action-height); --footer-height:var(--action-height); --header-height:48px; - --desktop-height:684px; --float-height:480px; --plug-height:320px; --story-height:var(--float-height); - --desktop-width:1200px; --float-width:1200px; --plug-width:800px; + --desktop-height:684px; --float-height:480px; --plug-height:480px; --story-height:var(--float-height); + --desktop-width:1200px; --float-width:1200px; --plug-width:1000px; --textarea-height:96px; --qrcode-height:364px; --iframe-height:420px; --river-margin:80px; --action-margin:200px; --desktop-icon-size:80px; --plugin-padding:10px; --plugin-margin:var(--plugin-padding); @@ -111,8 +111,8 @@ table.content td { padding:var(--table-padding); } table.content td input.icons { display:none; } table.content td i:hover { background-color:var(--hover-bg-color); color:var(--hover-fg-color); cursor:pointer; } table.content td i { padding:var(--input-padding); font-size:20px; } -body:not(.mobile) fieldset.plugin:not(.plug):not(.float):not(.full):not(.cmd)>div.output>table.content td input.icons { display:unset; } -body:not(.mobile) fieldset.plugin:not(.plug):not(.float):not(.full):not(.cmd)>div.output>table.content td i { display:none; } +body:not(.mobile) fieldset.Action:not(.tabview):not(.grid) fieldset.plugin:not(.plug):not(.float):not(.full):not(.cmd)>div.output>table.content td input.icons { display:unset; } +body:not(.mobile) fieldset.Action:not(.tabview):not(.grid) fieldset.plugin:not(.plug):not(.float):not(.full):not(.cmd)>div.output>table.content td i { display:none; } table.content.checkbox th:first-child { text-align:center; padding:var(--table-padding); position:sticky; left:2px; z-index:1; } table.content.checkbox td:first-child { background-color:var(--th-bg-color); text-align:center; position:sticky; left:2px; } table.content.detail td:first-child { width:var(--input-width); } @@ -304,13 +304,16 @@ div.tabs:hover>span.icon { visibility:visible; } fieldset.plugin>legend { font-style:italic; } fieldset.plugin>form.option>div.button.icons>input { display:none; } fieldset.plugin>div.action>div.button.icons>input { display:none; } -fieldset.plugin:not(.float):not(.full):not(.cmd)>form.option>div.icon { display:none; } -body:not(.mobile) fieldset.plugin:not(.float):not(.full):not(.cmd)>form.option>div.button.icons>input { display:unset; } -body:not(.mobile) fieldset.plugin:not(.float):not(.full):not(.cmd)>form.option>div.button.icons>span.icon { display:none; } -body:not(.mobile) fieldset.plugin:not(.float):not(.full):not(.cmd)>form.option>div.button.icons>i { display:none; } -body:not(.mobile) fieldset.plugin:not(.float):not(.full):not(.cmd)>div.action>div.button.icons>input { display:unset; } -body:not(.mobile) fieldset.plugin:not(.float):not(.full):not(.cmd)>div.action>div.button.icons>span.icon { display:none; } -body:not(.mobile) fieldset.plugin:not(.float):not(.full):not(.cmd)>div.action>div.button.icons>i { display:none; } +/* fieldset.plugin:not(.float):not(.full):not(.cmd)>form.option>div.icon { display:none; } */ +fieldset.Action:not(.tabview):not(.grid) fieldset.plugin:not(.float):not(.full):not(.cmd)>form.option>div.icon { display:none; } +fieldset.Action.tabview fieldset.plugin:not(.float):not(.full):not(.cmd)>form.option>div.icon.delete { display:none; } +fieldset.Action.grid fieldset.plugin:not(.float):not(.full):not(.cmd)>form.option>div.icon.delete { display:none; } +body:not(.mobile) fieldset.Action:not(.tabview):not(.grid) fieldset.plugin:not(.float):not(.full):not(.cmd)>form.option>div.button.icons>input { display:unset; } +body:not(.mobile) fieldset.Action:not(.tabview):not(.grid) fieldset.plugin:not(.float):not(.full):not(.cmd)>form.option>div.button.icons>span.icon { display:none; } +body:not(.mobile) fieldset.Action:not(.tabview):not(.grid) fieldset.plugin:not(.float):not(.full):not(.cmd)>form.option>div.button.icons>i { display:none; } +body:not(.mobile) fieldset.Action:not(.tabview):not(.grid) fieldset.plugin:not(.float):not(.full):not(.cmd)>div.action>div.button.icons>input { display:unset; } +body:not(.mobile) fieldset.Action:not(.tabview):not(.grid) fieldset.plugin:not(.float):not(.full):not(.cmd)>div.action>div.button.icons>span.icon { display:none; } +body:not(.mobile) fieldset.Action:not(.tabview):not(.grid) fieldset.plugin:not(.float):not(.full):not(.cmd)>div.action>div.button.icons>i { display:none; } fieldset.panel>div.action>div.button.icons>span.icon { display:none; } fieldset.plugin.cmd>form.option>div.icon.delete { display:none; } fieldset.story>form.option>div.button.icons>input { display:none; } @@ -392,10 +395,10 @@ fieldset:not(.plug)>div.output.card>div.item { height:180px; min-width:320px; } -fieldset.plug>div.output.card>div.item { - width:100%; - margin:0; -} +/* fieldset.plug>div.output.card>div.item { */ +/* width:100%; */ +/* margin:0; */ +/* } */ div.output.card>div.item { /* flex-grow:1; */ position:relative; @@ -630,8 +633,8 @@ fieldset.draw>div.output>div.layout>div.layout>div.profile { width:var(--project fieldset.word>div.output>fieldset.story:not(.full) { margin:var(--title-margin) 0; } fieldset.word>div.output fieldset.story:not(.float):not(.full)>form.option>div.icon.delete { display:none; } fieldset.input.icon div.output td { font-size:28px; padding:var(--input-padding); } +fieldset.status>div.output table.content { width:100%; } fieldset.web.code.git>div.output>fieldset.web.code.inner>div.output { overflow:auto; } -fieldset.web.code.git.status>div.output table.content { width:100%; } fieldset.web.code.git.total.draw div.output { text-align:center; } fieldset.web.code.git.trend>div.output rect { cursor:pointer; } fieldset.web.wiki.draw div.output svg { min-width:100%; min-height:100%; } diff --git a/panel/action.css b/panel/action.css index 0fb2eced..7a5c26d6 100644 --- a/panel/action.css +++ b/panel/action.css @@ -16,10 +16,10 @@ fieldset.Action.free>div.output>fieldset.plugin { position:absolute; } fieldset.Action.free>div.output>fieldset.plugin.select { z-index:10; } fieldset.Action.free>div.output { overflow:hidden; } fieldset.Action.grid>div.output>fieldset.plugin { float:left; } -fieldset.Action.grid>div.output>fieldset.plugin>form.option { display:none; } -fieldset.Action.grid>div.output>fieldset.plugin>div.action { display:none; } +/* fieldset.Action.grid>div.output>fieldset.plugin>form.option { display:none; } */ +/* fieldset.Action.grid>div.output>fieldset.plugin>div.action { display:none; } */ fieldset.Action.grid>div.output>fieldset.plugin>div.status { display:none; } -fieldset.Action.grid>div.output>fieldset.plugin>form.option input[type=text] { width:var(--button-width); } +/* fieldset.Action.grid>div.output>fieldset.plugin>form.option input[type=text] { width:var(--button-width); } */ fieldset.Action>div.toggle.project { padding-top:50px; height:150px; top:30%; } body:not(.mobile) fieldset.Action>div.project.toggle { display:none; } fieldset.Action.tabview>div.project.toggle { display:none; } diff --git a/panel/action.js b/panel/action.js index 26613d82..f308a806 100644 --- a/panel/action.js +++ b/panel/action.js @@ -10,19 +10,22 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg) { var river = can.Conf(chat.R (can.base.beginWith(meta.index, "can.")? []: [river, storm, meta.id||meta.index]).concat(cmds), cb) } sub.onexport.output = function() { can.page.style(can, sub._output, html.MAX_HEIGHT, "") } }) - }, function() { if (can.isCmdMode()) { return } can.user.mod.isCmd = false - can.page.ClassList.del(can, document.body, "cmd") - can.onmotion.delay(can, function() { can.onaction.layout(can), can.onappend.scroll(can, can._output), can.page.style(can, can._output, "visibility", "visible") - can.onexport.layout(can) && list[0] == river && list[1] == storm && can.core.List(can._plugins, function(sub) { sub.Conf(ctx.INDEX) == list[2] && can.onmotion.delay(can, function() { sub._tabs.click() }) }) - }, 300) + }, function() { if (can.isCmdMode()) { return } can.user.mod.isCmd = false, can.page.ClassList.del(can, document.body, "cmd") + can.onmotion.delay(can, function() { + can.onaction.layout(can, list[3]), can.onappend.scroll(can, can._output), can.page.style(can, can._output, "visibility", "visible") + can.onexport.layout(can) && list[0] == river && list[1] == storm && can.core.List(can._plugins, function(sub) { + sub.Conf(ctx.INDEX) == list[2] && can.onmotion.delay(can, function() { sub._tabs.click() }, 0) + }) + }, 0) }) }, _tabs: function(can, sub, meta) { - var tabs = [{view: [html.ITEM, "", meta.name], title: meta.help, onclick: function(event) { can.onmotion.select(can, can._header_tabs, html.DIV_ITEM, sub._header_tabs) + var tabs = [{view: [html.ITEM, "", can.user.trans(can, meta.name, meta.help)], title: meta.help, onclick: function(event) { can.onmotion.select(can, can._header_tabs, html.DIV_ITEM, sub._header_tabs) can.onmotion.select(can, can._action, html.DIV_ITEM, sub._tabs), can.onmotion.select(can, can._output, html.FIELDSET_PLUGIN, sub._target) - if (sub._delay_refresh) { sub._delay_refresh = false, sub.onimport.size(sub, can.ConfHeight()-can.Conf(html.MARGIN_Y), can.ConfWidth()-can.Conf(html.MARGIN_X), can.onexport.isauto(can)) } - can.onexport.layout(can) == FREE || (can._output.scrollTop = sub._target.offsetTop-10) - can.onexport.layout(can) && can.misc.SearchHash(can, can.Conf(chat.RIVER), can.Conf(chat.STORM), meta.index) + var layout = can.onexport.layout(can); + if (sub._delay_refresh || layout == "tabview") { sub._delay_refresh = false, sub.onimport.size(sub, can.ConfHeight()-can.Conf(html.MARGIN_Y), can.ConfWidth()-can.Conf(html.MARGIN_X), can.onexport.isauto(can)) } + layout == FREE || (can._output.scrollTop = sub._target.offsetTop-10) + can.misc.SearchHash(can, can.Conf(chat.RIVER), can.Conf(chat.STORM), meta.index, layout) }, oncontextmenu: sub._legend.onclick}]; sub._header_tabs = can.page.Append(can, can._header_tabs, tabs)._target, sub._tabs = can.page.Append(can, can._action, tabs)._target }, _menu: function(can, msg) { if (can.user.isMobile) { return } @@ -33,14 +36,12 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg) { var river = can.Conf(chat.R Volcanos(chat.ONACTION, {_init: function(can, target) { can.Conf(html.MARGIN_Y, 2*html.PLUGIN_PADDING+2*html.PLUGIN_MARGIN+html.ACTION_HEIGHT) can.Conf(html.MARGIN_X, 2*html.PLUGIN_PADDING+2*html.PLUGIN_MARGIN) + can.onaction.layout(can) can.core.List(["ontouchstart", "ontouchmove", "ontouchend"], function(item) { can.onengine.listen(can, item, function(event, msg) { can.onaction[item](event, can), can.onengine.signal(can, chat.ONACTION_TOUCH, msg) }, target) }) - can.onaction.layout(can) - }, - onsize: function(can, msg, height, width) { - can.Conf({height: can.base.Min(height, 240), width: width}) }, + onsize: function(can, msg, height, width) { can.Conf({height: can.base.Min(height, 240), width: width}) }, onlogin: function(can, msg) { can.Conf(html.MARGIN_Y, 2*html.PLUGIN_PADDING+2*html.PLUGIN_MARGIN+html.ACTION_HEIGHT) can.Conf(html.MARGIN_X, 2*html.PLUGIN_PADDING+2*html.PLUGIN_MARGIN) @@ -73,32 +74,24 @@ Volcanos(chat.ONACTION, {_init: function(can, target) { }) }, _onaction_cmd: function(can) { can.onengine.signal(can, chat.ONACTION_CMD), can.onlayout._init(can) }, - onaction_cmd: function(can, msg) { can.user.mod.isCmd = true - can.page.ClassList.add(can, can._target, can.Mode(chat.CMD)), can.Conf(html.MARGIN_Y, 128), can.Conf(html.MARGIN_X, 0) - }, - onsearch: function(can, msg, arg) { var fields = msg.Option(ice.MSG_FIELDS).split(mdb.FS) - if (arg[0] == mdb.PLUGIN) { can.onexport.plugin(can, msg, arg, fields) } - if (arg[0] == ctx.COMMAND) { can.onexport.command(can, msg, arg, fields) } - }, + onaction_cmd: function(can, msg) { can.user.mod.isCmd = true, can.page.ClassList.add(can, can._target, can.Mode(chat.CMD)), can.Conf(html.MARGIN_Y, 128), can.Conf(html.MARGIN_X, 0) }, + onsearch: function(can, msg, arg) { var fields = msg.Option(ice.MSG_FIELDS).split(mdb.FS); if (arg[0] == mdb.PLUGIN) { can.onexport.plugin(can, msg, arg, fields) } if (arg[0] == ctx.COMMAND) { can.onexport.command(can, msg, arg, fields) } }, onkeydown: function(can, msg, model) { if (can.isCmdMode() && !msg._event.metaKey) { var sub = can._plugins[0].sub; sub && can.core.CallFunc([sub, "onaction.onkeydown"], {event: msg._event, can: sub}); return } if (can.onkeymap.selectCtrlN(msg._event, can, can._action, html.DIV_ITEM)) { return } can._keylist = can.onkeymap._parse(msg._event, can, model, can._keylist||[], can._output) }, onresize: function(can) { can.onaction.layout(can) }, - ontitle: function(can, msg) { can.onlayout._storage(can, "") }, + ontitle: function(can, msg) { + // can.onlayout._storage(can, "") + }, - ontouchstart: function(event, can) { can.touch = can.touch || {} - can.touch.isStart = true, can.touch.startX = event.touches[0].clientX - }, - ontouchmove: function(event, can) { - can.touch.isMove = true, can.touch.distanceX = event.touches[0].clientX - can.touch.startX - }, + ontouchstart: function(event, can) { can.touch = can.touch || {}, can.touch.isStart = true, can.touch.startX = event.touches[0].clientX }, + ontouchmove: function(event, can) { can.touch.isMove = true, can.touch.distanceX = event.touches[0].clientX - can.touch.startX }, ontouchend: function(event, can) { if (can.touch.isMove && Math.abs(can.touch.distanceX) > 50) { if (can.touch.distanceX > 0) { can.onengine.signal(can, "onslideright") } else { can.onengine.signal(can, "onslideleft") } - } - can.touch.isMove = false, can.touch.distanceX = 0, can.touch.isStart = false, can.touch.startX = 0 + } can.touch.isMove = false, can.touch.distanceX = 0, can.touch.isStart = false, can.touch.startX = 0 }, mail: function(can) { can.user.opens("/chat/pod/20230511-golang-story/cmd/web.chat.mail.client") }, @@ -113,31 +106,23 @@ Volcanos(chat.ONACTION, {_init: function(can, target) { can.isCmdMode() || can.core.List(can._plugins, function(sub) { sub._delay_refresh = false }) var cb = can.onlayout[button]; can.base.isFunc(cb) && cb(can) || can.onlayout._plugin(can, button) }, - _menus: [[html.LAYOUT, ice.AUTO, TABS, TABVIEW, HORIZON, VERTICAL, GRID, FREE, FLOW, PAGE], web.DREAM, "desktop", "portal"], - _trans: kit.Dict(web.DREAM, "空间", "portal", "官网", "desktop", "桌面", html.LAYOUT, "布局", ice.AUTO, "默认布局", TABS, "标签布局", TABVIEW, "标签分屏", HORIZON, "左右分屏", VERTICAL, "上下分屏", GRID, "网格布局", FREE, "自由布局", FLOW, "流动布局", PAGE, "网页布局"), + _menus: [[html.LAYOUT, ice.AUTO, TABS, TABVIEW, HORIZON, VERTICAL, GRID, FREE, FLOW, PAGE], web.DREAM, web.DESKTOP, web.PORTAL], + _trans: kit.Dict(web.DREAM, "空间", web.DESKTOP, "桌面", web.PORTAL, "官网", html.LAYOUT, "布局", ice.AUTO, "默认布局", TABS, "标签布局", TABVIEW, "标签分屏", HORIZON, "左右分屏", VERTICAL, "上下分屏", GRID, "网格布局", FREE, "自由布局", FLOW, "流动布局", PAGE, "网页布局"), }) Volcanos(chat.ONLAYOUT, { - tabs: function(can) { can.getActionSize(function(height, width) { can.ConfHeight(height+html.ACTION_HEIGHT), can.ConfWidth(width) }) + tabs: function(can) { + can.getActionSize(function(height, width) { can.ConfHeight(height+html.ACTION_HEIGHT), can.ConfWidth(width) }) can.core.List(can._plugins, function(sub) { sub._delay_refresh = true }) can.onmotion.select(can, can._action, html.DIV_ITEM, can.onmotion.select(can, can._action, html.DIV_ITEM)||0, function(target) { target.click() }); return true }, - tabview: function(can) { can.getActionSize(function(height, width) { can.ConfHeight(height+html.ACTION_HEIGHT), can.ConfWidth(width) }) + tabview: function(can) { can.onmotion.toggle(can, can._header_tabs, true) + can.getActionSize(function(height, width) { can.ConfHeight(height+html.ACTION_HEIGHT), can.ConfWidth(width) }) can.core.List(can._plugins, function(sub) { sub._delay_refresh = true }) - can.onmotion.toggle(can, can._header_tabs, true) can.onmotion.select(can, can._action, html.DIV_ITEM, can.onmotion.select(can, can._action, html.DIV_TABS)||0, function(target) { target.click() }); return true }, - horizon: function(can) { - can.getActionSize(function(height, width) { can.ConfHeight(height), can.ConfWidth(width/2) }) - can.onmotion.toggle(can, can._header_tabs, true) - }, - vertical: function(can) { - can.getActionSize(function(height, width) { can.ConfHeight(height/2), can.ConfWidth(width) }) - can.onmotion.toggle(can, can._header_tabs, true) - }, - grid: function(can) { - can.getActionSize(function(height, width) { var m = can.user.isMobile? 1: 2, n = 2, h = height/n, w = width/m; can.ConfHeight(h+html.ACTION_HEIGHT), can.ConfWidth(w) }) - can.onmotion.toggle(can, can._header_tabs, true) - }, + horizon: function(can) { can.getActionSize(function(height, width) { can.ConfHeight(height), can.ConfWidth(width/2) }) }, + vertical: function(can) { can.getActionSize(function(height, width) { can.ConfHeight(height/2), can.ConfWidth(width) }) }, + grid: function(can) { can.getActionSize(function(height, width) { var m = can.user.isMobile? 1: 2, n = 2, h = height/n, w = width/m; can.ConfHeight(h+html.ACTION_HEIGHT), can.ConfWidth(w) }) }, free: function(can) { can.getActionSize(function(height, width) { can.ConfHeight(height*3/4), can.ConfWidth(width*3/4) can.core.List(can._plugins, function(sub, index, array) { can.onmotion.move(can, sub._target, {left: (width/array.length/8*5+20)*index, top: (height/array.length/8*5)*index}) }), can.onmotion.toggle(can, can._header_tabs, true) }) }, diff --git a/panel/header.css b/panel/header.css index ccf2610a..217e00f4 100644 --- a/panel/header.css +++ b/panel/header.css @@ -2,6 +2,12 @@ fieldset.Header>div.output { line-height:21px; height:var(--header-height); over fieldset.Header>div.output div.item { background-color:var(--panel-output-bg-color); padding:13.5px; height:var(--header-height); float:left; } fieldset.Header>div.output div.item.title:first-child { font-size:var(--legend-font-size); font-style:italic; font-weight:bold; white-space:pre; overflow:hidden; } fieldset.Header>div.output div.item.title img { height:var(--action-height); width:var(--action-height); } +fieldset.Header>div.output div.item.layout>i { margin-left:var(--input-padding); } +fieldset.Header>div.output div.item.layout:not(:hover)>i { visibility:hidden; } +fieldset.Header>div.output div.item.layout { padding-right:0; } +fieldset.Header>div.output div.item.usernick>i { margin-left:var(--input-padding); } +fieldset.Header>div.output div.item.usernick:not(:hover)>i { visibility:hidden; } +fieldset.Header>div.output div.item.usernick { padding-right:0; } fieldset.Header>div.output div.item.theme { user-select:none; } fieldset.Header>div.output div.item.theme>i { margin-right:0; } fieldset.Header>div.output div.item.theme>i:last-child { color:var(--disable-fg-color); } @@ -19,3 +25,8 @@ fieldset.Header>div.output div.search>input { padding-left:25px; } fieldset.Header>div.output div.search>span.icon { padding:var(--input-padding) var(--button-padding); } body:not(.mobile) fieldset.Header>div.output div.title:first-child { width:var(--river-width); } body:not(.mobile) fieldset.Header>div.output div.title img { margin-right:var(--button-margin); } +body:not(.width6) fieldset.Header.tabview>div.output>div.Action>div.item.dream { display:none; } +body:not(.width6) fieldset.Header.tabview>div.output>div.Action>div.item.desktop { display:none; } +body:not(.width6) fieldset.Header.tabview>div.output>div.Action>div.item.portal { display:none; } +body:not(.width6) fieldset.Header.tabview>div.output>div.item.language { display:none; } +/* body:not(.width6) fieldset.Header.tabview>div.output>div.item.qrcode { display:none; } */ diff --git a/panel/header.js b/panel/header.js index ba269b78..1f6d0d7b 100644 --- a/panel/header.js +++ b/panel/header.js @@ -9,10 +9,11 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.page.Append(can, target, [{view: [[html.ITEM, chat.STATE, item], "", can.Conf(item)||msg.Option(item)||""], onclick: function(event) { can.core.CallFunc([can.onaction, item], [event, can, item]) }, _init: function(target) { item == mdb.TIME && can.onimport._time(can, target) - item == aaa.AVATAR && can.page.Append(can, target, [{img: lex.SP}]) - item == aaa.LANGUAGE && can.page.Append(can, target, [{text: "EN"}, {text: " / "}, {text: "中"}]) - item == chat.THEME && can.page.Append(can, target, [{icon: icon.SUN}, {text: " / "}, {icon: icon.MOON}]) - item == cli.QRCODE && can.page.Append(can, target, [{icon: icon.qrcode}]) + item == aaa.AVATAR && can.page.Appends(can, target, [{img: lex.SP}]) + item == aaa.USERNICK && can.page.Appends(can, target, [{text: can.Conf(aaa.USERNICK)}, {icon: icon.CHEVRON_DOWN}]) + item == aaa.LANGUAGE && can.page.Appends(can, target, [{text: "EN"}, {text: " / "}, {text: "中"}]) + item == chat.THEME && can.page.Appends(can, target, [{icon: icon.SUN}, {text: " / "}, {icon: icon.MOON}]) + item == cli.QRCODE && can.page.Appends(can, target, [{icon: icon.qrcode, title: can.user.trans(can, cli.QRCODE)}]) }}]) }) }, _language: function(can) { can.page.Select(can, can._output, "div.item.language", function(target) { @@ -56,8 +57,8 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { }, menu: function(can, cmds, cb, trans) { can.base.isString(cmds) && (cmds = [cmds]) return can.page.Append(can, can._output, [{view: cmds[0], list: can.core.List(can.base.getValid(cmds.slice(1), [cmds[0]]), function(item) { - return can.base.isString(item)? /* 1.string */ {view: [[html.ITEM, html.MENU], "", can.user.trans(can, item, trans)], onclick: function(event) { can.base.isFunc(cb) && cb(event, item, [item]) }}: - can.base.isArray(item)? /* 2.array */ {view: [[html.ITEM, html.MENU], "", can.user.trans(can, item[0], trans)], onclick: function(event) { can.onkeymap.prevent(event) + return can.base.isString(item)? /* 1.string */ {view: [[html.ITEM, html.MENU, item], "", can.user.trans(can, item, trans)], onclick: function(event) { can.base.isFunc(cb) && cb(event, item, [item]) }}: + can.base.isArray(item)? /* 2.array */ {view: [[html.ITEM, html.MENU, item[0]]], list: [{text: can.user.trans(can, item[0], trans)}, {icon: icon.CHEVRON_DOWN}], onclick: function(event) { can.onkeymap.prevent(event) can.onaction.carte(can.request(event, {_style: "header "+item[0]}), can, item.slice(1), function(event, button, meta) { can.base.isFunc(cb) && cb(event, button, item) }, trans) }}: /* 3.others */ item }) }])._target @@ -100,6 +101,9 @@ Volcanos(chat.ONACTION, {_init: function(can) {}, onstorm_select: function(can, river, storm) { can.Conf(chat.RIVER, river), can.Conf(chat.STORM, storm) }, onaction_cmd: function(can) { can.onappend.style(can, html.HIDE), can.onmotion.delay(can, function() { can.onimport._const(can) }) }, onsearch_focus: function(can) { can._search && can._search.focus() }, + onlayout: function(can, layout, before) { if (can.user.isMobile) { return } + can.page.ClassList.del(can, can._target, before), can.page.ClassList.add(can, can._target, layout) + }, onshare: function(can, msg, args) { can.user.share(can, msg, [ctx.ACTION, chat.SHARE].concat(args||[])) }, onwebpack: function(can, msg) { can.user.input(msg._event, can, [{name: mdb.NAME, value: can.user.title()}], function(data) { can.core.Item(Volcanos.meta.pack, function(key, msg) { can.core.List(["_event", "_can", "_xhr", ""], function(key) { delete(msg[key]) }) }) diff --git a/panel/river.js b/panel/river.js index 61e3e965..d777c0e5 100644 --- a/panel/river.js +++ b/panel/river.js @@ -75,9 +75,10 @@ Volcanos(chat.ONACTION, {list: [mdb.CREATE, web.SHARE, web.REFRESH], _init: func }) }])._target, next && can._output.insertBefore(list, next), can.ui.sublist[river] = list, _menu(list), list.children.length > 0 && list.children[select].click() }) }, - action: function(event, can, river, storm) { can.misc.SearchHash(can, river, storm) + action: function(event, can, river, storm) { can.page.Select(can, can._output, [html.DIV_LIST, html.DIV_ITEM], function(target) { can.page.ClassList.del(can, target, html.SELECT) }) can.onmotion.select(can, can.ui.sublist[river], html.DIV_ITEM, can.ui.storm_list[can.core.Keys(river, storm)]) + can.onmotion.select(can, can._output, html.DIV_ITEM, can.ui.river_list[river]) can.onengine.signal(can, chat.ONSTORM_SELECT, can.request(event, {river: can.Conf(chat.RIVER, river), storm: can.Conf(chat.STORM, storm)})) }, carte: function(event, can, list, river, storm) { can.onkeymap.prevent(event); if (can.core.Value(can._root, can.core.Keys(chat.RIVER, river))) { return } diff --git a/plugin/local/code/inner.css b/plugin/local/code/inner.css index 8284a78c..aab367c5 100644 --- a/plugin/local/code/inner.css +++ b/plugin/local/code/inner.css @@ -10,12 +10,17 @@ fieldset.inner>div.output div.content td.text span.package { color:var(--code-pa fieldset.inner>div.output>div.project div.zone div.action:not(.hide) { width:100%; } fieldset.inner>div.output>div.project div.zone div.action>div.item { padding-right:0; width:100%; overflow:hidden; } fieldset.inner>div.output>div.project div.zone div.action>div.item>input { padding-left:25px; width:100%; } +fieldset.inner>div.output>div.project div.zone.space>div.list div.output>div.item { margin:var(--input-margin) 0; width:calc(100% - 5px); } +fieldset.inner>div.output>div.project div.zone.space>div.list div.output>div.item:hover { background-color:var(--hover-bg-color); } +fieldset.inner>div.output>div.project div.zone.repos>div.list div.output>div.item { margin:0; width:100% !important; } +fieldset.inner>div.output>div.project div.zone.repos>div.list div.output>div.item:hover { background-color:var(--hover-bg-color); } fieldset.inner>div.output>div.layout>div.tabs { font-size:var(--code-font-size); display:none; } fieldset.inner>div.output>div.layout>div.tabs>div.tabs>div.tabs { padding-right:0; margin-left:5px; } fieldset.inner>div.output>div.layout>div.tabs>div.tabs>div.tabs:hover { background-color:var(--output-bg-color); border-top-left-radius:var(--plugin-radius); border-top-right-radius:var(--plugin-radius); box-shadow:var(--box-shadow); } fieldset.inner>div.output>div.layout>div.tabs>div.tabs>div.tabs.select { background-color:var(--output-bg-color); border-top-left-radius:var(--plugin-radius); border-top-right-radius:var(--plugin-radius); border-bottom:lightgray solid 2px; box-shadow:var(--box-shadow);} fieldset.inner>div.output>div.layout>div.path { font-size:var(--code-font-size); display:none; } fieldset.inner.float>div.output>div.layout>div.path { font-size:var(--code-font-size); display:flex; } +fieldset.Action.tabview fieldset.inner>div.output>div.layout>div.path { font-size:var(--code-font-size); display:flex; } fieldset.inner>div.output>div.layout>div.display h1 { border-bottom:var(--box-border); margin:var(--title-margin) 0; } fieldset.inner>div.output>div.layout>div.display h2 { border-bottom:var(--box-border); margin:var(--title-margin) 0; } fieldset.inner>div.output>div.layout>div.display pre>code { padding-left:var(--table-padding); border-left:var(--code-border-color) solid 5px; display:block; } diff --git a/plugin/local/code/vimer.js b/plugin/local/code/vimer.js index 882f3772..0b606c8f 100644 --- a/plugin/local/code/vimer.js +++ b/plugin/local/code/vimer.js @@ -43,10 +43,7 @@ Volcanos(chat.ONFIGURE, { }); cache = can.onimport.tree(can, list, nfs.PATH, nfs.PS, function(event, item) { can.onimport.tabview(can, path, item.path) }, target, cache) }, true) } if (path.length == 1) { return show(target, zone, path[0]) } can.page.Remove(can, zone._action) can.onimport.zone(can, can.core.List(path, function(path) { return kit.Dict(mdb.NAME, path, path == args[0]? chat._INIT: chat._DELAY_INIT, function(target, zone) { - show(target, zone, path) - zone._toggle = function() { - zone._layout() - } + show(target, zone, path), zone._toggle = function() { zone._layout() } }) }), target) }, space: function(can, target, zone) { can.onimport._zone(can, zone, web.DREAM, function(sub, msg) { @@ -58,7 +55,7 @@ Volcanos(chat.ONFIGURE, { can.page.Select(can, sub._output, html.DIV_ITEM, function(target, index) { can.onappend.style(can, msg.status[index], target) }) }), zone.toggle(false) }, repos: function(can, target, zone) { can.onimport._zone(can, zone, {index: web.CODE_GIT_SEARCH, style: html.OUTPUT, mode: mdb.ZONE}, function(sub, msg) { - sub.onexport.record = function(sub, value, key, data) { can.user.opens(data.html_url) } + sub.onexport.record = function(sub, value, key, data) { can.onimport.tabview(can, "", [web.CODE_GIT_SEARCH, value].join(","), ctx.INDEX) } }), zone.toggle(false) }, }) Volcanos(chat.ONACTION, {list: ["创建", "编译", "源码", "计划", "流程", "文档", "后台", "桌面", "官网"], _trans: {show: "预览", exec: "展示"}, diff --git a/plugin/state.js b/plugin/state.js index 0efb95a8..c03af678 100644 --- a/plugin/state.js +++ b/plugin/state.js @@ -14,7 +14,7 @@ Volcanos(chat.ONIMPORT, { _field: function(can, msg, cb) { var height = can.base.Max(html.STORY_HEIGHT, can.ConfHeight()), width = can.ConfWidth() msg.Table(function(item) { can.onappend._plugin(can, item, {_space: can.ConfSpace(), index: item.index, args: can.base.Obj(item.args||item.arg, []), height: height, width: width}, function(sub) { if (can.base.isIn(sub.ConfIndex(), - web.WIKI_PORTAL, web.CHAT_IFRAME, web.CHAT_MACOS_DESKTOP, web.CODE_VIMER, + web.WIKI_PORTAL, web.CHAT_IFRAME, web.CHAT_MACOS_DESKTOP, web.WIKI_WORD, web.CODE_VIMER, )) { height = can.base.Max(can.base.Min(can.onexport.outputHeight(can), 480), can.ConfHeight()) } can.onmotion.delay(can, function() { can.onmotion.scrollIntoView(can, sub._target) }, 300) sub.run = function(event, cmds, cb) { var index = msg.Option(ice.MSG_INDEX) diff --git a/plugin/table.js b/plugin/table.js index b5e42837..4b5ee8c3 100644 --- a/plugin/table.js +++ b/plugin/table.js @@ -214,7 +214,12 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { }, }) Volcanos(chat.ONLAYOUT, { - _init: function(can, height, width) { can.core.CallFunc([can.onimport, html.LAYOUT], {can: can, height: height, width: width}) }, + _init: function(can, height, width) { + can.core.CallFunc([can.onimport, html.LAYOUT], {can: can, height: height, width: width}) + can.page.SelectChild(can, can._output, html.TABLE, function(table) { + (can.isCmdMode() || table.offsetWidth > can.ConfWidth() / 2) && can.onappend.style(can, "full", table) + }) + }, zone: function(can, height, width) { can.onlayout._init(can, height, width) }, result: function(can, height, width) { can.onlayout._init(can, height, width) }, simple: function(can, height, width) { can.onlayout._init(can, height, width) },