Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.
JavaScript apple-watchbodyweightdockerfitnessfitness-trackergymhealthiosmcpnodejspasskeysprogressive-web-applicationspwareactself-hostedself-hostingvitewebauthnweightliftingworkout-tracker
Swipe rows: no layout read per move, and a layer only while a row moves (#431)
Duarte Santoscf76ae3c1222
diff --git a/frontend/src/index.css b/frontend/src/index.cssindex f412a83b0..06cc836c3 100644--- a/frontend/src/index.css+++ b/frontend/src/index.css@@ -1101,7 +1101,9 @@ body.chips-dragging *{cursor:inherit}.swrow.dragging{-webkit-user-select:none;user-select:none}/* Plan's lists (v1.3.11): the row is a whole .item card, so the swipe clips to the card's corners */.swrow.swrow-item{border-radius:var(--r-card)}-.swfront{position:relative;z-index:1;background:var(--surface);will-change:transform}+.swfront{position:relative;z-index:1;background:var(--surface)}+/* Its own layer only while it moves: on every row it was a layer per set (#431). */+.swrow.dragging .swfront,.swrow.go-del .swfront,.swrow.go-cp .swfront{will-change:transform}.swpane{position:absolute;top:0;bottom:0;width:0;overflow:hidden;z-index:0}.swpane.del{inset-inline-end:0;background:color-mix(in srgb,var(--red) 22%,var(--surface))}.swpane.cp{inset-inline-start:0;background:var(--acc-soft)}diff --git a/frontend/src/lib/use-swipe-row.js b/frontend/src/lib/use-swipe-row.jsindex 59f3baf1f..c5d3469b8 100644--- a/frontend/src/lib/use-swipe-row.js+++ b/frontend/src/lib/use-swipe-row.js@@ -172,7 +172,9 @@ export function useSwipeRow({ canDelete = true, canCopy = true, canSwipe, onCommconst paint = useCallback((off, ms = 0) => {const outer = outerRef.current, front = frontRef.currentif (!outer || !front) return- const w = outer.clientWidth || 1+ // Mid-drag the row's width is the one read as the swipe locked: reading it again on every+ // move, right after the last move wrote the panes' widths, forced a layout per frame (#431).+ const w = g.current?.w || outer.clientWidth || 1const copy = props.current.canCopy !== falseconst prevArmed = armedFor(o.current, w, copy)o.current = off@@ -317,6 +319,7 @@ export function useSwipeRow({ canDelete = true, canCopy = true, canSwipe, onCommif (axis === 'y') { g.current = null; return }if (props.current.canSwipe && !props.current.canSwipe()) { g.current = null; return }d.lock = 'x'+ d.w = outerRef.current?.clientWidth || 1try { outerRef.current?.setPointerCapture?.(e.pointerId) } catch { /* the gesture still tracks */ }swallowNextClick()const a = typeof document !== 'undefined' ? document.activeElement : null@@ -333,7 +336,7 @@ export function useSwipeRow({ canDelete = true, canCopy = true, canSwipe, onCommconst now = e.timeStamp || Date.now()d.samples.push([now, logical])while (d.samples.length > 2 && now - d.samples[0][0] > 100) d.samples.shift()- const w = outerRef.current?.clientWidth || 1+ const w = d.w || outerRef.current?.clientWidth || 1paint(Math.max(-w, Math.min(w, shapeOffset(d.o0 + logical, w, props.current.canCopy !== false))))}const end = (e, cancelled) => {