@gjsify/adwaita-nativescript 0.48.0 → 0.50.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 (147) hide show
  1. package/lib/esm/index.js +1 -1
  2. package/lib/esm/namespace/gtk.js +1 -1
  3. package/lib/esm/widgets/adw-about-dialog.js +1 -1
  4. package/lib/esm/widgets/adw-action-row.js +1 -1
  5. package/lib/esm/widgets/adw-alert-dialog.js +1 -1
  6. package/lib/esm/widgets/adw-avatar.js +1 -1
  7. package/lib/esm/widgets/adw-banner.js +1 -1
  8. package/lib/esm/widgets/adw-bottom-sheet.js +1 -1
  9. package/lib/esm/widgets/adw-button-content.js +1 -1
  10. package/lib/esm/widgets/adw-button-row.js +1 -1
  11. package/lib/esm/widgets/adw-carousel.js +1 -1
  12. package/lib/esm/widgets/adw-clamp.js +1 -1
  13. package/lib/esm/widgets/adw-combo-row.js +1 -1
  14. package/lib/esm/widgets/adw-data-grid.js +1 -1
  15. package/lib/esm/widgets/adw-entry-row.js +1 -1
  16. package/lib/esm/widgets/adw-expander-row.js +1 -1
  17. package/lib/esm/widgets/adw-header-bar.js +1 -1
  18. package/lib/esm/widgets/adw-image-button.js +1 -1
  19. package/lib/esm/widgets/adw-inline-view-switcher.js +1 -1
  20. package/lib/esm/widgets/adw-navigation-split-view.js +1 -1
  21. package/lib/esm/widgets/adw-navigation-view.js +1 -1
  22. package/lib/esm/widgets/adw-overlay-split-view.js +1 -1
  23. package/lib/esm/widgets/adw-password-entry-row.js +1 -1
  24. package/lib/esm/widgets/adw-preferences-dialog.js +1 -1
  25. package/lib/esm/widgets/adw-preferences-group.js +1 -1
  26. package/lib/esm/widgets/adw-preferences-page.js +1 -1
  27. package/lib/esm/widgets/adw-shortcut-label.js +1 -1
  28. package/lib/esm/widgets/adw-sidebar.js +1 -1
  29. package/lib/esm/widgets/adw-slider-row.js +1 -1
  30. package/lib/esm/widgets/adw-spin-row.js +1 -1
  31. package/lib/esm/widgets/adw-spinner.js +1 -1
  32. package/lib/esm/widgets/adw-split-button.js +1 -1
  33. package/lib/esm/widgets/adw-status-page.js +1 -1
  34. package/lib/esm/widgets/adw-switch-row.js +1 -1
  35. package/lib/esm/widgets/adw-tab-view.js +1 -1
  36. package/lib/esm/widgets/adw-toast-overlay.js +1 -1
  37. package/lib/esm/widgets/adw-toggle-group.js +1 -1
  38. package/lib/esm/widgets/adw-toolbar-view.js +1 -1
  39. package/lib/esm/widgets/adw-view-stack.js +1 -1
  40. package/lib/esm/widgets/adw-view-switcher-bar.js +1 -1
  41. package/lib/esm/widgets/adw-view-switcher.js +1 -1
  42. package/lib/esm/widgets/adw-window-title.js +1 -1
  43. package/lib/esm/widgets/adw-wrap-box.js +1 -1
  44. package/lib/esm/widgets/avatar-view.js +1 -0
  45. package/lib/esm/widgets/box-layout.js +1 -0
  46. package/lib/esm/widgets/button-content.js +1 -1
  47. package/lib/esm/widgets/button-slot.js +1 -0
  48. package/lib/esm/widgets/construct-props.js +1 -0
  49. package/lib/esm/widgets/entry-row-view.js +1 -1
  50. package/lib/esm/widgets/gtk-align.js +1 -0
  51. package/lib/esm/widgets/gtk-box.js +1 -0
  52. package/lib/esm/widgets/gtk-button.js +1 -1
  53. package/lib/esm/widgets/gtk-drop-down.js +1 -1
  54. package/lib/esm/widgets/gtk-entry.js +1 -1
  55. package/lib/esm/widgets/gtk-icon-size.js +1 -0
  56. package/lib/esm/widgets/gtk-image.js +1 -1
  57. package/lib/esm/widgets/gtk-label.js +1 -0
  58. package/lib/esm/widgets/gtk-menu-button.js +1 -1
  59. package/lib/esm/widgets/icon-theme.js +1 -0
  60. package/lib/esm/widgets/index.js +1 -1
  61. package/lib/esm/widgets/label-text.js +1 -0
  62. package/lib/esm/widgets/signals.js +1 -0
  63. package/lib/esm/widgets/split-view-base.js +1 -1
  64. package/lib/esm/widgets/style-classes.js +1 -0
  65. package/lib/esm/widgets/view-switcher-base.js +1 -1
  66. package/lib/esm/widgets/view-switcher-model.js +1 -1
  67. package/lib/types/avatar.spec.d.ts +2 -0
  68. package/lib/types/box-layout.spec.d.ts +2 -0
  69. package/lib/types/button-slot.spec.d.ts +2 -0
  70. package/lib/types/construct-props.spec.d.ts +2 -0
  71. package/lib/types/icon-size.spec.d.ts +2 -0
  72. package/lib/types/icon-theme.spec.d.ts +2 -0
  73. package/lib/types/index.d.ts +2 -2
  74. package/lib/types/label-text.spec.d.ts +2 -0
  75. package/lib/types/namespace/gtk.d.ts +2 -0
  76. package/lib/types/signals.spec.d.ts +2 -0
  77. package/lib/types/style-classes.spec.d.ts +2 -0
  78. package/lib/types/widgets/adw-about-dialog.d.ts +16 -3
  79. package/lib/types/widgets/adw-action-row.d.ts +38 -10
  80. package/lib/types/widgets/adw-alert-dialog.d.ts +30 -13
  81. package/lib/types/widgets/adw-avatar.d.ts +49 -3
  82. package/lib/types/widgets/adw-banner.d.ts +16 -3
  83. package/lib/types/widgets/adw-bottom-sheet.d.ts +32 -16
  84. package/lib/types/widgets/adw-button-content.d.ts +18 -4
  85. package/lib/types/widgets/adw-button-row.d.ts +6 -3
  86. package/lib/types/widgets/adw-carousel.d.ts +19 -7
  87. package/lib/types/widgets/adw-clamp.d.ts +17 -5
  88. package/lib/types/widgets/adw-combo-row.d.ts +2 -1
  89. package/lib/types/widgets/adw-data-grid.d.ts +17 -4
  90. package/lib/types/widgets/adw-entry-row.d.ts +13 -11
  91. package/lib/types/widgets/adw-expander-row.d.ts +19 -8
  92. package/lib/types/widgets/adw-header-bar.d.ts +39 -14
  93. package/lib/types/widgets/adw-image-button.d.ts +52 -10
  94. package/lib/types/widgets/adw-inline-view-switcher.d.ts +2 -1
  95. package/lib/types/widgets/adw-navigation-split-view.d.ts +2 -1
  96. package/lib/types/widgets/adw-navigation-view.d.ts +40 -21
  97. package/lib/types/widgets/adw-overlay-split-view.d.ts +3 -2
  98. package/lib/types/widgets/adw-password-entry-row.d.ts +2 -1
  99. package/lib/types/widgets/adw-preferences-dialog.d.ts +16 -3
  100. package/lib/types/widgets/adw-preferences-group.d.ts +19 -6
  101. package/lib/types/widgets/adw-preferences-page.d.ts +37 -8
  102. package/lib/types/widgets/adw-shortcut-label.d.ts +15 -2
  103. package/lib/types/widgets/adw-sidebar.d.ts +15 -2
  104. package/lib/types/widgets/adw-slider-row.d.ts +15 -2
  105. package/lib/types/widgets/adw-spin-row.d.ts +2 -1
  106. package/lib/types/widgets/adw-spinner.d.ts +14 -2
  107. package/lib/types/widgets/adw-split-button.d.ts +15 -2
  108. package/lib/types/widgets/adw-status-page.d.ts +20 -6
  109. package/lib/types/widgets/adw-switch-row.d.ts +2 -1
  110. package/lib/types/widgets/adw-tab-view.d.ts +34 -8
  111. package/lib/types/widgets/adw-toast-overlay.d.ts +19 -7
  112. package/lib/types/widgets/adw-toggle-group.d.ts +14 -2
  113. package/lib/types/widgets/adw-toolbar-view.d.ts +21 -8
  114. package/lib/types/widgets/adw-view-stack.d.ts +38 -5
  115. package/lib/types/widgets/adw-view-switcher-bar.d.ts +16 -3
  116. package/lib/types/widgets/adw-view-switcher.d.ts +2 -1
  117. package/lib/types/widgets/adw-window-title.d.ts +16 -3
  118. package/lib/types/widgets/adw-wrap-box.d.ts +21 -8
  119. package/lib/types/widgets/avatar-view.d.ts +57 -0
  120. package/lib/types/widgets/bottom-sheet-state.d.ts +1 -1
  121. package/lib/types/widgets/box-layout.d.ts +39 -0
  122. package/lib/types/widgets/button-content.d.ts +4 -4
  123. package/lib/types/widgets/button-slot.d.ts +16 -0
  124. package/lib/types/widgets/construct-props.d.ts +102 -0
  125. package/lib/types/widgets/entry-row-view.d.ts +8 -7
  126. package/lib/types/widgets/gtk-align.d.ts +59 -0
  127. package/lib/types/widgets/gtk-box.d.ts +75 -0
  128. package/lib/types/widgets/gtk-button.d.ts +110 -28
  129. package/lib/types/widgets/gtk-drop-down.d.ts +15 -2
  130. package/lib/types/widgets/gtk-entry.d.ts +15 -2
  131. package/lib/types/widgets/gtk-icon-size.d.ts +96 -0
  132. package/lib/types/widgets/gtk-image.d.ts +61 -10
  133. package/lib/types/widgets/gtk-label.d.ts +82 -0
  134. package/lib/types/widgets/gtk-menu-button.d.ts +2 -1
  135. package/lib/types/widgets/icon-theme.d.ts +77 -0
  136. package/lib/types/widgets/icons.d.ts +3 -1
  137. package/lib/types/widgets/index.d.ts +15 -3
  138. package/lib/types/widgets/label-text.d.ts +13 -0
  139. package/lib/types/widgets/row-state.d.ts +1 -1
  140. package/lib/types/widgets/signals.d.ts +40 -0
  141. package/lib/types/widgets/split-view-base.d.ts +18 -6
  142. package/lib/types/widgets/status-page-content.d.ts +1 -1
  143. package/lib/types/widgets/style-classes.d.ts +61 -0
  144. package/lib/types/widgets/view-switcher-base.d.ts +12 -1
  145. package/lib/types/widgets/view-switcher-model.d.ts +2 -11
  146. package/package.json +7 -7
  147. package/src/theme/adwaita.css +58 -0
@@ -1,8 +1,20 @@
1
1
  import { FlexboxLayout, type View } from '@nativescript/core';
2
2
  import { type AdwLengthUnit, type AdwWrapBoxJustify, type AdwWrapBoxOrientation, type AdwWrapBoxPackDirection, type AdwWrapPolicy } from '@gjsify/adwaita-core';
3
+ import { type ConstructProps } from './construct-props.js';
3
4
  /** Every `notify::` an `Adw.WrapBox` emits (adw-wrap-box.c:284-497). */
4
5
  export type AdwWrapBoxProperty = 'child-spacing' | 'child-spacing-unit' | 'pack-direction' | 'align' | 'justify' | 'justify-last-line' | 'line-spacing' | 'line-spacing-unit' | 'line-homogeneous' | 'natural-line-length' | 'natural-line-length-unit' | 'wrap-reverse' | 'wrap-policy' | 'orientation';
5
- export declare class AdwWrapBox extends FlexboxLayout {
6
+ declare const AdwWrapBox_base: (abstract new (...args: any[]) => {
7
+ connect(eventName: string, callback: (self: /*elided*/ any, data: import("@nativescript/core").EventData) => void): number;
8
+ disconnect(handlerId: number): void;
9
+ _emit(eventName: string): void;
10
+ addEventListener(eventName: string, callback: (data: import("@nativescript/core").EventData) => void, thisArg?: unknown, once?: boolean): void;
11
+ removeEventListener(eventName: string, callback?: (data: import("@nativescript/core").EventData) => void, thisArg?: unknown): void;
12
+ notify<T extends import("@nativescript/core").EventData>(data: T): void;
13
+ notifyPropertyChange(name: string, value: unknown, oldValue?: unknown): void;
14
+ set(name: string, value: unknown): void;
15
+ get(name: string): unknown;
16
+ }) & typeof FlexboxLayout;
17
+ export declare class AdwWrapBox extends AdwWrapBox_base {
6
18
  private _childSpacing;
7
19
  private _lineSpacing;
8
20
  private _childSpacingUnit;
@@ -17,17 +29,17 @@ export declare class AdwWrapBox extends FlexboxLayout {
17
29
  private _orientation;
18
30
  private _naturalLineLength;
19
31
  private _naturalLineLengthUnit;
20
- constructor();
32
+ constructor(props?: ConstructProps<AdwWrapBox>);
21
33
  /** Append a child — `adw_wrap_box_append` (adw-wrap-box.c:1344-1352). */
22
- add(view: View): void;
34
+ append(view: View): void;
23
35
  /** Remove a previously-added child — `adw_wrap_box_remove` (:1387-1395). */
24
36
  remove(view: View): void;
25
37
  /** `adw_wrap_box_remove_all` (:1406-1414). */
26
- removeAll(): void;
38
+ remove_all(): void;
27
39
  /**
28
- * Every path a child can enter by — `add()`, a direct `addChild()`, and XML
40
+ * Every path a child can enter by — `append()`, a direct `addChild()`, and XML
29
41
  * inflation via `_addChildFromBuilder` — ends here, which is why the spacing
30
- * is applied here and not in `add()`. It used to be applied in `add()` only,
42
+ * is applied here and not in `append()`. It used to be applied in `append()` only,
31
43
  * so a child declared in markup got no spacing at all; C routes GtkBuildable's
32
44
  * `add_child` through the same append for the same reason.
33
45
  */
@@ -40,9 +52,9 @@ export declare class AdwWrapBox extends FlexboxLayout {
40
52
  * `WRAP_BOX_CHILD_ORDER_VECTORS`. Returns whether the insert happened; a
41
53
  * refusal is where C would have hit a `g_return_if_fail`.
42
54
  */
43
- insertChildAfter(view: View, sibling?: View | null): boolean;
55
+ insert_child_after(view: View, sibling?: View | null): boolean;
44
56
  /** `adw_wrap_box_reorder_child_after` (:1315-1332). Same NULL rule. */
45
- reorderChildAfter(view: View, sibling?: View | null): boolean;
57
+ reorder_child_after(view: View, sibling?: View | null): boolean;
46
58
  private _childViews;
47
59
  private _applyOrder;
48
60
  /** Gap between items in a line, in {@link childSpacingUnit}. Defaults to 0, as in C. */
@@ -101,3 +113,4 @@ export declare class AdwWrapBox extends FlexboxLayout {
101
113
  private _applyLayout;
102
114
  private _applyChildren;
103
115
  }
116
+ export {};
@@ -0,0 +1,57 @@
1
+ import { type AdwAvatarMode } from '@gjsify/adwaita-core';
2
+ import { type NsVisibility } from './row-state.js';
3
+ export type { AdwAvatarMode };
4
+ /** The fallback icon NAME, exported because it is a SUBSTITUTION a caller can see. */
5
+ export declare const AVATAR_DEFAULT_ICON = "avatar-default-symbolic";
6
+ /**
7
+ * `update_icon`: the caller's icon, or the default when none was set.
8
+ *
9
+ * The emptiness test is the port's, not the C's — C keys on `icon_name != NULL`, and a
10
+ * NativeScript setter has no null to tell from `''`. Same reading `AdwStatusPage` takes.
11
+ */
12
+ export declare function avatarIcon(iconName: string | null | undefined): string;
13
+ /** Which of the avatar's two NativeScript children is in the layout. */
14
+ export interface AvatarVisibilities {
15
+ /** The initials label. */
16
+ label: NsVisibility;
17
+ /** The fallback symbolic icon. */
18
+ icon: NsVisibility;
19
+ }
20
+ /**
21
+ * The two `visibility` values for a mode, straight off `update_visibility`'s three
22
+ * `gtk_widget_set_visible` calls (refs/libadwaita/src/adw-avatar.c:122-123#has_custom_image).
23
+ *
24
+ * `'image'` is REACHABLE and shows NEITHER child, rather than being folded into `'icon'`:
25
+ * a function that cannot express the third mode is how the web element shipped a
26
+ * `hasCustomImage: false` no vector could falsify.
27
+ */
28
+ export declare function avatarVisibilities(mode: AdwAvatarMode): AvatarVisibilities;
29
+ /** What `AdwAvatar` sets on its two children for a given property state. */
30
+ export interface AvatarViewState extends AvatarVisibilities {
31
+ /** The mode `update_visibility` picked. */
32
+ mode: AdwAvatarMode;
33
+ /**
34
+ * The icon the icon child renders — the default when the caller set none.
35
+ *
36
+ * NOT `icon`: {@link AvatarVisibilities} already owns that key for the child's
37
+ * `visibility`, and one interface cannot hold both.
38
+ */
39
+ iconName: string;
40
+ }
41
+ /**
42
+ * The WHOLE decision `AdwAvatar` makes, so that a spec can drive it.
43
+ *
44
+ * It lives here for a reason a mutation showed: `extends GridLayout` puts the class out of
45
+ * reach of every unit test in this package, so anything decided inside it is
46
+ * unfalsifiable — the fallback was reverted to "always initials" in the widget body and
47
+ * the whole suite, plus every gate that reads this tree, stayed green. What is left
48
+ * unreachable is three assignments; no test here closes that.
49
+ *
50
+ * `hasCustomImage` is hard `false` because the port has no `custom-image` counterpart
51
+ * (status/open-todos.md); when it lands, only this argument changes.
52
+ */
53
+ export declare function avatarViewState(input: {
54
+ showInitials: boolean;
55
+ text: string;
56
+ iconName: string;
57
+ }): AvatarViewState;
@@ -63,7 +63,7 @@ export declare function requestBottomSheetClose(state: BottomSheetPresentation,
63
63
  * libadwaita never writes to the child's own style classes — the marker lives on
64
64
  * the internal bin (`adw_bottom_sheet_set_content`, adw-bottom-sheet.c:1497-1510).
65
65
  * This port does write it, and used to do so with a bare string concat, so
66
- * `setContent(v)` twice left `'adw-bottom-sheet-content adw-bottom-sheet-content'`.
66
+ * `set_content(v)` twice left `'adw-bottom-sheet-content adw-bottom-sheet-content'`.
67
67
  */
68
68
  export declare function addMarkerClass(className: string | null | undefined, marker: string): string;
69
69
  /**
@@ -0,0 +1,39 @@
1
+ import { resolveWrapBoxChildOrder } from '@gjsify/adwaita-core';
2
+ /**
3
+ * `Gtk.Box:spacing`'s default, in DIPs. `0` in C (`gtkbox.c`, the property's default
4
+ * value), which is also what makes the margin write invisible until a caller asks.
5
+ */
6
+ export declare const DEFAULT_BOX_SPACING = 0;
7
+ /** Which axis a box stacks along — NativeScript's two words, and `Gtk.Orientation`'s nicks. */
8
+ export type BoxOrientation = 'horizontal' | 'vertical';
9
+ /**
10
+ * A spacing value as the box will hold it: a finite, non-negative number of DIPs.
11
+ *
12
+ * `gtk_box_set_spacing` takes an `int` and the property's minimum is 0, so a negative
13
+ * value is clamped rather than refused — the same clamp `normalizeWrapBoxSpacing` applies
14
+ * one widget over, restated here because that one carries the wrap box's UNIT machinery
15
+ * (`Adw.LengthUnit`) and a `Gtk.Box` has no unit to convert from.
16
+ */
17
+ export declare function normalizeBoxSpacing(value: unknown): number;
18
+ /** Whether writing `next` over `current` is a change the box must push to its children. */
19
+ export declare function boxSpacingChanges(current: number, next: unknown): boolean;
20
+ /**
21
+ * The margin shorthand that gives child `index` its share of the box's gap.
22
+ *
23
+ * `top right bottom left`, NativeScript's own order. The first child gets none: with N
24
+ * children there are N−1 gaps, and putting the gap on the LEADING edge of every child but
25
+ * the first is the only distribution that leaves the box's own bounds untouched.
26
+ */
27
+ export declare function boxChildMargin(index: number, spacing: unknown, orientation: BoxOrientation): string;
28
+ /**
29
+ * Where the child list ends up after an `insert_child_after` / `reorder_child_after`, or
30
+ * `null` where C would have hit a `g_return_if_fail`.
31
+ *
32
+ * SHARED WITH THE WRAP BOX RATHER THAN COPIED, and the name is the wrap box's only
33
+ * because that widget needed it first: the rule is `gtk_widget_insert_after`'s — a NULL
34
+ * sibling means the FIRST position, not the last — and `gtk_box_insert_child_after`
35
+ * documents itself by pointing at it. `resolveWrapBoxChildOrder` is generic over the
36
+ * child type and pure, so the alternative was a second copy of one paragraph of GTK
37
+ * semantics that could drift from the vectors already pinning it.
38
+ */
39
+ export { resolveWrapBoxChildOrder as resolveBoxChildOrder };
@@ -5,17 +5,17 @@ export type { ButtonContentEllipsize };
5
5
  /** The class the content carries while `can-shrink` is set, for the theme to key off. */
6
6
  export declare const BUTTON_CONTENT_CAN_SHRINK_CLASS = "can-shrink";
7
7
  /**
8
- * The SVG the icon view is given: the app's, or the `image-missing` asset for an
9
- * empty slot — the fallback `init` applies too, while `icon_name` is still `""`.
8
+ * The icon the icon view is given: the app's, or the `image-missing` NAME for an empty
9
+ * slot — the fallback `init` applies too, while `icon_name` is still `""`.
10
10
  *
11
11
  * The C NEVER hides the image, only the label, so this port keeps the icon view
12
12
  * parented at all times and swaps its source. Upstream's own doc comments claim the
13
13
  * icon is hidden instead; the code disagrees with them and this follows the code
14
14
  * (see the conformance vector's `rule`).
15
15
  */
16
- export declare function buttonContentIconSvg(svg: string): string;
16
+ export declare function buttonContentIcon(icon: string): string;
17
17
  /** Whether the icon shown is the empty-slot fallback rather than an app asset. */
18
- export declare function buttonContentIconIsFallback(svg: string): boolean;
18
+ export declare function buttonContentIconIsFallback(icon: string): boolean;
19
19
  /**
20
20
  * The parent button's `className` with `image-text-button` added — the root-time half
21
21
  * of `adw_button_content_root`. Adds rather than rewrites, so a caller's composed
@@ -0,0 +1,16 @@
1
+ /** The slot a `Gtk.Button` currently shows. `empty` is a button with no child at all. */
2
+ export type ButtonSlot = 'label' | 'icon' | 'child' | 'empty';
3
+ /** Which property was written. */
4
+ export type ButtonSlotWrite = 'label' | 'icon' | 'child';
5
+ /**
6
+ * The slot a button shows after `wrote` was assigned `value`.
7
+ *
8
+ * AN EMPTY LABEL IS STILL THE LABEL SLOT, and an empty icon name is still the icon slot:
9
+ * `gtk_button_set_label("")` leaves a `GtkLabel` in the child, showing nothing — the
10
+ * button is not childless, it has an empty label. Only `set_child(NULL)` empties it, which
11
+ * is the one write that can return `empty`. Reading `''` as "clear the button" would make
12
+ * a caller who blanks a label lose the padding the child was holding.
13
+ */
14
+ export declare function buttonSlotAfterWrite(wrote: ButtonSlotWrite, value: unknown): ButtonSlot;
15
+ /** Whether moving from `from` to `to` has to detach the view `from` had parented. */
16
+ export declare function buttonSlotDetaches(from: ButtonSlot, to: ButtonSlot): boolean;
@@ -0,0 +1,102 @@
1
+ /**
2
+ * The keys a widget's construct-props bag accepts, derived from the widget itself.
3
+ *
4
+ * Methods are dropped; everything else a caller could assign stays, its type read off the
5
+ * GETTER (so `size?: number` even though `set size(value: number | string)` also takes the
6
+ * string XML hands over — the bag is the TypeScript door, the attribute is the string one).
7
+ *
8
+ * A read-only accessor survives this type and is refused at RUNTIME instead. The
9
+ * `readonly`-detecting mapped type that would have caught `parent` at compile time was
10
+ * measured to drop `size` as well — a getter/setter pair with different types does not
11
+ * compare equal under it — and a type that silently loses real properties is worse than
12
+ * one that admits two impossible ones and says so when they arrive.
13
+ */
14
+ export type ConstructProps<T> = Partial<{
15
+ [K in keyof T as T[K] extends (...args: never[]) => unknown ? never : K]: K extends EnumProp ? T[K] | number : T[K];
16
+ }>;
17
+ /**
18
+ * Every key this bag reads as a GIR ENUM, so `| number` is admitted for exactly those and
19
+ * nowhere else. ADR 0034 § 4's second spelling: a nick is what an XML attribute can carry,
20
+ * and the constant is what a snippet ported off GJS carries.
21
+ */
22
+ export type EnumProp = AlignmentProp | IconSizeProp;
23
+ /**
24
+ * The NativeScript properties whose value this package reads as a `Gtk.Align`.
25
+ *
26
+ * `horizontalAlignment` and `verticalAlignment` are NativeScript's own — declared by
27
+ * `View`, never re-declared by a widget here — so this is a WIDENING of what they accept
28
+ * and not a second vocabulary: every NativeScript spelling passes through untouched, and
29
+ * only the GTK-side ones are translated.
30
+ *
31
+ * WHERE THIS DOOR AND THE ATTRIBUTE DOOR DISAGREE, exactly. NativeScript's `verticalAlignment`
32
+ * is `'top' | 'middle' | 'bottom' | 'stretch'`, and its layout pass sends anything else to the
33
+ * `default:` arm, which is `stretch`
34
+ * (`ui/core/view/view-helper/view-helper-common.ts`, both platforms). So the three GTK
35
+ * spellings this table TRANSLATES on that axis — `center`, `start`, `end` — reach the widget
36
+ * as `middle`/`top`/`bottom` through the bag and as themselves through
37
+ * `<adw:Avatar verticalAlignment="center">`, where they silently stretch. The horizontal axis
38
+ * has no such gap: `start`, `end` and `center` are NativeScript's own words, and `fill` maps
39
+ * to `stretch`, which is also what the `default:` arm does with it. Nothing here closes the
40
+ * vertical three — the attribute door has no coercer to hang this on and a per-widget
41
+ * `set verticalAlignment` would shadow `View`'s, which is the hazard arm 2 of
42
+ * `check-nativescript-xml-doors.mjs` exists for — so it is a declared divergence and the same
43
+ * § 1 convergence question ADR 0034 § Amendment 12 leaves open for `halign` / `valign`.
44
+ */
45
+ declare const ALIGNMENT_AXES: {
46
+ readonly horizontalAlignment: "horizontal";
47
+ readonly verticalAlignment: "vertical";
48
+ };
49
+ /**
50
+ * The keys the bag reads as a `Gtk.Align` — the runtime table's OWN key set, so the type
51
+ * cannot admit one the applier does not translate or refuse one it does.
52
+ *
53
+ * {@link ConstructProps} widens exactly these to `| number`. Without it the constant spelling
54
+ * was reachable at runtime and refused by the compiler: `new AdwAvatar({ horizontalAlignment:
55
+ * Gtk.Align.CENTER })` was `TS2322: Type 'number' is not assignable to type 'string'`, which
56
+ * is the one caller the second spelling exists for.
57
+ */
58
+ export type AlignmentProp = keyof typeof ALIGNMENT_AXES;
59
+ /**
60
+ * The keys the bag reads as a `Gtk.IconSize` — the port's OWN property, unlike the two
61
+ * alignment axes, which are NativeScript's.
62
+ *
63
+ * A table of one, and it is a table for the same reason `ALIGNMENT_AXES` is: the runtime key
64
+ * set and the type widening are derived from ONE declaration, so the type cannot admit a key
65
+ * the applier does not coerce, nor refuse one it does. `GtkImage` and `AdwImageButton` both
66
+ * spell it `iconSize` (#1584), and no other widget on this surface has a key of that name.
67
+ */
68
+ declare const ICON_SIZE_PROPS: {
69
+ readonly iconSize: true;
70
+ };
71
+ /** The keys {@link ICON_SIZE_PROPS} declares — {@link ConstructProps} widens exactly these. */
72
+ export type IconSizeProp = keyof typeof ICON_SIZE_PROPS;
73
+ /**
74
+ * A `Gtk.Align` value — the nick, or the constant a GJS caller's `Gtk.Align.CENTER` is —
75
+ * as the NativeScript alignment for `axis`. Any other value is NativeScript's own and is
76
+ * returned unchanged.
77
+ *
78
+ * The number spelling is resolved through {@link GTK_ALIGN} rather than assumed, because
79
+ * the constants are NOT the positions in the nick list: `GTK_ALIGN_BASELINE` was
80
+ * deprecated in GTK 4.12 and made an ALIAS of `GTK_ALIGN_BASELINE_FILL`, so both are 4 and
81
+ * `GTK_ALIGN_BASELINE_CENTER` is 5 where its position says 6.
82
+ */
83
+ export declare function nsAlignment(value: unknown, axis: 'horizontal' | 'vertical'): unknown;
84
+ /**
85
+ * Apply a construct-props bag through the target's declared setters.
86
+ *
87
+ * Called as the LAST statement of a widget's own constructor, so the bag wins over whatever
88
+ * that constructor set up — which is the point of a construct property.
89
+ *
90
+ * An `undefined` VALUE is skipped rather than assigned: every key of a `Partial` is
91
+ * optional, so `{ title: maybeTitle }` is the ordinary spelling of "set it if I have one",
92
+ * and assigning `undefined` there would clear a default the constructor had just chosen. An
93
+ * unknown KEY still throws — the key is what the caller got wrong.
94
+ *
95
+ * The parameter is a bare record rather than `ConstructProps<T>` because inside a
96
+ * constructor `this` has the POLYMORPHIC this-type: a generic `<T extends object>(target: T,
97
+ * props?: ConstructProps<T>)` infers `T` as `this`, and `ConstructProps<AdwAvatar>` is not
98
+ * assignable to `ConstructProps<this>` — 46 of 46 call sites failed to compile that way. The
99
+ * typed door is the widget's own constructor signature; this is what it hands over.
100
+ */
101
+ export declare function applyConstructProps(target: object, props?: Readonly<Record<string, unknown>>): void;
102
+ export {};
@@ -37,7 +37,7 @@ export interface PasswordEntryRowViews {
37
37
  field: {
38
38
  secure: boolean;
39
39
  };
40
- /** The peek toggle, whose `icon` takes an Adwaita symbolic SVG string. */
40
+ /** The peek toggle, whose `iconName` takes an Adwaita icon name or SVG source. */
41
41
  peekButton: {
42
42
  iconName: string;
43
43
  };
@@ -85,12 +85,13 @@ export declare function entryRowClassName(base: string, state: EntryRowRenderSta
85
85
  */
86
86
  export declare function applyEntryRowState(views: EntryRowViews, state: EntryRowRenderState, base: string): void;
87
87
  /**
88
- * The Adwaita symbolic SVG for a canonical peek icon name.
88
+ * Paint one password-entry-row render snapshot — `notify_visibility_cb` (C:62-81).
89
89
  *
90
- * The core names the icon the way the C does (`view-reveal-symbolic` /
91
- * `view-conceal-symbolic`, adw-password-entry-row.c:68,73); this is the one
92
- * place that maps a name onto the asset `@gjsify/adwaita-icons` ships.
90
+ * The peek icon goes through UNTRANSLATED. The core names it the way the C does
91
+ * (`view-reveal-symbolic` / `view-conceal-symbolic`, adw-password-entry-row.c:68,73),
92
+ * and since `icon-theme.ts` this port resolves that name at the widget — so the
93
+ * `peekIconSvg` that used to sit here, mapping the two names onto two imported
94
+ * documents, was one of four hand-rolled registries and is gone. Its whole body was
95
+ * the substitution the registry now performs for every name at once.
93
96
  */
94
- export declare function peekIconSvg(iconName: PasswordEntryRowRenderState['peekIconName']): string;
95
- /** Paint one password-entry-row render snapshot — `notify_visibility_cb` (C:62-81). */
96
97
  export declare function applyPasswordEntryRowState(views: PasswordEntryRowViews, state: PasswordEntryRowRenderState): void;
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Every `Gtk.Align` member, in GIR declaration order.
3
+ *
4
+ * Held against `GtkAlignNick` in `packages/framework/gtk-host/src/generated/props.ts` —
5
+ * in-repo, GIR-derived, emitted by a generator that has never heard of this port — so this
6
+ * array is a copy that cannot drift rather than a second source.
7
+ */
8
+ export declare const GTK_ALIGN_NICKS: readonly ["fill", "start", "end", "center", "baseline-fill", "baseline", "baseline-center"];
9
+ /**
10
+ * The members that are a SECOND NAME for another member rather than a value of their own,
11
+ * as alias to the member it stands for.
12
+ *
13
+ * The single authored GIR fact in this file. An alias takes its target's number and does
14
+ * not consume one, which is what shifts every later member below its position.
15
+ *
16
+ * `baseline` is here because GTK 4.12 deprecated `GTK_ALIGN_BASELINE` in favour of
17
+ * `GTK_ALIGN_BASELINE_FILL` and gave the new name the SAME value — "a different name for
18
+ * `GTK_ALIGN_BASELINE`", as the GIR doc on `baseline-fill` puts it — rather than adding a
19
+ * member. That is the whole of the off-by-one below it.
20
+ */
21
+ export declare const GTK_ALIGN_ALIASES: Readonly<Record<string, string>>;
22
+ /**
23
+ * Every `Gtk.Align` member, nick to constant.
24
+ *
25
+ * Six distinct values across seven nicks: `baseline` and `baseline-fill` are the same
26
+ * member under two names.
27
+ */
28
+ export declare const GTK_ALIGN: Readonly<Record<string, number>>;
29
+ /**
30
+ * `Gtk.Align` to `View.horizontalAlignment`.
31
+ *
32
+ * FOUR OF THE SEVEN MEMBERS MAP, not two. ADR 0034 § Context measured NativeScript's
33
+ * horizontal vocabulary as `'left' | 'center' | 'right' | 'stretch'` and concluded that
34
+ * `start` and `end` have no counterpart; `@nativescript/core` 9.0.21-next.15 declares
35
+ * `'start' | 'left' | 'center' | 'right' | 'end' | 'stretch'` (`core-types/index.ts:127`),
36
+ * and its shared layout pass resolves `start`/`end` against the view's own `direction`
37
+ * (`ui/core/view/view-helper/view-helper-common.ts:98-111`) — the same direction-relative
38
+ * meaning GTK gives them. The remainder is the three baselines and nothing else.
39
+ */
40
+ export declare const NS_HORIZONTAL_ALIGNMENT: Readonly<Record<string, string>>;
41
+ /**
42
+ * `Gtk.Align` to `View.verticalAlignment`.
43
+ *
44
+ * NativeScript's vertical vocabulary is `'top' | 'middle' | 'bottom' | 'stretch'` — no
45
+ * `center` and no `start`/`end`, so all four mapped members are genuinely translated here
46
+ * rather than passed through. GTK's vertical `start`/`end` are not direction-relative
47
+ * (`gtkenums.h` scopes that to the horizontal context), which is why they can be top and
48
+ * bottom without asking the view which way its text runs.
49
+ */
50
+ export declare const NS_VERTICAL_ALIGNMENT: Readonly<Record<string, string>>;
51
+ /**
52
+ * Why a `Gtk.Align` member has no NativeScript counterpart on either axis.
53
+ *
54
+ * ADR 0034 § 1's declared remainder: a member that is absent from both maps and absent from
55
+ * here is a silent omission, and the gate fails on it.
56
+ */
57
+ export declare const GTK_ALIGN_REFUSALS: Readonly<Record<string, string>>;
58
+ /** The refusal reason for `nick`, for an error message that says why and not only no. */
59
+ export declare function gtkAlignRefusal(nick: string): string;
@@ -0,0 +1,75 @@
1
+ import { StackLayout, type View } from '@nativescript/core';
2
+ import { DEFAULT_BOX_SPACING } from './box-layout.js';
3
+ import { type ConstructProps } from './construct-props.js';
4
+ export { DEFAULT_BOX_SPACING };
5
+ declare const GtkBox_base: (abstract new (...args: any[]) => {
6
+ connect(eventName: string, callback: (self: /*elided*/ any, data: import("@nativescript/core").EventData) => void): number;
7
+ disconnect(handlerId: number): void;
8
+ _emit(eventName: string): void;
9
+ addEventListener(eventName: string, callback: (data: import("@nativescript/core").EventData) => void, thisArg?: unknown, once?: boolean): void;
10
+ removeEventListener(eventName: string, callback?: (data: import("@nativescript/core").EventData) => void, thisArg?: unknown): void;
11
+ notify<T extends import("@nativescript/core").EventData>(data: T): void;
12
+ notifyPropertyChange(name: string, value: unknown, oldValue?: unknown): void;
13
+ set(name: string, value: unknown): void;
14
+ get(name: string): unknown;
15
+ }) & typeof StackLayout;
16
+ export declare class GtkBox extends GtkBox_base {
17
+ private _spacing;
18
+ private _styleClasses;
19
+ constructor(props?: ConstructProps<GtkBox>);
20
+ /** Append a child — `gtk_box_append`. */
21
+ append(view: View): void;
22
+ /** Insert a child at the START — `gtk_box_prepend`. */
23
+ prepend(view: View): void;
24
+ /** Remove a previously-added child — `gtk_box_remove`. */
25
+ remove(view: View): void;
26
+ /**
27
+ * Every path a child can enter by — `append()`, a direct `addChild()`, and XML
28
+ * inflation through `_addChildFromBuilder` — ends here, which is why the spacing is
29
+ * applied here and not in `append()`. `AdwWrapBox` records the incident that rule
30
+ * comes from: applied in `append()` only, a child declared in markup got no spacing
31
+ * at all.
32
+ */
33
+ addChild(view: View): void;
34
+ /**
35
+ * `gtk_box_insert_child_after`.
36
+ *
37
+ * A NULL/absent `sibling` inserts at the FIRST position, not the last —
38
+ * `gtk_widget_insert_after`'s documented rule. Returns whether the insert happened; a
39
+ * refusal is where C would have hit a `g_return_if_fail`.
40
+ */
41
+ insert_child_after(view: View, sibling?: View | null): boolean;
42
+ /** `gtk_box_reorder_child_after`. Same NULL rule. */
43
+ reorder_child_after(view: View, sibling?: View | null): boolean;
44
+ /** `Gtk.Box:spacing` — the gap between children, in DIPs. Defaults to 0, as in C. */
45
+ get spacing(): number;
46
+ set spacing(value: number | string);
47
+ /**
48
+ * `GtkWidget:css-classes`, spelled `styleClasses` — the platform owns `cssClasses` as a
49
+ * live `Set`, and taking that name is fatal inside the widget's own constructor
50
+ * (`style-classes.ts`). From XML it is a space-separated list, which is what an
51
+ * attribute can carry: `<gtk:Box styleClasses="card" />`.
52
+ */
53
+ get styleClasses(): string[];
54
+ set styleClasses(value: string | null | undefined);
55
+ /** `gtk_widget_add_css_class`. A class the box already carries is a no-op. */
56
+ add_css_class(name: string): void;
57
+ /** `gtk_widget_remove_css_class`. A class it does not carry is a no-op. */
58
+ remove_css_class(name: string): void;
59
+ /** `gtk_widget_has_css_class`. */
60
+ has_css_class(name: string): boolean;
61
+ /** `gtk_widget_get_css_classes` — the list, without the widget's own CSS name. */
62
+ get_css_classes(): string[];
63
+ /** `gtk_widget_set_css_classes` — REPLACES the list, as in C. */
64
+ set_css_classes(names: readonly string[]): void;
65
+ private _setClasses;
66
+ private _childViews;
67
+ private _applyOrder;
68
+ /**
69
+ * Give every child its share of the gap.
70
+ *
71
+ * The WHOLE set, not just the newcomer: adding a second child changes the FIRST one's
72
+ * answer too when the box is re-ordered, and a removal shifts every index after it.
73
+ */
74
+ private _applyChildren;
75
+ }
@@ -1,33 +1,115 @@
1
- import { type AdwButtonStyleClass } from '@gjsify/adwaita-core';
2
- import { Button } from '@nativescript/core';
3
- /**
4
- * The Adwaita button variants this widget can apply. `'default'` = plain button.
5
- *
6
- * The class list is `@gjsify/adwaita-core`'s, not a local table: this widget's own
7
- * one was MISSING `circular`, which the browser element had, and neither file could
8
- * see the other. `circular` is now here because the shared table says it exists.
9
- *
10
- * STILL `Adw…`, on a class that is not: the variants ARE libadwaita style classes
11
- * (`.suggested-action`, `.pill`, `_buttons.scss`), so the prefix names what they are.
12
- * ADR 0034 clause 1 renames WIDGETS after the library owning their GType; a style-class
13
- * vocabulary is not a widget, and renaming it would have moved a true name to a false one.
14
- */
15
- export type AdwButtonVariant = 'default' | AdwButtonStyleClass;
16
- export declare class GtkButton extends Button {
17
- private _variant;
18
- constructor();
1
+ import { GridLayout, type View } from '@nativescript/core';
2
+ import { type ConstructProps } from './construct-props.js';
3
+ /** Event name emitted when the button is tapped. Mirrors `Gtk.Button::clicked`. */
4
+ export declare const GTK_BUTTON_CLICKED = "clicked";
5
+ /** The class the button's own label carries, so the theme can give it Adwaita's type. */
6
+ export declare const GTK_BUTTON_LABEL_CLASS = "adw-button-label";
7
+ declare const GtkButton_base: (abstract new (...args: any[]) => {
8
+ connect(eventName: string, callback: (self: /*elided*/ any, data: import("@nativescript/core").EventData) => void): number;
9
+ disconnect(handlerId: number): void;
10
+ _emit(eventName: string): void;
11
+ addEventListener(eventName: string, callback: (data: import("@nativescript/core").EventData) => void, thisArg?: unknown, once?: boolean): void;
12
+ removeEventListener(eventName: string, callback?: (data: import("@nativescript/core").EventData) => void, thisArg?: unknown): void;
13
+ notify<T extends import("@nativescript/core").EventData>(data: T): void;
14
+ notifyPropertyChange(name: string, value: unknown, oldValue?: unknown): void;
15
+ set(name: string, value: unknown): void;
16
+ get(name: string): unknown;
17
+ }) & typeof GridLayout;
18
+ export declare class GtkButton extends GtkButton_base {
19
+ private _styleClasses;
20
+ private _label;
21
+ private _iconName;
22
+ private _useUnderline;
23
+ private _slot;
24
+ /** The view currently in the single cell, whichever slot filled it. */
25
+ private _content;
26
+ constructor(props?: ConstructProps<GtkButton>);
19
27
  /**
20
- * The Adwaita style variant. Setting it swaps the corresponding CSS class
21
- * (one of `GtkButton.variantClasses`) onto the button,
22
- * preserving the base `adw-button` class. Note that `pill` is the rounded
23
- * SHAPE and combines with no other variant here (set the shape OR the accent
24
- * intent — matching how this CSS subset expresses them as flat classes).
28
+ * `Gtk.Button:label` — the button's text.
29
+ *
30
+ * Writing it REPLACES whatever was in the child, which is `gtk_button_set_label`
31
+ * building a fresh `GtkLabel` and handing it to `set_child`. An empty label is still a
32
+ * label: the button keeps its child and shows nothing, rather than collapsing.
25
33
  */
26
- get variant(): AdwButtonVariant;
27
- set variant(value: AdwButtonVariant);
34
+ get label(): string;
35
+ set label(value: string);
28
36
  /**
29
- * All Adwaita variant class names this widget recognises — exposed for tests
30
- * and for consumers composing class lists manually.
37
+ * `Gtk.Button:icon-name` — an Adwaita symbolic SVG string, not a theme name (see the
38
+ * header). Writing it replaces the child, as `gtk_button_set_icon_name` does.
31
39
  */
32
- static get variantClasses(): readonly string[];
40
+ get iconName(): string;
41
+ set iconName(value: string);
42
+ /**
43
+ * `Gtk.Button:child` — any view, which is how a button wraps an `Adw.ButtonContent`.
44
+ *
45
+ * `null` empties the button. Setting it also hands an `AdwButtonContent` the host it
46
+ * needs: that widget stamps `image-text-button` on the button around it, which C gets
47
+ * from `gtk_widget_get_ancestor` and NativeScript has no rooting protocol for — so the
48
+ * button that receives the content is what tells it.
49
+ */
50
+ get child(): View | null;
51
+ set child(view: View | null);
52
+ /** `gtk_button_set_child`. The method spelling of {@link child}. */
53
+ set_child(view: View | null): void;
54
+ /** `gtk_button_get_child`. */
55
+ get_child(): View | null;
56
+ /**
57
+ * XML inflation — every child a template declares is THE button's child.
58
+ *
59
+ * Without this, `LayoutBase`'s default calls `addChild`, which drops the view into the
60
+ * cell without the slot bookkeeping: a second child would paint on top of the first
61
+ * and `child` would read back `null`, both at exit 0.
62
+ */
63
+ _addChildFromBuilder(_name: string, view: View): void;
64
+ /**
65
+ * `Gtk.Button:use-underline` — whether an `_` in {@link label} marks a mnemonic.
66
+ *
67
+ * The marker is REMOVED and no key is bound: NativeScript has no accelerator layer.
68
+ * Same reduction `Adw.ButtonContent` and `Gtk.Label` make, through the same helper.
69
+ */
70
+ get useUnderline(): boolean;
71
+ set useUnderline(raw: boolean | string);
72
+ /**
73
+ * The style classes this button carries (`GtkWidget:css-classes`), without the
74
+ * `adw-button` class that makes it a button — GTK's own rule for the property.
75
+ *
76
+ * IT WAS `variant`, AN ENUM, AND THAT WAS ONE LOOK AT A TIME (ADR 0049). Its own doc
77
+ * said so: "`pill` is the rounded SHAPE and combines with no other variant here (set
78
+ * the shape OR the accent intent)". GTK holds a LIST, so `.pill.suggested-action` is
79
+ * an ordinary Adwaita button and was unreachable through the enum. The names are the
80
+ * CLASS names now, not the web element's attribute spellings: `suggested-action`,
81
+ * not `suggested`.
82
+ *
83
+ * NOT `cssClasses`: `ViewBase` owns that name as a live `Set<string>` the CSS engine
84
+ * rebuilds on every `className` write, and shadowing it kills the widget in its own
85
+ * constructor — see `style-classes.ts`.
86
+ *
87
+ * From XML it is a space-separated list, which is what an attribute can carry:
88
+ * `<gtk:Button styleClasses="pill suggested-action" />`.
89
+ */
90
+ get styleClasses(): string[];
91
+ set styleClasses(value: string | null | undefined);
92
+ /** `gtk_widget_add_css_class`. A class the button already carries is a no-op. */
93
+ add_css_class(name: string): void;
94
+ /** `gtk_widget_remove_css_class`. A class it does not carry is a no-op. */
95
+ remove_css_class(name: string): void;
96
+ /** `gtk_widget_has_css_class`. */
97
+ has_css_class(name: string): boolean;
98
+ /** `gtk_widget_get_css_classes` — the list, without the widget's own CSS name. */
99
+ get_css_classes(): string[];
100
+ /** `gtk_widget_set_css_classes` — REPLACES the list, as in C. */
101
+ set_css_classes(names: readonly string[]): void;
102
+ private _setClasses;
103
+ /**
104
+ * Put `value` in the single cell under `wrote`'s slot, detaching whatever the previous
105
+ * slot had parented.
106
+ *
107
+ * The detach is the whole reason `button-slot.ts` exists: two views left in one
108
+ * `GridLayout` cell paint on top of each other and nothing complains.
109
+ */
110
+ private _fill;
111
+ private _detach;
112
+ /** Parent `view` in the single cell, centred, and remember it as the content. */
113
+ private _adopt;
33
114
  }
115
+ export {};