diff --git a/etc/miss.sh b/etc/miss.sh index 4c8d7456..88c802bf 100644 --- a/etc/miss.sh +++ b/etc/miss.sh @@ -26,7 +26,7 @@ ish_miss_prepare redis-story # ish_miss_prepare wubi-dict # ish_miss_prepare word-dict # ish_miss_prepare echarts -# ish_miss_prepare icons +ish_miss_prepare icons ish_miss_prepare websocket ish_miss_prepare go-qrcode diff --git a/src/document/web.dream/list.shy b/src/document/web.dream/list.shy new file mode 100644 index 00000000..7e5718f5 --- /dev/null +++ b/src/document/web.dream/list.shy @@ -0,0 +1,9 @@ +chapter "dream 项目空间" + +section "list 空间列表" + +section "start 启动空间" + +section "stop 停止空间" + +section "trash 删除空间" diff --git a/src/document/web.dream/start.shy b/src/document/web.dream/start.shy new file mode 100644 index 00000000..9cead7f3 --- /dev/null +++ b/src/document/web.dream/start.shy @@ -0,0 +1,4 @@ +chapter "start 启动空间" + +section "start 启动空间" + diff --git a/src/macosx/controls.go b/src/macosx/controls.go new file mode 100644 index 00000000..53f1db21 --- /dev/null +++ b/src/macosx/controls.go @@ -0,0 +1,7 @@ +package macosx + +import ice "shylinux.com/x/icebergs" + +const CONTROLS = "controls" + +func init() { Index.MergeCommands(ice.Commands{CONTROLS: {Actions: CmdHashAction()}}) } diff --git a/src/macosx/controls.js b/src/macosx/controls.js new file mode 100644 index 00000000..cda17037 --- /dev/null +++ b/src/macosx/controls.js @@ -0,0 +1,3 @@ +Volcanos(chat.ONIMPORT, {_init: function(can, msg) { + msg.Echo("hello world").Dump(can) +}}) \ No newline at end of file diff --git a/src/macosx/desktop.css b/src/macosx/desktop.css new file mode 100644 index 00000000..18227381 --- /dev/null +++ b/src/macosx/desktop.css @@ -0,0 +1,43 @@ +fieldset.macosx.desktop { background-size:cover; background-position:center; color:#e8eaed; } +body.dark fieldset.macosx.desktop>div.output { background-color:unset; } +fieldset.macosx.desktop>div.output>fieldset.macosx>div.output { background-color:transparent; } +fieldset.macosx.desktop>div.output>fieldset.macosx.menu { background-color:#08234ad1; color:#e8eaed; line-height:25px; height:25px; width:100%; position:absolute; top:0; } +fieldset.macosx.desktop>div.output>fieldset.macosx.controls { background-color:#08234ad1; height:40%; width:240px; position:absolute; top:20px; right:0; } +fieldset.macosx.desktop>div.output>fieldset.macosx.notifications { background-color:#08234ad1; height:80%; width:240px; position:absolute; top:10%; right:0; } +fieldset.macosx.desktop>div.output>fieldset.macosx.dock { position:absolute; bottom:10px; left:300px; transition:margin-left 0.3s; } +fieldset.macosx.desktop>div.output>fieldset.macosx.dock:hover { margin-left:-40px; transition:margin-left 0.3s; } +fieldset.macosx.desktop>div.output>div.desktop:not(.select) { display:none; } +fieldset.macosx.desktop>div.output>div.desktop>fieldset { position:absolute; } +fieldset.macosx.desktop>div.output>div.desktop.scale>fieldset { scale:0.6; } +// fieldset.macosx.desktop>div.output>div.desktop fieldset { background-color:#333434; border:#ffffff3d solid 1px; border-top:#ffffff52 ridge 2px; border-radius:10px; } +fieldset.macosx.desktop>div.output>div.desktop fieldset { background-color:#333434; border-radius:10px; } +fieldset.macosx.desktop>div.output>div.desktop fieldset>legend { background-color:unset; margin:10px 0; } +fieldset.macosx.desktop>div.output>div.desktop fieldset>form.option>* { margin:10px 0; background-color:unset; } +fieldset.macosx.desktop>div.output>div.desktop fieldset>div.action>* { margin:10px 0; } +fieldset.macosx.desktop>div.output>div.desktop>fieldset>div.output { background-color:#1a1d1d; } +fieldset.macosx.desktop>div.output>div.desktop fieldset>div.status { background-color:transparent; border-top:#3e4040 solid 1px; } +fieldset.macosx.desktop>div.output>div.desktop fieldset>div.status>* { margin:10px 0; } +fieldset.macosx.desktop>div.output>div.desktop fieldset input { background-color:#333434; border:#404141 solid 1px; border-radius:5px; box-shadow:unset; } +fieldset.macosx.desktop>div.output>div.desktop fieldset input[type=button] { background-color:#5e5f5f; } +fieldset.macosx.desktop>div.output>div.desktop fieldset table.content th { background-color:unset; } +fieldset.macosx.desktop>div.output>div.desktop fieldset table.content.action td:last-child { background-color:unset; } +fieldset.macosx.desktop>div.output>div.desktop fieldset table.content tr:nth-child(odd) { background-color:#1a1d1e; } +fieldset.macosx.desktop>div.output>div.desktop fieldset table.content tr:nth-child(even) { background-color:#282B2F; } +fieldset.macosx.desktop>div.output>div.desktop fieldset>div.output.card>div.item { border:#3e4040 solid 1px; } +fieldset.macosx.desktop>div.output>div.desktop fieldset>div.output.card>div.item>div.title { border-bottom:#3e4040 solid 1px; } + +fieldset.macosx.menu>div.output>div.item { padding:0 5px; float:right; cursor:pointer; } +fieldset.macosx.menu>div.output>div.icon { padding:0 5px; float:right; cursor:pointer; } +fieldset.macosx.dock>div.output { background-color:#02142196; border:#ffffff3d solid 1px; border-radius:20px; height:80px; min-width:200px; overflow:visible; display:flex; z-index:11; } +fieldset.macosx.dock>div.output>div.item { text-align:center; align-self:baseline; transition:margin-top 0.3s; } +fieldset.macosx.dock>div.output>div.item:hover { background-color:unset; margin-top:-80px; transition:margin-top 0.3s; } +fieldset.macosx.dock>div.output>div.item img { width:80px; transition:width 0.3s; } +fieldset.macosx.dock>div.output>div.item img:hover { width:160px; transition:width 0.3s; } + +div.carte.macosx.float { background:#29323beb; color:#e8eaed; font-size:14px; padding:10px; border:#ffffff5e solid 1px; border-radius:8px; } +div.carte.macosx.float div.item { background:transparent; } +div.carte.macosx.float hr { border-bottom:gray solid 1px; } + +fieldset.macosx.desktop input { color:#e8eaed; } +fieldset.macosx.desktop>div.output>div.item { text-align:center; width:120px; float:left; overflow:hidden; } +fieldset.macosx.desktop>div.output>div.item img { width:80px; } diff --git a/src/macosx/desktop.go b/src/macosx/desktop.go new file mode 100644 index 00000000..563488c7 --- /dev/null +++ b/src/macosx/desktop.go @@ -0,0 +1,7 @@ +package macosx + +import ice "shylinux.com/x/icebergs" + +const DESKTOP = "desktop" + +func init() { Index.MergeCommands(ice.Commands{DESKTOP: {Actions: CmdHashAction()}}) } diff --git a/src/macosx/desktop.js b/src/macosx/desktop.js new file mode 100644 index 00000000..f7ac2094 --- /dev/null +++ b/src/macosx/desktop.js @@ -0,0 +1,61 @@ +Volcanos(chat.ONIMPORT, { + _init: function(can, msg, cb) { can.ui = {}, cb(msg), can.onmotion.clear(can) + can.page.styleHeight(can, can._output, can.ConfHeight()) + can.onimport._menu(can), can.onimport._dock(can), can.onimport._desktop(can, msg), can.onlayout.background(can, can.user.info.background, can._fields) + }, + _desktop: function(can, msg) { var target = can.page.Append(can, can._output, [{view: "desktop"}])._target + msg = msg||can._msg, msg.Table(function(item) { can.page.Append(can, target, [{view: html.ITEM, list: [{view: html.ICON, list: [{img: "/require/"+item.icon}]}, {view: [mdb.NAME, "", item.name]}]}]) }) + can.onimport.tabs(can, [{name: "desktop", text: ""}], function() { can.onmotion.select(can, can._output, "div.desktop", target), can.ui.desktop = target }, function() { can.page.Remove(can, target) }) + }, + _window: function(can, item) { item.height = can.ConfHeight()-282, item.width = can.ConfWidth()-100 + can.onappend.plugin(can, item, function(sub) { sub.onimport.size(sub, item.height, item.width, true), can.onmotion.move(can, sub._target, {"z-index": 10, top: 100, left: 100}) }, can.ui.desktop) + }, + _notifications: function(can) { can.onappend.plugin(can, {index: "web.chat.macosx.notifications", style: html.OUTPUT}, function(sub) { can.ui.notifications = sub, can.onmotion.hidden(can, sub._target) }) }, + _controls: function(can) { can.onappend.plugin(can, {index: "web.chat.macosx.controls", style: html.OUTPUT}, function(sub) { can.ui.controls = sub, can.onmotion.hidden(can, sub._target) }) }, + _menu: function(can) { can.onappend.plugin(can, {index: "web.chat.macosx.menu", style: html.OUTPUT}, function(sub) { can.ui.menu = sub + can.onimport._notifications(can), can.onimport._controls(can) + sub.onexport.record = function(_, value, key, item) { + switch (value) { + case "notifications": can.onmotion.toggle(can, can.ui.notifications._target); break + case "controls": can.onmotion.toggle(can, can.ui.controls._target); break + case "system": + var carte = can.user.carte(event, can, { + "About This Mac": function(event) { can.user.toast(can, "about this mac") }, + "System Preferences...": function(event) { can.user.toast(can, "about this mac") }, + "App Store...": function(event) { can.user.toast(can, "about this mac") }, + "Rencent iterms >": function(event) { can.user.toast(can, "about this mac") }, + "Force Quit Chrome": function(event) { can.user.toast(can, "about this mac") }, + "Sleep": function(event) { can.user.toast(can, "about this mac") }, + "Restart...": function(event) { can.user.toast(can, "about this mac") }, + "Shut Down...": function(event) { can.user.toast(can, "about this mac") }, + "Lock Screen": function(event) { can.user.toast(can, "about this mac") }, + "Log Out shy...": function(event) { can.user.toast(can, "about this mac") }, + full: function(event) { can.onaction.full(event, can) }, + scale: function(event) { + can.page.ClassList.neg(can, can.ui.desktop, "scale") + }, + }); var list = can.page.Select(can, carte._target, html.DIV_ITEM) + can.core.List([1, 3, 4, 5, 8], function(i) { can.page.insertBefore(can, [{type: html.HR}], list[i]) }) + can.page.style(can, carte._target, html.TOP, "25px") + break + } + } + }) }, + _dock: function(can) { can.onappend.plugin(can, {index: "web.chat.macosx.dock", style: html.OUTPUT}, function(sub) { can.ui.dock = sub + sub.onexport.record = function(sub, value, key, item) { can.onimport._window(can, item) } + }) }, + layout: function(can) { + can.page.styleHeight(can, can._output, can.ConfHeight()) + return + if (can._fields.offsetHeight > 32) { + can.ConfHeight(can._fields.offsetHeight-html.ACTION_HEIGHT) + } + can.ConfWidth(can._output.offsetWidth) + can.ui && can.ui.dock && can.page.style(can, can.ui.dock._target, "bottom", "10px") + }, +}, [""]) +Volcanos(chat.ONACTION, {list: ["full"], + create: function(event, can, button) { can.onimport._desktop(can) }, + // full: function(event, can, button) { can._fields.requestFullscreen() }, + full: function(event, can) { document.body.requestFullscreen() }, +}) diff --git a/src/macosx/dock.go b/src/macosx/dock.go new file mode 100644 index 00000000..c98d7ae6 --- /dev/null +++ b/src/macosx/dock.go @@ -0,0 +1,25 @@ +package macosx + +import ( + ice "shylinux.com/x/icebergs" + "shylinux.com/x/icebergs/base/mdb" + "shylinux.com/x/icebergs/base/nfs" + kit "shylinux.com/x/toolkits" +) + +const DOCK = "dock" + +func init() { + Index.MergeCommands(ice.Commands{ + DOCK: {Actions: ice.MergeActions(ice.Actions{ + mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { + switch mdb.HashInputs(m, arg); arg[0] { + case mdb.NAME: + m.Cmd(nfs.DIR, "usr/icons/", func(value ice.Maps) { m.Push(arg[0], kit.TrimExt(value[nfs.PATH], nfs.PNG)) }) + case mdb.ICON: + m.Cmd(nfs.DIR, "usr/icons/", func(value ice.Maps) { m.Push(arg[0], value[nfs.PATH]) }) + } + }}, + }, CmdHashAction())}, + }) +} diff --git a/src/macosx/dock.js b/src/macosx/dock.js new file mode 100644 index 00000000..1f7db2ec --- /dev/null +++ b/src/macosx/dock.js @@ -0,0 +1,21 @@ +Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb) { + msg.Table(function(item) { can.page.Append(can, can._output, [{view: html.ITEM, list: [{view: html.ICON, list: [{img: "/require/"+item.icon}] }], onclick: function(event) { + can.sup.onexport.record(can, item.name, mdb.NAME, item) + } }]) }) + can._output.oncontextmenu = function(event) { var carte = can.user.carte(event, can, { + create: function() { can.Update(event, [ctx.ACTION, mdb.CREATE]) }, + }); can.page.style(can, carte._target, html.LEFT, event.x) } + return + var current = null, before, begin + can.page.SelectChild(can, can._output, "*", function(target) { target.draggable = true + target.ondragstart = function() { current = target, can.page.style(can, target, "visibility", "hidden") } + target.ondragenter = function(event) { before = target, begin = {x: event.x, y: event.y} } + target.ondragover = function(event) { var offset = event.x - begin.x + can.page.style(can, target, {position: "relative", left: -offset}) + } + target.ondragleave = function(event) { } + target.ondragend = function(event) { before && can.page.insertBefore(can, current, before) + can.page.SelectChild(can, can._output, "*", function(target) { can.page.style(can, target, {position: "", left: "", visibility: "visible"}) }) + } + }) +}}) diff --git a/src/macosx/finder.go b/src/macosx/finder.go new file mode 100644 index 00000000..7f46323d --- /dev/null +++ b/src/macosx/finder.go @@ -0,0 +1,43 @@ +package macosx + +import ( + "strings" + + ice "shylinux.com/x/icebergs" + "shylinux.com/x/icebergs/base/ctx" + "shylinux.com/x/icebergs/base/nfs" + kit "shylinux.com/x/toolkits" +) + +const FINDER = "finder" + +func init() { + Index.MergeCommands(ice.Commands{ + FINDER: {Name: "finder path auto create", Help: "浏览器", Actions: ice.MergeActions(CmdHashAction()), Hand: func(m *ice.Message, arg ...string) { + if len(arg) == 0 || strings.HasSuffix(arg[0], nfs.PS) { + switch kit.Select("", arg, 0) { + case ice.USR_LOCAL_WORK: + ctx.ProcessCmds(m, "web.dream") + case ice.USR_LOCAL_REPOS: + ctx.ProcessCmds(m, "web.code.git.service") + case ice.USR_LOCAL_IMAGE: + ctx.ProcessCmds(m, "web.wiki.feel") + case ice.USR_LOCAL_DAEMON: + ctx.ProcessCmds(m, "web.code.install") + default: + m.Cmdy(nfs.DIR, arg).Display("") + } + } else { + switch kit.Ext(arg[0]) { + case "svg": + ctx.ProcessCmds(m, "web.wiki.draw", arg[0]) + case "shy": + ctx.ProcessCmds(m, "web.wiki.word", arg[0]) + default: + ls := nfs.SplitPath(m, arg[0]) + ctx.ProcessCmds(m, "web.code.vimer", ls[0], ls[1]) + } + } + }}, + }) +} diff --git a/src/macosx/finder.js b/src/macosx/finder.js new file mode 100644 index 00000000..363dafec --- /dev/null +++ b/src/macosx/finder.js @@ -0,0 +1,3 @@ +Volcanos(chat.ONIMPORT, {_init: function(can, msg) { + msg.Dump(can) +}}) diff --git a/src/macosx/macosx.go b/src/macosx/macosx.go new file mode 100644 index 00000000..d7ee9ea0 --- /dev/null +++ b/src/macosx/macosx.go @@ -0,0 +1,22 @@ +package macosx + +import ( + ice "shylinux.com/x/icebergs" + "shylinux.com/x/icebergs/base/ctx" + "shylinux.com/x/icebergs/base/mdb" + "shylinux.com/x/icebergs/core/chat" + kit "shylinux.com/x/toolkits" +) + +const MACOSX = "macosx" + +var Index = &ice.Context{Name: MACOSX} + +func init() { chat.Index.Register(Index, nil) } + +func CmdHashAction(arg ...string) ice.Actions { + file := kit.FileLines(2) + return ice.MergeActions(ice.Actions{ + mdb.SELECT: {Name: "list hash auto create", Hand: func(m *ice.Message, arg ...string) { mdb.HashSelect(m, arg...).Display(file) }}, + }, ctx.CmdAction(), mdb.HashAction(mdb.SHORT, kit.Select("", arg, 0), mdb.FIELD, kit.Select("time,hash,type,name,icon,index,args", arg, 1), kit.Slice(arg, 2))) +} diff --git a/src/macosx/macosx.shy b/src/macosx/macosx.shy new file mode 100644 index 00000000..f8f5c0b8 --- /dev/null +++ b/src/macosx/macosx.shy @@ -0,0 +1,13 @@ +title "macosx" +chain ` +desktop + menu + dock + finder + trash + safari + preview + terminal + settings + notifications +` \ No newline at end of file diff --git a/src/macosx/menu.go b/src/macosx/menu.go new file mode 100644 index 00000000..e5bcbcdb --- /dev/null +++ b/src/macosx/menu.go @@ -0,0 +1,7 @@ +package macosx + +import ice "shylinux.com/x/icebergs" + +const MENU = "menu" + +func init() { Index.MergeCommands(ice.Commands{MENU: {Actions: CmdHashAction()}}) } diff --git a/src/macosx/menu.js b/src/macosx/menu.js new file mode 100644 index 00000000..4ff91696 --- /dev/null +++ b/src/macosx/menu.js @@ -0,0 +1,14 @@ +Volcanos(chat.ONIMPORT, {_init: function(can, msg) { msg.Dump(can), can.page.Append(can, can._output, can.user.header(can)) + false && can.page.Append(can, can._output, [{view: ["icon", "", "notifications"], onclick: function(event) { + can.sup.onexport.record(can, "notifications", mdb.NAME, {}) + }}]) + false && can.page.Append(can, can._output, [{view: ["icon", "", "controls"], onclick: function(event) { + can.sup.onexport.record(can, "controls", mdb.NAME, {}) + }}]) + can.page.Append(can, can._output, [{view: ["icon"], list: [{img: "/require/usr/icons/menu.png"}], onclick: function(event) { + can.sup.onexport.record(can, "controls", mdb.NAME, {}) + }}]) + can.page.Append(can, can._output, [{view: ["menu"], list: [{img: "/require/usr/icons/menu0.png"}], onclick: function(event) { + can.sup.onexport.record(can, "system", mdb.NAME, {}) + }}]) +}}) diff --git a/src/macosx/notifications.go b/src/macosx/notifications.go new file mode 100644 index 00000000..0c69e8fd --- /dev/null +++ b/src/macosx/notifications.go @@ -0,0 +1,7 @@ +package macosx + +import ice "shylinux.com/x/icebergs" + +const NOTIFICATIONS = "notifications" + +func init() { Index.MergeCommands(ice.Commands{NOTIFICATIONS: {Actions: CmdHashAction()}}) } diff --git a/src/macosx/notifications.js b/src/macosx/notifications.js new file mode 100644 index 00000000..a6546ea8 --- /dev/null +++ b/src/macosx/notifications.js @@ -0,0 +1,3 @@ +Volcanos(chat.ONIMPORT, {_init: function(can, msg) { + msg.Dump(can) +}}) \ No newline at end of file diff --git a/src/macosx/settings.go b/src/macosx/settings.go new file mode 100644 index 00000000..46799811 --- /dev/null +++ b/src/macosx/settings.go @@ -0,0 +1,7 @@ +package macosx + +import ice "shylinux.com/x/icebergs" + +const SETTINGS = "settings" + +func init() { Index.MergeCommands(ice.Commands{SETTINGS: {Actions: CmdHashAction()}}) } diff --git a/src/main.go b/src/main.go index c73bef9c..1c66cb22 100644 --- a/src/main.go +++ b/src/main.go @@ -30,6 +30,8 @@ import ( _ "shylinux.com/x/golang-story/src/grafana" _ "shylinux.com/x/golang-story/src/kubernetes" _ "shylinux.com/x/golang-story/src/prometheus" + + _ "shylinux.com/x/contexts/src/macosx" ) func main() { print(ice.Run()) }