@gtkx/react 0.14.0 → 0.15.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.
Files changed (52) hide show
  1. package/README.md +27 -27
  2. package/dist/generated/jsx.d.ts +235 -228
  3. package/dist/host-config.js +2 -2
  4. package/dist/jsx.d.ts +111 -2
  5. package/dist/jsx.js +79 -0
  6. package/dist/nodes/adjustment.d.ts +48 -0
  7. package/dist/nodes/adjustment.js +70 -0
  8. package/dist/nodes/calendar.js +3 -16
  9. package/dist/nodes/column-view-column.d.ts +1 -0
  10. package/dist/nodes/column-view-column.js +4 -0
  11. package/dist/nodes/column-view.js +6 -6
  12. package/dist/nodes/drawing-area.d.ts +1 -0
  13. package/dist/nodes/drawing-area.js +19 -0
  14. package/dist/nodes/expander-row.js +1 -0
  15. package/dist/nodes/index.d.ts +8 -0
  16. package/dist/nodes/index.js +8 -0
  17. package/dist/nodes/internal/constants.js +3 -0
  18. package/dist/nodes/internal/list-item-renderer.d.ts +1 -0
  19. package/dist/nodes/internal/list-item-renderer.js +5 -0
  20. package/dist/nodes/internal/predicates.d.ts +4 -0
  21. package/dist/nodes/internal/predicates.js +3 -0
  22. package/dist/nodes/internal/signal-store.d.ts +1 -0
  23. package/dist/nodes/internal/signal-store.js +7 -0
  24. package/dist/nodes/internal/tree-list-item-renderer.d.ts +1 -0
  25. package/dist/nodes/internal/tree-list-item-renderer.js +8 -0
  26. package/dist/nodes/level-bar.js +3 -16
  27. package/dist/nodes/list-view.js +6 -2
  28. package/dist/nodes/navigation-page.js +32 -23
  29. package/dist/nodes/notebook-page-tab.d.ts +1 -0
  30. package/dist/nodes/notebook-page-tab.js +15 -9
  31. package/dist/nodes/notebook-page.js +9 -6
  32. package/dist/nodes/scale.js +3 -16
  33. package/dist/nodes/scrolled-window.js +3 -2
  34. package/dist/nodes/shortcut-controller.d.ts +37 -0
  35. package/dist/nodes/shortcut-controller.js +74 -0
  36. package/dist/nodes/shortcut.d.ts +38 -0
  37. package/dist/nodes/shortcut.js +46 -0
  38. package/dist/nodes/source-buffer.d.ts +73 -0
  39. package/dist/nodes/source-buffer.js +149 -0
  40. package/dist/nodes/source-view.d.ts +1 -0
  41. package/dist/nodes/source-view.js +42 -0
  42. package/dist/nodes/stack-page.js +15 -9
  43. package/dist/nodes/text-buffer.d.ts +43 -0
  44. package/dist/nodes/text-buffer.js +81 -0
  45. package/dist/nodes/text-view.d.ts +1 -0
  46. package/dist/nodes/text-view.js +45 -0
  47. package/dist/nodes/tree-list-view.js +6 -2
  48. package/dist/nodes/widget.d.ts +4 -0
  49. package/dist/nodes/widget.js +85 -10
  50. package/dist/nodes/window.js +7 -5
  51. package/dist/types.d.ts +26 -0
  52. package/package.json +3 -3
@@ -1,4 +1,4 @@
1
- import { batch, beginBatch, endBatch, getNativeId } from "@gtkx/ffi";
1
+ import { beginBatch, endBatch, getNativeId } from "@gtkx/ffi";
2
2
  import React from "react";
3
3
  import { createNode } from "./factory.js";
4
4
  import { signalStore } from "./nodes/internal/signal-store.js";
@@ -71,11 +71,11 @@ export function createHostConfig() {
71
71
  parent.insertBefore(child, beforeChild);
72
72
  },
73
73
  prepareForCommit: () => {
74
+ signalStore.blockAll();
74
75
  beginBatch();
75
76
  return null;
76
77
  },
77
78
  resetAfterCommit: () => {
78
- batch(() => signalStore.blockAll());
79
79
  endBatch();
80
80
  flushAfterCommit();
81
81
  signalStore.unblockAll();
package/dist/jsx.d.ts CHANGED
@@ -1,8 +1,16 @@
1
1
  import type * as Gtk from "@gtkx/ffi/gtk";
2
2
  import type { ReactElement, ReactNode } from "react";
3
+ import type { AdjustmentProps } from "./nodes/adjustment.js";
3
4
  import type { RenderItemFn } from "./nodes/internal/list-item-renderer.js";
4
5
  import type { TreeRenderItemFn } from "./nodes/internal/tree-list-item-renderer.js";
5
- export type { DragSourceProps, DropTargetProps, EventControllerProps } from "./types.js";
6
+ import type { ShortcutProps as ShortcutNodeProps } from "./nodes/shortcut.js";
7
+ import type { ShortcutControllerProps as ShortcutControllerNodeProps } from "./nodes/shortcut-controller.js";
8
+ import type { SourceBufferProps } from "./nodes/source-buffer.js";
9
+ import type { TextBufferProps } from "./nodes/text-buffer.js";
10
+ export type { AdjustmentProps } from "./nodes/adjustment.js";
11
+ export type { SourceBufferProps } from "./nodes/source-buffer.js";
12
+ export type { TextBufferProps } from "./nodes/text-buffer.js";
13
+ export type { DragSourceProps, DropTargetProps, EventControllerProps, GestureDragProps } from "./types.js";
6
14
  /**
7
15
  * Props for slot-based child positioning.
8
16
  *
@@ -131,7 +139,7 @@ export type ColumnViewRootProps<C extends string = string> = {
131
139
  /** Sort direction (ascending or descending) */
132
140
  sortOrder?: Gtk.SortType;
133
141
  /** Callback when sort changes */
134
- onSortChange?: (column: C | null, order: Gtk.SortType) => void;
142
+ onSortChanged?: (column: C | null, order: Gtk.SortType) => void;
135
143
  /** Estimated row height in pixels for proper virtualization before content loads */
136
144
  estimatedRowHeight?: number;
137
145
  };
@@ -319,6 +327,23 @@ type NavigationPageBaseProps = {
319
327
  canPop?: boolean;
320
328
  children?: ReactNode;
321
329
  };
330
+ /**
331
+ * Props for the ShortcutController element in JSX.
332
+ *
333
+ * Extends the base ShortcutControllerProps with support for children.
334
+ *
335
+ * @see {@link x.ShortcutController} for usage examples
336
+ */
337
+ export type ShortcutControllerProps = ShortcutControllerNodeProps & {
338
+ /** Shortcut children to add to this controller */
339
+ children?: ReactNode;
340
+ };
341
+ /**
342
+ * Props for the Shortcut element in JSX.
343
+ *
344
+ * @see {@link x.Shortcut} for usage examples
345
+ */
346
+ export type ShortcutProps = ShortcutNodeProps;
322
347
  /**
323
348
  * Props for the NavigationPage virtual element with type-safe targeting.
324
349
  *
@@ -712,6 +737,24 @@ export declare const x: {
712
737
  * ```
713
738
  */
714
739
  MenuSubmenu: "MenuSubmenu";
740
+ /**
741
+ * Declarative adjustment configuration for adjustable widgets.
742
+ *
743
+ * Works with Scale, Scrollbar, ScaleButton, SpinButton, and ListBox.
744
+ *
745
+ * @example
746
+ * ```tsx
747
+ * <GtkScale>
748
+ * <x.Adjustment
749
+ * value={50}
750
+ * lower={0}
751
+ * upper={100}
752
+ * onValueChanged={(v) => console.log(v)}
753
+ * />
754
+ * </GtkScale>
755
+ * ```
756
+ */
757
+ Adjustment: "Adjustment";
715
758
  /**
716
759
  * A mark to display on a GtkScale slider.
717
760
  *
@@ -725,6 +768,38 @@ export declare const x: {
725
768
  * ```
726
769
  */
727
770
  ScaleMark: "ScaleMark";
771
+ /**
772
+ * Declarative text buffer for a GtkTextView.
773
+ *
774
+ * @example
775
+ * ```tsx
776
+ * <GtkTextView>
777
+ * <x.TextBuffer
778
+ * text="Hello!"
779
+ * enableUndo
780
+ * onTextChanged={(text) => console.log(text)}
781
+ * />
782
+ * </GtkTextView>
783
+ * ```
784
+ */
785
+ TextBuffer: "TextBuffer";
786
+ /**
787
+ * Declarative source buffer for a GtkSourceView with syntax highlighting.
788
+ *
789
+ * @example
790
+ * ```tsx
791
+ * <GtkSourceView>
792
+ * <x.SourceBuffer
793
+ * text={code}
794
+ * language="typescript"
795
+ * styleScheme="Adwaita-dark"
796
+ * highlightMatchingBrackets
797
+ * onTextChanged={(text) => console.log(text)}
798
+ * />
799
+ * </GtkSourceView>
800
+ * ```
801
+ */
802
+ SourceBuffer: "SourceBuffer";
728
803
  /**
729
804
  * A day mark on a GtkCalendar.
730
805
  *
@@ -818,6 +893,35 @@ export declare const x: {
818
893
  * ```
819
894
  */
820
895
  NavigationPage: "NavigationPage";
896
+ /**
897
+ * Declarative keyboard shortcut controller.
898
+ *
899
+ * Attach keyboard shortcuts to a widget. Must contain `x.Shortcut` children.
900
+ *
901
+ * @example
902
+ * ```tsx
903
+ * <GtkBox>
904
+ * <x.ShortcutController scope={Gtk.ShortcutScope.GLOBAL}>
905
+ * <x.Shortcut trigger="<Control>f" onActivate={() => setSearchMode(s => !s)} />
906
+ * <x.Shortcut trigger="<Control>q" onActivate={quit} />
907
+ * </x.ShortcutController>
908
+ * </GtkBox>
909
+ * ```
910
+ */
911
+ ShortcutController: "ShortcutController";
912
+ /**
913
+ * A keyboard shortcut definition.
914
+ *
915
+ * Must be a child of `x.ShortcutController`.
916
+ *
917
+ * @example
918
+ * ```tsx
919
+ * <x.Shortcut trigger="<Control>s" onActivate={save} />
920
+ * <x.Shortcut trigger={["F5", "<Control>r"]} onActivate={refresh} />
921
+ * <x.Shortcut trigger="Escape" onActivate={cancel} disabled={!canCancel} />
922
+ * ```
923
+ */
924
+ Shortcut: "Shortcut";
821
925
  };
822
926
  declare global {
823
927
  namespace React {
@@ -841,7 +945,10 @@ declare global {
841
945
  OverlayChild: OverlayChildProps;
842
946
  PackEnd: VirtualSlotProps;
843
947
  PackStart: VirtualSlotProps;
948
+ Adjustment: AdjustmentProps;
844
949
  ScaleMark: ScaleMarkProps;
950
+ SourceBuffer: SourceBufferProps;
951
+ TextBuffer: TextBufferProps;
845
952
  SimpleListItem: StringListItemProps;
846
953
  StackPage: StackPageProps;
847
954
  Toggle: ToggleProps;
@@ -849,6 +956,8 @@ declare global {
849
956
  ToolbarTop: VirtualSlotProps;
850
957
  TreeListItem: TreeListItemProps<any>;
851
958
  NavigationPage: NavigationPageProps;
959
+ ShortcutController: ShortcutControllerProps;
960
+ Shortcut: ShortcutProps;
852
961
  }
853
962
  }
854
963
  }
package/dist/jsx.js CHANGED
@@ -319,6 +319,24 @@ export const x = {
319
319
  * ```
320
320
  */
321
321
  MenuSubmenu: "MenuSubmenu",
322
+ /**
323
+ * Declarative adjustment configuration for adjustable widgets.
324
+ *
325
+ * Works with Scale, Scrollbar, ScaleButton, SpinButton, and ListBox.
326
+ *
327
+ * @example
328
+ * ```tsx
329
+ * <GtkScale>
330
+ * <x.Adjustment
331
+ * value={50}
332
+ * lower={0}
333
+ * upper={100}
334
+ * onValueChanged={(v) => console.log(v)}
335
+ * />
336
+ * </GtkScale>
337
+ * ```
338
+ */
339
+ Adjustment: "Adjustment",
322
340
  /**
323
341
  * A mark to display on a GtkScale slider.
324
342
  *
@@ -332,6 +350,38 @@ export const x = {
332
350
  * ```
333
351
  */
334
352
  ScaleMark: "ScaleMark",
353
+ /**
354
+ * Declarative text buffer for a GtkTextView.
355
+ *
356
+ * @example
357
+ * ```tsx
358
+ * <GtkTextView>
359
+ * <x.TextBuffer
360
+ * text="Hello!"
361
+ * enableUndo
362
+ * onTextChanged={(text) => console.log(text)}
363
+ * />
364
+ * </GtkTextView>
365
+ * ```
366
+ */
367
+ TextBuffer: "TextBuffer",
368
+ /**
369
+ * Declarative source buffer for a GtkSourceView with syntax highlighting.
370
+ *
371
+ * @example
372
+ * ```tsx
373
+ * <GtkSourceView>
374
+ * <x.SourceBuffer
375
+ * text={code}
376
+ * language="typescript"
377
+ * styleScheme="Adwaita-dark"
378
+ * highlightMatchingBrackets
379
+ * onTextChanged={(text) => console.log(text)}
380
+ * />
381
+ * </GtkSourceView>
382
+ * ```
383
+ */
384
+ SourceBuffer: "SourceBuffer",
335
385
  /**
336
386
  * A day mark on a GtkCalendar.
337
387
  *
@@ -425,5 +475,34 @@ export const x = {
425
475
  * ```
426
476
  */
427
477
  NavigationPage: "NavigationPage",
478
+ /**
479
+ * Declarative keyboard shortcut controller.
480
+ *
481
+ * Attach keyboard shortcuts to a widget. Must contain `x.Shortcut` children.
482
+ *
483
+ * @example
484
+ * ```tsx
485
+ * <GtkBox>
486
+ * <x.ShortcutController scope={Gtk.ShortcutScope.GLOBAL}>
487
+ * <x.Shortcut trigger="<Control>f" onActivate={() => setSearchMode(s => !s)} />
488
+ * <x.Shortcut trigger="<Control>q" onActivate={quit} />
489
+ * </x.ShortcutController>
490
+ * </GtkBox>
491
+ * ```
492
+ */
493
+ ShortcutController: "ShortcutController",
494
+ /**
495
+ * A keyboard shortcut definition.
496
+ *
497
+ * Must be a child of `x.ShortcutController`.
498
+ *
499
+ * @example
500
+ * ```tsx
501
+ * <x.Shortcut trigger="<Control>s" onActivate={save} />
502
+ * <x.Shortcut trigger={["F5", "<Control>r"]} onActivate={refresh} />
503
+ * <x.Shortcut trigger="Escape" onActivate={cancel} disabled={!canCancel} />
504
+ * ```
505
+ */
506
+ Shortcut: "Shortcut",
428
507
  };
429
508
  export * from "./generated/jsx.js";
@@ -0,0 +1,48 @@
1
+ import type { AdjustableWidget } from "./internal/predicates.js";
2
+ import { VirtualNode } from "./virtual.js";
3
+ /**
4
+ * Props for the Adjustment virtual element.
5
+ *
6
+ * Used to declaratively configure the adjustment for adjustable widgets
7
+ * such as Scale, Scrollbar, ScaleButton, SpinButton, and ListBox.
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * <GtkScale>
12
+ * <x.Adjustment
13
+ * value={50}
14
+ * lower={0}
15
+ * upper={100}
16
+ * stepIncrement={1}
17
+ * onValueChanged={(v) => console.log("Value:", v)}
18
+ * />
19
+ * </GtkScale>
20
+ * ```
21
+ */
22
+ export type AdjustmentProps = {
23
+ /** The current value */
24
+ value?: number;
25
+ /** The minimum value */
26
+ lower?: number;
27
+ /** The maximum value */
28
+ upper?: number;
29
+ /** The increment for arrow keys */
30
+ stepIncrement?: number;
31
+ /** The increment for page up/down */
32
+ pageIncrement?: number;
33
+ /** The page size (usually 0 for scales) */
34
+ pageSize?: number;
35
+ /** Callback when the value changes */
36
+ onValueChanged?: (value: number) => void;
37
+ };
38
+ export declare class AdjustmentNode extends VirtualNode<AdjustmentProps> {
39
+ static priority: number;
40
+ private widget?;
41
+ private adjustment?;
42
+ static matches(type: string): boolean;
43
+ setWidget(widget: AdjustableWidget): void;
44
+ private setupAdjustment;
45
+ private updateSignalHandler;
46
+ updateProps(oldProps: AdjustmentProps | null, newProps: AdjustmentProps): void;
47
+ unmount(): void;
48
+ }
@@ -0,0 +1,70 @@
1
+ import * as Gtk from "@gtkx/ffi/gtk";
2
+ import { registerNodeClass } from "../registry.js";
3
+ import { signalStore } from "./internal/signal-store.js";
4
+ import { VirtualNode } from "./virtual.js";
5
+ export class AdjustmentNode extends VirtualNode {
6
+ static priority = 1;
7
+ widget;
8
+ adjustment;
9
+ static matches(type) {
10
+ return type === "Adjustment";
11
+ }
12
+ setWidget(widget) {
13
+ this.widget = widget;
14
+ this.setupAdjustment();
15
+ }
16
+ setupAdjustment() {
17
+ if (!this.widget)
18
+ return;
19
+ const { value = 0, lower = 0, upper = 100, stepIncrement = 1, pageIncrement = 10, pageSize = 0 } = this.props;
20
+ this.adjustment = new Gtk.Adjustment(value, lower, upper, stepIncrement, pageIncrement, pageSize);
21
+ this.widget.setAdjustment(this.adjustment);
22
+ this.updateSignalHandler();
23
+ }
24
+ updateSignalHandler() {
25
+ if (!this.adjustment)
26
+ return;
27
+ const { onValueChanged } = this.props;
28
+ if (onValueChanged) {
29
+ const adjustment = this.adjustment;
30
+ signalStore.set(this, adjustment, "value-changed", () => onValueChanged(adjustment.getValue()));
31
+ }
32
+ else {
33
+ signalStore.set(this, this.adjustment, "value-changed", null);
34
+ }
35
+ }
36
+ updateProps(oldProps, newProps) {
37
+ super.updateProps(oldProps, newProps);
38
+ if (!this.adjustment)
39
+ return;
40
+ if (!oldProps || oldProps.lower !== newProps.lower) {
41
+ this.adjustment.setLower(newProps.lower ?? 0);
42
+ }
43
+ if (!oldProps || oldProps.upper !== newProps.upper) {
44
+ this.adjustment.setUpper(newProps.upper ?? 100);
45
+ }
46
+ if (!oldProps || oldProps.stepIncrement !== newProps.stepIncrement) {
47
+ this.adjustment.setStepIncrement(newProps.stepIncrement ?? 1);
48
+ }
49
+ if (!oldProps || oldProps.pageIncrement !== newProps.pageIncrement) {
50
+ this.adjustment.setPageIncrement(newProps.pageIncrement ?? 10);
51
+ }
52
+ if (!oldProps || oldProps.pageSize !== newProps.pageSize) {
53
+ this.adjustment.setPageSize(newProps.pageSize ?? 0);
54
+ }
55
+ if (!oldProps || oldProps.value !== newProps.value) {
56
+ if (newProps.value !== undefined) {
57
+ this.adjustment.setValue(newProps.value);
58
+ }
59
+ }
60
+ if (!oldProps || oldProps.onValueChanged !== newProps.onValueChanged) {
61
+ this.updateSignalHandler();
62
+ }
63
+ }
64
+ unmount() {
65
+ this.adjustment = undefined;
66
+ this.widget = undefined;
67
+ super.unmount();
68
+ }
69
+ }
70
+ registerNodeClass(AdjustmentNode);
@@ -3,7 +3,6 @@ import { registerNodeClass } from "../registry.js";
3
3
  import { CommitPriority, scheduleAfterCommit } from "../scheduler.js";
4
4
  import { CalendarMarkNode } from "./calendar-mark.js";
5
5
  import { isContainerType } from "./internal/utils.js";
6
- import { SlotNode } from "./slot.js";
7
6
  import { WidgetNode } from "./widget.js";
8
7
  class CalendarNode extends WidgetNode {
9
8
  static priority = 1;
@@ -18,11 +17,7 @@ class CalendarNode extends WidgetNode {
18
17
  scheduleAfterCommit(() => child.addMark());
19
18
  return;
20
19
  }
21
- if (child instanceof SlotNode || child instanceof WidgetNode) {
22
- super.appendChild(child);
23
- return;
24
- }
25
- throw new Error(`Cannot append '${child.typeName}' to 'Calendar': expected x.CalendarMark or Widget`);
20
+ super.appendChild(child);
26
21
  }
27
22
  insertBefore(child, before) {
28
23
  if (child instanceof CalendarMarkNode) {
@@ -37,11 +32,7 @@ class CalendarNode extends WidgetNode {
37
32
  this.scheduleRebuildAllMarks();
38
33
  return;
39
34
  }
40
- if (child instanceof SlotNode || child instanceof WidgetNode) {
41
- super.insertBefore(child, before);
42
- return;
43
- }
44
- throw new Error(`Cannot insert '${child.typeName}' into 'Calendar': expected x.CalendarMark or Widget`);
35
+ super.insertBefore(child, before);
45
36
  }
46
37
  removeChild(child) {
47
38
  if (child instanceof CalendarMarkNode) {
@@ -52,11 +43,7 @@ class CalendarNode extends WidgetNode {
52
43
  this.scheduleRebuildAllMarks(CommitPriority.HIGH);
53
44
  return;
54
45
  }
55
- if (child instanceof SlotNode || child instanceof WidgetNode) {
56
- super.removeChild(child);
57
- return;
58
- }
59
- throw new Error(`Cannot remove '${child.typeName}' from 'Calendar': expected x.CalendarMark or Widget`);
46
+ super.removeChild(child);
60
47
  }
61
48
  scheduleRebuildAllMarks(priority = CommitPriority.NORMAL) {
62
49
  scheduleAfterCommit(() => {
@@ -10,6 +10,7 @@ export declare class ColumnViewColumnNode extends VirtualNode<Props> {
10
10
  column: Gtk.ColumnViewColumn;
11
11
  private itemRenderer;
12
12
  constructor(typeName: string, props: Props, container: undefined, rootContainer?: Container);
13
+ unmount(): void;
13
14
  setStore(model?: ListStore): void;
14
15
  setEstimatedRowHeight(height?: number): void;
15
16
  updateProps(oldProps: Props | null, newProps: Props): void;
@@ -15,6 +15,10 @@ export class ColumnViewColumnNode extends VirtualNode {
15
15
  this.column = new Gtk.ColumnViewColumn();
16
16
  this.column.setFactory(this.itemRenderer.getFactory());
17
17
  }
18
+ unmount() {
19
+ this.itemRenderer.dispose();
20
+ super.unmount();
21
+ }
18
22
  setStore(model) {
19
23
  this.itemRenderer.setStore(model);
20
24
  }
@@ -7,7 +7,7 @@ import { filterProps, matchesAnyClass } from "./internal/utils.js";
7
7
  import { ListItemNode } from "./list-item.js";
8
8
  import { List } from "./models/list.js";
9
9
  import { WidgetNode } from "./widget.js";
10
- const PROP_NAMES = ["sortColumn", "sortOrder", "onSortChange", "estimatedRowHeight"];
10
+ const PROP_NAMES = ["sortColumn", "sortOrder", "onSortChanged", "estimatedRowHeight"];
11
11
  class ColumnViewNode extends WidgetNode {
12
12
  static priority = 1;
13
13
  handleSortChange;
@@ -85,12 +85,12 @@ class ColumnViewNode extends WidgetNode {
85
85
  this.columnNodes.delete(child);
86
86
  }
87
87
  updateProps(oldProps, newProps) {
88
- if (!oldProps || oldProps.onSortChange !== newProps.onSortChange) {
88
+ if (!oldProps || oldProps.onSortChanged !== newProps.onSortChanged) {
89
89
  const sorter = this.container.getSorter();
90
- const onSortChange = newProps.onSortChange;
90
+ const onSortChanged = newProps.onSortChanged;
91
91
  if (sorter) {
92
92
  this.handleSortChange = () => {
93
- onSortChange?.(sorter.getPrimarySortColumn()?.getId() ?? null, sorter.getPrimarySortOrder());
93
+ onSortChanged?.(sorter.getPrimarySortColumn()?.getId() ?? null, sorter.getPrimarySortOrder());
94
94
  };
95
95
  signalStore.set(this, sorter, "changed", this.handleSortChange);
96
96
  }
@@ -111,8 +111,8 @@ class ColumnViewNode extends WidgetNode {
111
111
  column.setEstimatedRowHeight(this.estimatedRowHeight);
112
112
  }
113
113
  }
114
- this.list.updateProps(oldProps ? filterProps(oldProps, PROP_NAMES) : null, filterProps(newProps, PROP_NAMES));
115
- super.updateProps(oldProps ? filterProps(oldProps, PROP_NAMES) : null, filterProps(newProps, PROP_NAMES));
114
+ this.list.updateProps(filterProps(oldProps ?? {}, PROP_NAMES), filterProps(newProps, PROP_NAMES));
115
+ super.updateProps(filterProps(oldProps ?? {}, PROP_NAMES), filterProps(newProps, PROP_NAMES));
116
116
  }
117
117
  getColumn(columnId) {
118
118
  const columns = this.container.getColumns();
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,19 @@
1
+ import * as Gtk from "@gtkx/ffi/gtk";
2
+ import { registerNodeClass } from "../registry.js";
3
+ import { filterProps, isContainerType } from "./internal/utils.js";
4
+ import { WidgetNode } from "./widget.js";
5
+ const PROPS = ["onDraw"];
6
+ class DrawingAreaNode extends WidgetNode {
7
+ static priority = 1;
8
+ static matches(_type, containerOrClass) {
9
+ return isContainerType(Gtk.DrawingArea, containerOrClass);
10
+ }
11
+ updateProps(oldProps, newProps) {
12
+ if (newProps.onDraw && (!oldProps || oldProps.onDraw !== newProps.onDraw)) {
13
+ this.container.setDrawFunc(newProps.onDraw);
14
+ this.container.queueDraw();
15
+ }
16
+ super.updateProps(filterProps(oldProps ?? {}, PROPS), filterProps(newProps, PROPS));
17
+ }
18
+ }
19
+ registerNodeClass(DrawingAreaNode);
@@ -42,6 +42,7 @@ class ExpanderRowNode extends WidgetNode {
42
42
  }
43
43
  removeChild(child) {
44
44
  if (child instanceof ExpanderRowChild || child instanceof ActionRowChild) {
45
+ child.unmount();
45
46
  return;
46
47
  }
47
48
  if (child instanceof SlotNode || child instanceof WidgetNode) {
@@ -6,6 +6,7 @@ import "./calendar-mark.js";
6
6
  import "./calendar.js";
7
7
  import "./column-view-column.js";
8
8
  import "./column-view.js";
9
+ import "./drawing-area.js";
9
10
  import "./expander-row-child.js";
10
11
  import "./expander-row.js";
11
12
  import "./fixed-child.js";
@@ -24,14 +25,21 @@ import "./overlay-child.js";
24
25
  import "./pack-child.js";
25
26
  import "./pack.js";
26
27
  import "./popover-menu.js";
28
+ import "./adjustment.js";
27
29
  import "./scale-mark.js";
28
30
  import "./scale.js";
29
31
  import "./scrolled-window.js";
32
+ import "./shortcut-controller.js";
33
+ import "./shortcut.js";
30
34
  import "./simple-list-item.js";
31
35
  import "./simple-list-view.js";
32
36
  import "./slot.js";
37
+ import "./source-buffer.js";
38
+ import "./source-view.js";
33
39
  import "./stack-page.js";
34
40
  import "./stack.js";
41
+ import "./text-buffer.js";
42
+ import "./text-view.js";
35
43
  import "./toggle.js";
36
44
  import "./toggle-group.js";
37
45
  import "./toolbar-child.js";
@@ -6,6 +6,7 @@ import "./calendar-mark.js";
6
6
  import "./calendar.js";
7
7
  import "./column-view-column.js";
8
8
  import "./column-view.js";
9
+ import "./drawing-area.js";
9
10
  import "./expander-row-child.js";
10
11
  import "./expander-row.js";
11
12
  import "./fixed-child.js";
@@ -24,14 +25,21 @@ import "./overlay-child.js";
24
25
  import "./pack-child.js";
25
26
  import "./pack.js";
26
27
  import "./popover-menu.js";
28
+ import "./adjustment.js";
27
29
  import "./scale-mark.js";
28
30
  import "./scale.js";
29
31
  import "./scrolled-window.js";
32
+ import "./shortcut-controller.js";
33
+ import "./shortcut.js";
30
34
  import "./simple-list-item.js";
31
35
  import "./simple-list-view.js";
32
36
  import "./slot.js";
37
+ import "./source-buffer.js";
38
+ import "./source-view.js";
33
39
  import "./stack-page.js";
34
40
  import "./stack.js";
41
+ import "./text-buffer.js";
42
+ import "./text-view.js";
35
43
  import "./toggle.js";
36
44
  import "./toggle-group.js";
37
45
  import "./toolbar-child.js";
@@ -18,4 +18,7 @@ export const EVENT_CONTROLLER_PROPS = new Set([
18
18
  "onDropMotion",
19
19
  "dropActions",
20
20
  "dropTypes",
21
+ "onGestureDragBegin",
22
+ "onGestureDragUpdate",
23
+ "onGestureDragEnd",
21
24
  ]);
@@ -15,5 +15,6 @@ export declare class ListItemRenderer {
15
15
  setStore(store?: ListStore | null): void;
16
16
  setEstimatedItemHeight(height?: number): void;
17
17
  private getStore;
18
+ dispose(): void;
18
19
  private initialize;
19
20
  }
@@ -32,6 +32,11 @@ export class ListItemRenderer {
32
32
  }
33
33
  return this.store;
34
34
  }
35
+ dispose() {
36
+ signalStore.clear(this);
37
+ this.fiberRoots.clear();
38
+ this.tornDown.clear();
39
+ }
35
40
  initialize() {
36
41
  signalStore.set(this, this.factory, "setup", (_self, listItem) => {
37
42
  const ptr = getNativeId(listItem.handle);
@@ -27,6 +27,9 @@ type EditableWidget = Gtk.Widget & {
27
27
  setPosition: (position: number) => void;
28
28
  getText: () => string;
29
29
  };
30
+ export type AdjustableWidget = Gtk.Widget & {
31
+ setAdjustment: (adjustment: Gtk.Adjustment) => void;
32
+ };
30
33
  export declare const isAppendable: (obj: unknown) => obj is AppendableWidget;
31
34
  export declare const isAddable: (obj: unknown) => obj is AddableWidget;
32
35
  export declare const hasSingleContent: (obj: unknown) => obj is ContentWidget;
@@ -35,4 +38,5 @@ export declare const isRemovable: (obj: unknown) => obj is RemovableWidget;
35
38
  export declare const isReorderable: (obj: unknown) => obj is ReorderableWidget;
36
39
  export declare const isInsertable: (obj: unknown) => obj is InsertableWidget;
37
40
  export declare const isEditable: (obj: unknown) => obj is EditableWidget;
41
+ export declare const isAdjustable: (obj: unknown) => obj is AdjustableWidget;
38
42
  export {};
@@ -37,3 +37,6 @@ export const isEditable = (obj) => {
37
37
  "getText" in obj &&
38
38
  typeof obj.getText === "function");
39
39
  };
40
+ export const isAdjustable = (obj) => {
41
+ return obj instanceof Gtk.Widget && "setAdjustment" in obj && typeof obj.setAdjustment === "function";
42
+ };
@@ -4,6 +4,7 @@ export type SignalHandler = (...args: any[]) => any;
4
4
  declare class SignalStore {
5
5
  private ownerHandlers;
6
6
  private blockedHandlers;
7
+ private isBlocking;
7
8
  private getOwnerMap;
8
9
  private disconnect;
9
10
  private connect;