@gtkx/react 0.17.3 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/dist/factory.d.ts +0 -1
  2. package/dist/factory.js +21 -8
  3. package/dist/generated/internal.d.ts +4 -51
  4. package/dist/generated/internal.js +626 -412
  5. package/dist/generated/jsx.d.ts +453 -958
  6. package/dist/host-config.d.ts +1 -1
  7. package/dist/host-config.js +18 -23
  8. package/dist/index.d.ts +1 -1
  9. package/dist/index.js +1 -1
  10. package/dist/jsx.d.ts +579 -302
  11. package/dist/jsx.js +37 -179
  12. package/dist/metadata.d.ts +3 -0
  13. package/dist/metadata.js +26 -0
  14. package/dist/node.d.ts +20 -12
  15. package/dist/node.js +72 -17
  16. package/dist/nodes/adjustable.d.ts +3 -16
  17. package/dist/nodes/adjustable.js +5 -22
  18. package/dist/nodes/alert-dialog-response.d.ts +14 -1
  19. package/dist/nodes/alert-dialog-response.js +36 -62
  20. package/dist/nodes/animation.d.ts +37 -1
  21. package/dist/nodes/animation.js +162 -105
  22. package/dist/nodes/application.d.ts +11 -1
  23. package/dist/nodes/application.js +17 -38
  24. package/dist/nodes/calendar.d.ts +13 -0
  25. package/dist/nodes/calendar.js +10 -16
  26. package/dist/nodes/color-dialog-button.d.ts +13 -0
  27. package/dist/nodes/color-dialog-button.js +10 -38
  28. package/dist/nodes/column-view-column.d.ts +13 -11
  29. package/dist/nodes/column-view-column.js +27 -23
  30. package/dist/nodes/column-view.d.ts +31 -0
  31. package/dist/nodes/column-view.js +44 -44
  32. package/dist/nodes/container-slot.d.ts +15 -0
  33. package/dist/nodes/container-slot.js +68 -0
  34. package/dist/nodes/dialog.d.ts +6 -8
  35. package/dist/nodes/dialog.js +12 -13
  36. package/dist/nodes/drawing-area.d.ts +12 -0
  37. package/dist/nodes/drawing-area.js +24 -24
  38. package/dist/nodes/drop-down.d.ts +22 -0
  39. package/dist/nodes/drop-down.js +72 -0
  40. package/dist/nodes/event-controller.d.ts +8 -17
  41. package/dist/nodes/event-controller.js +20 -42
  42. package/dist/nodes/fixed-child.d.ts +18 -1
  43. package/dist/nodes/fixed-child.js +52 -36
  44. package/dist/nodes/font-dialog-button.d.ts +13 -0
  45. package/dist/nodes/font-dialog-button.js +12 -35
  46. package/dist/nodes/grid-child.d.ts +17 -1
  47. package/dist/nodes/grid-child.js +57 -37
  48. package/dist/nodes/grid-view.d.ts +24 -0
  49. package/dist/nodes/grid-view.js +73 -0
  50. package/dist/nodes/internal/base-item-renderer.d.ts +7 -9
  51. package/dist/nodes/internal/base-item-renderer.js +15 -18
  52. package/dist/nodes/internal/grid-item-renderer.d.ts +17 -0
  53. package/dist/nodes/internal/grid-item-renderer.js +59 -0
  54. package/dist/nodes/internal/list-item-renderer.d.ts +14 -9
  55. package/dist/nodes/internal/list-item-renderer.js +96 -35
  56. package/dist/nodes/internal/list-store.d.ts +5 -0
  57. package/dist/nodes/internal/list-store.js +39 -9
  58. package/dist/nodes/internal/predicates.d.ts +4 -19
  59. package/dist/nodes/internal/predicates.js +1 -20
  60. package/dist/nodes/internal/props.d.ts +5 -0
  61. package/dist/nodes/internal/props.js +42 -0
  62. package/dist/nodes/internal/{selection-model.d.ts → selection-model-controller.d.ts} +4 -9
  63. package/dist/nodes/internal/{selection-model.js → selection-model-controller.js} +6 -15
  64. package/dist/nodes/internal/signal-store.js +12 -5
  65. package/dist/nodes/internal/simple-list-store.d.ts +5 -0
  66. package/dist/nodes/internal/simple-list-store.js +42 -13
  67. package/dist/nodes/internal/text-buffer-controller.d.ts +4 -12
  68. package/dist/nodes/internal/text-buffer-controller.js +32 -33
  69. package/dist/nodes/internal/tree-store.d.ts +7 -0
  70. package/dist/nodes/internal/tree-store.js +75 -18
  71. package/dist/nodes/internal/widget.d.ts +7 -0
  72. package/dist/nodes/internal/widget.js +68 -0
  73. package/dist/nodes/level-bar.d.ts +10 -0
  74. package/dist/nodes/level-bar.js +11 -22
  75. package/dist/nodes/list-item.d.ts +17 -9
  76. package/dist/nodes/list-item.js +67 -12
  77. package/dist/nodes/list-view.d.ts +23 -0
  78. package/dist/nodes/list-view.js +27 -31
  79. package/dist/nodes/menu.d.ts +2 -4
  80. package/dist/nodes/menu.js +0 -6
  81. package/dist/nodes/models/grid.d.ts +27 -0
  82. package/dist/nodes/models/grid.js +68 -0
  83. package/dist/nodes/models/list.d.ts +15 -13
  84. package/dist/nodes/models/list.js +48 -26
  85. package/dist/nodes/models/menu.d.ts +15 -16
  86. package/dist/nodes/models/menu.js +63 -93
  87. package/dist/nodes/navigation-page.d.ts +16 -10
  88. package/dist/nodes/navigation-page.js +108 -31
  89. package/dist/nodes/navigation-view.d.ts +15 -0
  90. package/dist/nodes/navigation-view.js +15 -65
  91. package/dist/nodes/notebook-page-tab.d.ts +10 -12
  92. package/dist/nodes/notebook-page-tab.js +24 -27
  93. package/dist/nodes/notebook-page.d.ts +19 -16
  94. package/dist/nodes/notebook-page.js +75 -56
  95. package/dist/nodes/notebook.d.ts +10 -1
  96. package/dist/nodes/notebook.js +10 -22
  97. package/dist/nodes/overlay-child.d.ts +17 -1
  98. package/dist/nodes/overlay-child.js +53 -75
  99. package/dist/nodes/popover-menu.d.ts +15 -0
  100. package/dist/nodes/popover-menu.js +13 -26
  101. package/dist/nodes/scale.d.ts +8 -0
  102. package/dist/nodes/scale.js +2 -11
  103. package/dist/nodes/scrolled-window.d.ts +9 -0
  104. package/dist/nodes/scrolled-window.js +5 -11
  105. package/dist/nodes/search-bar.d.ts +9 -0
  106. package/dist/nodes/search-bar.js +8 -33
  107. package/dist/nodes/shortcut-controller.d.ts +9 -1
  108. package/dist/nodes/shortcut-controller.js +12 -25
  109. package/dist/nodes/shortcut.d.ts +11 -33
  110. package/dist/nodes/shortcut.js +19 -15
  111. package/dist/nodes/slot.d.ts +16 -15
  112. package/dist/nodes/slot.js +63 -57
  113. package/dist/nodes/source-view.d.ts +16 -0
  114. package/dist/nodes/source-view.js +44 -44
  115. package/dist/nodes/stack-page.d.ts +21 -1
  116. package/dist/nodes/stack-page.js +68 -17
  117. package/dist/nodes/stack.d.ts +11 -0
  118. package/dist/nodes/stack.js +8 -26
  119. package/dist/nodes/text-anchor.d.ts +11 -30
  120. package/dist/nodes/text-anchor.js +20 -22
  121. package/dist/nodes/text-content.d.ts +1 -0
  122. package/dist/nodes/text-content.js +1 -1
  123. package/dist/nodes/text-paintable.d.ts +10 -15
  124. package/dist/nodes/text-paintable.js +16 -9
  125. package/dist/nodes/text-segment.d.ts +12 -10
  126. package/dist/nodes/text-segment.js +19 -11
  127. package/dist/nodes/text-tag.d.ts +20 -119
  128. package/dist/nodes/text-tag.js +153 -119
  129. package/dist/nodes/text-view.d.ts +13 -18
  130. package/dist/nodes/text-view.js +17 -17
  131. package/dist/nodes/toggle-group.d.ts +9 -0
  132. package/dist/nodes/toggle-group.js +8 -33
  133. package/dist/nodes/toggle.d.ts +15 -1
  134. package/dist/nodes/toggle.js +34 -52
  135. package/dist/nodes/virtual.d.ts +3 -10
  136. package/dist/nodes/virtual.js +1 -14
  137. package/dist/nodes/web-view.d.ts +9 -0
  138. package/dist/nodes/web-view.js +10 -24
  139. package/dist/nodes/widget.d.ts +17 -13
  140. package/dist/nodes/widget.js +185 -112
  141. package/dist/nodes/window.d.ts +20 -21
  142. package/dist/nodes/window.js +54 -35
  143. package/dist/registry.d.ts +17 -6
  144. package/dist/registry.js +104 -5
  145. package/dist/render.d.ts +0 -9
  146. package/dist/render.js +0 -11
  147. package/package.json +3 -3
  148. package/dist/animation/css-builder.d.ts +0 -3
  149. package/dist/animation/css-builder.js +0 -53
  150. package/dist/animation/types.d.ts +0 -120
  151. package/dist/animation/types.js +0 -1
  152. package/dist/nodes/abstract/positional-child.d.ts +0 -9
  153. package/dist/nodes/abstract/positional-child.js +0 -29
  154. package/dist/nodes/abstract/virtual-container.d.ts +0 -21
  155. package/dist/nodes/abstract/virtual-container.js +0 -68
  156. package/dist/nodes/abstract/virtual-single-child.d.ts +0 -18
  157. package/dist/nodes/abstract/virtual-single-child.js +0 -55
  158. package/dist/nodes/action-row-child.d.ts +0 -1
  159. package/dist/nodes/action-row-child.js +0 -30
  160. package/dist/nodes/autowrapped.d.ts +0 -1
  161. package/dist/nodes/autowrapped.js +0 -115
  162. package/dist/nodes/expander-row-child.d.ts +0 -1
  163. package/dist/nodes/expander-row-child.js +0 -30
  164. package/dist/nodes/grid.d.ts +0 -1
  165. package/dist/nodes/grid.js +0 -41
  166. package/dist/nodes/index.d.ts +0 -56
  167. package/dist/nodes/index.js +0 -56
  168. package/dist/nodes/internal/child-attachment.d.ts +0 -26
  169. package/dist/nodes/internal/child-attachment.js +0 -48
  170. package/dist/nodes/internal/deferred-action.d.ts +0 -9
  171. package/dist/nodes/internal/deferred-action.js +0 -22
  172. package/dist/nodes/internal/text-tag-styles.d.ts +0 -43
  173. package/dist/nodes/internal/text-tag-styles.js +0 -52
  174. package/dist/nodes/internal/tree-list-item-renderer.d.ts +0 -26
  175. package/dist/nodes/internal/tree-list-item-renderer.js +0 -134
  176. package/dist/nodes/internal/utils.d.ts +0 -12
  177. package/dist/nodes/internal/utils.js +0 -92
  178. package/dist/nodes/models/tree-list.d.ts +0 -28
  179. package/dist/nodes/models/tree-list.js +0 -113
  180. package/dist/nodes/pack-child.d.ts +0 -1
  181. package/dist/nodes/pack-child.js +0 -30
  182. package/dist/nodes/simple-list-item.d.ts +0 -9
  183. package/dist/nodes/simple-list-item.js +0 -9
  184. package/dist/nodes/simple-list-view.d.ts +0 -1
  185. package/dist/nodes/simple-list-view.js +0 -74
  186. package/dist/nodes/toolbar-child.d.ts +0 -1
  187. package/dist/nodes/toolbar-child.js +0 -30
  188. package/dist/nodes/tree-list-item.d.ts +0 -22
  189. package/dist/nodes/tree-list-item.js +0 -90
  190. package/dist/nodes/tree-list-view.d.ts +0 -1
  191. package/dist/nodes/tree-list-view.js +0 -77
  192. package/dist/scheduler.d.ts +0 -26
  193. package/dist/scheduler.js +0 -42
@@ -1,55 +0,0 @@
1
- import { isObjectEqual } from "@gtkx/ffi";
2
- import { CommitPriority, scheduleAfterCommit } from "../../scheduler.js";
3
- import { VirtualNode } from "../virtual.js";
4
- import { WidgetNode } from "../widget.js";
5
- export class VirtualSingleChildNode extends VirtualNode {
6
- parent = null;
7
- child = null;
8
- setParent(parent) {
9
- this.parent = parent;
10
- }
11
- getParent() {
12
- if (!this.parent) {
13
- throw new Error(`Expected parent widget to be set on ${this.typeName}`);
14
- }
15
- return this.parent;
16
- }
17
- getTypedParent() {
18
- return this.getParent();
19
- }
20
- appendChild(child) {
21
- if (!(child instanceof WidgetNode)) {
22
- throw new Error(`Cannot append '${child.typeName}' to '${this.typeName}': expected Widget`);
23
- }
24
- const oldChild = this.child;
25
- this.child = child.container;
26
- scheduleAfterCommit(() => {
27
- if (this.parent) {
28
- this.onChildChange(oldChild);
29
- }
30
- }, CommitPriority.NORMAL);
31
- }
32
- removeChild(child) {
33
- if (!(child instanceof WidgetNode)) {
34
- throw new Error(`Cannot remove '${child.typeName}' from '${this.typeName}': expected Widget`);
35
- }
36
- const oldChild = this.child;
37
- scheduleAfterCommit(() => {
38
- if (isObjectEqual(oldChild, this.child)) {
39
- this.child = null;
40
- }
41
- if (this.parent && oldChild) {
42
- this.onChildChange(oldChild);
43
- }
44
- }, CommitPriority.HIGH);
45
- }
46
- canBeChildOf(parent) {
47
- return parent instanceof WidgetNode;
48
- }
49
- attachTo(parent) {
50
- if (parent instanceof WidgetNode) {
51
- this.setParent(parent.container);
52
- }
53
- }
54
- detachFrom(_parent) { }
55
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,30 +0,0 @@
1
- import { PREFIX_SUFFIX_INTERFACE_METHODS } from "../generated/internal.js";
2
- import { registerNodeClass } from "../registry.js";
3
- import { VirtualContainerNode } from "./abstract/virtual-container.js";
4
- import { matchesInterface } from "./internal/utils.js";
5
- class ActionRowPrefixNode extends VirtualContainerNode {
6
- static priority = 1;
7
- static matches(type) {
8
- return type === "ActionRowPrefix";
9
- }
10
- canBeChildOf(parent) {
11
- return matchesInterface(PREFIX_SUFFIX_INTERFACE_METHODS, parent.container);
12
- }
13
- attachChild(parent, widget) {
14
- parent.addPrefix(widget);
15
- }
16
- }
17
- class ActionRowSuffixNode extends VirtualContainerNode {
18
- static priority = 1;
19
- static matches(type) {
20
- return type === "ActionRowSuffix";
21
- }
22
- canBeChildOf(parent) {
23
- return matchesInterface(PREFIX_SUFFIX_INTERFACE_METHODS, parent.container);
24
- }
25
- attachChild(parent, widget) {
26
- parent.addSuffix(widget);
27
- }
28
- }
29
- registerNodeClass(ActionRowPrefixNode);
30
- registerNodeClass(ActionRowSuffixNode);
@@ -1 +0,0 @@
1
- export {};
@@ -1,115 +0,0 @@
1
- import { isObjectEqual } from "@gtkx/ffi";
2
- import * as Gtk from "@gtkx/ffi/gtk";
3
- import { AUTOWRAP_CLASSES } from "../generated/internal.js";
4
- import { registerNodeClass } from "../registry.js";
5
- import { isRemovable, isSingleChild } from "./internal/predicates.js";
6
- import { matchesAnyClass } from "./internal/utils.js";
7
- import { SlotNode } from "./slot.js";
8
- import { WidgetNode } from "./widget.js";
9
- const isAutowrappedChild = (obj) => {
10
- return obj instanceof Gtk.ListBoxRow || obj instanceof Gtk.FlowBoxChild;
11
- };
12
- class AutowrappedNode extends WidgetNode {
13
- static priority = 1;
14
- static matches(_type, containerOrClass) {
15
- return matchesAnyClass(AUTOWRAP_CLASSES, containerOrClass);
16
- }
17
- appendChild(child) {
18
- if (child instanceof SlotNode) {
19
- super.appendChild(child);
20
- return;
21
- }
22
- if (!(child instanceof WidgetNode)) {
23
- throw new Error(`Cannot append '${child.typeName}' to 'ListBox/FlowBox': expected Widget`);
24
- }
25
- if (isAutowrappedChild(child.container)) {
26
- const currentParent = child.container.getParent();
27
- if (currentParent !== null && isRemovable(currentParent)) {
28
- currentParent.remove(child.container);
29
- }
30
- }
31
- else {
32
- this.removeExistingWrapper(child.container);
33
- }
34
- this.container.append(child.container);
35
- }
36
- removeChild(child) {
37
- if (child instanceof SlotNode) {
38
- super.removeChild(child);
39
- return;
40
- }
41
- if (!(child instanceof WidgetNode)) {
42
- throw new Error(`Cannot remove '${child.typeName}' from 'ListBox/FlowBox': expected Widget`);
43
- }
44
- if (!isAutowrappedChild(child.container)) {
45
- const wrapper = child.container.getParent();
46
- if (wrapper && isSingleChild(wrapper)) {
47
- wrapper.setChild(null);
48
- this.container.remove(wrapper);
49
- return;
50
- }
51
- }
52
- this.container.remove(child.container);
53
- }
54
- insertBefore(child, before) {
55
- if (child instanceof SlotNode) {
56
- super.insertBefore(child, before);
57
- return;
58
- }
59
- if (!(child instanceof WidgetNode) || !(before instanceof WidgetNode)) {
60
- throw new Error(`Cannot insert '${child.typeName}' into 'ListBox/FlowBox': expected Widget`);
61
- }
62
- const currentParent = child.container.getParent();
63
- if (currentParent !== null) {
64
- if (isAutowrappedChild(child.container)) {
65
- if (isRemovable(currentParent)) {
66
- currentParent.remove(child.container);
67
- }
68
- }
69
- else {
70
- this.removeExistingWrapper(child.container);
71
- }
72
- }
73
- else if (!isAutowrappedChild(child.container)) {
74
- this.removeExistingWrapper(child.container);
75
- }
76
- const position = this.findChildPosition(before);
77
- if (position !== null) {
78
- this.container.insert(child.container, position);
79
- }
80
- else {
81
- this.container.append(child.container);
82
- }
83
- }
84
- removeExistingWrapper(childWidget) {
85
- const existingWrapper = childWidget.getParent();
86
- if (existingWrapper && isSingleChild(existingWrapper)) {
87
- existingWrapper.setChild(null);
88
- const wrapperParent = existingWrapper.getParent();
89
- if (wrapperParent !== null && isRemovable(wrapperParent)) {
90
- wrapperParent.remove(existingWrapper);
91
- }
92
- }
93
- }
94
- findChildPosition(before) {
95
- let position = 0;
96
- let currentChild = this.container.getFirstChild();
97
- const beforeIsWrapper = isAutowrappedChild(before.container);
98
- while (currentChild) {
99
- const widgetToCompare = beforeIsWrapper ? currentChild : this.unwrapChild(currentChild);
100
- if (widgetToCompare && isObjectEqual(widgetToCompare, before.container)) {
101
- return position;
102
- }
103
- position++;
104
- currentChild = currentChild.getNextSibling();
105
- }
106
- return null;
107
- }
108
- unwrapChild(child) {
109
- if ("getChild" in child && typeof child.getChild === "function") {
110
- return child.getChild();
111
- }
112
- return child;
113
- }
114
- }
115
- registerNodeClass(AutowrappedNode);
@@ -1 +0,0 @@
1
- export {};
@@ -1,30 +0,0 @@
1
- import { registerNodeClass } from "../registry.js";
2
- import { VirtualContainerNode } from "./abstract/virtual-container.js";
3
- import { matchesInterface } from "./internal/utils.js";
4
- const EXPANDER_ROW_INTERFACE_METHODS = ["addRow", "addAction", "remove"];
5
- class ExpanderRowRowNode extends VirtualContainerNode {
6
- static priority = 1;
7
- static matches(type) {
8
- return type === "ExpanderRowRow";
9
- }
10
- canBeChildOf(parent) {
11
- return matchesInterface(EXPANDER_ROW_INTERFACE_METHODS, parent.container);
12
- }
13
- attachChild(parent, widget) {
14
- parent.addRow(widget);
15
- }
16
- }
17
- class ExpanderRowActionNode extends VirtualContainerNode {
18
- static priority = 1;
19
- static matches(type) {
20
- return type === "ExpanderRowAction";
21
- }
22
- canBeChildOf(parent) {
23
- return matchesInterface(EXPANDER_ROW_INTERFACE_METHODS, parent.container);
24
- }
25
- attachChild(parent, widget) {
26
- parent.addAction(widget);
27
- }
28
- }
29
- registerNodeClass(ExpanderRowRowNode);
30
- registerNodeClass(ExpanderRowActionNode);
@@ -1 +0,0 @@
1
- export {};
@@ -1,41 +0,0 @@
1
- import * as Gtk from "@gtkx/ffi/gtk";
2
- import { registerNodeClass } from "../registry.js";
3
- import { isAttachable } from "./internal/predicates.js";
4
- import { matchesAnyClass } from "./internal/utils.js";
5
- import { SlotNode } from "./slot.js";
6
- import { WidgetNode } from "./widget.js";
7
- class GridNode extends WidgetNode {
8
- static priority = 0;
9
- static matches(_type, containerOrClass) {
10
- return matchesAnyClass([Gtk.Grid], containerOrClass);
11
- }
12
- isGridChild(child) {
13
- return child.typeName === "GridChild";
14
- }
15
- appendChild(child) {
16
- if (child instanceof SlotNode) {
17
- super.appendChild(child);
18
- return;
19
- }
20
- if (isAttachable(child) && this.isGridChild(child)) {
21
- child.attachTo(this);
22
- return;
23
- }
24
- throw new Error(`Cannot append '${child.typeName}' to 'Grid': expected x.GridChild`);
25
- }
26
- insertBefore(child, _before) {
27
- this.appendChild(child);
28
- }
29
- removeChild(child) {
30
- if (child instanceof SlotNode) {
31
- super.removeChild(child);
32
- return;
33
- }
34
- if (isAttachable(child) && this.isGridChild(child)) {
35
- child.detachFrom(this);
36
- return;
37
- }
38
- throw new Error(`Cannot remove '${child.typeName}' from 'Grid': expected x.GridChild`);
39
- }
40
- }
41
- registerNodeClass(GridNode);
@@ -1,56 +0,0 @@
1
- import "./adjustable.js";
2
- import "./animation.js";
3
- import "./alert-dialog-response.js";
4
- import "./application.js";
5
- import "./autowrapped.js";
6
- import "./calendar.js";
7
- import "./color-dialog-button.js";
8
- import "./column-view-column.js";
9
- import "./column-view.js";
10
- import "./dialog.js";
11
- import "./drawing-area.js";
12
- import "./fixed-child.js";
13
- import "./font-dialog-button.js";
14
- import "./grid.js";
15
- import "./grid-child.js";
16
- import "./level-bar.js";
17
- import "./list-item.js";
18
- import "./list-view.js";
19
- import "./menu.js";
20
- import "./navigation-page.js";
21
- import "./navigation-view.js";
22
- import "./notebook-page-tab.js";
23
- import "./notebook-page.js";
24
- import "./notebook.js";
25
- import "./overlay-child.js";
26
- import "./popover-menu.js";
27
- import "./scale.js";
28
- import "./scrolled-window.js";
29
- import "./search-bar.js";
30
- import "./shortcut-controller.js";
31
- import "./shortcut.js";
32
- import "./event-controller.js";
33
- import "./simple-list-item.js";
34
- import "./simple-list-view.js";
35
- import "./slot.js";
36
- import "./source-view.js";
37
- import "./stack-page.js";
38
- import "./stack.js";
39
- import "./text-anchor.js";
40
- import "./text-content.js";
41
- import "./text-paintable.js";
42
- import "./text-segment.js";
43
- import "./text-tag.js";
44
- import "./text-view.js";
45
- import "./toggle.js";
46
- import "./toggle-group.js";
47
- import "./toolbar-child.js";
48
- import "./tree-list-item.js";
49
- import "./tree-list-view.js";
50
- import "./virtual.js";
51
- import "./web-view.js";
52
- import "./action-row-child.js";
53
- import "./expander-row-child.js";
54
- import "./pack-child.js";
55
- import "./widget.js";
56
- import "./window.js";
@@ -1,56 +0,0 @@
1
- import "./adjustable.js";
2
- import "./animation.js";
3
- import "./alert-dialog-response.js";
4
- import "./application.js";
5
- import "./autowrapped.js";
6
- import "./calendar.js";
7
- import "./color-dialog-button.js";
8
- import "./column-view-column.js";
9
- import "./column-view.js";
10
- import "./dialog.js";
11
- import "./drawing-area.js";
12
- import "./fixed-child.js";
13
- import "./font-dialog-button.js";
14
- import "./grid.js";
15
- import "./grid-child.js";
16
- import "./level-bar.js";
17
- import "./list-item.js";
18
- import "./list-view.js";
19
- import "./menu.js";
20
- import "./navigation-page.js";
21
- import "./navigation-view.js";
22
- import "./notebook-page-tab.js";
23
- import "./notebook-page.js";
24
- import "./notebook.js";
25
- import "./overlay-child.js";
26
- import "./popover-menu.js";
27
- import "./scale.js";
28
- import "./scrolled-window.js";
29
- import "./search-bar.js";
30
- import "./shortcut-controller.js";
31
- import "./shortcut.js";
32
- import "./event-controller.js";
33
- import "./simple-list-item.js";
34
- import "./simple-list-view.js";
35
- import "./slot.js";
36
- import "./source-view.js";
37
- import "./stack-page.js";
38
- import "./stack.js";
39
- import "./text-anchor.js";
40
- import "./text-content.js";
41
- import "./text-paintable.js";
42
- import "./text-segment.js";
43
- import "./text-tag.js";
44
- import "./text-view.js";
45
- import "./toggle.js";
46
- import "./toggle-group.js";
47
- import "./toolbar-child.js";
48
- import "./tree-list-item.js";
49
- import "./tree-list-view.js";
50
- import "./virtual.js";
51
- import "./web-view.js";
52
- import "./action-row-child.js";
53
- import "./expander-row-child.js";
54
- import "./pack-child.js";
55
- import "./widget.js";
56
- import "./window.js";
@@ -1,26 +0,0 @@
1
- import type * as Gtk from "@gtkx/ffi/gtk";
2
- type AttachmentStrategy = {
3
- type: "appendable";
4
- container: Gtk.Widget & {
5
- append(child: Gtk.Widget): void;
6
- };
7
- } | {
8
- type: "addable";
9
- container: Gtk.Widget & {
10
- add(child: Gtk.Widget): void;
11
- };
12
- } | {
13
- type: "content";
14
- container: Gtk.Widget & {
15
- setContent(content: Gtk.Widget | null): void;
16
- };
17
- } | {
18
- type: "singleChild";
19
- container: Gtk.Widget & {
20
- setChild(child: Gtk.Widget | null): void;
21
- };
22
- };
23
- export declare const getAttachmentStrategy: (container: Gtk.Widget) => AttachmentStrategy | null;
24
- export declare const attachChild: (child: Gtk.Widget, strategy: AttachmentStrategy) => void;
25
- export declare const detachChild: (child: Gtk.Widget, strategy: AttachmentStrategy) => void;
26
- export {};
@@ -1,48 +0,0 @@
1
- import { isAddable, isAppendable, isContentWidget, isRemovable, isSingleChild } from "./predicates.js";
2
- export const getAttachmentStrategy = (container) => {
3
- if (isAppendable(container)) {
4
- return { type: "appendable", container };
5
- }
6
- if (isAddable(container)) {
7
- return { type: "addable", container };
8
- }
9
- if (isContentWidget(container)) {
10
- return { type: "content", container };
11
- }
12
- if (isSingleChild(container)) {
13
- return { type: "singleChild", container };
14
- }
15
- return null;
16
- };
17
- export const attachChild = (child, strategy) => {
18
- switch (strategy.type) {
19
- case "appendable":
20
- strategy.container.append(child);
21
- break;
22
- case "addable":
23
- strategy.container.add(child);
24
- break;
25
- case "content":
26
- strategy.container.setContent(child);
27
- break;
28
- case "singleChild":
29
- strategy.container.setChild(child);
30
- break;
31
- }
32
- };
33
- export const detachChild = (child, strategy) => {
34
- switch (strategy.type) {
35
- case "appendable":
36
- case "addable":
37
- if (isRemovable(strategy.container)) {
38
- strategy.container.remove(child);
39
- }
40
- break;
41
- case "content":
42
- strategy.container.setContent(null);
43
- break;
44
- case "singleChild":
45
- strategy.container.setChild(null);
46
- break;
47
- }
48
- };
@@ -1,9 +0,0 @@
1
- import { type CommitPriority } from "../../scheduler.js";
2
- export declare class DeferredAction {
3
- private action;
4
- private priority;
5
- private scheduled;
6
- constructor(action: () => void, priority: CommitPriority);
7
- get isPending(): boolean;
8
- schedule(): void;
9
- }
@@ -1,22 +0,0 @@
1
- import { scheduleAfterCommit } from "../../scheduler.js";
2
- export class DeferredAction {
3
- action;
4
- priority;
5
- scheduled = false;
6
- constructor(action, priority) {
7
- this.action = action;
8
- this.priority = priority;
9
- }
10
- get isPending() {
11
- return this.scheduled;
12
- }
13
- schedule() {
14
- if (this.scheduled)
15
- return;
16
- this.scheduled = true;
17
- scheduleAfterCommit(() => {
18
- this.scheduled = false;
19
- this.action();
20
- }, this.priority);
21
- }
22
- }
@@ -1,43 +0,0 @@
1
- import type * as Gtk from "@gtkx/ffi/gtk";
2
- import type * as Pango from "@gtkx/ffi/pango";
3
- export type TagStyleProps = {
4
- background?: string;
5
- backgroundFullHeight?: boolean;
6
- foreground?: string;
7
- family?: string;
8
- font?: string;
9
- sizePoints?: number;
10
- size?: number;
11
- scale?: number;
12
- weight?: Pango.Weight | number;
13
- style?: Pango.Style;
14
- stretch?: Pango.Stretch;
15
- variant?: Pango.Variant;
16
- strikethrough?: boolean;
17
- underline?: Pango.Underline;
18
- overline?: Pango.Overline;
19
- rise?: number;
20
- letterSpacing?: number;
21
- lineHeight?: number;
22
- leftMargin?: number;
23
- rightMargin?: number;
24
- indent?: number;
25
- pixelsAboveLines?: number;
26
- pixelsBelowLines?: number;
27
- pixelsInsideWrap?: number;
28
- justification?: Gtk.Justification;
29
- direction?: Gtk.TextDirection;
30
- wrapMode?: Gtk.WrapMode;
31
- editable?: boolean;
32
- invisible?: boolean;
33
- allowBreaks?: boolean;
34
- insertHyphens?: boolean;
35
- fallback?: boolean;
36
- accumulativeMargin?: boolean;
37
- paragraphBackground?: string;
38
- showSpaces?: Pango.ShowFlags;
39
- textTransform?: Pango.TextTransform;
40
- fontFeatures?: string;
41
- language?: string;
42
- };
43
- export declare function applyStyleChanges(tag: Gtk.TextTag, oldProps: TagStyleProps | null, newProps: TagStyleProps): void;
@@ -1,52 +0,0 @@
1
- import { hasChanged } from "./utils.js";
2
- const STYLE_PROPS = {
3
- background: "setBackground",
4
- backgroundFullHeight: "setBackgroundFullHeight",
5
- foreground: "setForeground",
6
- family: "setFamily",
7
- font: "setFont",
8
- sizePoints: "setSizePoints",
9
- size: "setSize",
10
- scale: "setScale",
11
- weight: "setWeight",
12
- style: "setStyle",
13
- stretch: "setStretch",
14
- variant: "setVariant",
15
- strikethrough: "setStrikethrough",
16
- underline: "setUnderline",
17
- overline: "setOverline",
18
- rise: "setRise",
19
- letterSpacing: "setLetterSpacing",
20
- lineHeight: "setLineHeight",
21
- leftMargin: "setLeftMargin",
22
- rightMargin: "setRightMargin",
23
- indent: "setIndent",
24
- pixelsAboveLines: "setPixelsAboveLines",
25
- pixelsBelowLines: "setPixelsBelowLines",
26
- pixelsInsideWrap: "setPixelsInsideWrap",
27
- justification: "setJustification",
28
- direction: "setDirection",
29
- wrapMode: "setWrapMode",
30
- editable: "setEditable",
31
- invisible: "setInvisible",
32
- allowBreaks: "setAllowBreaks",
33
- insertHyphens: "setInsertHyphens",
34
- fallback: "setFallback",
35
- accumulativeMargin: "setAccumulativeMargin",
36
- paragraphBackground: "setParagraphBackground",
37
- showSpaces: "setShowSpaces",
38
- textTransform: "setTextTransform",
39
- fontFeatures: "setFontFeatures",
40
- language: "setLanguage",
41
- };
42
- export function applyStyleChanges(tag, oldProps, newProps) {
43
- for (const prop of Object.keys(STYLE_PROPS)) {
44
- if (hasChanged(oldProps, newProps, prop)) {
45
- const value = newProps[prop];
46
- if (value !== undefined) {
47
- const setter = tag[STYLE_PROPS[prop]];
48
- setter.call(tag, value);
49
- }
50
- }
51
- }
52
- }
@@ -1,26 +0,0 @@
1
- import * as Gtk from "@gtkx/ffi/gtk";
2
- import type { ReactNode } from "react";
3
- import type Reconciler from "react-reconciler";
4
- import { BaseItemRenderer } from "./base-item-renderer.js";
5
- import type { TreeStore } from "./tree-store.js";
6
- export type TreeRenderItemFn<T> = (item: T | null, row: Gtk.TreeListRow | null) => ReactNode;
7
- export declare class TreeListItemRenderer extends BaseItemRenderer<TreeStore> {
8
- private expanders;
9
- private setupComplete;
10
- private pendingBinds;
11
- private renderFn;
12
- private boundItems;
13
- setRenderFn(renderFn: TreeRenderItemFn<unknown> | null): void;
14
- rebindItem(id: string): void;
15
- protected getStoreTypeName(): string;
16
- dispose(): void;
17
- protected renderItem(_ptr: number): ReactNode;
18
- protected getItemFromListItem(listItem: Gtk.ListItem): unknown;
19
- protected onSetup(listItem: Gtk.ListItem, ptr: number): Gtk.Widget;
20
- protected onSetupComplete(ptr: number): void;
21
- protected onBind(listItem: Gtk.ListItem, ptr: number, fiberRoot: Reconciler.FiberRoot): void;
22
- protected onUnbind(listItem: Gtk.ListItem): void;
23
- protected onTeardown(_listItem: Gtk.ListItem, ptr: number): void;
24
- private processPendingBind;
25
- private renderBind;
26
- }