@gtkx/config 2.0.0-beta.13 → 2.0.0-beta.15

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/src/config.ts CHANGED
@@ -9,9 +9,17 @@ import { resolveUserEventSignals } from "./user-event-signals.ts";
9
9
 
10
10
  /** Object form of the `reactCompiler` config key, forwarded to `babel-plugin-react-compiler`. */
11
11
  type ReactCompilerOptions = {
12
- /** Which functions the React Compiler processes. */
12
+ /**
13
+ * Which functions the React Compiler processes.
14
+ *
15
+ * @defaultValue `"infer"`, the React Compiler's own default
16
+ */
13
17
  compilationMode?: "all" | "annotation" | "infer" | "syntax" | undefined;
14
- /** Which React Compiler diagnostics fail the build. */
18
+ /**
19
+ * Which React Compiler diagnostics fail the build.
20
+ *
21
+ * @defaultValue `"none"`, the React Compiler's own default
22
+ */
15
23
  panicThreshold?: "all_errors" | "critical_errors" | "none" | undefined;
16
24
  };
17
25
 
@@ -26,43 +34,94 @@ type ResolvedReactCompilerOptions = ReactCompilerOptions & {
26
34
 
27
35
  /**
28
36
  * GTKX project configuration authored in `gtkx.config.ts` and validated when loaded.
37
+ *
38
+ * [Configuration and Codegen](https://gtkx.dev/v2/guide/configuration-and-codegen) shows how to set up the file
39
+ * and what codegen generates from it.
29
40
  */
30
41
  type Config = {
31
42
  /**
32
43
  * Additional GIR libraries to bind, such as `WebKit-6.0`.
33
44
  * Adwaita and GTK are included implicitly and must not be listed.
45
+ *
46
+ * @defaultValue None: GTKX binds `Adw-1`, `Gtk-4.0` and the libraries they depend on
34
47
  */
35
48
  libraries?: string[] | undefined;
36
- /** Additional GIR search directories. Relative paths are resolved from the project root. */
49
+ /**
50
+ * Additional GIR search directories, searched before the system ones. Relative paths are resolved from the
51
+ * project root.
52
+ *
53
+ * @defaultValue None: GTKX searches `/usr/share/gir-1.0` and the GIR directories pkg-config reports for
54
+ * `gobject-introspection-1.0`
55
+ */
37
56
  girPath?: string[] | undefined;
38
57
  /**
39
58
  * GApplication identifier, such as `com.example.Tasks`. Required to run, build or deploy the project as an
40
59
  * application; a package that is not an application, such as a component library, leaves it out.
60
+ *
61
+ * @defaultValue None: the project loads as a package, with `isApplication` set to `false`
41
62
  */
42
63
  applicationId?: string | undefined;
43
- /** Whether to enable the React Compiler, or options passed to it. Enabled by default. */
64
+ /**
65
+ * Whether to enable the React Compiler, or options passed to it. `false` disables it.
66
+ *
67
+ * @defaultValue `true`
68
+ * @example
69
+ * ```ts
70
+ * reactCompiler: { compilationMode: "annotation" },
71
+ * ```
72
+ */
44
73
  reactCompiler?: boolean | ReactCompilerOptions | undefined;
45
74
  /**
46
75
  * Whether GTKX generates project bindings. Set to `false` to reuse an installed binding store.
47
- * Defaults to `true`.
76
+ *
77
+ * @defaultValue `true`
48
78
  */
49
79
  codegen?: boolean | undefined;
50
80
  /**
51
81
  * Additional signals to suppress during React property updates, keyed by GLib type name.
52
82
  * Entries extend the built-in signal lists.
83
+ *
84
+ * @defaultValue `{}`: only the built-in lists
53
85
  */
54
86
  userEventSignals?: Record<string, string[]> | undefined;
55
- /** Custom element behaviors and overrides for generated components, props, and documentation. */
87
+ /**
88
+ * Custom element behaviors and overrides for generated components, props, and documentation.
89
+ *
90
+ * @defaultValue `{}`: no custom behaviors or overrides
91
+ */
56
92
  elements?: ElementsOptions | undefined;
57
- /** Path to an icon theme directory or a single application icon file, relative to the project root. */
93
+ /**
94
+ * Path to an icon theme directory or a single SVG, PNG or XPM application icon file, relative to the project
95
+ * root. Deployment requires an icon.
96
+ *
97
+ * @defaultValue The one `<applicationId>.svg`, `.png` or `.xpm` file in the project root, if exactly one
98
+ * exists
99
+ */
58
100
  applicationIcon?: string | undefined;
59
- /** Application metadata, bundled runtime settings, and packaging options used by `gtkx deploy`. */
101
+ /**
102
+ * Application metadata, bundled runtime settings, and packaging options used by `gtkx deploy`.
103
+ *
104
+ * @defaultValue `{}`: metadata comes from `package.json` and packaging builds a Flatpak
105
+ */
60
106
  deploy?: DeployOptions | undefined;
61
- /** Controls the project instructions and reference files generated for coding agents. */
107
+ /**
108
+ * Controls the project instructions and reference files generated for coding agents.
109
+ *
110
+ * @defaultValue `{}`: an application gets both, a package neither
111
+ */
62
112
  agents?: AgentsOptions | undefined;
63
- /** Default tool selection and access mode for the project's MCP server. Command-line flags take precedence. */
113
+ /**
114
+ * Default tool selection and access mode for the project's MCP server. The `gtkx mcp` flags `--tools` and
115
+ * `--read-only` take precedence.
116
+ *
117
+ * @defaultValue `{}`: every tool, app interactions included
118
+ */
64
119
  mcp?: McpOptions | undefined;
65
- /** Controls warnings for deprecated configuration and behavior. */
120
+ /**
121
+ * Controls warnings for deprecated configuration and behavior.
122
+ *
123
+ * @defaultValue `{}`: every deprecation warning is shown
124
+ */
66
125
  deprecations?: DeprecationsOptions | undefined;
67
126
  };
68
127
  /** A {@link Config} whose `applicationId` is known, as loaded for an application. */
@@ -84,32 +143,66 @@ type ElementPropsExport = {
84
143
  export: string;
85
144
  /**
86
145
  * How the exported props are combined: `intersection` is inherited; `factory` applies only to this type.
87
- * Defaults to `intersection`.
146
+ *
147
+ * @defaultValue `"intersection"`
88
148
  */
89
149
  composition?: "factory" | "intersection" | undefined;
90
- /** Props that can only be set when the element is created; changing them afterward throws. */
150
+ /**
151
+ * Props that can only be set when the element is created; changing them afterward throws.
152
+ *
153
+ * @defaultValue `[]`
154
+ */
91
155
  constructOnly?: string[] | undefined;
92
156
  };
93
157
 
94
158
  /** Overrides for one GLib type in `elements.config`, keyed by its registered type name. */
95
159
  type ElementConfigOptions = {
96
- /** Component export that wraps the generated element. */
160
+ /**
161
+ * Component export that wraps the generated element.
162
+ *
163
+ * @defaultValue None: no wrapper `component`
164
+ */
97
165
  component?: ModuleExport | undefined;
98
- /** Additional props type to combine with the generated element props. */
166
+ /**
167
+ * Additional props type to combine with the generated element props.
168
+ *
169
+ * @defaultValue None: no extra `props` type
170
+ */
99
171
  props?: ElementPropsExport | undefined;
100
- /** Whether the parent container creates this element's GObject instead of the element constructing its own. */
172
+ /**
173
+ * Whether the parent container creates this element's GObject instead of the element constructing its own.
174
+ * Subtypes inherit the setting.
175
+ *
176
+ * @defaultValue `false`
177
+ */
101
178
  isLazy?: boolean | undefined;
102
- /** Accepted child GLib type names to show in the generated element documentation. */
179
+ /**
180
+ * Accepted child GLib type names to show in the generated element documentation.
181
+ *
182
+ * @defaultValue `[]`
183
+ */
103
184
  acceptedChildTypes?: string[] | undefined;
104
- /** GObject properties to leave out of generated props, such as properties managed by an element behavior. */
185
+ /**
186
+ * GObject properties to leave out of generated props, such as properties managed by an element behavior.
187
+ *
188
+ * @defaultValue `[]`: every GObject property becomes a prop
189
+ */
105
190
  omittedProps?: string[] | undefined;
106
191
  };
107
192
 
108
193
  /** The `elements` options: custom element behaviors and per-type overrides for generated elements. */
109
194
  type ElementsOptions = {
110
- /** Path, relative to the project root, of the module exporting the element behavior map. */
195
+ /**
196
+ * Path, relative to the project root, of the module exporting the element behavior map.
197
+ *
198
+ * @defaultValue None: only the behaviors built into `@gtkx/react` apply
199
+ */
111
200
  behaviors?: string | undefined;
112
- /** Element configuration overrides keyed by GLib type name, such as `GtkWidget`. */
201
+ /**
202
+ * Element configuration overrides keyed by GLib type name, such as `GtkWidget`.
203
+ *
204
+ * @defaultValue `{}`
205
+ */
113
206
  config?: Record<string, ElementConfigOptions> | undefined;
114
207
  };
115
208
 
@@ -118,13 +211,16 @@ type AgentsOptions = {
118
211
  /**
119
212
  * Whether codegen maintains the GTKX rules in `AGENTS.md` and creates a missing `CLAUDE.md` import.
120
213
  * `false` removes rules written earlier, deleting `AGENTS.md` and the `CLAUDE.md` import when nothing else
121
- * remains. Defaults to `true` for an application and `false` for a package without an `applicationId`.
214
+ * remains.
215
+ *
216
+ * @defaultValue `true` for an application, `false` for a package without an `applicationId`
122
217
  */
123
218
  rules?: boolean | undefined;
124
219
  /**
125
220
  * Whether codegen writes the generated element reference to `.gtkx/reference` and points the rules at it.
126
- * `false` removes a reference generated earlier. Defaults to `true` for an application and `false` for a
127
- * package without an `applicationId`.
221
+ * `false` removes a reference generated earlier.
222
+ *
223
+ * @defaultValue `true` for an application, `false` for a package without an `applicationId`
128
224
  */
129
225
  reference?: boolean | undefined;
130
226
  };
@@ -134,18 +230,31 @@ type McpOptions = {
134
230
  /**
135
231
  * Tool name patterns applied in order: `*` matches any text and a leading `!` excludes matches.
136
232
  * Omitted, empty, or exclusion-only lists start with all tools; other lists start with none.
233
+ * `gtkx mcp --tools` overrides it.
234
+ *
235
+ * @defaultValue `[]`: every tool
236
+ * @example
237
+ * ```ts
238
+ * tools: ["gtkx_*", "!gtkx_take_screenshot"],
239
+ * ```
137
240
  */
138
241
  tools?: string[] | undefined;
139
242
  /**
140
243
  * Whether the MCP server exposes only inspection and reference tools, excluding app interactions.
141
- * Defaults to `false`.
244
+ * `gtkx mcp --read-only` overrides it.
245
+ *
246
+ * @defaultValue `false`
142
247
  */
143
248
  readOnly?: boolean | undefined;
144
249
  };
145
250
 
146
251
  /** The `deprecations` options: which deprecation warnings stay silent. */
147
252
  type DeprecationsOptions = {
148
- /** Deprecation identifiers whose warnings are suppressed. There are currently no accepted identifiers. */
253
+ /**
254
+ * Deprecation identifiers whose warnings are suppressed. There are currently no accepted identifiers.
255
+ *
256
+ * @defaultValue `[]`
257
+ */
149
258
  silence?: never[] | undefined;
150
259
  };
151
260