@gjsify/adwaita-nativescript 0.64.13 → 0.64.15-next.287

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 (119) hide show
  1. package/lib/esm/builder/index.js +1 -1
  2. package/lib/esm/index.js +1 -1
  3. package/lib/esm/name-selector.js +1 -0
  4. package/lib/esm/namespace/gio.js +1 -1
  5. package/lib/esm/namespace/gtk.js +1 -1
  6. package/lib/esm/platform-host.js +1 -1
  7. package/lib/esm/widgets/adw-about-dialog.js +3 -3
  8. package/lib/esm/widgets/adw-action-row.js +1 -1
  9. package/lib/esm/widgets/adw-button-row.js +1 -1
  10. package/lib/esm/widgets/adw-entry-row.js +1 -1
  11. package/lib/esm/widgets/adw-image-button.js +1 -1
  12. package/lib/esm/widgets/adw-preferences-group.js +1 -1
  13. package/lib/esm/widgets/adw-split-button.js +1 -1
  14. package/lib/esm/widgets/bin-layout.js +1 -0
  15. package/lib/esm/widgets/box-layout.js +1 -1
  16. package/lib/esm/widgets/css-names.js +1 -0
  17. package/lib/esm/widgets/gtk-box.js +1 -1
  18. package/lib/esm/widgets/gtk-button.js +1 -1
  19. package/lib/esm/widgets/gtk-check-button.js +1 -1
  20. package/lib/esm/widgets/gtk-entry.js +1 -1
  21. package/lib/esm/widgets/gtk-label.js +2 -2
  22. package/lib/esm/widgets/gtk-menu-button.js +1 -1
  23. package/lib/esm/widgets/gtk-popover-menu.js +1 -1
  24. package/lib/esm/widgets/gtk-scrolled-window.js +1 -1
  25. package/lib/esm/widgets/gtk-stack.js +1 -1
  26. package/lib/esm/widgets/index.js +1 -1
  27. package/lib/esm/widgets/label-markup-native.android.js +1 -0
  28. package/lib/esm/widgets/label-markup-native.ios.js +1 -0
  29. package/lib/esm/widgets/label-markup-native.js +1 -0
  30. package/lib/esm/widgets/label-markup.js +1 -1
  31. package/lib/esm/widgets/menu-slot.js +1 -0
  32. package/lib/esm/widgets/popup-menu-view.js +1 -1
  33. package/lib/esm/widgets/popup-menu.js +1 -1
  34. package/lib/esm/widgets/scrolled-window-policy.js +1 -1
  35. package/lib/esm/widgets/signals.js +1 -1
  36. package/lib/esm/widgets/single-child-base.js +1 -1
  37. package/lib/esm/widgets/single-child-cell.js +1 -1
  38. package/lib/esm/widgets/widget-layout.js +1 -1
  39. package/lib/types/button-bin.spec.d.ts +2 -0
  40. package/lib/types/css-names.spec.d.ts +1 -0
  41. package/lib/types/entry-properties.spec.d.ts +1 -0
  42. package/lib/types/index.d.ts +4 -2
  43. package/lib/types/menu-button-properties.spec.d.ts +2 -0
  44. package/lib/types/menu-model-door.spec.d.ts +1 -0
  45. package/lib/types/menu-model-route-d.node-gi.spec.d.ts +2 -0
  46. package/lib/types/name-selector.d.ts +20 -0
  47. package/lib/types/name-selector.spec.d.ts +2 -0
  48. package/lib/types/namespace/gio.d.ts +1 -1
  49. package/lib/types/template-xalign.spec.d.ts +2 -0
  50. package/lib/types/testing/ns-core.d.mts +30 -0
  51. package/lib/types/widgets/actions.d.ts +3 -3
  52. package/lib/types/widgets/adw-about-dialog.d.ts +2 -0
  53. package/lib/types/widgets/adw-action-row.d.ts +2 -0
  54. package/lib/types/widgets/adw-alert-dialog.d.ts +2 -0
  55. package/lib/types/widgets/adw-avatar.d.ts +2 -0
  56. package/lib/types/widgets/adw-banner.d.ts +2 -0
  57. package/lib/types/widgets/adw-bottom-sheet.d.ts +2 -0
  58. package/lib/types/widgets/adw-button-content.d.ts +2 -0
  59. package/lib/types/widgets/adw-carousel.d.ts +2 -0
  60. package/lib/types/widgets/adw-clamp.d.ts +2 -0
  61. package/lib/types/widgets/adw-data-grid.d.ts +2 -0
  62. package/lib/types/widgets/adw-header-bar.d.ts +2 -0
  63. package/lib/types/widgets/adw-image-button.d.ts +4 -2
  64. package/lib/types/widgets/adw-navigation-page.d.ts +2 -0
  65. package/lib/types/widgets/adw-navigation-view.d.ts +2 -0
  66. package/lib/types/widgets/adw-preferences-group.d.ts +2 -0
  67. package/lib/types/widgets/adw-preferences-page.d.ts +2 -0
  68. package/lib/types/widgets/adw-shortcut-label.d.ts +2 -0
  69. package/lib/types/widgets/adw-sidebar.d.ts +2 -0
  70. package/lib/types/widgets/adw-slider-row.d.ts +2 -0
  71. package/lib/types/widgets/adw-spinner.d.ts +2 -0
  72. package/lib/types/widgets/adw-split-button.d.ts +49 -24
  73. package/lib/types/widgets/adw-status-page.d.ts +2 -0
  74. package/lib/types/widgets/adw-tab-view.d.ts +2 -0
  75. package/lib/types/widgets/adw-toast-overlay.d.ts +2 -0
  76. package/lib/types/widgets/adw-toggle-group.d.ts +2 -0
  77. package/lib/types/widgets/adw-toggle.d.ts +2 -0
  78. package/lib/types/widgets/adw-toolbar-view.d.ts +2 -0
  79. package/lib/types/widgets/adw-view-stack.d.ts +2 -0
  80. package/lib/types/widgets/adw-view-switcher-bar.d.ts +2 -0
  81. package/lib/types/widgets/adw-window-title.d.ts +2 -0
  82. package/lib/types/widgets/adw-wrap-box.d.ts +2 -0
  83. package/lib/types/widgets/bin-layout.d.ts +12 -0
  84. package/lib/types/widgets/box-layout.d.ts +37 -0
  85. package/lib/types/widgets/carousel-indicator-base.d.ts +2 -0
  86. package/lib/types/widgets/css-names.d.ts +9 -0
  87. package/lib/types/widgets/gtk-action-bar.d.ts +2 -0
  88. package/lib/types/widgets/gtk-box.d.ts +11 -5
  89. package/lib/types/widgets/gtk-button.d.ts +8 -5
  90. package/lib/types/widgets/gtk-drop-down.d.ts +2 -0
  91. package/lib/types/widgets/gtk-entry.d.ts +64 -34
  92. package/lib/types/widgets/gtk-image.d.ts +2 -0
  93. package/lib/types/widgets/gtk-label.d.ts +26 -0
  94. package/lib/types/widgets/gtk-menu-button.d.ts +33 -18
  95. package/lib/types/widgets/gtk-popover-menu.d.ts +9 -7
  96. package/lib/types/widgets/gtk-scrolled-window.d.ts +9 -0
  97. package/lib/types/widgets/gtk-stack.d.ts +2 -0
  98. package/lib/types/widgets/gtk-text-view.d.ts +2 -0
  99. package/lib/types/widgets/index.d.ts +1 -2
  100. package/lib/types/widgets/label-markup-native.android.d.ts +5 -0
  101. package/lib/types/widgets/label-markup-native.d.ts +19 -0
  102. package/lib/types/widgets/label-markup-native.ios.d.ts +5 -0
  103. package/lib/types/widgets/label-markup.d.ts +62 -1
  104. package/lib/types/widgets/menu-slot.d.ts +51 -0
  105. package/lib/types/widgets/popup-menu-view.d.ts +3 -2
  106. package/lib/types/widgets/popup-menu.d.ts +8 -6
  107. package/lib/types/widgets/scrolled-window-policy.d.ts +4 -2
  108. package/lib/types/widgets/signals.d.ts +2 -0
  109. package/lib/types/widgets/single-child-base.d.ts +3 -0
  110. package/lib/types/widgets/single-child-cell.d.ts +10 -5
  111. package/lib/types/widgets/split-view-base.d.ts +2 -0
  112. package/lib/types/widgets/stack-page.d.ts +2 -0
  113. package/lib/types/widgets/styled-layout-base.d.ts +2 -0
  114. package/lib/types/widgets/view-stack-page.d.ts +2 -0
  115. package/lib/types/widgets/view-switcher-base.d.ts +2 -0
  116. package/lib/types/widgets/widget-layout.d.ts +2 -0
  117. package/package.json +20 -15
  118. package/src/testing/ns-core.mts +58 -0
  119. package/src/theme/adwaita.css +24 -11
@@ -1,26 +1,30 @@
1
- import { GridLayout, TextField, type EventData } from '@nativescript/core';
1
+ import { GridLayout, TextField } from '@nativescript/core';
2
2
  import { type ConstructProps } from './construct-props.js';
3
+ import { type GObjectNotify } from './signals.js';
3
4
  /** Event name emitted when {@link GtkEntry.text} changes. Mirrors GObject `notify::text`. */
4
5
  export declare const NOTIFY_TEXT = "notify::text";
6
+ /** Event name emitted when {@link GtkEntry.textLength} changes. Mirrors `notify::text-length`. */
7
+ export declare const NOTIFY_TEXT_LENGTH = "notify::text-length";
8
+ /** Event name emitted when {@link GtkEntry.maxLength} changes. Mirrors `notify::max-length`. */
9
+ export declare const NOTIFY_MAX_LENGTH = "notify::max-length";
10
+ /** Event name emitted when {@link GtkEntry.placeholderText} changes. */
11
+ export declare const NOTIFY_PLACEHOLDER_TEXT = "notify::placeholder-text";
12
+ /** Event name emitted when {@link GtkEntry.editable} changes. */
13
+ export declare const NOTIFY_EDITABLE = "notify::editable";
5
14
  /** Event name emitted when the return key is pressed — `Gtk.Entry::activate`. */
6
15
  export declare const ACTIVATE = "activate";
7
16
  /** `Gtk.Editable::changed` — every change of the text, typed or set. */
8
17
  export declare const CHANGED = "changed";
9
- /** Payload of the `notify::text` event. */
10
- export interface NotifyEntryTextEventData extends EventData {
11
- /** The new text value (already truncated to `maxLength`). */
12
- text: string;
13
- /** The new number of CHARACTERS (not UTF-16 units). */
14
- textLength: number;
15
- }
16
18
  declare const GtkEntry_base: ((abstract new (...args: any[]) => {
17
- addEventListener(eventName: string, callback: (data: EventData) => void, thisArg?: unknown, once?: boolean): void;
18
- removeEventListener(eventName: string, callback?: (data: EventData) => void, thisArg?: unknown): void;
19
- connect(eventName: string, callback: (self: /*elided*/ any, data: EventData) => unknown): number;
19
+ addEventListener(eventName: string, callback: (data: import("@nativescript/core").EventData) => void, thisArg?: unknown, once?: boolean): void;
20
+ removeEventListener(eventName: string, callback?: (data: import("@nativescript/core").EventData) => void, thisArg?: unknown): void;
21
+ connect(eventName: string, callback: (self: /*elided*/ any, data: import("@nativescript/core").EventData) => unknown): number;
20
22
  disconnect(handlerId: number): void;
21
23
  emit(eventName: string, ...args: unknown[]): void;
22
24
  get_property(name: string): unknown;
23
25
  set_property(name: string, value: unknown): void;
26
+ get cssType(): string | undefined;
27
+ set cssType(value: string | undefined);
24
28
  get halign(): string;
25
29
  set halign(value: string | number);
26
30
  get valign(): string;
@@ -71,7 +75,7 @@ declare const GtkEntry_base: ((abstract new (...args: any[]) => {
71
75
  set_focus_on_click(focusOnClick: boolean): void;
72
76
  grab_focus(): boolean;
73
77
  _emit(eventName: string): void;
74
- notify<T extends EventData>(data: T): void;
78
+ notify<T extends import("@nativescript/core").EventData>(data: T): void;
75
79
  notifyPropertyChange(name: string, value: unknown, oldValue?: unknown): void;
76
80
  set(name: string, value: unknown): void;
77
81
  get(name: string): unknown;
@@ -80,35 +84,61 @@ declare const GtkEntry_base: ((abstract new (...args: any[]) => {
80
84
  }) & typeof GridLayout;
81
85
  export declare class GtkEntry extends GtkEntry_base {
82
86
  static readonly GTypeName: string;
83
- /** The GTK signals this widget emits through `connect` — read by the shared-tree builder (ADR 0093). */
84
- static readonly emittedSignals: readonly string[];
85
87
  /** The real input. Chrome-less: the box around it paints the Adwaita surface. */
86
88
  protected readonly _field: TextField;
87
- private _text;
88
- private _maxLength;
89
- constructor(props?: ConstructProps<GtkEntry>);
90
89
  /**
91
- * Truncate, write the field, and notify on a real change.
90
+ * Whether the write being applied came from the keyboard. It decides the ORDER
91
+ * {@link _applyText} emits in, and nothing else — see the module header's measurement.
92
+ */
93
+ private _typing;
94
+ /** The entry's contents, truncated to {@link maxLength}. Declared above; the seam installs it. */
95
+ text: string;
96
+ /**
97
+ * `Gtk.Entry:text-length` — the number of CHARACTERS, not UTF-16 units, so `'🔒é'` is 2.
92
98
  *
93
- * Writing the field re-enters through `textChange`; the nested call finds the
94
- * text already applied and settles it, and the outer one then sees its own
95
- * value in `_text` and stops — so a truncated keystroke notifies exactly once.
99
+ * READ-ONLY, as upstream declares it: a write is normalized back to the count derived from
100
+ * this entry's own {@link text} and so changes nothing (see the declaration). Not `readonly`
101
+ * in TypeScript, because the seam installs one accessor pair per declared property and this
102
+ * widget is what writes the derived value.
96
103
  */
97
- private _applyText;
98
- /** The editable text. */
99
- get text(): string;
100
- set text(value: string);
101
- /** The number of CHARACTERS in {@link text}, not UTF-16 units. */
102
- get textLength(): number;
103
- /** Maximum number of characters, `0` = unlimited. */
104
- get maxLength(): number;
105
- set maxLength(raw: number | string);
104
+ textLength: number;
105
+ /** `Gtk.Entry:max-length` — maximum number of characters, `0` = unlimited. */
106
+ maxLength: number;
106
107
  /** Placeholder shown while the entry is empty (`Gtk.Entry:placeholder-text`). */
107
- get placeholderText(): string;
108
- set placeholderText(value: string);
108
+ placeholderText: string;
109
109
  /** Whether the entry accepts edits (`GtkEditable:editable`). */
110
- get editable(): boolean;
111
- set editable(raw: boolean | string);
110
+ editable: boolean;
111
+ /** GJS's `notify('<prop>')` beside NativeScript's `notify({ eventName })`; see the seam. */
112
+ notify: GObjectNotify;
113
+ constructor(props?: ConstructProps<GtkEntry>);
114
+ /**
115
+ * What a `text` write does once the seam holds the normalized value: push the field, move
116
+ * the derived length, and emit in the MEASURED order.
117
+ *
118
+ * Writing the field re-enters through `textChange`, which writes this very value back; the
119
+ * seam's equal-write rule drops it, and that is what retired the old re-entrancy funnel.
120
+ * The origin is read BEFORE that write, because the handler it re-enters assigns `_typing`
121
+ * and the flag is no longer this call's once the field has been touched.
122
+ */
123
+ private _applyText;
124
+ /**
125
+ * What a `max-length` write does: re-run the held text against the new ceiling, so a
126
+ * SHRINKING limit truncates what is already there, and only then announce the limit —
127
+ * `changed`, `notify::text`, `notify::max-length`, as measured.
128
+ */
129
+ private _applyMaxLength;
130
+ /** `placeholder-text` reaches the field's hint and nothing else. */
131
+ private _applyPlaceholderText;
132
+ /** `editable` gates the keyboard only — see the declaration. */
133
+ private _applyEditable;
134
+ /** `gtk_editable_get_text`. */
135
+ get_text(): string;
136
+ /** `gtk_editable_set_text`. */
137
+ set_text(text: string): void;
138
+ /** `gtk_entry_get_max_length`. */
139
+ get_max_length(): number;
140
+ /** `gtk_entry_set_max_length`. */
141
+ set_max_length(max: number): void;
112
142
  /** The inner `TextField` — for focus, selection and host-specific keyboard options. */
113
143
  get field(): TextField;
114
144
  }
@@ -19,6 +19,8 @@ declare const GtkImage_base: ((abstract new (...args: any[]) => {
19
19
  emit(eventName: string, ...args: unknown[]): void;
20
20
  get_property(name: string): unknown;
21
21
  set_property(name: string, value: unknown): void;
22
+ get cssType(): string | undefined;
23
+ set cssType(value: string | undefined);
22
24
  get halign(): string;
23
25
  set halign(value: string | number);
24
26
  get valign(): string;
@@ -3,6 +3,23 @@ import { type LabelEllipsizeMode, type LabelJustification } from '@gjsify/adwait
3
3
  import { type ConstructProps } from './construct-props.js';
4
4
  /** Event name emitted when a link in the markup is tapped, before it is opened. */
5
5
  export declare const ACTIVATE_LINK = "activate-link";
6
+ /**
7
+ * `Gtk.Label:xalign` on a TEMPLATE CHILD — a plain `@nativescript/core` `Label` an Adw widget
8
+ * builds inside itself, standing in for a `<object class="GtkLabel">` in the upstream `.ui`.
9
+ *
10
+ * WHY IT EXISTS AND WHY IT IS NOT A NO-OP AT 0. The platform's own default is start-aligned, so
11
+ * `0` writes the word the view already had; the point is that the widget now STATES the alignment
12
+ * its upstream template states, instead of agreeing with it by accident. Upstream rows read
13
+ * left-aligned because `adw-action-row.ui` and its siblings each say `<property name="xalign">0`,
14
+ * not because GTK's default is 0 — it is 0.5 — and a port that leaves them implicit cannot be read
15
+ * against the `.ui` file that is its specification.
16
+ *
17
+ * START IS `'initial'`, NOT `'left'`: GTK's 0 is the START edge and mirrors in RTL, and `'initial'`
18
+ * is the platform's own direction-aware start. Only `0` and `0.5` are here, which is every value
19
+ * libadwaita's templates put on a label; `1` belongs to `adw-spin-row.ui`'s `GtkSpinButton`, an
20
+ * entry's `xalign` and not this one.
21
+ */
22
+ export declare function applyTemplateXalign(label: Label, xalign: 0 | 0.5): void;
6
23
  declare const GtkLabel_base: ((abstract new (...args: any[]) => {
7
24
  addEventListener(eventName: string, callback: (data: EventData) => void, thisArg?: unknown, once?: boolean): void;
8
25
  removeEventListener(eventName: string, callback?: (data: EventData) => void, thisArg?: unknown): void;
@@ -11,6 +28,8 @@ declare const GtkLabel_base: ((abstract new (...args: any[]) => {
11
28
  emit(eventName: string, ...args: unknown[]): void;
12
29
  get_property(name: string): unknown;
13
30
  set_property(name: string, value: unknown): void;
31
+ get cssType(): string | undefined;
32
+ set cssType(value: string | undefined);
14
33
  get halign(): string;
15
34
  set halign(value: string | number);
16
35
  get valign(): string;
@@ -204,6 +223,13 @@ export declare class GtkLabel extends GtkLabel_base {
204
223
  set_css_classes(names: readonly string[]): void;
205
224
  private _setClasses;
206
225
  private _render;
226
+ /**
227
+ * `TextBase._setNativeText` — the one place every text write ends in, and therefore the
228
+ * seam the native markup path draws at. Refused by every host but Android, which then
229
+ * leaves the framework's own `formattedText`/`text` implementation in charge:
230
+ * `label-markup-native.ts`.
231
+ */
232
+ _setNativeText(reset?: boolean): void;
207
233
  /**
208
234
  * `emit_activate_link` for the link at `index`: the user's handlers under GTK's handled
209
235
  * accumulator, then — only if none handled it — the default launch.
@@ -1,4 +1,4 @@
1
- import type { AdwMenuActions, AdwMenuInput, AdwMenuModel } from '@gjsify/adwaita-core';
1
+ import type { AdwMenuActions, AdwMenuModel } from '@gjsify/adwaita-core';
2
2
  import type { EventData } from '@nativescript/core';
3
3
  import { AdwImageButton } from './adw-image-button.js';
4
4
  import { type ConstructProps } from './construct-props.js';
@@ -18,9 +18,36 @@ export interface MenuItemActivatedEventData extends EventData {
18
18
  /** The chosen item's detailed action name, when the item carried one. */
19
19
  action?: string;
20
20
  }
21
- export declare class GtkMenuButton extends AdwImageButton {
21
+ declare const GtkMenuButton_base: ((abstract new (...args: any[]) => {
22
+ _emit(eventName: string): void;
23
+ addEventListener(eventName: string, callback: (data: EventData) => void, thisArg?: unknown, once?: boolean): void;
24
+ removeEventListener(eventName: string, callback?: (data: EventData) => void, thisArg?: unknown): void;
25
+ notify<T extends EventData>(data: T): void;
26
+ notifyPropertyChange(name: string, value: unknown, oldValue?: unknown): void;
27
+ set(name: string, value: unknown): void;
28
+ get(name: string): unknown;
29
+ }) & {
30
+ readonly emittedSignals: readonly string[];
31
+ }) & typeof AdwImageButton;
32
+ export declare class GtkMenuButton extends GtkMenuButton_base {
22
33
  static readonly GTypeName: string;
23
- private _model;
34
+ /**
35
+ * The menu — a real `Gio.MenuModel` since ADR 0128 — opened as an Android `PopupMenu`
36
+ * on tap. `null` is the one spelling of "no menu".
37
+ *
38
+ * IT TAKES A MODEL AND NOTHING ELSE: `Gio.Menu` from this package's `Gio` namespace, or
39
+ * `buildMenu([…])` for the authored shorthands (a bare `string[]` included). An array
40
+ * written straight here is refused by the GObject value check, word for word as GJS
41
+ * refuses it. A JSON STRING is refused too, with its own message — see
42
+ * `AdwSplitButton.menuModel` for why the XML door stays shut until a probe can prove
43
+ * it, and why being shut is not the same as being silent.
44
+ *
45
+ * A CHANGE IS `notify::menu-model` through {@link connect}, not the NativeScript
46
+ * `menuModelChange` this property emitted while it was hand-rolled.
47
+ */
48
+ menuModel: AdwMenuModel | null;
49
+ /** The menu this button holds, with its `items-changed` watcher and the tree the popup reads. */
50
+ private readonly _slot;
24
51
  private _actions;
25
52
  private _menuTitle;
26
53
  private _primary;
@@ -28,21 +55,8 @@ export declare class GtkMenuButton extends AdwImageButton {
28
55
  private readonly _baseClassName;
29
56
  private _styleClasses;
30
57
  constructor(props?: ConstructProps<GtkMenuButton>);
31
- /**
32
- * The menu, normalised (ADR 0042) — opened as an Android `PopupMenu` on tap.
33
- *
34
- * Accepts every input form the portable model does, a bare `string[]` included —
35
- * but NOT a JSON string; see `AdwSplitButton.menuModel` for why the XML door stays
36
- * shut until a probe can prove it, and why being shut is not the same as being
37
- * silent.
38
- */
39
- get menuModel(): AdwMenuModel;
40
- set menuModel(value: AdwMenuInput);
41
- /** `Gtk.MenuButton:menu-model` — the GIR spelling of {@link menuModel}. */
42
- get menu_model(): AdwMenuModel;
43
- set menu_model(value: AdwMenuInput);
44
- get_menu_model(): AdwMenuModel;
45
- set_menu_model(value: AdwMenuInput): void;
58
+ get_menu_model(): AdwMenuModel | null;
59
+ set_menu_model(value: AdwMenuModel | null): void;
46
60
  /**
47
61
  * What the action group publishes about the actions this menu names — the portable
48
62
  * stand-in for a `GActionGroup`. Left `null`, the registry above the button answers
@@ -80,3 +94,4 @@ export declare class GtkMenuButton extends AdwImageButton {
80
94
  private _setClasses;
81
95
  private _openMenu;
82
96
  }
97
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { Observable, type EventData } from '@nativescript/core';
2
- import type { AdwMenuActions, AdwMenuInput, AdwMenuModel } from '@gjsify/adwaita-core';
2
+ import type { AdwMenuActions, AdwMenuModel } from '@gjsify/adwaita-core';
3
3
  import type { ActionHost } from './actions.js';
4
4
  import { type ConstructProps } from './construct-props.js';
5
5
  /** `GtkPopover::closed`, emitted when the menu goes away. */
@@ -12,6 +12,8 @@ declare const GtkPopoverMenu_base: ((abstract new (...args: any[]) => {
12
12
  emit(eventName: string, ...args: unknown[]): void;
13
13
  get_property(name: string): unknown;
14
14
  set_property(name: string, value: unknown): void;
15
+ get cssType(): string | undefined;
16
+ set cssType(value: string | undefined);
15
17
  get halign(): string;
16
18
  set halign(value: string | number);
17
19
  get valign(): string;
@@ -71,16 +73,16 @@ declare const GtkPopoverMenu_base: ((abstract new (...args: any[]) => {
71
73
  }) & typeof Observable;
72
74
  export declare class GtkPopoverMenu extends GtkPopoverMenu_base {
73
75
  static readonly GTypeName: string;
74
- private _model;
76
+ private readonly _slot;
75
77
  private _actions;
76
78
  private _parent;
77
79
  private _open;
78
80
  constructor(props?: ConstructProps<GtkPopoverMenu>);
79
- /** `Gtk.PopoverMenu:menu-model`. */
80
- get menuModel(): AdwMenuModel;
81
- set menuModel(value: AdwMenuInput);
82
- set_menu_model(model: AdwMenuInput | null): void;
83
- get_menu_model(): AdwMenuModel;
81
+ /** `Gtk.PopoverMenu:menu-model` — a real `Gio.MenuModel`, or `null` (ADR 0128). */
82
+ get menuModel(): AdwMenuModel | null;
83
+ set menuModel(value: AdwMenuModel | null);
84
+ set_menu_model(model: AdwMenuModel | null): void;
85
+ get_menu_model(): AdwMenuModel | null;
84
86
  /** What the action group publishes about the actions this menu names; see `GtkMenuButton.actions`. */
85
87
  get actions(): AdwMenuActions | null;
86
88
  set actions(value: AdwMenuActions | null);
@@ -10,6 +10,11 @@ export declare class GtkScrolledWindow extends AdwSingleChildBase {
10
10
  private readonly _scroll;
11
11
  /** The box the child really goes in — see "THE CHILD IS NOT THE CONTENT" in the header. */
12
12
  private readonly _viewport;
13
+ /** The horizontal half of a two-axis window — see "TWO AXES" in the header. */
14
+ private readonly _hscroll;
15
+ /** The box the child goes in once `_hscroll` is in play, for the same margin reason. */
16
+ private readonly _hbox;
17
+ private _nested;
13
18
  private _hscrollbarPolicy;
14
19
  private _vscrollbarPolicy;
15
20
  private _hasFrame;
@@ -46,6 +51,10 @@ export declare class GtkScrolledWindow extends AdwSingleChildBase {
46
51
  /** `Gtk.ScrolledWindow:has-frame` — held and read back; no frame is drawn (see the header). */
47
52
  get hasFrame(): boolean;
48
53
  set hasFrame(raw: boolean | string);
54
+ /** The view that scrolls sideways: the inner one of a two-axis window, else the only one. */
55
+ private get _horizontalScroller();
56
+ /** Where the child sits: the viewport box, or the horizontal scroller's box inside it. */
57
+ private get _holder();
49
58
  protected _adopt(view: View): void;
50
59
  protected _release(view: View): void;
51
60
  private _applyOrientation;
@@ -19,6 +19,8 @@ declare const GtkStack_base: ((abstract new (...args: any[]) => {
19
19
  emit(eventName: string, ...args: unknown[]): void;
20
20
  get_property(name: string): unknown;
21
21
  set_property(name: string, value: unknown): void;
22
+ get cssType(): string | undefined;
23
+ set cssType(value: string | undefined);
22
24
  get halign(): string;
23
25
  set halign(value: string | number);
24
26
  get valign(): string;
@@ -21,6 +21,8 @@ declare const GtkTextView_base: ((abstract new (...args: any[]) => {
21
21
  emit(eventName: string, ...args: unknown[]): void;
22
22
  get_property(name: string): unknown;
23
23
  set_property(name: string, value: unknown): void;
24
+ get cssType(): string | undefined;
25
+ set cssType(value: string | undefined);
24
26
  get halign(): string;
25
27
  set halign(value: string | number);
26
28
  get valign(): string;
@@ -4,8 +4,7 @@ export { AdwActionRow } from './adw-action-row.js';
4
4
  export { AdwSwitchRow, NOTIFY_ACTIVE } from './adw-switch-row.js';
5
5
  export { AdwEntryRow, NOTIFY_TEXT, NOTIFY_TEXT_LENGTH, NOTIFY_MAX_LENGTH, NOTIFY_EDITABLE, NOTIFY_SHOW_APPLY_BUTTON, NOTIFY_ACTIVATES_DEFAULT, SIGNAL_APPLY, SIGNAL_ENTRY_ACTIVATED, } from './adw-entry-row.js';
6
6
  export { AdwPasswordEntryRow } from './adw-password-entry-row.js';
7
- export { GtkEntry, ACTIVATE as ENTRY_ACTIVATE, NOTIFY_TEXT as NOTIFY_ENTRY_TEXT } from './gtk-entry.js';
8
- export type { NotifyEntryTextEventData } from './gtk-entry.js';
7
+ export { GtkEntry, ACTIVATE as ENTRY_ACTIVATE, CHANGED as ENTRY_CHANGED, NOTIFY_TEXT as NOTIFY_ENTRY_TEXT, NOTIFY_TEXT_LENGTH as NOTIFY_ENTRY_TEXT_LENGTH, NOTIFY_MAX_LENGTH as NOTIFY_ENTRY_MAX_LENGTH, NOTIFY_PLACEHOLDER_TEXT, NOTIFY_EDITABLE as NOTIFY_ENTRY_EDITABLE, } from './gtk-entry.js';
9
8
  export { AdwComboRow, ComboState, NOTIFY_SELECTED } from './adw-combo-row.js';
10
9
  export type { AdwComboOption, ComboStateChange, ComboStateListener } from './adw-combo-row.js';
11
10
  export { GtkDropDown, NOTIFY_SELECTED as NOTIFY_DROP_DOWN_SELECTED } from './gtk-drop-down.js';
@@ -0,0 +1,5 @@
1
+ import { type LabelMarkupNativeText } from './label-markup.js';
2
+ /** Rationale and contract: `label-markup-native.ts`. */
3
+ export declare function labelMarkupHoldNative(label: object, text: LabelMarkupNativeText | null): boolean;
4
+ /** Rationale and contract: `label-markup-native.ts`. */
5
+ export declare function labelMarkupDrawNative(label: object, reset: boolean): boolean;
@@ -0,0 +1,19 @@
1
+ import type { LabelMarkupNativeText } from './label-markup.js';
2
+ /**
3
+ * Record the markup `label` must draw natively, or clear it with `null` — answers whether
4
+ * this host draws its own styled text at all, so a caller can take the `FormattedString`
5
+ * path on the same condition it would take it on.
6
+ *
7
+ * A host that answers `true` here MUST answer `true` from {@link labelMarkupDrawNative}
8
+ * for as long as something is held, and the caller may rely on that: nothing re-reads the
9
+ * markup between the hold and the write.
10
+ */
11
+ export declare function labelMarkupHoldNative(_label: object, _text: LabelMarkupNativeText | null): boolean;
12
+ /**
13
+ * Draw the held markup into `label`'s native text view — `false` when there is nothing held
14
+ * or this host has no such text, and then the caller lets `TextBase._setNativeText` run.
15
+ *
16
+ * `reset` is the platform's own "clear the text" call, which no styled text can answer:
17
+ * it is always refused so the base implementation clears the view.
18
+ */
19
+ export declare function labelMarkupDrawNative(_label: object, _reset: boolean): boolean;
@@ -0,0 +1,5 @@
1
+ import type { LabelMarkupNativeText } from './label-markup.js';
2
+ /** Record what `label` must draw natively — iOS draws none. See {@link labelMarkupHoldNative}. */
3
+ export declare function labelMarkupHoldNative(_label: object, _text: LabelMarkupNativeText | null): boolean;
4
+ /** Draw the held markup — iOS holds none. See {@link labelMarkupDrawNative}. */
5
+ export declare function labelMarkupDrawNative(_label: object, _reset: boolean): boolean;
@@ -1,5 +1,66 @@
1
1
  import { FormattedString, Span } from '@nativescript/core';
2
- import { type LabelMarkupRender, type LabelMarkupRun } from '@gjsify/adwaita-core';
2
+ import { type LabelMarkupRender, type LabelMarkupRun, type LabelMarkupStyle } from '@gjsify/adwaita-core';
3
+ /**
4
+ * The native FACE one run asks for: the typeface, the two lines, the baseline and the font
5
+ * factor, with pango's tags and `<span>` attributes already resolved against each other.
6
+ *
7
+ * WHY A SECOND SHAPE BESIDE {@link labelMarkupSpan}. A `Span` IS the shape on the surfaces
8
+ * that go through a `FormattedString`, so there the resolution and the write are one
9
+ * function. Android's spans are not a shape at all — `TypefaceSpan`, `StyleSpan`,
10
+ * `UnderlineSpan`, `RelativeSizeSpan` are independent objects over a RANGE of one
11
+ * builder — so the decisions have to be readable before anything native exists, which is
12
+ * also what makes them assertable off a device. `label-markup-native.android.ts` turns one
13
+ * face into those spans and decides nothing else.
14
+ *
15
+ * THE SCALE IS RELATIVE, which is what pango's is. `<big>` is a FACTOR
16
+ * (`PANGO_SCALE_LARGE`), so a platform with a relative span needs no base size and drops
17
+ * nothing — where the `Span` path's `fontSize` is an absolute number of DIPs and has to
18
+ * resolve the factor against a size something has written, which is why it SKIPS the scale
19
+ * when nothing has (see the header). The same markup is therefore more faithful on the
20
+ * native path, not differently faithful; the measured corpus has no `<big>`/`<small>` at
21
+ * all, so no label in it renders differently either way.
22
+ *
23
+ * THE WEIGHT LADDER COLLAPSES TO BOLD, declared rather than approximated: Android picks a
24
+ * weight with `Typeface.create(family, weight, italic)` from API 28 and has nothing but
25
+ * `Typeface.BOLD` below it, and this port supports API 24. So pango's named and numeric
26
+ * weights are read and answered as bold from {@link BOLD_FROM} up. `semilight`, `book` and
27
+ * `ultraheavy` are dropped, which is the same answer {@link SPAN_WEIGHTS} gives them.
28
+ */
29
+ export interface LabelMarkupFace {
30
+ /** The typeface family, or `undefined` for the view's own. `<tt>` is `monospace`. */
31
+ readonly family: string | undefined;
32
+ readonly bold: boolean;
33
+ readonly italic: boolean;
34
+ readonly underline: boolean;
35
+ readonly strikethrough: boolean;
36
+ /** `<sub>` / `<sup>` — a baseline shift, not a size. */
37
+ readonly script: 'sub' | 'sup' | null;
38
+ /** The font factor `<big>`, `<small>`, `<sub>` and `<sup>` multiply up to. 1 means none. */
39
+ readonly scale: number;
40
+ }
41
+ /**
42
+ * One run's style as the face a native span-setter writes.
43
+ *
44
+ * The `<span>` attributes are read OUTERMOST FIRST and the pango tags after, so a tag wins
45
+ * a collision — the same declared order {@link labelMarkupSpan} applies, for the same
46
+ * reason: the runs record the tags as booleans and the `<span>`s as a separate stack, so
47
+ * neither renderer can know which element was inner.
48
+ */
49
+ export declare function labelMarkupFace(style: LabelMarkupStyle, link: boolean): LabelMarkupFace;
50
+ /**
51
+ * A label's markup as the platform half of this package has to DRAW it — everything
52
+ * `label-markup-native.ts` needs and nothing a `FormattedString` would add.
53
+ *
54
+ * `onLinkTap` rather than the links themselves: following a link is the widget's decision
55
+ * (`GtkLabel._activateLink` runs `::activate-link` under GTK's handled accumulator), and a
56
+ * span-setter that reached for `render.links[i].href` would be making it a second time.
57
+ */
58
+ export interface LabelMarkupNativeText {
59
+ readonly render: LabelMarkupRender;
60
+ /** `use-underline` — whether the mnemonic marker is stripped out of each run's text. */
61
+ readonly mnemonics: boolean;
62
+ onLinkTap(index: number): void;
63
+ }
3
64
  /**
4
65
  * One run as one `Span`.
5
66
  *
@@ -0,0 +1,51 @@
1
+ import type { AdwMenuTree, GioMenuModel } from '@gjsify/adwaita-core';
2
+ export declare class MenuSlot {
3
+ private readonly widget;
4
+ private readonly onItemsChanged;
5
+ private readonly _authored;
6
+ private _model;
7
+ private _tree;
8
+ private _unwatch;
9
+ /**
10
+ * @param widget the class name {@link refuseMenuString} names in its refusal.
11
+ * @param onItemsChanged what to do when the HELD menu mutates under the widget.
12
+ */
13
+ constructor(widget: string, onItemsChanged: () => void);
14
+ /** The model itself, by identity — what `menuModel` answers. */
15
+ get model(): GioMenuModel | null;
16
+ /** The snapshot `planPopupMenu` reads. Re-taken on each `items-changed`, never aliased. */
17
+ get tree(): AdwMenuTree;
18
+ /**
19
+ * Whether there is anything to show — NOT whether there is a menu.
20
+ *
21
+ * `null` and an empty `Gio.Menu` are different menus, and on GTK they behave
22
+ * differently: an empty non-null model still builds a `GtkPopoverMenu` (measured,
23
+ * `MENU_MODEL_DOOR_VECTORS`). A `PopupMenu` with no items draws no window at all, so
24
+ * this is the question the TAP asks, and the widgets ask `model === null` where GTK asks
25
+ * about the model.
26
+ */
27
+ get isEmpty(): boolean;
28
+ /**
29
+ * READ a property write without holding it: a real model by identity, `null` for no menu —
30
+ * and a `TypeError` for a string, an array or anything else, which this door does not take
31
+ * (`buildMenu` is how an array becomes a model now).
32
+ *
33
+ * The refusal is a THROW because a property assignment is a call: whoever wrote the
34
+ * menu is on the stack and can hear it. There is no second, quieter door here the way
35
+ * the browser has one for markup.
36
+ *
37
+ * SPLIT FROM {@link adopt} for the seam: a declared property reads the write in `normalize`,
38
+ * ahead of the store and of the equal-write check, and takes the value on in `afterNotify`,
39
+ * which runs only for a write that moved (`signals.ts`). A single `write` would snapshot and
40
+ * re-watch on every write including an equal one, which is a notify the measurement says
41
+ * `Adw.SplitButton` does not make.
42
+ */
43
+ read(value: unknown): GioMenuModel | null;
44
+ /**
45
+ * {@link read} and {@link adopt} in one — the door for a widget whose `menuModel` the seam
46
+ * does NOT own (`gtk-popover-menu.ts`).
47
+ */
48
+ write(value: unknown): void;
49
+ /** Hold `next`, snapshot it, and listen to it — the three that always happen together. */
50
+ adopt(next: GioMenuModel | null): void;
51
+ }
@@ -1,8 +1,9 @@
1
- import type { AdwMenuActions, AdwMenuItem, AdwMenuModel, AdwMenuPath } from '@gjsify/adwaita-core';
1
+ import type { AdwMenuActions, AdwMenuItem, AdwMenuPath, AdwMenuTree } from '@gjsify/adwaita-core';
2
2
  import { type ActionHost } from './actions.js';
3
3
  import { type PopupMenuSurface } from './popup-menu.js';
4
4
  export interface MenuPopupOptions {
5
- readonly model: AdwMenuModel;
5
+ /** The SNAPSHOT of the menu model, as `MenuSlot.tree` holds it (ADR 0128 § 3). */
6
+ readonly tree: AdwMenuTree;
6
7
  /** What the application wrote itself; absent, the registry above `anchor` answers. */
7
8
  readonly actions?: AdwMenuActions | null;
8
9
  /** A leaf item was chosen, after its action fired. */
@@ -1,4 +1,4 @@
1
- import type { AdwMenuActions, AdwMenuModel, AdwMenuPath, PopupMenuLevelPlan, PopupMenuPlan } from '@gjsify/adwaita-core';
1
+ import type { AdwMenuActions, AdwMenuPath, AdwMenuTree, PopupMenuLevelPlan, PopupMenuPlan } from '@gjsify/adwaita-core';
2
2
  /** The `MenuItem` calls the driver makes. */
3
3
  export interface PopupMenuItemLike {
4
4
  setEnabled(enabled: boolean): unknown;
@@ -33,7 +33,8 @@ export declare const GROUP_DIVIDER_API = 28;
33
33
  export declare function fillPopupMenu(menu: PopupMenuLike, level: PopupMenuLevelPlan, apiLevel: number): Map<number, AdwMenuPath>;
34
34
  export interface OpenPopupMenuOptions {
35
35
  readonly surface: PopupMenuSurface;
36
- readonly model: AdwMenuModel;
36
+ /** The SNAPSHOT of the menu model, as `MenuSlot.tree` holds it (ADR 0128 § 3). */
37
+ readonly tree: AdwMenuTree;
37
38
  /** What {@link resolveMenuItemState} reads; from `menuActionsFor` it is the registry's. */
38
39
  readonly actions?: AdwMenuActions;
39
40
  /** A tap on a leaf item, with its model path. Fire the action here (`activateMenuItem`). */
@@ -46,14 +47,15 @@ export interface OpenPopupMenuOptions {
46
47
  */
47
48
  export declare function openPopupMenu(options: OpenPopupMenuOptions): PopupMenuPlan;
48
49
  /**
49
- * Throw if `model` holds what `PopupMenu` can never draw, at the ASSIGNMENT: a `custom` item or a
50
+ * Throw if `tree` holds what `PopupMenu` can never draw, at the ASSIGNMENT: a `custom` item or a
50
51
  * section label. A radio run that shares a group needs the actions to be known, so it throws when
51
52
  * the menu is opened.
52
53
  */
53
- export declare function assertPopupMenuAssignable(model: AdwMenuModel): void;
54
+ export declare function assertPopupMenuAssignable(tree: AdwMenuTree): void;
54
55
  /**
55
56
  * A JSON string is not a menu model here: NativeScript's XML Builder writes an attribute straight
56
- * onto the property, so accepting one would open an XML door nothing can prove, and
57
- * `normalizeMenuModel` would turn it into an EMPTY menu with nothing saying why.
57
+ * onto the property, so accepting one would open an XML door nothing can prove. Since ADR 0128
58
+ * the core's door DOES parse one — that is how the browser's `menu-model` attribute works — so
59
+ * this stays in front of it rather than relying on a refusal the shared door no longer makes.
58
60
  */
59
61
  export declare function refuseMenuString(value: unknown, widget: string): void;
@@ -9,9 +9,11 @@ export declare function policyScrolls(policy: GtkPolicyNick): boolean;
9
9
  /**
10
10
  * The one axis the `ScrollView` scrolls on, for a pair of policies.
11
11
  *
12
- * Vertical wins a tie, because that is the axis a page of content grows on; a window that
13
- * scrolls ONLY horizontally is the one case that flips it. Neither axis scrolling still
12
+ * Vertical wins a tie, because that is the axis a page of content grows on and the outer view
13
+ * of a two-axis window; a window that scrolls ONLY horizontally is the one case that flips it. Neither axis scrolling still
14
14
  * answers `vertical` — a `ScrollView` cannot refuse to scroll, so the child is simply held
15
15
  * at its natural size by the surrounding layout.
16
16
  */
17
17
  export declare function scrollOrientationFor(hscrollbarPolicy: GtkPolicyNick, vscrollbarPolicy: GtkPolicyNick): 'horizontal' | 'vertical';
18
+ /** Whether both axes scroll, which is when the window needs the second, nested `ScrollView`. */
19
+ export declare function scrollsBothAxes(hscrollbarPolicy: GtkPolicyNick, vscrollbarPolicy: GtkPolicyNick): boolean;
@@ -147,6 +147,8 @@ export declare function withSignals<TBase extends ObservableConstructor>(Base: T
147
147
  emit(eventName: string, ...args: unknown[]): void;
148
148
  get_property(name: string): unknown;
149
149
  set_property(name: string, value: unknown): void;
150
+ get cssType(): string | undefined;
151
+ set cssType(value: string | undefined);
150
152
  get halign(): string;
151
153
  set halign(value: string | number);
152
154
  get valign(): string;
@@ -4,10 +4,13 @@ export declare abstract class AdwSingleChildBase extends AdwStyledLayoutBase {
4
4
  private _child;
5
5
  constructor();
6
6
  private _columnIsStar;
7
+ private _rowIsStar;
7
8
  onLoaded(): void;
8
9
  onUnloaded(): void;
9
10
  private _onWidthChangeSyncColumn;
11
+ private _onHeightChangeSyncRow;
10
12
  private _syncColumnToAlignment;
13
+ private _syncRowToAlignment;
11
14
  /** The child, or `null`. */
12
15
  get child(): View | null;
13
16
  set child(view: View | null);
@@ -1,8 +1,13 @@
1
1
  /**
2
- * Whether the single cell of a one-child container is `star` rather than `auto`.
2
+ * Whether the single cell of a one-child container is `star` rather than `auto`, on ONE axis.
3
3
  *
4
- * `star` when the container's width is settled — either because it stretches to its parent,
5
- * or because a definite `width` was written on it. `auto` otherwise, so the container can
6
- * still report its child's natural width and be placed by its alignment.
4
+ * `star` when the container's extent along that axis is settled — either because it stretches
5
+ * to its parent, or because a definite `width` / `height` was written on it. `auto` otherwise,
6
+ * so the container can still report its child's natural size and be placed by its alignment.
7
+ *
8
+ * TAKES NO AXIS, because there is nothing axis-specific left once the question is phrased that
9
+ * way: `'stretch'` is the stretching value of BOTH `horizontalAlignment` and
10
+ * `verticalAlignment`, and a settled `width` reads exactly like a settled `height`. The column
11
+ * passes `horizontalAlignment` + `width`, the row `verticalAlignment` + `height`.
7
12
  */
8
- export declare function singleChildCellIsStar(horizontalAlignment: unknown, width: unknown): boolean;
13
+ export declare function singleChildCellIsStar(alignment: unknown, length: unknown): boolean;
@@ -18,6 +18,8 @@ declare const AdwSplitViewBase_base: ((abstract new (...args: any[]) => {
18
18
  emit(eventName: string, ...args: unknown[]): void;
19
19
  get_property(name: string): unknown;
20
20
  set_property(name: string, value: unknown): void;
21
+ get cssType(): string | undefined;
22
+ set cssType(value: string | undefined);
21
23
  get halign(): string;
22
24
  set halign(value: string | number);
23
25
  get valign(): string;