MS-XAML-2017 object-mapping profile and typed View generation for Selene

git clone https://github.com/kkkiio/selene.git
cd selene/selene-xaml
moon install ./src/cmd/selene-xamlimport {
"KKKIIO/selene@0.37.3",
}<!-- counter.xaml -->
<Flex xmlns="urn:selene:xaml:ui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:model="moonbit:your_game/model"
x:Class="CounterView" DataType="model:CounterState"
Direction="Column" Gap="12" Padding="16">
<Text Text="{Binding Path=label}" FontSize="24" Color="#f0ddbd" />
<Button x:Name="increment" OnClick="increment">
<Text Text="+1" Color="#f0ddbd" />
</Button>
</Flex>moon -C your_game info src/model --target js
selene-xaml generate \
your_game/counter.xaml \
--mbti your_game/src/model/pkg.generated.mbti \
--out-dir your_game/src/viewlet entity = @entity.Entity()
@counter_view.CounterView::mount(entity, CounterState::{ label: "0" })
for envelope in @event.EventReader().read(@counter_view.action_event_bus) {
match envelope.action {
Increment => @counter_view.CounterView::replace(
entity,
CounterState::{ label: "1" },
)
}
}
entity.destroy()Install
Download zipMS-XAML-2017 object-mapping profile and typed View generation for Selene