database-devtools 0.1.3 → 0.1.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/README.md CHANGED
@@ -94,3 +94,16 @@ For **local development only**. The hub listens on `0.0.0.0`. The RN overlay is
94
94
  ## License
95
95
 
96
96
  MIT © [tamangRajkumar/database-devtools](https://github.com/tamangRajkumar/database-devtools)
97
+
98
+ ## Publishing (maintainers)
99
+
100
+ The npm package ships **two artifacts**: the JS library (`dist/*.js`) and the static browser hub (`dist/web/` including `sql-wasm.wasm`).
101
+
102
+ Always run the **full** build before publishing:
103
+
104
+ ```bash
105
+ pnpm build # from monorepo root
106
+ pnpm --filter database-devtools publish --no-git-checks --otp=CODE
107
+ ```
108
+
109
+ Do **not** run `tsup` alone — it wipes `dist/` and does not rebuild the web UI. `prepublishOnly` will fail if `dist/web` or wasm assets are missing.
@@ -32,8 +32,12 @@ type DatabaseDevToolsProps = {
32
32
  onFloatingPositionChange?: (position: FloatingButtonPosition) => void;
33
33
  /** Optional style for the floating button database icon. */
34
34
  style?: StyleProp<TextStyle>;
35
+ /** Floating button background color. */
36
+ buttonColor?: string;
37
+ /** Database icon color. */
38
+ iconColor?: string;
35
39
  onConnectionStateChange?: (state: ConnectionState) => void;
36
40
  };
37
- declare function DatabaseDevTools({ database, type, adapter, serverUrl, enabled, position, draggable, snapToEdges, floatingPosition, onFloatingPositionChange, style, onConnectionStateChange, }: DatabaseDevToolsProps): react_jsx_runtime.JSX.Element | null;
41
+ declare function DatabaseDevTools({ database, type, adapter, serverUrl, enabled, position, draggable, snapToEdges, floatingPosition, onFloatingPositionChange, style, buttonColor, iconColor, onConnectionStateChange, }: DatabaseDevToolsProps): react_jsx_runtime.JSX.Element | null;
38
42
 
39
43
  export { DatabaseDevTools as D, type FloatingButtonPosition as F, type DatabaseDevToolsProps as a, type DatabaseDialect as b };
@@ -32,8 +32,12 @@ type DatabaseDevToolsProps = {
32
32
  onFloatingPositionChange?: (position: FloatingButtonPosition) => void;
33
33
  /** Optional style for the floating button database icon. */
34
34
  style?: StyleProp<TextStyle>;
35
+ /** Floating button background color. */
36
+ buttonColor?: string;
37
+ /** Database icon color. */
38
+ iconColor?: string;
35
39
  onConnectionStateChange?: (state: ConnectionState) => void;
36
40
  };
37
- declare function DatabaseDevTools({ database, type, adapter, serverUrl, enabled, position, draggable, snapToEdges, floatingPosition, onFloatingPositionChange, style, onConnectionStateChange, }: DatabaseDevToolsProps): react_jsx_runtime.JSX.Element | null;
41
+ declare function DatabaseDevTools({ database, type, adapter, serverUrl, enabled, position, draggable, snapToEdges, floatingPosition, onFloatingPositionChange, style, buttonColor, iconColor, onConnectionStateChange, }: DatabaseDevToolsProps): react_jsx_runtime.JSX.Element | null;
38
42
 
39
43
  export { DatabaseDevTools as D, type FloatingButtonPosition as F, type DatabaseDevToolsProps as a, type DatabaseDialect as b };
@@ -580,6 +580,10 @@ function DevToolsProvider({
580
580
  setDeviceId(persistedId);
581
581
  setDeviceIdReady(true);
582
582
  }
583
+ }).catch(() => {
584
+ if (!cancelled) {
585
+ setDeviceIdReady(true);
586
+ }
583
587
  });
584
588
  return () => {
585
589
  cancelled = true;
@@ -1340,9 +1344,12 @@ function isFloatingButtonTap(totalMovement) {
1340
1344
  }
1341
1345
  var DEFAULT_ICON_SIZE = 22;
1342
1346
  var DEFAULT_ICON_COLOR = "#f8fafc";
1347
+ var DEFAULT_BUTTON_COLOR = "#1e293b";
1343
1348
  function FloatingDevToolsButton({
1344
1349
  position = "bottom-right",
1345
1350
  iconStyle,
1351
+ buttonColor,
1352
+ iconColor,
1346
1353
  draggable = true,
1347
1354
  snapToEdges = true,
1348
1355
  floatingPosition,
@@ -1446,22 +1453,24 @@ function FloatingDevToolsButton({
1446
1453
  if (!renderedPosition) {
1447
1454
  return null;
1448
1455
  }
1456
+ const resolvedButtonColor = buttonColor ?? DEFAULT_BUTTON_COLOR;
1457
+ const resolvedIconColor = iconColor ?? StyleSheet.flatten(iconStyle)?.color ?? DEFAULT_ICON_COLOR;
1458
+ const buttonStyle = { backgroundColor: resolvedButtonColor };
1459
+ const statusDotStyle = {
1460
+ backgroundColor: getConnectionDotColor(connectionState),
1461
+ borderColor: resolvedButtonColor
1462
+ };
1449
1463
  const buttonContent = /* @__PURE__ */ jsxs(Fragment, { children: [
1450
1464
  /* @__PURE__ */ jsx(
1451
1465
  MaterialCommunityIcons,
1452
1466
  {
1453
- color: DEFAULT_ICON_COLOR,
1467
+ color: resolvedIconColor,
1454
1468
  name: "database",
1455
1469
  size: DEFAULT_ICON_SIZE,
1456
1470
  style: iconStyle
1457
1471
  }
1458
1472
  ),
1459
- /* @__PURE__ */ jsx(
1460
- View,
1461
- {
1462
- style: [styles4.statusDot, { backgroundColor: getConnectionDotColor(connectionState) }]
1463
- }
1464
- )
1473
+ /* @__PURE__ */ jsx(View, { style: [styles4.statusDot, statusDotStyle] })
1465
1474
  ] });
1466
1475
  if (!draggable) {
1467
1476
  const positionStyle = position === "bottom-left" ? styles4.bottomLeft : styles4.bottomRight;
@@ -1471,7 +1480,11 @@ function FloatingDevToolsButton({
1471
1480
  accessibilityLabel: "Open Database DevTools",
1472
1481
  accessibilityRole: "button",
1473
1482
  onPress: openLauncher,
1474
- style: ({ pressed }) => [styles4.button, pressed && styles4.buttonPressed],
1483
+ style: ({ pressed }) => [
1484
+ styles4.button,
1485
+ buttonStyle,
1486
+ pressed && styles4.buttonPressed
1487
+ ],
1475
1488
  children: buttonContent
1476
1489
  }
1477
1490
  ) });
@@ -1496,7 +1509,7 @@ function FloatingDevToolsButton({
1496
1509
  accessibilityHint: "Drag to move. Tap to open DevTools launcher.",
1497
1510
  accessibilityLabel: "Open Database DevTools",
1498
1511
  accessibilityRole: "button",
1499
- style: [styles4.button, dragPosition && styles4.buttonDragging],
1512
+ style: [styles4.button, buttonStyle, dragPosition && styles4.buttonDragging],
1500
1513
  children: buttonContent
1501
1514
  }
1502
1515
  )
@@ -1525,7 +1538,6 @@ var styles4 = StyleSheet.create({
1525
1538
  width: FLOATING_BUTTON_SIZE,
1526
1539
  height: FLOATING_BUTTON_SIZE,
1527
1540
  borderRadius: FLOATING_BUTTON_SIZE / 2,
1528
- backgroundColor: "#1e293b",
1529
1541
  alignItems: "center",
1530
1542
  justifyContent: "center",
1531
1543
  shadowColor: "#000",
@@ -1548,8 +1560,7 @@ var styles4 = StyleSheet.create({
1548
1560
  width: 10,
1549
1561
  height: 10,
1550
1562
  borderRadius: 5,
1551
- borderWidth: 2,
1552
- borderColor: "#1e293b"
1563
+ borderWidth: 2
1553
1564
  }
1554
1565
  });
1555
1566
  var explorerColors = {
@@ -2692,6 +2703,8 @@ function DatabaseDevTools({
2692
2703
  floatingPosition,
2693
2704
  onFloatingPositionChange,
2694
2705
  style,
2706
+ buttonColor,
2707
+ iconColor,
2695
2708
  onConnectionStateChange
2696
2709
  }) {
2697
2710
  if (!isDevToolsEnabled(enabled)) {
@@ -2709,8 +2722,10 @@ function DatabaseDevTools({
2709
2722
  /* @__PURE__ */ jsx(
2710
2723
  FloatingDevToolsButton,
2711
2724
  {
2725
+ buttonColor,
2712
2726
  draggable,
2713
2727
  floatingPosition,
2728
+ iconColor,
2714
2729
  iconStyle: style,
2715
2730
  onFloatingPositionChange,
2716
2731
  position,
@@ -2726,5 +2741,5 @@ function DatabaseDevTools({
2726
2741
  }
2727
2742
 
2728
2743
  export { DatabaseDevTools, createExpoSqliteInspector, handleBeginTransaction, handleCommitTransaction, handleExecuteWrite, handleRollbackTransaction, isEditableDatabaseAdapter, isWritableDatabaseAdapter };
2729
- //# sourceMappingURL=chunk-NHHA5CZP.js.map
2730
- //# sourceMappingURL=chunk-NHHA5CZP.js.map
2744
+ //# sourceMappingURL=chunk-SFLXGLHQ.js.map
2745
+ //# sourceMappingURL=chunk-SFLXGLHQ.js.map