gpui-bridge 0.2.0 → 0.3.0

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/app.d.ts CHANGED
@@ -145,7 +145,7 @@ export declare class UINode<T extends NodeType> {
145
145
  /** Subscribes to an event; the host only emits subscribed events. */
146
146
  on<E extends keyof NodeEvents[T] & string>(event: E, handler: (payload: NodeEvents[T][E]) => void): this;
147
147
  off<E extends keyof NodeEvents[T] & string>(event: E): this;
148
- /** Gives the node the keyboard focus on the next commit (an Input, a Textarea or a div with `keyDown`). */
148
+ /** Gives the node the keyboard focus on the next commit (an Input, a Textarea, a Command, a div with `keyDown`…). */
149
149
  focus(): this;
150
150
  /** Removes the node and all its descendants. */
151
151
  remove(): void;
@@ -275,6 +275,74 @@ export declare class App {
275
275
  sidebar(props?: NodeProps["Sidebar"]): UINode<"Sidebar">;
276
276
  /** A line, bar or pie chart of the points in `data`. */
277
277
  chart(props?: NodeProps["Chart"]): UINode<"Chart">;
278
+ /** Paints the drawing commands in `commands`; `pointerDown` with the local point. */
279
+ canvas(props?: NodeProps["Canvas"]): UINode<"Canvas">;
280
+ /** A command palette over the sections in `items`; `confirm` with the chosen entry's `id`. */
281
+ command(props?: NodeProps["Command"]): UINode<"Command">;
282
+ /** Settings pages of typed fields in `pages`; `change` with `{key, value}` of the field set. */
283
+ settings(props?: NodeProps["Settings"]): UINode<"Settings">;
284
+ /** A button that stays pressed: `change` with `checked`. */
285
+ toggle(props?: NodeProps["Toggle"]): UINode<"Toggle">;
286
+ /** An action with a menu: `click` for the left half, `menu` with the chosen item's id. */
287
+ dropdownButton(props?: NodeProps["DropdownButton"]): UINode<"DropdownButton">;
288
+ /** Text with an optional secondary text and a highlighted substring. */
289
+ label(props?: NodeProps["Label"]): UINode<"Label">;
290
+ /** A centered empty state; append the action (usually a `Button`). */
291
+ empty(props?: NodeProps["Empty"]): UINode<"Empty">;
292
+ /** Loading text with a moving highlight. */
293
+ shimmer(props?: NodeProps["Shimmer"]): UINode<"Shimmer">;
294
+ /** A text field with text and an icon on either side: `change` and `submit` like an `Input`. */
295
+ inputGroup(props?: NodeProps["InputGroup"]): UINode<"InputGroup">;
296
+ /** Copies `value` on click: `copied` with that text. */
297
+ clipboard(props?: NodeProps["Clipboard"]): UINode<"Clipboard">;
298
+ /** A confirmation with a title, a description and an icon: `ok` and `cancel`, as in a `Dialog`. */
299
+ alertDialog(props?: NodeProps["AlertDialog"]): UINode<"AlertDialog">;
300
+ /** A panel that slides in from `side`: `close` with its X, Escape or a click on the overlay. */
301
+ sheet(props?: NodeProps["Sheet"]): UINode<"Sheet">;
302
+ /** A panel anchored to its first child (the trigger): `change` with `checked` both ways. */
303
+ popover(props?: NodeProps["Popover"]): UINode<"Popover">;
304
+ /** A card on hover, opened by the mouse alone: `change` with `checked`. */
305
+ hoverCard(props?: NodeProps["HoverCard"]): UINode<"HoverCard">;
306
+ /** A day picker: `change` with the chosen day (`null` when cleared). */
307
+ datePicker(props?: NodeProps["DatePicker"]): UINode<"DatePicker">;
308
+ /** A time typed by segments: `change` with the time. */
309
+ timeField(props?: NodeProps["TimeField"]): UINode<"TimeField">;
310
+ /** A color swatch and hex box: `change` with the color (`null` when cleared). */
311
+ colorPicker(props?: NodeProps["ColorPicker"]): UINode<"ColorPicker">;
312
+ /** A list that picks several options: `change` with the whole selection. */
313
+ combobox(props?: NodeProps["Combobox"]): UINode<"Combobox">;
314
+ /** A chat bubble; its children are the content. */
315
+ bubble(props?: NodeProps["Bubble"]): UINode<"Bubble">;
316
+ /** A message row: `MessageHeader`/`MessageFooter` children, the rest is the content. */
317
+ message(props?: NodeProps["Message"]): UINode<"Message">;
318
+ /** A `Message`'s header (sender, time). */
319
+ messageHeader(props?: NodeProps["MessageHeader"]): UINode<"MessageHeader">;
320
+ /** A `Message`'s footer (state, actions). */
321
+ messageFooter(props?: NodeProps["MessageFooter"]): UINode<"MessageFooter">;
322
+ /** A compact status row in a conversation. */
323
+ marker(props?: NodeProps["Marker"]): UINode<"Marker">;
324
+ /** A file or picture card: `click`, `remove` and `retry` show its controls. */
325
+ attachment(props?: NodeProps["Attachment"]): UINode<"Attachment">;
326
+ /** A virtual list of messages anchored at the end; each child is a row. */
327
+ messageScroller(props?: NodeProps["MessageScroller"]): UINode<"MessageScroller">;
328
+ /** Questions one at a time: `change` with each answer, `submit` with all of them. */
329
+ questionnaire(props?: NodeProps["Questionnaire"]): UINode<"Questionnaire">;
330
+ /** A selectable list over its `ListItem` children: `change`, `confirm`, `query` and `loadMore`. */
331
+ list(props?: NodeProps["List"]): UINode<"List">;
332
+ /** A `List` row: `value` is what the events report; its children are the content. */
333
+ listItem(props?: NodeProps["ListItem"]): UINode<"ListItem">;
334
+ /** Panels the user rearranges: its `DockPanel` children. The host owns the layout. */
335
+ dock(props?: NodeProps["Dock"]): UINode<"Dock">;
336
+ /** A `Dock` panel: `title`, `placement` (read once) and `closable` (`close`); its children are the content. */
337
+ dockPanel(props?: NodeProps["DockPanel"]): UINode<"DockPanel">;
338
+ /** An `Accordion` section: `id` (what `change` reports), `title`, `open`, `disabled`; its children are the content. */
339
+ accordionItem(props?: NodeProps["AccordionItem"]): UINode<"AccordionItem">;
340
+ /** A `Dialog`'s or `AlertDialog`'s footer: its children (buttons) replace OK/Cancel. */
341
+ dialogFooter(props?: NodeProps["DialogFooter"]): UINode<"DialogFooter">;
342
+ /** A `StatusBar`'s left side: its children replace the `left` text. */
343
+ statusBarLeft(props?: NodeProps["StatusBarLeft"]): UINode<"StatusBarLeft">;
344
+ /** A `StatusBar`'s right side: its children replace the `right` text. */
345
+ statusBarRight(props?: NodeProps["StatusBarRight"]): UINode<"StatusBarRight">;
278
346
  /** A node of any type; the specific methods below only add typing. */
279
347
  create<T extends NodeType>(type: T, props?: NodeProps[T]): UINode<T>;
280
348
  /** Creates or updates the main window (window 1). It opens on the first commit that sets `root`. */
package/dist/app.js CHANGED
@@ -59,7 +59,7 @@ export class UINode {
59
59
  this.app.wire.setHandler(this.id, event, undefined);
60
60
  return this;
61
61
  }
62
- /** Gives the node the keyboard focus on the next commit (an Input, a Textarea or a div with `keyDown`). */
62
+ /** Gives the node the keyboard focus on the next commit (an Input, a Textarea, a Command, a div with `keyDown`…). */
63
63
  focus() {
64
64
  this.app.wire.queue({ op: "focus", id: this.id });
65
65
  return this;
@@ -336,6 +336,142 @@ export class App {
336
336
  chart(props = {}) {
337
337
  return this.create("Chart", props);
338
338
  }
339
+ /** Paints the drawing commands in `commands`; `pointerDown` with the local point. */
340
+ canvas(props = {}) {
341
+ return this.create("Canvas", props);
342
+ }
343
+ /** A command palette over the sections in `items`; `confirm` with the chosen entry's `id`. */
344
+ command(props = {}) {
345
+ return this.create("Command", props);
346
+ }
347
+ /** Settings pages of typed fields in `pages`; `change` with `{key, value}` of the field set. */
348
+ settings(props = {}) {
349
+ return this.create("Settings", props);
350
+ }
351
+ /** A button that stays pressed: `change` with `checked`. */
352
+ toggle(props = {}) {
353
+ return this.create("Toggle", props);
354
+ }
355
+ /** An action with a menu: `click` for the left half, `menu` with the chosen item's id. */
356
+ dropdownButton(props = {}) {
357
+ return this.create("DropdownButton", props);
358
+ }
359
+ /** Text with an optional secondary text and a highlighted substring. */
360
+ label(props = {}) {
361
+ return this.create("Label", props);
362
+ }
363
+ /** A centered empty state; append the action (usually a `Button`). */
364
+ empty(props = {}) {
365
+ return this.create("Empty", props);
366
+ }
367
+ /** Loading text with a moving highlight. */
368
+ shimmer(props = {}) {
369
+ return this.create("Shimmer", props);
370
+ }
371
+ /** A text field with text and an icon on either side: `change` and `submit` like an `Input`. */
372
+ inputGroup(props = {}) {
373
+ return this.create("InputGroup", props);
374
+ }
375
+ /** Copies `value` on click: `copied` with that text. */
376
+ clipboard(props = {}) {
377
+ return this.create("Clipboard", props);
378
+ }
379
+ /** A confirmation with a title, a description and an icon: `ok` and `cancel`, as in a `Dialog`. */
380
+ alertDialog(props = {}) {
381
+ return this.create("AlertDialog", props);
382
+ }
383
+ /** A panel that slides in from `side`: `close` with its X, Escape or a click on the overlay. */
384
+ sheet(props = {}) {
385
+ return this.create("Sheet", props);
386
+ }
387
+ /** A panel anchored to its first child (the trigger): `change` with `checked` both ways. */
388
+ popover(props = {}) {
389
+ return this.create("Popover", props);
390
+ }
391
+ /** A card on hover, opened by the mouse alone: `change` with `checked`. */
392
+ hoverCard(props = {}) {
393
+ return this.create("HoverCard", props);
394
+ }
395
+ /** A day picker: `change` with the chosen day (`null` when cleared). */
396
+ datePicker(props = {}) {
397
+ return this.create("DatePicker", props);
398
+ }
399
+ /** A time typed by segments: `change` with the time. */
400
+ timeField(props = {}) {
401
+ return this.create("TimeField", props);
402
+ }
403
+ /** A color swatch and hex box: `change` with the color (`null` when cleared). */
404
+ colorPicker(props = {}) {
405
+ return this.create("ColorPicker", props);
406
+ }
407
+ /** A list that picks several options: `change` with the whole selection. */
408
+ combobox(props = {}) {
409
+ return this.create("Combobox", props);
410
+ }
411
+ /** A chat bubble; its children are the content. */
412
+ bubble(props = {}) {
413
+ return this.create("Bubble", props);
414
+ }
415
+ /** A message row: `MessageHeader`/`MessageFooter` children, the rest is the content. */
416
+ message(props = {}) {
417
+ return this.create("Message", props);
418
+ }
419
+ /** A `Message`'s header (sender, time). */
420
+ messageHeader(props = {}) {
421
+ return this.create("MessageHeader", props);
422
+ }
423
+ /** A `Message`'s footer (state, actions). */
424
+ messageFooter(props = {}) {
425
+ return this.create("MessageFooter", props);
426
+ }
427
+ /** A compact status row in a conversation. */
428
+ marker(props = {}) {
429
+ return this.create("Marker", props);
430
+ }
431
+ /** A file or picture card: `click`, `remove` and `retry` show its controls. */
432
+ attachment(props = {}) {
433
+ return this.create("Attachment", props);
434
+ }
435
+ /** A virtual list of messages anchored at the end; each child is a row. */
436
+ messageScroller(props = {}) {
437
+ return this.create("MessageScroller", props);
438
+ }
439
+ /** Questions one at a time: `change` with each answer, `submit` with all of them. */
440
+ questionnaire(props = {}) {
441
+ return this.create("Questionnaire", props);
442
+ }
443
+ /** A selectable list over its `ListItem` children: `change`, `confirm`, `query` and `loadMore`. */
444
+ list(props = {}) {
445
+ return this.create("List", props);
446
+ }
447
+ /** A `List` row: `value` is what the events report; its children are the content. */
448
+ listItem(props = {}) {
449
+ return this.create("ListItem", props);
450
+ }
451
+ /** Panels the user rearranges: its `DockPanel` children. The host owns the layout. */
452
+ dock(props = {}) {
453
+ return this.create("Dock", props);
454
+ }
455
+ /** A `Dock` panel: `title`, `placement` (read once) and `closable` (`close`); its children are the content. */
456
+ dockPanel(props = {}) {
457
+ return this.create("DockPanel", props);
458
+ }
459
+ /** An `Accordion` section: `id` (what `change` reports), `title`, `open`, `disabled`; its children are the content. */
460
+ accordionItem(props = {}) {
461
+ return this.create("AccordionItem", props);
462
+ }
463
+ /** A `Dialog`'s or `AlertDialog`'s footer: its children (buttons) replace OK/Cancel. */
464
+ dialogFooter(props = {}) {
465
+ return this.create("DialogFooter", props);
466
+ }
467
+ /** A `StatusBar`'s left side: its children replace the `left` text. */
468
+ statusBarLeft(props = {}) {
469
+ return this.create("StatusBarLeft", props);
470
+ }
471
+ /** A `StatusBar`'s right side: its children replace the `right` text. */
472
+ statusBarRight(props = {}) {
473
+ return this.create("StatusBarRight", props);
474
+ }
339
475
  /** A node of any type; the specific methods below only add typing. */
340
476
  create(type, props = {}) {
341
477
  return new UINode(this, this.wire.create(type, { ...props }), type);
@@ -464,7 +600,11 @@ export class App {
464
600
  ? { paths: message.paths ?? [] }
465
601
  : message.event === "sort"
466
602
  ? message.value
467
- : type === "Checkbox" || type === "Switch"
603
+ : type === "Checkbox" ||
604
+ type === "Switch" ||
605
+ type === "Toggle" ||
606
+ type === "Popover" ||
607
+ type === "HoverCard"
468
608
  ? { checked: message.checked ?? false }
469
609
  : message.value !== undefined
470
610
  ? { value: message.value }
@@ -2,7 +2,7 @@ export declare const PROTOCOL_VERSION = 1;
2
2
  export type NodeId = number;
3
3
  /** Client-assigned window id; `window` without `id` is window 1. */
4
4
  export type WindowId = number;
5
- export type NodeType = "div" | "text" | "Button" | "Input" | "Checkbox" | "Icon" | "Image" | "MenuBar" | "Switch" | "RadioGroup" | "Select" | "Slider" | "Textarea" | "Dialog" | "VirtualList" | "Table" | "Tabs" | "Tab" | "Alert" | "Badge" | "Tag" | "Kbd" | "Progress" | "Spinner" | "Skeleton" | "Rating" | "Pagination" | "Collapsible" | "Accordion" | "Avatar" | "Stepper" | "NumberInput" | "OtpInput" | "Form" | "Field" | "GroupBox" | "DescriptionList" | "StatusBar" | "Toolbar" | "Resizable" | "Calendar" | "Tree" | "Diff" | "Carousel" | "Sidebar" | "Chart";
5
+ export type NodeType = "div" | "text" | "Button" | "Input" | "Checkbox" | "Icon" | "Image" | "MenuBar" | "Switch" | "RadioGroup" | "Select" | "Slider" | "Textarea" | "Dialog" | "VirtualList" | "Table" | "Tabs" | "Tab" | "Alert" | "Badge" | "Tag" | "Kbd" | "Progress" | "Spinner" | "Skeleton" | "Rating" | "Pagination" | "Collapsible" | "Accordion" | "Avatar" | "Stepper" | "NumberInput" | "OtpInput" | "Form" | "Field" | "GroupBox" | "DescriptionList" | "StatusBar" | "Toolbar" | "Resizable" | "Calendar" | "Tree" | "Diff" | "Carousel" | "Sidebar" | "Chart" | "Canvas" | "Command" | "Settings" | "Toggle" | "DropdownButton" | "Label" | "Empty" | "Shimmer" | "InputGroup" | "Clipboard" | "AlertDialog" | "Sheet" | "Popover" | "HoverCard" | "DatePicker" | "TimeField" | "ColorPicker" | "Combobox" | "Bubble" | "Message" | "MessageHeader" | "MessageFooter" | "Marker" | "Attachment" | "MessageScroller" | "Questionnaire" | "List" | "ListItem" | "Dock" | "DockPanel" | "AccordionItem" | "DialogFooter" | "StatusBarLeft" | "StatusBarRight";
6
6
  export type WindowTheme = "light" | "dark";
7
7
  /** Events a window can report (PROTOCOL.md section 3); `window.events` opts in. */
8
8
  export type WindowEventName = "focus" | "blur" | "resize" | "move" | "visibility";
@@ -136,7 +136,7 @@ export type HostMessage = {
136
136
  type: "event";
137
137
  id: NodeId;
138
138
  event: string;
139
- value?: string | number | null | TableSort | DiffSelection;
139
+ value?: string | number | null | string[] | TableSort | DiffSelection | CanvasPoint | SettingsChange | QuestionnaireAnswer | QuestionnaireAnswer[];
140
140
  checked?: boolean;
141
141
  paths?: string[];
142
142
  } | {
@@ -353,7 +353,7 @@ export interface DialogProps {
353
353
  title?: string;
354
354
  /** Default "OK". */
355
355
  okText?: string;
356
- /** Adds a cancel button. */
356
+ /** Adds a cancel button. A `DialogFooter` child replaces both buttons. */
357
357
  cancelText?: string;
358
358
  /** In pixels. */
359
359
  width?: number;
@@ -497,7 +497,7 @@ export interface PaginationProps {
497
497
  controlled?: boolean;
498
498
  class?: string;
499
499
  }
500
- /** A section of an `Accordion`; its content is text. */
500
+ /** An `items` entry of an `Accordion`; its content is text. */
501
501
  export interface AccordionItem {
502
502
  id: string;
503
503
  title: string;
@@ -506,6 +506,7 @@ export interface AccordionItem {
506
506
  disabled?: boolean;
507
507
  }
508
508
  export interface AccordionProps {
509
+ /** Ignored when the Accordion has `AccordionItem` children. */
509
510
  items?: AccordionItem[];
510
511
  /** Several sections open at once; default false. */
511
512
  multiple?: boolean;
@@ -590,7 +591,9 @@ export interface DescriptionListProps {
590
591
  class?: string;
591
592
  }
592
593
  export interface StatusBarProps {
594
+ /** Replaced by a `StatusBarLeft` child. */
593
595
  left?: string;
596
+ /** Replaced by a `StatusBarRight` child. */
594
597
  right?: string;
595
598
  class?: string;
596
599
  }
@@ -749,6 +752,437 @@ export interface ChartProps {
749
752
  /** Give it a bounded box (`h-64`, `flex-1 w-full`): the plot fills it. */
750
753
  class?: string;
751
754
  }
755
+ /** One drawing command of a `Canvas` (PROTOCOL.md section 20), in logical pixels from its top-left corner. */
756
+ export type CanvasCommand = {
757
+ op: "rect";
758
+ x: number;
759
+ y: number;
760
+ w: number;
761
+ h: number;
762
+ color?: ChartColor;
763
+ corner_radius?: number;
764
+ } | {
765
+ op: "line";
766
+ x1: number;
767
+ y1: number;
768
+ x2: number;
769
+ y2: number;
770
+ color?: ChartColor;
771
+ width?: number;
772
+ }
773
+ /** `d` takes absolute `M x y`, `L x y` and `Z` only. */
774
+ | {
775
+ op: "path";
776
+ d: string;
777
+ color?: ChartColor;
778
+ width?: number;
779
+ };
780
+ /** A point local to a `Canvas`, in the same coordinates as its commands. */
781
+ export interface CanvasPoint {
782
+ x: number;
783
+ y: number;
784
+ }
785
+ export interface CanvasProps {
786
+ /** Painted in order; `setProps` replaces the whole list. */
787
+ commands?: CanvasCommand[];
788
+ /** Give it a bounded box (`h-64 w-full`). */
789
+ class?: string;
790
+ }
791
+ /** One entry of a `Command` palette. */
792
+ export interface CommandEntry {
793
+ /** Unique across the whole palette: it is what `confirm` reports. */
794
+ id: string;
795
+ label: string;
796
+ /** A bundled icon name. */
797
+ icon?: string;
798
+ /** Extra terms the search matches, besides `label`. */
799
+ keywords?: string[];
800
+ /** Draws a check at the end of the row. */
801
+ checked?: boolean;
802
+ disabled?: boolean;
803
+ }
804
+ /** A group of entries with a heading (`label`); without one the entries have no heading. */
805
+ export interface CommandSection {
806
+ label?: string;
807
+ items: CommandEntry[];
808
+ }
809
+ export interface CommandProps {
810
+ /** The sections: the palette takes no children and filters them by the query itself. */
811
+ items?: CommandSection[];
812
+ /** The search field's placeholder. */
813
+ placeholder?: string;
814
+ class?: string;
815
+ }
816
+ /** One field of a `Settings` page; `value` fits `type` (a dropdown's is one of its `options`). */
817
+ export type SettingsItem = {
818
+ /** Unique across all pages: it is what `change` reports. */
819
+ key: string;
820
+ label: string;
821
+ description?: string;
822
+ disabled?: boolean;
823
+ } & ({
824
+ type: "switch" | "checkbox";
825
+ value: boolean;
826
+ } | {
827
+ type: "input";
828
+ value: string;
829
+ } | {
830
+ type: "dropdown";
831
+ value: string;
832
+ options: {
833
+ value: string;
834
+ label: string;
835
+ }[];
836
+ } | {
837
+ type: "number";
838
+ value: number;
839
+ min?: number;
840
+ max?: number;
841
+ step?: number;
842
+ });
843
+ /** A group of fields, with an optional heading. */
844
+ export interface SettingsGroup {
845
+ title?: string;
846
+ items: SettingsItem[];
847
+ }
848
+ /** A sidebar entry and the groups shown when it is selected. */
849
+ export interface SettingsPage {
850
+ title: string;
851
+ /** A bundled icon name. */
852
+ icon?: string;
853
+ groups: SettingsGroup[];
854
+ }
855
+ /** What `change` reports: the field the user set and its new value. */
856
+ export interface SettingsChange {
857
+ key: string;
858
+ value: boolean | string | number;
859
+ }
860
+ export interface SettingsProps {
861
+ /** The pages: the host keeps each value the user sets (no `controlled` mode). */
862
+ pages?: SettingsPage[];
863
+ /** Give it a size (`size-full`, `h-96`): the sidebar and the page split the box. */
864
+ class?: string;
865
+ }
866
+ export interface ToggleProps {
867
+ checked?: boolean;
868
+ label?: string;
869
+ /** A bundled icon name, drawn before the label. */
870
+ icon?: string;
871
+ /** Default "ghost". */
872
+ variant?: "ghost" | "outline";
873
+ /** A hint; it is also the name a screen reader reads. */
874
+ tooltip?: string;
875
+ disabled?: boolean;
876
+ /** The host only reports clicks; the client confirms them with `checked`. */
877
+ controlled?: boolean;
878
+ class?: string;
879
+ }
880
+ export interface DropdownButtonProps {
881
+ label?: string;
882
+ /** A bundled icon name, drawn before the label. */
883
+ icon?: string;
884
+ /** Default: gpui-component's own look. */
885
+ variant?: "primary" | "secondary" | "ghost" | "danger";
886
+ outline?: boolean;
887
+ disabled?: boolean;
888
+ /** The menu, in the format of `contextMenu` (`PROTOCOL.md` section 10). */
889
+ items?: MenuItem[];
890
+ /** The name a screen reader reads for the caret; default: a translated "More options". */
891
+ menuLabel?: string;
892
+ /** A hint on the left half. */
893
+ tooltip?: string;
894
+ class?: string;
895
+ }
896
+ export interface LabelProps {
897
+ content?: string;
898
+ /** A muted text after the content. */
899
+ secondary?: string;
900
+ /** Dots instead of the characters. */
901
+ masked?: boolean;
902
+ /** Marks every occurrence of this substring, ignoring case. */
903
+ highlight?: string;
904
+ class?: string;
905
+ }
906
+ export interface EmptyProps {
907
+ /** A bundled icon name, in a muted box above the title. */
908
+ icon?: string;
909
+ title?: string;
910
+ description?: string;
911
+ /** It fills its box (`flex-1`), so size the parent. */
912
+ class?: string;
913
+ }
914
+ export interface ShimmerProps {
915
+ content?: string;
916
+ /** One sweep, in seconds; default 2. */
917
+ duration?: number;
918
+ /** The highlight half-width; default 0.3, kept within 0.05–1. */
919
+ spread?: number;
920
+ reverse?: boolean;
921
+ /** One sweep instead of a loop. */
922
+ once?: boolean;
923
+ class?: string;
924
+ }
925
+ export interface InputGroupProps {
926
+ value?: string;
927
+ placeholder?: string;
928
+ /** Text on the left of the field. */
929
+ prefix?: string;
930
+ /** Text on the right. */
931
+ suffix?: string;
932
+ /** A bundled icon name on the left. */
933
+ prefixIcon?: string;
934
+ /** A bundled icon name on the right. */
935
+ suffixIcon?: string;
936
+ disabled?: boolean;
937
+ readonly?: boolean;
938
+ /** The caller's validation result; it does not reject edits. */
939
+ invalid?: boolean;
940
+ /** The host only reports edits; the client confirms them with `value`. */
941
+ controlled?: boolean;
942
+ class?: string;
943
+ }
944
+ export interface ClipboardProps {
945
+ /** The text copied on click. */
946
+ value?: string;
947
+ /** A hint; `a11y.label` is the button's name. */
948
+ tooltip?: string;
949
+ class?: string;
950
+ }
951
+ /** The eight corners a `Popover` or a `HoverCard` can open from. */
952
+ export type OverlayAnchor = "top-left" | "top-center" | "top-right" | "left-center" | "right-center" | "bottom-left" | "bottom-center" | "bottom-right";
953
+ export interface AlertDialogProps {
954
+ /** Shown while true; the host sets it to false when the user answers. */
955
+ open?: boolean;
956
+ title?: string;
957
+ description?: string;
958
+ /** A bundled icon name, before the title. */
959
+ icon?: string;
960
+ /** Default "OK". */
961
+ okText?: string;
962
+ /** Adds the Cancel button. A `DialogFooter` child replaces both buttons. */
963
+ cancelText?: string;
964
+ /** Classes of the body that holds the children. */
965
+ class?: string;
966
+ }
967
+ export interface SheetProps {
968
+ /** Shown while true; the host sets it to false when the panel closes. */
969
+ open?: boolean;
970
+ /** The edge it slides in from. Default "right". */
971
+ side?: "left" | "right" | "top" | "bottom";
972
+ title?: string;
973
+ /** Pixels: the width on the sides, the height above and below. Default 350. */
974
+ size?: number;
975
+ /** Classes of the body that holds the children. */
976
+ class?: string;
977
+ }
978
+ export interface PopoverProps {
979
+ /**
980
+ * The panel's state, kept in the host as a synced `Checkbox`'s `checked`: the user opening or
981
+ * closing it reports `change` and updates it, and a `setProps` with another `open` wins.
982
+ */
983
+ open?: boolean;
984
+ /** Where the panel goes. Default "top-left" (below the trigger, left-aligned). */
985
+ anchor?: OverlayAnchor;
986
+ /** A triangle pointing at the trigger. */
987
+ arrow?: boolean;
988
+ /** Classes of the trigger's slot (the first child), not of the panel. */
989
+ class?: string;
990
+ }
991
+ export interface HoverCardProps {
992
+ /** Milliseconds before it opens. Default 600. */
993
+ openDelay?: number;
994
+ /** Milliseconds before it closes. Default 300. */
995
+ closeDelay?: number;
996
+ /** Where the card goes. Default "top-center". */
997
+ anchor?: OverlayAnchor;
998
+ /** Classes of the trigger's slot (the first child), not of the card. */
999
+ class?: string;
1000
+ }
1001
+ export interface DatePickerProps {
1002
+ /** The chosen day, `YYYY-MM-DD`; with `range: true`, an ISO interval `YYYY-MM-DD/YYYY-MM-DD`. `null` clears it. */
1003
+ value?: string | null;
1004
+ /** A start-to-end range; the form of `value` is fixed by this (the picker rebuilds when it changes). */
1005
+ range?: boolean;
1006
+ /** Shown while the field is empty. */
1007
+ placeholder?: string;
1008
+ disabled?: boolean;
1009
+ /** The host only reports picks; the client confirms them with `value`. */
1010
+ controlled?: boolean;
1011
+ class?: string;
1012
+ }
1013
+ export interface TimeFieldProps {
1014
+ /** The time shown, `HH:MM`; with `seconds: true`, `HH:MM:SS`. It has no empty state: without `value` the field shows `00:00`. */
1015
+ value?: string;
1016
+ /** Include seconds; the form of `value` is fixed by this (the field rebuilds when it changes). */
1017
+ seconds?: boolean;
1018
+ disabled?: boolean;
1019
+ /** The host only reports edits; the client confirms them with `value`. */
1020
+ controlled?: boolean;
1021
+ class?: string;
1022
+ }
1023
+ export interface ColorPickerProps {
1024
+ /** `#RRGGBB` or `#RRGGBBAA`; the `#` is required. `null` clears it. It has no `disabled`: gpui-component cannot disable its color pickers. */
1025
+ value?: string | null;
1026
+ /** Colors shown first, in the same form. */
1027
+ palette?: string[];
1028
+ /** The host only reports picks; the client confirms them with `value`. */
1029
+ controlled?: boolean;
1030
+ class?: string;
1031
+ }
1032
+ export interface ComboboxProps {
1033
+ /** The choices, as in a `Select`. */
1034
+ options?: Option[];
1035
+ /** The chosen options' values; always a list. */
1036
+ value?: string[];
1037
+ /** Shown while nothing is chosen. */
1038
+ placeholder?: string;
1039
+ /** A search box at the top of the list. */
1040
+ searchable?: boolean;
1041
+ disabled?: boolean;
1042
+ /** The host only reports toggles; the client confirms them with `value`. */
1043
+ controlled?: boolean;
1044
+ class?: string;
1045
+ }
1046
+ export interface BubbleProps {
1047
+ /** The surface; default `filled`. `ghost` has no surface or padding and takes the whole width. */
1048
+ variant?: "filled" | "secondary" | "muted" | "tinted" | "outline" | "ghost" | "destructive";
1049
+ /** Unset, it follows the `Message` that holds it. */
1050
+ alignment?: "start" | "end";
1051
+ class?: string;
1052
+ }
1053
+ export interface MessageProps {
1054
+ /** Default `start`; `end` moves the avatar to that side too. */
1055
+ alignment?: "start" | "end";
1056
+ /** An `Avatar`'s `name` and `src`; without either there is no avatar. */
1057
+ avatarName?: string;
1058
+ avatarSrc?: string;
1059
+ class?: string;
1060
+ }
1061
+ /** A `MessageHeader`/`MessageFooter` lays out its children in a row; outside a `Message` it draws nothing. */
1062
+ export interface MessagePartProps {
1063
+ class?: string;
1064
+ }
1065
+ export interface MarkerProps {
1066
+ content?: string;
1067
+ /** A bundled icon before the text; it replaces the loading spinner. */
1068
+ icon?: string;
1069
+ /** Default `plain`. */
1070
+ variant?: "plain" | "separator" | "border";
1071
+ alignment?: "start" | "center" | "end";
1072
+ loading?: boolean;
1073
+ /** Default `spinner`; `shimmer` moves a highlight over `content`. */
1074
+ loadingStyle?: "spinner" | "shimmer";
1075
+ class?: string;
1076
+ }
1077
+ export interface AttachmentProps {
1078
+ /** Default `complete`. */
1079
+ status?: "pending" | "uploading" | "processing" | "failed" | "complete";
1080
+ /** 0–100, shown only while `uploading`. */
1081
+ progress?: number;
1082
+ title?: string;
1083
+ description?: string;
1084
+ /** Shown while the card is hovered. */
1085
+ tooltip?: string;
1086
+ /** The picture, as in an `Image`; `data` (standard base64) wins over `src`. */
1087
+ src?: string;
1088
+ data?: string;
1089
+ /** Default `horizontal`; `vertical` puts the picture on top. */
1090
+ axis?: "horizontal" | "vertical";
1091
+ class?: string;
1092
+ }
1093
+ export interface MessageScrollerProps {
1094
+ /** Default true. */
1095
+ scrollbar?: boolean;
1096
+ /** The round button that goes back to the end; default true. */
1097
+ jumpButton?: boolean;
1098
+ /** That button's tooltip and name; the crate's default is "Jump to latest". */
1099
+ jumpLabel?: string;
1100
+ class?: string;
1101
+ }
1102
+ export interface QuestionnaireChoice {
1103
+ /** Unique within its question. */
1104
+ value: string;
1105
+ label: string;
1106
+ description?: string;
1107
+ disabled?: boolean;
1108
+ /** An answer from the start; at most one without `multiple`. */
1109
+ selected?: boolean;
1110
+ }
1111
+ export interface QuestionnaireItem {
1112
+ /** Unique; it names the answer. */
1113
+ name: string;
1114
+ label: string;
1115
+ description?: string;
1116
+ /** It cannot be skipped. */
1117
+ required?: boolean;
1118
+ /** Checkboxes instead of radio buttons. */
1119
+ multiple?: boolean;
1120
+ disabled?: boolean;
1121
+ /** A free-text field. */
1122
+ input?: boolean;
1123
+ choices?: QuestionnaireChoice[];
1124
+ }
1125
+ /** One answer, as `change` and `submit` report it. */
1126
+ export interface QuestionnaireAnswer {
1127
+ name: string;
1128
+ /** `unanswered` when it was cleared. */
1129
+ status: "answered" | "skipped" | "unanswered";
1130
+ choices: string[];
1131
+ text: string | null;
1132
+ }
1133
+ export interface QuestionnaireProps {
1134
+ /** Setting different `items` starts over; the same ones again keep the answers. */
1135
+ items?: QuestionnaireItem[];
1136
+ class?: string;
1137
+ }
1138
+ export interface ListProps {
1139
+ /** The selected row's `value`; one that is not among the rows selects nothing. */
1140
+ value?: string;
1141
+ /** The host only reports selections; the client confirms them with `value`. */
1142
+ controlled?: boolean;
1143
+ /** A search field above the rows: each edit sends `query`, and the client sends the matching rows. */
1144
+ searchable?: boolean;
1145
+ placeholder?: string;
1146
+ /** Near the end, the list sends `loadMore` (once per row count). */
1147
+ hasMore?: boolean;
1148
+ /** How many rows before the end `loadMore` is sent; default 20. */
1149
+ loadMoreThreshold?: number;
1150
+ /** Shows a skeleton instead of the rows. */
1151
+ loading?: boolean;
1152
+ class?: string;
1153
+ }
1154
+ /** A screen reader reads a row by its `a11y.label` (PROTOCOL.md section 27). */
1155
+ export interface ListItemProps {
1156
+ /** What the List's events report. Required: the host rejects a `ListItem` without it. */
1157
+ value?: string;
1158
+ /** Neither selected nor confirmed; the arrow keys pass over it. */
1159
+ disabled?: boolean;
1160
+ }
1161
+ export interface DockProps {
1162
+ class?: string;
1163
+ }
1164
+ export interface DockPanelProps {
1165
+ /** The tab's text. */
1166
+ title?: string;
1167
+ /** Where the panel starts; read only when it is added (the layout is the user's after that). */
1168
+ placement?: "center" | "left" | "right" | "bottom";
1169
+ /** The tab offers to close it: `close` is sent, and the app removes the node. */
1170
+ closable?: boolean;
1171
+ }
1172
+ /** A section of an `Accordion`; its children are the content. */
1173
+ export interface AccordionItemProps {
1174
+ /** What the Accordion's `change` reports. Required: the host rejects an `AccordionItem` without it. */
1175
+ id?: string;
1176
+ title?: string;
1177
+ /** The host keeps it in synced mode. */
1178
+ open?: boolean;
1179
+ disabled?: boolean;
1180
+ class?: string;
1181
+ }
1182
+ /** A `Dialog`'s or `AlertDialog`'s footer instead of OK/Cancel; outside one it draws nothing. */
1183
+ export interface SlotProps {
1184
+ class?: string;
1185
+ }
752
1186
  export interface NodeProps {
753
1187
  div: DivProps & SharedProps;
754
1188
  text: TextProps & SharedProps;
@@ -796,6 +1230,40 @@ export interface NodeProps {
796
1230
  Carousel: CarouselProps & SharedProps;
797
1231
  Sidebar: SidebarProps & SharedProps;
798
1232
  Chart: ChartProps & SharedProps;
1233
+ Canvas: CanvasProps & SharedProps;
1234
+ Command: CommandProps & SharedProps;
1235
+ Settings: SettingsProps & SharedProps;
1236
+ Toggle: ToggleProps & SharedProps;
1237
+ DropdownButton: DropdownButtonProps & SharedProps;
1238
+ Label: LabelProps & SharedProps;
1239
+ Empty: EmptyProps & SharedProps;
1240
+ Shimmer: ShimmerProps & SharedProps;
1241
+ InputGroup: InputGroupProps & SharedProps;
1242
+ Clipboard: ClipboardProps & SharedProps;
1243
+ AlertDialog: AlertDialogProps & SharedProps;
1244
+ Sheet: SheetProps & SharedProps;
1245
+ Popover: PopoverProps & SharedProps;
1246
+ HoverCard: HoverCardProps & SharedProps;
1247
+ DatePicker: DatePickerProps & SharedProps;
1248
+ TimeField: TimeFieldProps & SharedProps;
1249
+ ColorPicker: ColorPickerProps & SharedProps;
1250
+ Combobox: ComboboxProps & SharedProps;
1251
+ Bubble: BubbleProps & SharedProps;
1252
+ Message: MessageProps & SharedProps;
1253
+ MessageHeader: MessagePartProps & SharedProps;
1254
+ MessageFooter: MessagePartProps & SharedProps;
1255
+ Marker: MarkerProps & SharedProps;
1256
+ Attachment: AttachmentProps & SharedProps;
1257
+ MessageScroller: MessageScrollerProps & SharedProps;
1258
+ Questionnaire: QuestionnaireProps & SharedProps;
1259
+ List: ListProps & SharedProps;
1260
+ ListItem: ListItemProps & SharedProps;
1261
+ Dock: DockProps & SharedProps;
1262
+ DockPanel: DockPanelProps & SharedProps;
1263
+ AccordionItem: AccordionItemProps & SharedProps;
1264
+ DialogFooter: SlotProps & SharedProps;
1265
+ StatusBarLeft: SlotProps & SharedProps;
1266
+ StatusBarRight: SlotProps & SharedProps;
799
1267
  }
800
1268
  export interface NodeEvents {
801
1269
  div: {
@@ -979,4 +1447,140 @@ export interface NodeEvents {
979
1447
  };
980
1448
  /** A chart has no events: the hover tooltip is the component's own. */
981
1449
  Chart: {};
1450
+ /** `value` is the point pressed, local to the canvas. */
1451
+ Canvas: {
1452
+ pointerDown: {
1453
+ value: CanvasPoint;
1454
+ };
1455
+ };
1456
+ /** `value` is the `id` of the entry confirmed (Enter or a click). */
1457
+ Command: {
1458
+ confirm: {
1459
+ value: string;
1460
+ };
1461
+ };
1462
+ /** `value` is the field set by the user and its new value. */
1463
+ Settings: {
1464
+ change: {
1465
+ value: SettingsChange;
1466
+ };
1467
+ };
1468
+ Toggle: {
1469
+ change: {
1470
+ checked: boolean;
1471
+ };
1472
+ };
1473
+ /** `value` is the chosen item's `id`. */
1474
+ DropdownButton: {
1475
+ click: {};
1476
+ menu: {
1477
+ item: string;
1478
+ };
1479
+ };
1480
+ Label: {};
1481
+ Empty: {};
1482
+ Shimmer: {};
1483
+ InputGroup: {
1484
+ change: {
1485
+ value: string;
1486
+ };
1487
+ submit: {
1488
+ value: string;
1489
+ };
1490
+ };
1491
+ /** `value` is the text that was copied. */
1492
+ Clipboard: {
1493
+ copied: {
1494
+ value: string;
1495
+ };
1496
+ };
1497
+ /** OK and Cancel close it, as in a `Dialog`; it shows over an open one. */
1498
+ AlertDialog: {
1499
+ ok: {};
1500
+ cancel: {};
1501
+ };
1502
+ /** The user closed the panel with its X, Escape or a click on the overlay. */
1503
+ Sheet: {
1504
+ close: {};
1505
+ };
1506
+ /** `checked` is true when it opened, false when it closed. */
1507
+ Popover: {
1508
+ change: {
1509
+ checked: boolean;
1510
+ };
1511
+ };
1512
+ /** The mouse is the only way in: no `open` and no `simulate`. */
1513
+ HoverCard: {
1514
+ change: {
1515
+ checked: boolean;
1516
+ };
1517
+ };
1518
+ /** `value` is the chosen day, `null` when cleared. */
1519
+ DatePicker: {
1520
+ change: {
1521
+ value: string | null;
1522
+ };
1523
+ };
1524
+ /** `value` is the time, `HH:MM[:SS]`; it has no empty state. */
1525
+ TimeField: {
1526
+ change: {
1527
+ value: string;
1528
+ };
1529
+ };
1530
+ /** `value` is the color, `null` when cleared. */
1531
+ ColorPicker: {
1532
+ change: {
1533
+ value: string | null;
1534
+ };
1535
+ };
1536
+ /** `value` is the whole selection: toggling one sends the full list. */
1537
+ Combobox: {
1538
+ change: {
1539
+ value: string[];
1540
+ };
1541
+ };
1542
+ Bubble: {};
1543
+ Message: {};
1544
+ MessageHeader: {};
1545
+ MessageFooter: {};
1546
+ Marker: {};
1547
+ /** The card's controls exist only while their event is subscribed; `retry` only while `failed`. */
1548
+ Attachment: {
1549
+ click: {};
1550
+ remove: {};
1551
+ retry: {};
1552
+ };
1553
+ MessageScroller: {};
1554
+ /** `change` sends one answer; `submit` all of them, in question order. */
1555
+ Questionnaire: {
1556
+ change: {
1557
+ value: QuestionnaireAnswer;
1558
+ };
1559
+ submit: {
1560
+ value: QuestionnaireAnswer[];
1561
+ };
1562
+ };
1563
+ /** `change` sends the selected row's `value` (`null`: Escape); `query` the search text; `loadMore` nothing. */
1564
+ List: {
1565
+ change: {
1566
+ value: string | null;
1567
+ };
1568
+ confirm: {
1569
+ value: string;
1570
+ };
1571
+ query: {
1572
+ value: string;
1573
+ };
1574
+ loadMore: {};
1575
+ };
1576
+ ListItem: {};
1577
+ Dock: {};
1578
+ /** `close`: the user closed the panel; it has left the layout. */
1579
+ DockPanel: {
1580
+ close: {};
1581
+ };
1582
+ AccordionItem: {};
1583
+ DialogFooter: {};
1584
+ StatusBarLeft: {};
1585
+ StatusBarRight: {};
982
1586
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gpui-bridge",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Node.js client for the gpui-bridge native UI host",
5
5
  "license": "MIT",
6
6
  "author": "gpui-bridge contributors",
@@ -29,9 +29,9 @@
29
29
  "node": ">=22.6"
30
30
  },
31
31
  "optionalDependencies": {
32
- "@indios/gpui-bridge-darwin-arm64": "0.2.0",
33
- "@indios/gpui-bridge-linux-x64": "0.2.0",
34
- "@indios/gpui-bridge-win32-x64": "0.2.0"
32
+ "@indios/gpui-bridge-darwin-arm64": "0.3.0",
33
+ "@indios/gpui-bridge-linux-x64": "0.3.0",
34
+ "@indios/gpui-bridge-win32-x64": "0.3.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "^26.6.5",