New techniques for storing state in querystring

This commit is contained in:
2026-07-12 21:46:53 -05:00
parent 6ce1c39b8d
commit 991ef30013
7 changed files with 717 additions and 305 deletions
+18
View File
@@ -24,6 +24,24 @@ base-128 variable-length integers.
This adaptive layout was adopted before deployment, so it uses serialization
version `1`; no dense-only version 1 URLs need backward compatibility.
### Selectable field encodings
Websites select their encoding with the CheckboxTree `stateEncoding` option.
The value is intentionally not stored in the fragment, so it forms part of the
website's URL-format contract. Version 1 supports:
* `adaptive` (default): adaptive `c` and `x` fields described above
* `dense`: trimmed dense `c` and `x` bitsets
* `tiered`: hierarchical checked fields and depth-grouped expanded fields
In tiered encoding, `c1` stores actual root checked state. Each deeper `cN`
stores whether a node differs from its direct parent's checked state;
restoration uses XOR. Expansion does not inherit from a parent: each `xN` stores
actual expanded state for branches at depth N, with collapsed as the baseline.
Every tier independently uses the adaptive representation. Non-selectable
parents provide a false checked baseline. An `n` field records the manifest slot
coverage at serialization time; slots appended beyond that value restore false.
## 1. Purpose
Implement a compact, shareable, client-side serialization format for storing tree widget state in a URL.