Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@
"@solid-primitives/video": "0.0.100",
"@solid-primitives/async": "0.0.100",
"@solid-primitives/url": "0.1.0",
"@solid-primitives/favicon": "0.0.100"
"@solid-primitives/favicon": "0.0.100",
"@solid-primitives/sortable": "0.0.100"
},
"changesets": [
"a11y-dataset-hydration-safety",
Expand Down Expand Up @@ -208,6 +209,7 @@
"signal-builders-solid2-migration",
"signal-builders-toggle",
"solid-2-beta-20-upgrade",
"sortable-initial",
"spring-solid2-migration",
"sse-solid2-async-reactivity",
"state-machine-solid2-migration",
Expand Down
43 changes: 43 additions & 0 deletions packages/sortable/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# @solid-primitives/sortable

## 1.0.0-next.0

### Major Changes

- a402fce: Initial release of `@solid-primitives/sortable`

Reactive sorting primitives, combining ideas from VueUse's `useSorted` and d3-array's comparator
utilities, built directly on Solid 2.0's `mapArray` and `createProjection` rather than a bespoke
diffing engine.

### `ascending` / `descending` / `by` / `combine` / `reverse`

Comparator building blocks. `ascending`/`descending` always sort `null`/`undefined`/`NaN` to the
end, regardless of direction — unlike a naive `a < b ? -1 : a > b ? 1 : 0`, which silently treats
them as equal to everything. `by` derives a comparator from a key accessor; `combine` composes
comparators for multi-key tie-breaking; `reverse` flips any comparator.

### `makeSorted` / `createSorted`

Non-reactive and reactive sort. `createSorted`'s default path (a static comparator, non-`dirty`)
delegates directly to `@solid-primitives/signal-builders`'s existing `sort()`. It adds a reactive
comparator (an accessor, so toggling sort direction/column doesn't rebuild the primitive) and a
`dirty: true` option that sorts the source array in place and reuses its reference — mirroring
VueUse's `useSorted`'s `dirty` option under Solid's signal model.

### `sortedIndex` / `sortedIndexBy` / `insertSorted`

Binary search over an already-sorted array, and an O(log n) immutable insert — versus an
O(n log n) full re-sort for a single insertion.

### `createSortedIndex`

Per-item reactive rank tracking: an item's index accessor only updates when _that item's_ position
actually changes, never for unrelated moves elsewhere in the list. Built on `mapArray` — the same
core primitive that powers `<For>` — rather than a hand-rolled diffing engine.

### `createSortedProjection`

A store-shaped sorted view, reconciled by key via `createProjection`, so unrelated rows don't
notify when one row's data changes. Pairs naturally with `<For each={projection} keyed={...}>` for
move-not-recreate DOM behavior with no bespoke tracking code.
2 changes: 1 addition & 1 deletion packages/sortable/deno.jsonc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@solid-primitives/sortable",
"version": "0.0.100",
"version": "1.0.0-next.0",
"description": "Reactive sorting primitives — comparators, reactive sort, sorted search/insert, and granular per-item rank tracking.",
"license": "MIT",
"exports": "./src/index.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/sortable/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@solid-primitives/sortable",
"version": "0.0.100",
"version": "1.0.0-next.0",
"description": "Reactive sorting primitives — comparators, reactive sort, sorted search/insert, and granular per-item rank tracking.",
"author": "David Di Biase <dave@solidjs.com>",
"contributors": [],
Expand Down