@usableapp/cardds 0.7.80 → 0.7.81

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.
@@ -26,6 +26,8 @@ export declare function stackPaint(place: StackPlace | undefined, pulling?: bool
26
26
  style?: CSSProperties;
27
27
  busy?: true;
28
28
  };
29
+ /** the head the sheet owns: the card's own child. A card standing in the sheet's body has a head too, and it is that card's */
30
+ export declare const ownHead: (card: Element, target: Element) => Element | null;
29
31
  /**
30
32
  * The card's own pull, refresh and focus. Listeners sit on this card's head and body.
31
33
  * `--_pull` / `--_lift` are written while a finger is down, the same way a single Sheet writes `--_drag`.
@@ -36,6 +36,11 @@ const restPullPx = (card, stack) => {
36
36
  };
37
37
  const readFrame = (el) => { el.getBoundingClientRect(); };
38
38
  const along = (dir, startY, y) => (dir === 'down' ? Math.max(0, y - startY) : Math.max(0, startY - y));
39
+ /** the head the sheet owns: the card's own child. A card standing in the sheet's body has a head too, and it is that card's */
40
+ export const ownHead = (card, target) => {
41
+ const head = target.closest('.card__head');
42
+ return head?.parentElement === card ? head : null;
43
+ };
39
44
  const pullsHead = (target, head) => {
40
45
  if (!(target instanceof Element))
41
46
  return false;
@@ -168,7 +173,7 @@ export function useStackCard(ref, place, swallow) {
168
173
  return;
169
174
  if (scroller.scrollTop > 0)
170
175
  return;
171
- if (e.target instanceof Element && e.target.closest('.card__head'))
176
+ if (e.target instanceof Element && ownHead(card, e.target))
172
177
  return;
173
178
  const slop = pxFromRem(SLOP_REM);
174
179
  const commit = pxFromRem(COMMIT_REM);
@@ -237,7 +242,7 @@ export function useStackCard(ref, place, swallow) {
237
242
  const onTouchStart = (e) => {
238
243
  const t = e.touches[0];
239
244
  const ask = placeRef.current;
240
- const inHead = e.target instanceof Element && !!e.target.closest('.card__head');
245
+ const inHead = e.target instanceof Element && !!ownHead(card, e.target);
241
246
  touch = e.touches.length === 1 && t && ask?.onRefresh && !(ask.open && ask.refreshing) && scroller.scrollTop <= 0 && !inHead
242
247
  ? { x: t.clientX, y: t.clientY, ours: null } : null;
243
248
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usableapp/cardds",
3
- "version": "0.7.80",
3
+ "version": "0.7.81",
4
4
  "license": "UNLICENSED",
5
5
  "type": "module",
6
6
  "description": "card-first mobile design system, React-first: the components in src/ are thin wrappers over the CSS contract (css/*.css stays the only truth); gallery/ shows every story live (npm run dev), tests/ measures the geometry.",