@gjsify/adwaita-web 0.64.12 → 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-expander-row.d.ts +3 -0
- package/lib/types/elements/gtk-label.d.ts +64 -0
- package/lib/types/label-markup.d.ts +30 -0
- package/lib/types/pango-markup.d.ts +17 -0
- package/lib/types/styles.generated.d.ts +1 -1
- package/package.json +13 -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 +80 -0
- package/src/elements/adw-expander-row.ts +46 -16
- package/src/elements/gtk-label.ts +206 -16
- package/src/gtk-label.spec.ts +431 -11
- package/src/gtk-switch.spec.ts +8 -0
- package/src/label-markup.ts +193 -0
- package/src/pango-markup.ts +9 -3
- package/src/split-button.spec.ts +7 -4
- package/src/styles.generated.ts +1 -1
|
@@ -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,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;
|
|
@@ -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.
|