diff --git a/frame.js b/frame.js index 0544ee47..439994a5 100644 --- a/frame.js +++ b/frame.js @@ -1,23 +1,6 @@ Volcanos(chat.ONENGINE, {_init: function(can, meta, list, cb, target) { can.require([can.volcano], null, function(can, key, sub) { can[key] = sub }) if (!can.user.isMailMaster) { if (can.misc.Search(can, ice.MSG_SESSID)) { can.misc.CookieSessid(can, can.misc.Search(can, ice.MSG_SESSID)); return can.misc.Search(can, ice.MSG_SESSID, "") } } can.user.title(can.misc.SearchOrConf(can, chat.TITLE)||can.misc.Search(can, ice.POD)||location.host) - can.page.Append(can, document.head, ctx.STYLE, {"innerText": ` - body, fieldset { border:0; margin:0; overflow:hidden; } - fieldset>legend { float:left; } - fieldset>form.option { float:left; } - fieldset>div.action { float:left; } - fieldset>div.output { clear:both; } - fieldset>form.option>div.item { float:left; } - fieldset>div.action>div.item { float:left; } - fieldset>div.status>div.item { float:left; } - fieldset.Action>legend { display:none; } - div.float, fieldset.float { position:fixed; } - div.input.float div.action>div.item { float:right; } - div.item, fieldset>legend { cursor:pointer; } - .hide { display:none; } -`}) - can.onappend.theme(can, html.DARK), can.onappend.theme(can, html.LIGHT, {panel: cli.WHITE, plugin: cli.ALICEBLUE, legend: "lightsteelblue", input: cli.WHITE, output: cli.WHITE, table: cli.ALICEBLUE, - hover: cli.ALICEBLUE, border: cli.TRANSPARENT, label: cli.BLACK, text: cli.BLACK, info: cli.BLUE, warn: cli.RED}) can.run = function(event, cmds, cb) { var msg = can.request(event); cmds = cmds||[]; return (can.onengine[cmds[0]]||can.onengine._remote)(event, can, msg, can, cmds, cb) } can.core.Next(list, function(item, next) { item.type = chat.PANEL can.onappend._init(can, can.base.Copy(item, can.core.Value(can, [chat.RIVER, item.name])), item.list, function(sub) { can[item.name] = sub @@ -216,7 +199,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { var action = meta.feature[cmds[1]]; if (can.base.isFunc(action)) { cb = cb||function() { can.Update() } return action.list && action.list.length > 0? can.user.input(event, can, action.list, function(data) { can.core.CallFunc(action, {can: can, msg: can.request(event, data), arg: cmds.slice(2), cb: cb}) - }): can.core.CallFunc(action, {can: can, msg: can.request(event), arg: cmds.slice(2), cb: cb}) + }): can.core.CallFunc(action, {sup: meta.can, can: can, msg: can.request(event), arg: cmds.slice(2), cb: cb}) } return can.user.input(event, can, meta.feature[cmds[1]], function(args) { can.Update(can.request(event, {_handle: ice.TRUE}, can.Option()), cmds.slice(0, 2).concat(args), cb) }) } return can.onengine._plugin(event, can, msg, can, cmds, cb) || can.run(event, cmds, function(msg) { @@ -255,7 +238,6 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { ], onclick: function(event) { can.user.copy(event, can, item.value) }}]) }) }, - theme: function(can, theme, color, style, list) { const PANEL_STYLE = "panel-style", PLUGIN_STYLE = "plugin-style" const LEGEND_STYLE = "legend-style", INPUT_STYLE = "input-style", INPUT_HOVER_STYLE = "input-hover-style", OUTPUT_STYLE = "output-style", GLASS_STYLE = "glass-style" const TABLE_HEAD_STYLE = "table-head-style", TABLE_HEAD_HOVER_STYLE = "table-head-hover-style", TABLE_ROW_HOVER_STYLE = "table-row-hover-style", TABLE_CELL_HOVER_STYLE = "table-cell-hover-style" @@ -328,7 +310,10 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { return (item.style? (pre+ice.SP+type+" { "+(can.base.isArray(item.style)? can.core.List(item.style, function(item) { return can.core.Item(style[item], function(key, value) { return key&&value? key+DF+value: undefined }).join(FS) }).join(FS): can.core.Item(can.base.Obj(item.style), function(key, value) { return key+DF+value }).join(FS))+" }"): "")+(item.list? render(pre+ice.SP+type, item.list): "") - }).join(ice.NL) } can.page.Append(can, document.head, ctx.STYLE, {"innerText": render(html.BODY+ice.PT+theme, list)}) + }).join(ice.NL) } + var text = render(html.BODY+ice.PT+theme, list) + can.page.Append(can, document.head, ctx.STYLE, {"innerText": text}) + return text }, style: function(can, style, target) { target = target||can._fields||can._target if (can.base.endWith(style, ".css")) { return can.require([style]) } diff --git a/lib/page.js b/lib/page.js index 1d11fbad..919e6f47 100644 --- a/lib/page.js +++ b/lib/page.js @@ -291,7 +291,7 @@ Volcanos("page", { requireModules: function(can, libs, cb, cbs) { for (var i = 0; i < libs.length; i++) { if (libs[i].indexOf(ice.PS) == 0 || libs[i].indexOf(ice.HTTP) == 0) { continue } if (libs[i].indexOf(nfs._CSS) == -1 && libs[i].indexOf(nfs._JS) == -1) { libs[i] = libs[i]+"/lib/"+libs[i]+nfs._JS } - libs[i] = "/require/node_modules/"+libs[i] + libs[i] = "/require/modules/"+libs[i] } can.require(libs, cb, cbs) }, requireDraw: function(can, cb) { can.page.ClassList.add(can, can._fields, "draw") diff --git a/page/index.html b/page/index.html deleted file mode 100644 index 4230b8df..00000000 --- a/page/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - volcanos - - - - - - - - - diff --git a/page/index.js b/page/index.js deleted file mode 100644 index 18914668..00000000 --- a/page/index.js +++ /dev/null @@ -1,61 +0,0 @@ -Volcanos({name: "chat", river: { - product: {name: "产品群", storm: { - office: {name: "办公 office", list: [ - {name: "feel", help: "影音媒体", index: "web.wiki.feel"}, - {name: "draw", help: "思维导图", index: "web.wiki.draw"}, - {name: "data", help: "数据表格", index: "web.wiki.data"}, - {name: "location", help: "地图导航", index: "web.chat.location"}, - {name: "context", help: "编程", index: "web.wiki.word", args: ["src/main.shy"]}, - ]}, - website: {name: "定制 website", index: [ - "web.chat.website", - "web.chat.div", - "web.code.vimer", - "web.dream", - ]}, - }}, - project: {name: "研发群", storm: { - studio: {name: "研发 studio", list: [ - {name: "vimer", help: "编辑器", index: "web.code.vimer"}, - {name: "repos", help: "代码库", index: "web.code.git.status"}, - {name: "plan", help: "任务表", index: "web.team.plan"}, - {name: "todo", help: "待办项", index: "web.team.todo"}, - {name: "ctx", help: "上下文", index: "web.wiki.word"}, - ]}, - }}, - profile: {name: "测试群", storm: { - release: {name: "发布 release", index: [ - "web.code.install", - "web.code.upgrade", - "web.code.webpack", - "web.code.binpack", - "web.code.autogen", - "web.code.compile", - "web.code.publish", - "web.code.git.server", - "web.code.git.status", - ]}, - research: {name: "测试 research", index: [ - "web.code.favor", - "web.code.bench", - "web.code.pprof", - "web.code.xterm", - "web.code.case", - ]}, - }}, - operate: {name: "运维群", storm: { - aaa: {name: "权限 aaa", index: [ - "user", "totp", "sess", "role", - ]}, - web: {name: "应用 web", index: [ - "broad", "serve", "space", "dream", "route", - "share", "spide", "cache", "story", - ]}, - cli: {name: "系统 cli", index: [ - "qrcode", "daemon", "system", "runtime", "mirrors", "forever", "port", - ]}, - nfs: {name: "文件 nfs", index: [ - "cat", "dir", "pack", "tail", "trash", - ]}, - }}, -}}) diff --git a/panel/header.js b/panel/header.js index 0c400f30..4284b93b 100644 --- a/panel/header.js +++ b/panel/header.js @@ -45,6 +45,27 @@ Volcanos(chat.ONACTION, {_init: function(can) { var themeMedia = window.matchMed can.__theme = themeMedia.matches? html.DARK: html.LIGHT, themeMedia.addListener(function(event) { can.__theme = event.matches? html.DARK: html.LIGHT can.onengine.signal(can, chat.ONTHEMECHANGE, can.request(event, {theme: can.__theme})) }), can.onimport.theme(can) + false && can.page.Append(can, document.head, ctx.STYLE, {"innerText": ` + body, fieldset { border:0; margin:0; overflow:hidden; } + fieldset>legend { float:left; } + fieldset>form.option { float:left; } + fieldset>div.action { float:left; } + fieldset>div.output { clear:both; } + fieldset>form.option>div.item { float:left; } + fieldset>div.action>div.item { float:left; } + fieldset>div.status>div.item { float:left; } + fieldset.Action>legend { display:none; } + div.float, fieldset.float { position:fixed; } + div.input.float div.action>div.item { float:right; } + div.item, fieldset>legend { cursor:pointer; } + .hide { display:none; } +`}) + return can.require(["src/template/web.chat.header/dark.css", "src/template/web.chat.header/light.css"]) + can._themes = { + "dark": can.onappend.theme(can, html.DARK), + "light": can.onappend.theme(can, html.LIGHT, {panel: cli.WHITE, plugin: cli.ALICEBLUE, legend: "lightsteelblue", input: cli.WHITE, output: cli.WHITE, table: cli.ALICEBLUE, + hover: cli.ALICEBLUE, border: cli.TRANSPARENT, label: cli.BLACK, text: cli.BLACK, info: cli.BLUE, warn: cli.RED}), + } }, onsize: function(can) { can.ConfHeight(can._target.offsetHeight), can.ConfWidth(can._target.offsetWidth) }, onmain: function(can) { @@ -141,7 +162,12 @@ Volcanos(chat.ONPLUGIN, { background: shy("背景图片", function(can, sub, cb) { can.page.Append(can, sub._output, [{img: can.user.info.background, style: kit.Dict(html.MAX_HEIGHT, sub.ConfHeight(), html.MAX_WIDTH, sub.ConfWidth())}]) }), language: shy("语言地区", {_init: function(can) { can.Option(aaa.LANGUAGE, can.user.info.language||ice.AUTO) }}, ["language:select=auto,zh,en", ice.RUN], function(can, msg, arg) { can.onimport.language(can, arg[0]) }), title: shy("网页标题", [chat.TITLE], function(can, msg, arg) { msg.Echo(can.user.title(arg[0])) }), - theme: shy("界面主题", {_init: function(can) { can.Option(chat.THEME, can.getHeader(chat.THEME)) }}, ["theme:select=auto,dark,light,print,white,black", ice.RUN], function(can, msg, arg) { + theme: shy("界面主题", { + _init: function(can) { can.Option(chat.THEME, can.getHeader(chat.THEME)) }, + save: function(can, sup) { + can.user.downloads(can, sup._themes[can.Option("theme")], can.Option("theme"), "css") + }, + }, ["theme:select=auto,dark,light,print,white,black", ice.RUN, nfs.SAVE], function(can, msg, arg) { if (arg[0] == ice.AUTO) { arg[0] = "", can._theme = "" } can.misc.localStorage(can, "can.theme", arg[0]), can.onimport.theme(can, arg[0]) }), logout: shy("退出登录", kit.Dict(aaa.LOGOUT, shy("退出", function(can) { can.user.logout(can._root.Header) })), [aaa.LOGOUT]), diff --git a/plugin/story/spide.js b/plugin/story/spide.js index 7b344da7..228df971 100644 --- a/plugin/story/spide.js +++ b/plugin/story/spide.js @@ -36,7 +36,7 @@ Volcanos(chat.ONACTION, {list: [[ice.VIEW, "横向", "纵向"], [html.SIZE, 24, can.onaction._draw_vertical(can, can._tree[can.dir_root], can.margin, can.margin+(can.size+can.margin)/2) }, _draw: function(can, tree, x, y, style) { var color = can.onimport._color(can, tree) - tree.view = can.onimport.draw(can, {shape: html.TEXT, points: [{x: x, y: y}], style: can.base.Copy(kit.Dict(svg.STROKE, color, svg.FILL, color, html.INNER, tree.name), style)}) + tree.view = can.onimport.draw(can, {shape: html.TEXT, points: [{x: x, y: y}], style: can.base.Copy(kit.Dict(svg.STROKE, color, svg.FILL, color, html.INNER, tree.name||" "), style)}) return can.core.ItemCB(can.ondetail, tree.view, can, tree), tree.view }, _draw_vertical: function(can, tree, x, y) {