forked from cyclejs-community/cyclejs-sortable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
41 lines (35 loc) · 970 Bytes
/
index.ts
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
import xs, { Stream } from 'xstream';
import { run } from '@cycle/run';
import { ul, li, div, span, makeDOMDriver, DOMSource, VNode } from '@cycle/dom';
import { makeSortable } from '../../../src/makeSortable';
type Sources = {
DOM : DOMSource;
};
type Sinks = {
DOM : Stream<VNode>;
};
function main({ DOM } : Sources) : Sinks
{
const vdom$ : Stream<VNode> = xs.of(
div([
span('.test', 'Test, should not move'),
ul('.ul', [
li('.class', '', ['Option 1']),
li('.class', '', ['Option 2']),
li('.class', '', ['Option 3']),
li('.class', '', ['Option 4']),
li('.class', '', ['Option 5']),
li('.class', '', ['Option 6']),
])
])
)
.compose(makeSortable<Stream<VNode>>(DOM, {
parentSelector: '.ul'
}));
return {
DOM: vdom$
};
}
run(main, {
DOM: makeDOMDriver('#app')
});