From e8c68bac4b98bed4e65e3c38e5f4930094785881 Mon Sep 17 00:00:00 2001 From: shy Date: Tue, 5 Mar 2024 16:49:47 +0800 Subject: [PATCH] add some --- base/web/html/html.go | 24 +++++++++++++----------- core/chat/message.css | 4 ++-- core/wiki/portal.css | 9 +++++++-- core/wiki/spark.go | 38 +++++++++++++++++++++++++++++++++++--- core/wiki/style.go | 5 +++++ 5 files changed, 62 insertions(+), 18 deletions(-) diff --git a/base/web/html/html.go b/base/web/html/html.go index 346742ff..ae90738a 100644 --- a/base/web/html/html.go +++ b/base/web/html/html.go @@ -84,17 +84,19 @@ const ( REFRESH = "refresh" CONFIRM = "confirm" - PLUGIN_STORY_JSON = "/plugin/story/json.js" - ICONS_MAIL = "usr/icons/Mail.png" - ICONS_DREAM = "usr/icons/Launchpad.png" - ICONS_SETTINGS = "usr/icons/System Settings.png" - GetLocation = "getLocation" - ConnectWifi = "ConnectWifi" - GetClipboardData = "getClipboardData" - ScanQRCode = "scanQRCode" - ChooseImage = "chooseImage" - Record1 = "record1" - Record2 = "record2" + PLUGIN_LOCAL_CODE_INNER = "/plugin/local/code/inner.js" + PLUGIN_STORY_JSON = "/plugin/story/json.js" + + ICONS_MAIL = "usr/icons/Mail.png" + ICONS_DREAM = "usr/icons/Launchpad.png" + ICONS_SETTINGS = "usr/icons/System Settings.png" + GetLocation = "getLocation" + ConnectWifi = "ConnectWifi" + GetClipboardData = "getClipboardData" + ScanQRCode = "scanQRCode" + ChooseImage = "chooseImage" + Record1 = "record1" + Record2 = "record2" ) func IsImage(name, mime string) bool { diff --git a/core/chat/message.css b/core/chat/message.css index 895832ab..92ab3893 100644 --- a/core/chat/message.css +++ b/core/chat/message.css @@ -1,7 +1,7 @@ body.light fieldset.web.chat.message>div.output { background-color:white; } body.light fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list { background-color:#e3e3e2; } body.light fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list>div.item:not(.plug).send div.content { background-color:#94ec69; } -fieldset.web.chat.message>div.output>div.project { width:260px; flex:0 0 260px; } +// fieldset.web.chat.message>div.output>div.project { width:260px; flex:0 0 260px; } fieldset.web.chat.message>div.output>div.project>div.title { background-color:var(--plugin-bg-color); padding:var(--button-padding); display:flex; justify-content:space-between; position:sticky; top:0; z-index:2; } fieldset.web.chat.message>div.output>div.project>div.title i:hover { background-color:var(--hover-bg-color); cursor:pointer; } fieldset.web.chat.message>div.output>div.project>div.title span:hover { background-color:var(--hover-bg-color); cursor:pointer; } @@ -24,7 +24,7 @@ fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list> fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list>div.item:hover { background-color:unset; } fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list>div.item.time { color:var(--disable-fg-color); font-size:var(--status-font-size); padding:0; margin-top:var(--button-margin); height:fit-content; justify-content:center; } fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list>div.item>img { height:var(--header-height); width:var(--header-height); } -fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list>div.item div.content img { max-width:256px; } +fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list>div.item div.content img { max-width:var(--form-width); } fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list>div.item div.container { width:fit-content; max-width:calc(100% - var(--header-height)); margin:0 var(--button-margin); } fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list>div.item div.container>span.from { color:var(--disable-fg-color); font-size:var(--status-font-size); padding:0 var(--input-padding); } fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list>div.item.send div.container>span.from { float:right; } diff --git a/core/wiki/portal.css b/core/wiki/portal.css index 0aa27e20..c3eab1f0 100644 --- a/core/wiki/portal.css +++ b/core/wiki/portal.css @@ -11,7 +11,9 @@ fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] { -- fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] { display:flex; justify-content:center; } fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item { text-align:center; padding:var(--legend-padding); height:var(--portal-header-height); } fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item { display:flex; align-items:center; } -fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item:first-child { line-height:calc(var(--portal-header-height) - 2 * var(--legend-padding)); font-size:24px; } +fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item:first-child { + line-height:calc(var(--portal-header-height) - 2 * var(--legend-padding)); + font-size:24px; font-weight:bold; font-style:italic; } fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item.select { background-color:var(--output-bg-color); } fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item:hover { background-color:var(--output-bg-color); } fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item.space { padding:0px; margin:0 var(--portal-main-padding); } @@ -26,10 +28,11 @@ fieldset.web.wiki.portal>div.output>div.layout>div.aside div.item.section { padd fieldset.web.wiki.portal>div.output>div.layout>div.main { padding:var(--portal-main-padding); height:600px; min-width:390px; max-width:var(--portal-max-width); overflow:auto; overflow-x:hidden; } fieldset.web.wiki.portal>div.output>div.layout>div.main div.story.column { display:flex; flex-direction:column; justify-content:center; } fieldset.web.wiki.portal>div.output>div.layout>div.main div.story.column fieldset.inner>div.output>div.layout>div.layout div.content div.tips { top:10px; right:10px; } -fieldset.web.wiki.portal>div.output>div.layout>div.main div.story.column h1 { font-size:48px; } +fieldset.web.wiki.portal>div.output>div.layout>div.main div.story.column h1 { font-size:48px; font-style:italic; margin-top:0; } fieldset.web.wiki.portal>div.output>div.layout>div.main div.story.column h2 { margin:0 !important; } fieldset.web.wiki.portal>div.output>div.layout>div.main div.story.column b { font-size:22px; } fieldset.web.wiki.portal>div.output>div.layout>div.main div.story.column input[type=button] { background-color:var(--notice-bg-color); color:var(--notice-fg-color); } +fieldset.web.wiki.portal>div.output>div.layout>div.main div.story.column input[type=button]:hover { background-color:var(--hover-bg-color); box-shadow:var(--notice-box-shadow); } fieldset.web.wiki.portal>div.output>div.layout>div.main fieldset.inner.output div.content { background-color:var(--code-bg-color); color:var(--code-fg-color); padding:var(--input-padding) 0; --code-comment:silver; --code-keyword:orange; @@ -38,9 +41,11 @@ fieldset.web.wiki.portal>div.output>div.layout>div.main fieldset.inner.output di } fieldset.web.wiki.portal>div.output>div.layout>div.main div.story[data-type=spark][data-name=shell] { background-color:var(--code-bg-color); color:var(--code-fg-color); padding:var(--button-padding) var(--input-padding); margin:var(--plugin-margin) 0; box-shadow:var(--box-shadow); + margin:10px 0; } fieldset.web.wiki.portal>div.output>div.layout>div.main table.content div.story[data-type=spark][data-name=shell] { margin-top:unset; } fieldset.web.wiki.portal.home>div.output>div.layout>div.main p { white-space:pre-wrap; text-align:center; } +fieldset.web.wiki.portal.home>div.output>div.layout>div.main p:hover { background-color:var(--hover-bg-color); color:var(--hover-fg-color); } body.dark fieldset.web.wiki.portal>div.output>div.layout { background-color:var(--plugin-bg-color); --code-bg-color:var(--output-bg-color); } body.dark fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item:hover { background-color:var(--plugin-bg-color); } body.dark fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item.select { background-color:var(--plugin-bg-color); } diff --git a/core/wiki/spark.go b/core/wiki/spark.go index 45fe9fd4..3be9e016 100644 --- a/core/wiki/spark.go +++ b/core/wiki/spark.go @@ -60,8 +60,11 @@ func _spark_show(m *ice.Message, name, text string, arg ...string) *ice.Message } const ( - INNER = "inner" - SHELL = "shell" + INNER = "inner" + SHELL = "shell" + ROUTE = "route" + PROJECT = "project" + PRODUCT = "product" ) const SPARK = "spark" @@ -92,8 +95,10 @@ func init() { arg = append(arg, kit.Simple(ctx.ARGS, kit.Join(nfs.SplitPath(m, p), lex.SP))...) arg[0] = m.Cmdx(nfs.CAT, p) } - m.Cmdy(FIELD, "", web.CODE_INNER, ice.MSG_RESULT, arg[0], ctx.DISPLAY, "/plugin/local/code/inner.js", ctx.STYLE, html.OUTPUT, arg[1:]) + m.Cmdy(FIELD, "", web.CODE_INNER, ice.MSG_RESULT, arg[0], ctx.DISPLAY, html.PLUGIN_LOCAL_CODE_INNER, ctx.STYLE, html.OUTPUT, arg[1:]) }}, + PROJECT: {Hand: func(m *ice.Message, arg ...string) { _spark_project(m, arg...) }}, + PRODUCT: {Hand: func(m *ice.Message, arg ...string) { _spark_product(m, arg...) }}, }), Hand: func(m *ice.Message, arg ...string) { if kit.Ext(arg[0]) == "md" { _spark_md(m, arg...) @@ -108,3 +113,30 @@ func init() { }}, }) } +func _spark_project(m *ice.Message, arg ...string) { + defer m.Cmdy(STYLE, FLEX).Cmdy(STYLE, END) + m.Cmdy(STYLE, COLUMN) + m.Cmdy(TITLE, kit.Capital(path.Base(kit.Select(ice.Info.Pathname, ice.Info.Make.Remote)))) + m.Cmdy(SPARK, TITLE, arg[0]).Cmdy(ORDER, arg[1]) + m.Cmdy(STYLE, FLEX) + m.Cmdy(SPARK, html.BUTTON, "体 验", ROUTE, web.SpideOrigin(m, ice.DEMO)) + m.Cmdy(SPARK, html.BUTTON, "下 载", ROUTE, "download/") + m.Cmdy(SPARK, html.BUTTON, "文 档", ROUTE, "started/") + m.Cmdy(STYLE, END) + m.Cmdy(STYLE, END) + m.Cmdy(STYLE, COLUMN, FLEX, "0 0 480px") + m.Cmdy(SPARK, INNER, ice.SRC_MAIN_GO, html.WIDTH, "480px") + m.Cmdy(SPARK, SHELL, kit.Renders(` +git clone {{ .Make.Remote }} +cd {{ .Make.Remote | Base }} && source etc/miss.sh + +./bin/ice.bin + +open http://localhost:9020 +`, ice.Info), "style.width", "480px") + m.Cmdy(STYLE, END) +} +func _spark_product(m *ice.Message, arg ...string) { + m.Cmdy(SPARK, TITLE, arg[1]).Cmdy(SPARK, arg[2]) + m.Cmdy(FIELD, arg[1], arg[0], arg[3:]) +} diff --git a/core/wiki/style.go b/core/wiki/style.go index a28edd6b..a42346d5 100644 --- a/core/wiki/style.go +++ b/core/wiki/style.go @@ -5,6 +5,11 @@ import ( kit "shylinux.com/x/toolkits" ) +const ( + COLUMN = "column" + FLEX = "flex" + END = "end" +) const STYLE = "style" func init() {