@gjsify/adwaita-core 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.
@@ -65,7 +65,11 @@ export declare class ActionRowState<TWidget = unknown> {
65
65
  setTitle(title: string | null | undefined): boolean;
66
66
  /** `AdwActionRow:subtitle`. */
67
67
  get subtitle(): string;
68
- /** Set the subtitle. Returns whether it changed (the `notify::subtitle` gate). */
68
+ /**
69
+ * Set the subtitle. Returns whether the write notifies (the `notify::subtitle` gate) —
70
+ * which is NOT whether the text moved: a `null` write notifies every time
71
+ * ({@link adwSubtitleWriteNotifies}).
72
+ */
69
73
  setSubtitle(subtitle: string | null | undefined): boolean;
70
74
  /** `AdwActionRow:activatable-widget` — `null` when unset. */
71
75
  get activatableWidget(): TWidget | null;
@@ -164,3 +164,31 @@ export interface WindowTitleVector {
164
164
  * the reasoning for why the port normalises before comparing.
165
165
  */
166
166
  export declare const WINDOW_TITLE_VECTORS: ReadonlyArray<WindowTitleVector>;
167
+ /** One `subtitle` write and whether it notifies. */
168
+ export interface ActionRowSubtitleStep {
169
+ /** What the caller passed: `null` is a distinct write from `''`. */
170
+ write: string | null;
171
+ /** Whether `notify::subtitle` is emitted for this write. */
172
+ notified: boolean;
173
+ /** `get_subtitle()` afterwards — never `null`. */
174
+ subtitle: string;
175
+ }
176
+ /** A scripted sequence of subtitle writes applied to a FRESH `Adw.ActionRow` / `Adw.ExpanderRow`. */
177
+ export interface ActionRowSubtitleVector {
178
+ name: string;
179
+ steps: readonly ActionRowSubtitleStep[];
180
+ rule: string;
181
+ }
182
+ /**
183
+ * `adw_action_row_set_subtitle` (adw-action-row.c:562-577), which `Adw.ExpanderRow` inherits.
184
+ *
185
+ * The guard is `g_strcmp0 (gtk_label_get_text (priv->subtitle), subtitle) == 0`. The label's
186
+ * text is never `NULL` and `g_strcmp0` never calls `NULL` equal to a string, so a `NULL` write
187
+ * passes the guard EVERY time, rewrites `""` over `""` and notifies. An empty string against
188
+ * the empty label is the ordinary idempotent case.
189
+ *
190
+ * Every row is a runtime measurement on GJS 1.88.1 / libadwaita 1.9.4 / GTK 4.22.5, on both
191
+ * `Adw.ActionRow` and `Adw.ExpanderRow`. `title` was measured on the same rows and does NOT
192
+ * behave this way, so these vectors are about the subtitle alone.
193
+ */
194
+ export declare const ACTION_ROW_SUBTITLE_VECTORS: ReadonlyArray<ActionRowSubtitleVector>;
@@ -0,0 +1,40 @@
1
+ /** The properties an `Adw.ExpanderRow` write can notify. */
2
+ export type ExpanderRowProperty = 'expanded' | 'enable-expansion';
3
+ /** One write in an {@link ExpanderRowVector} sequence, with its outcome. */
4
+ export interface ExpanderRowStep {
5
+ /** The property written. */
6
+ op: ExpanderRowProperty;
7
+ value: boolean;
8
+ /** The `notify::*` properties this one write emits, in emission order. */
9
+ notified: readonly ExpanderRowProperty[];
10
+ /** `get_expanded()` afterwards. */
11
+ expanded: boolean;
12
+ /** `get_enable_expansion()` afterwards. */
13
+ enableExpansion: boolean;
14
+ rule: string;
15
+ }
16
+ /** A scripted sequence of writes applied to a FRESH row (`expanded=false`, `enable-expansion=true`). */
17
+ export interface ExpanderRowVector {
18
+ name: string;
19
+ steps: readonly ExpanderRowStep[];
20
+ }
21
+ /** The row `adw_expander_row_init` builds: collapsed, expansion enabled. */
22
+ export declare const EXPANDER_ROW_INITIAL: {
23
+ readonly expanded: false;
24
+ readonly enableExpansion: true;
25
+ };
26
+ export declare const EXPANDER_ROW_VECTORS: ReadonlyArray<ExpanderRowVector>;
27
+ /**
28
+ * What a row built with BOTH properties at once ends up holding — construct properties, an XML
29
+ * attribute pair, a `new Adw.ExpanderRow({…})`. Measured in BOTH key orders on GJS: neither
30
+ * order lets a disabled row open. A leg applies `enableExpansion` first and `expanded` second,
31
+ * and the reverse where it can spell it, and expects the same answer.
32
+ */
33
+ export interface ExpanderRowConstructVector {
34
+ expanded: boolean;
35
+ enableExpansion: boolean;
36
+ /** `get_expanded()` afterwards. */
37
+ resultExpanded: boolean;
38
+ rule: string;
39
+ }
40
+ export declare const EXPANDER_ROW_CONSTRUCT_VECTORS: ReadonlyArray<ExpanderRowConstructVector>;
@@ -2,8 +2,8 @@ export { ABOUT_DIALOG_CREDITS_LEGAL_VECTORS, ABOUT_DIALOG_DETAILS_VECTORS, ABOUT
2
2
  export type { AboutDialogCreditsLegalVector, AboutDialogDetailsVector, AboutDialogHeaderVector, AboutDialogLabelVector, AboutDialogSupportVector, AcknowledgementSectionsVector, CreditPersonVector, CreditsSectionsVector, LegalSectionVector, LegalSectionsVector, LicenseInfoVector, LicenseSetterStep, LicenseSetterVector, LicenseSpdxVector, LicenseTextVector, TranslatorCreditsVector, } from './about-dialog.js';
3
3
  export { AVATAR_COLOR_VECTORS, AVATAR_FONT_SIZE_VECTORS, AVATAR_ICON_SIZE_VECTORS, AVATAR_INITIALS_VECTORS, AVATAR_MODE_VECTORS, } from './avatar.js';
4
4
  export type { AvatarColorVector, AvatarFontSizeVector, AvatarIconSizeVector, AvatarInitialsVector, AvatarModeVector, } from './avatar.js';
5
- export { ACTION_ROW_ACTIVATION_VECTORS, BUTTON_ROW_ACTIVATABLE_VECTORS, BUTTON_ROW_ICON_VECTORS, LABEL_VISIBILITY_VECTORS, SWITCH_ROW_NOTIFY_VECTORS, WINDOW_TITLE_VECTORS, } from './action-row.js';
6
- export type { ActionRowActivationVector, ActionRowStep, ButtonRowActivatableVector, ButtonRowIconVector, LabelVisibilityVector, SwitchRowNotifyVector, SwitchRowStep, WindowTitleStep, WindowTitleVector, } from './action-row.js';
5
+ export { ACTION_ROW_ACTIVATION_VECTORS, ACTION_ROW_SUBTITLE_VECTORS, BUTTON_ROW_ACTIVATABLE_VECTORS, BUTTON_ROW_ICON_VECTORS, LABEL_VISIBILITY_VECTORS, SWITCH_ROW_NOTIFY_VECTORS, WINDOW_TITLE_VECTORS, } from './action-row.js';
6
+ export type { ActionRowActivationVector, ActionRowSubtitleStep, ActionRowSubtitleVector, ActionRowStep, ButtonRowActivatableVector, ButtonRowIconVector, LabelVisibilityVector, SwitchRowNotifyVector, SwitchRowStep, WindowTitleStep, WindowTitleVector, } from './action-row.js';
7
7
  export { BANNER_BUTTON_STYLE_PARSE_VECTORS, BANNER_BUTTON_STYLE_VECTORS, BANNER_BUTTON_TEXT_VECTORS, BANNER_BUTTON_VISIBLE_VECTORS, BANNER_DEFAULT_VECTORS, } from './banner.js';
8
8
  export type { BannerButtonStyleParseVector, BannerButtonStyleVector, BannerButtonTextVector, BannerButtonVisibleVector, BannerDefaultVector, } from './banner.js';
9
9
  export { BUTTON_CONTENT_DEFAULT_VECTORS, BUTTON_CONTENT_ELLIPSIZE_VECTORS, BUTTON_CONTENT_ICON_VECTORS, BUTTON_CONTENT_LABEL_VECTORS, BUTTON_CONTENT_STYLE_TARGET_VECTORS, BUTTON_CONTENT_TEXT_VECTORS, } from './button-content.js';
@@ -18,6 +18,8 @@ export { CHECK_GROUP_VECTORS, driveCheckGroupVectors } from './check-group.js';
18
18
  export type { CheckButtonLike, CheckGroupSubject, CheckGroupVector } from './check-group.js';
19
19
  export { COMBO_CHOOSER_VECTORS, COMBO_ITEMS_CHANGED_VECTORS, COMBO_SELECTION_VECTORS, TOGGLE_ACTIVE_NAME_VECTORS, } from './rows.js';
20
20
  export type { ComboChooserVector, ComboItemsChangedVector, ComboSelectionStep, ComboSelectionVector, ComboSpliceStep, ToggleActiveNameVector, } from './rows.js';
21
+ export { EXPANDER_ROW_CONSTRUCT_VECTORS, EXPANDER_ROW_INITIAL, EXPANDER_ROW_VECTORS } from './expander-row.js';
22
+ export type { ExpanderRowConstructVector, ExpanderRowProperty, ExpanderRowStep, ExpanderRowVector, } from './expander-row.js';
21
23
  export { VIEW_STACK_ICON_NAME_VECTORS, VIEW_STACK_PAGE_VECTORS, VIEW_STACK_VECTORS } from './view-stack.js';
22
24
  export type { ViewStackIconNameVector, ViewStackPageDescriptorVector, ViewStackVector, ViewStackVectorChange, ViewStackVectorOp, ViewStackVectorPage, } from './view-stack.js';
23
25
  export { NAVIGATION_VIEW_VECTORS, collectNavigationState, navigationEventLog, runNavigationSteps, } from './navigation-view.js';
@@ -74,6 +76,8 @@ export { BOX_ORIENTATION_VECTORS, BOX_SPACING_VECTORS } from './box.js';
74
76
  export type { BoxOrientationVector, BoxSpacingVector } from './box.js';
75
77
  export { LABEL_CHAR_COUNT_VECTORS, LABEL_DISPLAY_TEXT_VECTORS, LABEL_EFFECTIVE_LINES_VECTORS, LABEL_ELLIPSIZE_OVERFLOW_VECTORS, LABEL_ELLIPSIZE_VECTORS, LABEL_JUSTIFY_VECTORS, LABEL_WIDTH_CHARS_EXTENT_VECTORS, LABEL_WRAP_MODE_VECTORS, LABEL_XALIGN_VECTORS, LABEL_YALIGN_ALIGN_ITEMS_VECTORS, LABEL_YALIGN_VECTORS, } from './label.js';
76
78
  export type { LabelCharCountVector, LabelDisplayTextVector, LabelEffectiveLinesVector, LabelEllipsizeOverflowVector, LabelEllipsizeVector, LabelJustifyVector, LabelWidthCharsExtentVector, LabelWrapModeVector, LabelXalignVector, LabelYalignAlignItemsVector, LabelYalignVector, } from './label.js';
79
+ export { LABEL_MARKUP_LINK_VECTORS, LABEL_MARKUP_RUN_VECTORS } from './label-markup.js';
80
+ export type { LabelMarkupLinkExpectation, LabelMarkupLinkVector, LabelMarkupRunExpectation, LabelMarkupRunVector, } from './label-markup.js';
77
81
  export { WRAP_BOX_CHILD_ORDER_VECTORS, WRAP_BOX_LENGTH_VECTORS, WRAP_BOX_LINE_VECTORS, WRAP_BOX_NATURAL_LENGTH_VECTORS, WRAP_BOX_NOTIFY_PROPERTIES, WRAP_BOX_POLICY_VECTORS, WRAP_BOX_SPACING_NOTIFY_VECTORS, WRAP_BOX_SPACING_VECTORS, } from './wrap-box.js';
78
82
  export type { WrapBoxChildOrderVector, WrapBoxLengthVector, WrapBoxLineVector, WrapBoxNaturalLengthVector, WrapBoxPolicyVector, WrapBoxSpacingNotifyVector, WrapBoxSpacingVector, } from './wrap-box.js';
79
83
  export { BREAKPOINT_PICK_VECTORS, BREAKPOINT_TRANSITION_VECTORS } from './breakpoint-bin.js';
@@ -0,0 +1,73 @@
1
+ /** One run a label draws: the characters, and the style pango's nesting resolves to. */
2
+ export interface LabelMarkupRunExpectation {
3
+ text: string;
4
+ /** Every flag omitted means "not set", so a row only writes what the markup turns on. */
5
+ bold?: boolean;
6
+ italic?: boolean;
7
+ underline?: boolean;
8
+ strikethrough?: boolean;
9
+ monospace?: boolean;
10
+ /** `<big>` minus `<small>`; absent is 0. */
11
+ sizeSteps?: number;
12
+ script?: 'sub' | 'sup';
13
+ /** The index into the same row's `links`, absent when the run is outside every `<a>`. */
14
+ link?: number;
15
+ /** The `<span>` attribute sets over the run, outermost first; absent is none. */
16
+ spans?: ReadonlyArray<Readonly<Record<string, string>>>;
17
+ }
18
+ /** One markup string and the styled runs both ports draw for it. */
19
+ export interface LabelMarkupRunVector {
20
+ markup: string;
21
+ /** `gtk_label_get_text()` for the same string — the runs' text concatenated. */
22
+ text: string;
23
+ runs: ReadonlyArray<LabelMarkupRunExpectation>;
24
+ rule: string;
25
+ }
26
+ /**
27
+ * THE MERGE IS THE PART A RENDERER GETS WRONG. `<b>a</b><b>b</b>` is ONE bold run, not
28
+ * two: pango attributes character ranges and two adjacent ranges with equal attributes are
29
+ * one range. A port that emits one span per element draws two boxes, and a line break or a
30
+ * selection can then fall between two characters that are typographically one word — so
31
+ * the row with the two adjacent `<b>` elements is the row that catches it.
32
+ *
33
+ * `<big>`/`<small>` ARE COUNTED, NOT FLAGS, because pango multiplies one scale factor per
34
+ * element: `<big><big>x</big></big>` is two steps up, and `<small>` inside `<big>` is back
35
+ * to zero. The innermost-wins reading a boolean would give is wrong at both rows.
36
+ */
37
+ export declare const LABEL_MARKUP_RUN_VECTORS: ReadonlyArray<LabelMarkupRunVector>;
38
+ /** One `<a href>` as a label records it. */
39
+ export interface LabelMarkupLinkExpectation {
40
+ href: string;
41
+ title: string | null;
42
+ cssClass: string | null;
43
+ /** Where the link's text starts in the display text, in UTF-16 code units. */
44
+ start: number;
45
+ /** Where it ends, exclusive. */
46
+ end: number;
47
+ }
48
+ /** One markup string and the links a label takes from it. */
49
+ export interface LabelMarkupLinkVector {
50
+ markup: string;
51
+ /** `null` when the markup does not parse at all, and the raw string stands. */
52
+ links: ReadonlyArray<LabelMarkupLinkExpectation> | null;
53
+ /** Whether the label gains the `link` CSS class — any link at all. */
54
+ cssClass: boolean;
55
+ /** Whether the label gains `has-tooltip` — any link with a `title`. */
56
+ hasTooltip: boolean;
57
+ rule: string;
58
+ }
59
+ /**
60
+ * `Gtk.Label`'s `<a href>` — the one tag that is the LABEL'S and not pango's.
61
+ *
62
+ * THE OFFSETS ARE UTF-16 CODE UNITS, where GTK's are bytes (`pdata->text_len` as
63
+ * `parse_uri_markup` walks). JavaScript has no byte offsets into a string, and the units
64
+ * that matter are the ones `String.prototype.slice` takes — a renderer cutting the display
65
+ * text with these gets the characters GTK's layout attributed. The row with a non-ASCII
66
+ * character before the link is the one that distinguishes the two.
67
+ *
68
+ * THE THREE ATTRIBUTES ARE A CLOSED SET. `href` is required
69
+ * (`G_MARKUP_ERROR_INVALID_CONTENT` without it), `title` and `class` are optional, and a
70
+ * fourth attribute is `G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE` — which means the whole string
71
+ * fails to parse and the label shows it raw, not that the attribute is ignored.
72
+ */
73
+ export declare const LABEL_MARKUP_LINK_VECTORS: ReadonlyArray<LabelMarkupLinkVector>;
@@ -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;
@@ -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;
@@ -51,12 +51,14 @@ export type { GtkStringListProps } from './gtk-string-list.js';
51
51
  export { GjsifyOptionList, GjsifyOptionObject, readModelWrite } from './option-list.js';
52
52
  export type { GjsifyOptionListProps } from './option-list.js';
53
53
  export { ComboState, ExpanderState, ToggleGroupState, keptToggles, toggleIndexOfName } from './rows.js';
54
- export type { ComboItemsListener, ComboNotify, ComboNotifyListener, ComboStateChange, ComboStateListener, ComboWatchableModel, ExpanderStateListener, ToggleGroupStateChange, ToggleGroupStateListener, } from './rows.js';
54
+ export type { ComboItemsListener, ComboNotify, ComboNotifyListener, ComboStateChange, ComboStateListener, ComboWatchableModel, ExpanderNotify, ExpanderStateListener, ToggleGroupStateChange, ToggleGroupStateListener, } from './rows.js';
55
55
  export { DEFAULT_BOX_SPACING, normalizeBoxOrientation, normalizeBoxSpacing } from './box.js';
56
56
  export type { BoxOrientation } from './box.js';
57
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';
58
58
  export type { LabelAlignItems, LabelEllipsizeMode, LabelJustification, LabelWidthCharsExtent, LabelWrapMode, } from './label.js';
59
- 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';
60
62
  export { AppLaunchContext as GdkAppLaunchContext, ContentFormats, ContentProvider, Clipboard, Display, createGdk, widgetDisplayMembers, } from './gdk.js';
61
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';
62
64
  export type { GtkPlatform, HostKeyEvent, PlatformHost } from './gtk-platform.js';
@@ -113,8 +115,8 @@ export type { AdwSwipeEnd, AdwSwipeEndInput, AdwSwipeRange, AdwSwipeSource } fro
113
115
  export { CAROUSEL_SCROLL_TIMEOUT_MS, CAROUSEL_SETTLE_EPSILON, CarouselState, carouselClampPosition, carouselClosestSnapPoint, carouselNavigateTarget, carouselPageAllocation, carouselPageAtPosition, carouselRange, carouselReorderShift, carouselSizesFromSnapPoints, carouselSnapPoints, carouselWheelStep, } from './carousel.js';
114
116
  export type { CarouselChangeReason, CarouselDirection, CarouselOrientation, CarouselPageAllocation, CarouselPageChangedListener, CarouselPageMeasurement, CarouselRange, CarouselReorderShiftInput, CarouselScrollOptions, CarouselScrollRequest, CarouselScrollSource, CarouselStateChange, CarouselStateListener, CarouselStateOptions, CarouselWheelInput, } from './carousel.js';
115
117
  export { UNTITLED_PAGE_LABEL, collectSearchRows, countVisiblePages, createSearchRowSubtitle, defaultCaseFolder, derivePreferencesGroupHeader, makeComparable, rowMatchesQuery, searchPreferences, } from './preferences.js';
116
- export { PANGO_MARKUP_TAGS, escapeMarkup, parsePangoMarkup, stripMarkup } from './pango-markup.js';
117
- 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';
118
120
  export type { CaseFolder, MakeComparableOptions, PreferencesGroupHeaderInput, PreferencesGroupHeaderState, PreferencesSearchEntry, PreferencesSearchGroup, PreferencesSearchPage, PreferencesSearchResult, PreferencesSearchRow, SearchPreferencesOptions, SearchRowSubtitleInput, } from './preferences.js';
119
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';
120
122
  export type { AdwClampSizeClass, AdwMeasurement, AdwToolbarStyle, ClampAllocation, ClampParams, ClampThresholds, SpinnerGeometry, ToolbarViewAllocateInput, ToolbarViewAllocation, ToolbarViewClassInput, ToolbarViewClasses, ToolbarViewContentForSize, ToolbarViewContentForSizeInput, ToolbarViewMeasureInput, } from './chrome.js';
@@ -142,6 +144,8 @@ export type { ApplicationHost, GtkApplicationMembers, GtkApplicationConstructor
142
144
  export { ActionRegistry, SimpleAction, actionRegistryOf, activateWidgetAction, applicationOfWindow, findActionGroup, insertActionGroup, installActionMap, linkWindow, SimpleActionGroup, } from './gio-actions.js';
143
145
  export type { ActionActivateHandler, ActionGroupLike, ActionLike, SimpleActionProps } from './gio-actions.js';
144
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';
145
149
  export { engineForTarget, registerGObjectEngine, registeredEngine, resetRegisteredEngine } from './engine.js';
146
150
  export type { EngineTarget, ForeignClassMeta, ForeignObjectProperty, ForeignProperty, ForeignPropertyKind, ForeignScalarKind, ForeignScalarProperty, ForeignSignal, GObjectEngine, } from './engine.js';
147
151
  export { MAXUINT32, buildFilenamev, getCurrentDir, getSystemDataDirs } from './glib-paths.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. */
@@ -17,6 +17,29 @@ export type PangoMarkupNode = {
17
17
  readonly attributes: Readonly<Record<string, string>>;
18
18
  readonly children: readonly PangoMarkupNode[];
19
19
  };
20
+ /**
21
+ * A piece of LABEL markup: {@link PangoMarkupNode}, plus the `<a href>` run pango knows
22
+ * nothing about. Every `PangoMarkupNode` IS a `LabelMarkupNode` — the link kind is the
23
+ * only addition — so a renderer written against this type draws both trees.
24
+ */
25
+ export type LabelMarkupNode = {
26
+ readonly kind: 'text';
27
+ readonly text: string;
28
+ } | {
29
+ readonly kind: 'element';
30
+ readonly tag: PangoMarkupTag;
31
+ readonly attributes: Readonly<Record<string, string>>;
32
+ readonly children: readonly LabelMarkupNode[];
33
+ } | {
34
+ readonly kind: 'link';
35
+ /** `<a>`'s required `href`, entities resolved. */
36
+ readonly href: string;
37
+ /** `<a title>`, which GTK shows as the label's tooltip; `null` when absent. */
38
+ readonly title: string | null;
39
+ /** `<a class>`, the CSS class GTK puts on the link's own node; `null` when absent. */
40
+ readonly cssClass: string | null;
41
+ readonly children: readonly LabelMarkupNode[];
42
+ };
20
43
  /**
21
44
  * `g_markup_escape_text` — the escape `create_search_row_subtitle` puts a page title
22
45
  * through before it becomes a markup subtitle. GLib emits NUMERIC references for the
@@ -50,10 +73,32 @@ export declare function escapeMarkup(text: string): string;
50
73
  * discarded).
51
74
  */
52
75
  export declare function parsePangoMarkup(text: string): PangoMarkupNode[] | null;
76
+ /**
77
+ * `gtk_label_set_markup`'s whole parse: pango's markup PLUS `<a href>`, which is
78
+ * `Gtk.Label`'s own extension and not a pango tag at all.
79
+ *
80
+ * Same `null`-never-throws contract as {@link parsePangoMarkup}, and the same failures,
81
+ * with `<a>`'s two added: an attribute other than `href` / `title` / `class`
82
+ * (`G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE`) and a missing `href`
83
+ * (`G_MARKUP_ERROR_INVALID_CONTENT`).
84
+ *
85
+ * USE THIS ONLY WHERE GTK ITSELF PARSES URI MARKUP — `Gtk.Label`, and the widgets that
86
+ * are a label (`Gtk.Inscription` is NOT one: it has no `::activate-link`). Everything
87
+ * else — the search pipeline's `stripMarkup`, `Adw.Banner`, `Adw.AlertDialog` — stays on
88
+ * {@link parsePangoMarkup}, where `<a>` is an unknown tag and the string falls back to
89
+ * text, because that is what those surfaces do in the C.
90
+ */
91
+ export declare function parseLabelMarkup(text: string): LabelMarkupNode[] | null;
53
92
  /**
54
93
  * The plain text of markup — {@link parsePangoMarkup} reduced to its text runs, and
55
94
  * `null` under exactly the same failures. This is what `make_comparable` compares, what
56
- * `<gtk-label>`/`<gtk-inscription>` show for `use-markup`, and what the C shows when
57
- * markup does not parse.
95
+ * `<gtk-inscription>` shows for `markup`, and what the C shows when markup does not parse.
58
96
  */
59
97
  export declare function stripMarkup(text: string): string | null;
98
+ /**
99
+ * The plain text of LABEL markup — {@link parseLabelMarkup} reduced the same way, so a
100
+ * `<a href="…">GTK</a>` shows as `GTK` and not as the raw string. This is what
101
+ * `gtk_label_get_text` returns: `parse_uri_markup` strips the `<a>` elements out before
102
+ * pango ever sees the string, and the text GTK keeps is the remainder.
103
+ */
104
+ export declare function stripLabelMarkup(text: string): string | null;
@@ -6,21 +6,43 @@ export type { SpinStateChange, SpinStateListener, SpinStateRangeListener } from
6
6
  /** Subscriber for {@link ExpanderState} changes — receives the new expanded flag. */
7
7
  export type ExpanderStateListener = (expanded: boolean) => void;
8
8
  /**
9
- * The disclosure state of an expander row: a single boolean that toggles between
10
- * revealed and collapsed. Idempotent — setting the current value again is a no-op
11
- * and fires no notification. Both programmatic and interactive changes notify (as
12
- * `Adw.ExpanderRow` does).
9
+ * The `notify::*` an expander-row write emits, in emission order. A renderer that owns real
10
+ * GObject properties re-emits it verbatim; `expanded` leads `enable-expansion` because the
11
+ * C setter cross-writes `expanded` before it notifies its own property.
12
+ */
13
+ export type ExpanderNotify = 'expanded' | 'enable-expansion';
14
+ /**
15
+ * The state of an expander row: whether the disclosure is revealed, and whether it may be.
16
+ *
17
+ * The two are coupled the way `adw-expander-row.c` couples them. `setExpanded` coerces
18
+ * `expanded && enableExpansion` before its equal-return (C:264), so opening a disabled row is
19
+ * a silent no-op rather than a refusal. `setEnableExpansion` stores, drives `expanded` to the
20
+ * new value (C:310) and only then notifies its own property — enabling EXPANDS, disabling
21
+ * COLLAPSES. Idempotent — setting a current value again fires nothing. Both programmatic and
22
+ * interactive changes notify (as `Adw.ExpanderRow` does).
13
23
  */
14
24
  export declare class ExpanderState {
15
25
  private _expanded;
26
+ private _enableExpansion;
16
27
  private readonly _listeners;
17
28
  /** Subscribe to expanded-state changes. Returns an unsubscribe function. */
18
29
  subscribe(listener: ExpanderStateListener): () => void;
19
30
  private _emit;
20
31
  /** Whether the disclosure is revealed. */
21
32
  get expanded(): boolean;
22
- /** Set the expanded flag. Notifies only on an actual change. Returns whether it changed. */
33
+ /** Whether the row can be expanded at all. */
34
+ get enableExpansion(): boolean;
35
+ /**
36
+ * Set the expanded flag, held `false` while expansion is disabled. Notifies only on an
37
+ * actual change. Returns whether it changed.
38
+ */
23
39
  setExpanded(value: boolean): boolean;
40
+ /**
41
+ * Set `enable-expansion` and drive `expanded` to the same value. Returns the properties
42
+ * the write notifies, in order: empty for an equal write, `['enable-expansion']` when
43
+ * `expanded` already held the value, `['expanded', 'enable-expansion']` otherwise.
44
+ */
45
+ setEnableExpansion(value: boolean): readonly ExpanderNotify[];
24
46
  /** Flip expanded↔collapsed (the disclosure tap). Returns whether it changed. */
25
47
  toggle(): boolean;
26
48
  /** Reveal the disclosure. Returns whether it changed. */