checkpoint-cli 0.3.3 → 0.3.5
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 +1 -1
- package/dist/tracking-script-minimal.js +66 -13
- package/package.json +1 -1
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.
|
|
1609
|
+
.version('0.3.5');
|
|
1610
1610
|
// ── checkpoint login ──
|
|
1611
1611
|
program
|
|
1612
1612
|
.command('login')
|
|
@@ -9,11 +9,13 @@ function buildMinimalTrackingScript() {
|
|
|
9
9
|
var pickClickHandler=null;
|
|
10
10
|
var pickEscHandler=null;
|
|
11
11
|
var pickKeydownHandler=null;
|
|
12
|
+
var pickBlockHandler=null;
|
|
12
13
|
var hoverRaf=0;
|
|
13
14
|
var lastMouseX=0;
|
|
14
15
|
var lastMouseY=0;
|
|
15
16
|
var inspectBox=null;
|
|
16
17
|
var inspectLabel=null;
|
|
18
|
+
var pickShield=null;
|
|
17
19
|
var lastPath='';
|
|
18
20
|
var mutationTick=false;
|
|
19
21
|
var pendingPickCommit=false;
|
|
@@ -209,11 +211,15 @@ function buildMinimalTrackingScript() {
|
|
|
209
211
|
|
|
210
212
|
function getElementAtPoint(x,y){
|
|
211
213
|
try{
|
|
214
|
+
if(pickShield) pickShield.style.pointerEvents='none';
|
|
212
215
|
if(typeof x==='number'&&typeof y==='number'&&document.elementFromPoint){
|
|
213
216
|
var node=document.elementFromPoint(x,y);
|
|
214
217
|
if(node&&node.nodeType===1) return node;
|
|
215
218
|
}
|
|
216
219
|
}catch(e){}
|
|
220
|
+
finally{
|
|
221
|
+
if(pickShield) pickShield.style.pointerEvents='auto';
|
|
222
|
+
}
|
|
217
223
|
return null;
|
|
218
224
|
}
|
|
219
225
|
|
|
@@ -387,6 +393,28 @@ function buildMinimalTrackingScript() {
|
|
|
387
393
|
if(inspectLabel) inspectLabel.style.display='none';
|
|
388
394
|
}
|
|
389
395
|
|
|
396
|
+
function ensurePickShield(){
|
|
397
|
+
if(!document.body) return;
|
|
398
|
+
if(pickShield) return;
|
|
399
|
+
pickShield=document.createElement('div');
|
|
400
|
+
pickShield.style.position='fixed';
|
|
401
|
+
pickShield.style.left='0';
|
|
402
|
+
pickShield.style.top='0';
|
|
403
|
+
pickShield.style.right='0';
|
|
404
|
+
pickShield.style.bottom='0';
|
|
405
|
+
pickShield.style.background='transparent';
|
|
406
|
+
pickShield.style.cursor='crosshair';
|
|
407
|
+
pickShield.style.pointerEvents='auto';
|
|
408
|
+
pickShield.style.zIndex='2147483645';
|
|
409
|
+
document.body.appendChild(pickShield);
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
function removePickShield(){
|
|
413
|
+
if(!pickShield) return;
|
|
414
|
+
try{ pickShield.remove(); }catch(e){}
|
|
415
|
+
pickShield=null;
|
|
416
|
+
}
|
|
417
|
+
|
|
390
418
|
function renderInspectAt(x,y){
|
|
391
419
|
ensureInspectUi();
|
|
392
420
|
if(!inspectBox||!inspectLabel){
|
|
@@ -444,25 +472,41 @@ function buildMinimalTrackingScript() {
|
|
|
444
472
|
if(document.body) document.body.style.cursor=pickMode?'crosshair':'';
|
|
445
473
|
|
|
446
474
|
if(!pickMode){
|
|
447
|
-
if(pickMoveHandler)
|
|
448
|
-
if(pickPointerDownHandler)
|
|
449
|
-
if(pickClickHandler)
|
|
475
|
+
if(pickMoveHandler&&pickShield) pickShield.removeEventListener('mousemove',pickMoveHandler,true);
|
|
476
|
+
if(pickPointerDownHandler&&pickShield) pickShield.removeEventListener('pointerdown',pickPointerDownHandler,true);
|
|
477
|
+
if(pickClickHandler&&pickShield) pickShield.removeEventListener('click',pickClickHandler,true);
|
|
450
478
|
if(pickEscHandler) window.removeEventListener('keydown',pickEscHandler,true);
|
|
451
479
|
if(pickKeydownHandler) window.removeEventListener('keydown',pickKeydownHandler,true);
|
|
480
|
+
if(pickBlockHandler){
|
|
481
|
+
window.removeEventListener('mousedown',pickBlockHandler,true);
|
|
482
|
+
window.removeEventListener('mouseup',pickBlockHandler,true);
|
|
483
|
+
window.removeEventListener('pointerup',pickBlockHandler,true);
|
|
484
|
+
window.removeEventListener('touchstart',pickBlockHandler,true);
|
|
485
|
+
window.removeEventListener('touchend',pickBlockHandler,true);
|
|
486
|
+
window.removeEventListener('auxclick',pickBlockHandler,true);
|
|
487
|
+
window.removeEventListener('dblclick',pickBlockHandler,true);
|
|
488
|
+
window.removeEventListener('contextmenu',pickBlockHandler,true);
|
|
489
|
+
window.removeEventListener('submit',pickBlockHandler,true);
|
|
490
|
+
}
|
|
452
491
|
pickMoveHandler=null;
|
|
453
492
|
pickPointerDownHandler=null;
|
|
454
493
|
pickClickHandler=null;
|
|
455
494
|
pickEscHandler=null;
|
|
456
495
|
pickKeydownHandler=null;
|
|
496
|
+
pickBlockHandler=null;
|
|
457
497
|
pendingPickCommit=false;
|
|
458
498
|
if(hoverRaf){
|
|
459
499
|
cancelAnimationFrame(hoverRaf);
|
|
460
500
|
hoverRaf=0;
|
|
461
501
|
}
|
|
462
502
|
hideInspectUi();
|
|
503
|
+
removePickShield();
|
|
463
504
|
return;
|
|
464
505
|
}
|
|
465
506
|
|
|
507
|
+
ensurePickShield();
|
|
508
|
+
if(!pickShield) return;
|
|
509
|
+
|
|
466
510
|
pickMoveHandler=function(ev){
|
|
467
511
|
if(!pickMode) return;
|
|
468
512
|
lastMouseX=ev.clientX;
|
|
@@ -483,19 +527,13 @@ function buildMinimalTrackingScript() {
|
|
|
483
527
|
try{
|
|
484
528
|
postPickResult(target,ev.clientX,ev.clientY);
|
|
485
529
|
}catch(e){}
|
|
486
|
-
|
|
487
|
-
// otherwise link/tab navigation can still fire.
|
|
488
|
-
pendingPickCommit=true;
|
|
530
|
+
setPickMode(false);
|
|
489
531
|
};
|
|
490
532
|
pickClickHandler=function(ev){
|
|
491
533
|
if(!pickMode) return;
|
|
492
534
|
ev.preventDefault();
|
|
493
535
|
ev.stopPropagation();
|
|
494
536
|
if(typeof ev.stopImmediatePropagation==='function') ev.stopImmediatePropagation();
|
|
495
|
-
if(pendingPickCommit){
|
|
496
|
-
pendingPickCommit=false;
|
|
497
|
-
setPickMode(false);
|
|
498
|
-
}
|
|
499
537
|
};
|
|
500
538
|
pickEscHandler=function(ev){
|
|
501
539
|
if(ev.key==='Escape') setPickMode(false);
|
|
@@ -509,12 +547,27 @@ function buildMinimalTrackingScript() {
|
|
|
509
547
|
if(typeof ev.stopImmediatePropagation==='function') ev.stopImmediatePropagation();
|
|
510
548
|
}
|
|
511
549
|
};
|
|
550
|
+
pickBlockHandler=function(ev){
|
|
551
|
+
if(!pickMode) return;
|
|
552
|
+
ev.preventDefault();
|
|
553
|
+
ev.stopPropagation();
|
|
554
|
+
if(typeof ev.stopImmediatePropagation==='function') ev.stopImmediatePropagation();
|
|
555
|
+
};
|
|
512
556
|
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
557
|
+
pickShield.addEventListener('mousemove',pickMoveHandler,true);
|
|
558
|
+
pickShield.addEventListener('pointerdown',pickPointerDownHandler,true);
|
|
559
|
+
pickShield.addEventListener('click',pickClickHandler,true);
|
|
516
560
|
window.addEventListener('keydown',pickEscHandler,true);
|
|
517
561
|
window.addEventListener('keydown',pickKeydownHandler,true);
|
|
562
|
+
window.addEventListener('mousedown',pickBlockHandler,true);
|
|
563
|
+
window.addEventListener('mouseup',pickBlockHandler,true);
|
|
564
|
+
window.addEventListener('pointerup',pickBlockHandler,true);
|
|
565
|
+
window.addEventListener('touchstart',pickBlockHandler,{ capture:true, passive:false });
|
|
566
|
+
window.addEventListener('touchend',pickBlockHandler,{ capture:true, passive:false });
|
|
567
|
+
window.addEventListener('auxclick',pickBlockHandler,true);
|
|
568
|
+
window.addEventListener('dblclick',pickBlockHandler,true);
|
|
569
|
+
window.addEventListener('contextmenu',pickBlockHandler,true);
|
|
570
|
+
window.addEventListener('submit',pickBlockHandler,true);
|
|
518
571
|
}
|
|
519
572
|
|
|
520
573
|
function reportScroll(){
|