@gtkx/react 0.18.9 → 0.20.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/components/list.d.ts +35 -0
- package/dist/components/list.d.ts.map +1 -0
- package/dist/components/list.js +40 -0
- package/dist/components/list.js.map +1 -0
- package/dist/generated/internal.d.ts +8 -3
- package/dist/generated/internal.d.ts.map +1 -1
- package/dist/generated/internal.js +3553 -53
- package/dist/generated/internal.js.map +1 -1
- package/dist/generated/jsx.d.ts +178 -326
- package/dist/generated/jsx.d.ts.map +1 -1
- package/dist/generated/jsx.js +0 -324
- package/dist/generated/jsx.js.map +1 -1
- package/dist/host-config.d.ts.map +1 -1
- package/dist/host-config.js +48 -10
- package/dist/host-config.js.map +1 -1
- package/dist/jsx.d.ts +111 -54
- package/dist/jsx.d.ts.map +1 -1
- package/dist/jsx.js +3 -28
- package/dist/jsx.js.map +1 -1
- package/dist/metadata.d.ts +1 -0
- package/dist/metadata.d.ts.map +1 -1
- package/dist/metadata.js +7 -1
- package/dist/metadata.js.map +1 -1
- package/dist/node.d.ts +0 -2
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +19 -25
- package/dist/node.js.map +1 -1
- package/dist/nodes/application.d.ts.map +1 -1
- package/dist/nodes/application.js +4 -0
- package/dist/nodes/application.js.map +1 -1
- package/dist/nodes/column-view-column.d.ts +19 -16
- package/dist/nodes/column-view-column.d.ts.map +1 -1
- package/dist/nodes/column-view-column.js +129 -97
- package/dist/nodes/column-view-column.js.map +1 -1
- package/dist/nodes/event-controller.d.ts +1 -0
- package/dist/nodes/event-controller.d.ts.map +1 -1
- package/dist/nodes/event-controller.js +9 -7
- package/dist/nodes/event-controller.js.map +1 -1
- package/dist/nodes/fixed-child.d.ts +1 -2
- package/dist/nodes/fixed-child.d.ts.map +1 -1
- package/dist/nodes/fixed-child.js +21 -21
- package/dist/nodes/fixed-child.js.map +1 -1
- package/dist/nodes/font-dialog-button.d.ts +1 -1
- package/dist/nodes/font-dialog-button.d.ts.map +1 -1
- package/dist/nodes/font-dialog-button.js +8 -0
- package/dist/nodes/font-dialog-button.js.map +1 -1
- package/dist/nodes/internal/accessible.d.ts +5 -0
- package/dist/nodes/internal/accessible.d.ts.map +1 -0
- package/dist/nodes/internal/accessible.js +119 -0
- package/dist/nodes/internal/accessible.js.map +1 -0
- package/dist/nodes/internal/bound-item.d.ts +4 -0
- package/dist/nodes/internal/bound-item.d.ts.map +1 -0
- package/dist/nodes/internal/bound-item.js +2 -0
- package/dist/nodes/internal/bound-item.js.map +1 -0
- package/dist/nodes/internal/construct.d.ts +3 -0
- package/dist/nodes/internal/construct.d.ts.map +1 -0
- package/dist/nodes/internal/construct.js +44 -0
- package/dist/nodes/internal/construct.js.map +1 -0
- package/dist/nodes/internal/text-buffer-controller.d.ts +4 -0
- package/dist/nodes/internal/text-buffer-controller.d.ts.map +1 -1
- package/dist/nodes/internal/text-buffer-controller.js +49 -9
- package/dist/nodes/internal/text-buffer-controller.js.map +1 -1
- package/dist/nodes/internal/widget.d.ts.map +1 -1
- package/dist/nodes/internal/widget.js +4 -1
- package/dist/nodes/internal/widget.js.map +1 -1
- package/dist/nodes/list-item-node.d.ts +12 -0
- package/dist/nodes/list-item-node.d.ts.map +1 -0
- package/dist/nodes/list-item-node.js +23 -0
- package/dist/nodes/list-item-node.js.map +1 -0
- package/dist/nodes/list.d.ts +100 -0
- package/dist/nodes/list.d.ts.map +1 -0
- package/dist/nodes/list.js +950 -0
- package/dist/nodes/list.js.map +1 -0
- package/dist/nodes/notebook-page.d.ts.map +1 -1
- package/dist/nodes/notebook-page.js +4 -0
- package/dist/nodes/notebook-page.js.map +1 -1
- package/dist/nodes/shortcut.d.ts +3 -2
- package/dist/nodes/shortcut.d.ts.map +1 -1
- package/dist/nodes/shortcut.js +19 -4
- package/dist/nodes/shortcut.js.map +1 -1
- package/dist/nodes/text-anchor.d.ts.map +1 -1
- package/dist/nodes/text-anchor.js +7 -1
- package/dist/nodes/text-anchor.js.map +1 -1
- package/dist/nodes/text-tag.d.ts.map +1 -1
- package/dist/nodes/text-tag.js +5 -1
- package/dist/nodes/text-tag.js.map +1 -1
- package/dist/nodes/text-view.d.ts +1 -0
- package/dist/nodes/text-view.d.ts.map +1 -1
- package/dist/nodes/text-view.js +4 -0
- package/dist/nodes/text-view.js.map +1 -1
- package/dist/nodes/widget.d.ts +0 -2
- package/dist/nodes/widget.d.ts.map +1 -1
- package/dist/nodes/widget.js +51 -67
- package/dist/nodes/widget.js.map +1 -1
- package/dist/nodes/window.d.ts.map +1 -1
- package/dist/nodes/window.js +2 -2
- package/dist/nodes/window.js.map +1 -1
- package/dist/registry.d.ts +0 -2
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +4 -13
- package/dist/registry.js.map +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -4
- package/src/components/list.tsx +83 -0
- package/src/generated/internal.ts +3559 -49
- package/src/generated/jsx.ts +178 -326
- package/src/host-config.ts +43 -10
- package/src/jsx.ts +121 -62
- package/src/metadata.ts +8 -1
- package/src/node.ts +23 -25
- package/src/nodes/application.ts +5 -0
- package/src/nodes/column-view-column.ts +125 -104
- package/src/nodes/event-controller.ts +8 -8
- package/src/nodes/fixed-child.ts +24 -23
- package/src/nodes/font-dialog-button.ts +10 -0
- package/src/nodes/internal/accessible.ts +155 -0
- package/src/nodes/internal/bound-item.ts +4 -0
- package/src/nodes/internal/construct.ts +60 -0
- package/src/nodes/internal/text-buffer-controller.ts +51 -8
- package/src/nodes/internal/widget.ts +3 -1
- package/src/nodes/list-item-node.ts +29 -0
- package/src/nodes/list.ts +1082 -0
- package/src/nodes/notebook-page.ts +4 -0
- package/src/nodes/shortcut.ts +22 -5
- package/src/nodes/text-anchor.ts +6 -1
- package/src/nodes/text-tag.ts +7 -1
- package/src/nodes/text-view.ts +5 -0
- package/src/nodes/widget.ts +47 -69
- package/src/nodes/window.ts +2 -2
- package/src/registry.ts +11 -17
- package/src/types.ts +7 -2
- package/dist/fiber-root.d.ts +0 -4
- package/dist/fiber-root.d.ts.map +0 -1
- package/dist/fiber-root.js +0 -6
- package/dist/fiber-root.js.map +0 -1
- package/dist/nodes/column-view.d.ts +0 -36
- package/dist/nodes/column-view.d.ts.map +0 -1
- package/dist/nodes/column-view.js +0 -175
- package/dist/nodes/column-view.js.map +0 -1
- package/dist/nodes/drop-down.d.ts +0 -27
- package/dist/nodes/drop-down.d.ts.map +0 -1
- package/dist/nodes/drop-down.js +0 -85
- package/dist/nodes/drop-down.js.map +0 -1
- package/dist/nodes/grid-view.d.ts +0 -29
- package/dist/nodes/grid-view.d.ts.map +0 -1
- package/dist/nodes/grid-view.js +0 -85
- package/dist/nodes/grid-view.js.map +0 -1
- package/dist/nodes/internal/base-item-renderer.d.ts +0 -28
- package/dist/nodes/internal/base-item-renderer.d.ts.map +0 -1
- package/dist/nodes/internal/base-item-renderer.js +0 -86
- package/dist/nodes/internal/base-item-renderer.js.map +0 -1
- package/dist/nodes/internal/grid-item-renderer.d.ts +0 -20
- package/dist/nodes/internal/grid-item-renderer.d.ts.map +0 -1
- package/dist/nodes/internal/grid-item-renderer.js +0 -66
- package/dist/nodes/internal/grid-item-renderer.js.map +0 -1
- package/dist/nodes/internal/list-item-renderer.d.ts +0 -27
- package/dist/nodes/internal/list-item-renderer.d.ts.map +0 -1
- package/dist/nodes/internal/list-item-renderer.js +0 -131
- package/dist/nodes/internal/list-item-renderer.js.map +0 -1
- package/dist/nodes/internal/list-store.d.ts +0 -22
- package/dist/nodes/internal/list-store.d.ts.map +0 -1
- package/dist/nodes/internal/list-store.js +0 -91
- package/dist/nodes/internal/list-store.js.map +0 -1
- package/dist/nodes/internal/selection-model-controller.d.ts +0 -26
- package/dist/nodes/internal/selection-model-controller.d.ts.map +0 -1
- package/dist/nodes/internal/selection-model-controller.js +0 -79
- package/dist/nodes/internal/selection-model-controller.js.map +0 -1
- package/dist/nodes/internal/simple-list-store.d.ts +0 -20
- package/dist/nodes/internal/simple-list-store.d.ts.map +0 -1
- package/dist/nodes/internal/simple-list-store.js +0 -87
- package/dist/nodes/internal/simple-list-store.js.map +0 -1
- package/dist/nodes/internal/tree-store.d.ts +0 -34
- package/dist/nodes/internal/tree-store.d.ts.map +0 -1
- package/dist/nodes/internal/tree-store.js +0 -208
- package/dist/nodes/internal/tree-store.js.map +0 -1
- package/dist/nodes/list-item.d.ts +0 -24
- package/dist/nodes/list-item.d.ts.map +0 -1
- package/dist/nodes/list-item.js +0 -83
- package/dist/nodes/list-item.js.map +0 -1
- package/dist/nodes/list-view.d.ts +0 -29
- package/dist/nodes/list-view.d.ts.map +0 -1
- package/dist/nodes/list-view.js +0 -83
- package/dist/nodes/list-view.js.map +0 -1
- package/dist/nodes/models/grid.d.ts +0 -28
- package/dist/nodes/models/grid.d.ts.map +0 -1
- package/dist/nodes/models/grid.js +0 -69
- package/dist/nodes/models/grid.js.map +0 -1
- package/dist/nodes/models/list.d.ts +0 -31
- package/dist/nodes/models/list.d.ts.map +0 -1
- package/dist/nodes/models/list.js +0 -93
- package/dist/nodes/models/list.js.map +0 -1
- package/dist/nodes/shortcut-controller.d.ts +0 -10
- package/dist/nodes/shortcut-controller.d.ts.map +0 -1
- package/dist/nodes/shortcut-controller.js +0 -23
- package/dist/nodes/shortcut-controller.js.map +0 -1
- package/src/fiber-root.ts +0 -20
- package/src/nodes/column-view.ts +0 -217
- package/src/nodes/drop-down.ts +0 -108
- package/src/nodes/grid-view.ts +0 -109
- package/src/nodes/internal/base-item-renderer.ts +0 -108
- package/src/nodes/internal/grid-item-renderer.ts +0 -78
- package/src/nodes/internal/list-item-renderer.ts +0 -162
- package/src/nodes/internal/list-store.ts +0 -105
- package/src/nodes/internal/selection-model-controller.ts +0 -115
- package/src/nodes/internal/simple-list-store.ts +0 -99
- package/src/nodes/internal/tree-store.ts +0 -237
- package/src/nodes/list-item.ts +0 -107
- package/src/nodes/list-view.ts +0 -113
- package/src/nodes/models/grid.ts +0 -105
- package/src/nodes/models/list.ts +0 -140
- package/src/nodes/shortcut-controller.ts +0 -27
|
@@ -81,6 +81,10 @@ export class NotebookPageNode extends VirtualNode<NotebookPageProps, WidgetNode<
|
|
|
81
81
|
public override detachDeletedInstance(): void {
|
|
82
82
|
const childWidget = this.findContentChild()?.container ?? null;
|
|
83
83
|
if (childWidget && this.parent) {
|
|
84
|
+
const notebook = this.getParentWidget();
|
|
85
|
+
if (notebook.getNPages() <= 1) {
|
|
86
|
+
notebook.setShowTabs(false);
|
|
87
|
+
}
|
|
84
88
|
this.detachPage(childWidget);
|
|
85
89
|
}
|
|
86
90
|
super.detachDeletedInstance();
|
package/src/nodes/shortcut.ts
CHANGED
|
@@ -13,25 +13,42 @@ export class ShortcutNode extends VirtualNode<ShortcutProps, EventControllerNode
|
|
|
13
13
|
public override isValidParent(parent: Node): boolean {
|
|
14
14
|
return parent instanceof EventControllerNode && parent.container instanceof Gtk.ShortcutController;
|
|
15
15
|
}
|
|
16
|
+
|
|
16
17
|
private shortcut: Gtk.Shortcut | null = null;
|
|
17
18
|
private action: Gtk.CallbackAction | null = null;
|
|
18
19
|
|
|
20
|
+
public override setParent(parent: EventControllerNode<Gtk.ShortcutController> | null): void {
|
|
21
|
+
if (!parent && this.parent) {
|
|
22
|
+
this.removeFromController();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
super.setParent(parent);
|
|
26
|
+
|
|
27
|
+
if (parent && !this.shortcut) {
|
|
28
|
+
this.createShortcut();
|
|
29
|
+
const shortcut = this.shortcut;
|
|
30
|
+
if (shortcut) parent.container.addShortcut(shortcut);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
19
34
|
public override commitUpdate(oldProps: ShortcutProps | null, newProps: ShortcutProps): void {
|
|
20
35
|
super.commitUpdate(oldProps, newProps);
|
|
21
36
|
this.applyOwnProps(oldProps, newProps);
|
|
22
37
|
}
|
|
23
38
|
|
|
24
39
|
public override detachDeletedInstance(): void {
|
|
25
|
-
this.
|
|
26
|
-
this.action = null;
|
|
40
|
+
this.removeFromController();
|
|
27
41
|
super.detachDeletedInstance();
|
|
28
42
|
}
|
|
29
43
|
|
|
30
|
-
|
|
31
|
-
|
|
44
|
+
private removeFromController(): void {
|
|
45
|
+
if (!this.parent || !this.shortcut) return;
|
|
46
|
+
this.parent.container.removeShortcut(this.shortcut);
|
|
47
|
+
this.shortcut = null;
|
|
48
|
+
this.action = null;
|
|
32
49
|
}
|
|
33
50
|
|
|
34
|
-
|
|
51
|
+
private createShortcut(): void {
|
|
35
52
|
const trigger = this.createTrigger();
|
|
36
53
|
this.action = new Gtk.CallbackAction(() => {
|
|
37
54
|
const result = this.props.onActivate();
|
package/src/nodes/text-anchor.ts
CHANGED
|
@@ -49,7 +49,12 @@ export class TextAnchorNode extends VirtualNode<TextAnchorProps, Node & TextCont
|
|
|
49
49
|
const iter = new Gtk.TextIter();
|
|
50
50
|
this.buffer.getIterAtOffset(iter, this.bufferOffset);
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
if (this.props.replacementChar) {
|
|
53
|
+
this.anchor = Gtk.TextChildAnchor.newWithReplacement(this.props.replacementChar);
|
|
54
|
+
this.buffer.insertChildAnchor(iter, this.anchor);
|
|
55
|
+
} else {
|
|
56
|
+
this.anchor = this.buffer.createChildAnchor(iter);
|
|
57
|
+
}
|
|
53
58
|
|
|
54
59
|
const widgetChild = this.children[0];
|
|
55
60
|
if (widgetChild?.container && this.anchor) {
|
package/src/nodes/text-tag.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { Node } from "../node.js";
|
|
|
4
4
|
import { hasChanged } from "./internal/props.js";
|
|
5
5
|
import { TextAnchorNode } from "./text-anchor.js";
|
|
6
6
|
import type { TextContentChild, TextContentParent } from "./text-content.js";
|
|
7
|
+
import { TextPaintableNode } from "./text-paintable.js";
|
|
7
8
|
import { isTextContentParent, TextSegmentNode } from "./text-segment.js";
|
|
8
9
|
import { VirtualNode } from "./virtual.js";
|
|
9
10
|
|
|
@@ -282,6 +283,11 @@ export class TextTagNode
|
|
|
282
283
|
}
|
|
283
284
|
|
|
284
285
|
private isTextContentChild(child: Node): child is TextContentChild {
|
|
285
|
-
return
|
|
286
|
+
return (
|
|
287
|
+
child instanceof TextSegmentNode ||
|
|
288
|
+
child instanceof TextTagNode ||
|
|
289
|
+
child instanceof TextAnchorNode ||
|
|
290
|
+
child instanceof TextPaintableNode
|
|
291
|
+
);
|
|
286
292
|
}
|
|
287
293
|
}
|
package/src/nodes/text-view.ts
CHANGED
|
@@ -52,6 +52,11 @@ export class TextViewNode extends WidgetNode<Gtk.TextView, TextViewProps, TextVi
|
|
|
52
52
|
return new TextBufferController(this, this.container, () => new Gtk.TextBuffer());
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
public override finalizeInitialChildren(props: TextViewProps): boolean {
|
|
56
|
+
this.bufferController?.finalizeInitialMount();
|
|
57
|
+
return super.finalizeInitialChildren(props);
|
|
58
|
+
}
|
|
59
|
+
|
|
55
60
|
public override commitUpdate(oldProps: TextViewProps | null, newProps: TextViewProps): void {
|
|
56
61
|
super.commitUpdate(oldProps ? filterProps(oldProps, OWN_PROPS) : null, filterProps(newProps, OWN_PROPS));
|
|
57
62
|
this.ensureBufferController().applyOwnProps(oldProps, newProps);
|
package/src/nodes/widget.ts
CHANGED
|
@@ -11,10 +11,11 @@ import {
|
|
|
11
11
|
typeNameFromInstance,
|
|
12
12
|
} from "@gtkx/ffi/gobject";
|
|
13
13
|
import * as Gtk from "@gtkx/ffi/gtk";
|
|
14
|
-
import {
|
|
15
|
-
import { resolvePropMeta, resolveSignal } from "../metadata.js";
|
|
14
|
+
import { isConstructOnlyProp, resolvePropMeta, resolveSignal } from "../metadata.js";
|
|
16
15
|
import { Node } from "../node.js";
|
|
17
16
|
import type { Container, Props } from "../types.js";
|
|
17
|
+
import { applyAccessibleProps, isAccessibleProp } from "./internal/accessible.js";
|
|
18
|
+
import { createContainerWithProperties } from "./internal/construct.js";
|
|
18
19
|
import {
|
|
19
20
|
type InsertableWidget,
|
|
20
21
|
isAddable,
|
|
@@ -30,7 +31,7 @@ import { filterProps } from "./internal/props.js";
|
|
|
30
31
|
import type { SignalHandler } from "./internal/signal-store.js";
|
|
31
32
|
import { attachChild, detachChild } from "./internal/widget.js";
|
|
32
33
|
|
|
33
|
-
const EXCLUDED_PROPS = ["children"
|
|
34
|
+
const EXCLUDED_PROPS = ["children"];
|
|
34
35
|
|
|
35
36
|
function findProperty(obj: NativeObject, key: string): GObject.ParamSpec | null {
|
|
36
37
|
const propertyName = key.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
@@ -54,11 +55,7 @@ export class WidgetNode<
|
|
|
54
55
|
containerClass: typeof Gtk.Widget,
|
|
55
56
|
_rootContainer?: Container,
|
|
56
57
|
): Container | null {
|
|
57
|
-
|
|
58
|
-
const typeName = WidgetClass.glibTypeName;
|
|
59
|
-
const args = (CONSTRUCTOR_PROPS[typeName] ?? []).map((name) => props[name]);
|
|
60
|
-
|
|
61
|
-
return new WidgetClass(...(args as ConstructorParameters<typeof Gtk.Widget>));
|
|
58
|
+
return createContainerWithProperties(containerClass, props);
|
|
62
59
|
}
|
|
63
60
|
|
|
64
61
|
public override isValidChild(_child: Node): boolean {
|
|
@@ -123,57 +120,54 @@ export class WidgetNode<
|
|
|
123
120
|
throw new Error(`Container is undefined for '${this.typeName}'`);
|
|
124
121
|
}
|
|
125
122
|
|
|
126
|
-
this.
|
|
127
|
-
try {
|
|
128
|
-
this.updateSizeRequest(oldProps, newProps);
|
|
129
|
-
this.updateGrabFocus(oldProps, newProps);
|
|
123
|
+
applyAccessibleProps(this.container, oldProps, newProps);
|
|
130
124
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
125
|
+
const propNames = new Set([
|
|
126
|
+
...Object.keys(filterProps(oldProps ?? {}, EXCLUDED_PROPS)),
|
|
127
|
+
...Object.keys(filterProps(newProps ?? {}, EXCLUDED_PROPS)),
|
|
128
|
+
]);
|
|
135
129
|
|
|
136
|
-
|
|
137
|
-
|
|
130
|
+
const pendingSignals: Array<{ name: string; newValue: unknown }> = [];
|
|
131
|
+
const pendingProperties: Array<{ name: string; oldValue: unknown; newValue: unknown }> = [];
|
|
138
132
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
133
|
+
for (const name of propNames) {
|
|
134
|
+
if (isAccessibleProp(name)) continue;
|
|
135
|
+
if (isConstructOnlyProp(this.container, name)) continue;
|
|
142
136
|
|
|
143
|
-
|
|
137
|
+
const oldValue = oldProps?.[name];
|
|
138
|
+
const newValue = newProps[name];
|
|
144
139
|
|
|
145
|
-
|
|
140
|
+
if (oldValue === newValue) continue;
|
|
146
141
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
142
|
+
const signalName = resolveSignal(this.container, name);
|
|
143
|
+
|
|
144
|
+
if (signalName) {
|
|
145
|
+
pendingSignals.push({ name, newValue });
|
|
146
|
+
} else if (newValue !== undefined) {
|
|
147
|
+
pendingProperties.push({ name, oldValue, newValue });
|
|
148
|
+
} else if (oldValue !== undefined) {
|
|
149
|
+
const defaultValue = this.getPropertyDefaultValue(name);
|
|
150
|
+
if (defaultValue !== undefined) {
|
|
151
|
+
pendingProperties.push({ name, oldValue, newValue: defaultValue });
|
|
156
152
|
}
|
|
157
153
|
}
|
|
154
|
+
}
|
|
158
155
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
156
|
+
for (const { name, newValue } of pendingSignals) {
|
|
157
|
+
const signalName = resolveSignal(this.container, name);
|
|
158
|
+
if (!signalName) continue;
|
|
159
|
+
const handler = typeof newValue === "function" ? (newValue as SignalHandler) : undefined;
|
|
160
|
+
this.signalStore.set(this, this.container, signalName, handler);
|
|
161
|
+
}
|
|
165
162
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
163
|
+
for (const { name, oldValue, newValue } of pendingProperties) {
|
|
164
|
+
if (name === "text" && oldValue !== undefined && isEditable(this.container)) {
|
|
165
|
+
if (oldValue !== this.container.getText()) {
|
|
166
|
+
continue;
|
|
171
167
|
}
|
|
172
|
-
|
|
173
|
-
this.setProperty(name, newValue);
|
|
174
168
|
}
|
|
175
|
-
|
|
176
|
-
this.
|
|
169
|
+
|
|
170
|
+
this.setProperty(name, newValue);
|
|
177
171
|
}
|
|
178
172
|
}
|
|
179
173
|
|
|
@@ -276,26 +270,6 @@ export class WidgetNode<
|
|
|
276
270
|
}
|
|
277
271
|
}
|
|
278
272
|
|
|
279
|
-
private updateSizeRequest(oldProps: P | null, newProps: P): void {
|
|
280
|
-
const oldWidth = oldProps?.widthRequest as number | undefined;
|
|
281
|
-
const oldHeight = oldProps?.heightRequest as number | undefined;
|
|
282
|
-
const newWidth = newProps.widthRequest as number | undefined;
|
|
283
|
-
const newHeight = newProps.heightRequest as number | undefined;
|
|
284
|
-
|
|
285
|
-
if (oldWidth !== newWidth || oldHeight !== newHeight) {
|
|
286
|
-
this.container.setSizeRequest(newWidth ?? -1, newHeight ?? -1);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
private updateGrabFocus(oldProps: P | null, newProps: P): void {
|
|
291
|
-
const oldGrabFocus = oldProps?.grabFocus as boolean | undefined;
|
|
292
|
-
const newGrabFocus = newProps.grabFocus as boolean | undefined;
|
|
293
|
-
|
|
294
|
-
if (!oldGrabFocus && newGrabFocus) {
|
|
295
|
-
this.container.grabFocus();
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
|
|
299
273
|
private getPropertyDefaultValue(key: string): unknown {
|
|
300
274
|
if (!resolvePropMeta(this.container, key)) return undefined;
|
|
301
275
|
|
|
@@ -392,7 +366,11 @@ export class WidgetNode<
|
|
|
392
366
|
|
|
393
367
|
function detachChildFromParent(child: WidgetNode): void {
|
|
394
368
|
const currentParent = child.container.getParent();
|
|
395
|
-
if (currentParent !== null
|
|
396
|
-
currentParent
|
|
369
|
+
if (currentParent !== null) {
|
|
370
|
+
if (isRemovable(currentParent)) {
|
|
371
|
+
currentParent.remove(child.container);
|
|
372
|
+
} else {
|
|
373
|
+
child.container.unparent();
|
|
374
|
+
}
|
|
397
375
|
}
|
|
398
376
|
}
|
package/src/nodes/window.ts
CHANGED
|
@@ -107,6 +107,7 @@ export class WindowNode extends WidgetNode<Gtk.Window, WindowProps, WindowChild>
|
|
|
107
107
|
|
|
108
108
|
public override removeChild(child: WindowChild): void {
|
|
109
109
|
if (child instanceof WindowNode) {
|
|
110
|
+
child.container.setVisible(false);
|
|
110
111
|
child.container.setTransientFor(null);
|
|
111
112
|
super.removeChild(child);
|
|
112
113
|
return;
|
|
@@ -152,9 +153,8 @@ export class WindowNode extends WidgetNode<Gtk.Window, WindowProps, WindowChild>
|
|
|
152
153
|
}
|
|
153
154
|
|
|
154
155
|
public override detachDeletedInstance(): void {
|
|
155
|
-
this.container.setVisible(false);
|
|
156
|
-
this.container.destroy();
|
|
157
156
|
super.detachDeletedInstance();
|
|
157
|
+
this.container.destroy();
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
private applyOwnProps(oldProps: WindowProps | null, newProps: WindowProps): void {
|
package/src/registry.ts
CHANGED
|
@@ -10,20 +10,17 @@ import { AnimationNode } from "./nodes/animation.js";
|
|
|
10
10
|
import { ApplicationNode } from "./nodes/application.js";
|
|
11
11
|
import { CalendarNode } from "./nodes/calendar.js";
|
|
12
12
|
import { ColorDialogButtonNode } from "./nodes/color-dialog-button.js";
|
|
13
|
-
import { ColumnViewNode } from "./nodes/column-view.js";
|
|
14
13
|
import { ColumnViewColumnNode } from "./nodes/column-view-column.js";
|
|
15
14
|
import { ContainerSlotNode } from "./nodes/container-slot.js";
|
|
16
15
|
import { DialogNode } from "./nodes/dialog.js";
|
|
17
16
|
import { DrawingAreaNode } from "./nodes/drawing-area.js";
|
|
18
|
-
import { DropDownNode } from "./nodes/drop-down.js";
|
|
19
17
|
import { EventControllerNode } from "./nodes/event-controller.js";
|
|
20
18
|
import { FixedChildNode } from "./nodes/fixed-child.js";
|
|
21
19
|
import { FontDialogButtonNode } from "./nodes/font-dialog-button.js";
|
|
22
20
|
import { GridChildNode } from "./nodes/grid-child.js";
|
|
23
|
-
import { GridViewNode } from "./nodes/grid-view.js";
|
|
24
21
|
import { LevelBarNode } from "./nodes/level-bar.js";
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
22
|
+
import { ListNode } from "./nodes/list.js";
|
|
23
|
+
import { ListItemNode } from "./nodes/list-item-node.js";
|
|
27
24
|
import { MenuNode } from "./nodes/menu.js";
|
|
28
25
|
import { NavigationPageNode } from "./nodes/navigation-page.js";
|
|
29
26
|
import { NavigationViewNode } from "./nodes/navigation-view.js";
|
|
@@ -36,7 +33,6 @@ import { ScaleNode } from "./nodes/scale.js";
|
|
|
36
33
|
import { ScrolledWindowNode } from "./nodes/scrolled-window.js";
|
|
37
34
|
import { SearchBarNode } from "./nodes/search-bar.js";
|
|
38
35
|
import { ShortcutNode } from "./nodes/shortcut.js";
|
|
39
|
-
import { ShortcutControllerNode } from "./nodes/shortcut-controller.js";
|
|
40
36
|
import { SlotNode } from "./nodes/slot.js";
|
|
41
37
|
import { SourceViewNode } from "./nodes/source-view.js";
|
|
42
38
|
import { StackNode } from "./nodes/stack.js";
|
|
@@ -58,14 +54,16 @@ export type AdjustableWidget = InstanceType<(typeof AdjustableWidgets)[number]>;
|
|
|
58
54
|
export const StackWidgets = [Gtk.Stack, Adw.ViewStack] as const;
|
|
59
55
|
export type StackWidget = InstanceType<(typeof StackWidgets)[number]>;
|
|
60
56
|
|
|
61
|
-
export const DropDownWidgets = [Gtk.DropDown, Adw.ComboRow] as const;
|
|
62
|
-
export type DropDownWidget = InstanceType<(typeof DropDownWidgets)[number]>;
|
|
63
|
-
|
|
64
57
|
export const PopoverMenuWidgets = [Gtk.PopoverMenu, Gtk.PopoverMenuBar, Gtk.MenuButton] as const;
|
|
65
58
|
export type PopoverMenuWidget = InstanceType<(typeof PopoverMenuWidgets)[number]>;
|
|
66
59
|
|
|
67
|
-
|
|
68
|
-
|
|
60
|
+
export type NodeClass = (new (
|
|
61
|
+
// biome-ignore lint/suspicious/noExplicitAny: Registry entries require flexible typing for varied node constructors
|
|
62
|
+
...args: any[]
|
|
63
|
+
) => Node) & {
|
|
64
|
+
// biome-ignore lint/suspicious/noExplicitAny: Registry entries require flexible typing for varied node constructors
|
|
65
|
+
createContainer(...args: any[]): unknown;
|
|
66
|
+
};
|
|
69
67
|
|
|
70
68
|
// biome-ignore lint/suspicious/noExplicitAny: Class keys require flexible typing for GTK class hierarchy matching
|
|
71
69
|
type ClassKey = new (...args: any[]) => any;
|
|
@@ -79,7 +77,6 @@ export const NODE_REGISTRY: NodeRegistryEntry[] = [
|
|
|
79
77
|
["ColumnViewColumn", ColumnViewColumnNode],
|
|
80
78
|
["FixedChild", FixedChildNode],
|
|
81
79
|
["GridChild", GridChildNode],
|
|
82
|
-
["ListItem", ListItemNode],
|
|
83
80
|
[["MenuItem", "MenuSection", "MenuSubmenu"], MenuNode],
|
|
84
81
|
["NavigationPage", NavigationPageNode],
|
|
85
82
|
["NotebookPage", NotebookPageNode],
|
|
@@ -94,7 +91,6 @@ export const NODE_REGISTRY: NodeRegistryEntry[] = [
|
|
|
94
91
|
["TextTag", TextTagNode],
|
|
95
92
|
["Toggle", ToggleNode],
|
|
96
93
|
[Gtk.Application, ApplicationNode],
|
|
97
|
-
[Gtk.ShortcutController, ShortcutControllerNode],
|
|
98
94
|
[Gtk.EventController, EventControllerNode],
|
|
99
95
|
[GtkSource.View, SourceViewNode],
|
|
100
96
|
[Gtk.TextView, TextViewNode],
|
|
@@ -113,11 +109,9 @@ export const NODE_REGISTRY: NodeRegistryEntry[] = [
|
|
|
113
109
|
[Adw.ToggleGroup, ToggleGroupNode],
|
|
114
110
|
[Gtk.Notebook, NotebookNode],
|
|
115
111
|
[StackWidgets, StackNode],
|
|
116
|
-
[Gtk.ColumnView,
|
|
117
|
-
[Gtk.ListView, ListViewNode],
|
|
118
|
-
[Gtk.GridView, GridViewNode],
|
|
119
|
-
[DropDownWidgets, DropDownNode],
|
|
112
|
+
[[Gtk.ListView, Gtk.ColumnView, Gtk.GridView, Gtk.DropDown, Adw.ComboRow], ListNode],
|
|
120
113
|
[PopoverMenuWidgets, PopoverMenuNode],
|
|
121
114
|
[AdjustableWidgets, AdjustableNode],
|
|
115
|
+
[[Gtk.ListItem, Gtk.ListHeader], ListItemNode],
|
|
122
116
|
[Gtk.Widget, WidgetNode],
|
|
123
117
|
];
|
package/src/types.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type * as Gtk from "@gtkx/ffi/gtk";
|
|
2
2
|
|
|
3
|
-
export type Container = Gtk.Widget | Gtk.Application | Gtk.EventController;
|
|
3
|
+
export type Container = Gtk.Widget | Gtk.Application | Gtk.EventController | Gtk.ListItem | Gtk.ListHeader;
|
|
4
4
|
|
|
5
5
|
export type Props = Record<string, unknown>;
|
|
6
6
|
|
|
7
|
-
export type ContainerClass =
|
|
7
|
+
export type ContainerClass =
|
|
8
|
+
| typeof Gtk.Widget
|
|
9
|
+
| typeof Gtk.Application
|
|
10
|
+
| typeof Gtk.EventController
|
|
11
|
+
| typeof Gtk.ListItem
|
|
12
|
+
| typeof Gtk.ListHeader;
|
package/dist/fiber-root.d.ts
DELETED
package/dist/fiber-root.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fiber-root.d.ts","sourceRoot":"","sources":["../src/fiber-root.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAG/C,eAAO,MAAM,eAAe,GAAI,WAAW,GAAG,CAAC,MAAM,KAAG,UAAU,CAAC,SAelE,CAAC"}
|
package/dist/fiber-root.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { reconciler } from "./reconciler.js";
|
|
2
|
-
export const createFiberRoot = (container) => {
|
|
3
|
-
const instance = reconciler.getInstance();
|
|
4
|
-
return instance.createContainer(container, 1, null, false, null, "", (error) => console.error("Fiber root render error:", error), () => { }, () => { }, () => { });
|
|
5
|
-
};
|
|
6
|
-
//# sourceMappingURL=fiber-root.js.map
|
package/dist/fiber-root.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fiber-root.js","sourceRoot":"","sources":["../src/fiber-root.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,SAAqB,EAAwB,EAAE;IAC3E,MAAM,QAAQ,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC;IAE1C,OAAO,QAAQ,CAAC,eAAe,CAC3B,SAAS,EACT,CAAC,EACD,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,EAAE,EACF,CAAC,KAAY,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,KAAK,CAAC,EAClE,GAAG,EAAE,GAAE,CAAC,EACR,GAAG,EAAE,GAAE,CAAC,EACR,GAAG,EAAE,GAAE,CAAC,CACX,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import * as Gtk from "@gtkx/ffi/gtk";
|
|
2
|
-
import type { GtkColumnViewProps } from "../jsx.js";
|
|
3
|
-
import type { Node } from "../node.js";
|
|
4
|
-
import type { Container } from "../types.js";
|
|
5
|
-
import { ColumnViewColumnNode } from "./column-view-column.js";
|
|
6
|
-
import { ContainerSlotNode } from "./container-slot.js";
|
|
7
|
-
import { EventControllerNode } from "./event-controller.js";
|
|
8
|
-
import { ListItemNode } from "./list-item.js";
|
|
9
|
-
import { type ListModelProps } from "./models/list.js";
|
|
10
|
-
import { SlotNode } from "./slot.js";
|
|
11
|
-
import { WidgetNode } from "./widget.js";
|
|
12
|
-
declare const OWN_PROPS: readonly ["sortColumn", "sortOrder", "onSortChanged", "estimatedRowHeight"];
|
|
13
|
-
type ColumnViewProps = Pick<GtkColumnViewProps, (typeof OWN_PROPS)[number]> & ListModelProps;
|
|
14
|
-
type ColumnViewChild = ListItemNode | ColumnViewColumnNode | EventControllerNode | SlotNode | ContainerSlotNode;
|
|
15
|
-
export declare class ColumnViewNode extends WidgetNode<Gtk.ColumnView, ColumnViewProps, ColumnViewChild> {
|
|
16
|
-
private handleSortChange;
|
|
17
|
-
private list;
|
|
18
|
-
isValidChild(child: Node): boolean;
|
|
19
|
-
private columnNodes;
|
|
20
|
-
private estimatedRowHeight;
|
|
21
|
-
constructor(typeName: string, props: ColumnViewProps, container: Gtk.ColumnView, rootContainer: Container);
|
|
22
|
-
appendChild(child: ColumnViewChild): void;
|
|
23
|
-
insertBefore(child: ColumnViewChild, before: ColumnViewChild): void;
|
|
24
|
-
removeChild(child: ColumnViewChild): void;
|
|
25
|
-
finalizeInitialChildren(props: ColumnViewProps): boolean;
|
|
26
|
-
commitUpdate(oldProps: ColumnViewProps | null, newProps: ColumnViewProps): void;
|
|
27
|
-
commitMount(): void;
|
|
28
|
-
detachDeletedInstance(): void;
|
|
29
|
-
private applyOwnProps;
|
|
30
|
-
private findColumn;
|
|
31
|
-
private getColumn;
|
|
32
|
-
private getColumnIndex;
|
|
33
|
-
private findColumnInView;
|
|
34
|
-
}
|
|
35
|
-
export {};
|
|
36
|
-
//# sourceMappingURL=column-view.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"column-view.d.ts","sourceRoot":"","sources":["../../src/nodes/column-view.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,eAAe,CAAC;AACrC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,KAAK,EAAE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EAAE,eAAe,GAAG,IAAI;IAuBzC,uBAAuB,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO;IAKxD,YAAY,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,EAAE,QAAQ,EAAE,eAAe,GAAG,IAAI;IAM/E,WAAW,IAAI,IAAI;IAMnB,qBAAqB,IAAI,IAAI;IAK7C,OAAO,CAAC,aAAa;IAiCrB,OAAO,CAAC,UAAU;IAWlB,OAAO,CAAC,SAAS;IAQjB,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,gBAAgB;CAI3B"}
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import * as Gtk from "@gtkx/ffi/gtk";
|
|
2
|
-
import { ColumnViewColumnNode } from "./column-view-column.js";
|
|
3
|
-
import { ContainerSlotNode } from "./container-slot.js";
|
|
4
|
-
import { EventControllerNode } from "./event-controller.js";
|
|
5
|
-
import { filterProps, hasChanged } from "./internal/props.js";
|
|
6
|
-
import { ListItemNode } from "./list-item.js";
|
|
7
|
-
import { ListModel } from "./models/list.js";
|
|
8
|
-
import { SlotNode } from "./slot.js";
|
|
9
|
-
import { WidgetNode } from "./widget.js";
|
|
10
|
-
const OWN_PROPS = ["sortColumn", "sortOrder", "onSortChanged", "estimatedRowHeight"];
|
|
11
|
-
export class ColumnViewNode extends WidgetNode {
|
|
12
|
-
handleSortChange = null;
|
|
13
|
-
list;
|
|
14
|
-
isValidChild(child) {
|
|
15
|
-
return (child instanceof ListItemNode ||
|
|
16
|
-
child instanceof ColumnViewColumnNode ||
|
|
17
|
-
child instanceof EventControllerNode ||
|
|
18
|
-
child instanceof SlotNode ||
|
|
19
|
-
child instanceof ContainerSlotNode);
|
|
20
|
-
}
|
|
21
|
-
columnNodes = new Set();
|
|
22
|
-
estimatedRowHeight = null;
|
|
23
|
-
constructor(typeName, props, container, rootContainer) {
|
|
24
|
-
super(typeName, props, container, rootContainer);
|
|
25
|
-
this.list = new ListModel({ owner: this, signalStore: this.signalStore }, {
|
|
26
|
-
selectionMode: props.selectionMode,
|
|
27
|
-
selected: props.selected,
|
|
28
|
-
onSelectionChanged: props.onSelectionChanged,
|
|
29
|
-
});
|
|
30
|
-
this.list.getStore().setOnItemUpdated((id) => {
|
|
31
|
-
for (const column of this.columnNodes) {
|
|
32
|
-
column.rebindItem(id);
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
appendChild(child) {
|
|
37
|
-
super.appendChild(child);
|
|
38
|
-
if (child instanceof ListItemNode) {
|
|
39
|
-
this.list.appendChild(child);
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
if (!(child instanceof ColumnViewColumnNode))
|
|
43
|
-
return;
|
|
44
|
-
const existingColumn = this.findColumnInView(child.getColumn());
|
|
45
|
-
if (existingColumn) {
|
|
46
|
-
this.container.removeColumn(existingColumn);
|
|
47
|
-
}
|
|
48
|
-
child.setStore(this.list.getStore());
|
|
49
|
-
child.setEstimatedRowHeight(this.estimatedRowHeight);
|
|
50
|
-
this.container.appendColumn(child.getColumn());
|
|
51
|
-
child.attachToColumnView(this.container);
|
|
52
|
-
this.columnNodes.add(child);
|
|
53
|
-
}
|
|
54
|
-
insertBefore(child, before) {
|
|
55
|
-
super.insertBefore(child, before);
|
|
56
|
-
if (child instanceof ListItemNode) {
|
|
57
|
-
if (before instanceof ListItemNode) {
|
|
58
|
-
this.list.insertBefore(child, before);
|
|
59
|
-
}
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
if (!(child instanceof ColumnViewColumnNode))
|
|
63
|
-
return;
|
|
64
|
-
const existingColumn = this.findColumnInView(child.getColumn());
|
|
65
|
-
if (existingColumn) {
|
|
66
|
-
this.container.removeColumn(existingColumn);
|
|
67
|
-
}
|
|
68
|
-
child.setStore(this.list.getStore());
|
|
69
|
-
child.setEstimatedRowHeight(this.estimatedRowHeight);
|
|
70
|
-
if (before instanceof ColumnViewColumnNode) {
|
|
71
|
-
const beforeIndex = this.getColumnIndex(before.getColumn());
|
|
72
|
-
this.container.insertColumn(beforeIndex, child.getColumn());
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
this.container.appendColumn(child.getColumn());
|
|
76
|
-
}
|
|
77
|
-
child.attachToColumnView(this.container);
|
|
78
|
-
this.columnNodes.add(child);
|
|
79
|
-
}
|
|
80
|
-
removeChild(child) {
|
|
81
|
-
if (child instanceof ListItemNode) {
|
|
82
|
-
this.list.removeChild(child);
|
|
83
|
-
super.removeChild(child);
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
if (child instanceof ColumnViewColumnNode) {
|
|
87
|
-
child.detachFromColumnView();
|
|
88
|
-
const existingColumn = this.findColumnInView(child.getColumn());
|
|
89
|
-
if (existingColumn) {
|
|
90
|
-
this.container.removeColumn(existingColumn);
|
|
91
|
-
}
|
|
92
|
-
child.setStore(null);
|
|
93
|
-
this.columnNodes.delete(child);
|
|
94
|
-
}
|
|
95
|
-
super.removeChild(child);
|
|
96
|
-
}
|
|
97
|
-
finalizeInitialChildren(props) {
|
|
98
|
-
super.finalizeInitialChildren(props);
|
|
99
|
-
return true;
|
|
100
|
-
}
|
|
101
|
-
commitUpdate(oldProps, newProps) {
|
|
102
|
-
super.commitUpdate(oldProps ? filterProps(oldProps, OWN_PROPS) : null, filterProps(newProps, OWN_PROPS));
|
|
103
|
-
this.applyOwnProps(oldProps, newProps);
|
|
104
|
-
this.list.updateProps(oldProps ? filterProps(oldProps, OWN_PROPS) : null, filterProps(newProps, OWN_PROPS));
|
|
105
|
-
}
|
|
106
|
-
commitMount() {
|
|
107
|
-
super.commitMount();
|
|
108
|
-
this.list.flushBatch();
|
|
109
|
-
this.container.setModel(this.list.getSelectionModel());
|
|
110
|
-
}
|
|
111
|
-
detachDeletedInstance() {
|
|
112
|
-
this.columnNodes.clear();
|
|
113
|
-
super.detachDeletedInstance();
|
|
114
|
-
}
|
|
115
|
-
applyOwnProps(oldProps, newProps) {
|
|
116
|
-
if (hasChanged(oldProps, newProps, "onSortChanged")) {
|
|
117
|
-
const sorter = this.container.getSorter();
|
|
118
|
-
const onSortChanged = newProps.onSortChanged;
|
|
119
|
-
if (sorter instanceof Gtk.ColumnViewSorter) {
|
|
120
|
-
this.handleSortChange = () => {
|
|
121
|
-
onSortChanged?.(sorter.getPrimarySortColumn()?.getId() ?? null, sorter.getPrimarySortOrder());
|
|
122
|
-
};
|
|
123
|
-
this.signalStore.set(this, sorter, "changed", this.handleSortChange);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
if (hasChanged(oldProps, newProps, "sortColumn") || hasChanged(oldProps, newProps, "sortOrder")) {
|
|
127
|
-
const sortColumn = newProps.sortColumn;
|
|
128
|
-
const sortOrder = newProps.sortOrder ?? Gtk.SortType.ASCENDING;
|
|
129
|
-
if (!sortColumn) {
|
|
130
|
-
this.container.sortByColumn(sortOrder, undefined);
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
this.container.sortByColumn(sortOrder, this.getColumn(sortColumn));
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
if (hasChanged(oldProps, newProps, "estimatedRowHeight")) {
|
|
137
|
-
this.estimatedRowHeight = newProps.estimatedRowHeight ?? null;
|
|
138
|
-
for (const column of this.columnNodes) {
|
|
139
|
-
column.setEstimatedRowHeight(this.estimatedRowHeight);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
findColumn(predicate) {
|
|
144
|
-
const columns = this.container.getColumns();
|
|
145
|
-
for (let i = 0; i < columns.getNItems(); i++) {
|
|
146
|
-
const column = columns.getObject(i);
|
|
147
|
-
if (!(column instanceof Gtk.ColumnViewColumn))
|
|
148
|
-
continue;
|
|
149
|
-
const result = predicate(column, i);
|
|
150
|
-
if (result !== null)
|
|
151
|
-
return result;
|
|
152
|
-
}
|
|
153
|
-
return null;
|
|
154
|
-
}
|
|
155
|
-
getColumn(columnId) {
|
|
156
|
-
const column = this.findColumn((col) => (col.getId() === columnId ? col : null));
|
|
157
|
-
if (!column) {
|
|
158
|
-
throw new Error(`Unable to find column '${columnId}' in ${this.typeName}`);
|
|
159
|
-
}
|
|
160
|
-
return column;
|
|
161
|
-
}
|
|
162
|
-
getColumnIndex(column) {
|
|
163
|
-
const targetId = column.getId();
|
|
164
|
-
const index = this.findColumn((col, i) => (col.getId() === targetId ? i : null));
|
|
165
|
-
if (index === null) {
|
|
166
|
-
throw new Error(`Unable to find column '${targetId}' in ${this.typeName}`);
|
|
167
|
-
}
|
|
168
|
-
return index;
|
|
169
|
-
}
|
|
170
|
-
findColumnInView(column) {
|
|
171
|
-
const targetId = column.getId();
|
|
172
|
-
return this.findColumn((col) => (col.getId() === targetId ? col : null));
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
//# sourceMappingURL=column-view.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"column-view.js","sourceRoot":"","sources":["../../src/nodes/column-view.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,eAAe,CAAC;AAIrC,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAuB,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,SAAS,GAAG,CAAC,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,oBAAoB,CAAU,CAAC;AAK9F,MAAM,OAAO,cAAe,SAAQ,UAA4D;IACpF,gBAAgB,GAAwB,IAAI,CAAC;IAC7C,IAAI,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