@gjsify/adwaita-core 0.31.0 → 0.33.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.
Files changed (124) hide show
  1. package/lib/esm/about-dialog.js +3 -0
  2. package/lib/esm/action-row.js +1 -0
  3. package/lib/esm/avatar.js +1 -0
  4. package/lib/esm/banner.js +1 -0
  5. package/lib/esm/button-content.js +1 -0
  6. package/lib/esm/carousel.js +1 -0
  7. package/lib/esm/checks.js +1 -0
  8. package/lib/esm/chrome.js +1 -0
  9. package/lib/esm/conformance/about-dialog.js +6 -0
  10. package/lib/esm/conformance/action-row.js +1 -0
  11. package/lib/esm/conformance/avatar.js +1 -0
  12. package/lib/esm/conformance/banner.js +1 -0
  13. package/lib/esm/conformance/button-content.js +1 -0
  14. package/lib/esm/conformance/carousel.js +1 -0
  15. package/lib/esm/conformance/checks.js +1 -0
  16. package/lib/esm/conformance/chrome.js +1 -0
  17. package/lib/esm/conformance/data-grid.js +1 -0
  18. package/lib/esm/conformance/dialog.js +1 -0
  19. package/lib/esm/conformance/entry-row.js +1 -0
  20. package/lib/esm/conformance/index.js +1 -0
  21. package/lib/esm/conformance/navigation-view.js +1 -0
  22. package/lib/esm/conformance/popover.js +1 -0
  23. package/lib/esm/conformance/preferences.js +1 -0
  24. package/lib/esm/conformance/rows.js +1 -0
  25. package/lib/esm/conformance/sidebar.js +1 -0
  26. package/lib/esm/conformance/spinner.js +1 -0
  27. package/lib/esm/conformance/split-button.js +1 -0
  28. package/lib/esm/conformance/split-view.js +1 -0
  29. package/lib/esm/conformance/tab-view.js +1 -0
  30. package/lib/esm/conformance/view-stack.js +1 -0
  31. package/lib/esm/conformance/view-switcher.js +1 -0
  32. package/lib/esm/conformance/wrap-box.js +1 -0
  33. package/lib/esm/data-grid.js +1 -0
  34. package/lib/esm/dialog.js +1 -1
  35. package/lib/esm/easing.js +1 -0
  36. package/lib/esm/entry-row.js +1 -0
  37. package/lib/esm/glib.js +1 -0
  38. package/lib/esm/index.js +1 -1
  39. package/lib/esm/length-unit.js +1 -0
  40. package/lib/esm/navigation-view.js +1 -0
  41. package/lib/esm/popover.js +1 -0
  42. package/lib/esm/preferences.js +1 -0
  43. package/lib/esm/rows.js +1 -1
  44. package/lib/esm/sidebar.js +1 -0
  45. package/lib/esm/spinner.js +1 -0
  46. package/lib/esm/split-button.js +1 -0
  47. package/lib/esm/split-view.js +1 -0
  48. package/lib/esm/tab-view.js +1 -0
  49. package/lib/esm/view-stack.js +1 -0
  50. package/lib/esm/view-switcher.js +1 -0
  51. package/lib/esm/wrap-box.js +1 -0
  52. package/lib/types/about-dialog.d.ts +391 -0
  53. package/lib/types/about-dialog.spec.d.ts +2 -0
  54. package/lib/types/action-row.d.ts +270 -0
  55. package/lib/types/action-row.spec.d.ts +2 -0
  56. package/lib/types/avatar.d.ts +112 -0
  57. package/lib/types/avatar.spec.d.ts +2 -0
  58. package/lib/types/banner.d.ts +104 -0
  59. package/lib/types/banner.spec.d.ts +2 -0
  60. package/lib/types/button-content.d.ts +141 -0
  61. package/lib/types/button-content.spec.d.ts +2 -0
  62. package/lib/types/carousel.d.ts +535 -0
  63. package/lib/types/carousel.spec.d.ts +2 -0
  64. package/lib/types/checks.d.ts +63 -0
  65. package/lib/types/checks.spec.d.ts +2 -0
  66. package/lib/types/chrome.d.ts +355 -0
  67. package/lib/types/chrome.spec.d.ts +2 -0
  68. package/lib/types/conformance/about-dialog.d.ts +314 -0
  69. package/lib/types/conformance/action-row.d.ts +186 -0
  70. package/lib/types/conformance/avatar.d.ts +61 -0
  71. package/lib/types/conformance/banner.d.ts +91 -0
  72. package/lib/types/conformance/button-content.d.ts +110 -0
  73. package/lib/types/conformance/carousel.d.ts +298 -0
  74. package/lib/types/conformance/checks.d.ts +29 -0
  75. package/lib/types/conformance/chrome.d.ts +207 -0
  76. package/lib/types/conformance/data-grid.d.ts +136 -0
  77. package/lib/types/conformance/dialog.d.ts +97 -0
  78. package/lib/types/conformance/entry-row.d.ts +187 -0
  79. package/lib/types/conformance/index.d.ts +46 -0
  80. package/lib/types/conformance/navigation-view.d.ts +235 -0
  81. package/lib/types/conformance/popover.d.ts +58 -0
  82. package/lib/types/conformance/preferences.d.ts +184 -0
  83. package/lib/types/conformance/rows.d.ts +74 -0
  84. package/lib/types/conformance/sidebar.d.ts +182 -0
  85. package/lib/types/conformance/spinner.d.ts +66 -0
  86. package/lib/types/conformance/split-button.d.ts +193 -0
  87. package/lib/types/conformance/split-view.d.ts +301 -0
  88. package/lib/types/conformance/tab-view.d.ts +449 -0
  89. package/lib/types/conformance/view-stack.d.ts +121 -0
  90. package/lib/types/conformance/view-switcher.d.ts +443 -0
  91. package/lib/types/conformance/wrap-box.d.ts +185 -0
  92. package/lib/types/data-grid.d.ts +140 -0
  93. package/lib/types/data-grid.spec.d.ts +2 -0
  94. package/lib/types/dialog.d.ts +144 -0
  95. package/lib/types/easing.d.ts +21 -0
  96. package/lib/types/entry-row.d.ts +308 -0
  97. package/lib/types/entry-row.spec.d.ts +2 -0
  98. package/lib/types/glib.d.ts +49 -0
  99. package/lib/types/index.d.ts +50 -4
  100. package/lib/types/length-unit.d.ts +24 -0
  101. package/lib/types/navigation-view.d.ts +343 -0
  102. package/lib/types/navigation-view.spec.d.ts +2 -0
  103. package/lib/types/popover.d.ts +155 -0
  104. package/lib/types/popover.spec.d.ts +2 -0
  105. package/lib/types/preferences.d.ts +349 -0
  106. package/lib/types/preferences.spec.d.ts +2 -0
  107. package/lib/types/rows.d.ts +96 -8
  108. package/lib/types/sidebar.d.ts +308 -0
  109. package/lib/types/sidebar.spec.d.ts +2 -0
  110. package/lib/types/spinner.d.ts +117 -0
  111. package/lib/types/spinner.spec.d.ts +2 -0
  112. package/lib/types/split-button.d.ts +316 -0
  113. package/lib/types/split-button.spec.d.ts +2 -0
  114. package/lib/types/split-view.d.ts +703 -0
  115. package/lib/types/split-view.spec.d.ts +2 -0
  116. package/lib/types/tab-view.d.ts +616 -0
  117. package/lib/types/tab-view.spec.d.ts +2 -0
  118. package/lib/types/view-stack.d.ts +278 -0
  119. package/lib/types/view-stack.spec.d.ts +2 -0
  120. package/lib/types/view-switcher.d.ts +524 -0
  121. package/lib/types/view-switcher.spec.d.ts +2 -0
  122. package/lib/types/wrap-box.d.ts +200 -0
  123. package/lib/types/wrap-box.spec.d.ts +2 -0
  124. package/package.json +8 -4
@@ -0,0 +1,112 @@
1
+ /** How many colours `Adw.Avatar` picks between — libadwaita's `NUMBER_OF_COLORS`. */
2
+ export declare const AVATAR_COLOR_COUNT = 14;
3
+ /** One `$avatarcolorlist` entry: light `fg` text over a `start`→`stop` gradient. */
4
+ export interface AdwAvatarColor {
5
+ /** Light tint used for the initials. */
6
+ fg: string;
7
+ /** Gradient start (top). */
8
+ start: string;
9
+ /** Gradient stop (bottom). */
10
+ stop: string;
11
+ }
12
+ /**
13
+ * The 14 libadwaita avatar colours, in `$avatarcolorlist` order — index `n` is
14
+ * the CSS class `color{n+1}`.
15
+ */
16
+ export declare const AVATAR_COLORS: ReadonlyArray<AdwAvatarColor>;
17
+ /**
18
+ * GLib's `g_str_hash` — the DJB2 variant `h = h * 33 + c`, as `guint32`.
19
+ *
20
+ * Two details decide whether the avatar colour matches GTK, and both were wrong
21
+ * in the renderer copies this replaces: `c` is a **`signed char` of the UTF-8
22
+ * encoding**, not a UTF-16 code unit, so bytes ≥ 0x80 contribute NEGATIVE values
23
+ * (`"Jörg Schröder"` picked colour 5 instead of 13); and the C loop stops at the
24
+ * first NUL byte, so an embedded `\0` truncates the input.
25
+ */
26
+ export declare function gStrHash(text: string): number;
27
+ /**
28
+ * The initials `Adw.Avatar` shows for `text`: the first character, plus the
29
+ * character following the LAST space if there is one.
30
+ *
31
+ * Mirrors `extract_initials_from_text` step for step — upcase, then strip, then
32
+ * NFC-normalise, then take code points (never UTF-16 units, so an astral first
33
+ * letter survives). Only a literal ASCII space separates the two initials, so
34
+ * `"Ada\tLovelace"` yields `"A"`, exactly as GTK does.
35
+ *
36
+ * Returns `''` for a blank name. libadwaita instead emits a one-NUL-byte label
37
+ * there, because its caller only guards the RAW text against being empty; an
38
+ * empty string is the sane rendering of the same "no initials" state.
39
+ */
40
+ export declare function avatarInitials(text: string): string;
41
+ /**
42
+ * The 1-based colour class (`color1`…`color14`) `Adw.Avatar` assigns to `text`,
43
+ * i.e. `set_class_color`'s `(g_str_hash (text) % NUMBER_OF_COLORS) + 1`.
44
+ *
45
+ * `null` for a blank name: libadwaita picks a RANDOM class there, so no value is
46
+ * derivable from the name. A renderer that wants that behaviour calls
47
+ * {@link randomAvatarColorClass}; one that paints nothing without initials — as
48
+ * both current renderers do — can ignore the `null`.
49
+ */
50
+ export declare function avatarColorClass(text: string): number | null;
51
+ /**
52
+ * A random colour class for a nameless avatar, matching libadwaita's
53
+ * `g_rand_int_range (rand, 1, NUMBER_OF_COLORS)` — which is the half-open range
54
+ * `[1, 14)`, so `color14` never comes up. Kept faithful rather than "fixed":
55
+ * a renderer that widened it would not match GTK.
56
+ */
57
+ export declare function randomAvatarColorClass(random?: () => number): number;
58
+ /**
59
+ * The palette entry `Adw.Avatar` paints for `text`. Falls back to the first
60
+ * colour for a blank name so a renderer always has something to paint; use
61
+ * {@link avatarColorClass} directly when the nameless case must stay random.
62
+ */
63
+ export declare function avatarColor(text: string): AdwAvatarColor;
64
+ /** Which of the three mutually exclusive things an avatar shows. */
65
+ export type AdwAvatarMode = 'image' | 'initials' | 'icon';
66
+ /**
67
+ * `update_visibility` (adw-avatar.c:117): a custom image wins outright,
68
+ * otherwise initials show when they were asked for and the name is non-empty,
69
+ * otherwise the fallback icon.
70
+ *
71
+ * The gate is the length of the TEXT, not of the derived initials — a
72
+ * whitespace-only name is in `'initials'` mode with a blank label, where a
73
+ * renderer keying on the initials would fall back to the icon instead.
74
+ */
75
+ export declare function avatarMode(input: {
76
+ hasCustomImage: boolean;
77
+ showInitials: boolean;
78
+ text: string;
79
+ }): AdwAvatarMode;
80
+ /**
81
+ * The largest font size that still fits the initials inside the circle
82
+ * (`update_font_size`, adw-avatar.c:221-227): the biggest square inscribed in
83
+ * the circle, `size / 1.4142`, less a size-proportional padding
84
+ * `max(size * 0.4 - 5, 0)`.
85
+ *
86
+ * Monotonically increasing in `size`. A renderer that cannot measure text can
87
+ * use this alone and stay inside libadwaita's bound — which the browser
88
+ * renderer's old `size * (size < 32 ? 0.5 : 0.4)` did not: at size 31 it asked
89
+ * for 15.5px against a 14.5px cap, then DROPPED to 12.8px at size 32.
90
+ */
91
+ export declare function avatarMaxFontSize(size: number): number;
92
+ /**
93
+ * The font size `Adw.Avatar` gives the initials label, given the label's
94
+ * measured box: `height * (max / width)`, clamped to `[0, max]`.
95
+ *
96
+ * Text measurement is the one genuinely renderer-specific input, so it is
97
+ * injected — the same seam style as `ToastScheduler`. Only the ASPECT RATIO of
98
+ * the measurement matters (the formula scales it against the cap), so a renderer
99
+ * may measure at any font size it likes, exactly as Pango's reset-then-measure
100
+ * does. A non-positive width means "not laid out yet"; the cap is then the only
101
+ * defensible answer.
102
+ */
103
+ export declare function avatarFontSize(size: number, measured: {
104
+ width: number;
105
+ height: number;
106
+ }): number;
107
+ /**
108
+ * The flat 50/50 blend of a palette entry's gradient, for renderers whose style
109
+ * layer has no gradients (the NativeScript CSS subset is the one that forced
110
+ * this). Returns a `#rrggbb` string.
111
+ */
112
+ export declare function flattenAvatarGradient(color: AdwAvatarColor): string;
@@ -0,0 +1,2 @@
1
+ declare const _default: () => Promise<void>;
2
+ export default _default;
@@ -0,0 +1,104 @@
1
+ /**
2
+ * `AdwBannerButtonStyle` as a string union — the two enum nicks
3
+ * (adw-banner.c:23-35, Since 1.7).
4
+ */
5
+ export type AdwBannerButtonStyle = 'default' | 'suggested';
6
+ /** Both `AdwBannerButtonStyle` members, in enum order. */
7
+ export declare const ADW_BANNER_BUTTON_STYLES: readonly AdwBannerButtonStyle[];
8
+ /**
9
+ * Every style class `button-style` MANAGES on the banner button.
10
+ *
11
+ * A renderer swaps within this set and leaves every other class alone — the C
12
+ * only ever adds or removes `suggested-action` (:766, :769), it never rewrites
13
+ * the button's class list.
14
+ */
15
+ export declare const ADW_BANNER_BUTTON_STYLE_CLASSES: readonly string[];
16
+ /** The five `Adw.Banner` properties, as a renderer holds them. */
17
+ export interface AdwBannerProps {
18
+ /** `title` — the message. Pango markup when {@link useMarkup}. */
19
+ title: string;
20
+ /** `button-label` — empty means no button. */
21
+ buttonLabel: string;
22
+ /** `revealed` — whether the strip is on screen. */
23
+ revealed: boolean;
24
+ /** `use-markup` — whether {@link title} is Pango markup. */
25
+ useMarkup: boolean;
26
+ /** `button-style` — grey (`'default'`) or `.suggested-action`. */
27
+ buttonStyle: AdwBannerButtonStyle;
28
+ }
29
+ /**
30
+ * The property defaults a freshly constructed `Adw.Banner` has, straight from
31
+ * the `GParamSpec`s.
32
+ *
33
+ * Two of these are the whole reason this module exists, and both are easy to get
34
+ * backwards from the rendered widget rather than from the source: `revealed` is
35
+ * FALSE (:456-459) and `use-markup` is TRUE (:422-425).
36
+ */
37
+ export declare const ADW_BANNER_DEFAULTS: Readonly<AdwBannerProps>;
38
+ /** Whether `value` is one of the two `AdwBannerButtonStyle` nicks. */
39
+ export declare function isBannerButtonStyle(value: unknown): value is AdwBannerButtonStyle;
40
+ /**
41
+ * The button style for a renderer-supplied string — an HTML attribute, an XML
42
+ * property, a JSON config.
43
+ *
44
+ * Anything that is not a nick becomes `'default'`. That is NOT the C setter's
45
+ * behaviour and cannot be: `adw_banner_set_button_style` guards the ENUM range
46
+ * (:756-757) and returns without changing anything, because by the time it runs
47
+ * the value is already an `AdwBannerButtonStyle`. A string never becomes one, so
48
+ * there is nothing to keep — falling back to the property default is what
49
+ * GObject itself does when an invalid nick reaches `g_object_set`.
50
+ */
51
+ export declare function parseBannerButtonStyle(value: string | null | undefined): AdwBannerButtonStyle;
52
+ /**
53
+ * The style classes the banner button carries for `style` —
54
+ * `adw_banner_set_button_style`'s switch (:764-774).
55
+ */
56
+ export declare function bannerButtonStyleClasses(style: AdwBannerButtonStyle): readonly string[];
57
+ /**
58
+ * Whether the action button is shown: `gtk_widget_set_visible (button, label &&
59
+ * label[0])` (:663).
60
+ *
61
+ * The test is on the FIRST CHARACTER, so it is not a trim and not a truthiness
62
+ * check on the trimmed value — `" "` is a one-character label and its button is
63
+ * shown, blank-looking though it is. A renderer that trimmed here would silently
64
+ * drop a button GTK draws.
65
+ */
66
+ export declare function bannerButtonVisible(label: string | null | undefined): boolean;
67
+ /**
68
+ * The text painted on the action button.
69
+ *
70
+ * The template pins the button to `use-underline=True` (adw-banner.ui:33) and
71
+ * exposes no property to turn it off, so an `_` in `button-label` is ALWAYS an
72
+ * accelerator marker — `"_Resume"` reads `Resume` with an underlined R. A
73
+ * renderer with no accelerator layer wants the marker gone, which is what
74
+ * {@link stripMnemonic} returns.
75
+ *
76
+ * The TITLE deliberately has no counterpart here: the same template pins the
77
+ * title label to `use-underline=False` (adw-banner.ui:20), so a title keeps
78
+ * every underscore it was given. Passing a title through this function would be
79
+ * a bug, not a symmetry.
80
+ */
81
+ export declare function bannerButtonText(label: string): string;
82
+ /** What one banner derivation tells a renderer to draw. */
83
+ export interface AdwBannerRenderState {
84
+ /** Whether the strip is on screen (`GtkRevealer:reveal-child`, :817). */
85
+ revealed: boolean;
86
+ /** Whether {@link AdwBannerProps.title} is to be read as Pango markup. */
87
+ useMarkup: boolean;
88
+ /** Whether the action button is in the tree (:663). */
89
+ buttonVisible: boolean;
90
+ /** The button's label with mnemonic markers removed. */
91
+ buttonText: string;
92
+ /** The style classes `button-style` puts on the button (:764-774). */
93
+ buttonClasses: readonly string[];
94
+ }
95
+ /**
96
+ * The full render state for a banner, filling every unset property from
97
+ * {@link ADW_BANNER_DEFAULTS}.
98
+ *
99
+ * Takes a `Partial` on purpose: a renderer reading attributes has "not set" as a
100
+ * real state, and the whole point of this module is that "not set" resolves to
101
+ * the libadwaita default rather than to whatever the renderer's field
102
+ * initialiser happened to be.
103
+ */
104
+ export declare function bannerRenderState(props?: Partial<AdwBannerProps>): AdwBannerRenderState;
@@ -0,0 +1,2 @@
1
+ declare const _default: () => Promise<void>;
2
+ export default _default;
@@ -0,0 +1,141 @@
1
+ /**
2
+ * The style class `AdwButtonContent` stamps on its parent button (:115) and
3
+ * removes again on unroot (:126).
4
+ */
5
+ export declare const BUTTON_CONTENT_STYLE_CLASS = "image-text-button";
6
+ /** The icon `GtkImage` falls back to for an empty `icon-name` (:355-356). */
7
+ export declare const BUTTON_CONTENT_FALLBACK_ICON = "image-missing";
8
+ /** How `can-shrink` reaches the label — `PangoEllipsizeMode` as a string union. */
9
+ export type ButtonContentEllipsize = 'none' | 'end';
10
+ /** The four `AdwButtonContent` properties, as a renderer holds them. */
11
+ export interface AdwButtonContentProps {
12
+ /** `icon-name` — an icon-theme name. Empty means {@link BUTTON_CONTENT_FALLBACK_ICON}. */
13
+ iconName: string;
14
+ /** `label` — empty hides the label node. */
15
+ label: string;
16
+ /** `use-underline` — whether `_` marks a mnemonic in {@link label}. */
17
+ useUnderline: boolean;
18
+ /** `can-shrink` — whether the label ellipsizes rather than widening the button. */
19
+ canShrink: boolean;
20
+ }
21
+ /**
22
+ * The property defaults a freshly constructed `AdwButtonContent` has, straight
23
+ * from the `GParamSpec`s. All four are the empty/false end of their type.
24
+ */
25
+ export declare const ADW_BUTTON_CONTENT_DEFAULTS: Readonly<AdwButtonContentProps>;
26
+ /**
27
+ * Whether the icon slot is empty — the `!icon_name[0]` test at :355.
28
+ *
29
+ * The one icon question that does not depend on how a renderer represents the
30
+ * icon: a name is empty or it is not, an SVG string is empty or it is not. Kept
31
+ * separate from {@link buttonContentIconName} so the NativeScript port, which
32
+ * holds SVG source rather than theme names, has something in core to ask.
33
+ */
34
+ export declare function buttonContentIconIsEmpty(icon: string): boolean;
35
+ /**
36
+ * The icon-theme name the image is actually set from: `icon_name`, or
37
+ * `image-missing` when it is empty (:355-358).
38
+ *
39
+ * UPSTREAM CONTRADICTION — the code and the docs disagree, and this follows the
40
+ * CODE. Both doc comments say the icon "is not shown" when `icon-name` is empty
41
+ * (:228 on the property, :343 on the setter), but nothing in the widget ever
42
+ * hides `self->icon`: `gtk_widget_set_visible` is called on the LABEL (:300,
43
+ * :398) and never on the image, `init` sets the image to `image-missing` while
44
+ * `icon_name` is still `""` (:284, :294), and the setter re-applies that
45
+ * fallback for every empty value (:355-356). A default-constructed
46
+ * `AdwButtonContent` therefore draws the broken-image glyph. Both ports followed
47
+ * the prose and hid the icon; a vector written from the prose would have pinned
48
+ * that guess and shipped it under the word "conformance", which is the one thing
49
+ * these tables must not do.
50
+ */
51
+ export declare function buttonContentIconName(iconName: string): string;
52
+ /**
53
+ * Whether the label node is in the tree: `gtk_widget_set_visible (self->label,
54
+ * label[0])` (:398).
55
+ *
56
+ * First character, not truthiness and not a trim — `" "` is a label and its node
57
+ * is shown, exactly as with the banner button.
58
+ */
59
+ export declare function buttonContentLabelVisible(label: string): boolean;
60
+ /**
61
+ * Whether the icon takes the box's free space: `gtk_widget_set_hexpand
62
+ * (self->icon, !label[0])` (:399), matching the `TRUE` init sets while the label
63
+ * is still empty (:296).
64
+ *
65
+ * The complement of {@link buttonContentLabelVisible} by construction, and named
66
+ * for what it DOES rather than derived at each call site: with no label the icon
67
+ * expands and so centres itself inside the button; with a label the pair sits
68
+ * together under the box's `halign: CENTER` (:289).
69
+ */
70
+ export declare function buttonContentIconExpands(label: string): boolean;
71
+ /**
72
+ * The text painted on the label, with mnemonic markers removed when
73
+ * `use-underline` is set (:442).
74
+ *
75
+ * Default FALSE (:253-256), so an underscore survives unless the app asked for
76
+ * mnemonics — the opposite default to the banner's action button, which its
77
+ * template pins to TRUE.
78
+ */
79
+ export declare function buttonContentLabelText(label: string, useUnderline: boolean): string;
80
+ /**
81
+ * The label's `PangoEllipsizeMode` for `can-shrink` — `END` or `NONE`
82
+ * (:489-491), which is also how the getter reads the property back (:462).
83
+ */
84
+ export declare function buttonContentEllipsize(canShrink: boolean): ButtonContentEllipsize;
85
+ /**
86
+ * One entry of the ancestor chain `adw_button_content_root` walks, nearest
87
+ * first, tagged by the only distinction the C makes.
88
+ *
89
+ * `'button'` is a `GtkButton` (or any subclass); `'menu-button'` and
90
+ * `'split-button'` are `GtkMenuButton` and `AdwSplitButton`, neither of which
91
+ * derives from `GtkButton` — `AdwSplitButton` is a `GtkWidget`
92
+ * (adw-split-button.c:112), which is exactly why it cannot be found by
93
+ * `gtk_widget_get_ancestor (…, GTK_TYPE_BUTTON)` and needs the retarget.
94
+ * `'other'` is any other container.
95
+ */
96
+ export type ButtonContentAncestor = 'button' | 'menu-button' | 'split-button' | 'other';
97
+ /**
98
+ * Which ancestor receives {@link BUTTON_CONTENT_STYLE_CLASS}, as an INDEX into
99
+ * `ancestors` (nearest first), or `null` when there is no button ancestor.
100
+ *
101
+ * `adw_button_content_root` (:108-116) takes the nearest `GtkButton`, then makes
102
+ * ONE substitution: if that button's DIRECT parent is an `AdwSplitButton`, the
103
+ * class goes on the split button instead (:112-113), because the split button is
104
+ * the node the stylesheet styles (`splitbutton.image-text-button > button`,
105
+ * _buttons.scss:499-507). Inside a `GtkMenuButton` no substitution happens, so
106
+ * the menu button's INTERNAL button keeps the class — which is what the class
107
+ * docs describe (:56-59).
108
+ *
109
+ * `null` is this port's answer to a case the C does not survive: with no button
110
+ * ancestor at all `gtk_widget_get_ancestor` returns `NULL`, and the very next
111
+ * lines call `gtk_widget_get_parent (NULL)` and `gtk_widget_add_css_class (NULL,
112
+ * …)` (:112-115), which are two `CRITICAL`s. A renderer has nothing to style,
113
+ * and saying so is better than reproducing a crash.
114
+ */
115
+ export declare function buttonContentStyleTargetIndex(ancestors: readonly ButtonContentAncestor[]): number | null;
116
+ /** What one button-content derivation tells a renderer to draw. */
117
+ export interface AdwButtonContentRenderState {
118
+ /** The icon-theme name the image node shows (:355-358). */
119
+ iconName: string;
120
+ /** Whether {@link iconName} is the empty-slot fallback rather than an app value. */
121
+ iconIsFallback: boolean;
122
+ /** Whether the icon takes the box's free space (:399). */
123
+ iconExpands: boolean;
124
+ /** Whether the label node is in the tree (:398). */
125
+ labelVisible: boolean;
126
+ /** The label text, mnemonic markers resolved (:442). */
127
+ labelText: string;
128
+ /** The label's ellipsize mode (:489-491). */
129
+ ellipsize: ButtonContentEllipsize;
130
+ /** The style class the parent button carries while this content is rooted (:115). */
131
+ parentClass: string;
132
+ }
133
+ /**
134
+ * The full render state for a button content, filling every unset property from
135
+ * {@link ADW_BUTTON_CONTENT_DEFAULTS}.
136
+ *
137
+ * `parentClass` is constant, and is in the state anyway so a renderer takes the
138
+ * class from the same call that gives it the rest — the whole defect this module
139
+ * fixes was a renderer never being handed that string at all.
140
+ */
141
+ export declare function buttonContentRenderState(props?: Partial<AdwButtonContentProps>): AdwButtonContentRenderState;
@@ -0,0 +1,2 @@
1
+ declare const _default: () => Promise<void>;
2
+ export default _default;