@gperezmz/bb-plugin-thread-glance 0.1.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.
Files changed (98) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +20 -0
  3. package/THIRD_PARTY_NOTICES.md +230 -0
  4. package/app.tsx +12 -0
  5. package/components/ui/alert-dialog.tsx +142 -0
  6. package/components/ui/button.tsx +59 -0
  7. package/components/ui/card.tsx +83 -0
  8. package/components/ui/coarse-pointer-sizing.ts +66 -0
  9. package/components/ui/context-menu.tsx +355 -0
  10. package/components/ui/dialog.tsx +416 -0
  11. package/components/ui/dropdown-menu.tsx +640 -0
  12. package/components/ui/hooks/use-compact-viewport.tsx +37 -0
  13. package/components/ui/hooks/use-media-query.ts +70 -0
  14. package/components/ui/hooks/use-pointer-coarse.ts +7 -0
  15. package/components/ui/hover-card.tsx +36 -0
  16. package/components/ui/icon-extended.tsx +333 -0
  17. package/components/ui/icon-registry.ts +189 -0
  18. package/components/ui/icon.tsx +444 -0
  19. package/components/ui/input.tsx +30 -0
  20. package/components/ui/menu-item-hover.tsx +93 -0
  21. package/components/ui/motion.ts +4 -0
  22. package/components/ui/overlay-trigger.ts +84 -0
  23. package/components/ui/popover.tsx +223 -0
  24. package/components/ui/responsive-overlay.tsx +823 -0
  25. package/components/ui/tooltip.tsx +63 -0
  26. package/dist/app.css +2 -0
  27. package/dist/app.js +66 -0
  28. package/dist/app.meta.json +11 -0
  29. package/dist/server.js +71 -0
  30. package/dist/server.js.map +6 -0
  31. package/dist/server.meta.json +11 -0
  32. package/features/thread-list/components/Dialogs.tsx +299 -0
  33. package/features/thread-list/components/FoldRows.tsx +147 -0
  34. package/features/thread-list/components/GroupSection.tsx +370 -0
  35. package/features/thread-list/components/ProviderBadge.tsx +57 -0
  36. package/features/thread-list/components/PullRequestBadge.tsx +50 -0
  37. package/features/thread-list/components/Rails.tsx +28 -0
  38. package/features/thread-list/components/RenameEditor.tsx +118 -0
  39. package/features/thread-list/components/RowMenu.tsx +168 -0
  40. package/features/thread-list/components/SplitMiniMap.tsx +55 -0
  41. package/features/thread-list/components/ThreadDetails.tsx +138 -0
  42. package/features/thread-list/components/ThreadList.tsx +855 -0
  43. package/features/thread-list/components/ThreadRowView.tsx +631 -0
  44. package/features/thread-list/components/Toolbar.tsx +296 -0
  45. package/features/thread-list/components/controller.ts +64 -0
  46. package/features/thread-list/components/glyphs.tsx +129 -0
  47. package/features/thread-list/components/row-card.ts +127 -0
  48. package/features/thread-list/data/storage.ts +18 -0
  49. package/features/thread-list/data/useAutoExpand.ts +53 -0
  50. package/features/thread-list/data/useClientPreferences.ts +20 -0
  51. package/features/thread-list/data/useNotes.ts +41 -0
  52. package/features/thread-list/data/useNow.ts +19 -0
  53. package/features/thread-list/data/usePreferences.ts +126 -0
  54. package/features/thread-list/data/useScheduled.ts +43 -0
  55. package/features/thread-list/data/useStamps.ts +68 -0
  56. package/features/thread-list/icons.ts +44 -0
  57. package/features/thread-list/index.ts +2 -0
  58. package/features/thread-list/model/attention.ts +89 -0
  59. package/features/thread-list/model/counters.ts +67 -0
  60. package/features/thread-list/model/details.ts +79 -0
  61. package/features/thread-list/model/drag.ts +104 -0
  62. package/features/thread-list/model/expansion.ts +71 -0
  63. package/features/thread-list/model/families.ts +297 -0
  64. package/features/thread-list/model/groups.ts +263 -0
  65. package/features/thread-list/model/labels.ts +50 -0
  66. package/features/thread-list/model/layout.ts +61 -0
  67. package/features/thread-list/model/menu.ts +78 -0
  68. package/features/thread-list/model/move.ts +46 -0
  69. package/features/thread-list/model/notes.ts +52 -0
  70. package/features/thread-list/model/provider-mark.ts +59 -0
  71. package/features/thread-list/model/share.ts +101 -0
  72. package/features/thread-list/model/sort.ts +78 -0
  73. package/features/thread-list/model/state.ts +330 -0
  74. package/features/thread-list/model/time.ts +107 -0
  75. package/features/thread-list/model/toggles.ts +99 -0
  76. package/features/thread-list/model/view.ts +669 -0
  77. package/features/thread-list/model/windowing.ts +27 -0
  78. package/features/thread-list/testing/fixtures.ts +162 -0
  79. package/hooks/useBrowserDimmingModal.ts +5 -0
  80. package/lib/portal-scope.ts +15 -0
  81. package/lib/utils.ts +17 -0
  82. package/package.json +96 -0
  83. package/server/cli.ts +107 -0
  84. package/server/failures.ts +136 -0
  85. package/server/import.ts +144 -0
  86. package/server/notes.ts +236 -0
  87. package/server/preference-store.ts +96 -0
  88. package/server/scheduled.ts +129 -0
  89. package/server/serial.ts +12 -0
  90. package/server/stamps.ts +142 -0
  91. package/server/startup.ts +121 -0
  92. package/server.ts +126 -0
  93. package/shared/contract.ts +73 -0
  94. package/shared/preferences.ts +241 -0
  95. package/shared/signals.ts +71 -0
  96. package/skills/thread-glance/SKILL.md +69 -0
  97. package/tsconfig.json +36 -0
  98. package/types/global-jsx.d.ts +10 -0
@@ -0,0 +1,416 @@
1
+ import * as React from "react";
2
+ import * as DialogPrimitive from "@radix-ui/react-dialog";
3
+ import { Slot } from "@radix-ui/react-slot";
4
+
5
+ import { cn } from "../../lib/utils";
6
+ import { usePortalScopeProps } from "../../lib/portal-scope";
7
+ import { useBrowserDimmingModal } from "../../hooks/useBrowserDimmingModal";
8
+ import {
9
+ type ResponsiveOverlayContextValue,
10
+ useResponsiveRoot,
11
+ MobileTrigger,
12
+ ResponsiveDrawerShell,
13
+ stripRadixContentProps,
14
+ } from "./responsive-overlay.js";
15
+ import {
16
+ blurActiveKeyboardInputBeforeOverlayOpen,
17
+ getOverlayTriggerClassName,
18
+ preventOverlayTriggerSelection,
19
+ } from "./overlay-trigger.js";
20
+ import { Icon } from "../../components/ui/icon.js";
21
+
22
+ interface ResponsiveDialogContextValue extends ResponsiveOverlayContextValue {
23
+ titleId: string;
24
+ descriptionId: string;
25
+ registerTitleId: (id: string) => () => void;
26
+ registerDescriptionId: (id: string) => () => void;
27
+ }
28
+
29
+ const ResponsiveDialogContext =
30
+ React.createContext<ResponsiveDialogContextValue>({
31
+ isCompactViewport: false,
32
+ open: false,
33
+ onOpenChange: () => {},
34
+ titleId: "",
35
+ descriptionId: "",
36
+ registerTitleId: () => () => {},
37
+ registerDescriptionId: () => () => {},
38
+ });
39
+
40
+ function useResponsiveDialog() {
41
+ return React.useContext(ResponsiveDialogContext);
42
+ }
43
+
44
+ function Dialog({
45
+ children,
46
+ open: controlledOpen,
47
+ onOpenChange: controlledOnChange,
48
+ ...props
49
+ }: React.ComponentProps<typeof DialogPrimitive.Root>) {
50
+ const responsiveRoot = useResponsiveRoot(controlledOpen, controlledOnChange);
51
+ const generatedTitleId = React.useId();
52
+ const generatedDescriptionId = React.useId();
53
+ const [titleId, setTitleId] = React.useState(generatedTitleId);
54
+ const [descriptionId, setDescriptionId] = React.useState(
55
+ generatedDescriptionId,
56
+ );
57
+ const registerTitleId = React.useCallback(
58
+ (id: string) => {
59
+ setTitleId(id);
60
+ return () => setTitleId(generatedTitleId);
61
+ },
62
+ [generatedTitleId],
63
+ );
64
+ const registerDescriptionId = React.useCallback(
65
+ (id: string) => {
66
+ setDescriptionId(id);
67
+ return () => setDescriptionId(generatedDescriptionId);
68
+ },
69
+ [generatedDescriptionId],
70
+ );
71
+ const ctx = React.useMemo(
72
+ () => ({
73
+ ...responsiveRoot,
74
+ titleId,
75
+ descriptionId,
76
+ registerTitleId,
77
+ registerDescriptionId,
78
+ }),
79
+ [
80
+ descriptionId,
81
+ registerDescriptionId,
82
+ registerTitleId,
83
+ responsiveRoot,
84
+ titleId,
85
+ ],
86
+ );
87
+
88
+ const body = ctx.isCompactViewport ? (
89
+ children
90
+ ) : (
91
+ <DialogPrimitive.Root
92
+ open={ctx.open}
93
+ onOpenChange={ctx.onOpenChange}
94
+ {...props}
95
+ >
96
+ {children}
97
+ </DialogPrimitive.Root>
98
+ );
99
+
100
+ return (
101
+ <ResponsiveDialogContext.Provider value={ctx}>
102
+ {body}
103
+ </ResponsiveDialogContext.Provider>
104
+ );
105
+ }
106
+
107
+ const DialogTrigger = React.forwardRef<
108
+ HTMLButtonElement,
109
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>
110
+ >(({ asChild, children, className, ...props }, ref) => {
111
+ const { isCompactViewport, open, onOpenChange } = useResponsiveDialog();
112
+
113
+ if (isCompactViewport) {
114
+ return (
115
+ <MobileTrigger
116
+ ref={ref}
117
+ asChild={asChild}
118
+ open={open}
119
+ onOpenChange={onOpenChange}
120
+ haspopup="dialog"
121
+ className={className}
122
+ {...props}
123
+ >
124
+ {children}
125
+ </MobileTrigger>
126
+ );
127
+ }
128
+
129
+ return (
130
+ <DialogPrimitive.Trigger
131
+ ref={ref}
132
+ asChild={asChild}
133
+ className={getOverlayTriggerClassName(className)}
134
+ onMouseDown={(event) => {
135
+ if (!open) {
136
+ blurActiveKeyboardInputBeforeOverlayOpen();
137
+ }
138
+ preventOverlayTriggerSelection(event);
139
+ }}
140
+ {...props}
141
+ >
142
+ {children}
143
+ </DialogPrimitive.Trigger>
144
+ );
145
+ });
146
+ DialogTrigger.displayName = "DialogTrigger";
147
+
148
+ interface DialogCloseProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
149
+ asChild?: boolean;
150
+ }
151
+
152
+ const DialogClose = React.forwardRef<HTMLButtonElement, DialogCloseProps>(
153
+ ({ asChild, onClick, children, ...props }, ref) => {
154
+ const { isCompactViewport, onOpenChange } = useResponsiveDialog();
155
+
156
+ if (isCompactViewport) {
157
+ const Comp = asChild ? Slot : "button";
158
+ const handleClick: React.MouseEventHandler<HTMLButtonElement> = (
159
+ event,
160
+ ) => {
161
+ onClick?.(event);
162
+ if (!event.defaultPrevented) {
163
+ onOpenChange(false);
164
+ }
165
+ };
166
+ return (
167
+ <Comp ref={ref} onClick={handleClick} {...props}>
168
+ {children}
169
+ </Comp>
170
+ );
171
+ }
172
+
173
+ return (
174
+ <DialogPrimitive.Close
175
+ ref={ref}
176
+ asChild={asChild}
177
+ onClick={onClick}
178
+ {...props}
179
+ >
180
+ {children}
181
+ </DialogPrimitive.Close>
182
+ );
183
+ },
184
+ );
185
+ DialogClose.displayName = "DialogClose";
186
+
187
+ const DialogOverlay = React.forwardRef<
188
+ React.ComponentRef<typeof DialogPrimitive.Overlay>,
189
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
190
+ >(({ className, ...props }, ref) => (
191
+ <DialogPrimitive.Overlay
192
+ ref={ref}
193
+ {...usePortalScopeProps()}
194
+ className={cn(
195
+ "fixed inset-0 z-50 bg-black/40 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
196
+ className,
197
+ )}
198
+ {...props}
199
+ />
200
+ ));
201
+ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
202
+
203
+ type DialogContentProps = React.ComponentPropsWithoutRef<
204
+ typeof DialogPrimitive.Content
205
+ > & {
206
+ onAfterCloseAutoFocus?: () => void;
207
+ hideCloseButton?: boolean;
208
+ };
209
+
210
+ const DialogContent = React.forwardRef<HTMLDivElement, DialogContentProps>(
211
+ (
212
+ {
213
+ className,
214
+ children,
215
+ hideCloseButton = false,
216
+ onAfterCloseAutoFocus,
217
+ onCloseAutoFocus,
218
+ ...props
219
+ },
220
+ ref,
221
+ ) => {
222
+ const { isCompactViewport, open, onOpenChange, titleId, descriptionId } =
223
+ useResponsiveDialog();
224
+ useBrowserDimmingModal(open);
225
+ const scopeProps = usePortalScopeProps();
226
+
227
+ if (isCompactViewport) {
228
+ const domProps = stripRadixContentProps(props);
229
+ return (
230
+ <ResponsiveDrawerShell
231
+ open={open}
232
+ onOpenChange={onOpenChange}
233
+ onAfterCloseAutoFocus={onAfterCloseAutoFocus}
234
+ labelledBy={titleId}
235
+ describedBy={descriptionId}
236
+ >
237
+ <div
238
+ ref={ref}
239
+ className={cn(
240
+ "grid grid-cols-[minmax(0,1fr)] gap-4 overflow-y-auto px-4 pt-2 pb-[max(1rem,env(safe-area-inset-bottom))]",
241
+ className,
242
+ "max-w-none",
243
+ )}
244
+ {...domProps}
245
+ >
246
+ {children}
247
+ </div>
248
+ </ResponsiveDrawerShell>
249
+ );
250
+ }
251
+
252
+ return (
253
+ <DialogPrimitive.Portal>
254
+ <DialogOverlay />
255
+ <DialogPrimitive.Content
256
+ ref={ref}
257
+ {...scopeProps}
258
+ onCloseAutoFocus={(event) => {
259
+ onCloseAutoFocus?.(event);
260
+ queueMicrotask(() => onAfterCloseAutoFocus?.());
261
+ }}
262
+ className={cn(
263
+ "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg grid-cols-[minmax(0,1fr)] translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-sm duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-lg",
264
+ className,
265
+ )}
266
+ {...props}
267
+ >
268
+ {children}
269
+ {hideCloseButton ? null : (
270
+ <DialogPrimitive.Close className="absolute right-4 top-4 cursor-pointer rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-state-active data-[state=open]:text-foreground">
271
+ <Icon name="X" className="h-4 w-4" />
272
+ <span className="sr-only">Close</span>
273
+ </DialogPrimitive.Close>
274
+ )}
275
+ </DialogPrimitive.Content>
276
+ </DialogPrimitive.Portal>
277
+ );
278
+ },
279
+ );
280
+ DialogContent.displayName = "DialogContent";
281
+
282
+ const DialogHeader = ({
283
+ className,
284
+ ...props
285
+ }: React.HTMLAttributes<HTMLDivElement>) => (
286
+ <div
287
+ className={cn("flex flex-col space-y-1.5 text-left", className)}
288
+ {...props}
289
+ />
290
+ );
291
+ DialogHeader.displayName = "DialogHeader";
292
+
293
+ const DialogFooter = ({
294
+ className,
295
+ ...props
296
+ }: React.HTMLAttributes<HTMLDivElement>) => (
297
+ <div
298
+ className={cn(
299
+ "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
300
+ className,
301
+ )}
302
+ {...props}
303
+ />
304
+ );
305
+ DialogFooter.displayName = "DialogFooter";
306
+
307
+ const DialogTitle = React.forwardRef<
308
+ HTMLHeadingElement,
309
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
310
+ >(({ asChild, className, id, children, ...props }, ref) => {
311
+ const { isCompactViewport, titleId, registerTitleId } = useResponsiveDialog();
312
+ const resolvedId = id ?? titleId;
313
+ React.useLayoutEffect(() => {
314
+ if (!isCompactViewport) {
315
+ return;
316
+ }
317
+ return registerTitleId(resolvedId);
318
+ }, [isCompactViewport, registerTitleId, resolvedId]);
319
+
320
+ if (isCompactViewport) {
321
+ const titleProps = {
322
+ id: resolvedId,
323
+ className: cn(
324
+ "text-base font-semibold leading-none tracking-tight",
325
+ className,
326
+ ),
327
+ ...props,
328
+ };
329
+ if (asChild) {
330
+ return (
331
+ <Slot ref={ref} {...titleProps}>
332
+ {children}
333
+ </Slot>
334
+ );
335
+ }
336
+ return (
337
+ <h2 ref={ref} {...titleProps}>
338
+ {children}
339
+ </h2>
340
+ );
341
+ }
342
+ return (
343
+ <DialogPrimitive.Title
344
+ ref={ref}
345
+ asChild={asChild}
346
+ {...(id === undefined ? {} : { id })}
347
+ className={cn(
348
+ "text-base font-semibold leading-none tracking-tight",
349
+ className,
350
+ )}
351
+ {...props}
352
+ >
353
+ {children}
354
+ </DialogPrimitive.Title>
355
+ );
356
+ });
357
+ DialogTitle.displayName = "DialogTitle";
358
+
359
+ const DialogDescription = React.forwardRef<
360
+ React.ComponentRef<typeof DialogPrimitive.Description>,
361
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
362
+ >(({ asChild, className, id, children, ...props }, ref) => {
363
+ const { isCompactViewport, descriptionId, registerDescriptionId } =
364
+ useResponsiveDialog();
365
+ const resolvedId = id ?? descriptionId;
366
+ React.useLayoutEffect(() => {
367
+ if (!isCompactViewport) {
368
+ return;
369
+ }
370
+ return registerDescriptionId(resolvedId);
371
+ }, [isCompactViewport, registerDescriptionId, resolvedId]);
372
+
373
+ if (isCompactViewport) {
374
+ const descriptionProps = {
375
+ id: resolvedId,
376
+ className: cn("text-sm text-muted-foreground", className),
377
+ ...props,
378
+ };
379
+ if (asChild) {
380
+ return (
381
+ <Slot ref={ref} {...descriptionProps}>
382
+ {children}
383
+ </Slot>
384
+ );
385
+ }
386
+ return (
387
+ <p ref={ref} {...descriptionProps}>
388
+ {children}
389
+ </p>
390
+ );
391
+ }
392
+ return (
393
+ <DialogPrimitive.Description
394
+ ref={ref}
395
+ asChild={asChild}
396
+ {...(id === undefined ? {} : { id })}
397
+ className={cn("text-sm text-muted-foreground", className)}
398
+ {...props}
399
+ >
400
+ {children}
401
+ </DialogPrimitive.Description>
402
+ );
403
+ });
404
+ DialogDescription.displayName = DialogPrimitive.Description.displayName;
405
+
406
+ export {
407
+ Dialog,
408
+ DialogOverlay,
409
+ DialogTrigger,
410
+ DialogClose,
411
+ DialogContent,
412
+ DialogHeader,
413
+ DialogFooter,
414
+ DialogTitle,
415
+ DialogDescription,
416
+ };