rune-grab 0.1.13 → 0.1.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.
package/dist/react.cjs CHANGED
@@ -260,9 +260,8 @@ function isSourceFile(filePath) {
260
260
  if (!filePath) return false;
261
261
  if (isLibraryFile(filePath)) return false;
262
262
  if (filePath.startsWith("webpack-internal:///node_modules/")) return false;
263
- if (filePath.includes("_next/static/")) return false;
264
- if (filePath.includes(".vite/deps/")) return false;
265
- if (/^webpack[\w-]*\.js$/.test(filePath) || /[\\/]webpack[\w-]*\.js$/.test(filePath)) return false;
263
+ if (/(?:^|[\\/])webpack(?:[-.][\w]+)?\.js$/.test(filePath)) return false;
264
+ if (/(?:^|[\\/])framework[-.][\w]+\.js$/.test(filePath)) return false;
266
265
  return true;
267
266
  }
268
267
  var SKIP_PREFIXES, STYLE_PROPS, STYLE_DEFAULTS, KEEP_ATTRS, Z_OVERLAY, Z_TOOLBAR, OWN_IDS, DRAG_THRESHOLD_PX, HELPER_PORT2, HEALTH_CHECK_TIMEOUT_MS, FLASH_VISIBLE_MS, FLASH_REMOVE_MS, LS_KEY;
@@ -1150,10 +1149,11 @@ function getReactComponentInfo(el, customSkip) {
1150
1149
  return info;
1151
1150
  }
1152
1151
  if (!fallback && isCleanComponentName(name, customSkip) && !isInfraName(name)) {
1153
- const validPath = filePath && isSourceFile(filePath) ? filePath : null;
1154
1152
  fallback = {
1155
- info: { name, filePath: validPath, line: validPath ? src?.lineNumber ?? null : null, column: validPath ? src?.columnNumber ?? null : null },
1156
- src: src || null
1153
+ name,
1154
+ filePath: null,
1155
+ line: null,
1156
+ column: null
1157
1157
  };
1158
1158
  }
1159
1159
  isFirst = false;
@@ -1161,8 +1161,7 @@ function getReactComponentInfo(el, customSkip) {
1161
1161
  cur = cur.return;
1162
1162
  }
1163
1163
  if (fallback) {
1164
- if (fallback.src) storePendingResolution(fallback.info, fallback.src);
1165
- return fallback.info;
1164
+ return fallback;
1166
1165
  }
1167
1166
  return null;
1168
1167
  }
@@ -1199,14 +1198,14 @@ function getReactComponentStack(el, maxDepth = 6, customSkip) {
1199
1198
  isFirst = false;
1200
1199
  } else if (fallbackStack.length < maxDepth && isCleanComponentName(name, customSkip) && !isInfraName(name) && !fallbackSeen.has(name)) {
1201
1200
  fallbackSeen.add(name);
1202
- const validPath = filePath && isSourceFile(filePath) ? filePath : null;
1203
- const frame = { name, filePath: validPath, line: validPath ? src?.lineNumber ?? null : null };
1204
- if (src) storePendingResolution(frame, src);
1205
- fallbackStack.push(frame);
1201
+ fallbackStack.push({ name, filePath: null, line: null });
1206
1202
  }
1207
1203
  }
1208
1204
  cur = cur.return;
1209
1205
  }
1206
+ if (fallbackStack.length > 0 && stack.every((f) => isInfraName(f.name))) {
1207
+ return fallbackStack;
1208
+ }
1210
1209
  return stack.length > 0 ? stack : fallbackStack;
1211
1210
  }
1212
1211
  function getVueComponentInfo(el) {
@@ -1267,10 +1266,11 @@ async function resolveComponentInfo(info) {
1267
1266
  if (!pending) return;
1268
1267
  const resolved = await resolveOriginalPosition(pending.url, pending.line, pending.col);
1269
1268
  if (resolved) {
1270
- info.line = resolved.line;
1271
- info.column = resolved.column;
1272
- if (resolved.source) {
1273
- info.filePath = cleanFilePath(resolved.source);
1269
+ const resolvedPath = resolved.source ? cleanFilePath(resolved.source) : null;
1270
+ if (resolvedPath && isSourceFile(resolvedPath)) {
1271
+ info.line = resolved.line;
1272
+ info.column = resolved.column;
1273
+ info.filePath = resolvedPath;
1274
1274
  }
1275
1275
  }
1276
1276
  pendingResolution.delete(info);
@@ -1281,9 +1281,10 @@ async function resolveComponentFrame(frame) {
1281
1281
  if (!pending) return;
1282
1282
  const resolved = await resolveOriginalPosition(pending.url, pending.line, pending.col);
1283
1283
  if (resolved) {
1284
- frame.line = resolved.line;
1285
- if (resolved.source) {
1286
- frame.filePath = cleanFilePath(resolved.source);
1284
+ const resolvedPath = resolved.source ? cleanFilePath(resolved.source) : null;
1285
+ if (resolvedPath && isSourceFile(resolvedPath)) {
1286
+ frame.line = resolved.line;
1287
+ frame.filePath = resolvedPath;
1287
1288
  }
1288
1289
  }
1289
1290
  pendingResolution.delete(frame);
@@ -1487,7 +1488,7 @@ function createGrabOverlay() {
1487
1488
  if (s.overlay) return;
1488
1489
  s.overlay = document.createElement("div");
1489
1490
  s.overlay.id = "__rune-grab-overlay__";
1490
- s.overlay.style.cssText = `position:fixed;pointer-events:none;z-index:${Z_OVERLAY};border:1px dashed ${M_BG};background:transparent;border-radius:3px;transition:all 0.08s ease-out;display:none;top:0;left:0;width:0;height:0;`;
1491
+ s.overlay.style.cssText = `position:fixed;pointer-events:none;z-index:${Z_OVERLAY};border:1px dashed #737373;background:transparent;border-radius:3px;transition:all 0.08s ease-out;display:none;top:0;left:0;width:0;height:0;`;
1491
1492
  s.label = document.createElement("div");
1492
1493
  s.label.id = "__rune-grab-label__";
1493
1494
  s.label.style.cssText = `position:fixed;pointer-events:none;z-index:${Z_TOOLBAR};background:${M_BG};border:1px solid ${M_BORDER};color:${M_FG};font-size:10px;font-family:${MONO};padding:2px 6px;border-radius:5px;white-space:nowrap;display:none;top:0;left:0;line-height:1.4;font-weight:500;letter-spacing:0.01em;box-shadow:0 2px 8px rgba(0,0,0,0.08);`;
@@ -1518,7 +1519,7 @@ function createSelectionBox() {
1518
1519
  s.selectionBox.id = "__rune-grab-selection__";
1519
1520
  s.selectionBox.style.cssText = `
1520
1521
  position:fixed;z-index:${Z_OVERLAY};
1521
- border:1px dashed ${M_BG};
1522
+ border:1px dashed #737373;
1522
1523
  background:transparent;
1523
1524
  border-radius:2px;display:none;
1524
1525
  pointer-events:none;