import * as React from 'react'; import { PROP_PREFIX, stripProps, useParamWriter, useRoute } from '~/router'; import type { Axes, AxisValue, Entry, PropBag } from '~/registry/types'; /** * The playground's props, in the URL. * * A component page used to hold its `PropBag` in `useState`, which made the one * thing people actually want to send each other — *this* Button, outline, green, * large, disabled — the one thing the site could not link to. The bag now lives * in the hash as `p.=`, so `chrome/ui/share.tsx` has something to copy * and a reload keeps what you built. * * Three rules, each of them load-bearing: * * - **A value equal to the entry's default is not written.** Same rule as * `useParam`'s `fallback`, and for the same reason: an untouched playground * should hand you a clean link, not a URL restating every default. * * - **Decoding goes through `entry.axes`.** The URL only holds strings; the axis * holds the real values, so `values.find(v => String(v) === raw)` gives back * the number `3` rather than `"3"` — the same trick the `