@weft-js/scroll 0.1.4 → 0.1.5-nightly.20261111.4

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.
package/README.md CHANGED
@@ -435,6 +435,9 @@ const list = virtualizer(area.viewport, {
435
435
  `aria-controls`.
436
436
  - **Reduced motion:** with `motion: 'auto'` (the default) and `prefers-reduced-motion: reduce`, animated scrolls
437
437
  are instant, bars stop fading and touch doesn't rubber-band.
438
+ - **Touch screens:** the bars are still this package's, drawn in place of the native ones. With a coarse pointer a
439
+ DOM bar lets the swipes that start at the edge through to the content; its thumb takes a finger only while it
440
+ shows, over a 44 px area. A canvas bar keeps its whole track.
438
441
  - **Right to left:** `x` and `scrollLeft` run from 0 to negative, as the DOM's do. The vertical bar sits at the
439
442
  inline end and the horizontal thumb starts from the right.
440
443
  - **Selection:** dragging a text selection past the edge scrolls toward it, faster further out, and the selection
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weft-js/scroll",
3
- "version": "0.1.4",
3
+ "version": "0.1.5-nightly.20261111.4",
4
4
  "description": "Scrolling in JavaScript: native-feeling wheel, touch, keys and focus, with scrollbars drawn in the DOM or on a canvas",
5
5
  "keywords": [
6
6
  "canvas",
package/styles/scroll.css CHANGED
@@ -157,6 +157,30 @@
157
157
  :where([data-scroll] [data-part='scrollbar'][data-active] > [data-part='thumb']) {
158
158
  background: var(--scroll-active-color, color-mix(in srgb, currentColor 60%, transparent));
159
159
  }
160
+ /* Touch: a bar at the edge mustn't take the swipes that start there. A DOM thumb takes a finger only while it shows,
161
+ over a 44 px area across, wider than it paints; the rest of the bar lets touches through to the content. A canvas bar, with no
162
+ thumb element, keeps its whole track. */
163
+ @media (pointer: coarse) {
164
+ :where([data-scroll] > [data-part='scrollbar']:has(> [data-part='thumb'])) {
165
+ pointer-events: none;
166
+ }
167
+ :where([data-scroll] > [data-part='scrollbar']:is([data-visible], [data-active]) > [data-part='thumb']) {
168
+ pointer-events: auto;
169
+ }
170
+ :where([data-scroll] [data-part='scrollbar'][data-orientation='vertical'] > [data-part='thumb'])::before {
171
+ content: '';
172
+ position: absolute;
173
+ inset-block: -8px;
174
+ inset-inline: -32px -6px;
175
+ }
176
+ :where([data-scroll] [data-part='scrollbar'][data-orientation='horizontal'] > [data-part='thumb'])::before {
177
+ content: '';
178
+ position: absolute;
179
+ inset-block: -32px -6px;
180
+ inset-inline: -8px;
181
+ }
182
+ }
183
+
160
184
  /* Native mode with DOM bars: the viewport's scroll position drives each thumb through a scroll timeline, which the
161
185
  browser runs on the compositor, so the thumb keeps up while the main thread is busy. The script sets the two ends
162
186
  and only sets `data-timeline` where the browser supports it; elsewhere it moves the thumb itself. */