@gtkx/react 0.15.0 → 0.17.1
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/README.md +1 -0
- package/dist/animation/css-builder.d.ts +3 -0
- package/dist/animation/css-builder.js +53 -0
- package/dist/animation/types.d.ts +120 -0
- package/dist/errors.js +3 -0
- package/dist/factory.d.ts +3 -2
- package/dist/factory.js +1 -1
- package/dist/fiber-root.js +1 -1
- package/dist/generated/internal.d.ts +28 -1
- package/dist/generated/internal.js +93 -18
- package/dist/generated/jsx.d.ts +1672 -1483
- package/dist/generated/jsx.js +475 -0
- package/dist/host-config.d.ts +3 -1
- package/dist/host-config.js +26 -11
- package/dist/jsx.d.ts +136 -166
- package/dist/jsx.js +58 -69
- package/dist/node.d.ts +4 -1
- package/dist/node.js +14 -3
- package/dist/nodes/abstract/positional-child.d.ts +9 -0
- package/dist/nodes/abstract/positional-child.js +29 -0
- package/dist/nodes/abstract/virtual-container.d.ts +21 -0
- package/dist/nodes/abstract/virtual-container.js +68 -0
- package/dist/nodes/abstract/virtual-single-child.d.ts +18 -0
- package/dist/nodes/abstract/virtual-single-child.js +55 -0
- package/dist/nodes/action-row-child.d.ts +0 -13
- package/dist/nodes/action-row-child.js +22 -12
- package/dist/nodes/adjustable.d.ts +23 -0
- package/dist/nodes/adjustable.js +62 -0
- package/dist/nodes/alert-dialog-response.js +86 -0
- package/dist/nodes/animation.js +252 -0
- package/dist/nodes/application.js +17 -7
- package/dist/nodes/autowrapped.js +37 -43
- package/dist/nodes/calendar.js +17 -43
- package/dist/nodes/color-dialog-button.d.ts +1 -0
- package/dist/nodes/color-dialog-button.js +70 -0
- package/dist/nodes/column-view-column.d.ts +3 -3
- package/dist/nodes/column-view-column.js +1 -1
- package/dist/nodes/column-view.js +36 -39
- package/dist/nodes/dialog.d.ts +11 -0
- package/dist/nodes/dialog.js +20 -0
- package/dist/nodes/drawing-area.js +24 -7
- package/dist/nodes/event-controller.d.ts +22 -0
- package/dist/nodes/event-controller.js +96 -0
- package/dist/nodes/expander-row-child.d.ts +0 -14
- package/dist/nodes/expander-row-child.js +22 -12
- package/dist/nodes/fixed-child.js +52 -36
- package/dist/nodes/font-dialog-button.d.ts +1 -0
- package/dist/nodes/font-dialog-button.js +90 -0
- package/dist/nodes/grid-child.js +43 -45
- package/dist/nodes/grid.d.ts +1 -0
- package/dist/nodes/grid.js +41 -0
- package/dist/nodes/index.d.ts +18 -12
- package/dist/nodes/index.js +18 -12
- package/dist/nodes/internal/base-item-renderer.d.ts +29 -0
- package/dist/nodes/internal/base-item-renderer.js +88 -0
- package/dist/nodes/internal/child-attachment.d.ts +26 -0
- package/dist/nodes/internal/child-attachment.js +48 -0
- package/dist/nodes/internal/deferred-action.d.ts +9 -0
- package/dist/nodes/internal/deferred-action.js +22 -0
- package/dist/nodes/internal/list-item-renderer.d.ts +14 -15
- package/dist/nodes/internal/list-item-renderer.js +51 -77
- package/dist/nodes/internal/list-store.d.ts +5 -6
- package/dist/nodes/internal/list-store.js +29 -38
- package/dist/nodes/internal/predicates.d.ts +25 -2
- package/dist/nodes/internal/predicates.js +53 -41
- package/dist/nodes/internal/selection-model.d.ts +30 -0
- package/dist/nodes/internal/selection-model.js +87 -0
- package/dist/nodes/internal/signal-store.d.ts +9 -5
- package/dist/nodes/internal/signal-store.js +31 -31
- package/dist/nodes/internal/simple-list-store.js +6 -9
- package/dist/nodes/internal/text-buffer-controller.d.ts +43 -0
- package/dist/nodes/internal/text-buffer-controller.js +287 -0
- package/dist/nodes/internal/text-tag-styles.d.ts +43 -0
- package/dist/nodes/internal/text-tag-styles.js +52 -0
- package/dist/nodes/internal/tree-list-item-renderer.d.ts +15 -14
- package/dist/nodes/internal/tree-list-item-renderer.js +85 -96
- package/dist/nodes/internal/tree-store.d.ts +8 -11
- package/dist/nodes/internal/tree-store.js +70 -72
- package/dist/nodes/internal/utils.d.ts +7 -4
- package/dist/nodes/internal/utils.js +50 -5
- package/dist/nodes/level-bar.js +19 -54
- package/dist/nodes/list-item.d.ts +6 -3
- package/dist/nodes/list-item.js +7 -4
- package/dist/nodes/list-view.js +17 -12
- package/dist/nodes/menu.d.ts +3 -3
- package/dist/nodes/menu.js +3 -3
- package/dist/nodes/models/list.d.ts +11 -13
- package/dist/nodes/models/list.js +16 -73
- package/dist/nodes/models/menu.d.ts +8 -7
- package/dist/nodes/models/menu.js +43 -50
- package/dist/nodes/models/tree-list.d.ts +6 -12
- package/dist/nodes/models/tree-list.js +30 -93
- package/dist/nodes/navigation-page.d.ts +1 -0
- package/dist/nodes/navigation-page.js +27 -32
- package/dist/nodes/navigation-view.js +17 -28
- package/dist/nodes/notebook-page-tab.d.ts +3 -3
- package/dist/nodes/notebook-page-tab.js +11 -14
- package/dist/nodes/notebook-page.d.ts +7 -5
- package/dist/nodes/notebook-page.js +45 -25
- package/dist/nodes/notebook.js +2 -2
- package/dist/nodes/overlay-child.js +90 -30
- package/dist/nodes/pack-child.d.ts +0 -13
- package/dist/nodes/pack-child.js +22 -12
- package/dist/nodes/popover-menu.js +2 -2
- package/dist/nodes/scale.js +15 -45
- package/dist/nodes/scrolled-window.js +7 -6
- package/dist/nodes/search-bar.d.ts +1 -0
- package/dist/nodes/search-bar.js +40 -0
- package/dist/nodes/shortcut-controller.d.ts +1 -37
- package/dist/nodes/shortcut-controller.js +8 -47
- package/dist/nodes/shortcut.d.ts +5 -4
- package/dist/nodes/shortcut.js +11 -5
- package/dist/nodes/simple-list-view.js +2 -3
- package/dist/nodes/slot.d.ts +6 -9
- package/dist/nodes/slot.js +27 -42
- package/dist/nodes/source-view.js +80 -29
- package/dist/nodes/stack-page.js +20 -22
- package/dist/nodes/stack.js +19 -5
- package/dist/nodes/text-anchor.d.ts +41 -0
- package/dist/nodes/text-anchor.js +59 -0
- package/dist/nodes/text-content.d.ts +10 -0
- package/dist/nodes/text-content.js +1 -0
- package/dist/nodes/text-paintable.d.ts +17 -0
- package/dist/nodes/text-paintable.js +34 -0
- package/dist/nodes/text-segment.d.ts +15 -0
- package/dist/nodes/text-segment.js +29 -0
- package/dist/nodes/text-tag.d.ts +136 -0
- package/dist/nodes/text-tag.js +202 -0
- package/dist/nodes/text-view.d.ts +30 -0
- package/dist/nodes/text-view.js +49 -21
- package/dist/nodes/toggle-group.js +24 -32
- package/dist/nodes/toggle.d.ts +1 -15
- package/dist/nodes/toggle.js +40 -32
- package/dist/nodes/toolbar-child.js +22 -31
- package/dist/nodes/tree-list-item.d.ts +7 -5
- package/dist/nodes/tree-list-item.js +24 -36
- package/dist/nodes/tree-list-view.js +9 -7
- package/dist/nodes/virtual.d.ts +1 -1
- package/dist/nodes/web-view.d.ts +1 -0
- package/dist/nodes/web-view.js +29 -0
- package/dist/nodes/widget.d.ts +2 -16
- package/dist/nodes/widget.js +105 -294
- package/dist/nodes/window.d.ts +9 -3
- package/dist/nodes/window.js +29 -15
- package/dist/registry.d.ts +1 -1
- package/dist/render.js +9 -7
- package/dist/scheduler.d.ts +11 -1
- package/dist/scheduler.js +16 -4
- package/dist/types.d.ts +2 -136
- package/package.json +4 -4
- package/dist/nodes/action-row.js +0 -46
- package/dist/nodes/adjustment.d.ts +0 -48
- package/dist/nodes/adjustment.js +0 -70
- package/dist/nodes/calendar-mark.d.ts +0 -15
- package/dist/nodes/calendar-mark.js +0 -29
- package/dist/nodes/expander-row.js +0 -55
- package/dist/nodes/internal/constants.d.ts +0 -1
- package/dist/nodes/internal/constants.js +0 -24
- package/dist/nodes/level-bar-offset.d.ts +0 -13
- package/dist/nodes/level-bar-offset.js +0 -35
- package/dist/nodes/pack.js +0 -46
- package/dist/nodes/scale-mark.d.ts +0 -17
- package/dist/nodes/scale-mark.js +0 -38
- package/dist/nodes/source-buffer.d.ts +0 -73
- package/dist/nodes/source-buffer.js +0 -149
- package/dist/nodes/text-buffer.d.ts +0 -43
- package/dist/nodes/text-buffer.js +0 -81
- package/dist/nodes/virtual-child.d.ts +0 -18
- package/dist/nodes/virtual-child.js +0 -62
- /package/dist/{nodes/action-row.d.ts → animation/types.js} +0 -0
- /package/dist/nodes/{expander-row.d.ts → alert-dialog-response.d.ts} +0 -0
- /package/dist/nodes/{pack.d.ts → animation.d.ts} +0 -0
|
@@ -1,39 +1,30 @@
|
|
|
1
|
-
import { batch, isObjectEqual } from "@gtkx/ffi";
|
|
2
1
|
import { registerNodeClass } from "../registry.js";
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import { VirtualContainerNode } from "./abstract/virtual-container.js";
|
|
3
|
+
import { matchesInterface } from "./internal/utils.js";
|
|
4
|
+
const TOOLBAR_INTERFACE_METHODS = ["addTopBar", "addBottomBar", "remove"];
|
|
5
|
+
class ToolbarTopNode extends VirtualContainerNode {
|
|
5
6
|
static priority = 1;
|
|
6
7
|
static matches(type) {
|
|
7
|
-
return type === "ToolbarTop"
|
|
8
|
+
return type === "ToolbarTop";
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
throw new Error("Expected ToolbarView reference to be set on ToolbarChildNode");
|
|
12
|
-
}
|
|
13
|
-
return this.parent;
|
|
10
|
+
canBeChildOf(parent) {
|
|
11
|
+
return matchesInterface(TOOLBAR_INTERFACE_METHODS, parent.container);
|
|
14
12
|
}
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
attachChild(parent, widget) {
|
|
14
|
+
parent.addTopBar(widget);
|
|
17
15
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (position === "top") {
|
|
30
|
-
toolbar.addTopBar(this.child);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
toolbar.addBottomBar(this.child);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
});
|
|
16
|
+
}
|
|
17
|
+
class ToolbarBottomNode extends VirtualContainerNode {
|
|
18
|
+
static priority = 1;
|
|
19
|
+
static matches(type) {
|
|
20
|
+
return type === "ToolbarBottom";
|
|
21
|
+
}
|
|
22
|
+
canBeChildOf(parent) {
|
|
23
|
+
return matchesInterface(TOOLBAR_INTERFACE_METHODS, parent.container);
|
|
24
|
+
}
|
|
25
|
+
attachChild(parent, widget) {
|
|
26
|
+
parent.addBottomBar(widget);
|
|
37
27
|
}
|
|
38
28
|
}
|
|
39
|
-
registerNodeClass(
|
|
29
|
+
registerNodeClass(ToolbarTopNode);
|
|
30
|
+
registerNodeClass(ToolbarBottomNode);
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import type { TreeListItemProps } from "../jsx.js";
|
|
2
2
|
import type { Node } from "../node.js";
|
|
3
|
-
import type { TreeStore } from "./internal/tree-store.js";
|
|
3
|
+
import type { TreeItemData, TreeStore } from "./internal/tree-store.js";
|
|
4
4
|
import { VirtualNode } from "./virtual.js";
|
|
5
5
|
type Props = Partial<TreeListItemProps>;
|
|
6
|
+
export declare const createTreeItemData: (props: Props) => TreeItemData;
|
|
6
7
|
export declare class TreeListItemNode extends VirtualNode<Props> {
|
|
7
8
|
static priority: number;
|
|
8
|
-
private store
|
|
9
|
-
private parentItemId
|
|
9
|
+
private store;
|
|
10
|
+
private parentItemId;
|
|
10
11
|
private childNodes;
|
|
11
12
|
static matches(type: string): boolean;
|
|
12
|
-
setStore(store
|
|
13
|
-
|
|
13
|
+
setStore(store: TreeStore | null): void;
|
|
14
|
+
getChildNodes(): readonly TreeListItemNode[];
|
|
15
|
+
setParentItemId(parentId: string | null): void;
|
|
14
16
|
getParentItemId(): string | null;
|
|
15
17
|
appendChild(child: Node): void;
|
|
16
18
|
insertBefore(child: Node, before: Node): void;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { registerNodeClass } from "../registry.js";
|
|
2
|
-
import { scheduleAfterCommit } from "../scheduler.js";
|
|
3
2
|
import { VirtualNode } from "./virtual.js";
|
|
3
|
+
export const createTreeItemData = (props) => ({
|
|
4
|
+
value: props.value,
|
|
5
|
+
indentForDepth: props.indentForDepth,
|
|
6
|
+
indentForIcon: props.indentForIcon,
|
|
7
|
+
hideExpander: props.hideExpander,
|
|
8
|
+
});
|
|
4
9
|
export class TreeListItemNode extends VirtualNode {
|
|
5
10
|
static priority = 1;
|
|
6
|
-
store;
|
|
7
|
-
parentItemId;
|
|
11
|
+
store = null;
|
|
12
|
+
parentItemId = null;
|
|
8
13
|
childNodes = [];
|
|
9
14
|
static matches(type) {
|
|
10
15
|
return type === "TreeListItem";
|
|
@@ -15,36 +20,32 @@ export class TreeListItemNode extends VirtualNode {
|
|
|
15
20
|
child.setStore(store);
|
|
16
21
|
}
|
|
17
22
|
}
|
|
23
|
+
getChildNodes() {
|
|
24
|
+
return this.childNodes;
|
|
25
|
+
}
|
|
18
26
|
setParentItemId(parentId) {
|
|
19
27
|
this.parentItemId = parentId;
|
|
20
28
|
}
|
|
21
29
|
getParentItemId() {
|
|
22
|
-
return this.parentItemId
|
|
30
|
+
return this.parentItemId;
|
|
23
31
|
}
|
|
24
32
|
appendChild(child) {
|
|
25
33
|
if (!(child instanceof TreeListItemNode)) {
|
|
26
34
|
return;
|
|
27
35
|
}
|
|
28
36
|
child.setStore(this.store);
|
|
29
|
-
child.setParentItemId(this.props.id);
|
|
37
|
+
child.setParentItemId(this.props.id ?? null);
|
|
30
38
|
this.childNodes.push(child);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
value: child.props.value,
|
|
35
|
-
indentForDepth: child.props.indentForDepth,
|
|
36
|
-
indentForIcon: child.props.indentForIcon,
|
|
37
|
-
hideExpander: child.props.hideExpander,
|
|
38
|
-
}, this.props.id);
|
|
39
|
-
}
|
|
40
|
-
});
|
|
39
|
+
if (this.store && child.props.id !== undefined) {
|
|
40
|
+
this.store.addItem(child.props.id, createTreeItemData(child.props), this.props.id);
|
|
41
|
+
}
|
|
41
42
|
}
|
|
42
43
|
insertBefore(child, before) {
|
|
43
44
|
if (!(child instanceof TreeListItemNode) || !(before instanceof TreeListItemNode)) {
|
|
44
45
|
return;
|
|
45
46
|
}
|
|
46
47
|
child.setStore(this.store);
|
|
47
|
-
child.setParentItemId(this.props.id);
|
|
48
|
+
child.setParentItemId(this.props.id ?? null);
|
|
48
49
|
const beforeIndex = this.childNodes.indexOf(before);
|
|
49
50
|
if (beforeIndex === -1) {
|
|
50
51
|
this.childNodes.push(child);
|
|
@@ -52,16 +53,9 @@ export class TreeListItemNode extends VirtualNode {
|
|
|
52
53
|
else {
|
|
53
54
|
this.childNodes.splice(beforeIndex, 0, child);
|
|
54
55
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
value: child.props.value,
|
|
59
|
-
indentForDepth: child.props.indentForDepth,
|
|
60
|
-
indentForIcon: child.props.indentForIcon,
|
|
61
|
-
hideExpander: child.props.hideExpander,
|
|
62
|
-
}, this.props.id);
|
|
63
|
-
}
|
|
64
|
-
});
|
|
56
|
+
if (this.store && child.props.id !== undefined && before.props.id !== undefined) {
|
|
57
|
+
this.store.insertItemBefore(child.props.id, before.props.id, createTreeItemData(child.props), this.props.id);
|
|
58
|
+
}
|
|
65
59
|
}
|
|
66
60
|
removeChild(child) {
|
|
67
61
|
if (!(child instanceof TreeListItemNode)) {
|
|
@@ -82,20 +76,14 @@ export class TreeListItemNode extends VirtualNode {
|
|
|
82
76
|
if (!this.store) {
|
|
83
77
|
return;
|
|
84
78
|
}
|
|
85
|
-
|
|
79
|
+
const propsChanged = !oldProps ||
|
|
86
80
|
oldProps.id !== newProps.id ||
|
|
87
81
|
oldProps.value !== newProps.value ||
|
|
88
82
|
oldProps.indentForDepth !== newProps.indentForDepth ||
|
|
89
83
|
oldProps.indentForIcon !== newProps.indentForIcon ||
|
|
90
|
-
oldProps.hideExpander !== newProps.hideExpander
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
value: newProps.value,
|
|
94
|
-
indentForDepth: newProps.indentForDepth,
|
|
95
|
-
indentForIcon: newProps.indentForIcon,
|
|
96
|
-
hideExpander: newProps.hideExpander,
|
|
97
|
-
});
|
|
98
|
-
}
|
|
84
|
+
oldProps.hideExpander !== newProps.hideExpander;
|
|
85
|
+
if (propsChanged && newProps.id !== undefined) {
|
|
86
|
+
this.store.updateItem(newProps.id, createTreeItemData(newProps));
|
|
99
87
|
}
|
|
100
88
|
}
|
|
101
89
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isObjectEqual } from "@gtkx/ffi";
|
|
1
2
|
import * as Gtk from "@gtkx/ffi/gtk";
|
|
2
3
|
import { registerNodeClass } from "../registry.js";
|
|
3
4
|
import { TreeListItemRenderer } from "./internal/tree-list-item-renderer.js";
|
|
@@ -25,9 +26,10 @@ class TreeListViewNode extends WidgetNode {
|
|
|
25
26
|
selectionMode: props.selectionMode,
|
|
26
27
|
selected: props.selected,
|
|
27
28
|
onSelectionChanged: props.onSelectionChanged,
|
|
28
|
-
});
|
|
29
|
-
this.itemRenderer = new TreeListItemRenderer();
|
|
29
|
+
}, rootContainer);
|
|
30
|
+
this.itemRenderer = new TreeListItemRenderer(this.signalStore);
|
|
30
31
|
this.itemRenderer.setStore(this.treeList.getStore());
|
|
32
|
+
this.treeList.getStore().setOnItemUpdated((id) => this.itemRenderer.rebindItem(id));
|
|
31
33
|
this.container.setFactory(this.itemRenderer.getFactory());
|
|
32
34
|
}
|
|
33
35
|
mount() {
|
|
@@ -58,18 +60,18 @@ class TreeListViewNode extends WidgetNode {
|
|
|
58
60
|
}
|
|
59
61
|
updateProps(oldProps, newProps) {
|
|
60
62
|
if (!oldProps || oldProps.renderItem !== newProps.renderItem) {
|
|
61
|
-
this.itemRenderer.setRenderFn(newProps.renderItem);
|
|
63
|
+
this.itemRenderer.setRenderFn(newProps.renderItem ?? null);
|
|
62
64
|
}
|
|
63
65
|
if (!oldProps || oldProps.estimatedItemHeight !== newProps.estimatedItemHeight) {
|
|
64
|
-
this.itemRenderer.setEstimatedItemHeight(newProps.estimatedItemHeight);
|
|
66
|
+
this.itemRenderer.setEstimatedItemHeight(newProps.estimatedItemHeight ?? null);
|
|
65
67
|
}
|
|
66
68
|
const previousModel = this.treeList.getSelectionModel();
|
|
67
|
-
this.treeList.updateProps(filterProps(oldProps
|
|
69
|
+
this.treeList.updateProps(oldProps ? filterProps(oldProps, RENDERER_PROP_NAMES) : null, filterProps(newProps, RENDERER_PROP_NAMES));
|
|
68
70
|
const currentModel = this.treeList.getSelectionModel();
|
|
69
|
-
if (previousModel
|
|
71
|
+
if (!isObjectEqual(previousModel, currentModel)) {
|
|
70
72
|
this.container.setModel(currentModel);
|
|
71
73
|
}
|
|
72
|
-
super.updateProps(filterProps(oldProps
|
|
74
|
+
super.updateProps(oldProps ? filterProps(oldProps, PROP_NAMES) : null, filterProps(newProps, PROP_NAMES));
|
|
73
75
|
}
|
|
74
76
|
}
|
|
75
77
|
registerNodeClass(TreeListViewNode);
|
package/dist/nodes/virtual.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare class VirtualNode<P = Props> extends Node<undefined, P> {
|
|
|
5
5
|
static matches(_type: string): boolean;
|
|
6
6
|
static createContainer(): void;
|
|
7
7
|
props: P;
|
|
8
|
-
constructor(typeName: string, props: P | undefined, container: undefined, rootContainer
|
|
8
|
+
constructor(typeName: string, props: P | undefined, container: undefined, rootContainer: Container);
|
|
9
9
|
appendChild(_child: Node): void;
|
|
10
10
|
removeChild(_child: Node): void;
|
|
11
11
|
insertBefore(_child: Node, _before: Node): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as WebKit from "@gtkx/ffi/webkit";
|
|
2
|
+
import { registerNodeClass } from "../registry.js";
|
|
3
|
+
import { filterProps, hasChanged, matchesAnyClass, propNameToSignalName, resolveSignal } from "./internal/utils.js";
|
|
4
|
+
import { WidgetNode } from "./widget.js";
|
|
5
|
+
const NON_BLOCKABLE_SIGNALS = ["load-changed"];
|
|
6
|
+
class WebViewNode extends WidgetNode {
|
|
7
|
+
static priority = 1;
|
|
8
|
+
static matches(_type, containerOrClass) {
|
|
9
|
+
return matchesAnyClass([WebKit.WebView], containerOrClass);
|
|
10
|
+
}
|
|
11
|
+
updateProps(oldProps, newProps) {
|
|
12
|
+
super.updateProps(oldProps ? filterProps(oldProps, NON_BLOCKABLE_SIGNALS) : null, filterProps(newProps, NON_BLOCKABLE_SIGNALS));
|
|
13
|
+
this.applyNonBlockableSignals(oldProps, newProps);
|
|
14
|
+
}
|
|
15
|
+
applyNonBlockableSignals(oldProps, newProps) {
|
|
16
|
+
for (const propName of NON_BLOCKABLE_SIGNALS) {
|
|
17
|
+
const camelCaseName = `on${propName.charAt(0).toUpperCase()}${propName.slice(1).replace(/-([a-z])/g, (_, c) => c.toUpperCase())}`;
|
|
18
|
+
if (hasChanged(oldProps, newProps, camelCaseName)) {
|
|
19
|
+
const signalName = propNameToSignalName(camelCaseName);
|
|
20
|
+
if (resolveSignal(this.container, signalName)) {
|
|
21
|
+
const newValue = newProps[camelCaseName];
|
|
22
|
+
const handler = typeof newValue === "function" ? newValue : undefined;
|
|
23
|
+
this.signalStore.set(this, this.container, signalName, handler, { blockable: false });
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
registerNodeClass(WebViewNode);
|
package/dist/nodes/widget.d.ts
CHANGED
|
@@ -3,16 +3,8 @@ import { Node } from "../node.js";
|
|
|
3
3
|
import type { Container, ContainerClass, Props } from "../types.js";
|
|
4
4
|
export declare class WidgetNode<T extends Gtk.Widget = Gtk.Widget, P extends Props = Props> extends Node<T, P> {
|
|
5
5
|
static priority: number;
|
|
6
|
-
private motionController?;
|
|
7
|
-
private clickController?;
|
|
8
|
-
private keyController?;
|
|
9
|
-
private scrollController?;
|
|
10
|
-
private dragSourceController?;
|
|
11
|
-
private dropTargetController?;
|
|
12
|
-
private gestureDragController?;
|
|
13
|
-
private adjustmentChild?;
|
|
14
6
|
static matches(_type: string, containerOrClass?: Container | ContainerClass | null): boolean;
|
|
15
|
-
static createContainer(props: Props, containerClass: typeof Gtk.Widget): Container | null;
|
|
7
|
+
static createContainer(props: Props, containerClass: typeof Gtk.Widget, _rootContainer?: Container): Container | null;
|
|
16
8
|
appendChild(child: Node): void;
|
|
17
9
|
removeChild(child: Node): void;
|
|
18
10
|
insertBefore(child: Node, before: Node): void;
|
|
@@ -21,13 +13,7 @@ export declare class WidgetNode<T extends Gtk.Widget = Gtk.Widget, P extends Pro
|
|
|
21
13
|
updateProps(oldProps: P | null, newProps: P): void;
|
|
22
14
|
private updateSizeRequest;
|
|
23
15
|
private updateGrabFocus;
|
|
24
|
-
private
|
|
25
|
-
private ensureDragSource;
|
|
26
|
-
private ensureDropTarget;
|
|
27
|
-
private ensureGestureDrag;
|
|
28
|
-
private updateNotifyHandler;
|
|
29
|
-
private propNameToSignalName;
|
|
30
|
-
private getProperty;
|
|
16
|
+
private getPropertyDefaultValue;
|
|
31
17
|
private setProperty;
|
|
32
18
|
private detachChildFromParent;
|
|
33
19
|
private attachChild;
|