dsh-remote-vs 0.9.0 → 0.9.2

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.
@@ -33,15 +33,15 @@
33
33
  import { useEffect, useRef, useState, type RefObject } from 'react'
34
34
 
35
35
  /** The floating "add to conversation" action: payload + viewport anchor. */
36
- export interface SelectionPopup {
37
- insert: string
36
+ export interface SelectionPopup<T> {
37
+ insert: T
38
38
  left: number
39
39
  top: number
40
40
  }
41
41
 
42
- export interface SelectionPopupOptions {
42
+ export interface SelectionPopupOptions<T> {
43
43
  /** Commit the payload into the composer draft (button click). */
44
- onCommit(insert: string): void
44
+ onCommit(insert: T): void
45
45
  /**
46
46
  * The DOM surface that must stay on screen for the popup to live: the
47
47
  * CodeMirror host. Called lazily (refs are null until the content loads).
@@ -49,20 +49,20 @@ export interface SelectionPopupOptions {
49
49
  getSurface(): HTMLElement | null
50
50
  }
51
51
 
52
- export interface SelectionPopupControls {
52
+ export interface SelectionPopupControls<T> {
53
53
  /** The current popup (null = hidden). */
54
- popup: SelectionPopup | null
54
+ popup: SelectionPopup<T> | null
55
55
  /** Attach to the portaled button element. */
56
56
  buttonRef: RefObject<HTMLButtonElement>
57
57
  /** Anchor the popup above a selection (viewport-clamped). */
58
- show(insert: string, left: number, top: number): void
58
+ show(insert: T, left: number, top: number): void
59
59
  /** Hide the popup (idempotent). */
60
60
  hide(): void
61
61
  /** The button's click: commit the stored payload, then hide. */
62
62
  commit(): void
63
63
  }
64
64
 
65
- export function useSelectionPopup(options: SelectionPopupOptions): SelectionPopupControls {
65
+ export function useSelectionPopup<T>(options: SelectionPopupOptions<T>): SelectionPopupControls<T> {
66
66
  // Latest-callback refs: the dismissal listeners live for the mount's
67
67
  // lifetime, so they must not capture stale closures across renders.
68
68
  const onCommitRef = useRef(options.onCommit)
@@ -70,16 +70,16 @@ export function useSelectionPopup(options: SelectionPopupOptions): SelectionPopu
70
70
  onCommitRef.current = options.onCommit
71
71
  getSurfaceRef.current = options.getSurface
72
72
 
73
- const [popup, setPopup] = useState<SelectionPopup | null>(null)
73
+ const [popup, setPopup] = useState<SelectionPopup<T> | null>(null)
74
74
  /** Live mirror for click/event-time reads (no re-render race). */
75
- const popupRef = useRef<SelectionPopup | null>(null)
75
+ const popupRef = useRef<SelectionPopup<T> | null>(null)
76
76
  /** The portaled button itself (for the outside-click guard). */
77
77
  const buttonRef = useRef<HTMLButtonElement>(null)
78
78
  /** The surface visibility observer (created lazily on open). */
79
79
  const observerRef = useRef<IntersectionObserver | null>(null)
80
80
 
81
- const show = (insert: string, left: number, top: number): void => {
82
- const next: SelectionPopup = {
81
+ const show = (insert: T, left: number, top: number): void => {
82
+ const next: SelectionPopup<T> = {
83
83
  insert,
84
84
  left: Math.min(Math.max(left, 80), window.innerWidth - 80),
85
85
  top,
@@ -5,8 +5,8 @@
5
5
  * the workspace REGISTRY, so this string is the only label the user ever sees
6
6
  * there. It used to be built from the remote PATH's last segment, which threw
7
7
  * away the one name the user had chosen: a workspace created as
8
- * "P710_userdebug" showed up as `… > P710`, and two bindings that differ only
9
- * deeper down (`…/userdebug/P710` and `…/userdebug/P710_fac`) became
8
+ * "build_variant_a" showed up as `… > build`, and two bindings that differ only
9
+ * deeper down (`…/userdebug/build_a` and `…/userdebug/build_a_fac`) became
10
10
  * indistinguishable.
11
11
  *
12
12
  * The alias stays in front: it is what tells two hosts apart, and the part after