@gjsify/adwaita-core 0.51.1 → 0.53.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.
- package/lib/esm/accent.js +1 -1
- package/lib/esm/appearance.js +2 -0
- package/lib/esm/apple-accent.js +1 -0
- package/lib/esm/box.js +1 -0
- package/lib/esm/conformance/accent.js +1 -1
- package/lib/esm/conformance/appearance.js +4 -0
- package/lib/esm/conformance/box.js +1 -0
- package/lib/esm/conformance/dialog.js +1 -1
- package/lib/esm/conformance/index.js +1 -1
- package/lib/esm/conformance/label.js +1 -0
- package/lib/esm/conformance/rows.js +1 -1
- package/lib/esm/conformance/shared-trees.js +1 -1
- package/lib/esm/conformance/tags.js +1 -0
- package/lib/esm/conformance/value-lists.js +1 -0
- package/lib/esm/dialog.js +1 -1
- package/lib/esm/gio-menu.js +1 -0
- package/lib/esm/gtk-adjustment.js +1 -0
- package/lib/esm/gtk-string-list.js +1 -0
- package/lib/esm/index.js +1 -1
- package/lib/esm/label.js +1 -0
- package/lib/esm/markup.js +4 -0
- package/lib/esm/rows.js +1 -1
- package/lib/esm/shortcut-format.js +1 -0
- package/lib/esm/source.js +1 -0
- package/lib/esm/tags.js +1 -0
- package/lib/esm/tokens.generated.js +1 -1
- package/lib/types/accent.d.ts +36 -0
- package/lib/types/appearance.d.ts +60 -0
- package/lib/types/appearance.spec.d.ts +2 -0
- package/lib/types/apple-accent.d.ts +18 -0
- package/lib/types/apple-accent.spec.d.ts +2 -0
- package/lib/types/box.d.ts +18 -0
- package/lib/types/box.spec.d.ts +2 -0
- package/lib/types/conformance/accent.d.ts +21 -0
- package/lib/types/conformance/appearance.d.ts +13 -0
- package/lib/types/conformance/box.d.ts +21 -0
- package/lib/types/conformance/dialog.d.ts +123 -1
- package/lib/types/conformance/index.d.ts +18 -8
- package/lib/types/conformance/label.d.ts +115 -0
- package/lib/types/conformance/list.d.ts +1 -1
- package/lib/types/conformance/rows.d.ts +29 -0
- package/lib/types/conformance/shared-trees.d.ts +155 -5
- package/lib/types/conformance/tags.d.ts +46 -0
- package/lib/types/conformance/value-lists.d.ts +19 -0
- package/lib/types/dialog.d.ts +163 -0
- package/lib/types/gio-menu.d.ts +46 -0
- package/lib/types/gtk-adjustment.d.ts +73 -0
- package/lib/types/gtk-adjustment.spec.d.ts +2 -0
- package/lib/types/gtk-string-list.d.ts +70 -0
- package/lib/types/gtk-string-list.spec.d.ts +2 -0
- package/lib/types/index.d.ts +21 -5
- package/lib/types/label.d.ts +135 -0
- package/lib/types/label.spec.d.ts +2 -0
- package/lib/types/markup.d.ts +14 -0
- package/lib/types/markup.spec.d.ts +2 -0
- package/lib/types/rows.d.ts +20 -0
- package/lib/types/shortcut-format.d.ts +25 -0
- package/lib/types/shortcut-format.spec.d.ts +2 -0
- package/lib/types/source.d.ts +94 -0
- package/lib/types/source.spec.d.ts +2 -0
- package/lib/types/tags.d.ts +48 -0
- package/lib/types/tags.spec.d.ts +2 -0
- package/lib/types/tokens.generated.d.ts +1 -1
- package/package.json +12 -4
|
@@ -1,9 +1,124 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* One node of an authored tree — the shape `ADWAITA_GALLERY_SHARED_TREES` is written in.
|
|
3
|
+
*
|
|
4
|
+
* THIS DECLARATION IS THE ORIGINAL. Every other spelling of the shape in this repository
|
|
5
|
+
* restates it — `scripts/adwaita-gallery-shared-trees.d.mts` for the plain-Node generators,
|
|
6
|
+
* `packages/infra/blueprint/src/shared-node.d.mts` for the projection, and more besides —
|
|
7
|
+
* each because it cannot import from here, each saying why in its own header.
|
|
8
|
+
* `scripts/check-shared-tree-shape.mjs` carries the list, holds every entry to this
|
|
9
|
+
* declaration field by field, and fails on a spelling that declares itself nowhere. So a
|
|
10
|
+
* field added here is added there too, or the gate says which field and where.
|
|
11
|
+
*/
|
|
2
12
|
export interface SharedTreeNode {
|
|
3
13
|
/** A GIR class name, e.g. `AdwPreferencesGroup`. */
|
|
4
14
|
tag: string;
|
|
15
|
+
/**
|
|
16
|
+
* The name this node is addressed by from OUTSIDE the tree.
|
|
17
|
+
*
|
|
18
|
+
* Renderer-neutral because every surface already has one — a GtkBuilder object id, a DOM
|
|
19
|
+
* `id`, a NativeScript `id` — and worth carrying although `bind` stays a refusal: measured
|
|
20
|
+
* in ADR 0066, EVERY id in this repository's shipped `.blp` is named by the sibling
|
|
21
|
+
* TypeScript through `InternalChildren` and NONE by a `bind` inside the file. A name read
|
|
22
|
+
* from outside is the component's addressing surface, not an input to a binding language.
|
|
23
|
+
*/
|
|
24
|
+
id?: string;
|
|
25
|
+
/**
|
|
26
|
+
* On the ROOT node: the composite class this tree DEFINES, where `tag` is the type it
|
|
27
|
+
* extends.
|
|
28
|
+
*
|
|
29
|
+
* `template $GalleryHeaderBar : Adw.Bin` is `{ tag: 'AdwBin', template: 'GalleryHeaderBar' }`
|
|
30
|
+
* — two facts that a single tag cannot carry, which is why the root of every shipped `.blp`
|
|
31
|
+
* projected to its PARENT type and said nothing about the class the file is about. The value
|
|
32
|
+
* is what GtkBuilder writes as `<template class="…">`, so `emitGtkBuilderXml` and the
|
|
33
|
+
* projection can be held against each other on it — and are, by stage D's addressing arm.
|
|
34
|
+
*/
|
|
35
|
+
template?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Where in the parent this child goes — the placement, spelled as the GTK side spells it.
|
|
38
|
+
*
|
|
39
|
+
* ONE FIELD FOR TWO GtkBuilder CONSTRUCTS, and the conflation is the projection's, not a
|
|
40
|
+
* choice made here: `[start]` is `<child type="start">` and `content: …` is a
|
|
41
|
+
* property-valued child, and both land on this field, so it cannot be inverted (the
|
|
42
|
+
* Blueprint corpus's `expectations.mjs` states it as finding 1). A renderer therefore has
|
|
43
|
+
* to answer to both spellings of a placement it has — `gtk-host` derives the property name
|
|
44
|
+
* from its own `set_`-prefixed slot method, `<adw-header-bar>` names `title-widget` beside
|
|
45
|
+
* its own `center`.
|
|
46
|
+
*
|
|
47
|
+
* A SHARED TREE MAY CARRY ONE ONLY WHERE EVERY RENDERER SPELLS IT THE SAME. That is the
|
|
48
|
+
* corpus's no-alias admission rule applied to a placement, and it is narrow: a row's
|
|
49
|
+
* `prefix`/`suffix` qualify, a header bar's `start`/`title`/`end` do not
|
|
50
|
+
* (`startBox`/`titleWidget`/`endBox` on the NativeScript port), which is why those blocks
|
|
51
|
+
* are ledgered as `vocabulary` divergences. A renderer handed a name it has no destination
|
|
52
|
+
* for REFUSES and says which — the alternative was measured on a shipped `.blp`, where a
|
|
53
|
+
* `[top]` header bar landed in the content and the window title was then discarded by the
|
|
54
|
+
* bar's own construction, at exit 0.
|
|
55
|
+
*/
|
|
5
56
|
slot?: string;
|
|
6
57
|
props?: Readonly<Record<string, string | number | boolean>>;
|
|
58
|
+
/**
|
|
59
|
+
* Which of this node's `props` are marked for translation, keyed by the prop name.
|
|
60
|
+
*
|
|
61
|
+
* A present key means marked; `context` carries the message context `C_("noun", …)` gives
|
|
62
|
+
* one. BESIDE `props` and not inside it, because that is what the marking is wherever a
|
|
63
|
+
* surface has one: GtkBuilder writes `translatable="yes" context="noun"` as attributes NEXT
|
|
64
|
+
* to the value, and a marked value is still the same value. Widening `props` to a union
|
|
65
|
+
* would make every reader of a value narrow past something that is not one.
|
|
66
|
+
*
|
|
67
|
+
* Worth carrying although no renderer here translates: a caption whose marking was dropped
|
|
68
|
+
* looks finished and is unreachable by `xgettext`, which is the exact defect ADR 0033 gives
|
|
69
|
+
* as its reason for preferring a declarative template. ADR 0067 measures it and says why
|
|
70
|
+
* the file-level `translation-domain` is not a node fact and stays a loss.
|
|
71
|
+
*/
|
|
72
|
+
translatable?: Readonly<Record<string, {
|
|
73
|
+
readonly context?: string;
|
|
74
|
+
}>>;
|
|
75
|
+
/**
|
|
76
|
+
* The style classes this node carries, as a list, in the order the source wrote them.
|
|
77
|
+
*
|
|
78
|
+
* ONE FIELD FOR TWO SPELLINGS, because they are one GTK property. Blueprint writes
|
|
79
|
+
* `styles ["flat", "circular"]` as a block and `css-classes: ["flat", "narrow"]` as a
|
|
80
|
+
* property value, and both set `GtkWidget:css-classes` — measured against the reference
|
|
81
|
+
* compiler, which writes the first as `<style><class name="flat"/></style>` and the second
|
|
82
|
+
* as a `<property>` whose text is NEWLINE-joined. A joined string in `props` would have to
|
|
83
|
+
* pick one of those two joins and could then not be held against the other golden, which is
|
|
84
|
+
* why the list is the field and not a string (ADR 0068 § 2).
|
|
85
|
+
*
|
|
86
|
+
* `styleClasses` and not `cssClasses`: ADR 0049 § 1 measured that name fatal on
|
|
87
|
+
* NativeScript, where `ViewBase` owns it as a live `Set` its CSS engine reads. So the field
|
|
88
|
+
* carries the name the three surfaces CAN share, and each driver maps it to its own door —
|
|
89
|
+
* the same arrangement `slot` already has, where GTK writes `<child type="start">` and the
|
|
90
|
+
* web writes `slot="start"`.
|
|
91
|
+
*/
|
|
92
|
+
styleClasses?: readonly string[];
|
|
93
|
+
/**
|
|
94
|
+
* Blueprint's value-carrying extension blocks, one key per kind (ADR 0072).
|
|
95
|
+
*
|
|
96
|
+
* `strings` is `Gtk.StringList { strings [ … ] }`: GtkBuilder writes it as `<items>` and
|
|
97
|
+
* fills it through `gtk_string_list_append`. `responses` is `Adw.AlertDialog { responses
|
|
98
|
+
* [ … ] }`: filled through `adw_alert_dialog_add_response`, with `destructive`/`suggested`
|
|
99
|
+
* as the `appearance` and `disabled` as `enabled: false`. A string keeps its `_()` marking
|
|
100
|
+
* beside it, in the same `{ context? }` that `translatable` holds for a prop.
|
|
101
|
+
*
|
|
102
|
+
* A CLOSED SET. Every other extension (`menu`, `layout`, `marks`, `items`, …) stays a named
|
|
103
|
+
* loss of the projection, so no renderer meets a kind it has no door for.
|
|
104
|
+
*/
|
|
105
|
+
extensions?: Readonly<{
|
|
106
|
+
strings?: readonly {
|
|
107
|
+
readonly value: string;
|
|
108
|
+
readonly translatable?: {
|
|
109
|
+
readonly context?: string;
|
|
110
|
+
};
|
|
111
|
+
}[];
|
|
112
|
+
responses?: readonly {
|
|
113
|
+
readonly id: string;
|
|
114
|
+
readonly label: string;
|
|
115
|
+
readonly translatable?: {
|
|
116
|
+
readonly context?: string;
|
|
117
|
+
};
|
|
118
|
+
readonly appearance?: 'suggested' | 'destructive';
|
|
119
|
+
readonly enabled?: boolean;
|
|
120
|
+
}[];
|
|
121
|
+
}>;
|
|
7
122
|
children?: readonly SharedTreeNode[];
|
|
8
123
|
}
|
|
9
124
|
/**
|
|
@@ -64,12 +179,47 @@ export declare function authoredNodes(root: SharedTreeNode): {
|
|
|
64
179
|
/**
|
|
65
180
|
* The authored classes a realised tree must carry, in authored order.
|
|
66
181
|
*
|
|
67
|
-
* `tagOf` is the renderer's own spelling of a GIR class name — `hostTagOf`
|
|
68
|
-
* GIR name itself in GTK. Both drivers filter
|
|
69
|
-
* against it, so it lives here rather than in
|
|
70
|
-
* is a second walk, free to disagree with the
|
|
182
|
+
* `tagOf` is the renderer's own spelling of a GIR class name — `hostTagOf` from the sibling
|
|
183
|
+
* `@gjsify/adwaita-core/tags` on the web, the GIR name itself in GTK. Both drivers filter
|
|
184
|
+
* their real tree down to this list and compare against it, so it lives here rather than in
|
|
185
|
+
* each of them: a driver deriving it privately is a second walk, free to disagree with the
|
|
186
|
+
* one {@link subjectIndexOf} addresses into.
|
|
71
187
|
*/
|
|
72
188
|
export declare function authoredTags(root: SharedTreeNode, tagOf?: (gtype: string) => string): string[];
|
|
189
|
+
/** One authored placement: the node's address, and the slot it named. */
|
|
190
|
+
export interface SharedTreePlacement {
|
|
191
|
+
/** The pre-order address {@link subjectIndexOf} reads, so a failure names a node. */
|
|
192
|
+
path: string;
|
|
193
|
+
/** The slot the tree authored, spelled the way every renderer admitting the block spells it. */
|
|
194
|
+
slot: string;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Every node of `root` that names a placement.
|
|
198
|
+
*
|
|
199
|
+
* WHAT THIS IS FOR. A driver comparing only the authored classes IN ORDER cannot see a
|
|
200
|
+
* slot at all: a child placed in the wrong slot of the right parent keeps every authored
|
|
201
|
+
* node in every authored position. ADR 0051 § Amendment 3 measured exactly that on the
|
|
202
|
+
* NativeScript port — two deliberate mis-placements, both GREEN — and the corpus authored
|
|
203
|
+
* no slot to catch it with until one did. This is the renderer-free half of the answer;
|
|
204
|
+
* what a driver DOES with it is its own, because "the child ended up in slot X" has no
|
|
205
|
+
* shared observable.
|
|
206
|
+
*/
|
|
207
|
+
export declare function sharedTreePlacements(root: SharedTreeNode): SharedTreePlacement[];
|
|
208
|
+
/**
|
|
209
|
+
* The same tree with every placement dropped — what a renderer that never read `slot`
|
|
210
|
+
* builds.
|
|
211
|
+
*
|
|
212
|
+
* THE CONTROL, and it is why a placement assertion can be made without a per-widget table
|
|
213
|
+
* of where each slot lands. A driver builds the tree twice and asserts the two REALISED
|
|
214
|
+
* trees differ: with the slots honoured a suffix sits in its row's header, without them it
|
|
215
|
+
* sits wherever that parent's default placement puts it. Every builder here read only
|
|
216
|
+
* `tag`, `props` and `children`, so the two builds were byte-identical — which is the
|
|
217
|
+
* regression this control turns red.
|
|
218
|
+
*
|
|
219
|
+
* Fresh nodes all the way down, never the authored ones: a driver handed the corpus's own
|
|
220
|
+
* objects could edit what the next block builds.
|
|
221
|
+
*/
|
|
222
|
+
export declare function withoutPlacements(root: SharedTreeNode): SharedTreeNode;
|
|
73
223
|
/**
|
|
74
224
|
* Where the node an expectation is about sits in that filtered walk.
|
|
75
225
|
*
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** One `hostTagOf` expectation — a class that resolves, or a name it must refuse. */
|
|
2
|
+
export interface HostTagVector {
|
|
3
|
+
/** A GIR class name, or a string that is deliberately not one. */
|
|
4
|
+
gtype: string;
|
|
5
|
+
/** The kebab tag `hostTagOf` must return. Absent for a row that must throw instead. */
|
|
6
|
+
expected?: string;
|
|
7
|
+
/** The exact `Error#message` `hostTagOf` must throw. Absent for a row that must resolve. */
|
|
8
|
+
error?: string;
|
|
9
|
+
rule: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* `hostTagOf` — GIR class name to kebab tag, and the refusal boundary.
|
|
13
|
+
*
|
|
14
|
+
* `AdwPreferencesGroup`/`AdwSwitchRow`/`GtkBox` pin the floor: one dash per word boundary,
|
|
15
|
+
* no acronym involved. `GtkGLArea`/`GtkATContext`/`GtkIMMulticontext` pin THE rule the floor
|
|
16
|
+
* cannot show — a run of two or more capitals closes at its LAST one, so `GL` stays one word
|
|
17
|
+
* and `Area` opens a new one, rather than `g-l-area`. `GtkPad2Btn` pins what a digit does:
|
|
18
|
+
* it is not an uppercase letter, so it ends a lower run exactly like a lowercase letter
|
|
19
|
+
* would, and the capital after it still opens a new word.
|
|
20
|
+
*/
|
|
21
|
+
export declare const HOST_TAG_VECTORS: ReadonlyArray<HostTagVector>;
|
|
22
|
+
/** One `attributeOf` expectation. */
|
|
23
|
+
export interface AttributeOfVector {
|
|
24
|
+
/** The authored property name, as an `AdwXyz`/`GtkXyz` prop is spelled in a `SharedTreeNode`. */
|
|
25
|
+
prop: string;
|
|
26
|
+
/** The attribute `attributeOf` must return. */
|
|
27
|
+
expected: string;
|
|
28
|
+
rule: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* `attributeOf` — camelCase property name to kebab DOM attribute.
|
|
32
|
+
*
|
|
33
|
+
* Every capital gets its own dash, with no acronym awareness — see the header for why that
|
|
34
|
+
* boundary is out of scope for this table.
|
|
35
|
+
*/
|
|
36
|
+
export declare const ATTRIBUTE_OF_VECTORS: ReadonlyArray<AttributeOfVector>;
|
|
37
|
+
/** One `propertyOf` expectation. */
|
|
38
|
+
export interface PropertyOfVector {
|
|
39
|
+
/** A property name as a projected `.blp` spells it, or as a hand-authored tree does. */
|
|
40
|
+
name: string;
|
|
41
|
+
/** The member `propertyOf` must return. */
|
|
42
|
+
expected: string;
|
|
43
|
+
rule: string;
|
|
44
|
+
}
|
|
45
|
+
/** `propertyOf` — a GIR property name to the camel-case member a NativeScript widget declares. */
|
|
46
|
+
export declare const PROPERTY_OF_VECTORS: ReadonlyArray<PropertyOfVector>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AdwResponseAppearance } from '../dialog.js';
|
|
2
|
+
/** One registered response, as the built dialog reports it. */
|
|
3
|
+
export interface ValueListResponse {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly label: string;
|
|
6
|
+
readonly appearance: AdwResponseAppearance;
|
|
7
|
+
readonly enabled: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** One Blueprint source and what the widget it builds hands back. */
|
|
10
|
+
export interface ValueListVector {
|
|
11
|
+
readonly rule: string;
|
|
12
|
+
/** The object, written after `using Gtk 4.0; using Adw 1;`. */
|
|
13
|
+
readonly blueprint: string;
|
|
14
|
+
/** The labels of the root's list model, in order — a combo row or a drop-down. */
|
|
15
|
+
readonly strings?: readonly string[];
|
|
16
|
+
/** The root dialog's responses, in the order they were added. */
|
|
17
|
+
readonly responses?: readonly ValueListResponse[];
|
|
18
|
+
}
|
|
19
|
+
export declare const VALUE_LIST_VECTORS: readonly ValueListVector[];
|
package/lib/types/dialog.d.ts
CHANGED
|
@@ -152,6 +152,127 @@ export interface BottomSheetCloseState {
|
|
|
152
152
|
* Neither can fire on a closed sheet, so neither signals anything.
|
|
153
153
|
*/
|
|
154
154
|
export declare function resolveBottomSheetClose(source: BottomSheetCloseSource, state: BottomSheetCloseState): BottomSheetCloseOutcome;
|
|
155
|
+
/**
|
|
156
|
+
* Which affordance asked a bottom sheet to OPEN.
|
|
157
|
+
*
|
|
158
|
+
* libadwaita gives a user exactly ONE surface to open a sheet from — the bottom bar. Both
|
|
159
|
+
* doors into it are gated by `can-open`, and both are unreachable without a bar:
|
|
160
|
+
*
|
|
161
|
+
* - `'bottom-bar'` — a click on the bar. The bin IS a `GtkButton`
|
|
162
|
+
* (adw-bottom-sheet.c:1203) whose own click gesture is put in
|
|
163
|
+
* `GTK_PHASE_NONE` by `disable_button_click` (:1209), so a pointer press
|
|
164
|
+
* runs `bottom_bar_released_cb` (:263-284) and a keyboard activation
|
|
165
|
+
* runs `bottom_bar_clicked_cb` (:402-407). Same verdict from both.
|
|
166
|
+
* - `'swipe'` — an upward swipe off the bar (`prepare_cb`, :1052-1053).
|
|
167
|
+
* - `'drag-handle'` — the pill, decorative exactly as in the dismissal gate.
|
|
168
|
+
*/
|
|
169
|
+
export type BottomSheetOpenSource = 'bottom-bar' | 'swipe' | 'drag-handle';
|
|
170
|
+
/**
|
|
171
|
+
* What a renderer must do about an open request. There is no `'open-attempt'`: libadwaita
|
|
172
|
+
* has no signal for a refused open, so a sheet that will not open is silent.
|
|
173
|
+
*/
|
|
174
|
+
export type BottomSheetOpenOutcome = 'open' | 'ignored';
|
|
175
|
+
/**
|
|
176
|
+
* What {@link resolveBottomSheetOpen} decides from — the SAME four properties the chrome is
|
|
177
|
+
* derived from, which is the finding rather than a convenience: whether a user can open the
|
|
178
|
+
* sheet is exactly the question of whether the bar is on screen and not inert.
|
|
179
|
+
*/
|
|
180
|
+
export type BottomSheetOpenState = BottomSheetChromeState;
|
|
181
|
+
/**
|
|
182
|
+
* The open decision table.
|
|
183
|
+
*
|
|
184
|
+
* Only ONE of the four inputs is a branch inside a callback — `can_open`. The other three
|
|
185
|
+
* are REACHABILITY, which is why a port that reads only the callbacks gets them wrong:
|
|
186
|
+
*
|
|
187
|
+
* - no bottom bar: the stack never switches to the bin (`show_bottom_bar` returns before the
|
|
188
|
+
* switch, adw-bottom-sheet.c:294-295; `set_bottom_bar` puts `sheet_page` back, :1615-1616),
|
|
189
|
+
* and the swipe area is a ZERO-HEIGHT rectangle at progress 0 because `bottom_bar_height`
|
|
190
|
+
* is 0 (`get_swipe_area`, :1412-1433). Upstream states the consequence outright — `can-open`
|
|
191
|
+
* "does nothing if [property@BottomSheet:bottom-bar] is not set" (:2013).
|
|
192
|
+
* - already open: `set_open (TRUE)` switches the stack away from the bin (:1701-1702), so
|
|
193
|
+
* there is nothing to click, and `prepare_cb` reads an open sheet's gesture as a CLOSE
|
|
194
|
+
* (:1050-1051) rather than a second open.
|
|
195
|
+
* - bar not revealed: at progress 0 `reveal_animation_done_cb` makes the whole sheet bin
|
|
196
|
+
* child-invisible (:362-364, and the same expression at :341-343), so the bar is off screen.
|
|
197
|
+
*
|
|
198
|
+
* `can_open` itself is NOT reachability: the bin stays focusable and merely gains the `inert`
|
|
199
|
+
* style class (:2033-2036), which is why {@link BottomSheetChrome.bottomBarInert} is a class
|
|
200
|
+
* to paint rather than a widget to disable.
|
|
201
|
+
*/
|
|
202
|
+
export declare function resolveBottomSheetOpen(source: BottomSheetOpenSource, state: BottomSheetOpenState): BottomSheetOpenOutcome;
|
|
203
|
+
/** Which of the sheet bin's two stack children is showing (`sheet_stack`). */
|
|
204
|
+
export type BottomSheetLayer = 'sheet' | 'bottom-bar';
|
|
205
|
+
/** What {@link resolveBottomSheetChrome} decides from. */
|
|
206
|
+
export interface BottomSheetChromeState {
|
|
207
|
+
/** `AdwBottomSheet:open`. */
|
|
208
|
+
open: boolean;
|
|
209
|
+
/** `AdwBottomSheet:can-open`. */
|
|
210
|
+
canOpen: boolean;
|
|
211
|
+
/** Whether `AdwBottomSheet:bottom-bar` is set. */
|
|
212
|
+
hasBottomBar: boolean;
|
|
213
|
+
/** `AdwBottomSheet:reveal-bottom-bar`; absent means revealed. */
|
|
214
|
+
revealBottomBar?: boolean;
|
|
215
|
+
/** `AdwBottomSheet:modal`; absent means modal, the pspec default (adw-bottom-sheet.c:1128). */
|
|
216
|
+
modal?: boolean;
|
|
217
|
+
}
|
|
218
|
+
/** What a renderer has to put on screen for a given state. */
|
|
219
|
+
export interface BottomSheetChrome {
|
|
220
|
+
/** Which stack child the sheet bin shows. */
|
|
221
|
+
layer: BottomSheetLayer;
|
|
222
|
+
/** Whether the sheet bin is on screen at all (`gtk_widget_set_child_visible`). */
|
|
223
|
+
surfaceVisible: boolean;
|
|
224
|
+
/** Whether the bar carries the `inert` style class — still clickable, just refusing. */
|
|
225
|
+
bottomBarInert: boolean;
|
|
226
|
+
/**
|
|
227
|
+
* Whether the dimming layer covers the content — the scrim a click on dismisses through
|
|
228
|
+
* the `'dimming'` source. Only a MODAL sheet has one on screen.
|
|
229
|
+
*/
|
|
230
|
+
dimmed: boolean;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* The bin's resting appearance: which child shows, whether the bin is on screen, and whether
|
|
234
|
+
* the bar looks inert.
|
|
235
|
+
*
|
|
236
|
+
* RESTING is the whole simplification. In C these follow `progress` across
|
|
237
|
+
* `CHILD_SWITCH_THRESHOLD` mid-animation (`open_animation_cb`, adw-bottom-sheet.c:322-330);
|
|
238
|
+
* with no spring animation the settled progress IS `open`, so `showing_bottom_bar` reduces to
|
|
239
|
+
* `!open` — which is also its init value (:1131) for a sheet that starts closed.
|
|
240
|
+
*
|
|
241
|
+
* The dimming reduces the same way. `set_open (TRUE)` makes it child-visible exactly when the
|
|
242
|
+
* sheet is modal (:1686-1687), `set_modal` re-applies that while the sheet is not settled closed
|
|
243
|
+
* (:1981-1982), and the close animation hides it once it settles (:338-339). At rest that is
|
|
244
|
+
* `open && modal`; the opacity ramp between is the animation this model does not run.
|
|
245
|
+
*/
|
|
246
|
+
export declare function resolveBottomSheetChrome(state: BottomSheetChromeState): BottomSheetChrome;
|
|
247
|
+
/** What {@link resolveBottomSheetSwipeTracker} decides from. */
|
|
248
|
+
export interface BottomSheetSwipeTrackerState {
|
|
249
|
+
/** `AdwBottomSheet:can-open`. */
|
|
250
|
+
canOpen: boolean;
|
|
251
|
+
/** `AdwBottomSheet:can-close`. */
|
|
252
|
+
canClose: boolean;
|
|
253
|
+
/** Whether `AdwBottomSheet:bottom-bar` is set. */
|
|
254
|
+
hasBottomBar: boolean;
|
|
255
|
+
/** `AdwBottomSheet:show-drag-handle`. */
|
|
256
|
+
showDragHandle: boolean;
|
|
257
|
+
}
|
|
258
|
+
/** The three `AdwSwipeTracker` settings `update_swipe_tracker` writes. */
|
|
259
|
+
export interface BottomSheetSwipeTrackerConfig {
|
|
260
|
+
/** Whether the tracker recognises a gesture at all. */
|
|
261
|
+
enabled: boolean;
|
|
262
|
+
/** Whether a mouse drag counts, not only touch. */
|
|
263
|
+
allowMouseDrag: boolean;
|
|
264
|
+
/** Whether the gesture may overshoot below the closed position. */
|
|
265
|
+
lowerOvershoot: boolean;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* `update_swipe_tracker` (adw-bottom-sheet.c:450-460) as a pure function.
|
|
269
|
+
*
|
|
270
|
+
* `enabled` is the line that decides whether a bottom sheet can be opened by gesture at all:
|
|
271
|
+
* `(can_open && bottom_bar != NULL) || can_close`. The `&& bottom_bar` conjunct is why
|
|
272
|
+
* `can-open` alone buys nothing — with no bar the only live arm is `can_close`, i.e. the
|
|
273
|
+
* tracker exists solely to CLOSE.
|
|
274
|
+
*/
|
|
275
|
+
export declare function resolveBottomSheetSwipeTracker(state: BottomSheetSwipeTrackerState): BottomSheetSwipeTrackerConfig;
|
|
155
276
|
/** One entry in a {@link BottomSheetPresentation}'s teardown callback pair. */
|
|
156
277
|
export type BottomSheetTeardownCallback = 'closing' | 'closed';
|
|
157
278
|
/** Subscriber for {@link BottomSheetPresentation} `open` changes. */
|
|
@@ -180,10 +301,18 @@ export interface BottomSheetPresentationOptions {
|
|
|
180
301
|
* still be closed using [property@BottomSheet:open]"); {@link requestClose} is the INTERACTIVE
|
|
181
302
|
* path that runs the gate. Keeping them apart is what lets a locked sheet still be closed by
|
|
182
303
|
* its owner.
|
|
304
|
+
*
|
|
305
|
+
* The same split holds the other way round: {@link requestOpen} is the user's path and runs
|
|
306
|
+
* {@link resolveBottomSheetOpen}, so a sheet with no bottom bar cannot be opened by a user at
|
|
307
|
+
* all, while its owner's `setOpen(true)` still works.
|
|
183
308
|
*/
|
|
184
309
|
export declare class BottomSheetPresentation {
|
|
185
310
|
private _open;
|
|
186
311
|
private _canClose;
|
|
312
|
+
private _canOpen;
|
|
313
|
+
private _hasBottomBar;
|
|
314
|
+
private _revealBottomBar;
|
|
315
|
+
private _modal;
|
|
187
316
|
private _hasBeenOpen;
|
|
188
317
|
private readonly _listeners;
|
|
189
318
|
private readonly _onClosing;
|
|
@@ -201,8 +330,36 @@ export declare class BottomSheetPresentation {
|
|
|
201
330
|
* {@link setOpen}; `has_been_open` in the C source.
|
|
202
331
|
*/
|
|
203
332
|
get hasBeenOpen(): boolean;
|
|
333
|
+
/** Whether the user may open the sheet from its bottom bar (`AdwBottomSheet:can-open`). */
|
|
334
|
+
get canOpen(): boolean;
|
|
335
|
+
/** Whether a bottom bar is set (`AdwBottomSheet:bottom-bar` is non-NULL). */
|
|
336
|
+
get hasBottomBar(): boolean;
|
|
337
|
+
/** Whether the bottom bar is revealed (`AdwBottomSheet:reveal-bottom-bar`). */
|
|
338
|
+
get revealBottomBar(): boolean;
|
|
339
|
+
/** Whether the sheet dims and blocks the content while open (`AdwBottomSheet:modal`). */
|
|
340
|
+
get modal(): boolean;
|
|
341
|
+
/** What the renderer has to show for the current state — {@link resolveBottomSheetChrome}. */
|
|
342
|
+
get chrome(): BottomSheetChrome;
|
|
204
343
|
/** Set `can-close`. Returns whether it changed. */
|
|
205
344
|
setCanClose(canClose: boolean): boolean;
|
|
345
|
+
/** Set `can-open`. Returns whether it changed. */
|
|
346
|
+
setCanOpen(canOpen: boolean): boolean;
|
|
347
|
+
/**
|
|
348
|
+
* Record whether a bottom bar is present. Returns whether it changed.
|
|
349
|
+
*
|
|
350
|
+
* A renderer calls this from wherever it adopts the bar widget — the C setter is where
|
|
351
|
+
* `update_swipe_tracker` is re-run (adw-bottom-sheet.c:1629), i.e. presence is an INPUT to
|
|
352
|
+
* the gates, not a rendering detail.
|
|
353
|
+
*/
|
|
354
|
+
setHasBottomBar(hasBottomBar: boolean): boolean;
|
|
355
|
+
/**
|
|
356
|
+
* Set `modal`. Returns whether it changed. A sheet that is open changes its dimming at
|
|
357
|
+
* once, as `adw_bottom_sheet_set_modal` does (adw-bottom-sheet.c:1981-1982); `open` and
|
|
358
|
+
* the gates do not move, so nothing is notified here — the renderer repaints.
|
|
359
|
+
*/
|
|
360
|
+
setModal(modal: boolean): boolean;
|
|
361
|
+
/** Set `reveal-bottom-bar`. Returns whether it changed. */
|
|
362
|
+
setRevealBottomBar(reveal: boolean): boolean;
|
|
206
363
|
/**
|
|
207
364
|
* The programmatic open/close — `adw_bottom_sheet_set_open`. Returns whether `open`
|
|
208
365
|
* changed, i.e. whether a `notify::open` was emitted.
|
|
@@ -218,6 +375,12 @@ export declare class BottomSheetPresentation {
|
|
|
218
375
|
* forwarded to the parent, or nothing at all.
|
|
219
376
|
*/
|
|
220
377
|
requestClose(source: BottomSheetCloseSource): BottomSheetCloseOutcome;
|
|
378
|
+
/**
|
|
379
|
+
* Route an open affordance through {@link resolveBottomSheetOpen} and APPLY the outcome.
|
|
380
|
+
* `'ignored'` is the only other answer, and it is silent: libadwaita has no
|
|
381
|
+
* `open-attempt` counterpart to `close-attempt`, so a renderer emits nothing for it.
|
|
382
|
+
*/
|
|
383
|
+
requestOpen(source: BottomSheetOpenSource): BottomSheetOpenOutcome;
|
|
221
384
|
/**
|
|
222
385
|
* The sheet has finished hiding — `open_animation_done_cb`'s teardown reduced to what a
|
|
223
386
|
* renderer without a spring animation can observe. Fires `onClosed` and returns whether it
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { AdwMenuEntryInput, AdwMenuItemInput } from './menu.js';
|
|
2
|
+
/**
|
|
3
|
+
* One menu item, built the way `g_menu_item_new` builds one.
|
|
4
|
+
*
|
|
5
|
+
* IT IS ITSELF A PORTABLE ENTRY — `implements AdwMenuItemInput` — so `append_item` pushes
|
|
6
|
+
* the instance and `normalizeMenuModel` reads its fields like any authored object. A
|
|
7
|
+
* separate internal shape would need a conversion the model does not ask for.
|
|
8
|
+
*
|
|
9
|
+
* Both halves are nullable, as they are in C: `g_menu_item_new(NULL, NULL)` is legal and
|
|
10
|
+
* produces an item carrying neither, which {@link normalizeMenuModel} drops rather than
|
|
11
|
+
* drawing an empty, unactionable row.
|
|
12
|
+
*/
|
|
13
|
+
export declare class GioMenuItem implements AdwMenuItemInput {
|
|
14
|
+
/** The user-visible string; ABSENT rather than `undefined` when the item has none. */
|
|
15
|
+
label?: string;
|
|
16
|
+
/** The DETAILED action name — `app.save-as`, `app.view::list` (ADR 0042 § divergence 2). */
|
|
17
|
+
action?: string;
|
|
18
|
+
constructor(label?: string | null, detailedAction?: string | null);
|
|
19
|
+
/** `g_menu_item_set_label`. `null` REMOVES the attribute, which is what C does. */
|
|
20
|
+
set_label(label: string | null): void;
|
|
21
|
+
/** `g_menu_item_set_detailed_action`, and `null` is `g_menu_item_set_action_and_target(…, NULL)`. */
|
|
22
|
+
set_detailed_action(detailedAction: string | null): void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A menu under construction — `Gio.Menu`'s four append entry points over the portable model.
|
|
26
|
+
*
|
|
27
|
+
* `new GioMenu()` is empty, as `g_menu_new()` is. Every `append*` puts one entry on the end,
|
|
28
|
+
* and the instance IS the value a `menuModel` property takes.
|
|
29
|
+
*/
|
|
30
|
+
export declare class GioMenu extends Array<AdwMenuEntryInput> {
|
|
31
|
+
/** `g_menu_append` — the convenience C implements as `menu_item_new` + `append_item`. */
|
|
32
|
+
append(label: string | null, detailedAction?: string | null): void;
|
|
33
|
+
/** `g_menu_append_item`. */
|
|
34
|
+
append_item(item: GioMenuItem): void;
|
|
35
|
+
/**
|
|
36
|
+
* `g_menu_append_section` — the `section` LINK, whose items are drawn inline with a
|
|
37
|
+
* separator rather than behind a further click.
|
|
38
|
+
*
|
|
39
|
+
* The label is optional in C and stays optional here: a section with none is a plain
|
|
40
|
+
* group, and writing `label: null` onto the entry would be an attribute the model
|
|
41
|
+
* then has to ignore.
|
|
42
|
+
*/
|
|
43
|
+
append_section(label: string | null, section: readonly AdwMenuEntryInput[]): void;
|
|
44
|
+
/** `g_menu_append_submenu` — the `submenu` LINK: a nested menu the user opens. */
|
|
45
|
+
append_submenu(label: string | null, submenu: readonly AdwMenuEntryInput[]): void;
|
|
46
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { AdwAdjustment, AdwAdjustmentInput } from './adjustment.js';
|
|
2
|
+
/**
|
|
3
|
+
* What `new Gtk.Adjustment({ … })` takes: the GJS construct bag, which is exactly
|
|
4
|
+
* {@link AdwAdjustmentInput}.
|
|
5
|
+
*
|
|
6
|
+
* An ALIAS and not a second interface — the two would be one declaration copied, and the
|
|
7
|
+
* copy is the one that drifts when a seventh field arrives.
|
|
8
|
+
*/
|
|
9
|
+
export type GtkAdjustmentProps = AdwAdjustmentInput;
|
|
10
|
+
/**
|
|
11
|
+
* A numeric range — `Gtk.Adjustment`'s six properties as a value an `adjustment` property
|
|
12
|
+
* takes.
|
|
13
|
+
*
|
|
14
|
+
* `new GtkAdjustment()` is `ADW_ADJUSTMENT_DEFAULTS` (0…100 step 1), which is the
|
|
15
|
+
* package's own default and NOT GTK's 0…0 step 0 — `adjustment.ts` says why in its header.
|
|
16
|
+
*/
|
|
17
|
+
export declare class GtkAdjustment implements AdwAdjustment {
|
|
18
|
+
/** The current value, within {@link adjustmentRange}. */
|
|
19
|
+
value: number;
|
|
20
|
+
/** The minimum value. */
|
|
21
|
+
lower: number;
|
|
22
|
+
/** The maximum value. */
|
|
23
|
+
upper: number;
|
|
24
|
+
/** How far one stepper press moves the value. */
|
|
25
|
+
stepIncrement: number;
|
|
26
|
+
/** How far one page press (Page Up/Down) moves the value. */
|
|
27
|
+
pageIncrement: number;
|
|
28
|
+
/** The size of the visible page; zero for a scalar value such as a spin row's. */
|
|
29
|
+
pageSize: number;
|
|
30
|
+
constructor(props?: GtkAdjustmentProps | null);
|
|
31
|
+
/**
|
|
32
|
+
* Re-establish the invariants around one authored change.
|
|
33
|
+
*
|
|
34
|
+
* The current six are the BASE, so a field nobody wrote keeps what it held instead of
|
|
35
|
+
* falling back to the package default — the same contract `SpinState.configure` has.
|
|
36
|
+
*/
|
|
37
|
+
private _write;
|
|
38
|
+
/** `gtk_adjustment_configure` — all six at once, which is what C compresses into one. */
|
|
39
|
+
configure(value: number, lower: number, upper: number, step_increment: number, page_increment: number, page_size: number): void;
|
|
40
|
+
/** `gtk_adjustment_get_value`. */
|
|
41
|
+
get_value(): number;
|
|
42
|
+
/** `gtk_adjustment_set_value` — "clamped to lie between lower and upper". */
|
|
43
|
+
set_value(value: number): void;
|
|
44
|
+
/** `gtk_adjustment_get_lower`. */
|
|
45
|
+
get_lower(): number;
|
|
46
|
+
/** `gtk_adjustment_set_lower`. */
|
|
47
|
+
set_lower(lower: number): void;
|
|
48
|
+
/** `gtk_adjustment_get_upper`. */
|
|
49
|
+
get_upper(): number;
|
|
50
|
+
/** `gtk_adjustment_set_upper`. */
|
|
51
|
+
set_upper(upper: number): void;
|
|
52
|
+
/** `gtk_adjustment_get_step_increment`. */
|
|
53
|
+
get_step_increment(): number;
|
|
54
|
+
/** `gtk_adjustment_set_step_increment`. */
|
|
55
|
+
set_step_increment(step_increment: number): void;
|
|
56
|
+
/** `gtk_adjustment_get_page_increment`. */
|
|
57
|
+
get_page_increment(): number;
|
|
58
|
+
/** `gtk_adjustment_set_page_increment`. */
|
|
59
|
+
set_page_increment(page_increment: number): void;
|
|
60
|
+
/** `gtk_adjustment_get_page_size`. */
|
|
61
|
+
get_page_size(): number;
|
|
62
|
+
/** `gtk_adjustment_set_page_size`. */
|
|
63
|
+
set_page_size(page_size: number): void;
|
|
64
|
+
/**
|
|
65
|
+
* `gtk_adjustment_get_minimum_increment` — "the smaller of step increment and page
|
|
66
|
+
* increment", which is the GIR's own sentence.
|
|
67
|
+
*
|
|
68
|
+
* Total, with no zero case: `normalizeAdjustment` refuses a step of zero and carries
|
|
69
|
+
* the page increment with it, so both are positive here. C has to answer for the
|
|
70
|
+
* adjustment its own defaults produce, where either can be 0.
|
|
71
|
+
*/
|
|
72
|
+
get_minimum_increment(): number;
|
|
73
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What `new Gtk.StringList({ … })` takes — the GJS spelling of the type's own
|
|
3
|
+
* construct-time properties.
|
|
4
|
+
*
|
|
5
|
+
* `strings` only. The other two `StringList` declares — `item-type` and `n-items` — are
|
|
6
|
+
* `GListModel`'s read-only pair, and a construct bag that accepted them would be offering
|
|
7
|
+
* a write the type does not have.
|
|
8
|
+
*/
|
|
9
|
+
export interface GtkStringListProps {
|
|
10
|
+
/** The strings the list starts with. */
|
|
11
|
+
strings?: readonly string[] | null;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A list of strings under construction — `Gtk.StringList`'s building half over a plain
|
|
15
|
+
* JS array.
|
|
16
|
+
*
|
|
17
|
+
* `new GtkStringList()` is empty, as `gtk_string_list_new(NULL)` is, and the instance IS
|
|
18
|
+
* the value a `model` property takes.
|
|
19
|
+
*/
|
|
20
|
+
export declare class GtkStringList extends Array<string> {
|
|
21
|
+
/** See the file header: `map`/`filter`/`slice` must not call this constructor. */
|
|
22
|
+
static get [Symbol.species](): ArrayConstructor;
|
|
23
|
+
constructor(props?: GtkStringListProps | null);
|
|
24
|
+
/**
|
|
25
|
+
* `Gtk.StringList:strings`, as the door an attribute reaches. GTK's property is
|
|
26
|
+
* construct-only, and a NativeScript XML template has no constructor call to pass it
|
|
27
|
+
* through: `<gtk:StringList strings='["Blue","Teal"]'>` assigns the JSON text to this
|
|
28
|
+
* member instead, on a list that is still empty. So it REPLACES the contents, as
|
|
29
|
+
* constructing with `{ strings }` would have filled them.
|
|
30
|
+
*/
|
|
31
|
+
get strings(): string[];
|
|
32
|
+
set strings(value: readonly string[] | string);
|
|
33
|
+
/** `gtk_string_list_append`. */
|
|
34
|
+
append(string: string): void;
|
|
35
|
+
/**
|
|
36
|
+
* `gtk_string_list_take` — `append` without the copy.
|
|
37
|
+
*
|
|
38
|
+
* The copy is what the two differ by in C ("this variant … is convenient for
|
|
39
|
+
* formatting strings"), and JS strings are immutable, so here the two are one
|
|
40
|
+
* function. It exists so code ported from GJS keeps working rather than to say
|
|
41
|
+
* something `append` does not.
|
|
42
|
+
*/
|
|
43
|
+
take(string: string): void;
|
|
44
|
+
/** `gtk_string_list_remove` — the string at `position`, which must be in range. */
|
|
45
|
+
remove(position: number): void;
|
|
46
|
+
/**
|
|
47
|
+
* `gtk_string_list_splice` AND `Array.prototype.splice`, which is the point.
|
|
48
|
+
*
|
|
49
|
+
* The two say the same thing and pass the additions differently: C takes ONE array of
|
|
50
|
+
* them, JS takes them as rest arguments. A list whose elements are strings can tell
|
|
51
|
+
* the two apart with no ambiguity — an element is never an array — so both spellings
|
|
52
|
+
* work and a `list.splice(1, 2, ['a', 'b'])` ported straight from GJS inserts two
|
|
53
|
+
* strings instead of silently inserting one array as an element.
|
|
54
|
+
*
|
|
55
|
+
* `nRemovals` omitted is `Array.prototype.splice`'s "to the end", which is a different
|
|
56
|
+
* thing from passing `undefined` — so it is spelled as the count that reaches the end,
|
|
57
|
+
* which `splice` clamps the same way for a negative `position` as the one-argument form
|
|
58
|
+
* does.
|
|
59
|
+
*
|
|
60
|
+
* Flattened by hand, not `Array.prototype.flatMap` (ES2019): this source is also
|
|
61
|
+
* type-checked through `@gjsify/gtk-host`'s type-surface gate, whose `tsconfig`s
|
|
62
|
+
* pin `lib` to ES2017 for reasons of their own (`type-tests/{jsx,react}/tsconfig.json`)
|
|
63
|
+
* — a method this file alone would happily target ES2020 for is invisible there.
|
|
64
|
+
*/
|
|
65
|
+
splice(position: number, nRemovals?: number, ...additions: readonly (string | readonly string[])[]): string[];
|
|
66
|
+
/** `gtk_string_list_get_string` — `null` past the end, as C returns `NULL`. */
|
|
67
|
+
get_string(position: number): string | null;
|
|
68
|
+
/** `g_list_model_get_n_items`, which a `GtkStringList` answers with its length. */
|
|
69
|
+
get_n_items(): number;
|
|
70
|
+
}
|