@gjsify/adwaita-web 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.
- package/dist/adwaita-web.css +31 -0
- package/dist/adwaita-web.css.map +1 -1
- package/lib/types/elements/adw-combo-row.d.ts +34 -15
- package/lib/types/elements/adw-expander-row.d.ts +3 -0
- package/lib/types/elements/gtk-drop-down.d.ts +31 -5
- package/lib/types/elements/gtk-label.d.ts +64 -0
- package/lib/types/label-markup.d.ts +30 -0
- package/lib/types/namespace/gdk.d.ts +1 -1
- package/lib/types/pango-markup.d.ts +17 -0
- package/lib/types/styles.generated.d.ts +1 -1
- package/package.json +12 -12
- package/scss/_labels.scss +19 -0
- package/scss/_link.scss +73 -7
- package/src/adw-action-rows.spec.ts +19 -0
- package/src/adw-row-state.spec.ts +200 -63
- package/src/construct-vectors.spec.ts +4 -2
- package/src/elements/adw-combo-row.ts +93 -47
- package/src/elements/adw-expander-row.ts +46 -16
- package/src/elements/gtk-drop-down.ts +111 -35
- package/src/elements/gtk-label.ts +206 -16
- package/src/elements/gtk-page-setup-unix-dialog.ts +8 -6
- package/src/file-chooser-host.ts +2 -1
- package/src/gtk-drop-down.spec.ts +91 -75
- package/src/gtk-label.spec.ts +431 -11
- package/src/gtk-switch.spec.ts +8 -0
- package/src/gtk-value-doors.spec.ts +70 -32
- package/src/label-markup.ts +193 -0
- package/src/namespace/gdk.ts +1 -0
- package/src/pango-markup.ts +9 -3
- package/src/split-button.spec.ts +7 -4
- package/src/styles.generated.ts +1 -1
- package/src/value-lists.spec.ts +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AdwComboOption,
|
|
1
|
+
import type { AdwComboOption, ComboWatchableModel } from '@gjsify/adwaita-core';
|
|
2
2
|
import { TooltipElement } from '../widget-element.js';
|
|
3
3
|
export declare class AdwComboRow extends TooltipElement {
|
|
4
4
|
private _select;
|
|
@@ -9,19 +9,36 @@ export declare class AdwComboRow extends TooltipElement {
|
|
|
9
9
|
private _subtitleEl;
|
|
10
10
|
/** The headless options list + selectedIndex↔selectedValue state machine (ADR 0004). */
|
|
11
11
|
private readonly _state;
|
|
12
|
+
/**
|
|
13
|
+
* The list the MARKUP doors fill — the `model` ATTRIBUTE is JSON text and a
|
|
14
|
+
* `<gtk-string-list slot="model">` child is strings, and a real `Gio.ListModel` has no
|
|
15
|
+
* spelling in either (ADR 0122 § 5). Held for the element's whole life so re-parsing the
|
|
16
|
+
* attribute splices the list the element already points at rather than replacing it, which
|
|
17
|
+
* would reset the selection.
|
|
18
|
+
*/
|
|
19
|
+
private readonly _authored;
|
|
12
20
|
private _initialized;
|
|
13
21
|
static get observedAttributes(): string[];
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
|
|
22
|
+
/**
|
|
23
|
+
* The list model (`Adw.ComboRow:model`) — the OBJECT that was assigned, by identity, as
|
|
24
|
+
* `row.model === model` is measured to hold in libadwaita (ADR 0122 § 4). The normalised
|
|
25
|
+
* descriptors are {@link options}. Assigning splices the `<select>` and re-runs autoselect.
|
|
26
|
+
*/
|
|
27
|
+
get model(): ComboWatchableModel | null;
|
|
28
|
+
set model(value: ComboWatchableModel | string | null);
|
|
29
|
+
/** The held model's items as `{ value, label }` descriptors. */
|
|
30
|
+
get options(): AdwComboOption[];
|
|
17
31
|
/** `adw_combo_row_set_model`. */
|
|
18
|
-
set_model(model:
|
|
32
|
+
set_model(model: ComboWatchableModel | null): void;
|
|
33
|
+
/** `adw_combo_row_get_model`. */
|
|
34
|
+
get_model(): ComboWatchableModel | null;
|
|
19
35
|
/**
|
|
20
|
-
* The selected index (Adw.ComboRow:selected).
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
36
|
+
* The selected index (Adw.ComboRow:selected). An index past the end is IGNORED — the
|
|
37
|
+
* selection stays where it was, which is what libadwaita is measured to do (ADR 0122 § 4,
|
|
38
|
+
* `combo-probe2.js`) and what `<gtk-drop-down>` already did. This element used to ACCEPT
|
|
39
|
+
* such a set and read back an empty {@link selectedValue}, the one row of
|
|
40
|
+
* `COMBO_SELECTION_VECTORS` the two selectors answered differently; the permissive half
|
|
41
|
+
* was ours, not GTK's, and it is gone. `ComboState.hasIndex` owns the bounds.
|
|
25
42
|
*/
|
|
26
43
|
get selected(): number;
|
|
27
44
|
set selected(value: number);
|
|
@@ -38,13 +55,15 @@ export declare class AdwComboRow extends TooltipElement {
|
|
|
38
55
|
get selectedValue(): string;
|
|
39
56
|
set selectedValue(value: string);
|
|
40
57
|
/**
|
|
41
|
-
* The selected
|
|
58
|
+
* The selected ITEM, or `null` (Adw.ComboRow:selected-item).
|
|
42
59
|
*
|
|
43
|
-
* Read-only, as the GObject property is
|
|
44
|
-
*
|
|
45
|
-
*
|
|
60
|
+
* Read-only, as the GObject property is, and the MODEL'S OWN object rather than a
|
|
61
|
+
* descriptor, so the identity comparison a `selected-item` consumer writes holds (ADR
|
|
62
|
+
* 0122 § 4). `null` and not a blank item: the sentinel and an index past the end both
|
|
63
|
+
* address no option, and inventing an empty one would make "nothing is selected"
|
|
64
|
+
* indistinguishable from an option with no text.
|
|
46
65
|
*/
|
|
47
|
-
get selectedItem():
|
|
66
|
+
get selectedItem(): unknown;
|
|
48
67
|
connectedCallback(): void;
|
|
49
68
|
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
|
50
69
|
/**
|
|
@@ -32,6 +32,9 @@ export declare class AdwExpanderRow extends TooltipElement {
|
|
|
32
32
|
get prefixSection(): HTMLDivElement;
|
|
33
33
|
connectedCallback(): void;
|
|
34
34
|
attributeChangedCallback(name: string): void;
|
|
35
|
+
/** The `enable-expansion` attribute as a flag: on unless it says `false`. */
|
|
36
|
+
private _enableAttribute;
|
|
37
|
+
private _reflectExpanded;
|
|
35
38
|
private _render;
|
|
36
39
|
/** Apply CSS line-clamping based on title-lines/subtitle-lines attributes. */
|
|
37
40
|
private _applyLineClamping;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './gtk-popover.js';
|
|
2
|
-
import type { AdwComboOption,
|
|
2
|
+
import type { AdwComboOption, ComboWatchableModel } from '@gjsify/adwaita-core';
|
|
3
3
|
import type { DispatchedSignals } from '../signals.js';
|
|
4
4
|
import { WidgetElement } from '../widget-element.js';
|
|
5
5
|
/**
|
|
@@ -19,13 +19,31 @@ export declare class GtkDropDown extends WidgetElement {
|
|
|
19
19
|
private _itemButtons;
|
|
20
20
|
/** The headless options list + selectedIndex↔selectedValue machine (ADR 0004). */
|
|
21
21
|
private readonly _state;
|
|
22
|
+
/**
|
|
23
|
+
* The list the MARKUP doors fill — the `model` ATTRIBUTE is JSON text and a
|
|
24
|
+
* `<gtk-string-list slot="model">` child is strings, and a real `Gio.ListModel` has no
|
|
25
|
+
* spelling in either (ADR 0122 § 5). Held for the element's whole life so re-parsing the
|
|
26
|
+
* attribute splices the list the element already points at rather than replacing it, which
|
|
27
|
+
* would reset the selection.
|
|
28
|
+
*/
|
|
29
|
+
private readonly _authored;
|
|
22
30
|
private _initialized;
|
|
23
31
|
private _typeAheadBuffer;
|
|
24
32
|
private _typeAheadTimer;
|
|
25
33
|
static get observedAttributes(): string[];
|
|
26
|
-
/**
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
/**
|
|
35
|
+
* The list model (`Gtk.DropDown:model`) — the OBJECT that was assigned, by identity, as
|
|
36
|
+
* `dropdown.model === model` is measured to hold in GTK (ADR 0122 § 4). The normalised
|
|
37
|
+
* descriptors are {@link options}. Assigning splices the popover and re-runs autoselect.
|
|
38
|
+
*/
|
|
39
|
+
get model(): ComboWatchableModel | null;
|
|
40
|
+
set model(value: ComboWatchableModel | string | null);
|
|
41
|
+
/** The held model's items as `{ value, label }` descriptors. */
|
|
42
|
+
get options(): AdwComboOption[];
|
|
43
|
+
/** `gtk_drop_down_set_model`. */
|
|
44
|
+
set_model(model: ComboWatchableModel | null): void;
|
|
45
|
+
/** `gtk_drop_down_get_model`. */
|
|
46
|
+
get_model(): ComboWatchableModel | null;
|
|
29
47
|
/** The selected index. Out-of-range values are ignored (Gtk.DropDown:selected). */
|
|
30
48
|
get selected(): number;
|
|
31
49
|
set selected(value: number);
|
|
@@ -36,7 +54,15 @@ export declare class GtkDropDown extends WidgetElement {
|
|
|
36
54
|
/** The selected option's value, or '' when empty (Gtk.DropDown:selected-item). */
|
|
37
55
|
get selectedValue(): string;
|
|
38
56
|
set selectedValue(value: string);
|
|
39
|
-
|
|
57
|
+
/**
|
|
58
|
+
* The selected ITEM, or `null` (Gtk.DropDown:selected-item).
|
|
59
|
+
*
|
|
60
|
+
* The MODEL'S OWN object rather than a descriptor, so the identity comparison a
|
|
61
|
+
* `selected-item` consumer writes holds (ADR 0122 § 4).
|
|
62
|
+
*/
|
|
63
|
+
get selectedItem(): unknown;
|
|
64
|
+
/** `gtk_drop_down_get_selected_item`. */
|
|
65
|
+
get_selected_item(): unknown;
|
|
40
66
|
get enableSearch(): boolean;
|
|
41
67
|
set enableSearch(value: boolean);
|
|
42
68
|
get active(): boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type LabelEllipsizeMode, type LabelJustification, type LabelWrapMode } from '@gjsify/adwaita-core';
|
|
2
|
+
import type { DispatchedSignals } from '../signals.js';
|
|
2
3
|
import { WidgetElement } from '../widget-element.js';
|
|
3
4
|
export declare class GtkLabel extends WidgetElement {
|
|
4
5
|
/**
|
|
@@ -11,10 +12,45 @@ export declare class GtkLabel extends WidgetElement {
|
|
|
11
12
|
* gets one text node").
|
|
12
13
|
*/
|
|
13
14
|
private _wrapSpan;
|
|
15
|
+
/**
|
|
16
|
+
* The box the markup's runs are drawn in while the label is a SINGLE LINE — the case
|
|
17
|
+
* {@link _wrapSpan} does not cover, and the runs still may not go without a box.
|
|
18
|
+
*
|
|
19
|
+
* THE RUNS MAY NOT BE THE LABEL'S OWN CHILDREN. `gtk-label` is a flex container (the
|
|
20
|
+
* `xalign` spacers, `_labels.scss`), so each node directly under it is a FLEX ITEM —
|
|
21
|
+
* and a flex item is not text: `vertical-align` does not apply to one, so `<sup>` and
|
|
22
|
+
* `<sub>` stop being raised and lowered, and `align-items` centres each run on its own
|
|
23
|
+
* rather than the line sharing one baseline. A plain label never showed this because a
|
|
24
|
+
* bare text node is ONE anonymous item; a run list is as many items as it has runs. So
|
|
25
|
+
* the runs get a box and the box is the item. `null` while plain text is drawn, so a
|
|
26
|
+
* label without markup keeps the single text node `childElementCount` asserts on.
|
|
27
|
+
*/
|
|
28
|
+
private _runSpan;
|
|
14
29
|
private _resizes;
|
|
15
30
|
/** Whether `_sync` last wrote `min-width` / `max-width` itself, and so may clear them. */
|
|
16
31
|
private _wroteMinWidth;
|
|
17
32
|
private _wroteMaxWidth;
|
|
33
|
+
/**
|
|
34
|
+
* The `<a href>` elements the label currently draws, in reading order.
|
|
35
|
+
*
|
|
36
|
+
* HELD ACROSS RENDERS because `visited` is: `gtk_label_set_markup` carries it over by
|
|
37
|
+
* URI (`labelLinksInheritVisited`), so a followed link stays followed when the text
|
|
38
|
+
* around it is rewritten. Empty whenever the markup has no links or does not parse.
|
|
39
|
+
*/
|
|
40
|
+
private _links;
|
|
41
|
+
private _wired;
|
|
42
|
+
/**
|
|
43
|
+
* The inputs of the run list currently in the DOM, or `null` when plain text is.
|
|
44
|
+
*
|
|
45
|
+
* `_render` runs on EVERY observed attribute — `xalign` included — and rebuilding the
|
|
46
|
+
* run elements each time would drop a selection and the focus inside a link for a
|
|
47
|
+
* change that never touched the text. The plain-text path compares `textContent`; a
|
|
48
|
+
* list of elements has no such single string to compare against, so the two inputs
|
|
49
|
+
* that produced it stand in for it.
|
|
50
|
+
*/
|
|
51
|
+
private _drawn;
|
|
52
|
+
/** The GTK signals this element dispatches, each with the DOM event it arrives as (ADR 0093). */
|
|
53
|
+
static readonly signals: DispatchedSignals;
|
|
18
54
|
static get observedAttributes(): ("label" | "use-markup" | "use-underline" | "justify" | "wrap" | "xalign" | "yalign" | "wrap-mode" | "ellipsize" | "lines" | "width-chars" | "max-width-chars" | "selectable")[];
|
|
19
55
|
/** `Gtk.Label:label` — the text as written, before markup and the mnemonic come out. */
|
|
20
56
|
get label(): string;
|
|
@@ -96,6 +132,34 @@ export declare class GtkLabel extends WidgetElement {
|
|
|
96
132
|
private _normalized;
|
|
97
133
|
private _render;
|
|
98
134
|
private _renderSingleLine;
|
|
135
|
+
/**
|
|
136
|
+
* `render`'s runs — or `text` when there are none — into `target`.
|
|
137
|
+
*
|
|
138
|
+
* A PLAIN LABEL KEEPS ITS SINGLE TEXT NODE: `textContent` is still the whole of the
|
|
139
|
+
* write whenever there is no markup to draw, so the shape `gtk-label.spec.ts` asserts
|
|
140
|
+
* for the XSS answer (no elements at all) is unchanged for every label that does not
|
|
141
|
+
* ask for markup.
|
|
142
|
+
*/
|
|
143
|
+
private _draw;
|
|
144
|
+
/**
|
|
145
|
+
* ONE delegated `click` listener, added once and never removed: the anchors are rebuilt
|
|
146
|
+
* on every render, so a listener per anchor would have to be re-added with them, and
|
|
147
|
+
* the element is the node they are always under.
|
|
148
|
+
*/
|
|
149
|
+
private _wire;
|
|
150
|
+
private _click;
|
|
151
|
+
/**
|
|
152
|
+
* The launcher call, on its own method so a caller (or a spec) can stand in for the
|
|
153
|
+
* window the desktop would have opened — `<gtk-link-button>`'s `launch`, and the same
|
|
154
|
+
* door, because the two must not disagree about what following a link does.
|
|
155
|
+
*/
|
|
156
|
+
protected launch(uri: string): void;
|
|
157
|
+
/**
|
|
158
|
+
* `visited` onto the anchors already in the DOM, rather than through a re-render: the
|
|
159
|
+
* link that was just clicked holds the focus, and rebuilding the runs under it would
|
|
160
|
+
* take that away for a change of one class.
|
|
161
|
+
*/
|
|
162
|
+
private _paintVisited;
|
|
99
163
|
/**
|
|
100
164
|
* A WRAPPED OR ELLIPSIZED label centres its BLOCK by `xalign` (`gtklabel.c`,
|
|
101
165
|
* `gtk_label_get_layout_location`), not just each line — `_labels.scss`'s two spacer
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type LabelMarkupRender } from '@gjsify/adwaita-core';
|
|
2
|
+
/**
|
|
3
|
+
* Which link an `<a>` draws, as its index into {@link LabelMarkupRender.links}.
|
|
4
|
+
*
|
|
5
|
+
* On the attribute and not in a JS-side map, because the element re-reads it to paint
|
|
6
|
+
* `visited` and to answer a click: one link may be drawn as SEVERAL anchors (a link whose
|
|
7
|
+
* text changes style mid-way is several runs), and the index is what ties them back
|
|
8
|
+
* together.
|
|
9
|
+
*/
|
|
10
|
+
export declare const LABEL_LINK_ATTRIBUTE = "data-gtk-link";
|
|
11
|
+
/**
|
|
12
|
+
* `render` as nodes, ready to be put into a label.
|
|
13
|
+
*
|
|
14
|
+
* CONSECUTIVE RUNS OF ONE LINK SHARE ONE `<a>`, so a link is one navigable element to the
|
|
15
|
+
* keyboard and one entry in the accessibility tree even when its text changes style
|
|
16
|
+
* part-way through — which is what GTK's single link node is. Runs of DIFFERENT links, or
|
|
17
|
+
* a run with none between them, close the anchor.
|
|
18
|
+
*/
|
|
19
|
+
export declare function labelMarkupNodes(render: LabelMarkupRender, doc: Document, mnemonics?: boolean): Node[];
|
|
20
|
+
/** Write `render` into `target`, replacing what was there. */
|
|
21
|
+
export declare function renderLabelMarkup(target: HTMLElement, render: LabelMarkupRender, mnemonics?: boolean): void;
|
|
22
|
+
/** The `<a>` elements {@link labelMarkupNodes} put under `target`, in reading order. */
|
|
23
|
+
export declare function labelMarkupAnchors(target: HTMLElement): HTMLAnchorElement[];
|
|
24
|
+
/**
|
|
25
|
+
* The link index `anchor` draws, or `null` when it is not one of ours.
|
|
26
|
+
*
|
|
27
|
+
* Read back from the attribute rather than closed over, because a click arrives at an
|
|
28
|
+
* element and the handler has only the DOM to go on.
|
|
29
|
+
*/
|
|
30
|
+
export declare function labelMarkupAnchorIndex(anchor: Element): number | null;
|
|
@@ -8,4 +8,4 @@ export declare const ContentProvider: Pick<typeof import("@gjsify/adwaita-core")
|
|
|
8
8
|
export declare const ContentFormats: typeof import("@gjsify/adwaita-core").ContentFormats;
|
|
9
9
|
export declare const AppLaunchContext: typeof import("@gjsify/adwaita-core").GdkAppLaunchContext;
|
|
10
10
|
export declare const CURRENT_TIME = 0;
|
|
11
|
-
export declare const KEY_space: 32, KEY_a: 97, KEY_d: 100, KEY_e: 101, KEY_q: 113, KEY_s: 115, KEY_w: 119, KEY_Return: 65293, KEY_Escape: 65307, KEY_Left: 65361, KEY_Up: 65362, KEY_Right: 65363, KEY_Down: 65364;
|
|
11
|
+
export declare const KEY_space: 32, KEY_a: 97, KEY_d: 100, KEY_e: 101, KEY_q: 113, KEY_s: 115, KEY_w: 119, KEY_Return: 65293, KEY_Escape: 65307, KEY_Left: 65361, KEY_Up: 65362, KEY_Right: 65363, KEY_Down: 65364, KEY_Back: 269025062;
|
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pango tag → the HTML element that draws it, with the CSS it needs because no
|
|
3
|
+
* presentational UA rule covers it. Every entry is a CLOSED set: a tag missing here is a
|
|
4
|
+
* parse error, so there is no default branch to fall through.
|
|
5
|
+
*/
|
|
6
|
+
export declare const TAG_STYLES: Readonly<Record<string, {
|
|
7
|
+
element: string;
|
|
8
|
+
style?: Readonly<Record<string, string>>;
|
|
9
|
+
}>>;
|
|
10
|
+
/**
|
|
11
|
+
* Write the recognised `<span>` attributes onto `el` as style declarations.
|
|
12
|
+
*
|
|
13
|
+
* Exported for `label-markup.ts`, which draws a `Gtk.Label`'s markup from flat RUNS rather
|
|
14
|
+
* than from this file's tree: the whitelist and its value tables are the part the two must
|
|
15
|
+
* share, so an attribute is added once and both renderers gain it.
|
|
16
|
+
*/
|
|
17
|
+
export declare function applySpanAttributes(el: HTMLElement, attributes: Readonly<Record<string, string>>): void;
|
|
1
18
|
/**
|
|
2
19
|
* Render Pango markup into `target`, replacing its content — the one door every
|
|
3
20
|
* `use-markup` surface in this package goes through.
|