switch over to deep diffing for mutations

This commit is contained in:
Chris Kruining 2024-10-21 14:19:39 +02:00
parent 2e3a3e90de
commit 6064fd3b45
No known key found for this signature in database
GPG key ID: EB894A3560CCCAD2
7 changed files with 228 additions and 88 deletions

View file

@ -65,7 +65,7 @@ export const SelectionProvider: ParentComponent<{ selection?: SelectionHandler,
length,
select(selection, { mode = SelectionMode.Normal } = {}) {
if (props.multiSelect === true && mode === SelectionMode.Normal) {
mode = SelectionMode.Append;
mode = SelectionMode.Toggle;
}
setState('selection', existing => {
@ -238,8 +238,7 @@ export const selectable = (element: HTMLElement, options: Accessor<{ value: obje
const append = Boolean(modifier() & Modifier.Control);
const mode = (() => {
if (append) return SelectionMode.Append;
if (!withRange && isSelected()) return SelectionMode.Toggle;
if (append) return SelectionMode.Toggle;
if (withRange) return SelectionMode.Replace;
return SelectionMode.Normal;
})();