@insitue/sdk 0.4.4 → 0.4.6
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/capture-only.js
CHANGED
|
@@ -543,6 +543,17 @@ function fromAttribute(el) {
|
|
|
543
543
|
}
|
|
544
544
|
return null;
|
|
545
545
|
}
|
|
546
|
+
function fromCmsAttribute(el) {
|
|
547
|
+
let cur = el;
|
|
548
|
+
for (let i3 = 0; cur && i3 < 16; i3++, cur = cur.parentElement) {
|
|
549
|
+
const handle = cur.getAttribute("data-insitue-cms");
|
|
550
|
+
if (handle) {
|
|
551
|
+
const adminUrl = cur.getAttribute("data-insitue-cms-url") ?? void 0;
|
|
552
|
+
return adminUrl ? { handle, adminUrl } : { handle };
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
return void 0;
|
|
556
|
+
}
|
|
546
557
|
function resolveTarget(el) {
|
|
547
558
|
const selector = buildSelector(el);
|
|
548
559
|
const fiber = getFiber(el);
|
|
@@ -580,7 +591,9 @@ function resolveTarget(el) {
|
|
|
580
591
|
}
|
|
581
592
|
}
|
|
582
593
|
}
|
|
583
|
-
|
|
594
|
+
const cmsSource = fromCmsAttribute(el);
|
|
595
|
+
const base = source === void 0 ? { confidence, componentStack, selector } : { source, confidence, componentStack, selector };
|
|
596
|
+
return cmsSource ? { ...base, cmsSource } : base;
|
|
584
597
|
}
|
|
585
598
|
var CAPTURE_SCHEMA_VERSION = 3;
|
|
586
599
|
var PROTOCOL_VERSION = 5;
|
|
@@ -2482,6 +2495,106 @@ function defaultDeliver(draft) {
|
|
|
2482
2495
|
} catch {
|
|
2483
2496
|
}
|
|
2484
2497
|
}
|
|
2498
|
+
function offlineHelpCard(reason, onClose) {
|
|
2499
|
+
const ink = "#ececef";
|
|
2500
|
+
const sub = "#a0a0aa";
|
|
2501
|
+
const faint = "#6b6b75";
|
|
2502
|
+
const line = "#26262d";
|
|
2503
|
+
const surface = "#13131a";
|
|
2504
|
+
const accent = "#5751e6";
|
|
2505
|
+
const mono = 'ui-monospace,"SF Mono",SFMono-Regular,Menlo,monospace';
|
|
2506
|
+
const sans = '-apple-system,BlinkMacSystemFont,"Segoe UI",Inter,Roboto,"Helvetica Neue",Arial,sans-serif';
|
|
2507
|
+
const title = reason === "companion" ? "Open claude to activate InSitue" : "Attach claude to start picking";
|
|
2508
|
+
const lead = reason === "companion" ? "The local companion isn't reachable yet. Open a terminal in this project and start claude." : "The companion is running, but no claude session is listening. Run the slash command below to attach.";
|
|
2509
|
+
const step1 = reason === "companion" ? "In your project directory, run:" : "In your existing claude session, run:";
|
|
2510
|
+
const cmd1 = reason === "companion" ? "claude" : "/insitue:connect";
|
|
2511
|
+
const step2 = reason === "companion" ? "Then inside claude, run:" : null;
|
|
2512
|
+
const cmd2 = reason === "companion" ? "/insitue:connect" : null;
|
|
2513
|
+
const code = (s3) => k(
|
|
2514
|
+
"code",
|
|
2515
|
+
{
|
|
2516
|
+
style: `display:inline-block;font:600 12.5px/1.4 ${mono};color:${ink};background:#0c0c11;border:1px solid ${line};padding:6px 10px;border-radius:6px`
|
|
2517
|
+
},
|
|
2518
|
+
s3
|
|
2519
|
+
);
|
|
2520
|
+
return k(
|
|
2521
|
+
"div",
|
|
2522
|
+
{
|
|
2523
|
+
style: `width:300px;font:13px/1.5 ${sans};color:${ink};background:${surface};border:1px solid ${line};border-radius:14px;box-shadow:0 14px 44px rgba(0,0,0,.55),0 2px 10px rgba(0,0,0,.35);overflow:hidden`
|
|
2524
|
+
},
|
|
2525
|
+
[
|
|
2526
|
+
k(
|
|
2527
|
+
"div",
|
|
2528
|
+
{
|
|
2529
|
+
style: `display:flex;align-items:center;justify-content:space-between;gap:8px;padding:14px 16px 10px`
|
|
2530
|
+
},
|
|
2531
|
+
[
|
|
2532
|
+
k(
|
|
2533
|
+
"div",
|
|
2534
|
+
{ style: "display:flex;align-items:center;gap:9px" },
|
|
2535
|
+
[
|
|
2536
|
+
k("span", {
|
|
2537
|
+
style: `width:9px;height:9px;border-radius:3px;background:${accent};box-shadow:0 1px 4px rgba(91,91,240,.4)`
|
|
2538
|
+
}),
|
|
2539
|
+
k(
|
|
2540
|
+
"span",
|
|
2541
|
+
{
|
|
2542
|
+
style: `font-weight:680;font-size:13.5px;letter-spacing:-.01em;color:${ink}`
|
|
2543
|
+
},
|
|
2544
|
+
title
|
|
2545
|
+
)
|
|
2546
|
+
]
|
|
2547
|
+
),
|
|
2548
|
+
k(
|
|
2549
|
+
"button",
|
|
2550
|
+
{
|
|
2551
|
+
onClick: onClose,
|
|
2552
|
+
style: `all:unset;cursor:pointer;color:${faint};font-size:18px;line-height:1;padding:2px 6px;border-radius:6px`,
|
|
2553
|
+
title: "Dismiss"
|
|
2554
|
+
},
|
|
2555
|
+
"\xD7"
|
|
2556
|
+
)
|
|
2557
|
+
]
|
|
2558
|
+
),
|
|
2559
|
+
k(
|
|
2560
|
+
"div",
|
|
2561
|
+
{ style: `padding:0 16px 14px;color:${sub}` },
|
|
2562
|
+
[
|
|
2563
|
+
k("p", { style: "margin:0 0 12px" }, lead),
|
|
2564
|
+
k(
|
|
2565
|
+
"div",
|
|
2566
|
+
{ style: "display:flex;flex-direction:column;gap:8px" },
|
|
2567
|
+
[
|
|
2568
|
+
k(
|
|
2569
|
+
"div",
|
|
2570
|
+
{
|
|
2571
|
+
style: `font-size:11.5px;color:${faint};letter-spacing:.04em;text-transform:uppercase;font-weight:600`
|
|
2572
|
+
},
|
|
2573
|
+
step1
|
|
2574
|
+
),
|
|
2575
|
+
code(cmd1),
|
|
2576
|
+
step2 ? k(
|
|
2577
|
+
"div",
|
|
2578
|
+
{
|
|
2579
|
+
style: `margin-top:6px;font-size:11.5px;color:${faint};letter-spacing:.04em;text-transform:uppercase;font-weight:600`
|
|
2580
|
+
},
|
|
2581
|
+
step2
|
|
2582
|
+
) : null,
|
|
2583
|
+
cmd2 ? code(cmd2) : null
|
|
2584
|
+
]
|
|
2585
|
+
),
|
|
2586
|
+
k(
|
|
2587
|
+
"p",
|
|
2588
|
+
{
|
|
2589
|
+
style: `margin:14px 0 0;font-size:12px;color:${faint}`
|
|
2590
|
+
},
|
|
2591
|
+
"Don't have the plugin? Run /plugin marketplace add InSitue/insitue in claude, then /plugin install insitue."
|
|
2592
|
+
)
|
|
2593
|
+
]
|
|
2594
|
+
)
|
|
2595
|
+
]
|
|
2596
|
+
);
|
|
2597
|
+
}
|
|
2485
2598
|
function CaptureApp(props) {
|
|
2486
2599
|
const isDev = props.sink.kind === "companion";
|
|
2487
2600
|
const C3 = isDev ? DEV : CLOUD;
|
|
@@ -2494,6 +2607,8 @@ function CaptureApp(props) {
|
|
|
2494
2607
|
isDev ? "connecting" : "idle"
|
|
2495
2608
|
);
|
|
2496
2609
|
const [companionDetail, setCompanionDetail] = d2("");
|
|
2610
|
+
const [subscriberCount, setSubscriberCount] = d2(0);
|
|
2611
|
+
const [showOfflineHelp, setShowOfflineHelp] = d2(false);
|
|
2497
2612
|
const noteRef = A2(null);
|
|
2498
2613
|
const companionRef = A2(null);
|
|
2499
2614
|
y2(() => {
|
|
@@ -2507,12 +2622,14 @@ function CaptureApp(props) {
|
|
|
2507
2622
|
onState: (s3, detail) => {
|
|
2508
2623
|
setCompanionState(s3);
|
|
2509
2624
|
if (detail) setCompanionDetail(detail);
|
|
2625
|
+
if (s3 !== "connected") setSubscriberCount(0);
|
|
2510
2626
|
if (s3 === "error" || s3 === "idle") {
|
|
2511
2627
|
if (!cancelled) {
|
|
2512
2628
|
reconnectTimer = setTimeout(connect, 2500);
|
|
2513
2629
|
}
|
|
2514
2630
|
}
|
|
2515
|
-
}
|
|
2631
|
+
},
|
|
2632
|
+
onSubscribersAttached: (count) => setSubscriberCount(count)
|
|
2516
2633
|
});
|
|
2517
2634
|
companionRef.current = c3;
|
|
2518
2635
|
void c3.connect();
|
|
@@ -2649,29 +2766,44 @@ function CaptureApp(props) {
|
|
|
2649
2766
|
};
|
|
2650
2767
|
if (phase === "idle" || phase === "picking") {
|
|
2651
2768
|
const picking = phase === "picking";
|
|
2652
|
-
const
|
|
2769
|
+
const active = isDev && companionState === "connected" && subscriberCount > 0;
|
|
2770
|
+
const muted = isDev && !active;
|
|
2653
2771
|
if (isDev) {
|
|
2654
|
-
const containerBg =
|
|
2655
|
-
const containerBorder =
|
|
2656
|
-
const containerShadow =
|
|
2657
|
-
const innerBg =
|
|
2658
|
-
const innerShadow =
|
|
2772
|
+
const containerBg = muted ? C3.surface : CLOUD.accentSolid;
|
|
2773
|
+
const containerBorder = muted ? `1px solid ${C3.line}` : "1px solid transparent";
|
|
2774
|
+
const containerShadow = muted ? C3.shadow : `0 0 0 4px rgba(91,91,240,.16),0 12px 30px rgba(60,55,200,.42)`;
|
|
2775
|
+
const innerBg = muted ? "#9a9aa4" : "#ffffff";
|
|
2776
|
+
const innerShadow = muted ? "none" : "0 1px 3px rgba(0,0,0,.20)";
|
|
2777
|
+
const onClickLauncher = picking ? void 0 : muted ? () => setShowOfflineHelp((v3) => !v3) : () => void startPick();
|
|
2778
|
+
const tooltip = picking ? "Click an element \xB7 Esc to cancel" : muted ? "InSitue is muted \u2014 click for setup" : "Pick an element to talk to claude about";
|
|
2659
2779
|
return k(
|
|
2660
|
-
"
|
|
2780
|
+
"div",
|
|
2661
2781
|
{
|
|
2662
|
-
|
|
2663
|
-
style: `all:unset;position:fixed;bottom:20px;right:20px;z-index:2147483000;display:flex;align-items:center;justify-content:center;width:38px;height:38px;cursor:${picking ? "default" : "pointer"};background:${containerBg};border:${containerBorder};border-radius:50%;box-shadow:${containerShadow};transition:background .18s ease,box-shadow .18s ease`,
|
|
2664
|
-
title: picking ? "Click an element \xB7 Esc to cancel" : offline ? "InSitue companion not running \u2014 start `claude` with /insitue:connect" : "Pick an element to talk to claude about"
|
|
2782
|
+
style: "position:fixed;bottom:20px;right:20px;z-index:2147483000;display:flex;flex-direction:column;align-items:flex-end;gap:12px"
|
|
2665
2783
|
},
|
|
2666
2784
|
[
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2785
|
+
showOfflineHelp && muted ? offlineHelpCard(
|
|
2786
|
+
companionState === "connected" ? "subscriber" : "companion",
|
|
2787
|
+
() => setShowOfflineHelp(false)
|
|
2788
|
+
) : null,
|
|
2789
|
+
k(
|
|
2790
|
+
"button",
|
|
2791
|
+
{
|
|
2792
|
+
onClick: onClickLauncher,
|
|
2793
|
+
style: `all:unset;display:flex;align-items:center;justify-content:center;width:38px;height:38px;cursor:${picking ? "default" : "pointer"};background:${containerBg};border:${containerBorder};border-radius:50%;box-shadow:${containerShadow};transition:background .18s ease,box-shadow .18s ease`,
|
|
2794
|
+
title: tooltip
|
|
2795
|
+
},
|
|
2796
|
+
[
|
|
2797
|
+
k("span", {
|
|
2798
|
+
style: `width:11px;height:11px;border-radius:3px;background:${innerBg};box-shadow:${innerShadow};${picking ? "animation:ipulse 1.1s ease-in-out infinite" : ""}`
|
|
2799
|
+
}),
|
|
2800
|
+
picking ? k(
|
|
2801
|
+
"style",
|
|
2802
|
+
{},
|
|
2803
|
+
"@keyframes ipulse{0%,100%{opacity:.45}50%{opacity:1}}"
|
|
2804
|
+
) : null
|
|
2805
|
+
]
|
|
2806
|
+
)
|
|
2675
2807
|
]
|
|
2676
2808
|
);
|
|
2677
2809
|
}
|
|
@@ -2936,8 +3068,8 @@ function CaptureApp(props) {
|
|
|
2936
3068
|
k("span", {}, isDev ? "InSitue Dev \xB7 pick + describe \u2192 CLI" : ""),
|
|
2937
3069
|
k(
|
|
2938
3070
|
"span",
|
|
2939
|
-
{ title: `@insitue/sdk@${"0.4.
|
|
2940
|
-
`InSitue \xB7 v${"0.4.
|
|
3071
|
+
{ title: `@insitue/sdk@${"0.4.6"}` },
|
|
3072
|
+
`InSitue \xB7 v${"0.4.6"}`
|
|
2941
3073
|
)
|
|
2942
3074
|
]
|
|
2943
3075
|
)
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
mountCaptureOnly
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6PYLXFYS.js";
|
|
4
4
|
|
|
5
5
|
// src/InSitue.tsx
|
|
6
6
|
import { useEffect } from "react";
|
|
@@ -54,7 +54,7 @@ function InSitue({ port }) {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
// src/index.ts
|
|
57
|
-
var SDK_VERSION = "0.4.
|
|
57
|
+
var SDK_VERSION = "0.4.6";
|
|
58
58
|
export {
|
|
59
59
|
InSitue,
|
|
60
60
|
InSitueCapture,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@insitue/sdk",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"description": "InSitue capture SDK — drop one snippet into your deployed app; your users point at a bug, InSitue opens a verified pull request.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"tsup": "^8.3.5",
|
|
52
52
|
"typescript": "^5.6.3",
|
|
53
53
|
"vitest": "^3.2.4",
|
|
54
|
-
"@insitue/capture-core": "0.3.
|
|
54
|
+
"@insitue/capture-core": "0.3.3"
|
|
55
55
|
},
|
|
56
56
|
"repository": {
|
|
57
57
|
"type": "git",
|