@dbx-tools/ui 0.9.187 → 0.9.189
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/index.ts +1 -1
- package/package.json +7 -7
- package/src/react/debug-capture.tsx +36 -5
package/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@better-auth/passkey": "1.7.6",
|
|
33
33
|
"@databricks/appkit-ui": "0.81.0",
|
|
34
|
-
"@dbx-tools/shared-appkit": "
|
|
35
|
-
"@dbx-tools/shared-auth": "
|
|
36
|
-
"@dbx-tools/shared-core": "
|
|
37
|
-
"@dbx-tools/shared-email": "
|
|
38
|
-
"@dbx-tools/shared-email-template": "
|
|
39
|
-
"@dbx-tools/shared-search": "
|
|
34
|
+
"@dbx-tools/shared-appkit": "0.9.189",
|
|
35
|
+
"@dbx-tools/shared-auth": "0.9.189",
|
|
36
|
+
"@dbx-tools/shared-core": "0.9.189",
|
|
37
|
+
"@dbx-tools/shared-email": "0.9.189",
|
|
38
|
+
"@dbx-tools/shared-email-template": "0.9.189",
|
|
39
|
+
"@dbx-tools/shared-search": "0.9.189",
|
|
40
40
|
"lucide-react": "^0.554.0",
|
|
41
41
|
"shiki": "^3.0.0",
|
|
42
42
|
"streamdown": "^2.5.0",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
|
-
"version": "0.9.
|
|
50
|
+
"version": "0.9.189",
|
|
51
51
|
"types": "index.ts",
|
|
52
52
|
"dbxToolsConfig": {
|
|
53
53
|
"tags": [
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
type DebugCaptureEvent,
|
|
17
17
|
type DebugCaptureScalar,
|
|
18
18
|
} from "@dbx-tools/shared-appkit/debug";
|
|
19
|
-
import { BugIcon } from "lucide-react";
|
|
19
|
+
import { BugIcon, CheckIcon } from "lucide-react";
|
|
20
20
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
21
21
|
|
|
22
22
|
import { copyText } from "./clipboard.ts";
|
|
@@ -456,25 +456,43 @@ export function BrowserDebugCaptureButton({
|
|
|
456
456
|
}: BrowserDebugCaptureButtonProps) {
|
|
457
457
|
const { available, captureId, error, phase, startCapture, stopCapture } =
|
|
458
458
|
useBrowserDebugCapture(options);
|
|
459
|
+
const [copiedId, setCopiedId] = useState<string | null>(null);
|
|
460
|
+
const copiedTimerRef = useRef<number | null>(null);
|
|
459
461
|
const recording = phase === "recording";
|
|
460
462
|
const busy = phase === "starting" || phase === "stopping";
|
|
461
463
|
|
|
464
|
+
useEffect(
|
|
465
|
+
() => () => {
|
|
466
|
+
if (copiedTimerRef.current !== null) window.clearTimeout(copiedTimerRef.current);
|
|
467
|
+
},
|
|
468
|
+
[],
|
|
469
|
+
);
|
|
470
|
+
|
|
462
471
|
if (!available) return null;
|
|
463
472
|
|
|
464
473
|
const tooltip = error
|
|
465
474
|
? error
|
|
466
475
|
: recording
|
|
467
476
|
? "Stop browser capture and copy ID"
|
|
468
|
-
:
|
|
477
|
+
: copiedId
|
|
478
|
+
? `Copied ${copiedId}`
|
|
479
|
+
: "Start browser debug capture";
|
|
469
480
|
|
|
470
481
|
const toggle = (button: HTMLButtonElement) => {
|
|
471
482
|
button.blur();
|
|
483
|
+
|
|
472
484
|
if (!recording || !captureId) {
|
|
473
485
|
void startCapture();
|
|
474
486
|
return;
|
|
475
487
|
}
|
|
476
488
|
// Begin the clipboard write inside the original iOS tap gesture.
|
|
477
|
-
void copyText(captureId)
|
|
489
|
+
void copyText(captureId).then((copied) => {
|
|
490
|
+
if (!copied) return;
|
|
491
|
+
setCopiedId(captureId);
|
|
492
|
+
if (copiedTimerRef.current !== null) window.clearTimeout(copiedTimerRef.current);
|
|
493
|
+
copiedTimerRef.current = window.setTimeout(() => setCopiedId(null), 5_000);
|
|
494
|
+
});
|
|
495
|
+
|
|
478
496
|
void stopCapture();
|
|
479
497
|
};
|
|
480
498
|
|
|
@@ -490,7 +508,7 @@ export function BrowserDebugCaptureButton({
|
|
|
490
508
|
disabled={busy}
|
|
491
509
|
aria-label={recording ? "Stop browser capture and copy ID" : "Start browser capture"}
|
|
492
510
|
aria-pressed={recording}
|
|
493
|
-
data-capture-id={captureId ?? undefined}
|
|
511
|
+
data-capture-id={captureId ?? copiedId ?? undefined}
|
|
494
512
|
data-capture-state={phase}
|
|
495
513
|
className={cn(
|
|
496
514
|
"relative size-8",
|
|
@@ -500,7 +518,12 @@ export function BrowserDebugCaptureButton({
|
|
|
500
518
|
)}
|
|
501
519
|
onClick={(event) => toggle(event.currentTarget)}
|
|
502
520
|
>
|
|
503
|
-
|
|
521
|
+
{copiedId && !recording ? (
|
|
522
|
+
<CheckIcon className="size-4" />
|
|
523
|
+
) : (
|
|
524
|
+
<BugIcon className="size-4" />
|
|
525
|
+
)}
|
|
526
|
+
|
|
504
527
|
{recording ? (
|
|
505
528
|
<span className="absolute right-1 top-1 size-1.5 rounded-full bg-destructive" />
|
|
506
529
|
) : null}
|
|
@@ -509,6 +532,14 @@ export function BrowserDebugCaptureButton({
|
|
|
509
532
|
<TooltipContent>{tooltip}</TooltipContent>
|
|
510
533
|
</Tooltip>
|
|
511
534
|
</TooltipProvider>
|
|
535
|
+
{copiedId && !recording ? (
|
|
536
|
+
<span
|
|
537
|
+
role="status"
|
|
538
|
+
className="absolute right-0 top-full z-50 mt-2 whitespace-nowrap rounded-md border bg-popover px-2 py-1 text-xs text-popover-foreground shadow-md"
|
|
539
|
+
>
|
|
540
|
+
Copied {copiedId}
|
|
541
|
+
</span>
|
|
542
|
+
) : null}
|
|
512
543
|
</div>
|
|
513
544
|
);
|
|
514
545
|
}
|