forked from mbk-lab/rui_orig
2
0
Fork 0

Optimisation

This commit is contained in:
anoshenko 2023-04-23 12:32:03 +03:00
parent 62910bf41f
commit d1b30c56da
3 changed files with 29 additions and 11 deletions

View File

@ -112,7 +112,7 @@ ul:focus {
}
.ruiImageView {
display: grid;
display: block;
}
.ruiSvgImageView {

View File

@ -67,8 +67,7 @@ func newImageView(session Session) View {
func (imageView *imageViewData) init(session Session) {
imageView.viewData.init(session)
imageView.tag = "ImageView"
//imageView.systemClass = "ruiImageView"
imageView.systemClass = "ruiImageView"
}
func (imageView *imageViewData) String() string {

View File

@ -525,19 +525,38 @@ func (theme *theme) cssText(session Session) string {
var builder cssStyleBuilder
builder.init()
for tag, style := range theme.styles {
styleList := func(styles map[string]ViewStyle) []string {
ruiStyles := []string{}
customStyles := []string{}
for tag, _ := range styles {
if strings.HasPrefix(tag, "rui") {
ruiStyles = append(ruiStyles, tag)
} else {
customStyles = append(customStyles, tag)
}
}
sort.Strings(ruiStyles)
sort.Strings(customStyles)
return append(ruiStyles, customStyles...)
}
for _, tag := range styleList(theme.styles) {
if style := theme.styles[tag]; style != nil {
builder.startStyle(tag)
style.cssViewStyle(&builder, session)
builder.endStyle()
}
}
for _, media := range theme.mediaStyles {
builder.startMedia(media.cssText())
for tag, style := range media.styles {
for _, tag := range styleList(media.styles) {
if style := media.styles[tag]; style != nil {
builder.startStyle(tag)
style.cssViewStyle(&builder, session)
builder.endStyle()
}
}
builder.endMedia()
}