Skip to content

LivePreview, DOM, and CSS improvements

Compare
Choose a tag to compare
@MihaelIsaev MihaelIsaev released this 26 Dec 12:50
· 64 commits to master since this release

🖥 Improve LivePreview declaration

Old way

class Index_Preview: WebPreview {
    override class var language: Language { .en }
    
    override class var title: String { "Index page" }
    
    override class var width: UInt { 600 }
    override class var height: UInt { 480 }
    
    @Preview override class var content: Preview.Content {
        AppStyles.all
        IndexPage()
    }
}

New way

class Index_Preview: WebPreview {
    @Preview override class var content: Preview.Content {
        Language.en
        Title("Index page")
        Size(600, 480)
        AppStyles.all
        IndexPage()
    }
}

🪚 DOM: make attribute method public

Now you can set custom attributes or not-supported attributes simply by calling

Div()
    .attribute("my-custom-attribute", "myCustomValue")

🎨 Fix CSS properties

Stop color for gradients now can be set these ways

// convenient way
.red.stop(80) // red / 80%

// short way
.red/80 // red / 80%

BackgroundClipType got new text value

Fixed properties with browser prefixes, now they all work as expected

BackgroundImageProperty got dedicated initializer with CSSFunction