@gjsify/adwaita-core 0.64.12-next.281 → 0.64.13-next.283

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 (46) hide show
  1. package/lib/esm/action-row.js +1 -1
  2. package/lib/esm/conformance/action-row.js +1 -1
  3. package/lib/esm/conformance/expander-row.js +1 -0
  4. package/lib/esm/conformance/index.js +1 -1
  5. package/lib/esm/conformance/label-markup.js +1 -0
  6. package/lib/esm/conformance/label.js +1 -1
  7. package/lib/esm/conformance/list.js +1 -1
  8. package/lib/esm/conformance/rows.js +1 -1
  9. package/lib/esm/conformance/split-button.js +1 -1
  10. package/lib/esm/default-translate.js +1 -0
  11. package/lib/esm/glib.js +1 -1
  12. package/lib/esm/gtk-platform.js +1 -1
  13. package/lib/esm/index.js +1 -1
  14. package/lib/esm/label-markup.js +1 -0
  15. package/lib/esm/label.js +1 -1
  16. package/lib/esm/list.js +1 -1
  17. package/lib/esm/option-list.js +1 -0
  18. package/lib/esm/pango-markup.js +1 -1
  19. package/lib/esm/rows.js +1 -1
  20. package/lib/esm/split-button.js +1 -1
  21. package/lib/types/action-row.d.ts +5 -1
  22. package/lib/types/conformance/action-row.d.ts +28 -0
  23. package/lib/types/conformance/expander-row.d.ts +40 -0
  24. package/lib/types/conformance/index.d.ts +10 -6
  25. package/lib/types/conformance/label-markup.d.ts +73 -0
  26. package/lib/types/conformance/list.d.ts +46 -39
  27. package/lib/types/conformance/rows.d.ts +62 -2
  28. package/lib/types/conformance/split-button.d.ts +7 -3
  29. package/lib/types/default-translate.d.ts +6 -0
  30. package/lib/types/default-translate.spec.d.ts +2 -0
  31. package/lib/types/engine.d.ts +40 -6
  32. package/lib/types/glib.d.ts +40 -0
  33. package/lib/types/glib.spec.d.ts +2 -0
  34. package/lib/types/gtk-platform.d.ts +9 -0
  35. package/lib/types/index.d.ts +13 -7
  36. package/lib/types/label-markup.d.ts +129 -0
  37. package/lib/types/label-markup.spec.d.ts +2 -0
  38. package/lib/types/label.d.ts +6 -0
  39. package/lib/types/list-view.d.ts +4 -4
  40. package/lib/types/list.d.ts +9 -23
  41. package/lib/types/option-list.d.ts +128 -0
  42. package/lib/types/option-list.spec.d.ts +2 -0
  43. package/lib/types/pango-markup.d.ts +47 -2
  44. package/lib/types/rows.d.ts +193 -65
  45. package/lib/types/split-button.d.ts +28 -6
  46. package/package.json +4 -4
@@ -1,4 +1,5 @@
1
- import type { AdwComboOption, AdwListItemsChanged, AdwListModel, AdwListModelInput } from '../list.js';
1
+ import type { AdwComboOption, AdwListItemsChanged, AdwListModel, AdwListModelInput, AdwListModelSource } from '../list.js';
2
+ import { GjsifyOptionList } from '../option-list.js';
2
3
  import type { TabViewPagesChange } from '../tab-view.js';
3
4
  /** One {@link normalizeComboOptions} expectation. */
4
5
  export interface ListNormalizeVector {
@@ -24,6 +25,19 @@ export interface ListNormalizeVector {
24
25
  * a citation, and that sentence named no table).
25
26
  */
26
27
  export declare const LIST_NORMALIZE_VECTORS: ReadonlyArray<ListNormalizeVector>;
28
+ /**
29
+ * A {@link LIST_NORMALIZE_VECTORS} row as the value a `model` PROPERTY write takes.
30
+ *
31
+ * ADR 0122 § 4 took the array arm off that property, so the ARRAY rows go in as a list built
32
+ * out of the array: the normaliser still runs on them, one step further in, as
33
+ * {@link GjsifyOptionList}'s own constructor. The model-source rows go STRAIGHT through —
34
+ * that is the shape the door now takes, and they are what proves a surface reads items by
35
+ * position rather than recognising one class.
36
+ *
37
+ * Lives here rather than in each driving suite because WHICH door a row reaches through is
38
+ * part of what the table claims, and two copies of that answer are two claims.
39
+ */
40
+ export declare function listModelForInput(input: AdwListModelInput): AdwListModelSource;
27
41
  /** One {@link parseListModel} expectation — the JSON attribute door. */
28
42
  export interface ListParseVector {
29
43
  /** The attribute value exactly as authored. */
@@ -65,20 +79,21 @@ export interface ListItemsChangedVector {
65
79
  * change, which is `g_list_store_splice`'s shape.
66
80
  */
67
81
  export declare const LIST_ITEMS_CHANGED_VECTORS: ReadonlyArray<ListItemsChangedVector>;
68
- /** What a caller does to the array it read back out of a `model` accessor. */
82
+ /** What a caller does to the options they hold, or to the model they were handed. */
69
83
  export type ListReadbackOp = 'append' | 'relabel-first' | 'remove-first';
70
- /** One read-mutate-assign expectation — see {@link LIST_MODEL_OWNERSHIP_VECTORS}. */
84
+ /** One ownership expectation — see {@link LIST_MODEL_OWNERSHIP_VECTORS}. */
71
85
  export interface ListModelOwnershipVector {
72
86
  initial: AdwListModel;
73
87
  /**
74
- * Which array the caller mutates: the one `model` handed BACK, or the one they
75
- * assigned and kept. Two doors into the same failure, and closing one leaves the other.
88
+ * WHAT the caller mutates. `input` is the array they authored and handed to
89
+ * `GjsifyOptionList.new`; `options` is the array read back out of `toOptions()`; `model`
90
+ * is the list itself, through its own `Gio.ListModel` API. The first two must move
91
+ * nothing and the third must move everything, and which of the three a surface gets
92
+ * wrong is the difference between a leak and a dropped redraw.
76
93
  */
77
- source: 'readback' | 'input';
94
+ source: 'options' | 'input' | 'model';
78
95
  op: ListReadbackOp;
79
- /** Whether the mutated array is assigned back to `model` afterwards. */
80
- assign: boolean;
81
- /** The model the surface holds when the row is done. */
96
+ /** The options the surface holds when the row is done. */
82
97
  model: AdwListModel;
83
98
  /** The splice the surface emits, or `null` where it emits none. */
84
99
  itemsChanged: AdwListItemsChanged | null;
@@ -87,50 +102,42 @@ export interface ListModelOwnershipVector {
87
102
  rule: string;
88
103
  }
89
104
  /**
90
- * WHO OWNS THE ARRAY a `model` accessor hands back — read, mutate, assign.
105
+ * WHO OWNS THE OPTIONS — the arrays a caller holds on either side of the model, and the
106
+ * model itself.
91
107
  *
92
108
  * The browser suite drives `LIST_MODEL_OWNERSHIP_VECTORS` through `<adw-combo-row>` and
93
- * `<gtk-drop-down>`, and core drives it through `ComboState` itself, which is the surface
94
- * where BOTH doors are reachable: the element setters run `normalizeComboOptions` and so
95
- * close the input door on their own, while `ComboState.setModel` takes a normalised model
96
- * straight from a caller.
109
+ * `<gtk-drop-down>`, and core drives it through `ComboState`.
97
110
  *
98
- * THE ROWS EXIST BECAUSE THE SPLICE MADE THIS A SILENT FAILURE. Under the full rebuild
99
- * every assignment redrew the list, so an aliased array was invisible; the splice decides
100
- * what to redraw by COMPARING the assignment against the stored model, and an alias makes
101
- * both sides read the new value — "nothing changed", nothing drawn, no error. `append`
102
- * with `assign` is the pattern that regressed, `relabel-first` is the same failure one
103
- * level down through a shared descriptor (which is why the copy is per ITEM and not just
104
- * per array), and the `assign: false` row is the invariant the other two rest on: what a
105
- * caller holds is THEIRS, so touching it moves nothing until they hand it back.
111
+ * READ, MUTATE, ASSIGN IS GONE AS A PATTERN, and that is what reshaped these rows. ADR 0122
112
+ * § 4 narrows `model` to a real `Gio.ListModel`, so there is no array to assign back: the
113
+ * only way to change a model in place is its own API, and handing over a DIFFERENT list is a
114
+ * replacement that resets the selection. What survives from the array era is the half that
115
+ * was never about assignment — an array a caller holds is THEIRS on both sides, going in
116
+ * (`GjsifyOptionList` copies each descriptor into an item) and coming out (`toOptions`
117
+ * copies each item back). `relabel-first` is why the copy is per ITEM rather than per array:
118
+ * a shared descriptor would let the text under a selection move with nothing emitted, which
119
+ * is the failure `GjsifyOptionObject`'s read-only `label` exists to prevent.
120
+ *
121
+ * The `model` rows are the other side of the same invariant: the ONE door that does move the
122
+ * list emits the one minimal splice for it, in each of the three directions a splice can go.
106
123
  */
107
124
  export declare const LIST_MODEL_OWNERSHIP_VECTORS: ReadonlyArray<ListModelOwnershipVector>;
108
125
  /**
109
- * The caller-side half of one {@link LIST_MODEL_OWNERSHIP_VECTORS} row: mutate the array a
110
- * `model` accessor handed back, IN PLACE, and hand the same array back.
126
+ * The caller-side half of an `options`/`input` row: mutate the array, IN PLACE, and hand the
127
+ * same array back.
111
128
  *
112
129
  * In place and returning its argument is the whole point — a helper that built a new array
113
130
  * would test the pattern that never broke.
114
131
  */
115
132
  export declare function applyListReadback(model: AdwComboOption[], op: ListReadbackOp): AdwComboOption[];
116
- /** One {@link clampListSelection} expectation. */
117
- export interface ListSelectionClampVector {
118
- selected: number;
119
- length: number;
120
- result: number;
121
- rule: string;
122
- }
123
133
  /**
124
- * Where a selection lands after the model under it was replaced.
134
+ * The model-side half: the same three ops through the list's own `Gio.ListModel` API.
125
135
  *
126
- * The browser suite drives `LIST_SELECTION_CLAMP_VECTORS` through `<adw-combo-row>` and
127
- * through that element only. `<gtk-drop-down>` REFUSES an out-of-range `selected` set
128
- * outright — its published contract, with `ComboState.hasIndex` as the shared bounds — so
129
- * the starting index these rows replace cannot be put on that element in the first place.
130
- * One row is narrower than the vector even on the row, and `adw-row-state.spec.ts` says
131
- * so in place.
136
+ * `relabel-first` is a splice rather than an assignment because {@link GjsifyOptionObject}
137
+ * is read-only — changing what an item says means putting a different item there, which is
138
+ * also how `Gio.ListStore` would have to spell it.
132
139
  */
133
- export declare const LIST_SELECTION_CLAMP_VECTORS: ReadonlyArray<ListSelectionClampVector>;
140
+ export declare function applyListMutation(model: GjsifyOptionList, op: ListReadbackOp): void;
134
141
  /** One {@link tabViewItemsChanged} expectation, with the order it replays. */
135
142
  export interface TabPagesItemsChangedVector {
136
143
  change: TabViewPagesChange;
@@ -1,12 +1,21 @@
1
- import type { AdwComboOption, ComboStateChange } from '../rows.js';
1
+ import type { AdwComboOption, ComboNotify, ComboStateChange } from '../rows.js';
2
2
  /**
3
3
  * One mutation in a combo scenario. DATA, not a closure: a renderer suite
4
4
  * replays these against a real widget (set the options, pick from the chooser)
5
5
  * and compares what the user would see.
6
+ *
7
+ * `setModel` carries the model's CONTENTS and not a model object, so the table stays
8
+ * portable: each renderer builds whatever model it holds — a `GjsifyOptionList` in the
9
+ * core and in both browser elements, the same on the NativeScript host — out of these
10
+ * descriptors. `setModelAgain` is the one step that is about the model's IDENTITY rather
11
+ * than its contents, and it is a step rather than a flag because that is the only way to
12
+ * spell "assign the object you are already holding" in data.
6
13
  */
7
14
  export type ComboSelectionStep = {
8
15
  op: 'setModel';
9
16
  model: ReadonlyArray<AdwComboOption>;
17
+ } | {
18
+ op: 'setModelAgain';
10
19
  } | {
11
20
  op: 'setSelectedIndex';
12
21
  index: number;
@@ -23,7 +32,7 @@ export interface ComboSelectionVector {
23
32
  steps: readonly ComboSelectionStep[];
24
33
  /** `selectedIndex` afterwards. */
25
34
  selected: number;
26
- /** `selectedValue` afterwards — `''` when the index sits outside the options. */
35
+ /** `selectedValue` afterwards — `''` when nothing is selected. */
27
36
  value: string;
28
37
  /** `selectedLabel` afterwards — the text the inline value / button shows. */
29
38
  label: string;
@@ -33,6 +42,12 @@ export interface ComboSelectionVector {
33
42
  * gated on `interactive`.
34
43
  */
35
44
  emitted: ReadonlyArray<ComboStateChange>;
45
+ /**
46
+ * Every `notify::` the scenario owes, flattened in EMISSION ORDER — see the module
47
+ * header. Driven by the surfaces that have real GObject properties; a DOM renderer
48
+ * skips it.
49
+ */
50
+ notified: ReadonlyArray<ComboNotify>;
36
51
  rule: string;
37
52
  }
38
53
  /**
@@ -46,6 +61,51 @@ export interface ComboSelectionVector {
46
61
  * replaced. That first change is in `emitted` for exactly that reason.
47
62
  */
48
63
  export declare const COMBO_SELECTION_VECTORS: ReadonlyArray<ComboSelectionVector>;
64
+ /** One splice applied to the model a combo state is HOLDING. */
65
+ export interface ComboSpliceStep {
66
+ position: number;
67
+ removed: number;
68
+ added: ReadonlyArray<AdwComboOption>;
69
+ }
70
+ /** One `items-changed` → selection scenario. */
71
+ export interface ComboItemsChangedVector {
72
+ name: string;
73
+ /** The model the state holds before the splice. */
74
+ initial: ReadonlyArray<AdwComboOption>;
75
+ /** Where the selection sits before the splice — `-1` leaves the sentinel in place. */
76
+ selected: number;
77
+ splice: ComboSpliceStep;
78
+ /** `selectedIndex` after the splice. */
79
+ result: number;
80
+ /** `selectedValue` after the splice. */
81
+ value: string;
82
+ /** The `notify::` the splice owes, in order — EMPTY where GTK emits none. */
83
+ notified: ReadonlyArray<ComboNotify>;
84
+ rule: string;
85
+ }
86
+ /**
87
+ * What a splice on the HELD model does to the selection — `GtkSingleSelection`'s
88
+ * `items-changed` handler, which `Adw.ComboRow` and `Gtk.DropDown` both sit on.
89
+ *
90
+ * NEW IN ADR 0122, and only reachable since it: while `model` was an Array the only way to
91
+ * change the list was to replace it, so this whole axis had no spelling. A live
92
+ * `Gio.ListModel` moves under the widget, and WHERE it moved decides whether the selection
93
+ * follows the item, shifts with it, or is clamped because the item is gone.
94
+ *
95
+ * Every row is MEASURED (`combo-probe2.js`), and the `notified` column is the point of the
96
+ * table: the order here is the INVERSE of a `selected` write — `selected-item` first,
97
+ * because what changed is the item and the index is downstream of it. The shift row
98
+ * notifies `selected` ALONE for the mirror-image reason (the item did not change, only its
99
+ * position), and the replace-in-place row notifies `selected-item` alone.
100
+ *
101
+ * `<adw-combo-row>` drives the table through its own DOM, which is where the splice has to
102
+ * land for a user to see it: the outcome columns, the rebuilt `<option>` list, and the
103
+ * SILENCE a DOM surface owes (a model moving underneath is not a user pick, so no
104
+ * `notify::selected` event). The `notified` column itself stays with the core suite — it is
105
+ * a GObject property feed, and no port publishes one for this path yet; `subscribeNotify`
106
+ * is the seam a host that owns real properties will re-emit from.
107
+ */
108
+ export declare const COMBO_ITEMS_CHANGED_VECTORS: ReadonlyArray<ComboItemsChangedVector>;
49
109
  /** One `presentsChooser` expectation. */
50
110
  export interface ComboChooserVector {
51
111
  count: number;
@@ -16,7 +16,10 @@ export interface SplitButtonContentStep {
16
16
  mode: SplitButtonContentMode;
17
17
  /** `get_label()` after the step. */
18
18
  label: string | null;
19
- /** `get_icon_name()` after the step. */
19
+ /**
20
+ * `get_icon_name()` after the step — the READBACK, so an icon name set to `''` reads
21
+ * back `null` here, as it does in C.
22
+ */
20
23
  iconName: string | null;
21
24
  /** The root style classes after the step. */
22
25
  styleClasses: readonly SplitButtonStyleClass[];
@@ -32,8 +35,9 @@ export interface SplitButtonContentVector {
32
35
  * The content machine.
33
36
  *
34
37
  * Two things are easy to get wrong and are asserted explicitly. The `notified` ORDER: C
35
- * freezes, notifies the slots it is about to CLEAR, sets the new one, notifies it, then
36
- * thaws — so one `set_label()` can emit three notifications. And `child` is notified far
38
+ * freezes, notifies the property being SET, then the slots that were filled before the
39
+ * call, then thaws — so one `set_label()` can emit three notifications, led by `label`
40
+ * itself. And `child` is notified far
37
41
  * more often than a reader expects, because `adw_split_button_get_child()` returns
38
42
  * GtkButton's INTERNAL label/image widget in label/icon mode (the upstream suite says so)
39
43
  * and the C guard tests that pointer, not whether the app ever set a child.
@@ -0,0 +1,6 @@
1
+ /** Translates `text`, disambiguated by the `C_()` `context` when there is one. */
2
+ export type DefaultTranslate = (text: string, context?: string) => string;
3
+ /** Install the translator; the last registration wins, as a later `textdomain()` call would. */
4
+ export declare function registerDefaultTranslate(translate: DefaultTranslate | undefined): void;
5
+ /** The installed translator, or `undefined` when no platform filled the slot. */
6
+ export declare function registeredDefaultTranslate(): DefaultTranslate | undefined;
@@ -0,0 +1,2 @@
1
+ declare const _default: () => Promise<void>;
2
+ export default _default;
@@ -1,16 +1,50 @@
1
- import type { Binding, BindingFlag, ClassLike, GObjectInstance, ParamSpec, RegisteredClass, SignalHandler } from './gobject.js';
1
+ import type { Binding, BindingFlag, ClassLike, GInterface, GObjectInstance, GType, ParamSpec, RegisteredClass, SignalHandler } from './gobject.js';
2
+ /**
3
+ * The kinds that carry a VALUE a declaration can also spell as a default — the five the subset
4
+ * has had since ADR 0105, and the only ones a signal parameter may take.
5
+ */
6
+ export type ForeignScalarKind = 'string' | 'boolean' | 'int' | 'uint' | 'double';
2
7
  /** The property kinds the subset has, and the only ones a declared widget property may take. */
3
- export type ForeignPropertyKind = 'string' | 'boolean' | 'int' | 'uint' | 'double';
8
+ export type ForeignPropertyKind = ForeignScalarKind | 'object';
4
9
  /** One property a widget class declares at its `extends`. `default` is the unset value. */
5
- export interface ForeignProperty {
6
- readonly kind: ForeignPropertyKind;
10
+ export interface ForeignScalarProperty {
11
+ readonly kind: ForeignScalarKind;
7
12
  readonly default?: string | boolean | number | null;
8
13
  readonly nick?: string;
9
14
  readonly blurb?: string;
10
15
  }
11
- /** One signal a widget class declares at its `extends`, in the subset's parameter vocabulary. */
16
+ /**
17
+ * A property holding another GObject, or `null` — `Adw.ComboRow:model` (ADR 0122 § 6).
18
+ *
19
+ * `valueType` IS REQUIRED, and that is the whole reason this is a separate arm rather than an
20
+ * optional field on the one above. `g_param_spec_object` takes the object type as an argument and
21
+ * has no default for it, so a declaration that omitted it would leave the engine to guess between
22
+ * "any GObject" and the interface the widget actually means — and a `model` that accepted any
23
+ * GObject is the refusal ADR 0122 § 6 exists to make. It is the subset's own token (`TYPE_OBJECT`
24
+ * or an interface of the subset), NOT node-gi's: a port that named a real GType would have to
25
+ * import node-gi to describe its own properties, which is the dependency this vocabulary exists
26
+ * to keep out. The engine that has node-gi translates.
27
+ *
28
+ * There is no `default`. `g_param_spec_object`'s default is always `NULL`, so a declaration
29
+ * cannot carry another one.
30
+ */
31
+ export interface ForeignObjectProperty {
32
+ readonly kind: 'object';
33
+ readonly valueType: GType | GInterface;
34
+ readonly nick?: string;
35
+ readonly blurb?: string;
36
+ }
37
+ /** One property a widget class declares at its `extends`. */
38
+ export type ForeignProperty = ForeignScalarProperty | ForeignObjectProperty;
39
+ /**
40
+ * One signal a widget class declares at its `extends`, in the subset's parameter vocabulary.
41
+ *
42
+ * SCALARS ONLY. An object parameter would need its own type beside the kind, as the property arm
43
+ * does, and nothing declares one — `items-changed` is three `uint`s. Widening it to
44
+ * `ForeignPropertyKind` would make `{ kind: 'object' }` spellable with no type and no meaning.
45
+ */
12
46
  export interface ForeignSignal {
13
- readonly param_types?: readonly ForeignPropertyKind[];
47
+ readonly param_types?: readonly ForeignScalarKind[];
14
48
  }
15
49
  /**
16
50
  * What a widget class declares at its `extends` — GJS's `registerClass` meta, in the port's own
@@ -22,6 +22,46 @@ export declare function gStrStrip(value: string): string;
22
22
  * subtitle.
23
23
  */
24
24
  export declare function stringIsNotEmpty(value: string | null | undefined): boolean;
25
+ /**
26
+ * How a `GtkButton` reads an icon name BACK: `''` becomes `NULL`.
27
+ *
28
+ * `gtk_button_set_icon_name` holds the name on an internal `GtkImage`, and an empty name
29
+ * leaves that image EMPTY — so `gtk_button_get_icon_name` answers `NULL` for a button
30
+ * whose icon name was set to `''`. Only the readback normalises; the write itself is
31
+ * accepted and does replace the content widget.
32
+ *
33
+ * WHY A PORT NEEDS IT. C's idempotence guard is `g_strcmp0 (icon_name, get_icon_name
34
+ * (self))` — the incoming value against the READBACK, not against what is stored. The
35
+ * two differ exactly here, so `g_strcmp0 ('', NULL)` is non-zero and EVERY
36
+ * `icon_name = ''` write passes the guard, rebuilds the internal image and notifies,
37
+ * for as long as it is repeated. A port that compares against its own field instead
38
+ * swallows the second write and goes silent where GTK is loud.
39
+ *
40
+ * Measured on GJS 1.88.1 / libadwaita 1.9.4 / GTK 4.22.5: `set_icon_name('')` on a fresh
41
+ * `Adw.SplitButton` emits `notify::icon-name` and reads `null` back; repeating it emits
42
+ * `notify::icon-name` and `notify::child` again. An `''` LABEL does not behave this way —
43
+ * `gtk_button_get_label` reads `''` straight back — which is why this is one function
44
+ * about one property and not a general "empty means unset" rule.
45
+ */
46
+ export declare function gtkButtonIconNameReadback(stored: string | null): string | null;
47
+ /**
48
+ * Whether `adw_action_row_set_subtitle` passes its guard (adw-action-row.c:571):
49
+ * `g_strcmp0 (gtk_label_get_text (priv->subtitle), subtitle) == 0` returns early.
50
+ *
51
+ * `g_strcmp0` orders `NULL` before every string, `''` included, so a `NULL` write is NEVER
52
+ * equal to the label text — which always reads `''`, never `NULL`. A `null` subtitle therefore
53
+ * passes the guard, relabels with `""` and notifies on EVERY write, held value unmoved. A
54
+ * `''` write against `''` is the ordinary idempotent case.
55
+ *
56
+ * Measured on GJS 1.88.1 / libadwaita 1.9.4: `subtitle = null` on a fresh `Adw.ActionRow` and
57
+ * `Adw.ExpanderRow` emits `notify::subtitle` each time and reads `""` back; `subtitle = ''`
58
+ * emits nothing. `title` was measured on the same rows and does NOT behave this way, so this is one
59
+ * property's rule, not a general one.
60
+ *
61
+ * @param held The label text now, never `null`.
62
+ * @param written What the caller passed.
63
+ */
64
+ export declare function adwSubtitleWriteNotifies(held: string, written: string | null | undefined): boolean;
25
65
  /**
26
66
  * GLib's `CLAMP`, which tests the HIGH bound FIRST:
27
67
  * `x > high ? high : (x < low ? low : x)`.
@@ -0,0 +1,2 @@
1
+ declare const _default: () => Promise<void>;
2
+ export default _default;
@@ -42,6 +42,8 @@ export declare const GDK_KEYS: Readonly<{
42
42
  readonly KEY_Up: 65362;
43
43
  readonly KEY_Right: 65363;
44
44
  readonly KEY_Down: 65364;
45
+ /** XF86Back: the hardware / mouse back key, and what Android's back button is delivered as. */
46
+ readonly KEY_Back: 269025062;
45
47
  }>;
46
48
  /** A DOM `key` as the keysym GTK would deliver: a Latin-1 character is its own code point, lowercased. */
47
49
  export declare function keyvalOfKey(key: string): number;
@@ -109,6 +111,13 @@ export interface GtkPlatform {
109
111
  }
110
112
  /** A port is always on a display, so `Settings.get_default()` is never null (real GTK: null before `Gtk.init`). */
111
113
  export declare function createGtkPlatform(host: PlatformHost): GtkPlatform;
114
+ /**
115
+ * Runs `event` through the key controllers attached to `widget`, as GTK does for a key the widget's
116
+ * toplevel receives: the first controller whose `key-pressed` / `key-released` handler returns true
117
+ * takes it. For keys the platform delivers by another road than the widget's own key listener (the
118
+ * Android back button); the result is whether a controller handled it.
119
+ */
120
+ export declare function deliverKeyToControllers(widget: object, event: HostKeyEvent): boolean;
112
121
  /** `Gtk.Widget.add_controller` / `remove_controller` for the widgets of a port. */
113
122
  export declare function widgetControllerMembers(host: PlatformHost): {
114
123
  add_controller(this: object, controller: EventControllerKey): void;
@@ -32,7 +32,7 @@ export { Toast, ToastOverlayQueue, ToastPriority } from './toast-object.js';
32
32
  export type { ToastOverlayQueueOptions } from './toast-object.js';
33
33
  export { AdwAlertResponses, BottomSheetPresentation, resolveBottomSheetChrome, resolveBottomSheetClose, resolveBottomSheetOpen, resolveBottomSheetSwipeTracker, } from './dialog.js';
34
34
  export type { AdwAlertResponse, AdwResponseAppearance, AdwResponseOptions, BottomSheetChrome, BottomSheetChromeState, BottomSheetCloseOutcome, BottomSheetCloseSource, BottomSheetCloseState, BottomSheetLayer, BottomSheetOpenOutcome, BottomSheetOpenSource, BottomSheetOpenState, BottomSheetPresentationListener, BottomSheetPresentationOptions, BottomSheetSwipeTrackerConfig, BottomSheetSwipeTrackerState, BottomSheetTeardownCallback, OrderedConfirmResponses, } from './dialog.js';
35
- export { ADW_COMBO_NO_SELECTION, clampListSelection, listItemsChanged, normalizeComboOptions, parseListModel, } from './list.js';
35
+ export { ADW_COMBO_NO_SELECTION, listItemsChanged, normalizeComboOptions, parseListModel } from './list.js';
36
36
  export type { AdwComboOption, AdwComboOptionInput, AdwListItemsChanged, AdwListModel, AdwListModelInput, } from './list.js';
37
37
  export { ADW_COLUMN_VIEW_NO_FIXED_WIDTH, ADW_GRID_VIEW_MAX_COLUMNS, ADW_GRID_VIEW_MIN_COLUMNS, columnViewSort, columnViewTracks, gridViewColumns, listItemField, listViewSelect, listViewSelectAll, ListViewState, normalizeColumnViewColumns, normalizeListSelectionMode, parseColumnViewColumns, } from './list-view.js';
38
38
  export type { AdwColumnViewColumn, AdwColumnViewSort, AdwListItemContext, AdwListItemFactory, AdwListItemField, AdwListSelectStep, AdwListSelection, AdwListSelectionMode, AdwListSelectResult, ListViewItemsListener, ListViewSelectionChange, ListViewSelectionListener, } from './list-view.js';
@@ -48,15 +48,19 @@ export { GtkAdjustment } from './gtk-adjustment.js';
48
48
  export type { GtkAdjustmentProps } from './gtk-adjustment.js';
49
49
  export { GtkStringList, GtkStringObject, INVALID_LIST_POSITION } from './gtk-string-list.js';
50
50
  export type { GtkStringListProps } from './gtk-string-list.js';
51
+ export { GjsifyOptionList, GjsifyOptionObject, readModelWrite } from './option-list.js';
52
+ export type { GjsifyOptionListProps } from './option-list.js';
51
53
  export { ComboState, ExpanderState, ToggleGroupState, keptToggles, toggleIndexOfName } from './rows.js';
52
- export type { ComboItemsListener, ComboStateChange, ComboStateListener, ExpanderStateListener, ToggleGroupStateChange, ToggleGroupStateListener, } from './rows.js';
54
+ export type { ComboItemsListener, ComboNotify, ComboNotifyListener, ComboStateChange, ComboStateListener, ComboWatchableModel, ExpanderNotify, ExpanderStateListener, ToggleGroupStateChange, ToggleGroupStateListener, } from './rows.js';
53
55
  export { DEFAULT_BOX_SPACING, normalizeBoxOrientation, normalizeBoxSpacing } from './box.js';
54
56
  export type { BoxOrientation } from './box.js';
55
57
  export { DEFAULT_LABEL_ELLIPSIZE, DEFAULT_LABEL_LINES, DEFAULT_LABEL_MAX_WIDTH_CHARS, DEFAULT_LABEL_WIDTH_CHARS, DEFAULT_LABEL_WRAP_MODE, DEFAULT_LABEL_XALIGN, DEFAULT_LABEL_YALIGN, LABEL_ELLIPSIZE_MODES, LABEL_JUSTIFICATIONS, LABEL_WRAP_MODES, labelDisplayText, labelEffectiveLines, labelEllipsizeOverflowValue, labelMarkupIsUnparseable, labelWidthCharsExtent, labelYalignAlignItems, normalizeLabelEllipsize, normalizeLabelJustify, normalizeLabelLines, normalizeLabelMaxWidthChars, normalizeLabelWidthChars, normalizeLabelWrapMode, normalizeLabelXalign, normalizeLabelYalign, } from './label.js';
56
58
  export type { LabelAlignItems, LabelEllipsizeMode, LabelJustification, LabelWidthCharsExtent, LabelWrapMode, } from './label.js';
57
- export { glibClamp, gStrStrip, stringIsNotEmpty } from './glib.js';
59
+ export { LABEL_MARKUP_STYLE_PLAIN, labelActivateLink, labelHasLinks, labelLinkVisited, labelLinksHaveTooltip, labelLinksInheritVisited, labelMarkupRender, } from './label-markup.js';
60
+ export type { LabelActivateLinkSteps, LabelLink, LabelMarkupRender, LabelMarkupRun, LabelMarkupStyle, } from './label-markup.js';
61
+ export { adwSubtitleWriteNotifies, glibClamp, gStrStrip, gtkButtonIconNameReadback, stringIsNotEmpty } from './glib.js';
58
62
  export { AppLaunchContext as GdkAppLaunchContext, ContentFormats, ContentProvider, Clipboard, Display, createGdk, widgetDisplayMembers, } from './gdk.js';
59
- export { CURRENT_TIME, CssProvider, EventControllerKey, GDK_KEYS, GtkSettings, IconTheme, STYLE_PROVIDER_PRIORITY_APPLICATION, STYLE_PROVIDER_PRIORITY_FALLBACK, STYLE_PROVIDER_PRIORITY_SETTINGS, STYLE_PROVIDER_PRIORITY_THEME, STYLE_PROVIDER_PRIORITY_USER, createGtkPlatform, keyvalOfKey, widgetControllerMembers, } from './gtk-platform.js';
63
+ export { CURRENT_TIME, CssProvider, EventControllerKey, GDK_KEYS, GtkSettings, IconTheme, STYLE_PROVIDER_PRIORITY_APPLICATION, STYLE_PROVIDER_PRIORITY_FALLBACK, STYLE_PROVIDER_PRIORITY_SETTINGS, STYLE_PROVIDER_PRIORITY_THEME, STYLE_PROVIDER_PRIORITY_USER, createGtkPlatform, deliverKeyToControllers, keyvalOfKey, widgetControllerMembers, } from './gtk-platform.js';
60
64
  export type { GtkPlatform, HostKeyEvent, PlatformHost } from './gtk-platform.js';
61
65
  export { iconLookupNames, lookupResourceIcon } from './icon-theme-resources.js';
62
66
  export type { IconDirection, ResourceIconMatch, ResourceIconRequest } from './icon-theme-resources.js';
@@ -111,8 +115,8 @@ export type { AdwSwipeEnd, AdwSwipeEndInput, AdwSwipeRange, AdwSwipeSource } fro
111
115
  export { CAROUSEL_SCROLL_TIMEOUT_MS, CAROUSEL_SETTLE_EPSILON, CarouselState, carouselClampPosition, carouselClosestSnapPoint, carouselNavigateTarget, carouselPageAllocation, carouselPageAtPosition, carouselRange, carouselReorderShift, carouselSizesFromSnapPoints, carouselSnapPoints, carouselWheelStep, } from './carousel.js';
112
116
  export type { CarouselChangeReason, CarouselDirection, CarouselOrientation, CarouselPageAllocation, CarouselPageChangedListener, CarouselPageMeasurement, CarouselRange, CarouselReorderShiftInput, CarouselScrollOptions, CarouselScrollRequest, CarouselScrollSource, CarouselStateChange, CarouselStateListener, CarouselStateOptions, CarouselWheelInput, } from './carousel.js';
113
117
  export { UNTITLED_PAGE_LABEL, collectSearchRows, countVisiblePages, createSearchRowSubtitle, defaultCaseFolder, derivePreferencesGroupHeader, makeComparable, rowMatchesQuery, searchPreferences, } from './preferences.js';
114
- export { PANGO_MARKUP_TAGS, escapeMarkup, parsePangoMarkup, stripMarkup } from './pango-markup.js';
115
- export type { PangoMarkupNode, PangoMarkupTag } from './pango-markup.js';
118
+ export { PANGO_MARKUP_TAGS, escapeMarkup, parseLabelMarkup, parsePangoMarkup, stripLabelMarkup, stripMarkup, } from './pango-markup.js';
119
+ export type { LabelMarkupNode, PangoMarkupNode, PangoMarkupTag } from './pango-markup.js';
116
120
  export type { CaseFolder, MakeComparableOptions, PreferencesGroupHeaderInput, PreferencesGroupHeaderState, PreferencesSearchEntry, PreferencesSearchGroup, PreferencesSearchPage, PreferencesSearchResult, PreferencesSearchRow, SearchPreferencesOptions, SearchRowSubtitleInput, } from './preferences.js';
117
121
  export { ADW_CLAMP_DEFAULTS, ADW_CLAMP_SIZE_CLASSES, ADW_SPINNER_MAX_SIZE, ADW_SPINNER_MIN_SIZE, ADW_TOOLBAR_BAR_CLASSES, ADW_TOOLBAR_VIEW_CLASSES, ADW_TOOLBAR_VIEW_DEFAULTS, clampAllocate, clampChildSize, clampSizeFromChild, clampThresholds, normalizeClampSize, parseToolbarStyle, resolveSpinnerSize, spinnerGeometry, toolbarBarStyleClasses, toolbarViewAllocate, toolbarViewClasses, toolbarViewContentForSize, toolbarViewMeasure, } from './chrome.js';
118
122
  export type { AdwClampSizeClass, AdwMeasurement, AdwToolbarStyle, ClampAllocation, ClampParams, ClampThresholds, SpinnerGeometry, ToolbarViewAllocateInput, ToolbarViewAllocation, ToolbarViewClassInput, ToolbarViewClasses, ToolbarViewContentForSize, ToolbarViewContentForSizeInput, ToolbarViewMeasureInput, } from './chrome.js';
@@ -140,8 +144,10 @@ export type { ApplicationHost, GtkApplicationMembers, GtkApplicationConstructor
140
144
  export { ActionRegistry, SimpleAction, actionRegistryOf, activateWidgetAction, applicationOfWindow, findActionGroup, insertActionGroup, installActionMap, linkWindow, SimpleActionGroup, } from './gio-actions.js';
141
145
  export type { ActionActivateHandler, ActionGroupLike, ActionLike, SimpleActionProps } from './gio-actions.js';
142
146
  export type { Binding, BindingFlag, BlueprintTemplate, BuiltTemplate, ClassLike, ClassMeta, GInterface, GObjectConstructor, GObjectDoor, GObjectInstance, GObjectNamespace, GType, ParamKind, RegisterClass, RegisteredClass, SignalHandler, SignalMeta, TemplateScope, } from './gobject.js';
147
+ export { registerDefaultTranslate, registeredDefaultTranslate } from './default-translate.js';
148
+ export type { DefaultTranslate } from './default-translate.js';
143
149
  export { engineForTarget, registerGObjectEngine, registeredEngine, resetRegisteredEngine } from './engine.js';
144
- export type { EngineTarget, ForeignClassMeta, ForeignProperty, ForeignPropertyKind, ForeignSignal, GObjectEngine, } from './engine.js';
150
+ export type { EngineTarget, ForeignClassMeta, ForeignObjectProperty, ForeignProperty, ForeignPropertyKind, ForeignScalarKind, ForeignScalarProperty, ForeignSignal, GObjectEngine, } from './engine.js';
145
151
  export { MAXUINT32, buildFilenamev, getCurrentDir, getSystemDataDirs } from './glib-paths.js';
146
152
  export { uriEscapeString } from './glib-uri.js';
147
153
  export { computeLanguageNames, languageNamesFromTags, localeFromLanguageTag } from './glib-language.js';
@@ -0,0 +1,129 @@
1
+ /**
2
+ * The style one run of text carries, with pango's nesting already resolved.
3
+ *
4
+ * The booleans are pango's own tags; a tag nested inside itself is still just set, which
5
+ * is why they are booleans and not counts. `sizeSteps` IS a count, because `<big>` and
6
+ * `<small>` are relative and compose: `<big><big>` is two steps up, and `<small>` inside
7
+ * `<big>` cancels back to zero — pango applies one `PANGO_SCALE_*` factor per element, so
8
+ * the steps multiply rather than the innermost winning.
9
+ */
10
+ export interface LabelMarkupStyle {
11
+ /** `<b>`. */
12
+ readonly bold: boolean;
13
+ /** `<i>`. */
14
+ readonly italic: boolean;
15
+ /** `<u>`. */
16
+ readonly underline: boolean;
17
+ /** `<s>`. */
18
+ readonly strikethrough: boolean;
19
+ /** `<tt>`. */
20
+ readonly monospace: boolean;
21
+ /** `<big>` minus `<small>`, so a negative value is smaller text. */
22
+ readonly sizeSteps: number;
23
+ /** `<sub>` / `<sup>`, the INNERMOST of the two — one run cannot be both. */
24
+ readonly script: 'sub' | 'sup' | null;
25
+ /**
26
+ * The `<span>` attribute sets the run sits inside, OUTERMOST FIRST.
27
+ *
28
+ * A STACK and not one merged record, because the attribute→platform mapping is the
29
+ * renderer's (`font_weight` is an alias of `weight` on the web, `fontWeight` on
30
+ * NativeScript, and neither list is the other's). A renderer applies them in order and
31
+ * the innermost therefore wins per platform property — merging here would need pango's
32
+ * alias table in core, where no port reads it.
33
+ */
34
+ readonly spans: readonly Readonly<Record<string, string>>[];
35
+ }
36
+ /** No tag at all — the style a bare text run carries. */
37
+ export declare const LABEL_MARKUP_STYLE_PLAIN: LabelMarkupStyle;
38
+ /** One `<a href>` of a label's markup, over a range of its display text. */
39
+ export interface LabelLink {
40
+ /** `<a href>`. */
41
+ readonly href: string;
42
+ /** `<a title>` — what GTK shows as the label's tooltip over this link. */
43
+ readonly title: string | null;
44
+ /** `<a class>` — the CSS class GTK adds to the link's own node. */
45
+ readonly cssClass: string | null;
46
+ /** Where the link's text starts in the display text, in UTF-16 code units. */
47
+ readonly start: number;
48
+ /** Where it ends, exclusive. `start === end` is a link with nothing to click. */
49
+ readonly end: number;
50
+ /** Whether this link has been followed — see {@link labelLinksInheritVisited}. */
51
+ readonly visited: boolean;
52
+ }
53
+ /** One run of a label's markup: text, the style over it, and the link it sits in. */
54
+ export interface LabelMarkupRun {
55
+ readonly text: string;
56
+ readonly style: LabelMarkupStyle;
57
+ /**
58
+ * The index into {@link LabelMarkupRender.links} of the link this run is inside, or
59
+ * `null`. An INDEX rather than the link itself, so a renderer that updates `visited`
60
+ * replaces one array entry instead of rewriting every run that points at it.
61
+ */
62
+ readonly link: number | null;
63
+ }
64
+ /** A label's markup, ready to draw. */
65
+ export interface LabelMarkupRender {
66
+ /** `gtk_label_get_text()` — the runs' text concatenated. */
67
+ readonly text: string;
68
+ /** The styled runs, in reading order. Empty when the markup has no text at all. */
69
+ readonly runs: readonly LabelMarkupRun[];
70
+ /** The `<a href>` elements, in reading order. */
71
+ readonly links: readonly LabelLink[];
72
+ }
73
+ /**
74
+ * A label's `label` as the runs and links a renderer draws, or `null` when the markup does
75
+ * not parse — the same `null` {@link parseLabelMarkup} returns, so a caller takes the C
76
+ * fallback (show the raw string) on exactly the strings GTK takes it on.
77
+ *
78
+ * `previous` is the links the label held BEFORE this value, and only `visited` is read from
79
+ * it: see {@link labelLinksInheritVisited}.
80
+ */
81
+ export declare function labelMarkupRender(markup: string, previous?: readonly LabelLink[]): LabelMarkupRender | null;
82
+ /**
83
+ * `visited` carried across a re-parse by URI (gtklabel.c:3635-3647): a link whose `href`
84
+ * matches one the label already had keeps that link's `visited`, because following a link
85
+ * and then rewriting the text around it has not un-followed it.
86
+ *
87
+ * FIRST match, as in the C: two links to the same URI are one visited state.
88
+ */
89
+ export declare function labelLinksInheritVisited(links: readonly LabelLink[], previous: readonly LabelLink[]): readonly LabelLink[];
90
+ /**
91
+ * `gtk_label_ensure_has_tooltip` — a label gets `has-tooltip` when ANY of its links
92
+ * carries a `title`, because the tooltip is per-link and the widget has to opt in before
93
+ * `query-tooltip` is ever asked.
94
+ */
95
+ export declare function labelLinksHaveTooltip(links: readonly LabelLink[]): boolean;
96
+ /**
97
+ * The `link` CSS class `gtk_label_set_markup` adds to the WIDGET (gtklabel.c:3896) when its
98
+ * markup carried at least one `<a href>` — libadwaita's stylesheet selects on it, so a
99
+ * port that draws the link colour without it is styling by its own rule and not GTK's.
100
+ */
101
+ export declare function labelHasLinks(links: readonly LabelLink[]): boolean;
102
+ /** What one port supplies to one `::activate-link` emission. */
103
+ export interface LabelActivateLinkSteps {
104
+ /**
105
+ * `GTK_IS_WINDOW (gtk_widget_get_root (widget))` — the default handler returns FALSE
106
+ * for a label with no window above it, and then NOTHING is launched. A port answers
107
+ * this with whatever "is in a presented window" means for it.
108
+ */
109
+ readonly rooted: boolean;
110
+ /** Emit `activate-link` to the USER's handlers and answer whether one handled it. */
111
+ emit(): boolean;
112
+ /** `Gio.AppInfo.launch_default_for_uri` — the port's door, ADR 0101. */
113
+ launch(uri: string): void;
114
+ }
115
+ /**
116
+ * `emit_activate_link` — `::activate-link` is RUN_LAST with the boolean handled
117
+ * accumulator (`HandledAccumulator`, `window-members.ts`), so the order is: the user's
118
+ * handlers, then — only if none handled it — the class handler, which launches the URI and
119
+ * counts that as handled.
120
+ *
121
+ * Returns whether the link becomes VISITED, which is what GTK does with the signal's
122
+ * result: a handler that returns TRUE has followed the link its own way, and the default
123
+ * returning TRUE means the URI went to the host. A label with no window above it returns
124
+ * FALSE and the link stays unvisited — `gtk_label_activate_link`'s first branch, and the
125
+ * reason it is not simply "launch and say yes".
126
+ */
127
+ export declare function labelActivateLink(uri: string, steps: LabelActivateLinkSteps): boolean;
128
+ /** The links of `links` with the one at `index` marked visited; the others untouched. */
129
+ export declare function labelLinkVisited(links: readonly LabelLink[], index: number): readonly LabelLink[];
@@ -0,0 +1,2 @@
1
+ declare const _default: () => Promise<void>;
2
+ export default _default;
@@ -11,6 +11,12 @@ export type LabelJustification = (typeof LABEL_JUSTIFICATIONS)[number];
11
11
  * of the resulting TEXT, so an `_` inside a tag's attributes is not a mnemonic. Doing it
12
12
  * the other way round would let `<span font_desc="Sans">` lose its underscore and stop
13
13
  * parsing.
14
+ *
15
+ * THE PARSE IS THE LABEL'S, `stripLabelMarkup` — pango's tags PLUS `<a href>`, which is
16
+ * what `gtk_label_get_text()` returns, because `parse_uri_markup` lifts the `<a>` elements
17
+ * out before pango ever sees the string. A surface that is NOT a label does not come here:
18
+ * `Gtk.Inscription` has no `::activate-link` and its `markup` goes through
19
+ * `pango_parse_markup` alone, so `<a>` is an unknown tag there and the raw string stands.
14
20
  */
15
21
  export declare function labelDisplayText(label: string, useMarkup: boolean, useUnderline: boolean): string;
16
22
  /** Whether `label` carries markup that could not be reduced, so the raw string is shown. */
@@ -138,10 +138,10 @@ export declare class ListViewState {
138
138
  * any selected position the new model does not have.
139
139
  *
140
140
  * A VIEW DOES NOT AUTOSELECT, and that is the one place this class deliberately
141
- * differs from `ComboState`. `clampListSelection` is `GtkSingleSelection`'s
142
- * `autoselect`, which exists so a combo row always has a value to SHOW; a list view
143
- * has no inline value and GTK's own `GtkMultiSelection` keeps nothing selected after
144
- * a model it cannot map. So positions are filtered, not clamped.
141
+ * differs from `ComboState`, whose model write resets the selection to 0:
142
+ * `GtkSingleSelection:autoselect` exists so a combo row always has a value to SHOW; a
143
+ * list view has no inline value and GTK's own `GtkMultiSelection` keeps nothing
144
+ * selected after a model it cannot map. So positions are filtered, not reset.
145
145
  */
146
146
  setModel(model: readonly AdwComboOption[] | null | undefined): void;
147
147
  /** `Gtk.SelectionModel` choice. Narrowing it drops what the new mode cannot hold. */