checkpoint-cli 0.3.2 → 0.3.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/dist/index.js CHANGED
@@ -1606,7 +1606,7 @@ const program = new commander_1.Command();
1606
1606
  program
1607
1607
  .name('checkpoint')
1608
1608
  .description('Share your localhost with reviewers — get visual feedback directly on the page')
1609
- .version('0.3.2');
1609
+ .version('0.3.4');
1610
1610
  // ── checkpoint login ──
1611
1611
  program
1612
1612
  .command('login')
@@ -8,6 +8,8 @@ function buildMinimalTrackingScript() {
8
8
  var pickPointerDownHandler=null;
9
9
  var pickClickHandler=null;
10
10
  var pickEscHandler=null;
11
+ var pickKeydownHandler=null;
12
+ var pickBlockHandler=null;
11
13
  var hoverRaf=0;
12
14
  var lastMouseX=0;
13
15
  var lastMouseY=0;
@@ -15,6 +17,7 @@ function buildMinimalTrackingScript() {
15
17
  var inspectLabel=null;
16
18
  var lastPath='';
17
19
  var mutationTick=false;
20
+ var pendingPickCommit=false;
18
21
 
19
22
  function getMetrics(){
20
23
  var de=document.documentElement;
@@ -446,10 +449,25 @@ function buildMinimalTrackingScript() {
446
449
  if(pickPointerDownHandler) window.removeEventListener('pointerdown',pickPointerDownHandler,true);
447
450
  if(pickClickHandler) window.removeEventListener('click',pickClickHandler,true);
448
451
  if(pickEscHandler) window.removeEventListener('keydown',pickEscHandler,true);
452
+ if(pickKeydownHandler) window.removeEventListener('keydown',pickKeydownHandler,true);
453
+ if(pickBlockHandler){
454
+ window.removeEventListener('mousedown',pickBlockHandler,true);
455
+ window.removeEventListener('mouseup',pickBlockHandler,true);
456
+ window.removeEventListener('pointerup',pickBlockHandler,true);
457
+ window.removeEventListener('touchstart',pickBlockHandler,true);
458
+ window.removeEventListener('touchend',pickBlockHandler,true);
459
+ window.removeEventListener('auxclick',pickBlockHandler,true);
460
+ window.removeEventListener('dblclick',pickBlockHandler,true);
461
+ window.removeEventListener('contextmenu',pickBlockHandler,true);
462
+ window.removeEventListener('submit',pickBlockHandler,true);
463
+ }
449
464
  pickMoveHandler=null;
450
465
  pickPointerDownHandler=null;
451
466
  pickClickHandler=null;
452
467
  pickEscHandler=null;
468
+ pickKeydownHandler=null;
469
+ pickBlockHandler=null;
470
+ pendingPickCommit=false;
453
471
  if(hoverRaf){
454
472
  cancelAnimationFrame(hoverRaf);
455
473
  hoverRaf=0;
@@ -478,22 +496,53 @@ function buildMinimalTrackingScript() {
478
496
  try{
479
497
  postPickResult(target,ev.clientX,ev.clientY);
480
498
  }catch(e){}
481
- setPickMode(false);
499
+ // Keep pick mode active until the subsequent click is swallowed,
500
+ // otherwise link/tab navigation can still fire.
501
+ pendingPickCommit=true;
482
502
  };
483
503
  pickClickHandler=function(ev){
484
504
  if(!pickMode) return;
485
505
  ev.preventDefault();
486
506
  ev.stopPropagation();
487
507
  if(typeof ev.stopImmediatePropagation==='function') ev.stopImmediatePropagation();
508
+ if(pendingPickCommit){
509
+ pendingPickCommit=false;
510
+ setPickMode(false);
511
+ }
488
512
  };
489
513
  pickEscHandler=function(ev){
490
514
  if(ev.key==='Escape') setPickMode(false);
491
515
  };
516
+ pickKeydownHandler=function(ev){
517
+ if(!pickMode) return;
518
+ // Block keyboard-activated interactions while choosing anchor.
519
+ if(ev.key==='Enter'||ev.key===' '||ev.key==='Spacebar'){
520
+ ev.preventDefault();
521
+ ev.stopPropagation();
522
+ if(typeof ev.stopImmediatePropagation==='function') ev.stopImmediatePropagation();
523
+ }
524
+ };
525
+ pickBlockHandler=function(ev){
526
+ if(!pickMode) return;
527
+ ev.preventDefault();
528
+ ev.stopPropagation();
529
+ if(typeof ev.stopImmediatePropagation==='function') ev.stopImmediatePropagation();
530
+ };
492
531
 
493
532
  document.addEventListener('mousemove',pickMoveHandler,true);
494
533
  window.addEventListener('pointerdown',pickPointerDownHandler,true);
495
534
  window.addEventListener('click',pickClickHandler,true);
496
535
  window.addEventListener('keydown',pickEscHandler,true);
536
+ window.addEventListener('keydown',pickKeydownHandler,true);
537
+ window.addEventListener('mousedown',pickBlockHandler,true);
538
+ window.addEventListener('mouseup',pickBlockHandler,true);
539
+ window.addEventListener('pointerup',pickBlockHandler,true);
540
+ window.addEventListener('touchstart',pickBlockHandler,{ capture:true, passive:false });
541
+ window.addEventListener('touchend',pickBlockHandler,{ capture:true, passive:false });
542
+ window.addEventListener('auxclick',pickBlockHandler,true);
543
+ window.addEventListener('dblclick',pickBlockHandler,true);
544
+ window.addEventListener('contextmenu',pickBlockHandler,true);
545
+ window.addEventListener('submit',pickBlockHandler,true);
497
546
  }
498
547
 
499
548
  function reportScroll(){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "checkpoint-cli",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "Share your localhost with reviewers — get visual feedback directly on the page",
5
5
  "keywords": [
6
6
  "checkpoint",