0.1.0 #1

Merged
Thilawyn merged 81 commits from next into master 2025-07-17 21:17:57 +02:00
Showing only changes of commit 708c93ed83 - Show all commits

View File

@@ -58,11 +58,9 @@ export const Todo = Component.make(function* Todo(props: TodoProps) {
onClick={() => Runtime.runSync(runtime)( onClick={() => Runtime.runSync(runtime)(
SubscriptionRef.updateEffect(state.ref, todos => Effect.gen(function*() { SubscriptionRef.updateEffect(state.ref, todos => Effect.gen(function*() {
if (props.index <= 0) return yield* Option.none() if (props.index <= 0) return yield* Option.none()
const toSwapIndex = props.index - 1
const toSwap = yield* Chunk.get(todos, toSwapIndex)
return todos.pipe( return todos.pipe(
Chunk.replace(props.index, toSwap), Chunk.replace(props.index, yield* Chunk.get(todos, props.index - 1)),
Chunk.replace(toSwapIndex, yield* ref), Chunk.replace(props.index - 1, yield* ref),
) )
})) }))
)} )}
@@ -75,11 +73,9 @@ export const Todo = Component.make(function* Todo(props: TodoProps) {
onClick={() => Runtime.runSync(runtime)( onClick={() => Runtime.runSync(runtime)(
SubscriptionRef.updateEffect(state.ref, todos => Effect.gen(function*() { SubscriptionRef.updateEffect(state.ref, todos => Effect.gen(function*() {
if (props.index >= size - 1) return yield* Option.none() if (props.index >= size - 1) return yield* Option.none()
const toSwapIndex = props.index + 1
const toSwap = yield* Chunk.get(todos, toSwapIndex)
return todos.pipe( return todos.pipe(
Chunk.replace(props.index, toSwap), Chunk.replace(props.index, yield* Chunk.get(todos, props.index + 1)),
Chunk.replace(toSwapIndex, yield* ref), Chunk.replace(props.index + 1, yield* ref),
) )
})) }))
)} )}