$ cnpm install sexy
Sexy - is super fast reactive framework for building fast UI. Perfect Google PageSpeed metrics (better 4-5 times then NuxtJS)
Sexy is fast because it compiles components to Native Javascript and it manages reactivity at compiler time!
Thanks SolidJS (dom expressions) and Sinuous (fast looping) for their work that helped to make max performance.
3.73kB
gzip.Performance is a main key of Sexy framework. (syntethic tests)
Best choice for mobile web apps development.
Benchmark was made with 10 000 components with loop function. (Without loop its much more faster).
Attribute speed test with MarkoJS benchmark showed 19000 ops/sec for sexy framework and x5 hydration speed
Expression generation should be fixed and tested more
Syntax is similar to VueJs but loop and conditional statements has a bit different syntax
@if(expression)
<div :class="[var2]" :style="var1">
<slot>Default slot text</slot>
</div>
@elseif(expression)
1
@else
2
@endif
Each with multiple nodes
@each((item, key) in items)
<template :key="key">
// code
</template>
@endeach
Each with signle nodes
@each((item, key) in items)
<div :key="key">
// code
</div>
@endeach
Example with Loop, external component, (bind) (two-way data binding and directive), references and style blocks
<div>
@each(item, key in items)
<nav.container ref="test" :key="item.v" (bind)="vv" transition:classed="fade" lazy>
test {{ item.v }}
</nav.container>
@endeach
<!-- <input type="text" (bind)="vv" ref="input"> -->
{{ vv }}
</div>
<script>
import { bind } from 'sexy-framework/directives'
let items = o([{
v: 'a'
}, {
v: 'b'
}]);
let vv = o('test');
function mounted()
{
}
function unmounted()
{
}
</script>
<style>
.red {
color: rgb(0, 0, 0);
}
</style>
Example events, classes, styles
<div @click="change" :class="[classList, { active: tick === 1 }]" :style="{ fontSize: tick() + 'px' }">
<slot></slot>
</div>
<script>
let tick = o(24);
let test = p(null);
let value = p(null);
let classList = () => {
return {
red: tick() % 2 == 0,
green: tick() % 3 == 0,
some: test() === null,
}
}
function change()
{
$emit('input', 2);
}
function mounted()
{
console.log('container mounted');
}
function unmounted()
{
console.log('container unmounted');
}
</script>
Burkhanov Kirill (kir.burkhanov@gmail.com)
Copyright (c) 2020 Burkhanov Kirill. This is free software, and may be redistributed under the terms specified in the LICENSE file.
Copyright 2014 - 2017 © taobao.org |