onChange(!value)} />
);
}
function TweakRadio({ label, value, options, onChange }) {
return (
{label}
{options.map((o) => (
))}
);
}
function TweakColor({ label, value, onChange }) {
return (
onChange(e.target.value)} style={{ width: 28, height: 22, border: 0, background: "none", cursor: "pointer", padding: 0 }} />
);
}
function TweakButton({ label, onClick }) {
return (
);
}
function useTweaks(defaults) {
const [tweaks, setTweaks] = useState(defaults);
const setTweak = (key, value) => setTweaks((t) => ({ ...t, [key]: value }));
return [tweaks, setTweak];
}
Object.assign(window, { TweaksPanel, TweakSection, TweakToggle, TweakRadio, TweakColor, TweakButton, useTweaks });