@jsenv/dom 0.17.13 → 0.17.15

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.
Files changed (2) hide show
  1. package/dist/jsenv_dom.js +33 -1
  2. package/package.json +1 -1
package/dist/jsenv_dom.js CHANGED
@@ -8951,6 +8951,26 @@ installImportMetaCssBuild(import.meta);/**
8951
8951
  *
8952
8952
  * Whichever trigger fired, it has established the intent: the gesture then
8953
8953
  * starts at the first pixel, without a second threshold to cross.
8954
+ *
8955
+ * WHEN A FINGER MAY TRAVEL TOO: [data-drag-on-contact].
8956
+ *
8957
+ * The wait a finger is asked for is not a rule about fingers, it is the answer to
8958
+ * an ambiguity — travel means scroll as much as it means drag, so the two have to
8959
+ * be told apart. Where nothing scrolls the ambiguity does not exist, and the wait
8960
+ * is asking the hand to prove something nothing else could have meant: inside a
8961
+ * dialog that holds the page still, a finger travelling on a piece can only be
8962
+ * carrying it.
8963
+ *
8964
+ * So the attribute says that place, not that element — put on the dialog, every
8965
+ * source inside it reads by distance like a mouse does, at the same few pixels.
8966
+ * A tap is left alone by that: a press that goes nowhere is still a press, which
8967
+ * is what a piece that is also a link or a card needs.
8968
+ *
8969
+ * It is opt-in and cannot be anything else. Nothing here can see whether the
8970
+ * surroundings scroll — a page scrolls by default, an overflow is one CSS
8971
+ * property away, and getting it wrong the wrong way means the list runs away
8972
+ * under the finger that meant to reorder it. Only the application knows it has
8973
+ * taken the scroll away.
8954
8974
  */
8955
8975
 
8956
8976
  /* At module scope, and on the markers rather than on the pressed element: both
@@ -8993,6 +9013,13 @@ const css$4 = /* css */`
8993
9013
  knows which way what surrounds the source scrolls. */
8994
9014
  touch-action: pan-x pinch-zoom;
8995
9015
  }
9016
+ [data-drag-on-contact] [data-drag-source],
9017
+ [data-drag-source][data-drag-on-contact] {
9018
+ /* Nothing scrolls here, so there is no pan to leave to anyone — the finger
9019
+ may travel from the first pixel. Zoom is kept: it belongs to the reader,
9020
+ not to the gesture, and two fingers are never a drag. */
9021
+ touch-action: pinch-zoom;
9022
+ }
8996
9023
  [data-drag-ignore] {
8997
9024
  -webkit-touch-callout: default;
8998
9025
  touch-action: auto;
@@ -9060,6 +9087,8 @@ const markDragSource = (element, axes) => {
9060
9087
  * distance-based.
9061
9088
  * @param {boolean|"if-touch"} [options.longPress="if-touch"]
9062
9089
  * Which pointers start a drag by holding still instead of by travelling.
9090
+ * `"if-touch"` excepts what stands inside a `[data-drag-on-contact]`, where
9091
+ * nothing scrolls and a finger resolves by distance like a mouse.
9063
9092
  * @param {number} [options.longPressDelay=400]
9064
9093
  * How long (ms) the pointer must stay down. Kept under the system context-menu
9065
9094
  * delay so the object is picked up before the menu would have opened.
@@ -9091,7 +9120,10 @@ const dragAfterIntent = (grabEvent, dragGestureInitializer, {
9091
9120
  startDragGesture(dragGestureInitializer);
9092
9121
  return;
9093
9122
  }
9094
- const startsOnLongPress = longPress === true || longPress === "if-touch" && grabEvent.pointerType === "touch";
9123
+ const startsOnLongPress = longPress === true || longPress === "if-touch" && grabEvent.pointerType === "touch" &&
9124
+ // The wait tells a scroll from a drag, and here there is no scroll to tell
9125
+ // it from — see [data-drag-on-contact] at the top of this file.
9126
+ !(target.closest && target.closest("[data-drag-on-contact]"));
9095
9127
  if (startsOnLongPress) {
9096
9128
  dragAfterLongPress(grabEvent, dragGestureInitializer, {
9097
9129
  longPressDelay,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/dom",
3
- "version": "0.17.13",
3
+ "version": "0.17.15",
4
4
  "type": "module",
5
5
  "description": "DOM utilities for writing frontend code",
6
6
  "repository": {