@gjsify/gtk-host 0.44.0 → 0.46.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 (65) hide show
  1. package/README.md +50 -4
  2. package/lib/esm/adapters/solid.js +1 -1
  3. package/lib/esm/conformance/diagnostics.js +1 -1
  4. package/lib/esm/conformance/index.js +2 -2
  5. package/lib/esm/descriptors/adw.js +1 -1
  6. package/lib/esm/descriptors/gtk.js +1 -1
  7. package/lib/esm/errors.js +1 -1
  8. package/lib/esm/generated/widgets.js +1 -1
  9. package/lib/esm/host.js +1 -1
  10. package/lib/esm/index.js +1 -1
  11. package/lib/esm/list/controller.js +1 -0
  12. package/lib/esm/list/index.js +1 -0
  13. package/lib/esm/list/scroll.js +1 -0
  14. package/lib/esm/policies.js +1 -1
  15. package/lib/esm/probe.js +1 -1
  16. package/lib/esm/props.js +1 -1
  17. package/lib/esm/registry.js +1 -1
  18. package/lib/esm/signals.js +1 -1
  19. package/lib/esm/style/document.js +1 -0
  20. package/lib/esm/style/gtk-props.js +1 -1
  21. package/lib/esm/style/index.js +1 -1
  22. package/lib/esm/style/layout.js +1 -1
  23. package/lib/esm/style/paint.js +1 -1
  24. package/lib/esm/style/sheet.js +3 -3
  25. package/lib/esm/style/theme.js +3 -0
  26. package/lib/esm/style/tokens.js +1 -1
  27. package/lib/types/adapters/solid.d.ts +35 -0
  28. package/lib/types/conformance/diagnostics.d.ts +1 -1
  29. package/lib/types/descriptors/index.d.ts +3 -3
  30. package/lib/types/errors.d.ts +10 -0
  31. package/lib/types/generated/props.d.ts +684 -816
  32. package/lib/types/generated/widgets.d.ts +1 -1
  33. package/lib/types/generator/emit-types.d.mts +2 -2
  34. package/lib/types/generator/emit.d.mts +16 -6
  35. package/lib/types/generator/girs-vocabulary.d.mts +45 -0
  36. package/lib/types/generator/main.d.mts +16 -8
  37. package/lib/types/generator/model.d.mts +95 -0
  38. package/lib/types/generator/names.d.mts +19 -0
  39. package/lib/types/generator/vocabulary-dts.d.mts +47 -0
  40. package/lib/types/host.d.ts +3 -3
  41. package/lib/types/index.d.ts +1 -1
  42. package/lib/types/list/controller.d.ts +112 -0
  43. package/lib/types/list/index.d.ts +2 -0
  44. package/lib/types/list/list.spec.d.ts +2 -0
  45. package/lib/types/list/scroll.d.ts +26 -0
  46. package/lib/types/policies.d.ts +18 -1
  47. package/lib/types/probe.d.ts +49 -0
  48. package/lib/types/probe.spec.d.ts +2 -0
  49. package/lib/types/props.d.ts +13 -1
  50. package/lib/types/registry.d.ts +1 -1
  51. package/lib/types/signals.d.ts +3 -1
  52. package/lib/types/style/document.d.ts +22 -0
  53. package/lib/types/style/index.d.ts +6 -3
  54. package/lib/types/style/layout.d.ts +34 -0
  55. package/lib/types/style/sheet.d.ts +0 -5
  56. package/lib/types/style/theme.d.ts +158 -0
  57. package/lib/types/style/theme.spec.d.ts +2 -0
  58. package/lib/types/style/tokens.d.ts +76 -0
  59. package/lib/types/style/tokens.spec.d.ts +2 -0
  60. package/lib/types/types.d.ts +84 -4
  61. package/package.json +22 -16
  62. package/lib/types/generator/gir.d.mts +0 -164
  63. package/lib/types/generator/mini.fixture.d.mts +0 -30
  64. package/lib/types/generator/surface.d.mts +0 -62
  65. package/lib/types/generator/tsmap.d.mts +0 -73
@@ -1,5 +1,6 @@
1
1
  import type Gtk from '@girs/gtk-4.0';
2
2
  import { widgetOf } from '../host.js';
3
+ import type { ListRowKey, ListRowSink } from '../list/index.js';
3
4
  import type { HostNode } from '../types.js';
4
5
  export declare const render: (code: () => HostNode, node: HostNode) => () => void, effect: <T>(fn: (prev?: T) => T, init?: T) => void, memo: <T>(fn: () => T, equal: boolean) => () => T, createComponent: <T>(Comp: (props: T) => HostNode, props: T) => HostNode, createElement: (tag: string) => HostNode, createTextNode: (value: string) => HostNode, insertNode: (parent: HostNode, node: HostNode, anchor?: HostNode) => void, insert: <T>(parent: any, accessor: T | (() => T), marker?: any | null, initial?: any) => HostNode, spread: <T>(node: any, accessor: (() => T) | T, skipChildren?: boolean) => void, setProp: <T>(node: HostNode, name: string, value: T, prev?: T) => T, mergeProps: (...sources: unknown[]) => unknown, use: <A, T>(fn: (element: HostNode, arg: A) => T, element: HostNode, arg: A) => T;
5
6
  /**
@@ -14,6 +15,40 @@ export declare const render: (code: () => HostNode, node: HostNode) => () => voi
14
15
  * disconnects the signal handlers.
15
16
  */
16
17
  export declare function mount(code: () => HostNode, container: Gtk.Widget): () => void;
18
+ /**
19
+ * What `listRows` keeps for one ROW WIDGET: a way to show a row in it, and a way to
20
+ * let go. Opaque to the controller, which stores it and hands it back.
21
+ */
22
+ export interface ListRowHandle<Row extends ListRowKey> {
23
+ show(row: Row | null, index: number): void;
24
+ dispose(): void;
25
+ }
26
+ /**
27
+ * Solid's half of a `Gtk.ListView`, for `ListController` in `@gjsify/gtk-host/list`.
28
+ *
29
+ * The controller owns the model, the factory and the key diff — none of which has a
30
+ * framework in it. This supplies the three callbacks it cannot have: what to put in a
31
+ * row widget, what to show there, and how to let go.
32
+ *
33
+ * ONE REACTIVE ROOT PER ROW WIDGET, created in `mountRow` and never again, for two
34
+ * reasons that are not the same kind of thing. The carrier is taken ONCE because taking
35
+ * it per bind is REFUSED: `adopt` snapshots what a container already held and cannot
36
+ * tell our own previous child from application chrome, and the same carrier comes back
37
+ * on the next show, so the second one reads our own row as someone else's and raises
38
+ * `occupied-slot` (measured against this seam; `host.spec.ts` pins the same refusal
39
+ * from the host's side). The row's signals live INSIDE the root rather than beside it
40
+ * for a documented reason rather than a measured one — Solid never disposes a
41
+ * computation created with no owner, which for a per-row memo would be one leak per
42
+ * row.
43
+ *
44
+ * What the row sees is an ACCESSOR, not a value, and that is the capability this seam
45
+ * buys over re-rendering: when `setRows` finds unchanged keys over changed content, the
46
+ * controller shows every live row again, this writes one signal, and Solid updates the
47
+ * properties that actually changed — the widgets stay. Only the transition between
48
+ * "holds a row" and "holds nothing" rebuilds the subtree, which is what `present`
49
+ * isolates.
50
+ */
51
+ export declare function listRows<Row extends ListRowKey>(renderRow: (row: () => Row, index: () => number) => HostNode): ListRowSink<Row, ListRowHandle<Row>>;
17
52
  /** `<For each={items}>` — keyed by item identity, so a reorder MOVES nodes. */
18
53
  export declare const For: <T>(props: {
19
54
  each: readonly T[] | undefined | null | false;
@@ -31,7 +31,7 @@ export declare function isEnvironmentDiagnostic(message: string): boolean;
31
31
  * arrive without one. The first version answered `String(raw ?? '')`, so such a
32
32
  * record was counted and then described as nothing: a CI run failed with
33
33
  * `GTK reported 1 diagnostic(s) that would have passed at exit 0:` followed by a
34
- * BLANK LIST, over a test that had just constructed 164 widgets. A gate that can
34
+ * BLANK LIST, over a test that had just constructed the whole table. A gate that can
35
35
  * count a failure but not name it sends the reader back to guessing, which is the
36
36
  * state this whole module exists to end.
37
37
  *
@@ -20,8 +20,8 @@ export declare const CURATED_DESCRIPTORS: readonly WidgetDescriptor[];
20
20
  * that merely LISTS such a tag hands a renderer a way to kill the process, and
21
21
  * `descriptorProblems()` cannot see it because it never instantiates anything.
22
22
  *
23
- * MEASURED bare-constructing all 164 generated rows on gjs 1.88.1 / GTK 4.22.4 /
24
- * libadwaita 1.9.3, resuming past each abort: **163 construct, one does not**, and not a
23
+ * MEASURED bare-constructing every generated row on gjs 1.88.1 / GTK 4.22.4 /
24
+ * libadwaita 1.9.3, resuming past each abort: **all but one construct**, and not a
25
25
  * single row throws. So this map is one entry rather than a policy — and
26
26
  * `constructsEveryDescriptor` in `generated.spec.ts` is what keeps it one entry.
27
27
  *
@@ -49,7 +49,7 @@ export declare const BUILTIN_DESCRIPTORS: readonly WidgetDescriptor[];
49
49
  export declare function registerBuiltinWidgets(): void;
50
50
  /** What the shipped table is made of, for a diagnostic or an about box. */
51
51
  export declare const tableProvenance: () => {
52
- gir: "Gtk-4.0 Adw-1";
52
+ gir: "Gtk-4.0/4.23.3 Adw-1/1.10.0";
53
53
  curated: number;
54
54
  generated: number;
55
55
  total: number;
@@ -43,6 +43,16 @@ export declare const err: {
43
43
  textNotAccepted: (tag: string, text: string) => GtkHostError;
44
44
  unclaimedChild: (parentTag: string, childTag: string) => GtkHostError;
45
45
  unknownSlot: (parentTag: string, slot: string, known: string[]) => GtkHostError;
46
+ /**
47
+ * An adder-backed slot with nothing that takes the child back out.
48
+ *
49
+ * `descriptorProblems()` rejects this shape up front, so a BUILT-IN descriptor can
50
+ * never reach here — but `registerWidget` takes descriptors from applications, which
51
+ * run no such check. Without this the unmount would be
52
+ * `TypeError: host[undefined] is not a function`, blaming the host for a claim the
53
+ * descriptor made.
54
+ */
55
+ slotNeedsRemove: (parentTag: string, slot: string, adder: string) => GtkHostError;
46
56
  rejectedChild: (parentTag: string, childTag: string, reason: string) => GtkHostError;
47
57
  uncuratedPlacement: (parentTag: string, childTag: string) => GtkHostError;
48
58
  siblingCycle: (parentTag: string) => GtkHostError;