Although v1.0.0 is not yet out, we do not expect many breaking changes. When there is one, however, it is documented clearly here.
Nov 4, 2017 (PR #158): major breaking change
All Component
s must now have a Render
method which returns vecty.ComponentOrHTML
instead of the prior *vecty.HTML
type.
This change allows for higher order components (components that themselves render components), which is useful for many more advanced uses of Vecty.
Upgrading most codebases should be trivial with a find-and-replace across all files.
From your editor:
- Find
) Render() *vecty.HTML
and replace with) Render() vecty.ComponentOrHTML
.
From the Linux command line:
git grep -l ') Render() \*vecty.HTML' | xargs sed -i 's/) Render() \*vecty.HTML/) Render() vecty.ComponentOrHTML/g'
From the Mac command line:
git grep -l ') Render() \*vecty.HTML' | xargs sed -i '' -e 's/) Render() \*vecty.HTML/) Render() vecty.ComponentOrHTML/g'
Obviously, you'll still need to verify that this only modifies your Component
implementations. No other changes are needed, and no behavior change is expected for components that return *vecty.HTML
(as the new vecty.ComponentOrHTML
interface return type).
Oct 14, 2017 (PR #155): major breaking change
The function prop.Class(string)
has been removed and replaced with vecty.Class(...string)
. Migrating users must use the new function and split their classes into separate strings, rather than a single space-separated string.
Oct 1, 2017 (PR #147): minor breaking change
MarkupOrChild
and ComponentOrHTML
can both now contain KeyedList
(a new type that has been added)
Sept 5, 2017 (PR #140): minor breaking change
Package storeutil
has been moved to github.com/gowasm/vecty/example/todomvc/store/storeutil
import path.
Sept 2, 2017 (PR #134): major breaking change
Several breaking changes have been made. Below, we describe how to upgrade your Vecty code to reflect each of these changes.
On the surface, these changes may appear to be needless or simple API changes, however when combined they in fact resolve one of the last major open issues about how Vecty fundamentally operates. With this change, Vecty now ensures that the persistent pointer to your component instances remain the same regardless of e.g. the styles that you pass into element constructors.
Tag
, Text
, and elem.Foo
constructors no longer accept markup (styles, properties, etc.) directly. You must now specify them via vecty.Markup
. For example, this code:
func (p *PageView) Render() *vecty.HTML {
return elem.Body(
vecty.Style("background", "red"),
vecty.Text("Hello World"),
)
}
Must now be written as:
func (p *PageView) Render() *vecty.HTML {
return elem.Body(
vecty.Markup(
vecty.Style("background", "red"),
),
vecty.Text("Hello World"),
)
}
If
now only accepts ComponentOrHTML
(meaning Component
, *HTML
, List
or nil
). It does not accept markup anymore (styles, properties, etc). A new MarkupIf
function is added for this purpose. For example you would need to make a change like this to your code:
func (p *PageView) Render() *vecty.HTML {
return elem.Body(
vecty.Markup(
- vecty.If(isBackgroundRed, vecty.Style("background", "red")),
+ vecty.MarkupIf(isBackgroundRed, vecty.Style("background", "red")),
),
vecty.Text("Hello World"),
)
}
ComponentOrHTML
now includesnil
and the newList
type, rather than justComponent
and*HTML
.MarkupOrComponentOrHTML
has been renamed toMarkupOrChild
, and now includesnil
and the newList
andMarkupList
(instead ofMarkup
, see below) types.- The
Markup
interface has been renamed toApplyer
, and aMarkup
function has been added to create aMarkupList
.
Aug 6, 2017 (PR #130): minor breaking change
The Restorer
interface has been removed, component instances are now persistent. Properties should be denoted via `vecty:"prop"`
struct field tags.
Jun 17, 2017 (PR #117): minor breaking change
(*HTML).Restore
is no longer exported, this method was not generally used externally.
May 11, 2017 (PR #108): minor breaking change
(*HTML).Node
is now a function instead of a struct field.