@gtkx/react 0.10.1 → 0.10.2
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/generated/jsx.d.ts +14 -5
- package/dist/nodes/index.d.ts +0 -3
- package/dist/nodes/index.js +0 -3
- package/dist/nodes/internal/predicates.d.ts +3 -0
- package/dist/nodes/internal/predicates.js +3 -0
- package/dist/nodes/notebook-page-tab.js +0 -3
- package/dist/nodes/notebook-page.js +0 -3
- package/dist/nodes/toolbar-child.d.ts +1 -9
- package/dist/nodes/toolbar-child.js +1 -1
- package/dist/nodes/widget.js +7 -1
- package/dist/nodes/window.js +0 -10
- package/package.json +3 -3
- package/dist/nodes/navigation-page.d.ts +0 -21
- package/dist/nodes/navigation-page.js +0 -95
- package/dist/nodes/navigation-view.d.ts +0 -1
- package/dist/nodes/navigation-view.js +0 -29
- package/dist/nodes/toolbar.d.ts +0 -1
- package/dist/nodes/toolbar.js +0 -42
package/dist/generated/jsx.d.ts
CHANGED
|
@@ -3186,8 +3186,6 @@ export interface GtkGLAreaProps extends WidgetProps {
|
|
|
3186
3186
|
export interface GtkGraphicsOffloadProps extends WidgetProps {
|
|
3187
3187
|
/** Whether to draw a black background. */
|
|
3188
3188
|
blackBackground?: boolean;
|
|
3189
|
-
/** The child widget. */
|
|
3190
|
-
child?: Gtk.Widget;
|
|
3191
3189
|
/** Whether graphics offload is enabled. */
|
|
3192
3190
|
enabled?: Gtk.GraphicsOffloadEnabled;
|
|
3193
3191
|
children?: ReactNode;
|
|
@@ -12328,7 +12326,6 @@ export type WidgetSlotNames = {
|
|
|
12328
12326
|
GtkExpander: "child" | "labelWidget";
|
|
12329
12327
|
GtkFlowBoxChild: "child";
|
|
12330
12328
|
GtkFrame: "child" | "labelWidget";
|
|
12331
|
-
GtkGraphicsOffload: "child";
|
|
12332
12329
|
GtkHeaderBar: "titleWidget";
|
|
12333
12330
|
GtkLabel: "mnemonicWidget";
|
|
12334
12331
|
GtkListBoxRow: "child";
|
|
@@ -12353,26 +12350,38 @@ export type WidgetSlotNames = {
|
|
|
12353
12350
|
AdwBin: "child";
|
|
12354
12351
|
AdwBottomSheet: "bottomBar" | "content" | "sheet";
|
|
12355
12352
|
AdwBreakpointBin: "child";
|
|
12353
|
+
AdwCarouselIndicatorDots: "carousel";
|
|
12354
|
+
AdwCarouselIndicatorLines: "carousel";
|
|
12356
12355
|
AdwClamp: "child";
|
|
12357
12356
|
AdwClampScrollable: "child";
|
|
12358
12357
|
AdwDialog: "child" | "defaultWidget" | "focusWidget";
|
|
12359
12358
|
AdwFlap: "content" | "flap" | "separator";
|
|
12360
12359
|
AdwHeaderBar: "titleWidget";
|
|
12360
|
+
AdwInlineViewSwitcher: "stack";
|
|
12361
12361
|
AdwLeaflet: "visibleChild";
|
|
12362
12362
|
AdwMessageDialog: "extraChild";
|
|
12363
|
+
AdwNavigationSplitView: "content" | "sidebar";
|
|
12363
12364
|
AdwOverlaySplitView: "content" | "sidebar";
|
|
12364
12365
|
AdwPreferencesDialog: "visiblePage";
|
|
12365
12366
|
AdwPreferencesGroup: "headerSuffix";
|
|
12367
|
+
AdwPreferencesPage: "banner";
|
|
12366
12368
|
AdwPreferencesWindow: "visiblePage";
|
|
12367
12369
|
AdwSplitButton: "child" | "popover";
|
|
12368
12370
|
AdwStatusPage: "child";
|
|
12369
|
-
AdwTabBar: "endActionWidget" | "startActionWidget";
|
|
12370
|
-
|
|
12371
|
+
AdwTabBar: "endActionWidget" | "startActionWidget" | "view";
|
|
12372
|
+
AdwTabButton: "view";
|
|
12373
|
+
AdwTabOverview: "child" | "view";
|
|
12371
12374
|
AdwToastOverlay: "child";
|
|
12372
12375
|
AdwToolbarView: "content";
|
|
12373
12376
|
AdwViewStack: "visibleChild";
|
|
12377
|
+
AdwViewSwitcher: "stack";
|
|
12378
|
+
AdwViewSwitcherBar: "stack";
|
|
12379
|
+
AdwViewSwitcherTitle: "stack";
|
|
12374
12380
|
GtkSourceCompletionCell: "widget";
|
|
12381
|
+
GtkSourceGutter: "view";
|
|
12382
|
+
GtkSourceMap: "view";
|
|
12375
12383
|
VteTerminal: "contextMenu";
|
|
12384
|
+
WebKitWebView: "relatedView";
|
|
12376
12385
|
};
|
|
12377
12386
|
/**
|
|
12378
12387
|
* The base class for all widgets.
|
package/dist/nodes/index.d.ts
CHANGED
|
@@ -9,8 +9,6 @@ import "./grid-child.js";
|
|
|
9
9
|
import "./list-item.js";
|
|
10
10
|
import "./list-view.js";
|
|
11
11
|
import "./menu.js";
|
|
12
|
-
import "./navigation-page.js";
|
|
13
|
-
import "./navigation-view.js";
|
|
14
12
|
import "./notebook-page-tab.js";
|
|
15
13
|
import "./notebook-page.js";
|
|
16
14
|
import "./notebook.js";
|
|
@@ -26,7 +24,6 @@ import "./stack.js";
|
|
|
26
24
|
import "./toast-overlay.js";
|
|
27
25
|
import "./toast.js";
|
|
28
26
|
import "./toolbar-child.js";
|
|
29
|
-
import "./toolbar.js";
|
|
30
27
|
import "./tree-list-item.js";
|
|
31
28
|
import "./tree-list-view.js";
|
|
32
29
|
import "./virtual.js";
|
package/dist/nodes/index.js
CHANGED
|
@@ -9,8 +9,6 @@ import "./grid-child.js";
|
|
|
9
9
|
import "./list-item.js";
|
|
10
10
|
import "./list-view.js";
|
|
11
11
|
import "./menu.js";
|
|
12
|
-
import "./navigation-page.js";
|
|
13
|
-
import "./navigation-view.js";
|
|
14
12
|
import "./notebook-page-tab.js";
|
|
15
13
|
import "./notebook-page.js";
|
|
16
14
|
import "./notebook.js";
|
|
@@ -26,7 +24,6 @@ import "./stack.js";
|
|
|
26
24
|
import "./toast-overlay.js";
|
|
27
25
|
import "./toast.js";
|
|
28
26
|
import "./toolbar-child.js";
|
|
29
|
-
import "./toolbar.js";
|
|
30
27
|
import "./tree-list-item.js";
|
|
31
28
|
import "./tree-list-view.js";
|
|
32
29
|
import "./virtual.js";
|
|
@@ -5,6 +5,9 @@ export declare const isAppendable: (obj: unknown) => obj is Gtk.Widget & {
|
|
|
5
5
|
export declare const isAddable: (obj: unknown) => obj is Gtk.Widget & {
|
|
6
6
|
add: (child: Gtk.Widget) => void;
|
|
7
7
|
};
|
|
8
|
+
export declare const hasSingleContent: (obj: unknown) => obj is Gtk.Widget & {
|
|
9
|
+
setContent: (content: Gtk.Widget | undefined) => void;
|
|
10
|
+
};
|
|
8
11
|
export declare const isSingleChild: (obj: unknown) => obj is Gtk.Widget & {
|
|
9
12
|
setChild: (child: Gtk.Widget | null) => void;
|
|
10
13
|
};
|
|
@@ -5,6 +5,9 @@ export const isAppendable = (obj) => {
|
|
|
5
5
|
export const isAddable = (obj) => {
|
|
6
6
|
return obj instanceof Gtk.Widget && "add" in obj && typeof obj.add === "function";
|
|
7
7
|
};
|
|
8
|
+
export const hasSingleContent = (obj) => {
|
|
9
|
+
return obj instanceof Gtk.Widget && "setContent" in obj && typeof obj.setContent === "function";
|
|
10
|
+
};
|
|
8
11
|
export const isSingleChild = (obj) => {
|
|
9
12
|
return obj instanceof Gtk.Widget && "setChild" in obj && typeof obj.setChild === "function";
|
|
10
13
|
};
|
|
@@ -30,12 +30,9 @@ export class NotebookPageTabNode extends SlotNode {
|
|
|
30
30
|
}
|
|
31
31
|
const notebook = this.getNotebook();
|
|
32
32
|
const page = this.getPage();
|
|
33
|
-
// Only call setTabLabel if the page is actually in the notebook
|
|
34
|
-
// (pageNum returns -1 if not found)
|
|
35
33
|
if (notebook.pageNum(page) === -1) {
|
|
36
34
|
return;
|
|
37
35
|
}
|
|
38
|
-
// setTabLabel accepts undefined to reset to default
|
|
39
36
|
notebook.setTabLabel(page, this.child);
|
|
40
37
|
}
|
|
41
38
|
}
|
|
@@ -54,7 +54,6 @@ export class NotebookPageNode extends SlotNode {
|
|
|
54
54
|
this.tabNode = undefined;
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
|
-
// For content widget, use SlotNode's removeChild logic
|
|
58
57
|
super.removeChild();
|
|
59
58
|
}
|
|
60
59
|
unmount() {
|
|
@@ -63,7 +62,6 @@ export class NotebookPageNode extends SlotNode {
|
|
|
63
62
|
}
|
|
64
63
|
updateProps(oldProps, newProps) {
|
|
65
64
|
if (!oldProps || oldProps.label !== newProps.label) {
|
|
66
|
-
// Only update if using text label (no custom tab node)
|
|
67
65
|
if (this.child && this.parent && !this.tabNode?.child) {
|
|
68
66
|
const tabLabel = this.getNotebook().getTabLabel(this.child);
|
|
69
67
|
tabLabel.setLabel(newProps.label ?? "");
|
|
@@ -73,7 +71,6 @@ export class NotebookPageNode extends SlotNode {
|
|
|
73
71
|
attachPage() {
|
|
74
72
|
const child = this.getChild();
|
|
75
73
|
const notebook = this.getNotebook();
|
|
76
|
-
// Use custom tab widget if provided, otherwise create a Label
|
|
77
74
|
let tabLabel;
|
|
78
75
|
if (this.tabNode?.child) {
|
|
79
76
|
tabLabel = this.tabNode.child;
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { SlotNode } from "./slot.js";
|
|
3
|
-
export declare class ToolbarChildNode extends SlotNode {
|
|
4
|
-
static priority: number;
|
|
5
|
-
static matches(type: string): boolean;
|
|
6
|
-
private getToolbar;
|
|
7
|
-
private getPosition;
|
|
8
|
-
protected onChildChange(oldChild: Gtk.Widget | undefined): void;
|
|
9
|
-
}
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { registerNodeClass } from "../registry.js";
|
|
2
2
|
import { SlotNode } from "./slot.js";
|
|
3
|
-
|
|
3
|
+
class ToolbarChildNode extends SlotNode {
|
|
4
4
|
static priority = 1;
|
|
5
5
|
static matches(type) {
|
|
6
6
|
return type === "Toolbar.Top" || type === "Toolbar.Bottom";
|
package/dist/nodes/widget.js
CHANGED
|
@@ -3,7 +3,7 @@ import * as Gtk from "@gtkx/ffi/gtk";
|
|
|
3
3
|
import { CONSTRUCTOR_PROPS, PROPS, SIGNALS } from "../generated/internal.js";
|
|
4
4
|
import { Node } from "../node.js";
|
|
5
5
|
import { registerNodeClass } from "../registry.js";
|
|
6
|
-
import { isAddable, isAppendable, isEditable, isInsertable, isRemovable, isReorderable, isSingleChild, } from "./internal/predicates.js";
|
|
6
|
+
import { hasSingleContent, isAddable, isAppendable, isEditable, isInsertable, isRemovable, isReorderable, isSingleChild, } from "./internal/predicates.js";
|
|
7
7
|
import { filterProps, isContainerType } from "./internal/utils.js";
|
|
8
8
|
import { SlotNode } from "./slot.js";
|
|
9
9
|
const EVENT_CONTROLLER_PROPS = new Set([
|
|
@@ -58,6 +58,9 @@ export class WidgetNode extends Node {
|
|
|
58
58
|
}
|
|
59
59
|
this.container.add(child.container);
|
|
60
60
|
}
|
|
61
|
+
else if (hasSingleContent(this.container)) {
|
|
62
|
+
this.container.setContent(child.container);
|
|
63
|
+
}
|
|
61
64
|
else if (isSingleChild(this.container)) {
|
|
62
65
|
this.container.setChild(child.container);
|
|
63
66
|
}
|
|
@@ -80,6 +83,9 @@ export class WidgetNode extends Node {
|
|
|
80
83
|
if (isRemovable(this.container)) {
|
|
81
84
|
this.container.remove(child.container);
|
|
82
85
|
}
|
|
86
|
+
else if (hasSingleContent(this.container)) {
|
|
87
|
+
this.container.setContent(undefined);
|
|
88
|
+
}
|
|
83
89
|
else if (isSingleChild(this.container)) {
|
|
84
90
|
this.container.setChild(null);
|
|
85
91
|
}
|
package/dist/nodes/window.js
CHANGED
|
@@ -37,11 +37,6 @@ class WindowNode extends WidgetNode {
|
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
this.menu.appendChild(child);
|
|
40
|
-
if (child instanceof WidgetNode &&
|
|
41
|
-
(this.container instanceof Adw.ApplicationWindow || this.container instanceof Adw.Window)) {
|
|
42
|
-
this.container.setContent(child.container);
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
40
|
super.appendChild(child);
|
|
46
41
|
}
|
|
47
42
|
removeChild(child) {
|
|
@@ -50,11 +45,6 @@ class WindowNode extends WidgetNode {
|
|
|
50
45
|
return;
|
|
51
46
|
}
|
|
52
47
|
this.menu.removeChild(child);
|
|
53
|
-
if (child instanceof WidgetNode &&
|
|
54
|
-
(this.container instanceof Adw.ApplicationWindow || this.container instanceof Adw.Window)) {
|
|
55
|
-
this.container.setContent(undefined);
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
48
|
super.removeChild(child);
|
|
59
49
|
}
|
|
60
50
|
insertBefore(child, before) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gtkx/react",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"description": "Build GTK4 desktop applications with React and TypeScript",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"gtk",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"react-reconciler": "^0.33.0",
|
|
39
|
-
"@gtkx/ffi": "0.10.
|
|
40
|
-
"@gtkx/gir": "0.10.
|
|
39
|
+
"@gtkx/ffi": "0.10.2",
|
|
40
|
+
"@gtkx/gir": "0.10.2"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/react-reconciler": "^0.32.3",
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as Adw from "@gtkx/ffi/adw";
|
|
2
|
-
import type { AdwNavigationPageProps } from "../jsx.js";
|
|
3
|
-
import type { Node } from "../node.js";
|
|
4
|
-
import { VirtualNode } from "./virtual.js";
|
|
5
|
-
type Props = Partial<AdwNavigationPageProps>;
|
|
6
|
-
export declare class NavigationPageNode extends VirtualNode<Props> {
|
|
7
|
-
static priority: number;
|
|
8
|
-
private parent?;
|
|
9
|
-
private child?;
|
|
10
|
-
private page?;
|
|
11
|
-
static matches(type: string): boolean;
|
|
12
|
-
setParent(parent?: Adw.NavigationView): void;
|
|
13
|
-
appendChild(child: Node): void;
|
|
14
|
-
removeChild(): void;
|
|
15
|
-
unmount(): void;
|
|
16
|
-
updateProps(oldProps: Props | null, newProps: Props): void;
|
|
17
|
-
private onChildChange;
|
|
18
|
-
private addPage;
|
|
19
|
-
private removePage;
|
|
20
|
-
}
|
|
21
|
-
export {};
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import * as Adw from "@gtkx/ffi/adw";
|
|
2
|
-
import { registerNodeClass } from "../registry.js";
|
|
3
|
-
import { scheduleAfterCommit } from "../scheduler.js";
|
|
4
|
-
import { VirtualNode } from "./virtual.js";
|
|
5
|
-
import { WidgetNode } from "./widget.js";
|
|
6
|
-
export class NavigationPageNode extends VirtualNode {
|
|
7
|
-
static priority = -1;
|
|
8
|
-
parent;
|
|
9
|
-
child;
|
|
10
|
-
page;
|
|
11
|
-
static matches(type) {
|
|
12
|
-
return type === "AdwNavigationPage";
|
|
13
|
-
}
|
|
14
|
-
setParent(parent) {
|
|
15
|
-
this.parent = parent;
|
|
16
|
-
}
|
|
17
|
-
appendChild(child) {
|
|
18
|
-
if (!(child instanceof WidgetNode)) {
|
|
19
|
-
throw new Error(`Cannot append '${child.typeName}' to 'NavigationPage': expected Widget`);
|
|
20
|
-
}
|
|
21
|
-
const oldChild = this.child;
|
|
22
|
-
this.child = child.container;
|
|
23
|
-
scheduleAfterCommit(() => {
|
|
24
|
-
if (this.parent) {
|
|
25
|
-
this.onChildChange(oldChild);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
removeChild() {
|
|
30
|
-
const oldChild = this.child;
|
|
31
|
-
scheduleAfterCommit(() => {
|
|
32
|
-
if (oldChild === this.child) {
|
|
33
|
-
this.child = undefined;
|
|
34
|
-
}
|
|
35
|
-
if (this.parent) {
|
|
36
|
-
this.onChildChange(oldChild);
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
unmount() {
|
|
41
|
-
if (this.parent && this.child) {
|
|
42
|
-
const oldChild = this.child;
|
|
43
|
-
this.child = undefined;
|
|
44
|
-
this.onChildChange(oldChild);
|
|
45
|
-
}
|
|
46
|
-
this.parent = undefined;
|
|
47
|
-
super.unmount();
|
|
48
|
-
}
|
|
49
|
-
updateProps(oldProps, newProps) {
|
|
50
|
-
super.updateProps(oldProps, newProps);
|
|
51
|
-
if (!this.page) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
if (newProps.title && (!oldProps || oldProps.title !== newProps.title)) {
|
|
55
|
-
this.page.setTitle(newProps.title);
|
|
56
|
-
}
|
|
57
|
-
if (!oldProps || oldProps.tag !== newProps.tag) {
|
|
58
|
-
this.page.setTag(newProps.tag);
|
|
59
|
-
}
|
|
60
|
-
if (!oldProps || oldProps.canPop !== newProps.canPop) {
|
|
61
|
-
this.page.setCanPop(newProps.canPop ?? true);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
onChildChange(oldChild) {
|
|
65
|
-
if (oldChild) {
|
|
66
|
-
this.removePage();
|
|
67
|
-
}
|
|
68
|
-
if (this.child) {
|
|
69
|
-
this.addPage();
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
addPage() {
|
|
73
|
-
if (!this.child || !this.parent) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
let page;
|
|
77
|
-
if (this.props.tag) {
|
|
78
|
-
page = Adw.NavigationPage.pageNewWithTag(this.child, this.props.title ?? "", this.props.tag);
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
page = new Adw.NavigationPage(this.child, this.props.title ?? "");
|
|
82
|
-
}
|
|
83
|
-
this.page = page;
|
|
84
|
-
this.parent.add(page);
|
|
85
|
-
this.updateProps(null, this.props);
|
|
86
|
-
}
|
|
87
|
-
removePage() {
|
|
88
|
-
if (!this.page || !this.parent) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
this.parent.remove(this.page);
|
|
92
|
-
this.page = undefined;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
registerNodeClass(NavigationPageNode);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import * as Adw from "@gtkx/ffi/adw";
|
|
2
|
-
import { registerNodeClass } from "../registry.js";
|
|
3
|
-
import { isContainerType } from "./internal/utils.js";
|
|
4
|
-
import { NavigationPageNode } from "./navigation-page.js";
|
|
5
|
-
import { WidgetNode } from "./widget.js";
|
|
6
|
-
class NavigationViewNode extends WidgetNode {
|
|
7
|
-
static priority = -1;
|
|
8
|
-
static matches(_type, containerOrClass) {
|
|
9
|
-
return isContainerType(Adw.NavigationView, containerOrClass);
|
|
10
|
-
}
|
|
11
|
-
appendChild(child) {
|
|
12
|
-
if (child instanceof NavigationPageNode) {
|
|
13
|
-
child.setParent(this.container);
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
super.appendChild(child);
|
|
17
|
-
}
|
|
18
|
-
insertBefore(child, _before) {
|
|
19
|
-
this.appendChild(child);
|
|
20
|
-
}
|
|
21
|
-
removeChild(child) {
|
|
22
|
-
if (child instanceof NavigationPageNode) {
|
|
23
|
-
child.unmount();
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
super.removeChild(child);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
registerNodeClass(NavigationViewNode);
|
package/dist/nodes/toolbar.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/nodes/toolbar.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import * as Adw from "@gtkx/ffi/adw";
|
|
2
|
-
import { registerNodeClass } from "../registry.js";
|
|
3
|
-
import { isContainerType } from "./internal/utils.js";
|
|
4
|
-
import { ToolbarChildNode } from "./toolbar-child.js";
|
|
5
|
-
import { WidgetNode } from "./widget.js";
|
|
6
|
-
class ToolbarNode extends WidgetNode {
|
|
7
|
-
static priority = 0;
|
|
8
|
-
static matches(_type, containerOrClass) {
|
|
9
|
-
return isContainerType(Adw.ToolbarView, containerOrClass);
|
|
10
|
-
}
|
|
11
|
-
appendChild(child) {
|
|
12
|
-
if (child instanceof ToolbarChildNode) {
|
|
13
|
-
child.setParent(this.container);
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
if (!(child instanceof WidgetNode)) {
|
|
17
|
-
throw new Error(`Cannot append '${child.typeName}' to 'ToolbarView': expected Widget`);
|
|
18
|
-
}
|
|
19
|
-
this.container.setContent(child.container);
|
|
20
|
-
}
|
|
21
|
-
insertBefore(child) {
|
|
22
|
-
if (child instanceof ToolbarChildNode) {
|
|
23
|
-
child.setParent(this.container);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
if (!(child instanceof WidgetNode)) {
|
|
27
|
-
throw new Error(`Cannot insert '${child.typeName}' to 'ToolbarView': expected Widget`);
|
|
28
|
-
}
|
|
29
|
-
this.container.setContent(child.container);
|
|
30
|
-
}
|
|
31
|
-
removeChild(child) {
|
|
32
|
-
if (child instanceof ToolbarChildNode) {
|
|
33
|
-
child.unmount();
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
if (!(child instanceof WidgetNode)) {
|
|
37
|
-
throw new Error(`Cannot remove '${child.typeName}' from 'ToolbarView': expected Widget`);
|
|
38
|
-
}
|
|
39
|
-
this.container.setContent(undefined);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
registerNodeClass(ToolbarNode);
|