@gtkx/react 0.1.12 → 0.1.15

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/index.js CHANGED
@@ -3,12 +3,11 @@ export * from "./generated/jsx.js";
3
3
  export { createPortal } from "./portal.js";
4
4
  export { render } from "./render.js";
5
5
  import { stop } from "@gtkx/ffi";
6
- import { disposeAllInstances, reconciler } from "./reconciler.js";
6
+ import { reconciler } from "./reconciler.js";
7
7
  import { container } from "./render.js";
8
8
  export const quit = () => {
9
9
  reconciler.updateContainer(null, container, null, () => {
10
- disposeAllInstances();
11
10
  stop();
12
11
  });
13
- return false;
12
+ return true;
14
13
  };
package/dist/node.d.ts CHANGED
@@ -1,13 +1,23 @@
1
- import type * as Gtk from "@gtkx/ffi/gtk";
1
+ import * as Gtk from "@gtkx/ffi/gtk";
2
2
  import type { Props } from "./factory.js";
3
- export interface Node<W extends Gtk.Widget = Gtk.Widget> {
4
- getWidget?(): W;
3
+ export declare abstract class Node<T extends Gtk.Widget | undefined = Gtk.Widget | undefined> {
4
+ static matches(_type: string): boolean;
5
+ protected signalHandlers: Map<string, number>;
6
+ protected widget: T;
7
+ protected isVirtual(): boolean;
8
+ constructor(type: string, props: Props, currentApp?: unknown);
9
+ protected createWidget(type: string, props: Props, currentApp?: unknown): T;
10
+ getWidget(): T;
5
11
  appendChild(child: Node): void;
6
12
  removeChild(child: Node): void;
7
- insertBefore(child: Node, before: Node): void;
8
- updateProps(oldProps: Props, newProps: Props): void;
9
- mount(): void;
13
+ insertBefore(child: Node, _before: Node): void;
10
14
  attachToParent(parent: Node): void;
11
15
  detachFromParent(parent: Node): void;
12
- dispose?(): void;
16
+ protected consumedProps(): Set<string>;
17
+ updateProps(oldProps: Props, newProps: Props): void;
18
+ protected setSignalProperty(widget: Gtk.Widget, key: string, handler: unknown): void;
19
+ protected setSignalHandler(widget: Gtk.Widget, eventName: string, handler: (...args: unknown[]) => unknown): void;
20
+ protected setProperty(widget: Gtk.Widget, key: string, value: unknown): void;
21
+ mount(): void;
22
+ dispose(): void;
13
23
  }
package/dist/node.js CHANGED
@@ -1 +1,126 @@
1
- export {};
1
+ import * as GObject from "@gtkx/ffi/gobject";
2
+ import * as Gtk from "@gtkx/ffi/gtk";
3
+ import { CONSTRUCTOR_PARAMS } from "./generated/jsx.js";
4
+ import { isAppendable, isRemovable, isSingleChild } from "./predicates.js";
5
+ const extractConstructorArgs = (type, props) => {
6
+ const params = CONSTRUCTOR_PARAMS[type];
7
+ if (!params)
8
+ return [];
9
+ return params.map((p) => props[p.name]);
10
+ };
11
+ const normalizeType = (type) => (type.endsWith(".Root") ? type.slice(0, -5) : type);
12
+ export class Node {
13
+ static matches(_type) {
14
+ return false;
15
+ }
16
+ signalHandlers = new Map();
17
+ widget;
18
+ isVirtual() {
19
+ return false;
20
+ }
21
+ constructor(type, props, currentApp) {
22
+ this.widget = (this.isVirtual() ? undefined : this.createWidget(type, props, currentApp));
23
+ this.updateProps({}, props);
24
+ }
25
+ createWidget(type, props, currentApp) {
26
+ const normalizedType = normalizeType(type);
27
+ const WidgetClass = Gtk[normalizedType];
28
+ if (!WidgetClass || typeof WidgetClass !== "function") {
29
+ throw new Error(`Unknown GTK widget type: ${normalizedType}`);
30
+ }
31
+ if (normalizedType === "ApplicationWindow") {
32
+ return new WidgetClass(currentApp);
33
+ }
34
+ const args = extractConstructorArgs(normalizedType, props);
35
+ return new WidgetClass(...args);
36
+ }
37
+ getWidget() {
38
+ return this.widget;
39
+ }
40
+ appendChild(child) {
41
+ child.attachToParent(this);
42
+ }
43
+ removeChild(child) {
44
+ child.detachFromParent(this);
45
+ }
46
+ insertBefore(child, _before) {
47
+ this.appendChild(child);
48
+ }
49
+ attachToParent(parent) {
50
+ const parentWidget = parent.getWidget();
51
+ const widget = this.getWidget();
52
+ if (!parentWidget || !widget)
53
+ return;
54
+ if (isAppendable(parentWidget)) {
55
+ parentWidget.append(widget);
56
+ }
57
+ else if (isSingleChild(parentWidget)) {
58
+ parentWidget.setChild(widget);
59
+ }
60
+ }
61
+ detachFromParent(parent) {
62
+ const parentWidget = parent.getWidget();
63
+ const widget = this.getWidget();
64
+ if (!parentWidget || !widget)
65
+ return;
66
+ if (isRemovable(parentWidget)) {
67
+ parentWidget.remove(widget);
68
+ }
69
+ else if (isSingleChild(parentWidget)) {
70
+ parentWidget.setChild(null);
71
+ }
72
+ }
73
+ consumedProps() {
74
+ return new Set(["children"]);
75
+ }
76
+ updateProps(oldProps, newProps) {
77
+ const widget = this.getWidget();
78
+ if (!widget)
79
+ return;
80
+ const consumed = this.consumedProps();
81
+ const allKeys = new Set([...Object.keys(oldProps), ...Object.keys(newProps)]);
82
+ for (const key of allKeys) {
83
+ if (consumed.has(key))
84
+ continue;
85
+ const oldValue = oldProps[key];
86
+ const newValue = newProps[key];
87
+ if (oldValue === newValue)
88
+ continue;
89
+ if (key.startsWith("on")) {
90
+ this.setSignalProperty(widget, key, newValue);
91
+ continue;
92
+ }
93
+ if (newValue === undefined)
94
+ continue;
95
+ this.setProperty(widget, key, newValue);
96
+ }
97
+ }
98
+ setSignalProperty(widget, key, handler) {
99
+ const eventName = key
100
+ .slice(2)
101
+ .replace(/([A-Z])/g, "-$1")
102
+ .toLowerCase()
103
+ .replace(/^-/, "");
104
+ const oldHandlerId = this.signalHandlers.get(eventName);
105
+ if (oldHandlerId !== undefined) {
106
+ GObject.signalHandlerDisconnect(widget, oldHandlerId);
107
+ this.signalHandlers.delete(eventName);
108
+ }
109
+ if (typeof handler === "function") {
110
+ this.setSignalHandler(widget, eventName, handler);
111
+ }
112
+ }
113
+ setSignalHandler(widget, eventName, handler) {
114
+ const handlerId = widget.connect(eventName, handler);
115
+ this.signalHandlers.set(eventName, handlerId);
116
+ }
117
+ setProperty(widget, key, value) {
118
+ const setterName = `set${key.charAt(0).toUpperCase()}${key.slice(1)}`;
119
+ const setter = widget[setterName];
120
+ if (typeof setter === "function") {
121
+ setter.call(widget, value);
122
+ }
123
+ }
124
+ mount() { }
125
+ dispose() { }
126
+ }
@@ -1,41 +1,34 @@
1
1
  import * as Gtk from "@gtkx/ffi/gtk";
2
2
  import type { Props } from "../factory.js";
3
- import type { Node } from "../node.js";
4
- import { type Connectable, type ModelSettable, type Selectable } from "../widget-capabilities.js";
5
- type ItemLabelFn<T> = (item: T) => string;
6
- interface DropDownWidget extends Gtk.Widget, ModelSettable, Selectable, Connectable {
7
- }
8
- export declare class DropDownNode implements Node<DropDownWidget> {
9
- static needsWidget: boolean;
10
- static matches(type: string, widget: Gtk.Widget | null): widget is DropDownWidget;
11
- private widget;
3
+ import { Node } from "../node.js";
4
+ type ItemLabelFn = (item: unknown) => string;
5
+ declare class DropDownStore {
6
+ private stringList;
7
+ private items;
12
8
  private labelFn;
9
+ constructor(labelFn: ItemLabelFn);
10
+ getModel(): Gtk.StringList;
11
+ append(item: unknown): void;
12
+ remove(item: unknown): void;
13
+ getItem(index: number): unknown;
14
+ get length(): number;
15
+ }
16
+ export declare class DropDownNode extends Node<Gtk.DropDown> {
17
+ static matches(type: string): boolean;
18
+ private store;
13
19
  private onSelectionChanged?;
14
- private signalHandlers;
15
- constructor(_type: string, widget: Gtk.Widget, props: Props);
16
- getWidget(): DropDownWidget;
17
- getLabelFn(): ItemLabelFn<unknown>;
18
- appendChild(child: Node): void;
19
- removeChild(child: Node): void;
20
- insertBefore(child: Node, _before: Node): void;
21
- attachToParent(parent: Node): void;
22
- detachFromParent(parent: Node): void;
20
+ constructor(type: string, props: Props, currentApp?: unknown);
21
+ getStore(): DropDownStore;
22
+ protected consumedProps(): Set<string>;
23
23
  updateProps(oldProps: Props, newProps: Props): void;
24
- mount(): void;
25
- dispose(): void;
26
24
  }
27
- export declare class DropDownItemNode<T = unknown> implements Node {
28
- static needsWidget: boolean;
29
- static matches(type: string, _widget: Gtk.Widget | null): _widget is Gtk.Widget;
25
+ export declare class DropDownItemNode extends Node<never> {
26
+ static matches(type: string): boolean;
27
+ protected isVirtual(): boolean;
30
28
  private item;
31
- constructor(_type: string, _widget: Gtk.Widget, props: Props);
32
- getItem(): T;
33
- appendChild(_child: Node): void;
34
- removeChild(_child: Node): void;
35
- insertBefore(_child: Node, _before: Node): void;
29
+ constructor(type: string, props: Props, _currentApp?: unknown);
30
+ getItem(): unknown;
36
31
  attachToParent(parent: Node): void;
37
32
  detachFromParent(parent: Node): void;
38
- updateProps(_oldProps: Props, _newProps: Props): void;
39
- mount(): void;
40
33
  }
41
34
  export {};
@@ -1,6 +1,5 @@
1
1
  import * as Gtk from "@gtkx/ffi/gtk";
2
- import { appendChild, disconnectSignalHandlers, isConnectable, isModelSettable, isSelectable, removeChild, } from "../widget-capabilities.js";
3
- const isDropDownWidget = (widget) => isModelSettable(widget) && isSelectable(widget) && isConnectable(widget);
2
+ import { Node } from "../node.js";
4
3
  class DropDownStore {
5
4
  stringList;
6
5
  items = [];
@@ -10,7 +9,7 @@ class DropDownStore {
10
9
  this.labelFn = labelFn;
11
10
  }
12
11
  getModel() {
13
- return this.stringList.ptr;
12
+ return this.stringList;
14
13
  }
15
14
  append(item) {
16
15
  const label = this.labelFn(item);
@@ -31,133 +30,66 @@ class DropDownStore {
31
30
  return this.items.length;
32
31
  }
33
32
  }
34
- const dropdownStores = new WeakMap();
35
- const getOrCreateStore = (widget, labelFn) => {
36
- let store = dropdownStores.get(widget);
37
- if (!store) {
38
- store = new DropDownStore(labelFn);
39
- dropdownStores.set(widget, store);
40
- widget.setModel(store.getModel());
41
- }
42
- return store;
43
- };
44
- export class DropDownNode {
45
- static needsWidget = true;
46
- static matches(type, widget) {
47
- if (type !== "DropDown" && type !== "DropDown.Root")
48
- return false;
49
- return widget !== null && isDropDownWidget(widget);
50
- }
51
- widget;
52
- labelFn;
33
+ export class DropDownNode extends Node {
34
+ static matches(type) {
35
+ return type === "DropDown.Root";
36
+ }
37
+ store;
53
38
  onSelectionChanged;
54
- signalHandlers = new Map();
55
- constructor(_type, widget, props) {
56
- if (!isDropDownWidget(widget)) {
57
- throw new Error("DropDownNode requires a DropDown widget");
58
- }
59
- this.widget = widget;
60
- this.labelFn = props.itemLabel ?? ((item) => String(item));
39
+ constructor(type, props, currentApp) {
40
+ super(type, props, currentApp);
41
+ const labelFn = props.itemLabel ?? ((item) => String(item));
61
42
  this.onSelectionChanged = props.onSelectionChanged;
62
- getOrCreateStore(this.widget, this.labelFn);
43
+ this.store = new DropDownStore(labelFn);
44
+ this.widget.setModel(this.store.getModel());
63
45
  if (this.onSelectionChanged) {
64
46
  const handler = () => {
65
47
  const index = this.widget.getSelected();
66
- const store = dropdownStores.get(this.widget);
67
- const item = store?.getItem(index);
48
+ const item = this.store.getItem(index);
68
49
  this.onSelectionChanged?.(item, index);
69
50
  };
70
- const handlerId = this.widget.connect("notify::selected", handler);
71
- this.signalHandlers.set("notify::selected", handlerId);
51
+ this.setSignalHandler(this.widget, "notify::selected", handler);
72
52
  }
73
53
  }
74
- getWidget() {
75
- return this.widget;
76
- }
77
- getLabelFn() {
78
- return this.labelFn;
79
- }
80
- appendChild(child) {
81
- child.attachToParent(this);
82
- }
83
- removeChild(child) {
84
- child.detachFromParent(this);
85
- }
86
- insertBefore(child, _before) {
87
- this.appendChild(child);
88
- }
89
- attachToParent(parent) {
90
- const parentWidget = parent.getWidget?.();
91
- if (parentWidget) {
92
- appendChild(parentWidget, this.widget);
93
- }
54
+ getStore() {
55
+ return this.store;
94
56
  }
95
- detachFromParent(parent) {
96
- const parentWidget = parent.getWidget?.();
97
- if (parentWidget) {
98
- removeChild(parentWidget, this.widget);
99
- }
57
+ consumedProps() {
58
+ const consumed = super.consumedProps();
59
+ consumed.add("itemLabel");
60
+ consumed.add("onSelectionChanged");
61
+ return consumed;
100
62
  }
101
63
  updateProps(oldProps, newProps) {
102
64
  if (oldProps.onSelectionChanged !== newProps.onSelectionChanged) {
103
65
  this.onSelectionChanged = newProps.onSelectionChanged;
104
66
  }
105
- const consumedProps = new Set(["children", "itemLabel", "onSelectionChanged"]);
106
- const allKeys = new Set([...Object.keys(oldProps), ...Object.keys(newProps)]);
107
- for (const key of allKeys) {
108
- if (consumedProps.has(key))
109
- continue;
110
- const oldValue = oldProps[key];
111
- const newValue = newProps[key];
112
- if (oldValue === newValue)
113
- continue;
114
- if (key.startsWith("on")) {
115
- continue;
116
- }
117
- const setterName = `set${key.charAt(0).toUpperCase()}${key.slice(1)}`;
118
- const setter = this.widget[setterName];
119
- if (typeof setter === "function") {
120
- setter.call(this.widget, newValue);
121
- }
122
- }
123
- }
124
- mount() { }
125
- dispose() {
126
- disconnectSignalHandlers(this.widget, this.signalHandlers);
67
+ super.updateProps(oldProps, newProps);
127
68
  }
128
69
  }
129
- export class DropDownItemNode {
130
- static needsWidget = false;
131
- static matches(type, _widget) {
70
+ export class DropDownItemNode extends Node {
71
+ static matches(type) {
132
72
  return type === "DropDown.Item";
133
73
  }
74
+ isVirtual() {
75
+ return true;
76
+ }
134
77
  item;
135
- constructor(_type, _widget, props) {
78
+ constructor(type, props, _currentApp) {
79
+ super(type, props);
136
80
  this.item = props.item;
137
81
  }
138
82
  getItem() {
139
83
  return this.item;
140
84
  }
141
- appendChild(_child) { }
142
- removeChild(_child) { }
143
- insertBefore(_child, _before) { }
144
85
  attachToParent(parent) {
145
86
  if (!(parent instanceof DropDownNode))
146
87
  return;
147
- const widget = parent.getWidget();
148
- const labelFn = parent.getLabelFn() ?? ((item) => String(item));
149
- const store = getOrCreateStore(widget, labelFn);
150
- store.append(this.item);
88
+ parent.getStore().append(this.item);
151
89
  }
152
90
  detachFromParent(parent) {
153
91
  if (!(parent instanceof DropDownNode))
154
92
  return;
155
- const widget = parent.getWidget();
156
- const store = dropdownStores.get(widget);
157
- if (store) {
158
- store.remove(this.item);
159
- }
93
+ parent.getStore().remove(this.item);
160
94
  }
161
- updateProps(_oldProps, _newProps) { }
162
- mount() { }
163
95
  }
@@ -1,41 +1,24 @@
1
1
  import type * as Gtk from "@gtkx/ffi/gtk";
2
2
  import type { Props } from "../factory.js";
3
- import type { Node } from "../node.js";
4
- import { type GridAttachable, type Removable } from "../widget-capabilities.js";
5
- interface GridWidget extends Gtk.Widget, GridAttachable, Removable {
3
+ import { Node } from "../node.js";
4
+ export declare class GridNode extends Node<Gtk.Grid> {
5
+ static matches(type: string): boolean;
6
6
  }
7
- export declare class GridNode implements Node<GridWidget> {
8
- static needsWidget: boolean;
9
- static matches(type: string, widget: Gtk.Widget | null): widget is GridWidget;
10
- private widget;
11
- constructor(_type: string, widget: Gtk.Widget, _props: Props);
12
- getWidget(): GridWidget;
13
- appendChild(child: Node): void;
14
- removeChild(child: Node): void;
15
- insertBefore(child: Node, _before: Node): void;
16
- attachToParent(parent: Node): void;
17
- detachFromParent(parent: Node): void;
18
- updateProps(oldProps: Props, newProps: Props): void;
19
- mount(): void;
20
- }
21
- export declare class GridChildNode implements Node {
22
- static needsWidget: boolean;
23
- static matches(type: string, _widget: Gtk.Widget | null): _widget is Gtk.Widget;
7
+ export declare class GridChildNode extends Node<never> {
8
+ static matches(type: string): boolean;
9
+ protected isVirtual(): boolean;
24
10
  private column;
25
11
  private row;
26
12
  private columnSpan;
27
13
  private rowSpan;
28
14
  private childWidget;
29
15
  private parentGrid;
30
- constructor(_type: string, _widget: Gtk.Widget, props: Props);
16
+ constructor(type: string, props: Props, _currentApp?: unknown);
31
17
  appendChild(child: Node): void;
32
18
  removeChild(child: Node): void;
33
- insertBefore(child: Node, _before: Node): void;
34
19
  private attachChildToGrid;
35
20
  private detachChildFromGrid;
36
21
  attachToParent(parent: Node): void;
37
22
  detachFromParent(parent: Node): void;
38
23
  updateProps(oldProps: Props, newProps: Props): void;
39
- mount(): void;
40
24
  }
41
- export {};
@@ -1,84 +1,31 @@
1
- import { appendChild, isGridAttachable, isRemovable, removeChild, } from "../widget-capabilities.js";
2
- const isGridWidget = (widget) => isGridAttachable(widget) && isRemovable(widget);
3
- export class GridNode {
4
- static needsWidget = true;
5
- static matches(type, widget) {
6
- if (type !== "Grid" && type !== "Grid.Root")
7
- return false;
8
- return widget !== null && isGridWidget(widget);
1
+ import { Node } from "../node.js";
2
+ export class GridNode extends Node {
3
+ static matches(type) {
4
+ return type === "Grid.Root";
9
5
  }
10
- widget;
11
- constructor(_type, widget, _props) {
12
- if (!isGridWidget(widget)) {
13
- throw new Error("GridNode requires a Grid widget");
14
- }
15
- this.widget = widget;
16
- }
17
- getWidget() {
18
- return this.widget;
19
- }
20
- appendChild(child) {
21
- child.attachToParent(this);
22
- }
23
- removeChild(child) {
24
- child.detachFromParent(this);
25
- }
26
- insertBefore(child, _before) {
27
- this.appendChild(child);
28
- }
29
- attachToParent(parent) {
30
- const parentWidget = parent.getWidget?.();
31
- if (parentWidget) {
32
- appendChild(parentWidget, this.widget);
33
- }
34
- }
35
- detachFromParent(parent) {
36
- const parentWidget = parent.getWidget?.();
37
- if (parentWidget) {
38
- removeChild(parentWidget, this.widget);
39
- }
40
- }
41
- updateProps(oldProps, newProps) {
42
- const consumedProps = new Set(["children"]);
43
- const allKeys = new Set([...Object.keys(oldProps), ...Object.keys(newProps)]);
44
- for (const key of allKeys) {
45
- if (consumedProps.has(key))
46
- continue;
47
- const oldValue = oldProps[key];
48
- const newValue = newProps[key];
49
- if (oldValue === newValue)
50
- continue;
51
- if (key.startsWith("on")) {
52
- continue;
53
- }
54
- const setterName = `set${key.charAt(0).toUpperCase()}${key.slice(1)}`;
55
- const setter = this.widget[setterName];
56
- if (typeof setter === "function") {
57
- setter.call(this.widget, newValue);
58
- }
59
- }
60
- }
61
- mount() { }
62
6
  }
63
- export class GridChildNode {
64
- static needsWidget = false;
65
- static matches(type, _widget) {
7
+ export class GridChildNode extends Node {
8
+ static matches(type) {
66
9
  return type === "Grid.Child";
67
10
  }
11
+ isVirtual() {
12
+ return true;
13
+ }
68
14
  column;
69
15
  row;
70
16
  columnSpan;
71
17
  rowSpan;
72
18
  childWidget = null;
73
19
  parentGrid = null;
74
- constructor(_type, _widget, props) {
20
+ constructor(type, props, _currentApp) {
21
+ super(type, props);
75
22
  this.column = props.column ?? 0;
76
23
  this.row = props.row ?? 0;
77
24
  this.columnSpan = props.columnSpan ?? 1;
78
25
  this.rowSpan = props.rowSpan ?? 1;
79
26
  }
80
27
  appendChild(child) {
81
- const widget = child.getWidget?.();
28
+ const widget = child.getWidget();
82
29
  if (widget) {
83
30
  this.childWidget = widget;
84
31
  if (this.parentGrid) {
@@ -87,26 +34,27 @@ export class GridChildNode {
87
34
  }
88
35
  }
89
36
  removeChild(child) {
90
- const widget = child.getWidget?.();
37
+ const widget = child.getWidget();
91
38
  if (widget && this.childWidget === widget) {
92
39
  this.detachChildFromGrid();
93
40
  this.childWidget = null;
94
41
  }
95
42
  }
96
- insertBefore(child, _before) {
97
- this.appendChild(child);
98
- }
99
43
  attachChildToGrid() {
100
44
  if (!this.parentGrid || !this.childWidget)
101
45
  return;
102
46
  const grid = this.parentGrid.getWidget();
103
- grid.attach(this.childWidget.ptr, this.column, this.row, this.columnSpan, this.rowSpan);
47
+ if (!grid)
48
+ return;
49
+ grid.attach(this.childWidget, this.column, this.row, this.columnSpan, this.rowSpan);
104
50
  }
105
51
  detachChildFromGrid() {
106
52
  if (!this.parentGrid || !this.childWidget)
107
53
  return;
108
54
  const grid = this.parentGrid.getWidget();
109
- grid.remove(this.childWidget.ptr);
55
+ if (!grid)
56
+ return;
57
+ grid.remove(this.childWidget);
110
58
  }
111
59
  attachToParent(parent) {
112
60
  if (parent instanceof GridNode) {
@@ -136,5 +84,4 @@ export class GridChildNode {
136
84
  this.attachChildToGrid();
137
85
  }
138
86
  }
139
- mount() { }
140
87
  }
@@ -1,46 +1,27 @@
1
1
  import * as Gtk from "@gtkx/ffi/gtk";
2
2
  import type { Props } from "../factory.js";
3
- import type { Node } from "../node.js";
4
- interface ListViewWidget extends Gtk.Widget {
5
- setModel(model: unknown): void;
6
- setFactory(factory: unknown): void;
7
- }
8
- export declare class ListViewNode<T = unknown> implements Node<ListViewWidget> {
9
- static needsWidget: boolean;
10
- static matches(type: string, widget: Gtk.Widget | null): widget is ListViewWidget;
11
- private widget;
3
+ import { Node } from "../node.js";
4
+ export declare class ListViewNode extends Node<Gtk.ListView> {
5
+ static matches(type: string): boolean;
12
6
  private stringList;
13
7
  private selectionModel;
14
8
  private factory;
15
9
  private items;
16
10
  private renderItem;
17
- private signalHandlers;
18
11
  private factorySignalHandlers;
19
- constructor(_type: string, widget: Gtk.Widget, props: Props);
20
- getWidget(): ListViewWidget;
21
- appendChild(child: Node): void;
22
- removeChild(child: Node): void;
23
- insertBefore(child: Node, _before: Node): void;
24
- attachToParent(parent: Node): void;
25
- detachFromParent(parent: Node): void;
26
- addItem(item: T): void;
27
- removeItem(item: T): void;
12
+ constructor(type: string, props: Props, currentApp?: unknown);
13
+ addItem(item: unknown): void;
14
+ removeItem(item: unknown): void;
15
+ protected consumedProps(): Set<string>;
28
16
  updateProps(oldProps: Props, newProps: Props): void;
29
- mount(): void;
30
17
  dispose(): void;
31
18
  }
32
- export declare class ListItemNode<T = unknown> implements Node {
33
- static needsWidget: boolean;
34
- static matches(type: string, _widget: Gtk.Widget | null): _widget is Gtk.Widget;
19
+ export declare class ListItemNode extends Node {
20
+ static matches(type: string): boolean;
21
+ protected isVirtual(): boolean;
35
22
  private item;
36
- constructor(_type: string, _widget: Gtk.Widget, props: Props);
37
- getItem(): T;
38
- appendChild(_child: Node): void;
39
- removeChild(_child: Node): void;
40
- insertBefore(_child: Node, _before: Node): void;
23
+ constructor(type: string, props: Props, _currentApp?: unknown);
24
+ getItem(): unknown;
41
25
  attachToParent(parent: Node): void;
42
26
  detachFromParent(parent: Node): void;
43
- updateProps(_oldProps: Props, _newProps: Props): void;
44
- mount(): void;
45
27
  }
46
- export {};