Split into category packages; module github.com/ZacharyZhang-NY/MujicaUI

This commit is contained in:
ZacharyZhang-NY committed 2026-10-05 16:18:48 -04:00
1 parent 5a7e921c7e
commit 22b53e9e9e
1822 files changed
+24568 -21314

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
package devtools
import (
"fmt"
"time"
"github.com/egoist/mygo/ui"
"github.com/ZacharyZhang-NY/MujicaUI/agent"
"github.com/ZacharyZhang-NY/MujicaUI/core"
"github.com/ZacharyZhang-NY/MujicaUI/theme"
)
// devtoolsAgo formats elapsed time using localized copy.
func devtoolsAgo(c *ui.Context, t time.Time) string {
d := max(c.Now().Sub(t), 0).Truncate(time.Second)
return fmt.Sprintf(core.Msg(c, "devtools.ago"), agent.AgentDuration(d))
}
// devtoolsSeverity shows severity with an icon and word.
func devtoolsSeverity(c *ui.Context, s core.Severity, word string) {
tone, icon := core.SeverityLook(core.Tokens(c), s)
ui.Row(c).Gap(core.Density(c).Unit()).AlignItems(ui.Center).Shrink(0).Children(func() {
ui.Icon(c, icon).Size(14, 14).TextColor(tone)
ui.Text(c, word).TextColor(tone).FontSize(core.FontSize(c, theme.CaptionSize+1)).FontWeight(600).SingleLine()
})
}
// devtoolsTitle is a serif panel title.
func devtoolsTitle(c *ui.Context, s string) *ui.Element {
return ui.Text(c, s).Font(theme.SerifFont).FontSize(core.FontSize(c, theme.H3Size)).FontWeight(600)
}