checkpoint-cli 0.3.7 → 0.3.8
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 +14 -1
- 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.8');
|
|
1610
1610
|
// ── checkpoint login ──
|
|
1611
1611
|
program
|
|
1612
1612
|
.command('login')
|
|
@@ -190,6 +190,15 @@ function buildMinimalTrackingScript() {
|
|
|
190
190
|
return score;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
+
function hasOwnerPathKey(anchor){
|
|
194
|
+
if(!anchor||!Array.isArray(anchor.owner_path)) return false;
|
|
195
|
+
for(var i=0;i<anchor.owner_path.length;i++){
|
|
196
|
+
var part=anchor.owner_path[i];
|
|
197
|
+
if(typeof part==='string'&&part.indexOf('#')>0) return true;
|
|
198
|
+
}
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
|
|
193
202
|
function findBestAnchorableElement(el){
|
|
194
203
|
if(!el||el.nodeType!==1) return { element:el, sourceAnchor:null };
|
|
195
204
|
var current=el;
|
|
@@ -208,6 +217,10 @@ function buildMinimalTrackingScript() {
|
|
|
208
217
|
if(anchor&&anchor.explicit_id){
|
|
209
218
|
return { element:current, sourceAnchor:anchor };
|
|
210
219
|
}
|
|
220
|
+
// Prefer keyed instances in repeated lists/grids.
|
|
221
|
+
if(anchor&&(anchor.react_key||hasOwnerPathKey(anchor))){
|
|
222
|
+
return { element:current, sourceAnchor:anchor };
|
|
223
|
+
}
|
|
211
224
|
current=current.parentElement;
|
|
212
225
|
depth++;
|
|
213
226
|
}
|
|
@@ -221,7 +234,7 @@ function buildMinimalTrackingScript() {
|
|
|
221
234
|
var score=0;
|
|
222
235
|
while(i>=0&&j>=0){
|
|
223
236
|
if(current[i]!==expected[j]) break;
|
|
224
|
-
score+=100;
|
|
237
|
+
score+=(String(expected[j]).indexOf('#')>0?180:100);
|
|
225
238
|
i--;
|
|
226
239
|
j--;
|
|
227
240
|
}
|