@gjsify/adwaita-nativescript 0.47.0 → 0.49.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 (155) hide show
  1. package/lib/esm/_virtual/_rolldown/runtime.js +1 -1
  2. package/lib/esm/index.js +1 -1
  3. package/lib/esm/namespace/adw.js +1 -0
  4. package/lib/esm/namespace/gtk.js +1 -0
  5. package/lib/esm/widgets/adw-about-dialog.js +1 -1
  6. package/lib/esm/widgets/adw-action-row.js +1 -1
  7. package/lib/esm/widgets/adw-alert-dialog.js +1 -1
  8. package/lib/esm/widgets/adw-avatar.js +1 -1
  9. package/lib/esm/widgets/adw-banner.js +1 -1
  10. package/lib/esm/widgets/adw-bottom-sheet.js +1 -1
  11. package/lib/esm/widgets/adw-button-content.js +1 -1
  12. package/lib/esm/widgets/adw-button-row.js +1 -1
  13. package/lib/esm/widgets/adw-carousel.js +1 -1
  14. package/lib/esm/widgets/adw-clamp.js +1 -1
  15. package/lib/esm/widgets/adw-combo-row.js +1 -1
  16. package/lib/esm/widgets/adw-data-grid.js +1 -1
  17. package/lib/esm/widgets/adw-entry-row.js +1 -1
  18. package/lib/esm/widgets/adw-expander-row.js +1 -1
  19. package/lib/esm/widgets/adw-header-bar.js +1 -1
  20. package/lib/esm/widgets/adw-image-button.js +1 -1
  21. package/lib/esm/widgets/adw-inline-view-switcher.js +1 -1
  22. package/lib/esm/widgets/adw-navigation-split-view.js +1 -1
  23. package/lib/esm/widgets/adw-navigation-view.js +1 -1
  24. package/lib/esm/widgets/adw-overlay-split-view.js +1 -1
  25. package/lib/esm/widgets/adw-password-entry-row.js +1 -1
  26. package/lib/esm/widgets/adw-preferences-dialog.js +1 -1
  27. package/lib/esm/widgets/adw-preferences-group.js +1 -1
  28. package/lib/esm/widgets/adw-preferences-page.js +1 -1
  29. package/lib/esm/widgets/adw-shortcut-label.js +1 -1
  30. package/lib/esm/widgets/adw-sidebar.js +1 -1
  31. package/lib/esm/widgets/adw-slider-row.js +1 -1
  32. package/lib/esm/widgets/adw-spin-row.js +1 -1
  33. package/lib/esm/widgets/adw-spinner.js +1 -1
  34. package/lib/esm/widgets/adw-split-button.js +1 -1
  35. package/lib/esm/widgets/adw-status-page.js +1 -1
  36. package/lib/esm/widgets/adw-switch-row.js +1 -1
  37. package/lib/esm/widgets/adw-tab-view.js +1 -1
  38. package/lib/esm/widgets/adw-toast-overlay.js +1 -1
  39. package/lib/esm/widgets/adw-toggle-group.js +1 -1
  40. package/lib/esm/widgets/adw-toolbar-view.js +1 -1
  41. package/lib/esm/widgets/adw-view-stack.js +1 -1
  42. package/lib/esm/widgets/adw-view-switcher-bar.js +1 -1
  43. package/lib/esm/widgets/adw-view-switcher.js +1 -1
  44. package/lib/esm/widgets/adw-window-title.js +1 -1
  45. package/lib/esm/widgets/adw-wrap-box.js +1 -1
  46. package/lib/esm/widgets/avatar-view.js +1 -0
  47. package/lib/esm/widgets/box-layout.js +1 -0
  48. package/lib/esm/widgets/button-content.js +1 -1
  49. package/lib/esm/widgets/button-slot.js +1 -0
  50. package/lib/esm/widgets/construct-props.js +1 -0
  51. package/lib/esm/widgets/entry-row-view.js +1 -1
  52. package/lib/esm/widgets/gtk-align.js +1 -0
  53. package/lib/esm/widgets/gtk-box.js +1 -0
  54. package/lib/esm/widgets/gtk-button.js +1 -1
  55. package/lib/esm/widgets/gtk-drop-down.js +1 -1
  56. package/lib/esm/widgets/gtk-entry.js +1 -1
  57. package/lib/esm/widgets/gtk-image.js +1 -0
  58. package/lib/esm/widgets/gtk-label.js +1 -0
  59. package/lib/esm/widgets/gtk-menu-button.js +1 -1
  60. package/lib/esm/widgets/icon-theme.js +1 -0
  61. package/lib/esm/widgets/index.js +1 -1
  62. package/lib/esm/widgets/label-text.js +1 -0
  63. package/lib/esm/widgets/menu-sheet.js +1 -0
  64. package/lib/esm/widgets/signals.js +1 -0
  65. package/lib/esm/widgets/split-button.js +1 -1
  66. package/lib/esm/widgets/split-view-base.js +1 -1
  67. package/lib/esm/widgets/style-classes.js +1 -0
  68. package/lib/esm/widgets/view-switcher-base.js +1 -1
  69. package/lib/esm/widgets/view-switcher-model.js +1 -1
  70. package/lib/types/avatar.spec.d.ts +2 -0
  71. package/lib/types/box-layout.spec.d.ts +2 -0
  72. package/lib/types/button-slot.spec.d.ts +2 -0
  73. package/lib/types/construct-props.spec.d.ts +2 -0
  74. package/lib/types/icon-theme.spec.d.ts +2 -0
  75. package/lib/types/index.d.ts +4 -3
  76. package/lib/types/label-text.spec.d.ts +2 -0
  77. package/lib/types/namespace/adw.d.ts +38 -0
  78. package/lib/types/namespace/gtk.d.ts +7 -0
  79. package/lib/types/signals.spec.d.ts +2 -0
  80. package/lib/types/style-classes.spec.d.ts +2 -0
  81. package/lib/types/widgets/adw-about-dialog.d.ts +16 -3
  82. package/lib/types/widgets/adw-action-row.d.ts +38 -10
  83. package/lib/types/widgets/adw-alert-dialog.d.ts +30 -13
  84. package/lib/types/widgets/adw-avatar.d.ts +49 -3
  85. package/lib/types/widgets/adw-banner.d.ts +16 -3
  86. package/lib/types/widgets/adw-bottom-sheet.d.ts +32 -16
  87. package/lib/types/widgets/adw-button-content.d.ts +20 -6
  88. package/lib/types/widgets/adw-button-row.d.ts +10 -7
  89. package/lib/types/widgets/adw-carousel.d.ts +19 -7
  90. package/lib/types/widgets/adw-clamp.d.ts +17 -5
  91. package/lib/types/widgets/adw-combo-row.d.ts +8 -7
  92. package/lib/types/widgets/adw-data-grid.d.ts +17 -4
  93. package/lib/types/widgets/adw-entry-row.d.ts +16 -14
  94. package/lib/types/widgets/adw-expander-row.d.ts +21 -10
  95. package/lib/types/widgets/adw-header-bar.d.ts +39 -14
  96. package/lib/types/widgets/adw-image-button.d.ts +22 -5
  97. package/lib/types/widgets/adw-inline-view-switcher.d.ts +2 -1
  98. package/lib/types/widgets/adw-navigation-split-view.d.ts +2 -1
  99. package/lib/types/widgets/adw-navigation-view.d.ts +40 -21
  100. package/lib/types/widgets/adw-overlay-split-view.d.ts +3 -2
  101. package/lib/types/widgets/adw-password-entry-row.d.ts +2 -1
  102. package/lib/types/widgets/adw-preferences-dialog.d.ts +16 -3
  103. package/lib/types/widgets/adw-preferences-group.d.ts +19 -6
  104. package/lib/types/widgets/adw-preferences-page.d.ts +37 -8
  105. package/lib/types/widgets/adw-shortcut-label.d.ts +15 -2
  106. package/lib/types/widgets/adw-sidebar.d.ts +15 -2
  107. package/lib/types/widgets/adw-slider-row.d.ts +30 -19
  108. package/lib/types/widgets/adw-spin-row.d.ts +18 -14
  109. package/lib/types/widgets/adw-spinner.d.ts +14 -2
  110. package/lib/types/widgets/adw-split-button.d.ts +60 -12
  111. package/lib/types/widgets/adw-status-page.d.ts +22 -8
  112. package/lib/types/widgets/adw-switch-row.d.ts +2 -1
  113. package/lib/types/widgets/adw-tab-view.d.ts +34 -8
  114. package/lib/types/widgets/adw-toast-overlay.d.ts +19 -7
  115. package/lib/types/widgets/adw-toggle-group.d.ts +14 -2
  116. package/lib/types/widgets/adw-toolbar-view.d.ts +21 -8
  117. package/lib/types/widgets/adw-view-stack.d.ts +38 -5
  118. package/lib/types/widgets/adw-view-switcher-bar.d.ts +16 -3
  119. package/lib/types/widgets/adw-view-switcher.d.ts +2 -1
  120. package/lib/types/widgets/adw-window-title.d.ts +16 -3
  121. package/lib/types/widgets/adw-wrap-box.d.ts +21 -8
  122. package/lib/types/widgets/avatar-view.d.ts +57 -0
  123. package/lib/types/widgets/bottom-sheet-state.d.ts +1 -1
  124. package/lib/types/widgets/box-layout.d.ts +39 -0
  125. package/lib/types/widgets/button-content.d.ts +4 -4
  126. package/lib/types/widgets/button-slot.d.ts +16 -0
  127. package/lib/types/widgets/construct-props.d.ts +82 -0
  128. package/lib/types/widgets/entry-row-view.d.ts +9 -8
  129. package/lib/types/widgets/gtk-align.d.ts +59 -0
  130. package/lib/types/widgets/gtk-box.d.ts +75 -0
  131. package/lib/types/widgets/gtk-button.d.ts +110 -28
  132. package/lib/types/widgets/gtk-drop-down.d.ts +21 -8
  133. package/lib/types/widgets/gtk-entry.d.ts +15 -2
  134. package/lib/types/widgets/gtk-image.d.ts +42 -0
  135. package/lib/types/widgets/gtk-label.d.ts +82 -0
  136. package/lib/types/widgets/gtk-menu-button.d.ts +29 -18
  137. package/lib/types/widgets/icon-theme.d.ts +77 -0
  138. package/lib/types/widgets/icons.d.ts +3 -1
  139. package/lib/types/widgets/index.d.ts +18 -5
  140. package/lib/types/widgets/label-text.d.ts +13 -0
  141. package/lib/types/widgets/menu-sheet.d.ts +58 -0
  142. package/lib/types/widgets/row-state.d.ts +1 -1
  143. package/lib/types/widgets/signals.d.ts +40 -0
  144. package/lib/types/widgets/split-button.d.ts +2 -21
  145. package/lib/types/widgets/split-view-base.d.ts +18 -6
  146. package/lib/types/widgets/status-page-content.d.ts +1 -1
  147. package/lib/types/widgets/style-classes.d.ts +61 -0
  148. package/lib/types/widgets/view-switcher-base.d.ts +12 -1
  149. package/lib/types/widgets/view-switcher-model.d.ts +3 -12
  150. package/package.json +14 -10
  151. package/src/theme/adwaita.css +66 -8
  152. package/lib/esm/namespace.js +0 -1
  153. package/lib/esm/widgets/adw-icon.js +0 -1
  154. package/lib/types/namespace.d.ts +0 -92
  155. package/lib/types/widgets/adw-icon.d.ts +0 -25
@@ -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 {};
@@ -1,6 +1,7 @@
1
1
  import { Label, StackLayout, type EventData } from '@nativescript/core';
2
- import type { AdwComboOption } from '@gjsify/adwaita-core';
3
- import { AdwIcon } from './adw-icon.js';
2
+ import type { AdwComboOption, AdwListModelInput } from '@gjsify/adwaita-core';
3
+ import { GtkImage } from './gtk-image.js';
4
+ import { type ConstructProps } from './construct-props.js';
4
5
  /** Event name emitted when {@link GtkDropDown.selected} changes through a pick. Mirrors GObject `notify::selected`. */
5
6
  export declare const NOTIFY_SELECTED = "notify::selected";
6
7
  /** Payload of the `notify::selected` event. */
@@ -12,21 +13,32 @@ export interface NotifyDropDownSelectedEventData extends EventData {
12
13
  /** The newly-selected option's `label` — what the button now shows. */
13
14
  label: string;
14
15
  }
15
- export declare class GtkDropDown extends StackLayout {
16
+ declare const GtkDropDown_base: (abstract new (...args: any[]) => {
17
+ connect(eventName: string, callback: (self: /*elided*/ any, data: EventData) => void): number;
18
+ disconnect(handlerId: number): void;
19
+ _emit(eventName: string): void;
20
+ addEventListener(eventName: string, callback: (data: EventData) => void, thisArg?: unknown, once?: boolean): void;
21
+ removeEventListener(eventName: string, callback?: (data: EventData) => void, thisArg?: unknown): void;
22
+ notify<T extends EventData>(data: T): void;
23
+ notifyPropertyChange(name: string, value: unknown, oldValue?: unknown): void;
24
+ set(name: string, value: unknown): void;
25
+ get(name: string): unknown;
26
+ }) & typeof StackLayout;
27
+ export declare class GtkDropDown extends GtkDropDown_base {
16
28
  /** The button label — the selected option. */
17
29
  protected readonly _label: Label;
18
30
  /** The down-chevron — a real Adwaita `pan-down-symbolic` icon. */
19
- protected readonly _chevron: AdwIcon;
31
+ protected readonly _chevron: GtkImage;
20
32
  /** The headless options list + selectedIndex↔selectedValue state machine (ADR 0004). */
21
33
  private readonly _state;
22
34
  /** Title shown atop the substituted `action()` sheet. */
23
35
  private _chooserTitle;
24
- constructor();
36
+ constructor(props?: ConstructProps<GtkDropDown>);
25
37
  /** Open the native chooser and apply the picked option. */
26
38
  private _openChooser;
27
- /** The selectable options. Updates the button label. */
28
- get options(): AdwComboOption[];
29
- set options(value: AdwComboOption[]);
39
+ /** The list model (`Gtk.DropDown:model`). Updates the button label. */
40
+ get model(): AdwComboOption[];
41
+ set model(value: AdwListModelInput);
30
42
  /** The selected option index (`Gtk.DropDown:selected`). */
31
43
  get selected(): number;
32
44
  set selected(raw: number | string);
@@ -43,3 +55,4 @@ export declare class GtkDropDown extends StackLayout {
43
55
  get chooserTitle(): string;
44
56
  set chooserTitle(value: string);
45
57
  }
58
+ export {};
@@ -1,4 +1,5 @@
1
1
  import { GridLayout, TextField, type EventData } from '@nativescript/core';
2
+ import { type ConstructProps } from './construct-props.js';
2
3
  /** Event name emitted when {@link GtkEntry.text} changes. Mirrors GObject `notify::text`. */
3
4
  export declare const NOTIFY_TEXT = "notify::text";
4
5
  /** Event name emitted when the return key is pressed — `Gtk.Entry::activate`. */
@@ -10,12 +11,23 @@ export interface NotifyEntryTextEventData extends EventData {
10
11
  /** The new number of CHARACTERS (not UTF-16 units). */
11
12
  textLength: number;
12
13
  }
13
- export declare class GtkEntry extends GridLayout {
14
+ declare const GtkEntry_base: (abstract new (...args: any[]) => {
15
+ connect(eventName: string, callback: (self: /*elided*/ any, data: EventData) => void): number;
16
+ disconnect(handlerId: number): void;
17
+ _emit(eventName: string): void;
18
+ addEventListener(eventName: string, callback: (data: EventData) => void, thisArg?: unknown, once?: boolean): void;
19
+ removeEventListener(eventName: string, callback?: (data: EventData) => void, thisArg?: unknown): void;
20
+ notify<T extends EventData>(data: T): void;
21
+ notifyPropertyChange(name: string, value: unknown, oldValue?: unknown): void;
22
+ set(name: string, value: unknown): void;
23
+ get(name: string): unknown;
24
+ }) & typeof GridLayout;
25
+ export declare class GtkEntry extends GtkEntry_base {
14
26
  /** The real input. Chrome-less: the box around it paints the Adwaita surface. */
15
27
  protected readonly _field: TextField;
16
28
  private _text;
17
29
  private _maxLength;
18
- constructor();
30
+ constructor(props?: ConstructProps<GtkEntry>);
19
31
  /**
20
32
  * Truncate, write the field, and notify on a real change.
21
33
  *
@@ -41,3 +53,4 @@ export declare class GtkEntry extends GridLayout {
41
53
  /** The inner `TextField` — for focus, selection and host-specific keyboard options. */
42
54
  get field(): TextField;
43
55
  }
56
+ export {};
@@ -0,0 +1,42 @@
1
+ import { Image } from '@nativescript/core';
2
+ import { type ConstructProps } from './construct-props.js';
3
+ /** Default decorative-icon size, in DIPs — the Adwaita 16px symbolic grid. */
4
+ export declare const DEFAULT_GTK_IMAGE_SIZE = 16;
5
+ declare const GtkImage_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 Image;
16
+ export declare class GtkImage extends GtkImage_base {
17
+ private _icon;
18
+ private _iconColor;
19
+ private _explicitColor;
20
+ private _iconSize;
21
+ private _unsubScheme;
22
+ constructor(props?: ConstructProps<GtkImage>);
23
+ /** Adopt the active scheme's default fill (no-op if the caller pinned a colour). */
24
+ private _syncThemeColor;
25
+ private _render;
26
+ /**
27
+ * The icon to render: an Adwaita icon NAME (`'list-add-symbolic'`) or an Adwaita
28
+ * symbolic SVG SOURCE string (e.g. `panDownSymbolic`). A name the compiled subset
29
+ * does not carry draws the `image-missing` glyph; `''` draws nothing.
30
+ */
31
+ get iconName(): string;
32
+ set iconName(value: string);
33
+ /** The icon fill colour (hex). Setting it PINS the colour (it no longer follows
34
+ * the light/dark scheme) — use it for context colours like white on a suggested
35
+ * button or destructive red, which must survive both schemes. */
36
+ get iconColor(): string;
37
+ set iconColor(value: string);
38
+ /** The icon size in DIPs (default 16). Re-renders + resizes the image box. */
39
+ get iconSize(): number;
40
+ set iconSize(raw: number | string);
41
+ }
42
+ export {};
@@ -0,0 +1,82 @@
1
+ import { Label } from '@nativescript/core';
2
+ import { type ConstructProps } from './construct-props.js';
3
+ declare const GtkLabel_base: (abstract new (...args: any[]) => {
4
+ connect(eventName: string, callback: (self: /*elided*/ any, data: import("@nativescript/core").EventData) => void): number;
5
+ disconnect(handlerId: number): void;
6
+ _emit(eventName: string): void;
7
+ addEventListener(eventName: string, callback: (data: import("@nativescript/core").EventData) => void, thisArg?: unknown, once?: boolean): void;
8
+ removeEventListener(eventName: string, callback?: (data: import("@nativescript/core").EventData) => void, thisArg?: unknown): void;
9
+ notify<T extends import("@nativescript/core").EventData>(data: T): void;
10
+ notifyPropertyChange(name: string, value: unknown, oldValue?: unknown): void;
11
+ set(name: string, value: unknown): void;
12
+ get(name: string): unknown;
13
+ }) & typeof Label;
14
+ export declare class GtkLabel extends GtkLabel_base {
15
+ private _label;
16
+ private _useMarkup;
17
+ private _useUnderline;
18
+ private _styleClasses;
19
+ constructor(props?: ConstructProps<GtkLabel>);
20
+ /**
21
+ * `Gtk.Label:label` — the text, as written, before markup and the mnemonic marker are
22
+ * taken out of it. `get_text()` is the string actually shown.
23
+ */
24
+ get label(): string;
25
+ set label(value: string);
26
+ /**
27
+ * `Gtk.Label:use-markup` — whether {@link label} is Pango markup.
28
+ *
29
+ * TRUE means the markup is REDUCED to its plain text here, not rendered: see the
30
+ * header. FALSE, the default, shows the string literally, so a `<` in a sentence stays
31
+ * a `<`.
32
+ */
33
+ get useMarkup(): boolean;
34
+ set useMarkup(raw: boolean | string);
35
+ /**
36
+ * `Gtk.Label:use-underline` — whether an `_` in {@link label} marks a mnemonic.
37
+ *
38
+ * The marker is REMOVED and the key is not bound: NativeScript has no accelerator
39
+ * layer and no way to underline one character of a `Label`. Same reduction
40
+ * `Adw.ButtonContent` makes.
41
+ */
42
+ get useUnderline(): boolean;
43
+ set useUnderline(raw: boolean | string);
44
+ /**
45
+ * `Gtk.Label:wrap` — whether the text wraps rather than running past its allocation.
46
+ *
47
+ * NativeScript's own name for it is `textWrap`, which stays reachable; this is the GIR
48
+ * spelling over the same platform property, so a snippet ported off GJS runs verbatim.
49
+ * `wrap-mode` and `natural-wrap-mode` are the declared gaps beside it — the platform
50
+ * wraps at word boundaries and offers no choice.
51
+ */
52
+ get wrap(): boolean;
53
+ set wrap(raw: boolean | string);
54
+ /**
55
+ * `GtkWidget:css-classes`, spelled `styleClasses` for the reason `style-classes.ts`
56
+ * records: the platform owns `cssClasses` as a live `Set` and taking that name kills
57
+ * the widget. From XML it is a space-separated list —
58
+ * `<gtk:Label styleClasses="title-2" />`.
59
+ */
60
+ get styleClasses(): string[];
61
+ set styleClasses(value: string | null | undefined);
62
+ /** `gtk_label_set_markup` — set the text AND turn markup interpretation on. */
63
+ set_markup(markup: string): void;
64
+ /**
65
+ * `gtk_label_get_text` — the text as SHOWN, with markup reduced and the mnemonic
66
+ * marker removed. `label` is the string as written.
67
+ */
68
+ get_text(): string;
69
+ /** `gtk_widget_add_css_class`. A class the label already carries is a no-op. */
70
+ add_css_class(name: string): void;
71
+ /** `gtk_widget_remove_css_class`. A class it does not carry is a no-op. */
72
+ remove_css_class(name: string): void;
73
+ /** `gtk_widget_has_css_class`. */
74
+ has_css_class(name: string): boolean;
75
+ /** `gtk_widget_get_css_classes` — the list, without the widget's own CSS name. */
76
+ get_css_classes(): string[];
77
+ /** `gtk_widget_set_css_classes` — REPLACES the list, as in C. */
78
+ set_css_classes(names: readonly string[]): void;
79
+ private _setClasses;
80
+ private _render;
81
+ }
82
+ export {};
@@ -1,34 +1,45 @@
1
- import type { AdwMenuEntry } from '@gjsify/adwaita-core';
1
+ import type { AdwMenuActions, AdwMenuInput, AdwMenuModel } from '@gjsify/adwaita-core';
2
2
  import { type EventData } from '@nativescript/core';
3
3
  import { AdwImageButton } from './adw-image-button.js';
4
+ import { type ConstructProps } from './construct-props.js';
4
5
  /** Event name emitted when a menu item is chosen. */
5
6
  export declare const MENU_ITEM_ACTIVATED = "menuItemActivated";
6
- /**
7
- * One entry in an {@link GtkMenuButton}'s menu — `@gjsify/adwaita-core`'s
8
- * {@link AdwMenuEntry}, under the name this widget has always used.
9
- *
10
- * It used to be a THIRD declaration of the same shape (the browser element had a
11
- * second, and the core the original), and this one was missing `icon` — so a menu
12
- * written for one renderer was not the same object on the other. The browser side
13
- * adopted the core type in #1191; this is its twin.
14
- */
15
- export type AdwMenuItem = AdwMenuEntry;
16
7
  /** Payload of the {@link MENU_ITEM_ACTIVATED} event. */
17
8
  export interface MenuItemActivatedEventData extends EventData {
18
9
  /** The chosen item's id (or its label when no id was given). */
19
10
  id: string;
20
11
  /** The chosen item's label. */
21
12
  label: string;
22
- /** The chosen item's index in {@link GtkMenuButton.menuItems}. */
23
- index: number;
13
+ /**
14
+ * Where the item sits in {@link GtkMenuButton.menuModel} — a PATH since ADR 0042,
15
+ * because a submenu is a model of its own and a flat index cannot name one.
16
+ */
17
+ path: readonly number[];
18
+ /** The chosen item's detailed action name, when the item carried one. */
19
+ action?: string;
24
20
  }
25
21
  export declare class GtkMenuButton extends AdwImageButton {
26
- private _items;
22
+ private _model;
23
+ private _actions;
27
24
  private _menuTitle;
28
- constructor();
29
- /** The menu items (opened as a native `action()` sheet on tap). */
30
- get menuItems(): AdwMenuItem[];
31
- set menuItems(value: AdwMenuItem[]);
25
+ constructor(props?: ConstructProps<GtkMenuButton>);
26
+ /**
27
+ * The menu, normalised (ADR 0042) — opened as a native `action()` sheet on tap.
28
+ *
29
+ * Accepts every input form the portable model does, a bare `string[]` included —
30
+ * but NOT a JSON string; see `AdwSplitButton.menuModel` for why the XML door stays
31
+ * shut until a probe can prove it, and why being shut is not the same as being
32
+ * silent.
33
+ */
34
+ get menuModel(): AdwMenuModel;
35
+ set menuModel(value: AdwMenuInput);
36
+ /**
37
+ * What the action group publishes about the actions this menu names — the portable
38
+ * stand-in for a `GActionGroup`, and the only source of a menu's enabled/checked
39
+ * state (ADR 0042).
40
+ */
41
+ get actions(): AdwMenuActions | null;
42
+ set actions(value: AdwMenuActions | null);
32
43
  /** Optional title shown atop the native menu sheet. */
33
44
  get menuTitle(): string;
34
45
  set menuTitle(value: string);
@@ -0,0 +1,77 @@
1
+ /**
2
+ * The name every unresolvable name resolves TO.
3
+ *
4
+ * libadwaita's own answer, and `adwaita-web`'s: a name nothing can draw draws the
5
+ * broken-image glyph rather than nothing at all. An empty icon is invisible, and an
6
+ * invisible failure is the class `check-adwaita-icon-masks.mjs` exists to have ended
7
+ * once already — there a missing mask painted a solid 16px square that read as a
8
+ * deliberate swatch, and no test could see it.
9
+ */
10
+ export declare const ICON_FALLBACK_NAME = "image-missing";
11
+ /**
12
+ * What a caller's icon value IS.
13
+ *
14
+ * `'empty'` is not the same answer as `'name'` that fails to resolve: the widgets read
15
+ * it as "no icon" and take their own absent-icon path (an avatar falls back to the
16
+ * person glyph, a status page collapses the image), which is libadwaita's behaviour for
17
+ * a NULL `icon-name` and must not become an `image-missing`.
18
+ */
19
+ export type IconValueKind = 'empty' | 'name' | 'source';
20
+ /**
21
+ * Which of the two doors a value came through — the whole discrimination, in one place.
22
+ *
23
+ * An SVG document is recognised by its FIRST non-space character being `<`, which admits
24
+ * an XML prolog and a DOCTYPE ahead of the root element (both legitimate in an icon read
25
+ * off a file, and `icon-registry.ts` on the web side takes the same two). An icon name is
26
+ * whatever `normalizeIconName` accepts: one CSS token once an optional `-symbolic` comes
27
+ * off. Nothing is both, so nothing has to be guessed.
28
+ *
29
+ * A value that is NEITHER — `'two words'`, `'org.gnome.Builder'` — is reported as a
30
+ * `'name'`, because that is what the caller meant and resolution draws
31
+ * {@link ICON_FALLBACK_NAME} for it. Calling it a source instead would hand an
32
+ * un-parseable string to the rasteriser, which draws nothing and says nothing.
33
+ */
34
+ export declare function iconValueKind(value: string | null | undefined): IconValueKind;
35
+ /** Whether {@link resolveIconSource} can draw `name` without falling back. */
36
+ export declare function isIconAvailable(name: string | null | undefined): boolean;
37
+ /** The subset's names, sorted — for a spec or a gate that has to enumerate them. */
38
+ export declare function compiledIconNames(): string[];
39
+ /** The names {@link registerIcon} has added, sorted. */
40
+ export declare function registeredIconNames(): string[];
41
+ /**
42
+ * Make `name` resolvable from an Adwaita symbolic SVG source (what
43
+ * `@gjsify/adwaita-icons` exports), for a glyph the compiled subset does not carry.
44
+ *
45
+ * import { registerIcon } from '@gjsify/adwaita-nativescript';
46
+ * import { dialogErrorSymbolic } from '@gjsify/adwaita-icons/status';
47
+ *
48
+ * registerIcon('dialog-error-symbolic', dialogErrorSymbolic);
49
+ * // …then anywhere: new Adw.StatusPage({ iconName: 'dialog-error-symbolic' })
50
+ *
51
+ * BOTH arguments are checked and a wrong one THROWS, the same verdict the web registry
52
+ * reaches for the same reason: this is an explicit call, and quietly registering
53
+ * something undrawable produces an icon strictly WORSE than an unregistered one — it
54
+ * beats the `image-missing` fallback and draws nothing, while {@link isIconAvailable}
55
+ * reports `true`.
56
+ *
57
+ * The SVG test is LEXICAL, not a parse, and that is a real limit rather than a shortcut:
58
+ * NativeScript has no `DOMParser`, and the rasterisers here read the document with
59
+ * `extractIconPaths`' own scanner. So a well-formed document with no `<svg>` root is
60
+ * refused, and a malformed one inside an `<svg>` is accepted and draws whatever
61
+ * `extractIconPaths` finds in it — which is the same thing it would have drawn had the
62
+ * caller passed it straight to the widget.
63
+ *
64
+ * Registering a name the subset already compiles REPLACES the glyph.
65
+ */
66
+ export declare function registerIcon(name: string, svg: string): void;
67
+ /** Drop a registration, so the name falls back to the compiled subset. Test seam. */
68
+ export declare function unregisterIcon(name: string): boolean;
69
+ /**
70
+ * A caller's icon value as the SVG document a rasteriser can read.
71
+ *
72
+ * The one function every icon property on this port goes through, so that a name means
73
+ * the same thing on all of them. `''` stays `''` — see {@link IconValueKind}. A source
74
+ * passes through untouched. A name resolves against the registrations, then the compiled
75
+ * subset, then {@link ICON_FALLBACK_NAME}.
76
+ */
77
+ export declare function resolveIconSource(value: string | null | undefined): string;
@@ -3,7 +3,9 @@ import type { SymbolicIconOptions } from './icon-path.js';
3
3
  export { ADWAITA_ICON_GRID, DEFAULT_ICON_COLOR, DEFAULT_ICON_COLOR_DARK, extractIconPaths, extractPathData, } from './icon-path.js';
4
4
  export type { IconPath, SymbolicIconOptions } from './icon-path.js';
5
5
  /**
6
- * Render an Adwaita symbolic SVG string to a native {@link ImageSource}. The base
6
+ * Render an Adwaita symbolic SVG string to a native {@link ImageSource}. A NAME is not
7
+ * accepted here — `resolveIconSource` in `icon-theme.ts` turns one into the document
8
+ * first, so the rasteriser has exactly one input shape. The base
7
9
  * implementation returns `null` — only the platform variants rasterise. Callers
8
10
  * treat `null` as "no icon available" (the widget shows nothing / its fallback).
9
11
  */
@@ -18,14 +18,22 @@ export { AdwSliderRow, NOTIFY_SLIDER_VALUE } from './adw-slider-row.js';
18
18
  export type { NotifySliderValueEventData } from './adw-slider-row.js';
19
19
  export { AdwExpanderRow, ExpanderState, NOTIFY_EXPANDED } from './adw-expander-row.js';
20
20
  export type { ExpanderStateListener, NotifyExpandedEventData } from './adw-expander-row.js';
21
- export { GtkButton } from './gtk-button.js';
22
- export type { AdwButtonVariant } from './gtk-button.js';
21
+ export { GtkButton, GTK_BUTTON_CLICKED, GTK_BUTTON_LABEL_CLASS } from './gtk-button.js';
22
+ export { buttonSlotAfterWrite, buttonSlotDetaches } from './button-slot.js';
23
+ export type { ButtonSlot, ButtonSlotWrite } from './button-slot.js';
24
+ export { GtkBox, DEFAULT_BOX_SPACING } from './gtk-box.js';
25
+ export { boxChildMargin, boxSpacingChanges, normalizeBoxSpacing } from './box-layout.js';
26
+ export type { BoxOrientation } from './box-layout.js';
27
+ export { GtkLabel } from './gtk-label.js';
28
+ export { labelDisplayText, labelMarkupIsUnparseable } from './label-text.js';
23
29
  export { AdwImageButton, DEFAULT_ICON_BUTTON_ICON_SIZE } from './adw-image-button.js';
24
30
  export { GtkMenuButton, MENU_ITEM_ACTIVATED } from './gtk-menu-button.js';
25
- export type { AdwMenuItem, MenuItemActivatedEventData } from './gtk-menu-button.js';
26
- export { AdwIcon, DEFAULT_ADW_ICON_SIZE } from './adw-icon.js';
31
+ export type { MenuItemActivatedEventData } from './gtk-menu-button.js';
32
+ export { MENU_CANCEL_LABEL, menuSheetActions, menuSheetRows, presentMenuSheet, resolveMenuChoice, } from './menu-sheet.js';
33
+ export type { MenuSheetPresenter, MenuSheetRow } from './menu-sheet.js';
34
+ export { GtkImage, DEFAULT_GTK_IMAGE_SIZE } from './gtk-image.js';
27
35
  export { AdwBanner, BUTTON_CLICKED } from './adw-banner.js';
28
- export { AdwAvatar, DEFAULT_AVATAR_SIZE, avatarInitials } from './adw-avatar.js';
36
+ export { AVATAR_DEFAULT_ICON, AdwAvatar, DEFAULT_AVATAR_SIZE, avatarInitials } from './adw-avatar.js';
29
37
  export { AdwWindowTitle } from './adw-window-title.js';
30
38
  export { AdwClamp, DEFAULT_CLAMP_MAX_SIZE } from './adw-clamp.js';
31
39
  export { AdwHeaderBar } from './adw-header-bar.js';
@@ -83,6 +91,11 @@ export type { AdwAlertResponse, AdwResponseAppearance, AdwResponseOptions, Notif
83
91
  export { AdwAboutDialog, CLOSED as ABOUT_CLOSED } from './adw-about-dialog.js';
84
92
  export { AdwPreferencesDialog, CLOSED as PREFERENCES_CLOSED } from './adw-preferences-dialog.js';
85
93
  export { attachRowPressFeedback } from './row-press.js';
94
+ export { applyConstructProps, nsAlignment } from './construct-props.js';
95
+ export type { ConstructProps } from './construct-props.js';
96
+ export { GTK_ALIGN } from './gtk-align.js';
97
+ export { ICON_FALLBACK_NAME, compiledIconNames, iconValueKind, isIconAvailable, registerIcon, registeredIconNames, resolveIconSource, unregisterIcon, } from './icon-theme.js';
98
+ export type { IconValueKind } from './icon-theme.js';
86
99
  export { ADWAITA_ICON_GRID, DEFAULT_ICON_COLOR, DEFAULT_ICON_COLOR_DARK, extractIconPaths, extractPathData, renderSymbolicIcon, } from './icons.js';
87
100
  export type { IconPath, SymbolicIconOptions } from './icons.js';
88
101
  export { adwaitaColorScheme, isThemeIconColor, onAdwaitaColorSchemeChanged, setAdwaitaColorScheme, themeIconColor, toggleAdwaitaColorScheme, } from './color-scheme.js';