@jsenv/dom 0.17.33 → 0.17.35

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 +382 -478
  2. package/package.json +1 -1
package/dist/jsenv_dom.js CHANGED
@@ -4896,9 +4896,18 @@ const findFocusable = (element, { exclude } = {}) => {
4896
4896
  return focusableDescendant;
4897
4897
  };
4898
4898
 
4899
- // note: keep in mind that an element with overflow: 'hidden' is scrollable
4900
- // it can be scrolled using keyboard arrows or JavaScript properties such as scrollTop, scrollLeft
4901
- // the only overflow that prevents scroll is "visible"
4899
+ // `hidden` and `clip` both cut the content off and are two different things
4900
+ // here, which is what `includeHidden` is about:
4901
+ // - `hidden` IS a scroll container. Nothing scrolls it by hand, but keyboard
4902
+ // arrows and scrollTop/scrollLeft do, so whoever cares where an element can
4903
+ // be brought into view has to count it.
4904
+ // - `clip` is not one. It clips and stops there: it has no scroll box at all,
4905
+ // and scrollTop/scrollLeft on it read back 0 whatever they are set to. That
4906
+ // is the whole reason a layout reaches for it (see navi's
4907
+ // docs/MOBILE_LAYOUT_PITFALLS.md), so it is never included, whatever the
4908
+ // caller asks for.
4909
+ // `visible` is the other non-scrolling value, and the only one on which the
4910
+ // content still reaches the ancestors.
4902
4911
  const isScrollable = (element, { includeHidden } = {}) => {
4903
4912
  if (canHaveVerticalScroll(element, { includeHidden })) {
4904
4913
  return true;
@@ -4940,7 +4949,10 @@ const canHaveVerticalScroll = (element, { includeHidden }) => {
4940
4949
  }
4941
4950
  return false;
4942
4951
  }
4943
- if (verticalOverflow === "hidden" || verticalOverflow === "clip") {
4952
+ if (verticalOverflow === "clip") {
4953
+ return false;
4954
+ }
4955
+ if (verticalOverflow === "hidden") {
4944
4956
  return includeHidden;
4945
4957
  }
4946
4958
  const overflow = getStyle(element, "overflow");
@@ -4951,7 +4963,10 @@ const canHaveVerticalScroll = (element, { includeHidden }) => {
4951
4963
  }
4952
4964
  return false;
4953
4965
  }
4954
- if (overflow === "hidden" || overflow === "clip") {
4966
+ if (overflow === "clip") {
4967
+ return false;
4968
+ }
4969
+ if (overflow === "hidden") {
4955
4970
  return includeHidden;
4956
4971
  }
4957
4972
  return true; // "auto", "scroll"
@@ -4965,7 +4980,10 @@ const canHaveHorizontalScroll = (element, { includeHidden }) => {
4965
4980
  }
4966
4981
  return false;
4967
4982
  }
4968
- if (horizontalOverflow === "hidden" || horizontalOverflow === "clip") {
4983
+ if (horizontalOverflow === "clip") {
4984
+ return false;
4985
+ }
4986
+ if (horizontalOverflow === "hidden") {
4969
4987
  return includeHidden;
4970
4988
  }
4971
4989
  const overflow = getStyle(element, "overflow");
@@ -4976,7 +4994,10 @@ const canHaveHorizontalScroll = (element, { includeHidden }) => {
4976
4994
  }
4977
4995
  return false;
4978
4996
  }
4979
- if (overflow === "hidden" || overflow === "clip") {
4997
+ if (overflow === "clip") {
4998
+ return false;
4999
+ }
5000
+ if (overflow === "hidden") {
4980
5001
  return includeHidden;
4981
5002
  }
4982
5003
  return true; // "auto", "scroll"
@@ -8405,26 +8426,16 @@ installImportMetaCssBuild(import.meta);/**
8405
8426
  * donc juste x/y ca seras surement mieux
8406
8427
  *
8407
8428
  */
8408
- const css$5 = /* css */`
8409
- .navi_drag_gesture_backdrop {
8410
- position: fixed;
8411
- inset: 0;
8412
- /* A finger dragging must not also pan the page under it. The backdrop is
8413
- the only element the finger can be over once the gesture is running. */
8414
- touch-action: none;
8415
- user-select: none;
8416
- }
8417
- /* Chrome matches :focus-visible on a programmatic focus, so focusing what the
8418
- gesture holds draws a ring around an object the user already has under the
8419
- pointer — a frame blinking for the length of the gesture, saying something
8420
- the finger knows. The ring stays whole where it earns its place: at the
8421
- keyboard, outside any gesture.
8422
- focus({ focusVisible: false }) would say the intent better but does not
8423
- hold — Chrome's heuristic does not always obey the option (see
8424
- isMatchingFocusVisible). */
8425
- [data-drag-focus]:focus-visible {
8426
- outline: none;
8427
- }
8429
+ const css$5 = /* css */`.navi_drag_gesture_backdrop {
8430
+ touch-action: none;
8431
+ user-select: none;
8432
+ position: fixed;
8433
+ inset: 0;
8434
+ }
8435
+
8436
+ [data-drag-focus]:focus-visible {
8437
+ outline: none;
8438
+ }
8428
8439
  `;
8429
8440
  import.meta.css = [css$5, "@jsenv/dom/src/interaction/drag/drag_gesture.js"];
8430
8441
 
@@ -9451,45 +9462,30 @@ installImportMetaCssBuild(import.meta);/**
9451
9462
  lets the page scroll and still makes the refusal effective — provided the
9452
9463
  listener that will refuse is already known too, which is markDragSource's
9453
9464
  half of the same rule. */
9454
- const css$4 = /* css */`
9455
- [data-drag-handle],
9456
- [data-drag-source] {
9457
- -webkit-touch-callout: none;
9458
- }
9459
- [data-drag-handle] {
9460
- /* A dedicated handle has nothing to share: it takes the gesture on contact. */
9461
- touch-action: none;
9462
- }
9463
- [data-drag-source] {
9464
- /* A source taken by long press must let the scroll through until the grab —
9465
- which is exactly what the long press is there to tell apart. Zoom has
9466
- nothing to do with the gesture and nobody should lose it by resting a
9467
- finger on a word.
9468
-
9469
- Vertical, because that is the way the page and the lists in it go: a
9470
- source dragged along one axis is surrounded by something scrolling along
9471
- that same axis (a row of a list runs the way the list scrolls), and a
9472
- source dragged both ways sits on the usual vertical page. */
9473
- touch-action: pan-y pinch-zoom;
9474
- }
9475
- [data-drag-source="x"] {
9476
- /* …and the sideways one, for the same reason read the other way. */
9477
- touch-action: pan-x pinch-zoom;
9478
- }
9479
- [data-drag-on-contact] [data-drag-source],
9480
- [data-drag-source][data-drag-on-contact] {
9481
- /* Nothing scrolls here, so there is no pan to leave to anyone — the finger
9482
- may travel from the first pixel. Zoom is kept: it belongs to the reader,
9483
- not to the gesture, and two fingers are never a drag. */
9484
- touch-action: pinch-zoom;
9485
- }
9486
- [data-drag-ignore],
9487
- [data-own-target],
9488
- [data-drag-source] [popover],
9489
- [data-drag-source] dialog {
9490
- -webkit-touch-callout: default;
9491
- touch-action: auto;
9492
- }
9465
+ const css$4 = /* css */`[data-drag-handle], [data-drag-source] {
9466
+ -webkit-touch-callout: none;
9467
+ }
9468
+
9469
+ [data-drag-handle] {
9470
+ touch-action: none;
9471
+ }
9472
+
9473
+ [data-drag-source] {
9474
+ touch-action: pan-y pinch-zoom;
9475
+ }
9476
+
9477
+ [data-drag-source="x"] {
9478
+ touch-action: pan-x pinch-zoom;
9479
+ }
9480
+
9481
+ [data-drag-on-contact] [data-drag-source], [data-drag-source][data-drag-on-contact] {
9482
+ touch-action: pinch-zoom;
9483
+ }
9484
+
9485
+ [data-drag-ignore], [data-own-target], [data-drag-source] [popover], [data-drag-source] dialog {
9486
+ -webkit-touch-callout: default;
9487
+ touch-action: auto;
9488
+ }
9493
9489
  `;
9494
9490
  import.meta.css = [css$4, "@jsenv/dom/src/interaction/drag/drag_after_intent.js"];
9495
9491
 
@@ -10202,20 +10198,19 @@ const getDragCoordinates = (
10202
10198
  return [leftRelativeToScrollContainer, topRelativeToScrollContainer];
10203
10199
  };
10204
10200
 
10205
- installImportMetaCssBuild(import.meta);const css$3 = /* css */`
10206
- .navi_constraint_feedback_line {
10207
- position: fixed;
10208
- z-index: 9998;
10209
- border-top: 2px dotted rgba(59, 130, 246, 0.7);
10210
- visibility: hidden;
10211
- transform-origin: left center;
10212
- transition: opacity 0.15s ease;
10213
- pointer-events: none;
10214
- }
10201
+ installImportMetaCssBuild(import.meta);const css$3 = /* css */`.navi_constraint_feedback_line {
10202
+ z-index: 9998;
10203
+ visibility: hidden;
10204
+ transform-origin: 0;
10205
+ pointer-events: none;
10206
+ border-top: 2px dotted #3b82f6b3;
10207
+ transition: opacity .15s;
10208
+ position: fixed;
10209
+ }
10215
10210
 
10216
- .navi_constraint_feedback_line[data-visible] {
10217
- visibility: visible;
10218
- }
10211
+ .navi_constraint_feedback_line[data-visible] {
10212
+ visibility: visible;
10213
+ }
10219
10214
  `;
10220
10215
  const setupConstraintFeedbackLine = () => {
10221
10216
  import.meta.css = [css$3, "@jsenv/dom/src/interaction/drag/constraint_feedback_line.js"];
@@ -10298,191 +10293,172 @@ let currentDebugMarkers = [];
10298
10293
  let currentConstraintMarkers = [];
10299
10294
  let currentReferenceElementMarker = null;
10300
10295
  let currentElementMarker = null;
10301
- const css$2 = /* css */`
10302
- .navi_debug_markers_container {
10303
- position: fixed;
10304
- top: 0;
10305
- left: 0;
10306
- z-index: 999998;
10307
- width: 100vw;
10308
- height: 100vh;
10309
- pointer-events: none;
10310
- overflow: hidden;
10311
- --marker-size: ${MARKER_SIZE}px;
10312
- }
10313
-
10314
- .navi_debug_marker {
10315
- position: absolute;
10316
- pointer-events: none;
10317
- }
10318
-
10319
- /* Markers based on side rather than orientation */
10320
- .navi_debug_marker[data-left],
10321
- .navi_debug_marker[data-right] {
10322
- width: var(--marker-size);
10323
- height: 100vh;
10324
- }
10325
-
10326
- .navi_debug_marker[data-top],
10327
- .navi_debug_marker[data-bottom] {
10328
- width: 100vw;
10329
- height: var(--marker-size);
10330
- }
10331
-
10332
- /* Gradient directions based on side, using CSS custom properties for color */
10333
- .navi_debug_marker[data-left] {
10334
- background: linear-gradient(
10335
- to right,
10336
- rgba(from var(--marker-color) r g b / 0.9) 0%,
10337
- rgba(from var(--marker-color) r g b / 0.7) 30%,
10338
- rgba(from var(--marker-color) r g b / 0.3) 70%,
10339
- rgba(from var(--marker-color) r g b / 0) 100%
10340
- );
10341
- }
10296
+ const css$2 = /* css */`.navi_debug_markers_container {
10297
+ z-index: 999998;
10298
+ pointer-events: none;
10299
+ --marker-size: ${MARKER_SIZE}px;
10300
+ width: 100vw;
10301
+ height: 100vh;
10302
+ position: fixed;
10303
+ top: 0;
10304
+ left: 0;
10305
+ overflow: hidden;
10306
+ }
10342
10307
 
10343
- .navi_debug_marker[data-right] {
10344
- background: linear-gradient(
10345
- to left,
10346
- rgba(from var(--marker-color) r g b / 0.9) 0%,
10347
- rgba(from var(--marker-color) r g b / 0.7) 30%,
10348
- rgba(from var(--marker-color) r g b / 0.3) 70%,
10349
- rgba(from var(--marker-color) r g b / 0) 100%
10350
- );
10351
- }
10308
+ .navi_debug_marker {
10309
+ pointer-events: none;
10310
+ position: absolute;
10311
+ }
10352
10312
 
10353
- .navi_debug_marker[data-top] {
10354
- background: linear-gradient(
10355
- to bottom,
10356
- rgba(from var(--marker-color) r g b / 0.9) 0%,
10357
- rgba(from var(--marker-color) r g b / 0.7) 30%,
10358
- rgba(from var(--marker-color) r g b / 0.3) 70%,
10359
- rgba(from var(--marker-color) r g b / 0) 100%
10360
- );
10361
- }
10313
+ .navi_debug_marker[data-left], .navi_debug_marker[data-right] {
10314
+ width: var(--marker-size);
10315
+ height: 100vh;
10316
+ }
10362
10317
 
10363
- .navi_debug_marker[data-bottom] {
10364
- background: linear-gradient(
10365
- to top,
10366
- rgba(from var(--marker-color) r g b / 0.9) 0%,
10367
- rgba(from var(--marker-color) r g b / 0.7) 30%,
10368
- rgba(from var(--marker-color) r g b / 0.3) 70%,
10369
- rgba(from var(--marker-color) r g b / 0) 100%
10370
- );
10371
- }
10318
+ .navi_debug_marker[data-top], .navi_debug_marker[data-bottom] {
10319
+ width: 100vw;
10320
+ height: var(--marker-size);
10321
+ }
10372
10322
 
10373
- .navi_debug_marker_label {
10374
- position: absolute;
10375
- padding: 2px 6px;
10376
- color: rgb(from var(--marker-color) r g b / 1);
10377
- font-weight: bold;
10378
- font-size: 12px;
10379
- white-space: nowrap;
10380
- background: rgba(255, 255, 255, 0.9);
10381
- border: 1px solid;
10382
- border-color: rgb(from var(--marker-color) r g b / 1);
10383
- border-radius: 3px;
10384
- pointer-events: none;
10385
- }
10386
-
10387
- /* Label positioning based on side data attributes */
10388
-
10389
- /* Left side markers - vertical with 90° rotation */
10390
- .navi_debug_marker[data-left] .navi_debug_marker_label {
10391
- top: 20px;
10392
- left: 10px;
10393
- transform: rotate(90deg);
10394
- transform-origin: left center;
10395
- }
10396
-
10397
- /* Right side markers - vertical with -90° rotation */
10398
- .navi_debug_marker[data-right] .navi_debug_marker_label {
10399
- top: 20px;
10400
- right: 10px;
10401
- left: auto;
10402
- transform: rotate(-90deg);
10403
- transform-origin: right center;
10404
- }
10405
-
10406
- /* Top side markers - horizontal, label on the line */
10407
- .navi_debug_marker[data-top] .navi_debug_marker_label {
10408
- top: 0px;
10409
- left: 20px;
10410
- }
10411
-
10412
- /* Bottom side markers - horizontal, label on the line */
10413
- .navi_debug_marker[data-bottom] .navi_debug_marker_label {
10414
- top: auto;
10415
- bottom: 0px;
10416
- left: 20px;
10417
- }
10418
-
10419
- .navi_obstacle_marker {
10420
- position: absolute;
10421
- z-index: 9999;
10422
- background-color: orange;
10423
- opacity: 0.6;
10424
- pointer-events: none;
10425
- }
10426
-
10427
- .navi_obstacle_marker_label {
10428
- position: absolute;
10429
- top: 50%;
10430
- left: 50%;
10431
- color: white;
10432
- font-weight: bold;
10433
- font-size: 12px;
10434
- text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.8);
10435
- transform: translate(-50%, -50%);
10436
- pointer-events: none;
10437
- }
10438
-
10439
- .navi_element_marker {
10440
- position: absolute;
10441
- z-index: 9997;
10442
- background-color: var(--element-color-alpha, rgba(255, 0, 150, 0.3));
10443
- border: 2px solid var(--element-color, rgb(255, 0, 150));
10444
- opacity: 0.9;
10445
- pointer-events: none;
10446
- }
10447
-
10448
- .navi_element_marker_label {
10449
- position: absolute;
10450
- top: -25px;
10451
- right: 0;
10452
- padding: 2px 6px;
10453
- color: var(--element-color, rgb(255, 0, 150));
10454
- font-weight: bold;
10455
- font-size: 11px;
10456
- white-space: nowrap;
10457
- background: rgba(255, 255, 255, 0.9);
10458
- border: 1px solid var(--element-color, rgb(255, 0, 150));
10459
- border-radius: 3px;
10460
- pointer-events: none;
10461
- }
10462
-
10463
- .navi_reference_element_marker {
10464
- position: absolute;
10465
- z-index: 9998;
10466
- background-color: rgba(0, 150, 255, 0.3);
10467
- border: 2px dashed rgba(0, 150, 255, 0.7);
10468
- opacity: 0.8;
10469
- pointer-events: none;
10470
- }
10471
-
10472
- .navi_reference_element_marker_label {
10473
- position: absolute;
10474
- top: -25px;
10475
- left: 0;
10476
- padding: 2px 6px;
10477
- color: rgba(0, 150, 255, 1);
10478
- font-weight: bold;
10479
- font-size: 11px;
10480
- white-space: nowrap;
10481
- background: rgba(255, 255, 255, 0.9);
10482
- border: 1px solid rgba(0, 150, 255, 0.7);
10483
- border-radius: 3px;
10484
- pointer-events: none;
10485
- }
10323
+ .navi_debug_marker[data-left] {
10324
+ background: linear-gradient(to right,
10325
+ rgba(from var(--marker-color) r g b / .9) 0%,
10326
+ rgba(from var(--marker-color) r g b / .7) 30%,
10327
+ rgba(from var(--marker-color) r g b / .3) 70%,
10328
+ rgba(from var(--marker-color) r g b / 0) 100%);
10329
+ }
10330
+
10331
+ .navi_debug_marker[data-right] {
10332
+ background: linear-gradient(to left,
10333
+ rgba(from var(--marker-color) r g b / .9) 0%,
10334
+ rgba(from var(--marker-color) r g b / .7) 30%,
10335
+ rgba(from var(--marker-color) r g b / .3) 70%,
10336
+ rgba(from var(--marker-color) r g b / 0) 100%);
10337
+ }
10338
+
10339
+ .navi_debug_marker[data-top] {
10340
+ background: linear-gradient(to bottom,
10341
+ rgba(from var(--marker-color) r g b / .9) 0%,
10342
+ rgba(from var(--marker-color) r g b / .7) 30%,
10343
+ rgba(from var(--marker-color) r g b / .3) 70%,
10344
+ rgba(from var(--marker-color) r g b / 0) 100%);
10345
+ }
10346
+
10347
+ .navi_debug_marker[data-bottom] {
10348
+ background: linear-gradient(to top,
10349
+ rgba(from var(--marker-color) r g b / .9) 0%,
10350
+ rgba(from var(--marker-color) r g b / .7) 30%,
10351
+ rgba(from var(--marker-color) r g b / .3) 70%,
10352
+ rgba(from var(--marker-color) r g b / 0) 100%);
10353
+ }
10354
+
10355
+ .navi_debug_marker_label {
10356
+ color: rgb(from var(--marker-color) r g b / 1);
10357
+ white-space: nowrap;
10358
+ border: 1px solid;
10359
+ border-color: rgb(from var(--marker-color) r g b / 1);
10360
+ pointer-events: none;
10361
+ background: #ffffffe6;
10362
+ border-radius: 3px;
10363
+ padding: 2px 6px;
10364
+ font-size: 12px;
10365
+ font-weight: bold;
10366
+ position: absolute;
10367
+ }
10368
+
10369
+ .navi_debug_marker[data-left] .navi_debug_marker_label {
10370
+ transform-origin: 0;
10371
+ top: 20px;
10372
+ left: 10px;
10373
+ transform: rotate(90deg);
10374
+ }
10375
+
10376
+ .navi_debug_marker[data-right] .navi_debug_marker_label {
10377
+ transform-origin: 100%;
10378
+ top: 20px;
10379
+ left: auto;
10380
+ right: 10px;
10381
+ transform: rotate(-90deg);
10382
+ }
10383
+
10384
+ .navi_debug_marker[data-top] .navi_debug_marker_label {
10385
+ top: 0;
10386
+ left: 20px;
10387
+ }
10388
+
10389
+ .navi_debug_marker[data-bottom] .navi_debug_marker_label {
10390
+ top: auto;
10391
+ bottom: 0;
10392
+ left: 20px;
10393
+ }
10394
+
10395
+ .navi_obstacle_marker {
10396
+ z-index: 9999;
10397
+ opacity: .6;
10398
+ pointer-events: none;
10399
+ background-color: orange;
10400
+ position: absolute;
10401
+ }
10402
+
10403
+ .navi_obstacle_marker_label {
10404
+ color: #fff;
10405
+ text-shadow: 1px 1px 1px #000c;
10406
+ pointer-events: none;
10407
+ font-size: 12px;
10408
+ font-weight: bold;
10409
+ position: absolute;
10410
+ top: 50%;
10411
+ left: 50%;
10412
+ transform: translate(-50%, -50%);
10413
+ }
10414
+
10415
+ .navi_element_marker {
10416
+ z-index: 9997;
10417
+ background-color: var(--element-color-alpha, #ff00964d);
10418
+ border: 2px solid var(--element-color, #ff0096);
10419
+ opacity: .9;
10420
+ pointer-events: none;
10421
+ position: absolute;
10422
+ }
10423
+
10424
+ .navi_element_marker_label {
10425
+ color: var(--element-color, #ff0096);
10426
+ white-space: nowrap;
10427
+ border: 1px solid var(--element-color, #ff0096);
10428
+ pointer-events: none;
10429
+ background: #ffffffe6;
10430
+ border-radius: 3px;
10431
+ padding: 2px 6px;
10432
+ font-size: 11px;
10433
+ font-weight: bold;
10434
+ position: absolute;
10435
+ top: -25px;
10436
+ right: 0;
10437
+ }
10438
+
10439
+ .navi_reference_element_marker {
10440
+ z-index: 9998;
10441
+ opacity: .8;
10442
+ pointer-events: none;
10443
+ background-color: #0096ff4d;
10444
+ border: 2px dashed #0096ffb3;
10445
+ position: absolute;
10446
+ }
10447
+
10448
+ .navi_reference_element_marker_label {
10449
+ color: #0096ff;
10450
+ white-space: nowrap;
10451
+ pointer-events: none;
10452
+ background: #ffffffe6;
10453
+ border: 1px solid #0096ffb3;
10454
+ border-radius: 3px;
10455
+ padding: 2px 6px;
10456
+ font-size: 11px;
10457
+ font-weight: bold;
10458
+ position: absolute;
10459
+ top: -25px;
10460
+ left: 0;
10461
+ }
10486
10462
  `;
10487
10463
  const setupDragDebugMarkers = (dragGesture, {
10488
10464
  referenceElement
@@ -11818,222 +11794,151 @@ const dragStyleController = createStyleController("drag_to_move");
11818
11794
  const TOSS_DURATION_MS = 320;
11819
11795
  // Far enough to be off any screen, in the direction the hand was going.
11820
11796
  const TOSS_DISTANCE = 900;
11821
- const css$1 = /* css */`
11822
- /* IT COSTS THE LIST NOTHING: the hint lands on the edge of a row, which for
11823
- the last one is the very bottom of the scroll area — a line taking up room
11824
- there would push the scrollable area a few pixels further and make a
11825
- scrollbar appear (or hide the hint under it) exactly when one is trying to
11826
- drop at the end. Being fixed is what avoids it: a fixed box has the
11827
- viewport as containing block, so it is left out of the scrollable overflow
11828
- of every ancestor and can overhang the list freely. Same for the clone it
11829
- accompanies. */
11830
- .navi_drop_hint {
11831
- /* A popover, so it lands in the top layer: no z-index to bid against the
11832
- page, and nothing it can be hidden behind. Shown BEFORE the clone, which
11833
- is what puts the clone above it — the top layer stacks in the order
11834
- things are shown, and the item being carried should pass over the line
11835
- rather than under it. The UA styles for [popover] have to be undone:
11836
- inset:0, margin:auto, a border and a background of its own. */
11837
- position: fixed;
11838
- inset: auto;
11839
- top: var(--drop-hint-y);
11840
- left: calc(var(--drop-target-left) + var(--drop-hint-margin-x, 0px));
11841
- display: none;
11842
- box-sizing: border-box;
11843
- width: calc(var(--drop-target-width) - 2 * var(--drop-hint-margin-x, 0px));
11844
- height: var(--drop-hint-size, 3px);
11845
- margin: 0;
11846
- padding: 0;
11847
- color: inherit;
11848
- background: var(--drop-hint-background-color, #4476ff);
11849
- border: none;
11850
- border-radius: var(--drop-hint-border-radius, 2px);
11851
- transform: translateY(-50%);
11852
- pointer-events: none;
11853
- overflow: visible;
11854
- }
11855
- .navi_drop_hint[data-drop-edge]:popover-open {
11856
- display: block;
11857
- }
11858
- .navi_drop_hint[data-drop-edge="top"] {
11859
- --drop-hint-y: calc(
11860
- var(--drop-target-top) - var(--drop-hint-margin-y, 0px)
11861
- );
11862
- }
11863
- .navi_drop_hint[data-drop-edge="bottom"] {
11864
- --drop-hint-y: calc(
11865
- var(--drop-target-bottom) + var(--drop-hint-margin-y, 0px)
11866
- );
11867
- }
11868
- /* A chevron at each end, pointing in: the line alone is easy to lose against
11869
- a list of borders and separators, two arrows read as "here" at a glance
11870
- (same idea as the table's column drop preview). They overhang the line,
11871
- which costs nothing to a box left out of the scrollable area — and the more
11872
- they stick out, the easier they are to spot. */
11873
- .navi_drop_hint_cap {
11874
- position: absolute;
11875
- top: 50%;
11876
- display: flex;
11877
- color: var(--drop-hint-background-color, #4476ff);
11878
- translate: 0 -50%;
11879
- }
11880
- .navi_drop_hint_cap svg {
11881
- width: var(--drop-hint-arrow-size, 11px);
11882
- height: var(--drop-hint-arrow-size, 11px);
11883
- }
11884
- .navi_drop_hint_cap[data-side="start"] {
11885
- left: calc(-1 * var(--drop-hint-arrow-size, 11px));
11886
- rotate: -90deg;
11887
- }
11888
- .navi_drop_hint_cap[data-side="end"] {
11889
- right: calc(-1 * var(--drop-hint-arrow-size, 11px));
11890
- rotate: 90deg;
11891
- }
11892
-
11893
- /* WHERE IT LANDS, when landing is ON a thing rather than between two: the
11894
- place itself is lit up, because there is no gap to draw a line in. Fixed
11895
- and in the top layer for the same reasons as the line above. */
11896
- .navi_drop_surface {
11897
- position: fixed;
11898
- inset: auto;
11899
- top: var(--drop-target-top);
11900
- left: var(--drop-target-left);
11901
- display: none;
11902
- box-sizing: border-box;
11903
- width: var(--drop-target-width);
11904
- height: var(--drop-target-height);
11905
- margin: 0;
11906
- padding: 0;
11907
- color: inherit;
11908
- background: var(--drop-surface-background-color, rgba(68, 118, 255, 0.16));
11909
- border: var(--drop-surface-border-width, 2px) solid
11797
+ const css$1 = /* css */`.navi_drop_hint {
11798
+ inset: auto;
11799
+ top: var(--drop-hint-y);
11800
+ left: calc(var(--drop-target-left) + var(--drop-hint-margin-x, 0px));
11801
+ box-sizing: border-box;
11802
+ width: calc(var(--drop-target-width) - 2 * var(--drop-hint-margin-x, 0px));
11803
+ height: var(--drop-hint-size, 3px);
11804
+ color: inherit;
11805
+ background: var(--drop-hint-background-color, #4476ff);
11806
+ border-radius: var(--drop-hint-border-radius, 2px);
11807
+ pointer-events: none;
11808
+ border: none;
11809
+ margin: 0;
11810
+ padding: 0;
11811
+ display: none;
11812
+ position: fixed;
11813
+ overflow: visible;
11814
+ transform: translateY(-50%);
11815
+ }
11816
+
11817
+ .navi_drop_hint[data-drop-edge]:popover-open {
11818
+ display: block;
11819
+ }
11820
+
11821
+ .navi_drop_hint[data-drop-edge="top"] {
11822
+ --drop-hint-y: calc(var(--drop-target-top) - var(--drop-hint-margin-y, 0px));
11823
+ }
11824
+
11825
+ .navi_drop_hint[data-drop-edge="bottom"] {
11826
+ --drop-hint-y: calc(var(--drop-target-bottom) + var(--drop-hint-margin-y, 0px));
11827
+ }
11828
+
11829
+ .navi_drop_hint_cap {
11830
+ color: var(--drop-hint-background-color, #4476ff);
11831
+ display: flex;
11832
+ position: absolute;
11833
+ top: 50%;
11834
+ translate: 0 -50%;
11835
+ }
11836
+
11837
+ .navi_drop_hint_cap svg {
11838
+ width: var(--drop-hint-arrow-size, 11px);
11839
+ height: var(--drop-hint-arrow-size, 11px);
11840
+ }
11841
+
11842
+ .navi_drop_hint_cap[data-side="start"] {
11843
+ left: calc(-1 * var(--drop-hint-arrow-size, 11px));
11844
+ rotate: -90deg;
11845
+ }
11846
+
11847
+ .navi_drop_hint_cap[data-side="end"] {
11848
+ right: calc(-1 * var(--drop-hint-arrow-size, 11px));
11849
+ rotate: 90deg;
11850
+ }
11851
+
11852
+ .navi_drop_surface {
11853
+ inset: auto;
11854
+ top: var(--drop-target-top);
11855
+ left: var(--drop-target-left);
11856
+ box-sizing: border-box;
11857
+ width: var(--drop-target-width);
11858
+ height: var(--drop-target-height);
11859
+ color: inherit;
11860
+ background: var(--drop-surface-background-color, #4476ff29);
11861
+ border: var(--drop-surface-border-width, 2px) solid
11910
11862
  var(--drop-surface-border-color, #4476ff);
11911
- border-radius: var(--drop-surface-border-radius, 6px);
11912
- pointer-events: none;
11913
- overflow: visible;
11914
- }
11915
- .navi_drop_surface[data-drop-over]:popover-open {
11916
- display: block;
11917
- }
11918
-
11919
- /* WHO CAN START A DRAG, said in the cursor.
11920
- A handle exists only to drag, so it shows the hand. A source does not, and
11921
- the gesture must not claim its cursor: it drags only once the intent shows
11922
- (a few pixels of travel, or a long press), a plain click on it stays a
11923
- click, and it is usually something else FIRST — a link, a card one opens.
11924
- The cursor says what the element is, and a hand insisting on the one thing
11925
- it can also be would talk over that. So it is left alone — default, and not
11926
- an I-beam, because dragging across the text does not select it (the gesture
11927
- takes the pointer; see the selectstart refused in drag_gesture.js) — and
11928
- whoever puts the drag there asks for the hand when a grab really is the
11929
- first thing the element offers.
11930
- An opted-out area keeps both its cursor and its selection, and never starts
11931
- a drag (see the check in startDragTo); a popover or a dialog anchored in a
11932
- source is one without having to say so.
11933
- Controls inside a source keep their own cursor: cursor is inherited, and
11934
- anything setting its own (a button's pointer) wins on itself.
11935
- Only the resting cursor is set here: what it becomes once a drag is under
11936
- way belongs to the gesture (see the backdrop in drag_gesture.js), the only
11937
- thing that knows a drag actually started. */
11938
- [data-drag-handle] {
11939
- cursor: grab;
11940
- }
11941
- [data-drag-source] {
11942
- cursor: default;
11943
- }
11944
- [data-drag-ignore],
11945
- [data-own-target],
11946
- [data-drag-source] [popover],
11947
- [data-drag-source] dialog {
11948
- cursor: auto;
11949
- }
11950
-
11951
- [navi-drag-clone-source] {
11952
- visibility: hidden;
11953
- }
11954
-
11955
- [navi-drag-clone-wrapper] {
11956
- /* Also a popover (see .navi_drop_hint): in the top layer it is over the
11957
- page whatever the page's own stacking is, and the coordinates it is
11958
- given are viewport ones — which is what the pointer carrying it works
11959
- in. Same UA-style reset as the hint. */
11960
- position: fixed;
11961
- inset: auto;
11962
- top: var(--clone-top);
11963
- left: var(--clone-left);
11964
- box-sizing: border-box;
11965
- width: var(--clone-width);
11966
- height: var(--clone-height);
11967
- margin: 0;
11968
- padding: 0;
11969
- color: inherit;
11970
- background: transparent;
11971
- border: none;
11972
- /* Carries the chain down to the copy, for an item whose own radius is an
11973
- "inherit" from the list around it. */
11974
- border-radius: inherit;
11975
- opacity: 0.95;
11976
- pointer-events: none;
11977
- /* Nothing in a copy being carried by a pointer is text to select: the
11978
- selection belongs to the original, which is still in the page. This is the
11979
- one place the rule is unconditional — an element that can be dragged is
11980
- usually selectable too (a link is both), and forcing it there would take
11981
- away a selection made from outside the element. */
11982
- user-select: none;
11983
- overflow: visible;
11984
- }
11985
-
11986
- /* On its way home and still the object: the hand can reach for it there, so
11987
- there it takes the pointer — which it must not do at any other moment of the
11988
- gesture, or it would hide what it is being dropped on. */
11989
- [navi-drag-clone-wrapper][data-catchable] {
11990
- pointer-events: auto;
11991
- }
11992
-
11993
- /* …and a FINGER reaching for it does not land on it: the pictures of the
11994
- transition cover the page, so as far as the browser is concerned the touch
11995
- began on the document root. What a touch may do is decided there and at that
11996
- moment, so the root says it for as long as the copy can be caught — the pan
11997
- is ours (nothing should scroll while something is landing), zoom stays the
11998
- reader's. Half of a pair: without the non-passive listener put down at the
11999
- same moment (see letCopyBeCaught) every touchmove arrives already
12000
- non-cancelable and refusing it does nothing. */
12001
- [data-drag-catchable] {
12002
- touch-action: pinch-zoom;
12003
- }
12004
-
12005
- /* Ce qui a été lancé: il continue dans la direction du geste jusqu'à sortir de
12006
- l'écran, et revient par le même chemin si la réponse refuse. */
12007
- [navi-drag-clone-wrapper][data-tossed] {
12008
- transition:
12009
- translate ${TOSS_DURATION_MS}ms ease-out,
11863
+ border-radius: var(--drop-surface-border-radius, 6px);
11864
+ pointer-events: none;
11865
+ margin: 0;
11866
+ padding: 0;
11867
+ display: none;
11868
+ position: fixed;
11869
+ overflow: visible;
11870
+ }
11871
+
11872
+ .navi_drop_surface[data-drop-over]:popover-open {
11873
+ display: block;
11874
+ }
11875
+
11876
+ [data-drag-handle] {
11877
+ cursor: grab;
11878
+ }
11879
+
11880
+ [data-drag-source] {
11881
+ cursor: default;
11882
+ }
11883
+
11884
+ [data-drag-ignore], [data-own-target], [data-drag-source] [popover], [data-drag-source] dialog {
11885
+ cursor: auto;
11886
+ }
11887
+
11888
+ [navi-drag-clone-source] {
11889
+ visibility: hidden;
11890
+ }
11891
+
11892
+ [navi-drag-clone-wrapper] {
11893
+ inset: auto;
11894
+ top: var(--clone-top);
11895
+ left: var(--clone-left);
11896
+ box-sizing: border-box;
11897
+ width: var(--clone-width);
11898
+ height: var(--clone-height);
11899
+ color: inherit;
11900
+ border-radius: inherit;
11901
+ opacity: .95;
11902
+ pointer-events: none;
11903
+ user-select: none;
11904
+ background: none;
11905
+ border: none;
11906
+ margin: 0;
11907
+ padding: 0;
11908
+ position: fixed;
11909
+ overflow: visible;
11910
+ }
11911
+
11912
+ [navi-drag-clone-wrapper][data-catchable] {
11913
+ pointer-events: auto;
11914
+ }
11915
+
11916
+ [data-drag-catchable] {
11917
+ touch-action: pinch-zoom;
11918
+ }
11919
+
11920
+ [navi-drag-clone-wrapper][data-tossed] {
11921
+ transition: translate ${TOSS_DURATION_MS}ms ease-out,
12010
11922
  opacity ${TOSS_DURATION_MS}ms ease-out;
12011
- }
12012
- [navi-drag-clone-wrapper][data-tossed="away"] {
12013
- opacity: 0;
12014
- }
11923
+ }
11924
+
11925
+ [navi-drag-clone-wrapper][data-tossed="away"] {
11926
+ opacity: 0;
11927
+ }
11928
+
11929
+ [navi-drag-clone] {
11930
+ box-shadow: var(--drag-clone-shadow, 0 12px 28px #00000038);
11931
+ transform: scale(var(--drag-clone-scale, 1.03));
11932
+ transform-origin: var(--drag-origin);
11933
+ transition: transform .15s cubic-bezier(.34, 1.56, .64, 1), box-shadow .15s;
11934
+ }
12015
11935
 
11936
+ @starting-style {
12016
11937
  [navi-drag-clone] {
12017
- /* Cast by the copy itself rather than by the box around it, so it takes the
12018
- shape of the thing — a rounded row throws a rounded shadow. Its value is a
12019
- var read on the copy, which IS the dragged element: what being carried
12020
- looks like belongs to whoever owns the thing — a row lifted off a list
12021
- wants this shadow, a sheet of paper leaving a board wants none, and its
12022
- shade is a theme's business either way. */
12023
- box-shadow: var(--drag-clone-shadow, 0 12px 28px rgba(0, 0, 0, 0.22));
12024
- transform: scale(var(--drag-clone-scale, 1.03));
12025
- transform-origin: var(--drag-origin);
12026
- transition:
12027
- transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
12028
- box-shadow 0.15s ease;
12029
- }
12030
-
12031
- @starting-style {
12032
- [navi-drag-clone] {
12033
- box-shadow: none;
12034
- transform: scale(1);
12035
- }
11938
+ box-shadow: none;
11939
+ transform: scale(1);
12036
11940
  }
11941
+ }
12037
11942
  `;
12038
11943
  // At module scope, not inside startDragTo: the cursor rules above say who
12039
11944
  // can start a drag, and they have to be true BEFORE anyone drags anything.
@@ -14519,13 +14424,12 @@ installImportMetaCssBuild(import.meta);/**
14519
14424
  *
14520
14425
  * The element should have a CSS "top" value specified (e.g., top: 10px).
14521
14426
  */
14522
- const css = /* css */`
14523
- [data-position-sticky-placeholder] {
14524
- position: static !important;
14525
- width: auto !important;
14526
- height: auto !important;
14527
- opacity: 0 !important;
14528
- }
14427
+ const css = /* css */`[data-position-sticky-placeholder] {
14428
+ opacity: 0 !important;
14429
+ width: auto !important;
14430
+ height: auto !important;
14431
+ position: static !important;
14432
+ }
14529
14433
  `;
14530
14434
  const initPositionSticky = element => {
14531
14435
  import.meta.css = [css, "@jsenv/dom/src/position/position_sticky.js"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/dom",
3
- "version": "0.17.33",
3
+ "version": "0.17.35",
4
4
  "type": "module",
5
5
  "description": "DOM utilities for writing frontend code",
6
6
  "repository": {