@gjsify/gtk-host 0.43.0 → 0.45.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 (63) hide show
  1. package/README.md +86 -13
  2. package/lib/esm/adapters/react.js +1 -1
  3. package/lib/esm/adapters/solid.js +1 -1
  4. package/lib/esm/conformance/diagnostics.js +2 -2
  5. package/lib/esm/conformance/index.js +2 -2
  6. package/lib/esm/descriptors/adw.js +1 -1
  7. package/lib/esm/descriptors/gtk.js +1 -1
  8. package/lib/esm/errors.js +1 -1
  9. package/lib/esm/generated/widgets.js +1 -1
  10. package/lib/esm/host.js +1 -1
  11. package/lib/esm/index.js +1 -1
  12. package/lib/esm/list/controller.js +1 -0
  13. package/lib/esm/list/index.js +1 -0
  14. package/lib/esm/list/scroll.js +1 -0
  15. package/lib/esm/policies.js +1 -1
  16. package/lib/esm/probe.js +1 -1
  17. package/lib/esm/signals.js +1 -1
  18. package/lib/esm/style/errors.js +1 -0
  19. package/lib/esm/style/gtk-css.js +1 -0
  20. package/lib/esm/style/gtk-props.js +1 -0
  21. package/lib/esm/style/index.js +1 -0
  22. package/lib/esm/style/layout.js +1 -0
  23. package/lib/esm/style/paint.js +1 -0
  24. package/lib/esm/style/resolve.js +1 -0
  25. package/lib/esm/style/sheet.js +3 -0
  26. package/lib/esm/style/tokens.js +1 -0
  27. package/lib/types/adapters/react.d.ts +59 -10
  28. package/lib/types/adapters/solid.d.ts +35 -0
  29. package/lib/types/conformance/diagnostics.d.ts +13 -3
  30. package/lib/types/conformance/index.d.ts +1 -1
  31. package/lib/types/descriptors/index.d.ts +2 -2
  32. package/lib/types/errors.d.ts +10 -0
  33. package/lib/types/generated/props.d.ts +80 -1
  34. package/lib/types/generator/emit-types.d.mts +1 -1
  35. package/lib/types/generator/gir.d.mts +36 -2
  36. package/lib/types/host.d.ts +2 -2
  37. package/lib/types/index.d.ts +1 -1
  38. package/lib/types/list/controller.d.ts +112 -0
  39. package/lib/types/list/index.d.ts +2 -0
  40. package/lib/types/list/list.spec.d.ts +2 -0
  41. package/lib/types/list/scroll.d.ts +26 -0
  42. package/lib/types/policies.d.ts +11 -0
  43. package/lib/types/probe.d.ts +80 -2
  44. package/lib/types/probe.spec.d.ts +2 -0
  45. package/lib/types/props.d.ts +7 -4
  46. package/lib/types/signals.d.ts +3 -1
  47. package/lib/types/style/errors.d.ts +6 -0
  48. package/lib/types/style/gtk-css.d.ts +24 -0
  49. package/lib/types/style/gtk-css.spec.d.ts +2 -0
  50. package/lib/types/style/gtk-props.d.ts +27 -0
  51. package/lib/types/style/gtk-props.spec.d.ts +2 -0
  52. package/lib/types/style/index.d.ts +13 -0
  53. package/lib/types/style/layout.d.ts +163 -0
  54. package/lib/types/style/layout.spec.d.ts +2 -0
  55. package/lib/types/style/paint.d.ts +53 -0
  56. package/lib/types/style/paint.spec.d.ts +2 -0
  57. package/lib/types/style/resolve.d.ts +58 -0
  58. package/lib/types/style/sheet.d.ts +40 -0
  59. package/lib/types/style/sheet.spec.d.ts +2 -0
  60. package/lib/types/style/tokens.d.ts +58 -0
  61. package/lib/types/testing/gate.d.mts +23 -0
  62. package/lib/types/types.d.ts +21 -4
  63. package/package.json +26 -12
@@ -1,2 +1,25 @@
1
+ import { type Runtime } from '@gjsify/unit';
1
2
  import type { DiagnosticsGate } from '../conformance/diagnostics.js';
2
3
  export declare const gated: (gate: DiagnosticsGate, name: string, body: () => Promise<void>) => Promise<void>;
4
+ /**
5
+ * The runtimes that can host GTK — and an IDENTITY list on purpose.
6
+ *
7
+ * These suites need a reachable GTK, not a particular interpreter, so the
8
+ * expressive form would be a capability (`@gjsify/unit` splits `'Display'` from
9
+ * `'Gl'` for exactly that reason). It is not used here, and the reason is the
10
+ * failure mode rather than taste.
11
+ *
12
+ * A capability can only be PROBED — nothing about `(os, env)` answers "is the Gtk
13
+ * typelib reachable from this process", and `@gjsify/unit` is Tier 1 and must not
14
+ * import `gi://` to find out. A probe that answers "no" makes the whole suite STAND
15
+ * DOWN, and `requireAxes` cannot catch that: it only holds axes the host MATCHES.
16
+ * So a container that lost its GTK would run zero tests and report success — the
17
+ * green-that-checked-nothing shape, arriving through the very gate meant to widen
18
+ * coverage. Measured once already: gated on `'Gjs'` alone, this suite built for the
19
+ * node target exited 0 having run 0 tests from 0 gates, 9 stood down.
20
+ *
21
+ * Named identities instead mean the suite RUNS wherever it was built, and a missing
22
+ * GTK dies loudly at `Gtk.init()` in the first line of each suite. Louder beats
23
+ * more expressive when the quiet failure is a pass.
24
+ */
25
+ export declare const GTK_HOSTS: Runtime[];
@@ -117,12 +117,29 @@ export type ChildPolicy = {
117
117
  remove: string;
118
118
  wrap: 'list-box-row' | 'flow-box-child' | null;
119
119
  }
120
- /** `Adw.HeaderBar`, `Adw.ToolbarView`, `Adw.ActionRow`: named attachment points. */
120
+ /**
121
+ * `Adw.HeaderBar`, `Adw.ToolbarView`, `Adw.ActionRow`: named attachment points.
122
+ *
123
+ * `remove` is OPTIONAL because a slot can be backed two ways and only one of them
124
+ * needs it. A `set_`-prefixed slot is emptied by writing `null` back through the
125
+ * same setter (`detachChild` already does exactly that, via `setterSlotOf`), so a
126
+ * policy whose slots are ALL setters never reaches a remove method — and
127
+ * `Adw.NavigationSplitView` / `Adw.OverlaySplitView` have none to name: measured on
128
+ * libadwaita 1.9.3, their only `remove*` methods are `GtkWidget`'s
129
+ * (`remove_controller`, `remove_css_class`, …). Declaring `remove: 'remove'` there
130
+ * would be a claim `descriptorProblems()` correctly rejects.
131
+ *
132
+ * An ADDER-backed slot (`add_top_bar`, `pack_start`) is the opposite: nothing takes
133
+ * a child back out of it but a remove method, so `remove` is REQUIRED the moment one
134
+ * slot does not start with `set_`. That rule is machine-checked in `policyProblems()`
135
+ * rather than left to this comment — optional in the type and unchecked would turn
136
+ * `Adw.ToolbarView` losing its `remove` into a `TypeError` deep inside an unmount.
137
+ */
121
138
  | {
122
139
  kind: 'slotted';
123
140
  slots: Record<string, string>;
124
141
  defaultSlot: string;
125
- remove: string;
142
+ remove?: string;
126
143
  }
127
144
  /**
128
145
  * `Gtk.Stack`, `Adw.NavigationView`: children addressed by name/tag.
@@ -150,14 +167,14 @@ export type ChildPolicy = {
150
167
  * Generated, not curated: the tag exists, its placement rule does not.
151
168
  *
152
169
  * The generated table adds every concrete GtkWidget descendant the GIR
153
- * describes — 164 of them — while the curated table measures placement for a
170
+ * describes, plus the placement carriers, while the curated table measures placement for a
154
171
  * fraction. Guessing an adder for the rest would be the worst of the three
155
172
  * options: `add` and `append` and `set_child` all exist somewhere in GTK, and
156
173
  * calling the wrong one is a warning at exit 0.
157
174
  *
158
175
  * So the honest state is spelled out. Such a widget can be CREATED and given
159
176
  * properties and handlers; inserting a child raises a named error that says
160
- * which tag needs a curated policy. A leaf widget — most of the 164 — needs
177
+ * which tag needs a curated policy. A leaf widget — most of the table — needs
161
178
  * nothing more.
162
179
  */
163
180
  | {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/gtk-host",
3
- "version": "0.43.0",
3
+ "version": "0.45.0",
4
4
  "description": "Framework-agnostic GTK4/Adwaita host: the element model UI-framework renderers bind to",
5
5
  "type": "module",
6
6
  "module": "lib/esm/index.js",
@@ -10,6 +10,14 @@
10
10
  "types": "./lib/types/index.d.ts",
11
11
  "default": "./lib/esm/index.js"
12
12
  },
13
+ "./style": {
14
+ "types": "./lib/types/style/index.d.ts",
15
+ "default": "./lib/esm/style/index.js"
16
+ },
17
+ "./list": {
18
+ "types": "./lib/types/list/index.d.ts",
19
+ "default": "./lib/esm/list/index.js"
20
+ },
13
21
  "./vue": {
14
22
  "types": "./lib/types/adapters/vue.d.ts",
15
23
  "default": "./lib/esm/adapters/vue.js"
@@ -63,9 +71,11 @@
63
71
  "build:gjsify": "gjsify build --library 'src/**/*.{ts,js}' --exclude 'src/**/*.spec.{mts,ts}' 'src/test.{mts,ts}'",
64
72
  "build:types": "gjsify tsc",
65
73
  "build:test": "gjsify run build:test:gjs",
74
+ "build:test:node": "gjsify build src/test.mts --app node --outfile dist/test.node.mjs --define '__VUE_OPTIONS_API__=false' --define '__VUE_PROD_DEVTOOLS__=false' --define '__VUE_PROD_HYDRATION_MISMATCH_DETAILS__=false' --define 'process.env.NODE_ENV=\"production\"' --exclude-globals navigator",
66
75
  "build:test:gjs": "gjsify build src/test.mts --app gjs --outfile test.gjs.mjs --define '__VUE_OPTIONS_API__=false' --define '__VUE_PROD_DEVTOOLS__=false' --define '__VUE_PROD_HYDRATION_MISMATCH_DETAILS__=false' --define 'process.env.NODE_ENV=\"production\"' --exclude-globals navigator",
67
76
  "test": "gjsify run build:gjsify && gjsify run build:test && gjsify run test:gjs",
68
77
  "test:gjs": "gjsify run test.gjs.mjs",
78
+ "test:gjs-on-node": "gjsify run build:gjsify && gjsify run build:test:node && NODE_GI_NATIVE=${NODE_GI_NATIVE:-prebuild} node dist/test.node.mjs",
69
79
  "generate": "gjsify build src/generator/main.mts --app gjs --outfile tmp/generate.gjs.mjs && gjsify run tmp/generate.gjs.mjs -- --out src/generated && gjsify format src/generated"
70
80
  },
71
81
  "keywords": [
@@ -88,8 +98,8 @@
88
98
  "peerDependencies": {
89
99
  "@vue/runtime-core": "^3.5.0",
90
100
  "solid-js": "^1.9.0",
91
- "react": "^18.3.1",
92
- "react-reconciler": "^0.29.2"
101
+ "react": "^19.2.0",
102
+ "react-reconciler": "^0.33.0"
93
103
  },
94
104
  "peerDependenciesMeta": {
95
105
  "@vue/runtime-core": {
@@ -106,28 +116,32 @@
106
116
  }
107
117
  },
108
118
  "devDependencies": {
109
- "@gjsify/cli": "^0.43.0",
119
+ "@gjsify/cli": "^0.45.0",
110
120
  "@vue/runtime-core": "^3.5.0",
111
121
  "solid-js": "^1.9.0",
112
- "@gjsify/unit": "^0.43.0",
122
+ "@gjsify/unit": "^0.45.0",
113
123
  "@types/node": "^25.9.2",
114
124
  "typescript": "^6.0.3",
115
- "@gjsify/domparser": "^0.43.0",
125
+ "@gjsify/domparser": "^0.45.0",
126
+ "@gjsify/node-gi": "file:../../node-gi/node-gi",
116
127
  "vue": "^3.5.41",
117
128
  "vue-tsc": "^3.3.11",
118
- "react": "^18.3.1",
119
- "react-reconciler": "^0.29.2",
120
- "@types/react": "^18.3.12",
121
- "@types/react-reconciler": "^0.28.9"
129
+ "react": "^19.2.0",
130
+ "react-reconciler": "^0.33.0",
131
+ "@types/react": "^19.2.2",
132
+ "@types/react-reconciler": "^0.33.0"
122
133
  },
123
134
  "gjsify": {
124
135
  "runtimes": {
125
136
  "gjs": "polyfill",
126
- "node": "none",
137
+ "node": "polyfill",
127
138
  "browser": "none",
128
139
  "nativescript": "none"
129
140
  },
130
- "tier": 3
141
+ "tier": 3,
142
+ "widgetVocabulary": {
143
+ "role": "reference"
144
+ }
131
145
  },
132
146
  "license": "MIT",
133
147
  "repository": {