/** * notion-enhancer * (c) 2023 dragonwocky (https://dragonwocky.me/) * (https://notion-enhancer.github.io/) under the MIT license */ "use strict"; function Checkbox({ _get, _set, _requireReload = true, ...props }) { let _initialValue; const { html, extendProps, setState, useState } = globalThis.__enhancerApi, $input = html``; extendProps($input, { onchange: () => _set?.($input.checked) }); useState(["rerender"], async () => { const checked = (await _get?.()) ?? $input.checked; $input.checked = checked; if (_requireReload) { _initialValue ??= checked; if (checked !== _initialValue) setState({ databaseUpdated: true }); } }); return html``; } export { Checkbox };