-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.mask
56 lines (52 loc) · 1.29 KB
/
index.mask
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
define :counter {
function onRenderStart() {
this.model = { counter: 0 };
}
slot increment () {
this.model.counter++;
}
h4 > 'Counter component'
hr;
button x-tap='increment' > tt > 'Increment '
i > '~[bind: counter]'
}
define :fooos {
var name = 'foo';
h4 > 'Make Foooos'
section name='clickable' {
h6 > 'Clickable: click to add `foo`';
.container;
event click (event) {
event
.currentTarget
.querySelector('.container')
.textContent += this.scope.name;
}
}
section name='pressable' {
h6 > 'Pressable: press any key to add `foo`'
input {
event keydown (e) {
e.preventDefault();
// demo, find input via the component (not from the event)
var input = this.$.find('input')[0];
input.value += this.scope.name;
}
}
}
}
define :base {
h4 > 'Inheritance'
i > @body;
}
define :inherited extends :base {
@body {
div > b > 'Italic and Bold with qux: @attr.qux'
div > @content;
}
}
ul {
li name='counter' > :counter;
li name='foos' > :fooos;
li > :inherited qux='Quux' > @content > tt > 'Italic and Teletype';
}