@usableapp/cardds 0.7.117 → 0.7.119

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -53,7 +53,16 @@ export function Card({ tone, paper, sm, row, cover, fold, centre, band, as = 'ar
53
53
  return () => { live = false; };
54
54
  }, [away]);
55
55
  const [go, setGo] = useState(false);
56
- useLayoutEffect(() => { setGo(!turns && own.current != null && goControl(own.current) != null); }); // every render: what the card holds is its children's
56
+ const findGo = useLatest(() => setGo(!turns && own.current != null && goControl(own.current) != null));
57
+ useLayoutEffect(() => findGo.current()); // every render: what the card holds is its children's
58
+ useEffect(() => {
59
+ const card = own.current;
60
+ if (!card)
61
+ return;
62
+ const watch = new MutationObserver(() => findGo.current());
63
+ watch.observe(card, { subtree: true, childList: true, attributes: true, attributeFilter: ['role', 'tabindex', 'href', 'disabled', 'aria-disabled', 'inert'] });
64
+ return () => watch.disconnect();
65
+ }, []);
57
66
  const pressing = useRef(false);
58
67
  const click = (e) => {
59
68
  if (pressing.current)