forked from x/icebergs
opt process
This commit is contained in:
parent
d7dc4693a2
commit
6ea1bd5a9d
@ -1,8 +1,11 @@
|
||||
package ctx
|
||||
|
||||
import (
|
||||
"path"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/aaa"
|
||||
"shylinux.com/x/icebergs/base/web/html"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
@ -58,6 +61,7 @@ func ProcessField(m *ice.Message, cmd string, args ice.Any, arg ...string) *ice.
|
||||
}
|
||||
m.Push(ARGS, kit.Format(_process_args(m, args))).Options(ice.MSG_INDEX, m.PrefixKey())
|
||||
m.ProcessField(ACTION, m.ActionKey(), RUN)
|
||||
kit.If(m.IsMetaKey(), func() { m.Push(STYLE, html.FLOAT) })
|
||||
} else {
|
||||
if !PodCmd(m, cmd, arg[1:]) {
|
||||
kit.If(aaa.Right(m, cmd, arg[1:]), func() { m.Cmdy(cmd, arg[1:]) })
|
||||
@ -65,3 +69,12 @@ func ProcessField(m *ice.Message, cmd string, args ice.Any, arg ...string) *ice.
|
||||
}
|
||||
return m
|
||||
}
|
||||
func ProcessFloat(m *ice.Message, cmd string, args ice.Any, arg ...string) *ice.Message {
|
||||
if m.IsMetaKey() {
|
||||
return m.ProcessOpen(path.Join("/c/", cmd, path.Join(_process_args(m, args)...)))
|
||||
}
|
||||
if !kit.HasPrefixList(arg, RUN) {
|
||||
defer m.Push(STYLE, html.FLOAT)
|
||||
}
|
||||
return ProcessField(m, cmd, args, arg...)
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ func init() {
|
||||
DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if kit.HasPrefixList(arg, ctx.ACTION, ADMIN) && len(arg) == 2 {
|
||||
if m.Option(mdb.TYPE) == MASTER {
|
||||
// m.ProcessOpen(SpideOrigin(m, m.Option(mdb.NAME)) + C(m.PrefixKey()))
|
||||
ctx.ProcessField(m, CHAT_IFRAME, SpideOrigin(m, m.Option(mdb.NAME))+C(m.PrefixKey()), arg...)
|
||||
m.ProcessField(ctx.ACTION, ctx.RUN, CHAT_IFRAME)
|
||||
} else {
|
||||
|
@ -273,9 +273,6 @@ func init() {
|
||||
_dream_start(m, m.Option(mdb.NAME))
|
||||
}
|
||||
}},
|
||||
nfs.REPOS: {Help: "仓库", Icon: "bi bi-git", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.ProcessOpen(m.MergePodCmd("", CODE_GIT_SEARCH))
|
||||
}},
|
||||
STARTALL: {Name: "startall name", Help: "启动", Icon: "bi bi-play-circle", Hand: func(m *ice.Message, arg ...string) {
|
||||
DreamEach(m, m.Option(mdb.NAME), cli.STOP, func(name string) {
|
||||
m.Cmd("", cli.START, ice.Maps{mdb.NAME: name, ice.MSG_DAEMON: ""})
|
||||
@ -371,14 +368,10 @@ func init() {
|
||||
"send": {Name: "send space*", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(SPACE, m.Option(SPACE), DREAM, mdb.CREATE, m.OptionSimple(mdb.NAME, mdb.ICON, nfs.REPOS, nfs.BINARY))
|
||||
m.Cmd(SPACE, m.Option(SPACE), DREAM, cli.START, m.OptionSimple(mdb.NAME))
|
||||
m.ProcessOpen(m.MergePod(kit.Keys(m.Option(SPACE), m.Option(mdb.NAME))))
|
||||
ProcessIframe(m, "", m.MergePod(kit.Keys(m.Option(SPACE), m.Option(mdb.NAME))))
|
||||
}},
|
||||
OPEN: {Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.Option(mdb.TYPE) == MASTER {
|
||||
m.ProcessOpen(SpideOrigin(m, m.Option(mdb.NAME)) + C(ADMIN))
|
||||
} else {
|
||||
m.ProcessOpen(m.MergePod(m.Option(mdb.NAME)))
|
||||
}
|
||||
ProcessIframe(m, m.Option(mdb.NAME), kit.Select(m.MergePod(m.Option(mdb.NAME), SpideOrigin(m, m.Option(mdb.NAME))+C(ADMIN)), m.Option(mdb.TYPE) == MASTER), arg...)
|
||||
}},
|
||||
MAIN: {Name: "main index", Help: "首页", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(SPACE, m.Option(mdb.NAME), SPACE, ice.MAIN, m.Option(ctx.INDEX))
|
||||
@ -465,9 +458,9 @@ func DreamProcess(m *ice.Message, args ice.Any, arg ...string) {
|
||||
ctx.ProcessField(m, m.PrefixKey(), args, kit.Slice(arg, 1)...)
|
||||
} else if kit.HasPrefixList(arg, ctx.ACTION, m.PrefixKey()) || kit.HasPrefixList(arg, ctx.ACTION, m.CommandKey()) {
|
||||
if m.Option(mdb.TYPE) == MASTER && (kit.IsIn(ctx.ShortCmd(m.PrefixKey()), PORTAL, DESKTOP)) {
|
||||
// m.ProcessOpen(SpideOrigin(m, m.Option(mdb.NAME)) + C(m.PrefixKey()))
|
||||
ctx.ProcessField(m, CHAT_IFRAME, SpideOrigin(m, m.Option(mdb.NAME))+C(m.PrefixKey()), arg...)
|
||||
m.ProcessField(ctx.ACTION, ctx.RUN, CHAT_IFRAME)
|
||||
if ProcessIframe(m, "", SpideOrigin(m, m.Option(mdb.NAME))+C(m.PrefixKey()), arg...); !m.IsMetaKey() {
|
||||
m.ProcessField(ctx.ACTION, ctx.RUN, CHAT_IFRAME)
|
||||
}
|
||||
} else if arg = kit.Slice(arg, 2); kit.HasPrefixList(arg, DREAM) {
|
||||
m.Cmdy(SPACE, m.Option(ice.MSG_USERPOD, arg[1]), m.PrefixKey(), ctx.ACTION, DREAM_ACTION, ctx.RUN, arg[2:])
|
||||
} else if dream := m.Option(mdb.NAME); dream != "" {
|
||||
|
@ -52,14 +52,6 @@ func ParseLink(m *ice.Message, url string) ice.Maps {
|
||||
kit.For(u.Query(), func(k string, v []string) { list[k] = v[0] })
|
||||
return list
|
||||
}
|
||||
func ProcessPodCmd(m *ice.Message, pod, cmd string, arg ...ice.Any) {
|
||||
m.ProcessOpen(m.MergePodCmd(pod, cmd, arg...))
|
||||
}
|
||||
func ProcessIframe(m *ice.Message, name, link string, arg ...string) {
|
||||
ctx.ProcessField(m, CHAT_IFRAME, func() []string {
|
||||
return []string{m.Cmdx(CHAT_IFRAME, mdb.CREATE, mdb.TYPE, LINK, mdb.NAME, name, LINK, link)}
|
||||
}, arg...)
|
||||
}
|
||||
func PushPodCmd(m *ice.Message, cmd string, arg ...string) *ice.Message {
|
||||
list := []string{}
|
||||
m.Cmds(SPACE, func(value ice.Maps) {
|
||||
|
@ -382,9 +382,9 @@ func init() {
|
||||
OPEN: {Hand: func(m *ice.Message, arg ...string) {
|
||||
switch m.Option(mdb.TYPE) {
|
||||
case MASTER:
|
||||
m.ProcessOpen(m.Cmdv(SPIDE, m.Option(mdb.NAME), CLIENT_ORIGIN))
|
||||
ProcessIframe(m, m.Option(mdb.NAME), m.Cmdv(SPIDE, m.Option(mdb.NAME), CLIENT_ORIGIN), arg...)
|
||||
default:
|
||||
m.ProcessOpen(m.MergePod(m.Option(mdb.NAME), arg))
|
||||
ProcessIframe(m, m.Option(mdb.NAME), m.MergePod(m.Option(mdb.NAME)), arg...)
|
||||
}
|
||||
}},
|
||||
nfs.PS: {Hand: func(m *ice.Message, arg ...string) { _space_fork(m) }},
|
||||
|
@ -455,14 +455,22 @@ func SpideDelete(m *ice.Message, arg ...ice.Any) ice.Any {
|
||||
}
|
||||
func SpideSave(m *ice.Message, file, link string, cb func(count, total, value int)) *ice.Message {
|
||||
return m.Cmd(Prefix(SPIDE), ice.DEV_IP, SPIDE_SAVE, file, http.MethodGet, link, cb)
|
||||
// return m.Cmd(Prefix(SPIDE), ice.DEV, SPIDE_SAVE, file, http.MethodGet, link, cb)
|
||||
}
|
||||
func SpideCache(m *ice.Message, link string) *ice.Message {
|
||||
return m.Cmd(Prefix(SPIDE), ice.DEV, SPIDE_CACHE, http.MethodGet, link)
|
||||
}
|
||||
func SpideOrigin(m *ice.Message, name string) string {
|
||||
return m.Cmdv("web.spide", name, CLIENT_ORIGIN)
|
||||
return m.Cmdv(SPIDE, name, CLIENT_ORIGIN)
|
||||
}
|
||||
func SpideURL(m *ice.Message, name string) string {
|
||||
return m.Cmdv("web.spide", name, CLIENT_URL)
|
||||
return m.Cmdv(SPIDE, name, CLIENT_URL)
|
||||
}
|
||||
func ProcessIframe(m *ice.Message, title, link string, arg ...string) *ice.Message {
|
||||
if m.IsMetaKey() {
|
||||
return m.ProcessOpen(link)
|
||||
}
|
||||
if !kit.HasPrefixList(arg, ctx.RUN) {
|
||||
defer m.Push(TITLE, title)
|
||||
}
|
||||
return ctx.ProcessFloat(m, CHAT_IFRAME, link, arg...)
|
||||
}
|
||||
|
@ -32,21 +32,14 @@ func init() {
|
||||
m.OptionDefault(nfs.BINARY, m.Option(ORIGIN)+S(m.Option(mdb.NAME)))
|
||||
m.Cmdy(DREAM, mdb.CREATE, m.OptionSimple(mdb.NAME, mdb.ICON, nfs.REPOS, nfs.BINARY))
|
||||
m.Cmdy(DREAM, cli.START, m.OptionSimple(mdb.NAME))
|
||||
defer m.Push(TITLE, m.Option(mdb.NAME))
|
||||
}
|
||||
ctx.ProcessField(m, CHAT_IFRAME, S(m.Option(mdb.NAME)), arg...)
|
||||
ProcessIframe(m, m.Option(mdb.NAME), S(m.Option(mdb.NAME)), arg...)
|
||||
}},
|
||||
OPEN: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if !kit.HasPrefixList(arg, ctx.RUN) {
|
||||
defer m.Push(TITLE, m.Option(mdb.NAME))
|
||||
}
|
||||
ctx.ProcessField(m, CHAT_IFRAME, S(m.Option(mdb.NAME)), arg...)
|
||||
ProcessIframe(m, m.Option(mdb.NAME), S(m.Option(mdb.NAME)), arg...)
|
||||
}},
|
||||
PORTAL: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if !kit.HasPrefixList(arg, ctx.RUN) {
|
||||
defer m.Push(TITLE, m.Option(mdb.NAME))
|
||||
}
|
||||
ctx.ProcessField(m, CHAT_IFRAME, m.Option(ORIGIN)+S(m.Option(mdb.NAME))+C(PORTAL), arg...)
|
||||
ProcessIframe(m, m.Option(mdb.NAME), m.Option(ORIGIN)+S(m.Option(mdb.NAME))+C(PORTAL), arg...)
|
||||
}},
|
||||
}, ctx.ConfAction(ctx.TOOLS, DREAM)), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) == 0 {
|
||||
|
@ -1,19 +1,8 @@
|
||||
Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg) { can.ui = can.onappend.layout(can), can.onimport._project(can, msg)
|
||||
can.onappend.style(can, "output card", can.ui.content), can.onmotion.delay(can, function() { can.onimport.layout(can) })
|
||||
can.sup.onimport._field = function(sup, msg) { msg.Table(function(item) { can.onappend._plugin(can, item, {style: html.FLOAT}, function(sub) {}) }) }
|
||||
},
|
||||
_project: function(can, msg) { var select, current = can.sup.db._zone||can.db.hash[0]||ice.DEV
|
||||
msg.Table(function(value) {
|
||||
var _target = can.onimport.item(can, value, function(event) {
|
||||
can.isCmdMode()? can.misc.SearchHash(can, value.name): can.sup.db._zone = value.name
|
||||
if (can.onmotion.cache(can, function() { return value.name }, can.ui.content, can._status)) { return can.onimport.layout(can) }
|
||||
can.run(can.request(event, {_toast: ice.PROCESS}), [value.name], function(msg) { can.onappend._status(can, msg.Option(ice.MSG_STATUS)), can.onimport.card(can, msg), can.onimport.layout(can) })
|
||||
}, function() {}, can.ui.project); select = (value.name == current? _target: select)||_target
|
||||
}), select && select.click()
|
||||
},
|
||||
layout: function(can) { can.Action(html.FILTER) && can.onmotion.filter(can, can.Action(html.FILTER))
|
||||
can.ui.layout(can.ConfHeight(), can.ConfWidth()), can.onlayout.expand(can, can.ui.content)
|
||||
// can.user.isMobile && can.page.style(can, can.ui.content, html.HEIGHT, "")
|
||||
_init: function(can, msg) { can.ui = can.onappend.layout(can), can.onimport.__project(can, msg) },
|
||||
_layout: function(can) {
|
||||
can.page.style(can, can.ui.content, html.HEIGHT, can._output.style[html.HEIGHT], html.MAX_HEIGHT, can._output.style[html.MAX_HEIGHT])
|
||||
can.page.style(can, can.ui.project, html.HEIGHT, can.ui.content.offsetHeight+can.ui.display.offsetHeight)
|
||||
can.onlayout.expand(can, can.ui.content)
|
||||
},
|
||||
}, [""])
|
||||
|
@ -53,6 +53,8 @@ fieldset.macos.desktop>div.output>div.desktop>fieldset>div.output>table.content
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset.web.wiki.feel>div.status { display:none; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset.web.code.xterm>div.status { display:none; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset.web.chat.iframe>div.status { display:none; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset.iframe>form.option>div.item.hash input { width:var(--form-width); }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset.xterm>form.option>div.item.hash input { width:var(--form-width); }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset.web.chat.location>form.option>div.item:last-child { margin-right:unset; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset.web.chat.location>div.action>div.item.text { display:none; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset.web.chat.location>div.action>div.item.style select { width:80px; }
|
||||
|
@ -76,6 +76,7 @@ Volcanos(chat.ONIMPORT, {
|
||||
item.height = can.base.Max(html.DESKTOP_HEIGHT, item.height), item.width = can.base.Max(html.DESKTOP_WIDTH, item.width)
|
||||
if (can.base.isIn(item.index, web.CODE_VIMER)) { item.width = can.base.Max(1600, can.ConfWidth()), item.left = (can.ConfWidth()-item.width)/2 }
|
||||
can.onappend.plugin(can, item, function(sub) { can.ondetail.select(can, sub._target)
|
||||
can.page.style(can, sub._target, html.HEIGHT, item.height, html.WIDTH, item.width)
|
||||
var index = 0; can.core.Item({
|
||||
close: {color: "#f95f57", inner: "x", onclick: function(event) { sub.onaction._close(event, sub) }},
|
||||
small: {color: "#fcbc2f", inner: "-", onclick: function(event) { var dock = can.page.Append(can, can.ui.dock._output, [{view: html.ITEM, list: [{view: html.ICON, list: [{img: can.misc.PathJoin(item.icon)}]}], onclick: function() {
|
||||
@ -87,17 +88,18 @@ Volcanos(chat.ONIMPORT, {
|
||||
})
|
||||
sub.onexport.marginTop = function() { return 25 }, sub.onexport.marginBottom = function() { return 100 }
|
||||
sub.onexport.actionHeight = function(sub) { return can.page.ClassList.has(can, sub._target, html.OUTPUT)? 0: html.ACTION_HEIGHT+20 }
|
||||
sub.onexport.output = function() { sub.onimport.size(sub, item.height, can.base.Min(sub._target.offsetWidth, item.width), true)
|
||||
sub.onexport.output = function() { sub.onimport.size(sub, item.height, can.base.Min(sub._target.offsetWidth, item.width), false)
|
||||
sub._target._meta.args = can.base.trim(can.page.SelectArgs(can, sub._option, "", function(target) { return target.value })), can.onexport.tabs(can)
|
||||
}, sub.onimport.size(sub, item.height, can.base.Min(sub._target.offsetWidth, item.width), true)
|
||||
}, sub.onimport.size(sub, item.height, can.base.Min(sub._target.offsetWidth, item.width), false)
|
||||
sub.onexport.record = function(sub, value, key, item) { can.onimport._window(can, item) }
|
||||
sub.onimport._open = function(sub, msg, arg) { can.onimport._window(can, {index: web.CHAT_IFRAME, args: [arg]}) }
|
||||
sub.onimport._field = function(sub, msg) { msg.Table(function(item) { can.onimport._window(can, item) }) }
|
||||
sub.onappend.dock = function(item) { can.ui.dock.runAction(can.request(event, item), mdb.CREATE, [], function() { can.ui.dock.Update() }) }
|
||||
sub.onaction._close = function() { can.page.Remove(can, sub._target), can.onexport.tabs(can) }
|
||||
sub.onappend.desktop = function(item) { can.onimport._item(can, item) }
|
||||
can.onmotion.move(can, sub._target, {top: item.top, left: item.left})
|
||||
sub.onmotion.resize(can, sub._target, function(height, width) {
|
||||
sub.onimport.size(sub, item.height = height, item.width = width)
|
||||
sub.onimport.size(sub, item.height = height, item.width = width, false)
|
||||
sub._target._meta.height = height, sub._target._meta.width = width, can.onexport.tabs(can)
|
||||
}, 25)
|
||||
sub._target.onclick = function(event) { can.ondetail.select(can, sub._target) }
|
||||
|
@ -120,7 +120,7 @@ func init() {
|
||||
}
|
||||
}},
|
||||
html.OUTPUT: {Help: "全屏", Hand: func(m *ice.Message, arg ...string) {
|
||||
web.ProcessPodCmd(m, "", "", mdb.HASH, kit.Select(m.Option(mdb.HASH), arg, 0), ctx.STYLE, html.OUTPUT)
|
||||
m.ProcessOpen(m.MergePodCmd("", "", mdb.HASH, kit.Select(m.Option(mdb.HASH), arg, 0), ctx.STYLE, html.OUTPUT))
|
||||
}},
|
||||
INSTALL: {Help: "安装", Hand: func(m *ice.Message, arg ...string) {
|
||||
_xterm_get(m, kit.Select("", arg, 0)).Write([]byte(m.Cmdx(PUBLISH, ice.CONTEXTS, ice.APP, kit.Dict("format", "raw")) + ice.NL))
|
||||
|
@ -134,5 +134,8 @@ func (m *Message) ProcessHold(text ...Any) { m.Process(PROCESS_HOLD, text...)
|
||||
func (m *Message) ProcessBack() { m.Process(PROCESS_BACK) }
|
||||
func (m *Message) ProcessRich(arg ...Any) { m.Process(PROCESS_RICH, arg...) }
|
||||
func (m *Message) ProcessGrow(arg ...Any) { m.Process(PROCESS_GROW, arg...) }
|
||||
func (m *Message) ProcessOpen(url string) { kit.If(url, func() { m.Process(PROCESS_OPEN, url) }) }
|
||||
func (m *Message) ProcessClose() *Message { return m.Process(PROCESS_CLOSE) }
|
||||
func (m *Message) ProcessOpen(url string) *Message {
|
||||
kit.If(url, func() { m.Process(PROCESS_OPEN, url) })
|
||||
return m
|
||||
}
|
||||
func (m *Message) ProcessClose() *Message { return m.Process(PROCESS_CLOSE) }
|
||||
|
@ -120,6 +120,9 @@ func (m *Message) IsDebug() bool {
|
||||
func (m *Message) IsCliUA() bool {
|
||||
return m.Option(MSG_USERUA) == "" || !strings.HasPrefix(m.Option(MSG_USERUA), "Mozilla")
|
||||
}
|
||||
func (m *Message) IsMetaKey() bool {
|
||||
return m.Option("metaKey") == TRUE
|
||||
}
|
||||
func (m *Message) IsMobileUA() bool {
|
||||
return strings.Contains(m.Option(MSG_USERUA), "Mobile")
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user