Prop For That is worth copying before it’s worth shipping
Adam Argyle’s Prop For That writes live browser state into CSS custom properties from a data attribute. I’d copy the pattern before shipping the library: half the values CSS already sees on its own, and on a WordPress site the wiring is most of the work.