Commit graph

1174 commits

Author SHA1 Message Date
Zixuan Chen
dc55055b6f
Perf cache WASM text toDelta result (#378)
* refactor: make cursor transformation in undo/redo better

* chore: add release info

* perf: cache to_delta value in wasm

* chore: release msg
2024-06-06 16:54:52 +08:00
Zixuan Chen
6d47015f6e
Refactor undo cursor (#377)
* refactor: make cursor transformation in undo/redo better

* chore: add release info
2024-06-06 16:49:36 +08:00
Zixuan Chen
54637a7b42
Publish v0.16.2 to crates.io (#374)
* chore: mark dev-utils not published

* chore: release rust crates

* chore: publish fi

* chore: pre publish fi

* chore: update lockfile

* test: change fuzz rev
2024-05-29 22:55:55 +08:00
Leon Zhao
cd04b27d65
fix: fuzz cache and counter feature (#373)
* fix: fuzz cache and counter feature

* fix: rev
2024-05-29 22:44:21 +08:00
Leon Zhao
4a0c8b6ddd
fix: tree transform when a and b is equal (#371)
* test: add test
2024-05-25 08:32:56 +08:00
github-actions[bot]
7fc85b1b04
chore: version packages (#370)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-05-23 10:28:24 +08:00
Zixuan Chen
6700dad19b
feat: Add event listener and native support of cursor transformation for undo/redo (#369) 2024-05-23 10:19:08 +08:00
github-actions[bot]
c8bbb437ca
chore: version packages (#366)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-05-21 13:12:38 +08:00
Zixuan Chen
1a347cab72
feat: refine undo impl (#365)
* feat: refine undo impl

- Add "unfo" origin for undo and redo event
- Allow users to skip certain local operations
- Skip undo/redo ops that're not visible to users

* feat: add returned bool value to indicate whether undo/redo is executed
2024-05-21 13:08:43 +08:00
Zixuan Chen
c124efc531
chore: update .npmignore 2024-05-21 06:48:45 +08:00
github-actions[bot]
d01fd66e39
chore: version packages (#364)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-05-21 06:40:05 +08:00
Zixuan Chen
321e0e72a4
Undo (#361)
https://github.com/loro-dev/loro/pull/361

---------

Co-authored-by: Leon Zhao <leeeon233@gmail.com>
2024-05-21 06:14:49 +08:00
Leon Zhao
26753f0d4d
fix: better jitter for fractional index (#360)
* fix: better jitter
2024-05-16 15:26:49 +08:00
Leon Zhao
6e14e5b117
Feat: Make the encoding format forward and backward compatible (#329) 2024-05-13 21:37:10 +08:00
Gábor Szabó
d958767b13
add repository to Cargo.toml (#358) 2024-05-10 21:14:17 +08:00
Zixuan Chen
ea7d8b0669
fix: refine error message on corrupted data (#356)
* fix: refine error message on corrupted data

* fix: comment
2024-05-10 11:06:01 +08:00
github-actions[bot]
3f23a67bb4
chore: version packages (#355)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-05-09 16:31:21 +08:00
Zixuan Chen
a9484b48a2
Fix potential movable list bug (#354)
* fix: upgrade wasm-bindgen to fix str free err

* chore: fix ci

* fix: potential bug in movable list op group
2024-05-09 15:46:19 +08:00
Zixuan Chen
0660b1a1be
fix: upgrade wasm-bindgen to fix str free err (#353)
* fix: upgrade wasm-bindgen to fix str free err

* chore: fix ci
2024-05-09 15:22:34 +08:00
Leon Zhao
51a673822e
fix: tree fuzz sort value (#351) 2024-05-07 19:39:38 +08:00
Leon Zhao
fffd49b5fa
Use fractional index to order the children of the tree (#298)
* feat: fractional index

---------

Co-authored-by: Zixuan Chen <remch183@outlook.com>
2024-05-07 14:01:13 +08:00
Zixuan Chen
4021ad820c
chore: loro-rs v0.5.1 2024-05-06 13:37:55 +08:00
Gábor Szabó
93726186c5
add repository field (#350) 2024-05-06 07:43:46 +08:00
github-actions[bot]
da8a0f63e5 chore: version packages 2024-05-04 11:41:30 +08:00
Zixuan Chen
dd8c7f7392
perf: delete span merge err (#348)
* perf: delete span merge err

* fix: slicing of DeleteSpanWIthId

* fix: sliceable err
2024-05-04 11:32:49 +08:00
Zixuan Chen
456ff12503
chore: warn missing debug impl (#347) 2024-05-04 11:32:31 +08:00
Zixuan Chen
659c9c54ea
fix(wasm): movable list .kind() (#342) 2024-05-04 11:32:18 +08:00
github-actions[bot]
307df25691
chore: version packages (#346)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-05-02 16:54:47 +08:00
Zixuan Chen
c2da94a557
fix: upgrade generic-btree to allow large btree (#344) 2024-05-02 16:45:33 +08:00
Leon Zhao
cd8b9a31e7
fix: missing MovableList in all container type (#343) 2024-05-02 11:28:28 +08:00
Zixuan Chen
8bf180827f
fix: get cursor err on text and movable list (#337) 2024-04-29 21:42:50 +08:00
Zixuan Chen
ce178df1e8
docs: minor fix on set_change_merge_interval api (#341) 2024-04-29 21:42:37 +08:00
Zixuan Chen
2918d01906
fix: refine ts type; reject invalid operations (#334) 2024-04-29 21:42:08 +08:00
Zixuan Chen
ca5f762646
fix: impl a few unimplemented! for movable tree (#335) 2024-04-29 21:40:57 +08:00
Zixuan Chen
e5dfded0f3
chore: skip the checking if not debug_assertions (#340) 2024-04-29 21:40:05 +08:00
Zixuan Chen
996ce70e45
docs: add warn(missing_docs) to loro and loro-wasm (#339) 2024-04-29 19:35:21 +08:00
Zixuan Chen
f869b959f3
chore: specify loro-delta version in loro 2024-04-29 18:16:00 +08:00
Zixuan Chen
5660bcc4a5
chore: bump loro-rs to v0.5.0 2024-04-29 18:09:07 +08:00
Leon Zhao
6224974124
chore: rename js toJSON (#338) 2024-04-29 16:23:00 +08:00
Leon Zhao
a1ec948c32
fix: fuzz tree delete nested (#336) 2024-04-28 17:06:47 +08:00
github-actions[bot]
41d198d9e4
chore: version packages (#333)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-04-26 12:29:22 +08:00
Zixuan Chen
31a8569840
Movable List (#293)
* bk: add move op content

* bk: add inner_movable_list diff and related stuff

* perf: high perf state

* fix: update old list item cache

* fix: should use id in del

* feat: two kinds of len for movable list state

* bk: add op index to movable list

* bk: make basic handler test pass

* refactor: add move_from to list event

* fix: make all existing tests pass

* bk: list move event hint into event

* bk: convert inner event into user event

Co-authored-by: Leon <leeeon233@gmail.com>

* fix: convert issue when inserting new value

* feat: add op group for movable list

* feat: diff calc

* feat: add mov support to tracker

* fix: when applying diff, state should be force update

* feat: encoded op

* feat: snapshot encode

* fix: pass basic sync

* fix: snapshot encode/decode

* fix: warnings

* feat: expose mov list to loro crate

* test: fuzz movable list

* test: fix fuzz integration

* fix: movable list basic move sync

* fix: movable list events

* fix: movable event err

* fix: register child container on movable list

* fix: should not return child index if the value is already overwritten

* fix: local event err in movable list

* fix: get elem at pos

* refactor: extract mut op that could break invariants

* fix: event err

* fix: child container to elem err

* fix: bringback event issue

* fix: event err

* fix: event emit

* fix: id to cursor iter issue

* chore: fix a few warnings

* fix: warnings

* fix: fix move in tracker

* test: add consistency check

* test: fix tracker

* refactor: simplify event conversion in docstate

* refactor: refine move event

* refactor: simplify the maintain of parent child links

* fix: revive err

* fix: warnings

* fix: it's possible that pos change but cannot find the respective list item

* fix: elem may be dropped after snapshot

* fix: warnings

* fix: richtext time travel issue

* fix: move op used wrong delete id on tracker

* fix: handle events created by concurrent moves correctly

* fix: event hint error, used op index for list event

* fix: move_from flag err

* fix: id to cursor get err

* test: add mov fuzz target

* fix: the pos of inserting new container

* fix: used wrong event hint index

* fix: del event hint

* fix: warnings

* fix: internal diff to event err

* fix: event's move flag error
This "move" flag does not actually mean that the insertion
is caused by the move op.
就算是 move 造成的它不一定就能是 true
它得是下游真的能在“前一个版本的 array 里找到“,才能是 true

* fix: remove redundant elements from the movable list

The Movable List is currently flawed; an element may not exist on the movable list state, yet there are operations that revive its corresponding list item. In such cases, the diff calculation does not send back the corresponding element state (this occurs when tracing back, which fuzz testing currently does not cover. It might only be exposed by randomly switching to a version and then checking for consistency; otherwise, as long as all elements are in memory, this problem does not arise).

Moreover, there is no need to store elements in the state that do not have a corresponding list item. They will be deleted during the Snapshot, and relying on "them still being in the state" is incorrect behavior. Such adjustments also eliminate the need to maintain the `pending_elements` field.

By allowing the opgroup to record the mapping from pos id to state id, we can ensure that the events sent to the movable list state will include the corresponding state.

Movable List 现在是有错的,elem 可能不存在 movable list state 上,但是又有操作把它对应的 list item 复活了,此时 diff calc 不会把对应 element 状态发送回来(往前回溯的时候会出现,fuzz 现在没覆盖到。得有随意切换一个版本然后 check consistency 才可能会暴露;否则现在大家 elements 都在内存,就没这个问题)

而且我们没有必要在状态中存储没有对应 list item 的 element。在 Snapshot 的时候它们都会被删掉,如果依赖了“它们还会在 state 内”就是错误的行为。这样的调整也让我们不需要去维护 pending_elements 这个 field 了

通过让 opgroup 记录了 pos id → state id 的映射,可以保证发给 movable list state 的事件中会带上对应的 state

* test: make fuzzer stricter

* test: test expectation error

* refactor: rename stable pos to cursor

* tests: chore list bench init

* test: add bench

* bench: add mov & set bench

* feat(wasm): movable list js api

* fix: make movablelist able to attach even if it's already attached & refine the type of subscribe

* fix: remove the loro doc param in .unsub

* refactor: refine ts types and export setContainer api

* chore: fix warnings

* chore: rm debug logs

* perf: reduce mem usage of opgroup

* bench: add list criterion bench

---------

Co-authored-by: Leon <leeeon233@gmail.com>
2024-04-26 12:08:53 +08:00
github-actions[bot]
1b59909490
chore: version packages (#332)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-04-24 19:29:58 +08:00
Leon Zhao
684d121702
fix: insert attach container (#331)
* fix: insert attached container

* test: insert attached container

* test: add more assert for insert container
2024-04-24 16:50:05 +08:00
Zixuan Chen
9d4f7aa8a3
DeltaRope (#327)
* feat: delta rope support init

* perf: use generic-btree v0.9.0

* refactor: improve readability and maintainability

* fix: fix several issues about composing

* fix: a few more issue about composing deletions

* test: rich text

* fix: cover more edge cases

* refactor: use deltarope for list event

* refactor: replace text delta with DeltaRope

* fix: list fuzz err

* fix: safety issue on insert_many

* chore: refine impl of text delta

* refactor: use Replace instead of insert+del in DeltaItem (#330)

* refactor: use Replace instead of insert+del in DeltaItem

* fix: each deltaitem should have non-zero rle_len
Updated generic-btree dependency to version 0.10.3 and refactored DeltaItem and DeltaRope implementations in loro-delta. Refine compose impl

* fix: update generic-btree to fix the update leaf issue

* chore: lockfile

* chore: clippy fix

* refactor: make composing easier to understand

* refactor: simplify the impl of composing
2024-04-24 13:53:26 +08:00
Zixuan Chen
f99bfd8e21
Refactor rm unused code (#328)
* chore: init

* fix: fuzz config

* refactor: rm unused code
2024-04-22 21:20:00 +08:00
github-actions[bot]
4700ead1c1
chore: version packages (#326)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-04-18 19:56:47 +08:00
Zixuan Chen
a32b75ad3b
fix(js): allow convert from undefined to LoroValue (#323) 2024-04-18 09:47:00 +08:00
Zixuan Chen
2fc44206fb
Fix rich text cursor pos (#324)
* test: add text cursor test

* fix: should return event index
2024-04-18 09:46:50 +08:00
github-actions[bot]
e8352ad38d
chore: version packages (#321)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-04-17 15:15:17 +08:00