bippy 0.2.4 → 0.2.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/inspect.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import './chunk-6TJRMCM3.js';
2
- import { getNearestHostFiber, traverseFiber, getFiberStack, getDisplayName, getFiberId, getFiberFromHostInstance, isCompositeFiber, isInstrumentationActive, getRDTHook, detectReactBuildType } from './chunk-MISFWX22.js';
2
+ import { getNearestHostFiber, traverseFiber, getFiberStack, getDisplayName, getFiberId, getFiberFromHostInstance, isCompositeFiber, isInstrumentationActive, hasRDTHook, getRDTHook, detectReactBuildType } from './chunk-4TD4C62I.js';
3
3
  import React17, { createContext, memo, Children, useContext, useCallback, useState, useLayoutEffect, useEffect, useMemo } from 'react';
4
4
 
5
5
  /**
@@ -1226,456 +1226,465 @@ var throttle = (fn, wait) => {
1226
1226
  };
1227
1227
  };
1228
1228
  var isMac = typeof navigator !== "undefined" && navigator.platform.toLowerCase().includes("mac");
1229
- var Inspector2 = ({
1230
- enabled = true,
1231
- dangerouslyRunInProduction = false
1232
- }) => {
1233
- const [element, setElement] = useState(null);
1234
- const [rect, setRect] = useState(null);
1235
- const [isActive, setIsActive] = useState(true);
1236
- const [isDialogMode, setIsDialogMode] = useState(false);
1237
- const [tooltip, setTooltip] = useState(null);
1238
- const [selectedFiber, setSelectedFiber] = useState(null);
1239
- const [position, setPosition] = useState({
1240
- top: 0,
1241
- left: 0
1242
- });
1243
- const getFiberForDisplay = () => {
1244
- if (selectedFiber) return selectedFiber;
1245
- const fiber2 = getFiberFromHostInstance(element);
1246
- if (!fiber2) return null;
1247
- return fiber2.return && isCompositeFiber(fiber2.return) ? fiber2.return : fiber2;
1248
- };
1249
- const handlePropertyHover = (_e, propName) => {
1250
- if (!isDialogMode) return;
1251
- const explanation = FIBER_PROP_EXPLANATIONS[propName];
1252
- if (!explanation) return;
1253
- setTooltip(explanation);
1254
- };
1255
- const handlePropertyLeave = () => {
1256
- setTooltip(null);
1257
- };
1258
- useEffect(() => {
1259
- const handleKeyDown = (e) => {
1260
- if (e.key === "o" && (e.metaKey || e.ctrlKey) && rect) {
1261
- e.preventDefault();
1262
- setIsDialogMode(true);
1263
- } else if (e.key === "Escape" && isDialogMode) {
1264
- setIsDialogMode(false);
1265
- setTooltip(null);
1266
- }
1229
+ var Inspector2 = React17.memo(
1230
+ ({ enabled = true, dangerouslyRunInProduction = false }) => {
1231
+ const [element, setElement] = useState(null);
1232
+ const [rect, setRect] = useState(null);
1233
+ const [isActive, setIsActive] = useState(true);
1234
+ const [isDialogMode, setIsDialogMode] = useState(false);
1235
+ const [tooltip, setTooltip] = useState(null);
1236
+ const [selectedFiber, setSelectedFiber] = useState(null);
1237
+ const [position, setPosition] = useState({
1238
+ top: 0,
1239
+ left: 0
1240
+ });
1241
+ const getFiberForDisplay = () => {
1242
+ if (selectedFiber) return selectedFiber;
1243
+ const fiber2 = getFiberFromHostInstance(element);
1244
+ if (!fiber2) return null;
1245
+ return fiber2.return && isCompositeFiber(fiber2.return) ? fiber2.return : fiber2;
1246
+ };
1247
+ const handlePropertyHover = (_e, propName) => {
1248
+ if (!isDialogMode) return;
1249
+ const explanation = FIBER_PROP_EXPLANATIONS[propName];
1250
+ setTooltip(explanation || null);
1267
1251
  };
1268
- window.addEventListener("keydown", handleKeyDown);
1269
- return () => window.removeEventListener("keydown", handleKeyDown);
1270
- }, [rect, isDialogMode]);
1271
- useEffect(() => {
1272
- if (!isDialogMode) {
1252
+ const handlePropertyLeave = () => {
1273
1253
  setTooltip(null);
1274
- }
1275
- }, [isDialogMode]);
1276
- useEffect(() => {
1277
- const handleMouseMove = (event) => {
1278
- if (isDialogMode) return;
1279
- const isActive2 = isInstrumentationActive();
1280
- if (!isActive2) {
1281
- setIsActive(false);
1282
- return;
1254
+ };
1255
+ useEffect(() => {
1256
+ const handleKeyDown = (e) => {
1257
+ if (e.key === "o" && (e.metaKey || e.ctrlKey) && rect) {
1258
+ e.preventDefault();
1259
+ setIsDialogMode(true);
1260
+ } else if (e.key === "Escape" && isDialogMode) {
1261
+ setIsDialogMode(false);
1262
+ setTooltip(null);
1263
+ }
1264
+ };
1265
+ window.addEventListener("keydown", handleKeyDown);
1266
+ return () => window.removeEventListener("keydown", handleKeyDown);
1267
+ }, [rect, isDialogMode]);
1268
+ useEffect(() => {
1269
+ if (!isDialogMode) {
1270
+ setTooltip(null);
1283
1271
  }
1284
- if (!dangerouslyRunInProduction) {
1285
- const rdtHook = getRDTHook();
1286
- for (const renderer of rdtHook.renderers.values()) {
1287
- const buildType = detectReactBuildType(renderer);
1288
- if (buildType === "production") {
1289
- setIsActive(false);
1290
- return;
1272
+ }, [isDialogMode]);
1273
+ useEffect(() => {
1274
+ const handleMouseMove = (event) => {
1275
+ if (isDialogMode) return;
1276
+ const isActive2 = isInstrumentationActive() || hasRDTHook();
1277
+ if (!isActive2) {
1278
+ setIsActive(false);
1279
+ return;
1280
+ }
1281
+ if (!dangerouslyRunInProduction) {
1282
+ const rdtHook = getRDTHook();
1283
+ for (const renderer of rdtHook.renderers.values()) {
1284
+ const buildType = detectReactBuildType(renderer);
1285
+ if (buildType === "production") {
1286
+ setIsActive(false);
1287
+ return;
1288
+ }
1291
1289
  }
1292
1290
  }
1293
- }
1294
- if (!enabled) {
1295
- setElement(null);
1296
- setRect(null);
1297
- setSelectedFiber(null);
1298
- return;
1299
- }
1300
- const element2 = document.elementFromPoint(event.clientX, event.clientY);
1301
- if (!element2) return;
1302
- setElement(element2);
1303
- setRect(element2.getBoundingClientRect());
1304
- setSelectedFiber(null);
1305
- };
1306
- const throttledMouseMove = throttle(handleMouseMove, 16);
1307
- document.addEventListener("mousemove", throttledMouseMove);
1308
- return () => {
1309
- document.removeEventListener("mousemove", throttledMouseMove);
1310
- };
1311
- }, [enabled, isDialogMode, dangerouslyRunInProduction]);
1312
- useEffect(() => {
1313
- if (!rect) return;
1314
- const padding = 10;
1315
- const inspectorWidth = 400;
1316
- const inspectorHeight = 320;
1317
- let left = rect.left + rect.width + padding;
1318
- let top = rect.top;
1319
- if (left + inspectorWidth > window.innerWidth) {
1320
- left = Math.max(padding, rect.left - inspectorWidth - padding);
1321
- }
1322
- if (top >= rect.top && top <= rect.bottom) {
1323
- if (rect.bottom + inspectorHeight + padding <= window.innerHeight) {
1324
- top = rect.bottom + padding;
1325
- } else if (rect.top - inspectorHeight - padding >= 0) {
1326
- top = rect.top - inspectorHeight - padding;
1327
- } else {
1328
- top = window.innerHeight - inspectorHeight - padding;
1329
- }
1330
- }
1331
- top = Math.max(
1332
- padding,
1333
- Math.min(top, window.innerHeight - inspectorHeight - padding)
1334
- );
1335
- left = Math.max(
1336
- padding,
1337
- Math.min(left, window.innerWidth - inspectorWidth - padding)
1338
- );
1339
- setPosition({ top, left });
1340
- }, [rect]);
1341
- useEffect(() => {
1342
- if (selectedFiber) {
1343
- const element2 = getNearestHostFiber(selectedFiber)?.stateNode;
1344
- if (element2) {
1291
+ if (!enabled) {
1292
+ setElement(null);
1293
+ setRect(null);
1294
+ setSelectedFiber(null);
1295
+ return;
1296
+ }
1297
+ const element2 = document.elementFromPoint(event.clientX, event.clientY);
1298
+ if (!element2) return;
1345
1299
  setElement(element2);
1346
1300
  setRect(element2.getBoundingClientRect());
1301
+ setSelectedFiber(null);
1302
+ };
1303
+ const throttledMouseMove = throttle(handleMouseMove, 16);
1304
+ document.addEventListener("mousemove", throttledMouseMove);
1305
+ return () => {
1306
+ document.removeEventListener("mousemove", throttledMouseMove);
1307
+ };
1308
+ }, [enabled, isDialogMode, dangerouslyRunInProduction]);
1309
+ useEffect(() => {
1310
+ if (!rect) return;
1311
+ const padding = 10;
1312
+ const inspectorWidth = 400;
1313
+ const inspectorHeight = 320;
1314
+ let left = rect.left + rect.width + padding;
1315
+ let top = rect.top;
1316
+ if (left + inspectorWidth > window.innerWidth) {
1317
+ left = Math.max(padding, rect.left - inspectorWidth - padding);
1347
1318
  }
1348
- }
1349
- }, [selectedFiber]);
1350
- if (window.innerWidth < 800 || !rect || !isActive) return null;
1351
- const fiber = getFiberForDisplay();
1352
- if (!fiber) return null;
1353
- let foundInspect = false;
1354
- traverseFiber(
1355
- fiber,
1356
- (innerFiber) => {
1357
- if (innerFiber.type === Inspector2) {
1358
- foundInspect = true;
1359
- return true;
1319
+ if (top >= rect.top && top <= rect.bottom) {
1320
+ if (rect.bottom + inspectorHeight + padding <= window.innerHeight) {
1321
+ top = rect.bottom + padding;
1322
+ } else if (rect.top - inspectorHeight - padding >= 0) {
1323
+ top = rect.top - inspectorHeight - padding;
1324
+ } else {
1325
+ top = window.innerHeight - inspectorHeight - padding;
1326
+ }
1360
1327
  }
1361
- },
1362
- true
1363
- );
1364
- if (foundInspect) return null;
1365
- const dialogStyle = isDialogMode ? {
1366
- position: "fixed",
1367
- top: "50%",
1368
- left: "50%",
1369
- transform: "translate(-50%, -50%)",
1370
- width: "80vw",
1371
- height: "80vh",
1372
- maxWidth: "none",
1373
- maxHeight: "none",
1374
- padding: "2ch",
1375
- boxShadow: "0 0 0 5px rgba(0, 0, 0, 0.1)",
1376
- zIndex: 1e3
1377
- } : {};
1378
- const overlayStyle = isDialogMode ? {
1379
- position: "fixed",
1380
- top: 0,
1381
- left: 0,
1382
- right: 0,
1383
- bottom: 0,
1384
- backgroundColor: "rgba(0, 0, 0, 0.5)",
1385
- zIndex: 999
1386
- } : {};
1387
- const fiberStack = fiber ? getFiberStack(fiber) : [];
1388
- return /* @__PURE__ */ React17.createElement(React17.Fragment, null, isDialogMode && /* @__PURE__ */ React17.createElement(
1389
- "div",
1390
- {
1391
- style: overlayStyle,
1392
- onClick: () => setIsDialogMode(false),
1393
- onKeyDown: (e) => e.key === "Escape" && setIsDialogMode(false),
1394
- role: "button",
1395
- tabIndex: 0
1396
- }
1397
- ), /* @__PURE__ */ React17.createElement(
1398
- "div",
1399
- {
1400
- style: {
1401
- position: "fixed",
1402
- backgroundColor: "white",
1403
- zIndex: 50,
1404
- padding: "1ch",
1405
- width: "50ch",
1406
- height: "40ch",
1407
- transition: "all 150ms",
1408
- overflow: "visible",
1409
- boxShadow: "0 1px 3px 0 rgb(0 0 0 / 0.1)",
1410
- border: "1px solid black",
1411
- top: position.top,
1412
- left: position.left,
1413
- opacity: rect ? 1 : 0,
1414
- transform: rect ? "translateY(0)" : "translateY(10px)",
1415
- pointerEvents: rect ? "auto" : "none",
1416
- display: "flex",
1417
- flexDirection: "column",
1418
- ...dialogStyle
1328
+ top = Math.max(
1329
+ padding,
1330
+ Math.min(top, window.innerHeight - inspectorHeight - padding)
1331
+ );
1332
+ left = Math.max(
1333
+ padding,
1334
+ Math.min(left, window.innerWidth - inspectorWidth - padding)
1335
+ );
1336
+ setPosition({ top, left });
1337
+ }, [rect]);
1338
+ useEffect(() => {
1339
+ if (selectedFiber) {
1340
+ const element2 = getNearestHostFiber(selectedFiber)?.stateNode;
1341
+ if (element2) {
1342
+ setElement(element2);
1343
+ setRect(element2.getBoundingClientRect());
1344
+ }
1419
1345
  }
1420
- },
1421
- /* @__PURE__ */ React17.createElement(
1346
+ }, [selectedFiber]);
1347
+ if (window.innerWidth < 800 || !rect || !isActive) return null;
1348
+ const fiber = getFiberForDisplay();
1349
+ if (!fiber) return null;
1350
+ let foundInspect = false;
1351
+ traverseFiber(
1352
+ fiber,
1353
+ (innerFiber) => {
1354
+ if (innerFiber.type === Inspector2) {
1355
+ foundInspect = true;
1356
+ return true;
1357
+ }
1358
+ },
1359
+ true
1360
+ );
1361
+ if (foundInspect) return null;
1362
+ const dialogStyle = isDialogMode ? {
1363
+ position: "fixed",
1364
+ top: "50%",
1365
+ left: "50%",
1366
+ transform: "translate(-50%, -50%)",
1367
+ width: "80vw",
1368
+ height: "80vh",
1369
+ maxWidth: "none",
1370
+ maxHeight: "none",
1371
+ padding: "2ch",
1372
+ boxShadow: "0 0 0 5px rgba(0, 0, 0, 0.1)",
1373
+ zIndex: 1e3
1374
+ } : {};
1375
+ const overlayStyle = isDialogMode ? {
1376
+ position: "fixed",
1377
+ top: 0,
1378
+ left: 0,
1379
+ right: 0,
1380
+ bottom: 0,
1381
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
1382
+ zIndex: 999
1383
+ } : {};
1384
+ const fiberStack = fiber ? getFiberStack(fiber) : [];
1385
+ return /* @__PURE__ */ React17.createElement(React17.Fragment, null, isDialogMode && /* @__PURE__ */ React17.createElement(
1386
+ "div",
1387
+ {
1388
+ style: overlayStyle,
1389
+ onClick: () => setIsDialogMode(false),
1390
+ onKeyDown: (e) => e.key === "Escape" && setIsDialogMode(false),
1391
+ role: "button",
1392
+ tabIndex: 0
1393
+ }
1394
+ ), /* @__PURE__ */ React17.createElement(
1422
1395
  "div",
1423
1396
  {
1424
1397
  style: {
1398
+ position: "fixed",
1399
+ backgroundColor: "white",
1400
+ zIndex: 50,
1401
+ padding: "1ch",
1402
+ width: "50ch",
1403
+ height: "40ch",
1404
+ transition: "all 150ms, z-index 0ms",
1405
+ overflow: "visible",
1406
+ boxShadow: "0 1px 3px 0 rgb(0 0 0 / 0.1)",
1407
+ border: "1px solid black",
1408
+ top: position.top,
1409
+ left: position.left,
1410
+ opacity: rect ? 1 : 0,
1411
+ transform: rect ? "translateY(0)" : "translateY(10px)",
1412
+ pointerEvents: rect ? "auto" : "none",
1425
1413
  display: "flex",
1426
- justifyContent: "space-between",
1427
- alignItems: "center",
1428
- marginBottom: "1ch"
1414
+ flexDirection: "column",
1415
+ ...dialogStyle
1429
1416
  }
1430
1417
  },
1431
1418
  /* @__PURE__ */ React17.createElement(
1432
- "h3",
1419
+ "div",
1433
1420
  {
1434
1421
  style: {
1435
- fontSize: "0.875rem",
1436
- backgroundColor: "#f5f5f5",
1437
- padding: "0 0.5ch",
1438
- borderRadius: "0.125rem",
1439
- width: "fit-content",
1440
- margin: 0
1422
+ display: "flex",
1423
+ justifyContent: "space-between",
1424
+ alignItems: "center",
1425
+ marginBottom: "1ch"
1441
1426
  }
1442
1427
  },
1443
- `<${typeof fiber.type === "string" ? fiber.type : getDisplayName(fiber.type) || "unknown"}>`,
1444
- !isDialogMode && /* @__PURE__ */ React17.createElement(
1445
- "span",
1428
+ /* @__PURE__ */ React17.createElement(
1429
+ "h3",
1446
1430
  {
1447
- style: { marginLeft: "1ch", opacity: 0.5, fontSize: "0.75rem" }
1431
+ style: {
1432
+ fontSize: "0.875rem",
1433
+ backgroundColor: "#f5f5f5",
1434
+ padding: "0 0.5ch",
1435
+ borderRadius: "0.125rem",
1436
+ width: "fit-content",
1437
+ margin: 0
1438
+ }
1439
+ },
1440
+ `<${typeof fiber.type === "string" ? fiber.type : getDisplayName(fiber.type) || "unknown"}>`,
1441
+ !isDialogMode && /* @__PURE__ */ React17.createElement(
1442
+ "span",
1443
+ {
1444
+ style: {
1445
+ marginLeft: "1ch",
1446
+ opacity: 0.5,
1447
+ fontSize: "0.75rem"
1448
+ }
1449
+ },
1450
+ `Press ${isMac ? "\u2318" : "ctrl"}O to expand`
1451
+ )
1452
+ ),
1453
+ isDialogMode && fiber.child && /* @__PURE__ */ React17.createElement(
1454
+ "div",
1455
+ {
1456
+ style: {
1457
+ marginTop: "1ch",
1458
+ marginBottom: "1ch",
1459
+ marginRight: "auto",
1460
+ marginLeft: "1ch",
1461
+ fontSize: "0.75rem",
1462
+ display: "flex",
1463
+ flexWrap: "wrap",
1464
+ gap: "0.5ch"
1465
+ }
1466
+ },
1467
+ /* @__PURE__ */ React17.createElement("span", { style: { opacity: 0.5 } }, "Children:"),
1468
+ /* @__PURE__ */ React17.createElement(
1469
+ "div",
1470
+ {
1471
+ style: { display: "flex", flexWrap: "wrap", gap: "0.5ch" }
1472
+ },
1473
+ (() => {
1474
+ const children = [];
1475
+ let currentChild = fiber.child;
1476
+ while (currentChild !== null) {
1477
+ children.push(currentChild);
1478
+ currentChild = currentChild.sibling;
1479
+ }
1480
+ return children.map((child) => {
1481
+ const name = typeof child.type === "string" ? child.type : getDisplayName(child.type) || "unknown";
1482
+ return /* @__PURE__ */ React17.createElement(
1483
+ "button",
1484
+ {
1485
+ key: getFiberId(child),
1486
+ type: "button",
1487
+ onClick: () => {
1488
+ setSelectedFiber(child);
1489
+ const element2 = getNearestHostFiber(child)?.stateNode;
1490
+ if (element2) {
1491
+ setElement(element2);
1492
+ setRect(element2.getBoundingClientRect());
1493
+ }
1494
+ },
1495
+ onKeyDown: (e) => {
1496
+ if (e.key === "Enter" || e.key === " ") {
1497
+ setSelectedFiber(child);
1498
+ const element2 = getNearestHostFiber(child)?.stateNode;
1499
+ if (element2) {
1500
+ setElement(element2);
1501
+ setRect(element2.getBoundingClientRect());
1502
+ }
1503
+ }
1504
+ },
1505
+ style: {
1506
+ cursor: "pointer",
1507
+ padding: "0 0.5ch",
1508
+ background: "#f5f5f5",
1509
+ border: "1px solid #eee",
1510
+ borderRadius: "0.125rem",
1511
+ fontSize: "inherit",
1512
+ color: "#666"
1513
+ },
1514
+ onMouseEnter: (e) => {
1515
+ e.currentTarget.style.backgroundColor = "#000";
1516
+ e.currentTarget.style.color = "#fff";
1517
+ e.currentTarget.style.borderColor = "#000";
1518
+ },
1519
+ onMouseLeave: (e) => {
1520
+ e.currentTarget.style.backgroundColor = "#f5f5f5";
1521
+ e.currentTarget.style.color = "#666";
1522
+ e.currentTarget.style.borderColor = "#eee";
1523
+ }
1524
+ },
1525
+ name
1526
+ );
1527
+ });
1528
+ })()
1529
+ )
1530
+ ),
1531
+ isDialogMode && /* @__PURE__ */ React17.createElement(
1532
+ "button",
1533
+ {
1534
+ type: "button",
1535
+ onClick: () => setIsDialogMode(false),
1536
+ style: {
1537
+ border: "none",
1538
+ background: "none",
1539
+ cursor: "pointer",
1540
+ padding: "0.5ch",
1541
+ fontSize: "2ch",
1542
+ opacity: 0.5
1543
+ }
1448
1544
  },
1449
- `Press ${isMac ? "\u2318" : "ctrl"}O to expand`
1545
+ "\xD7"
1450
1546
  )
1451
1547
  ),
1452
- isDialogMode && fiber.child && /* @__PURE__ */ React17.createElement(
1548
+ isDialogMode && /* @__PURE__ */ React17.createElement(
1453
1549
  "div",
1454
1550
  {
1455
1551
  style: {
1456
- marginTop: "1ch",
1457
- marginBottom: "1ch",
1458
- marginRight: "auto",
1459
- marginLeft: "1ch",
1552
+ borderTop: "1px solid #eee",
1553
+ padding: "0.5ch 0",
1460
1554
  fontSize: "0.75rem",
1461
- display: "flex",
1462
- flexWrap: "wrap",
1463
- gap: "0.5ch"
1555
+ color: "#666",
1556
+ whiteSpace: "nowrap",
1557
+ overflow: "hidden",
1558
+ textOverflow: "ellipsis",
1559
+ marginBottom: "2ch"
1464
1560
  }
1465
1561
  },
1466
- /* @__PURE__ */ React17.createElement("span", { style: { opacity: 0.5 } }, "Children:"),
1467
- /* @__PURE__ */ React17.createElement("div", { style: { display: "flex", flexWrap: "wrap", gap: "0.5ch" } }, (() => {
1468
- const children = [];
1469
- let currentChild = fiber.child;
1470
- while (currentChild !== null) {
1471
- children.push(currentChild);
1472
- currentChild = currentChild.sibling;
1473
- }
1474
- return children.map((child) => {
1475
- const name = typeof child.type === "string" ? child.type : getDisplayName(child.type) || "unknown";
1476
- return /* @__PURE__ */ React17.createElement(
1477
- "button",
1478
- {
1479
- key: getFiberId(child),
1480
- type: "button",
1481
- onClick: () => {
1482
- setSelectedFiber(child);
1483
- const element2 = getNearestHostFiber(child)?.stateNode;
1562
+ fiberStack.reverse().map((f, i, arr) => {
1563
+ const name = typeof f.type === "string" ? f.type : getDisplayName(f.type) || "unknown";
1564
+ if (!name) return null;
1565
+ return /* @__PURE__ */ React17.createElement(React17.Fragment, { key: getFiberId(f) }, /* @__PURE__ */ React17.createElement(
1566
+ "button",
1567
+ {
1568
+ type: "button",
1569
+ onClick: () => {
1570
+ setSelectedFiber(f);
1571
+ const element2 = getNearestHostFiber(f)?.stateNode;
1572
+ if (element2) {
1573
+ setElement(element2);
1574
+ setRect(element2.getBoundingClientRect());
1575
+ }
1576
+ },
1577
+ onKeyDown: (e) => {
1578
+ if (e.key === "Enter" || e.key === " ") {
1579
+ setSelectedFiber(f);
1580
+ const element2 = getNearestHostFiber(f)?.stateNode;
1484
1581
  if (element2) {
1485
1582
  setElement(element2);
1486
1583
  setRect(element2.getBoundingClientRect());
1487
1584
  }
1488
- },
1489
- onKeyDown: (e) => {
1490
- if (e.key === "Enter" || e.key === " ") {
1491
- setSelectedFiber(child);
1492
- const element2 = getNearestHostFiber(child)?.stateNode;
1493
- if (element2) {
1494
- setElement(element2);
1495
- setRect(element2.getBoundingClientRect());
1496
- }
1497
- }
1498
- },
1499
- style: {
1500
- cursor: "pointer",
1501
- padding: "0 0.5ch",
1502
- background: "#f5f5f5",
1503
- border: "1px solid #eee",
1504
- borderRadius: "0.125rem",
1505
- fontSize: "inherit",
1506
- color: "#666"
1507
- },
1508
- onMouseEnter: (e) => {
1509
- e.currentTarget.style.backgroundColor = "#000";
1510
- e.currentTarget.style.color = "#fff";
1511
- e.currentTarget.style.borderColor = "#000";
1512
- },
1513
- onMouseLeave: (e) => {
1514
- e.currentTarget.style.backgroundColor = "#f5f5f5";
1515
- e.currentTarget.style.color = "#666";
1516
- e.currentTarget.style.borderColor = "#eee";
1517
1585
  }
1518
1586
  },
1519
- name
1520
- );
1521
- });
1522
- })())
1587
+ style: {
1588
+ cursor: "pointer",
1589
+ textDecoration: "underline",
1590
+ color: "#666",
1591
+ background: "none",
1592
+ border: "none",
1593
+ padding: 0,
1594
+ font: "inherit"
1595
+ },
1596
+ onMouseEnter: (e) => {
1597
+ e.currentTarget.style.backgroundColor = "#000";
1598
+ e.currentTarget.style.color = "#fff";
1599
+ },
1600
+ onMouseLeave: (e) => {
1601
+ e.currentTarget.style.backgroundColor = "";
1602
+ e.currentTarget.style.color = "#666";
1603
+ }
1604
+ },
1605
+ name
1606
+ ), i < arr.length - 1 && " > ");
1607
+ })
1523
1608
  ),
1524
- isDialogMode && /* @__PURE__ */ React17.createElement(
1525
- "button",
1609
+ /* @__PURE__ */ React17.createElement(
1610
+ "div",
1526
1611
  {
1527
- type: "button",
1528
- onClick: () => setIsDialogMode(false),
1612
+ onMouseLeave: handlePropertyLeave,
1529
1613
  style: {
1530
- border: "none",
1531
- background: "none",
1532
- cursor: "pointer",
1533
- padding: "0.5ch",
1534
- fontSize: "2ch",
1535
- opacity: 0.5
1614
+ flex: 1,
1615
+ overflow: "auto"
1536
1616
  }
1537
1617
  },
1538
- "\xD7"
1539
- )
1540
- ),
1541
- isDialogMode && /* @__PURE__ */ React17.createElement(
1542
- "div",
1543
- {
1544
- style: {
1545
- borderTop: "1px solid #eee",
1546
- padding: "0.5ch 0",
1547
- fontSize: "0.75rem",
1548
- color: "#666",
1549
- whiteSpace: "nowrap",
1550
- overflow: "hidden",
1551
- textOverflow: "ellipsis",
1552
- marginBottom: "2ch"
1553
- }
1554
- },
1555
- fiberStack.reverse().map((f, i, arr) => {
1556
- const name = typeof f.type === "string" ? f.type : getDisplayName(f.type) || "unknown";
1557
- if (!name) return null;
1558
- return /* @__PURE__ */ React17.createElement(React17.Fragment, { key: getFiberId(f) }, /* @__PURE__ */ React17.createElement(
1559
- "button",
1618
+ /* @__PURE__ */ React17.createElement(
1619
+ Inspector,
1560
1620
  {
1561
- type: "button",
1562
- onClick: () => {
1563
- setSelectedFiber(f);
1564
- const element2 = getNearestHostFiber(f)?.stateNode;
1565
- if (element2) {
1566
- setElement(element2);
1567
- setRect(element2.getBoundingClientRect());
1568
- }
1569
- },
1570
- onKeyDown: (e) => {
1571
- if (e.key === "Enter" || e.key === " ") {
1572
- setSelectedFiber(f);
1573
- const element2 = getNearestHostFiber(f)?.stateNode;
1574
- if (element2) {
1575
- setElement(element2);
1576
- setRect(element2.getBoundingClientRect());
1577
- }
1578
- }
1579
- },
1580
- style: {
1581
- cursor: "pointer",
1582
- textDecoration: "underline",
1583
- color: "#666",
1584
- background: "none",
1585
- border: "none",
1586
- padding: 0,
1587
- font: "inherit"
1588
- },
1589
- onMouseEnter: (e) => {
1590
- e.currentTarget.style.backgroundColor = "#000";
1591
- e.currentTarget.style.color = "#fff";
1592
- },
1593
- onMouseLeave: (e) => {
1594
- e.currentTarget.style.backgroundColor = "";
1595
- e.currentTarget.style.color = "#666";
1621
+ data: fiber,
1622
+ expandLevel: 1,
1623
+ table: false,
1624
+ nodeRenderer: (props) => {
1625
+ const Component = props.depth === 0 ? ObjectRootLabel : ObjectLabel;
1626
+ return /* @__PURE__ */ React17.createElement(
1627
+ "span",
1628
+ {
1629
+ onMouseEnter: (e) => handlePropertyHover(e, props.name),
1630
+ onMouseLeave: handlePropertyLeave,
1631
+ style: {
1632
+ cursor: FIBER_PROP_EXPLANATIONS[props.name] ? "help" : "default",
1633
+ padding: "1px 0",
1634
+ display: "inline-block",
1635
+ fontWeight: FIBER_PROP_EXPLANATIONS[props.name] ? 500 : "normal"
1636
+ }
1637
+ },
1638
+ /* @__PURE__ */ React17.createElement(
1639
+ Component,
1640
+ {
1641
+ name: props.name,
1642
+ data: props.data,
1643
+ isNonenumerable: props.isNonenumerable
1644
+ }
1645
+ )
1646
+ );
1596
1647
  }
1597
- },
1598
- name
1599
- ), i < arr.length - 1 && " > ");
1600
- })
1601
- ),
1602
- /* @__PURE__ */ React17.createElement(
1603
- "div",
1604
- {
1605
- onMouseLeave: handlePropertyLeave,
1606
- style: {
1607
- flex: 1,
1608
- overflow: "auto"
1609
- }
1610
- },
1611
- /* @__PURE__ */ React17.createElement(
1612
- Inspector,
1648
+ }
1649
+ )
1650
+ ),
1651
+ tooltip && /* @__PURE__ */ React17.createElement(
1652
+ "div",
1613
1653
  {
1614
- data: fiber,
1615
- expandLevel: 1,
1616
- table: false,
1617
- nodeRenderer: (props) => {
1618
- const Component = props.depth === 0 ? ObjectRootLabel : ObjectLabel;
1619
- return /* @__PURE__ */ React17.createElement(
1620
- "span",
1621
- {
1622
- onMouseEnter: (e) => handlePropertyHover(e, props.name),
1623
- style: {
1624
- cursor: FIBER_PROP_EXPLANATIONS[props.name] ? "help" : "default",
1625
- padding: "1px 0",
1626
- display: "inline-block",
1627
- fontWeight: FIBER_PROP_EXPLANATIONS[props.name] ? 500 : "normal"
1628
- }
1629
- },
1630
- /* @__PURE__ */ React17.createElement(
1631
- Component,
1632
- {
1633
- name: props.name,
1634
- data: props.data,
1635
- isNonenumerable: props.isNonenumerable
1636
- }
1637
- )
1638
- );
1654
+ style: {
1655
+ position: "absolute",
1656
+ zIndex: 1001,
1657
+ backgroundColor: "#000",
1658
+ color: "white",
1659
+ bottom: "2ch",
1660
+ right: "2ch",
1661
+ pointerEvents: "none",
1662
+ overflowY: "auto",
1663
+ padding: "1ch",
1664
+ fontSize: "1ch"
1639
1665
  }
1640
- }
1666
+ },
1667
+ tooltip
1641
1668
  )
1642
- ),
1643
- tooltip && /* @__PURE__ */ React17.createElement(
1669
+ ), !isDialogMode && /* @__PURE__ */ React17.createElement(
1644
1670
  "div",
1645
1671
  {
1646
1672
  style: {
1647
- position: "absolute",
1648
- zIndex: 1001,
1649
- backgroundColor: "#000",
1650
- color: "white",
1651
- bottom: "2ch",
1652
- right: "2ch",
1673
+ position: "fixed",
1674
+ zIndex: 40,
1653
1675
  pointerEvents: "none",
1654
- overflowY: "auto",
1655
- padding: "1ch",
1656
- fontSize: "1ch"
1676
+ transition: "all 150ms",
1677
+ border: "1px dashed #a3a3a3",
1678
+ left: rect.left,
1679
+ top: rect.top,
1680
+ width: rect.width,
1681
+ height: rect.height,
1682
+ opacity: rect ? 1 : 0
1657
1683
  }
1658
- },
1659
- tooltip
1660
- )
1661
- ), !isDialogMode && /* @__PURE__ */ React17.createElement(
1662
- "div",
1663
- {
1664
- style: {
1665
- position: "fixed",
1666
- zIndex: 40,
1667
- pointerEvents: "none",
1668
- transition: "all 150ms",
1669
- border: "1px dashed #a3a3a3",
1670
- left: rect.left,
1671
- top: rect.top,
1672
- width: rect.width,
1673
- height: rect.height,
1674
- opacity: rect ? 1 : 0
1675
1684
  }
1676
- }
1677
- ));
1678
- };
1685
+ ));
1686
+ }
1687
+ );
1679
1688
  var inspect_default = Inspector2;
1680
1689
 
1681
1690
  export { Inspector2 as Inspector, inspect_default as default };