@gtkx/react 1.0.0-rc.3 → 1.0.0-rc.4

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 (164) hide show
  1. package/README.md +4 -5
  2. package/dist/adw/config.d.ts +1 -0
  3. package/dist/adw/config.d.ts.map +1 -1
  4. package/dist/adw/config.js +1 -0
  5. package/dist/adw/config.js.map +1 -1
  6. package/dist/adw/dialog.d.ts +1 -0
  7. package/dist/adw/dialog.d.ts.map +1 -1
  8. package/dist/adw/dialog.js +1 -0
  9. package/dist/adw/dialog.js.map +1 -1
  10. package/dist/adw/element-behaviors.js +2 -3
  11. package/dist/adw/element-behaviors.js.map +1 -1
  12. package/dist/adw/element-config.d.ts +4 -3
  13. package/dist/adw/element-config.d.ts.map +1 -1
  14. package/dist/adw/element-config.js +14 -13
  15. package/dist/adw/element-config.js.map +1 -1
  16. package/dist/adw/index.d.ts +1 -0
  17. package/dist/adw/index.d.ts.map +1 -1
  18. package/dist/adw/index.js +1 -0
  19. package/dist/adw/index.js.map +1 -1
  20. package/dist/adw/prop-types.d.ts +1 -1
  21. package/dist/adw/prop-types.d.ts.map +1 -1
  22. package/dist/adw/prop-types.js.map +1 -1
  23. package/dist/bootstrap.js +1 -1
  24. package/dist/bootstrap.js.map +1 -1
  25. package/dist/components/application.d.ts +1 -0
  26. package/dist/components/application.d.ts.map +1 -1
  27. package/dist/components/application.js +1 -0
  28. package/dist/components/application.js.map +1 -1
  29. package/dist/components/element.d.ts +0 -1
  30. package/dist/components/element.d.ts.map +1 -1
  31. package/dist/components/element.js +0 -1
  32. package/dist/components/element.js.map +1 -1
  33. package/dist/components/window.d.ts +1 -0
  34. package/dist/components/window.d.ts.map +1 -1
  35. package/dist/components/window.js +1 -0
  36. package/dist/components/window.js.map +1 -1
  37. package/dist/config.d.ts +5 -2
  38. package/dist/config.d.ts.map +1 -1
  39. package/dist/config.js +3 -1
  40. package/dist/config.js.map +1 -1
  41. package/dist/element-behaviors.js +0 -1
  42. package/dist/element-behaviors.js.map +1 -1
  43. package/dist/element-config.d.ts +4 -3
  44. package/dist/element-config.d.ts.map +1 -1
  45. package/dist/element-config.js +12 -11
  46. package/dist/element-config.js.map +1 -1
  47. package/dist/hooks/use-bind-setting.d.ts +8 -7
  48. package/dist/hooks/use-bind-setting.d.ts.map +1 -1
  49. package/dist/hooks/use-bind-setting.js +2 -7
  50. package/dist/hooks/use-bind-setting.js.map +1 -1
  51. package/dist/hooks/use-parent-window.d.ts +3 -1
  52. package/dist/hooks/use-parent-window.d.ts.map +1 -1
  53. package/dist/hooks/use-parent-window.js +3 -1
  54. package/dist/hooks/use-parent-window.js.map +1 -1
  55. package/dist/hooks/use-property.d.ts +2 -2
  56. package/dist/hooks/use-property.d.ts.map +1 -1
  57. package/dist/hooks/use-property.js +1 -2
  58. package/dist/hooks/use-property.js.map +1 -1
  59. package/dist/hooks/use-setting.d.ts +2 -3
  60. package/dist/hooks/use-setting.d.ts.map +1 -1
  61. package/dist/hooks/use-setting.js +2 -3
  62. package/dist/hooks/use-setting.js.map +1 -1
  63. package/dist/hooks/use-signal.d.ts +13 -7
  64. package/dist/hooks/use-signal.d.ts.map +1 -1
  65. package/dist/hooks/use-signal.js +6 -8
  66. package/dist/hooks/use-signal.js.map +1 -1
  67. package/dist/index.d.ts +10 -2
  68. package/dist/index.d.ts.map +1 -1
  69. package/dist/index.js +8 -0
  70. package/dist/index.js.map +1 -1
  71. package/dist/internal.d.ts +4 -3
  72. package/dist/internal.d.ts.map +1 -1
  73. package/dist/internal.js +2 -3
  74. package/dist/internal.js.map +1 -1
  75. package/dist/prop-types.d.ts +60 -0
  76. package/dist/prop-types.d.ts.map +1 -1
  77. package/dist/prop-types.js.map +1 -1
  78. package/dist/reconciler/behaviors.d.ts +0 -15
  79. package/dist/reconciler/behaviors.d.ts.map +1 -1
  80. package/dist/reconciler/behaviors.js +5 -20
  81. package/dist/reconciler/behaviors.js.map +1 -1
  82. package/dist/reconciler/host-config.d.ts +1 -1
  83. package/dist/reconciler/host-config.d.ts.map +1 -1
  84. package/dist/reconciler/host-config.js.map +1 -1
  85. package/dist/reconciler/instance.js +1 -1
  86. package/dist/reconciler/instance.js.map +1 -1
  87. package/dist/reconciler/metadata.d.ts +1 -1
  88. package/dist/reconciler/metadata.d.ts.map +1 -1
  89. package/dist/reconciler/metadata.js +7 -7
  90. package/dist/reconciler/metadata.js.map +1 -1
  91. package/dist/reconciler/node.d.ts +2 -2
  92. package/dist/reconciler/node.d.ts.map +1 -1
  93. package/dist/reconciler/node.js +1 -1
  94. package/dist/reconciler/node.js.map +1 -1
  95. package/dist/reconciler/placement.js +6 -6
  96. package/dist/reconciler/placement.js.map +1 -1
  97. package/dist/reconciler/registry.d.ts +42 -30
  98. package/dist/reconciler/registry.d.ts.map +1 -1
  99. package/dist/reconciler/registry.js +10 -19
  100. package/dist/reconciler/registry.js.map +1 -1
  101. package/dist/reconciler/root-element.d.ts +0 -1
  102. package/dist/reconciler/root-element.d.ts.map +1 -1
  103. package/dist/reconciler/root-element.js +0 -1
  104. package/dist/reconciler/root-element.js.map +1 -1
  105. package/dist/reconciler/root.d.ts +6 -20
  106. package/dist/reconciler/root.d.ts.map +1 -1
  107. package/dist/reconciler/root.js +4 -19
  108. package/dist/reconciler/root.js.map +1 -1
  109. package/dist/reconciler/signals.js +2 -2
  110. package/dist/reconciler/signals.js.map +1 -1
  111. package/dist/reconciler/text.js +5 -5
  112. package/dist/reconciler/text.js.map +1 -1
  113. package/dist/utils/accessible-metadata.d.ts +0 -7
  114. package/dist/utils/accessible-metadata.d.ts.map +1 -1
  115. package/dist/utils/accessible-metadata.js +0 -7
  116. package/dist/utils/accessible-metadata.js.map +1 -1
  117. package/dist/utils/accessible-props.d.ts +49 -1
  118. package/dist/utils/accessible-props.d.ts.map +1 -1
  119. package/dist/utils/accessible-props.js.map +1 -1
  120. package/dist/utils/ref-prop.d.ts +0 -6
  121. package/dist/utils/ref-prop.d.ts.map +1 -1
  122. package/dist/utils/ref-prop.js +0 -6
  123. package/dist/utils/ref-prop.js.map +1 -1
  124. package/dist/utils/settings.d.ts +6 -0
  125. package/dist/utils/settings.d.ts.map +1 -1
  126. package/dist/utils/settings.js.map +1 -1
  127. package/env.d.ts +11 -4
  128. package/package.json +5 -5
  129. package/src/adw/config.ts +1 -0
  130. package/src/adw/dialog.tsx +1 -0
  131. package/src/adw/element-behaviors.ts +2 -3
  132. package/src/adw/element-config.ts +14 -13
  133. package/src/adw/index.ts +1 -0
  134. package/src/adw/prop-types.ts +1 -1
  135. package/src/bootstrap.ts +1 -1
  136. package/src/components/application.tsx +1 -0
  137. package/src/components/element.tsx +0 -1
  138. package/src/components/window.tsx +1 -0
  139. package/src/config.ts +5 -9
  140. package/src/element-behaviors.ts +0 -1
  141. package/src/element-config.ts +12 -11
  142. package/src/hooks/use-bind-setting.ts +8 -7
  143. package/src/hooks/use-parent-window.ts +3 -1
  144. package/src/hooks/use-property.ts +2 -2
  145. package/src/hooks/use-setting.ts +2 -3
  146. package/src/hooks/use-signal.ts +16 -10
  147. package/src/index.ts +10 -2
  148. package/src/internal.ts +4 -3
  149. package/src/prop-types.ts +86 -5
  150. package/src/reconciler/behaviors.ts +6 -21
  151. package/src/reconciler/host-config.ts +1 -1
  152. package/src/reconciler/instance.ts +1 -1
  153. package/src/reconciler/metadata.ts +8 -8
  154. package/src/reconciler/node.ts +3 -3
  155. package/src/reconciler/placement.ts +6 -6
  156. package/src/reconciler/registry.ts +52 -37
  157. package/src/reconciler/root-element.ts +0 -1
  158. package/src/reconciler/root.ts +6 -20
  159. package/src/reconciler/signals.ts +2 -2
  160. package/src/reconciler/text.ts +6 -6
  161. package/src/utils/accessible-metadata.ts +0 -7
  162. package/src/utils/accessible-props.ts +49 -1
  163. package/src/utils/ref-prop.ts +0 -6
  164. package/src/utils/settings.ts +6 -0
@@ -6,22 +6,23 @@ import type { SettingsSchema, SettingsSchemaKeys } from "../utils/settings.js";
6
6
  import { type RefProp, resolveRefProp } from "../utils/ref-prop.js";
7
7
  import { useSettings } from "./use-setting.js";
8
8
 
9
+ /** Options for {@link useBindSetting}. */
9
10
  type UseBindSettingOptions<K extends SettingsSchemaKeys> = {
11
+ /** Schema the settings object is opened from. */
10
12
  schema: SettingsSchema<K>;
13
+ /** Key of that schema to bind. */
11
14
  key: keyof K & string;
15
+ /** Object holding the property, given directly or as a ref; nothing is bound while it is absent. */
12
16
  object: RefProp<GObject.Object>;
17
+ /** camelCase name of the property to keep in sync with the key. */
13
18
  property: string;
19
+ /** Direction and conversion behavior of the bind; defaults to `Gio.SettingsBindFlags.DEFAULT`. */
14
20
  flags?: Gio.SettingsBindFlags;
15
21
  };
16
22
 
17
23
  /**
18
- * Binds a GSettings key to a property of a GObject, keeping the two in sync for the object's lifetime.
19
- *
20
- * @param options.schema The schema reference identifying the settings backend.
21
- * @param options.key The key within the schema to bind.
22
- * @param options.object The GObject whose property is bound to the setting.
23
- * @param options.property The name of the object property to bind.
24
- * @param options.flags Flags controlling the binding's direction and behaviour.
24
+ * Binds a GSettings key to a property of a GObject, keeping the two in sync until the component unmounts.
25
+ * `property` is given in camelCase, and `flags` defaults to `Gio.SettingsBindFlags.DEFAULT`, a two-way bind.
25
26
  */
26
27
  function useBindSetting<K extends SettingsSchemaKeys>({
27
28
  schema,
@@ -4,7 +4,9 @@ import { type Context, createContext, use } from "react";
4
4
  const ParentWindowContext: Context<Gtk.Window | null> = createContext<Gtk.Window | null>(null);
5
5
 
6
6
  /**
7
- * Returns the `Gtk.Window` provided by the nearest window ancestor, or `null` when there is none.
7
+ * Returns the `Gtk.Window` of the nearest window ancestor. This is `null` on the first render even inside a
8
+ * window, because a window provides itself only once its GObject exists, and stays `null` outside one. The
9
+ * component re-renders when it resolves, so derive from the value rather than reading it once.
8
10
  */
9
11
  const useParentWindow = (): Gtk.Window | null => use(ParentWindowContext);
10
12
 
@@ -4,14 +4,14 @@ import type { RefProp } from "../utils/ref-prop.js";
4
4
  import { useObjectValue } from "./use-object-value.js";
5
5
 
6
6
  type Properties<T extends GObject.Object> = NonNullable<T["__properties__"]>;
7
+ /** Every property `T` declares that is also readable off the instance, in camelCase. */
7
8
  type PropertyName<T extends GObject.Object> = keyof Properties<T> & keyof T;
8
9
 
9
10
  /**
10
11
  * Subscribes to a GObject property and returns its current value, re-rendering when the property changes.
11
12
  *
12
- * @param object The GObject (or ref to one) whose property to observe.
13
13
  * @param propertyName The camelCase name of a readable property on the object.
14
- * @returns The current property value, or `undefined` when the object is not resolved.
14
+ * @returns The current value, or `undefined` while the object is null or an unresolved ref.
15
15
  */
16
16
  function useProperty<T extends GObject.Object, P extends PropertyName<T>>(
17
17
  object: RefProp<T>,
@@ -16,9 +16,8 @@ const useSettings = <K extends SettingsSchemaKeys>({ id, path }: UseSettingsProp
16
16
  /**
17
17
  * Reads and writes a single key of a GSettings schema, re-rendering when the stored value changes.
18
18
  *
19
- * @param schema The schema reference identifying the settings backend.
20
- * @param key The key within the schema to read and write.
21
- * @returns A tuple of the current value and a setter that persists a new value.
19
+ * @returns The current value, and a setter that writes a new one back to GSettings.
20
+ * @throws When the key is not declared in the schema.
22
21
  */
23
22
  function useSetting<K extends SettingsSchemaKeys, P extends keyof K>(
24
23
  schema: SettingsSchema<K>,
@@ -4,8 +4,13 @@ import { useEffectEvent, useLayoutEffect } from "react";
4
4
  import { type RefProp, resolveRefProp } from "../utils/ref-prop.js";
5
5
 
6
6
  type Signals<T extends GObject.Object> = NonNullable<T["__signals__"]>;
7
+ /** Every signal name `T` declares, on its own or narrowed by a `::detail` suffix. */
7
8
  type SignalName<T extends GObject.Object> = keyof Signals<T> | `${keyof Signals<T> & string}::${string}`;
8
9
 
10
+ /**
11
+ * The handler signature `T` declares for signal `S`, looked up through any `::detail` suffix and
12
+ * falling back to an untyped `SignalHandler` when the object declares no such signal.
13
+ */
9
14
  type TypedSignalHandler<T extends GObject.Object, S extends string> = S extends keyof Signals<T>
10
15
  ? Signals<T>[S]
11
16
  : S extends `${infer TBase}::${string}`
@@ -14,9 +19,12 @@ type TypedSignalHandler<T extends GObject.Object, S extends string> = S extends
14
19
  : SignalHandler
15
20
  : SignalHandler;
16
21
 
22
+ /** Options for {@link useSignal}. */
17
23
  type UseSignalOptions = {
18
- after?: boolean;
19
- immediate?: boolean;
24
+ /** Runs the handler after the object's own default handler rather than before it. */
25
+ isAfter?: boolean;
26
+ /** Invokes the handler once, with no arguments, as soon as the signal is connected. */
27
+ isImmediate?: boolean;
20
28
  };
21
29
 
22
30
  /**
@@ -29,16 +37,14 @@ type UseSignalOptions = {
29
37
  * runs the handler captured on the first render. Keep the calling component unwrapped, or read the values the
30
38
  * handler needs off the GObject itself. React fixes this on the 19.3 line.
31
39
  *
32
- * @param object The GObject (or ref to one) to connect to.
33
- * @param signal The signal name, optionally with a detail suffix.
34
- * @param handler The callback invoked when the signal is emitted.
35
- * @param options Connection options such as running after the default handler or invoking immediately.
40
+ * @param signal The signal name, optionally with a `::detail` suffix.
41
+ * @param options `isAfter` runs the handler after the default handler; `isImmediate` also invokes it on connect.
36
42
  */
37
43
  function useSignal<T extends GObject.Object, S extends SignalName<T> & string>(
38
44
  object: RefProp<T>,
39
45
  signal: S,
40
46
  handler: TypedSignalHandler<T, S>,
41
- { after = false, immediate = false }: UseSignalOptions = {},
47
+ { isAfter = false, isImmediate = false }: UseSignalOptions = {},
42
48
  ): void {
43
49
  const emit = useEffectEvent(handler as SignalHandler);
44
50
 
@@ -49,16 +55,16 @@ function useSignal<T extends GObject.Object, S extends SignalName<T> & string>(
49
55
  return;
50
56
  }
51
57
 
52
- resolved.on(signal, emit, after);
58
+ resolved.on(signal, emit, isAfter);
53
59
 
54
- if (immediate) {
60
+ if (isImmediate) {
55
61
  emit();
56
62
  }
57
63
 
58
64
  return () => {
59
65
  resolved.off(signal, emit);
60
66
  };
61
- }, [object, signal, after, immediate]);
67
+ }, [object, signal, isAfter, isImmediate]);
62
68
  }
63
69
 
64
70
  export { useSignal, type SignalName, type TypedSignalHandler };
package/src/index.ts CHANGED
@@ -1,14 +1,22 @@
1
1
  import "./bootstrap.js";
2
2
 
3
+ /** @public */
3
4
  export { useApplication } from "./hooks/use-application.js";
5
+ /** @public */
4
6
  export { useBindSetting } from "./hooks/use-bind-setting.js";
7
+ /** @public */
5
8
  export { useParentWindow } from "./hooks/use-parent-window.js";
9
+ /** @public */
6
10
  export { useProperty } from "./hooks/use-property.js";
11
+ /** @public */
7
12
  export { useSetting } from "./hooks/use-setting.js";
13
+ /** @public */
8
14
  export { useSignal } from "./hooks/use-signal.js";
9
- export type { MenuItem, VflConstraints } from "./prop-types.js";
15
+ /** @public */
10
16
  export { type RootElement, rootElement } from "./reconciler/root-element.js";
17
+ /** @public */
11
18
  export { createPortal, createRoot, quit, type Root } from "./reconciler/root.js";
19
+ /** @public */
12
20
  export type { AccessibleProps } from "./utils/accessible-props.js";
21
+ /** @public */
13
22
  export type { RefProp } from "./utils/ref-prop.js";
14
- export type { SettingsSchema, SettingsSchemaKeys, SettingValue } from "./utils/settings.js";
package/src/internal.ts CHANGED
@@ -1,14 +1,15 @@
1
1
  import "./bootstrap.js";
2
2
 
3
+ /** @internal */
3
4
  export { createApplicationComponent } from "./components/application.js";
4
5
  export { createElementComponent } from "./components/element.js";
6
+ /** @internal */
5
7
  export { createWindowComponent } from "./components/window.js";
6
- export { ApplicationContext } from "./hooks/use-application.js";
7
8
  export { useMergedRef } from "./hooks/use-merged-refs.js";
8
- export { useObjectValue } from "./hooks/use-object-value.js";
9
9
  export type * from "./prop-types.js";
10
+ export type { ModuleExport } from "./reconciler/registry.js";
10
11
  export { isRootElement } from "./reconciler/root-element.js";
11
12
  export { createReconcilerRoot, type ReconcilerRoot, setReconcilerErrorHandler } from "./reconciler/root.js";
12
13
  export { applyWrite } from "./reconciler/signals.js";
13
14
  export { getAccessibleMetadata } from "./utils/accessible-metadata.js";
14
- export { type RefProp, resolveRefProp } from "./utils/ref-prop.js";
15
+ export type { SettingsSchema, SettingsSchemaKeys, SettingValue } from "./utils/settings.js";
package/src/prop-types.ts CHANGED
@@ -5,110 +5,191 @@ import type { ReactNode } from "react";
5
5
 
6
6
  /** One entry of a `GMenu`'s `items` prop; `submenu` and `section` nest further menus. */
7
7
  type MenuItem = {
8
+ /** Text shown for the entry, or the heading of the submenu or section it introduces. */
8
9
  label?: string | null;
10
+ /** Detailed action name the entry activates, ignored when `submenu` or `section` is given. */
9
11
  action?: string | null;
12
+ /** Entries of a separate menu the labelled entry opens. */
10
13
  submenu?: MenuItem[];
14
+ /** Entries appended below the label as an inline section, used only when `submenu` is absent. */
11
15
  section?: MenuItem[];
12
16
  };
13
17
 
14
18
  /** One Visual Format Language block applied to a `Gtk.ConstraintLayout`. */
15
19
  type VflConstraints = {
20
+ /** Format lines, each describing every constraint on one row or column. */
16
21
  lines: string[];
22
+ /** Default horizontal spacing the `-` operator stands for; defaults to 0. */
17
23
  hspacing?: number;
24
+ /** Default vertical spacing the `-` operator stands for; defaults to 0. */
18
25
  vspacing?: number;
26
+ /** Targets the view names in `lines` refer to; defaults to none. */
19
27
  views?: Map<string, Gtk.ConstraintTarget>;
20
28
  };
21
29
 
22
30
  /** One mark on a `Gtk.Scale`. */
23
- type ScaleMark = { value?: number; position: Gtk.PositionType; markup?: string | null };
31
+ type ScaleMark = {
32
+ /** Point on the scale the mark is drawn at; defaults to 0. */
33
+ value?: number;
34
+ /** Side of the scale the mark and its label sit on. */
35
+ position: Gtk.PositionType;
36
+ /** Pango markup drawn beside the mark, or `null` for an unlabelled one. */
37
+ markup?: string | null;
38
+ };
39
+
24
40
  /** One labelled offset on a `Gtk.LevelBar`. */
25
- type LevelBarOffset = { name: string; value?: number };
41
+ type LevelBarOffset = {
42
+ /** Style class applied to the bar's blocks while the value falls in this offset's interval. */
43
+ name: string;
44
+ /** Upper bound of that interval; defaults to 0. */
45
+ value?: number;
46
+ };
47
+
26
48
  /** One credit section on a `Gtk.AboutDialog`. */
27
- type CreditSection = { sectionName: string; people: string[] };
49
+ type CreditSection = {
50
+ /** Heading the names are listed under. */
51
+ sectionName: string;
52
+ /** Names listed in the section. */
53
+ people: string[];
54
+ };
55
+
28
56
  /** One accelerator binding on a `Gtk.Application`. */
29
- type ActionAccel = { detailedActionName: string; accels: string[] };
57
+ type ActionAccel = {
58
+ /** Action the accelerators activate, such as `app.quit` or `win.open('file')`. */
59
+ detailedActionName: string;
60
+ /** Accelerators in `Gtk.acceleratorParse` syntax, cleared when the entry goes away. */
61
+ accels: string[];
62
+ };
63
+
30
64
  /** The drag icon of a `Gtk.DragSource`, with its hotspot. */
31
- type DragSourceIcon = { paintable?: Gdk.Paintable | null; hotX?: number; hotY?: number };
65
+ type DragSourceIcon = {
66
+ /** Image shown under the pointer during the drag; defaults to none. */
67
+ paintable?: Gdk.Paintable | null;
68
+ /** Horizontal offset of the pointer within the image; defaults to 0. */
69
+ hotX?: number;
70
+ /** Vertical offset of the pointer within the image; defaults to 0. */
71
+ hotY?: number;
72
+ };
32
73
 
33
74
  /** Props of an element that accepts children. */
34
75
  type ChildrenProps = {
76
+ /** Elements attached to the element's default child slot, or its text for elements that hold text. */
35
77
  children?: ReactNode;
36
78
  };
37
79
 
80
+ /** Objects a widget takes through a method call rather than a property. */
38
81
  type GtkWidgetProps = {
82
+ /** `Gtk.EventController` elements added to the widget. */
39
83
  controllers?: ReactNode | null | undefined;
84
+ /** `Gio.ActionGroup` elements inserted into the widget, each under its own `prefix`. */
40
85
  actionGroups?: ReactNode | null | undefined;
41
86
  } & ChildrenProps;
42
87
 
88
+ /** Props of an action group placed in a widget's `actionGroups` slot. */
43
89
  type GActionGroupProps = {
90
+ /** Prefix the group's actions are addressed by, such as `win`; defaults to the empty string. */
44
91
  prefix?: string | null | undefined;
45
92
  };
46
93
 
94
+ /** Props of an element implementing `Gio.ActionMap`. */
47
95
  type GActionMapProps = {
96
+ /** `Gio.Action` elements added to the map, removed again by their `name`. */
48
97
  actions?: ReactNode | null | undefined;
49
98
  };
50
99
 
100
+ /** Props of a `Gio.Menu` element. */
51
101
  type GMenuProps = {
102
+ /** Entries the menu is rebuilt from whenever they change. */
52
103
  items?: MenuItem[] | null | undefined;
53
104
  };
54
105
 
106
+ /** Props of a `Gtk.ShortcutController` element. */
55
107
  type GtkShortcutControllerProps = {
108
+ /** `Gtk.Shortcut` elements the controller watches for. */
56
109
  shortcuts?: ReactNode | null | undefined;
57
110
  };
58
111
 
112
+ /** Props of a `Gtk.Overlay` element, whose `children` is the widget the overlays sit above. */
59
113
  type GtkOverlayProps = {
114
+ /** Widgets stacked over the main child. */
60
115
  overlays?: ReactNode | null | undefined;
61
116
  } & ChildrenProps;
62
117
 
118
+ /** Props of a `Gtk.ConstraintLayout` element. */
63
119
  type GtkConstraintLayoutProps = {
120
+ /** `Gtk.Constraint` elements added to the layout. */
64
121
  constraints?: ReactNode | null | undefined;
122
+ /** `Gtk.ConstraintGuide` elements added to the layout as invisible spacers. */
65
123
  guides?: ReactNode | null | undefined;
124
+ /** Visual Format Language blocks whose constraints are added alongside `constraints`. */
66
125
  vfl?: VflConstraints[] | null | undefined;
67
126
  };
68
127
 
69
128
  /** Props of `GtkTextChildAnchor`, which embeds either a child widget or a paintable in a text buffer. */
70
129
  type GtkTextChildAnchorProps = {
130
+ /** Image inserted into the buffer instead of an anchored widget; giving both is an error. */
71
131
  paintable?: Gdk.Paintable | null | undefined;
72
132
  } & ChildrenProps;
73
133
 
134
+ /** Props of a `Gtk.HeaderBar` or `Gtk.ActionBar` element. */
74
135
  type GtkHeaderBarProps = {
136
+ /** Widgets packed at the start of the bar. */
75
137
  start?: ReactNode | null | undefined;
138
+ /** Widgets packed at the end of the bar. */
76
139
  end?: ReactNode | null | undefined;
77
140
  };
78
141
 
142
+ /** Props of a `Gtk.Scale` element. */
79
143
  type GtkScaleProps = {
144
+ /** Marks drawn along the scale, cleared and re-added whenever the list changes. */
80
145
  marks?: ScaleMark[] | null | undefined;
81
146
  };
82
147
 
148
+ /** Props of a `Gtk.Calendar` element. */
83
149
  type GtkCalendarProps = {
150
+ /** Days of the shown month drawn as marked, cleared and re-marked whenever the list changes. */
84
151
  markedDays?: number[] | null | undefined;
85
152
  };
86
153
 
154
+ /** Props of a `Gtk.LevelBar` element. */
87
155
  type GtkLevelBarProps = {
156
+ /** Offsets that split the bar's range into differently styled intervals. */
88
157
  offsets?: LevelBarOffset[] | null | undefined;
89
158
  };
90
159
 
160
+ /** Props of a `Gtk.SizeGroup` element. */
91
161
  type GtkSizeGroupProps = {
162
+ /** Widgets the group keeps at a common size. */
92
163
  widgets?: Gtk.Widget[] | null | undefined;
93
164
  };
94
165
 
166
+ /** Props of a `Gtk.AboutDialog` element. */
95
167
  type GtkAboutDialogProps = {
168
+ /** Extra sections appended to the dialog's credits, which GTK offers no way to remove. */
96
169
  creditSections?: CreditSection[] | null | undefined;
97
170
  };
98
171
 
172
+ /** Props of a `Gtk.Application` element, whose `children` are the windows it owns. */
99
173
  type GtkApplicationProps = {
174
+ /** Accelerators bound to the application's actions. */
100
175
  actionAccels?: ActionAccel[] | null | undefined;
101
176
  } & ChildrenProps;
102
177
 
178
+ /** Props of a `Gtk.DropTarget` element. */
103
179
  type GtkDropTargetProps = {
180
+ /** GTypes the target accepts a drop of. */
104
181
  types?: GObject.Type[] | null | undefined;
105
182
  };
106
183
 
184
+ /** Props of a `Gtk.DrawingArea` element. */
107
185
  type GtkDrawingAreaProps = {
186
+ /** Callback that draws the area's contents; setting it queues a redraw. */
108
187
  drawFunc?: Gtk.DrawingAreaDrawFunc | null | undefined;
109
188
  };
110
189
 
190
+ /** Props of a `Gtk.DragSource` element. */
111
191
  type GtkDragSourceProps = {
192
+ /** Icon shown under the pointer while a drag started from this source is in flight. */
112
193
  icon?: DragSourceIcon | null | undefined;
113
194
  };
114
195
 
@@ -23,7 +23,7 @@ type ListHooks<P extends GObject.Object, I, H> = {
23
23
 
24
24
  type ListEntry = { item: unknown; handle: unknown };
25
25
  type ListState = { snapshot: unknown[]; entries: ListEntry[] };
26
- type DeferredState = { desired: unknown; present: boolean; applied: unknown };
26
+ type DeferredState = { desired: unknown; isPresent: boolean; applied: unknown };
27
27
  type CanApply<P extends GObject.Object, V> = (object: P, value: V) => boolean;
28
28
  type ChildSetter = GObject.Object & { setChild: (child: Gtk.Widget | null) => void };
29
29
  type ContentSetter<C extends Gtk.Widget> = GObject.Object & { setContent: (content: C | null) => void };
@@ -67,7 +67,6 @@ const slotAttach =
67
67
  return attach(object as P, child as C, info) ?? true;
68
68
  };
69
69
 
70
- /** Builds a behavior for a named child slot holding children of `childType`, claiming matches only. */
71
70
  const slot = <P extends GObject.Object, C extends GObject.Object>(
72
71
  slotName: string,
73
72
  childType: string,
@@ -94,7 +93,6 @@ const slot = <P extends GObject.Object, C extends GObject.Object>(
94
93
  return behavior;
95
94
  };
96
95
 
97
- /** Builds a scalar-prop behavior that invokes `apply` whenever the value changes, and claims the prop. */
98
96
  const value = <P extends GObject.Object, V>(
99
97
  prop: string,
100
98
  apply: ValueApply<P, V>,
@@ -130,11 +128,6 @@ const teardownList = <P extends GObject.Object, I, H>(
130
128
  }
131
129
  };
132
130
 
133
- /**
134
- * Builds an array-prop behavior that adds, removes, and clears its items, reapplying on structural
135
- * change. `add` may return a handle that the same item's later `remove` receives, for items whose
136
- * teardown needs what `add` produced (as VFL constraints need the objects the layout created).
137
- */
138
131
  const list = <P extends GObject.Object, I, H = void>(
139
132
  prop: string,
140
133
  hooks: ListHooks<P, I, H>,
@@ -142,7 +135,7 @@ const list = <P extends GObject.Object, I, H = void>(
142
135
  const { add } = hooks;
143
136
 
144
137
  return {
145
- createContext: (): ListState => ({ snapshot: [], entries: [] }),
138
+ initialize: (): ListState => ({ snapshot: [], entries: [] }),
146
139
  update: (object, _prev, next, context) => {
147
140
  const state = context as ListState;
148
141
  const raw = next[prop];
@@ -169,7 +162,7 @@ const flushDeferred = <P extends GObject.Object, V>(
169
162
  ): void => {
170
163
  const state = context as DeferredState;
171
164
 
172
- if (!state.present || Object.is(state.applied, state.desired)) {
165
+ if (!state.isPresent || Object.is(state.applied, state.desired)) {
173
166
  return;
174
167
  }
175
168
 
@@ -184,17 +177,16 @@ const flushDeferred = <P extends GObject.Object, V>(
184
177
  state.applied = state.desired;
185
178
  };
186
179
 
187
- /** Builds a behavior for a prop applied after the surrounding commit, deferred until `canApply` returns true. */
188
180
  const deferred = <P extends GObject.Object, V>(
189
181
  prop: string,
190
182
  canApply?: CanApply<P, V>,
191
183
  ): ElementBehavior<P> => ({
192
184
  deferred: [prop],
193
- createContext: (): DeferredState => ({ desired: undefined, present: false, applied: undefined }),
185
+ initialize: (): DeferredState => ({ desired: undefined, isPresent: false, applied: undefined }),
194
186
  update: (_object, _prev, next, context) => {
195
187
  const state = context as DeferredState;
196
188
  state.desired = next[prop];
197
- state.present = next[prop] !== undefined;
189
+ state.isPresent = next[prop] !== undefined;
198
190
 
199
191
  return [prop];
200
192
  },
@@ -203,7 +195,6 @@ const deferred = <P extends GObject.Object, V>(
203
195
  },
204
196
  });
205
197
 
206
- /** Builds a behavior for a text prop kept in controlled-input sync: set when provided, never reset. */
207
198
  const controlledText = (prop: string): ElementBehavior =>
208
199
  value(prop, (object, next) => {
209
200
  if (!hasSameText(object, prop, next)) {
@@ -213,7 +204,6 @@ const controlledText = (prop: string): ElementBehavior =>
213
204
  }
214
205
  });
215
206
 
216
- /** Behavior for a container that installs its single child with `setChild`. */
217
207
  const childSetterSlot = <P extends ChildSetter>(): ElementBehavior<P> =>
218
208
  slot<P, Gtk.Widget>("children", "GtkWidget", {
219
209
  attach: (parent, child) => {
@@ -224,7 +214,6 @@ const childSetterSlot = <P extends ChildSetter>(): ElementBehavior<P> =>
224
214
  },
225
215
  });
226
216
 
227
- /** Behavior for a container that installs its single child with `setContent`. */
228
217
  const contentSetterSlot = <P extends ContentSetter<C>, C extends Gtk.Widget = Gtk.Widget>(
229
218
  childType = "GtkWidget",
230
219
  ): ElementBehavior<P> =>
@@ -237,7 +226,6 @@ const contentSetterSlot = <P extends ContentSetter<C>, C extends Gtk.Widget = Gt
237
226
  },
238
227
  });
239
228
 
240
- /** Behavior for a `GtkBox`-style container that orders children by sibling. */
241
229
  const boxSlot = <P extends BoxLike>(): ElementBehavior<P> =>
242
230
  slot<P, Gtk.Widget>("children", "GtkWidget", {
243
231
  attach: (box, child, info) => box.insertChildAfter(child, info.sibling as Gtk.Widget | null),
@@ -249,7 +237,6 @@ const boxSlot = <P extends BoxLike>(): ElementBehavior<P> =>
249
237
  },
250
238
  });
251
239
 
252
- /** Behavior for a container whose children are added and removed by a pair of methods. */
253
240
  const addRemoveSlot = <C extends GObject.Object, P extends GObject.Object>(
254
241
  slotName: string,
255
242
  childType: string,
@@ -257,7 +244,6 @@ const addRemoveSlot = <C extends GObject.Object, P extends GObject.Object>(
257
244
  remove: (parent: P, child: C) => void,
258
245
  ): ElementBehavior => slot<P, C>(slotName, childType, { attach: add, detach: remove });
259
246
 
260
- /** Behavior for a `children` slot whose attach call returns the page object the container adopts. */
261
247
  const adoptedChildrenSlot = <P extends GObject.Object, C extends GObject.Object>(
262
248
  childType: string,
263
249
  add: (parent: P, item: C) => unknown,
@@ -300,7 +286,6 @@ const removeWrappedRow = (
300
286
  }
301
287
  };
302
288
 
303
- /** Behavior for an index-placed container that wraps each child in `Wrapper` before adding it. */
304
289
  const wrappingIndexedSlot = <W extends Gtk.Widget, P extends IndexedInserter>(
305
290
  Wrapper: new (props: Props) => W,
306
291
  setChild: (wrapper: W, inner: Gtk.Widget) => void,
@@ -312,7 +297,7 @@ const wrappingIndexedSlot = <W extends Gtk.Widget, P extends IndexedInserter>(
312
297
  removeWrappedRow(Wrapper, parent, child, info.context as RowCache);
313
298
  },
314
299
  }),
315
- createContext: (): RowCache => new WeakMap(),
300
+ initialize: (): RowCache => new WeakMap(),
316
301
  });
317
302
 
318
303
  export {
@@ -41,7 +41,7 @@ import {
41
41
  validateContentMix,
42
42
  } from "./text.js";
43
43
 
44
- /** A top-level container an element tree can be mounted into. */
44
+ /** What a tree is rendered into: any GObject, or the {@link RootElement} marker to render at the top level. */
45
45
  type Container = RootElement | GObject.Object;
46
46
 
47
47
  type PriorityTracker = {
@@ -69,7 +69,7 @@ const createObject = (typeName: string, type: bigint, input: Props): GObject.Obj
69
69
  const resolveElementNode = (typeName: string, props: Props, dispatch: Dispatch): ElementNode | LazyNode => {
70
70
  const info = typeInfoFor(typeName);
71
71
 
72
- if (info.lazy) {
72
+ if (info.isLazy) {
73
73
  return createLazyNode(typeName, props, dispatch);
74
74
  }
75
75
 
@@ -1,6 +1,6 @@
1
1
  import { TYPE_INVALID, typeFromName, typeInterfaces, typeName, typeParent } from "@gtkx/runtime";
2
2
  import { getOrInsert } from "@gtkx/utils";
3
- import { CONSTRUCT_ONLY_PROPS, CONSTRUCT_PROPS, DEFAULT_PROPS, SIGNALS, userEventSignals } from "virtual:gtkx-config";
3
+ import { constructOnlyProps, constructProps, defaultProps, signals, userEventSignals } from "virtual:gtkx-config";
4
4
  import { deferredProps, type ElementBehavior, ELEMENTS } from "./registry.js";
5
5
 
6
6
  type TypeInfo = {
@@ -9,7 +9,7 @@ type TypeInfo = {
9
9
  userEventSignals: Set<string>;
10
10
  behaviors: ElementBehavior[];
11
11
  deferred: Set<string>;
12
- lazy: boolean;
12
+ isLazy: boolean;
13
13
  hasFlush: boolean;
14
14
  hasMount: boolean;
15
15
  constructOnly: Set<string>;
@@ -58,10 +58,10 @@ const addAll = <T>(target: Set<T>, source: Iterable<T> | undefined): void => {
58
58
  };
59
59
 
60
60
  const accumulateAncestor = (info: TypeInfo, ancestor: string): void => {
61
- Object.assign(info.signals, SIGNALS[ancestor] ?? {});
61
+ Object.assign(info.signals, signals[ancestor] ?? {});
62
62
  addAll(info.userEventSignals, userEventSignals[ancestor]);
63
- addAll(info.constructOnly, CONSTRUCT_ONLY_PROPS[ancestor]);
64
- addAll(info.construct, CONSTRUCT_PROPS[ancestor]);
63
+ addAll(info.constructOnly, constructOnlyProps[ancestor]);
64
+ addAll(info.construct, constructProps[ancestor]);
65
65
  info.behaviors.push(...(ELEMENTS[ancestor]?.behaviors ?? []));
66
66
  };
67
67
 
@@ -92,7 +92,7 @@ const buildTypeInfo = (name: string): TypeInfo => {
92
92
  userEventSignals: new Set(),
93
93
  behaviors: [],
94
94
  deferred: new Set(),
95
- lazy: false,
95
+ isLazy: false,
96
96
  hasFlush: false,
97
97
  hasMount: false,
98
98
  constructOnly: new Set(),
@@ -105,10 +105,10 @@ const buildTypeInfo = (name: string): TypeInfo => {
105
105
  }
106
106
 
107
107
  resolveBehaviorFlags(info);
108
- info.lazy = chain.some((ancestor) => ELEMENTS[ancestor]?.lazy === true);
108
+ info.isLazy = chain.some((ancestor) => ELEMENTS[ancestor]?.isLazy === true);
109
109
 
110
110
  for (const ancestor of chain.toReversed()) {
111
- Object.assign(info.defaults, DEFAULT_PROPS[ancestor] ?? {});
111
+ Object.assign(info.defaults, defaultProps[ancestor] ?? {});
112
112
  }
113
113
 
114
114
  return info;
@@ -5,7 +5,7 @@ import { getOrInsert } from "@gtkx/utils";
5
5
  import type { ElementBehavior, Props } from "./registry.js";
6
6
 
7
7
  type ContentKind = "label" | "buffer" | "tag" | "anchor";
8
- type HandlerRecord = { signal: string; handler: SignalHandler; wrapped: SignalHandler; blockable: boolean };
8
+ type HandlerRecord = { signal: string; handler: SignalHandler; wrapped: SignalHandler; isBlockable: boolean };
9
9
  type Dispatch = (fn: () => unknown) => unknown;
10
10
 
11
11
  type SignalTarget = {
@@ -21,7 +21,7 @@ type PlacedChild = {
21
21
  adopted: GObject.Object | null;
22
22
  slot: string;
23
23
  behavior: ElementBehavior | null;
24
- attached: boolean;
24
+ isAttached: boolean;
25
25
  };
26
26
 
27
27
  type ElementNode = SignalTarget & {
@@ -129,7 +129,7 @@ const lazyTarget = (node: LazyNode, adopted: GObject.Object): SignalTarget => ({
129
129
  });
130
130
 
131
131
  const getOrCreateContext = (node: ElementNode, behavior: ElementBehavior): unknown =>
132
- getOrInsert(node.contexts, behavior, () => behavior.createContext?.(node.object));
132
+ getOrInsert(node.contexts, behavior, () => behavior.initialize?.(node.object));
133
133
 
134
134
  export {
135
135
  ELEMENT_KIND,