@gjsify/adwaita-nativescript 0.48.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 (144) 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-image.js +1 -1
  56. package/lib/esm/widgets/gtk-label.js +1 -0
  57. package/lib/esm/widgets/gtk-menu-button.js +1 -1
  58. package/lib/esm/widgets/icon-theme.js +1 -0
  59. package/lib/esm/widgets/index.js +1 -1
  60. package/lib/esm/widgets/label-text.js +1 -0
  61. package/lib/esm/widgets/signals.js +1 -0
  62. package/lib/esm/widgets/split-view-base.js +1 -1
  63. package/lib/esm/widgets/style-classes.js +1 -0
  64. package/lib/esm/widgets/view-switcher-base.js +1 -1
  65. package/lib/esm/widgets/view-switcher-model.js +1 -1
  66. package/lib/types/avatar.spec.d.ts +2 -0
  67. package/lib/types/box-layout.spec.d.ts +2 -0
  68. package/lib/types/button-slot.spec.d.ts +2 -0
  69. package/lib/types/construct-props.spec.d.ts +2 -0
  70. package/lib/types/icon-theme.spec.d.ts +2 -0
  71. package/lib/types/index.d.ts +2 -2
  72. package/lib/types/label-text.spec.d.ts +2 -0
  73. package/lib/types/namespace/gtk.d.ts +2 -0
  74. package/lib/types/signals.spec.d.ts +2 -0
  75. package/lib/types/style-classes.spec.d.ts +2 -0
  76. package/lib/types/widgets/adw-about-dialog.d.ts +16 -3
  77. package/lib/types/widgets/adw-action-row.d.ts +38 -10
  78. package/lib/types/widgets/adw-alert-dialog.d.ts +30 -13
  79. package/lib/types/widgets/adw-avatar.d.ts +49 -3
  80. package/lib/types/widgets/adw-banner.d.ts +16 -3
  81. package/lib/types/widgets/adw-bottom-sheet.d.ts +32 -16
  82. package/lib/types/widgets/adw-button-content.d.ts +18 -4
  83. package/lib/types/widgets/adw-button-row.d.ts +6 -3
  84. package/lib/types/widgets/adw-carousel.d.ts +19 -7
  85. package/lib/types/widgets/adw-clamp.d.ts +17 -5
  86. package/lib/types/widgets/adw-combo-row.d.ts +2 -1
  87. package/lib/types/widgets/adw-data-grid.d.ts +17 -4
  88. package/lib/types/widgets/adw-entry-row.d.ts +13 -11
  89. package/lib/types/widgets/adw-expander-row.d.ts +19 -8
  90. package/lib/types/widgets/adw-header-bar.d.ts +39 -14
  91. package/lib/types/widgets/adw-image-button.d.ts +22 -5
  92. package/lib/types/widgets/adw-inline-view-switcher.d.ts +2 -1
  93. package/lib/types/widgets/adw-navigation-split-view.d.ts +2 -1
  94. package/lib/types/widgets/adw-navigation-view.d.ts +40 -21
  95. package/lib/types/widgets/adw-overlay-split-view.d.ts +3 -2
  96. package/lib/types/widgets/adw-password-entry-row.d.ts +2 -1
  97. package/lib/types/widgets/adw-preferences-dialog.d.ts +16 -3
  98. package/lib/types/widgets/adw-preferences-group.d.ts +19 -6
  99. package/lib/types/widgets/adw-preferences-page.d.ts +37 -8
  100. package/lib/types/widgets/adw-shortcut-label.d.ts +15 -2
  101. package/lib/types/widgets/adw-sidebar.d.ts +15 -2
  102. package/lib/types/widgets/adw-slider-row.d.ts +15 -2
  103. package/lib/types/widgets/adw-spin-row.d.ts +2 -1
  104. package/lib/types/widgets/adw-spinner.d.ts +14 -2
  105. package/lib/types/widgets/adw-split-button.d.ts +15 -2
  106. package/lib/types/widgets/adw-status-page.d.ts +20 -6
  107. package/lib/types/widgets/adw-switch-row.d.ts +2 -1
  108. package/lib/types/widgets/adw-tab-view.d.ts +34 -8
  109. package/lib/types/widgets/adw-toast-overlay.d.ts +19 -7
  110. package/lib/types/widgets/adw-toggle-group.d.ts +14 -2
  111. package/lib/types/widgets/adw-toolbar-view.d.ts +21 -8
  112. package/lib/types/widgets/adw-view-stack.d.ts +38 -5
  113. package/lib/types/widgets/adw-view-switcher-bar.d.ts +16 -3
  114. package/lib/types/widgets/adw-view-switcher.d.ts +2 -1
  115. package/lib/types/widgets/adw-window-title.d.ts +16 -3
  116. package/lib/types/widgets/adw-wrap-box.d.ts +21 -8
  117. package/lib/types/widgets/avatar-view.d.ts +57 -0
  118. package/lib/types/widgets/bottom-sheet-state.d.ts +1 -1
  119. package/lib/types/widgets/box-layout.d.ts +39 -0
  120. package/lib/types/widgets/button-content.d.ts +4 -4
  121. package/lib/types/widgets/button-slot.d.ts +16 -0
  122. package/lib/types/widgets/construct-props.d.ts +82 -0
  123. package/lib/types/widgets/entry-row-view.d.ts +8 -7
  124. package/lib/types/widgets/gtk-align.d.ts +59 -0
  125. package/lib/types/widgets/gtk-box.d.ts +75 -0
  126. package/lib/types/widgets/gtk-button.d.ts +110 -28
  127. package/lib/types/widgets/gtk-drop-down.d.ts +15 -2
  128. package/lib/types/widgets/gtk-entry.d.ts +15 -2
  129. package/lib/types/widgets/gtk-image.d.ts +22 -5
  130. package/lib/types/widgets/gtk-label.d.ts +82 -0
  131. package/lib/types/widgets/gtk-menu-button.d.ts +2 -1
  132. package/lib/types/widgets/icon-theme.d.ts +77 -0
  133. package/lib/types/widgets/icons.d.ts +3 -1
  134. package/lib/types/widgets/index.d.ts +14 -3
  135. package/lib/types/widgets/label-text.d.ts +13 -0
  136. package/lib/types/widgets/row-state.d.ts +1 -1
  137. package/lib/types/widgets/signals.d.ts +40 -0
  138. package/lib/types/widgets/split-view-base.d.ts +18 -6
  139. package/lib/types/widgets/status-page-content.d.ts +1 -1
  140. package/lib/types/widgets/style-classes.d.ts +61 -0
  141. package/lib/types/widgets/view-switcher-base.d.ts +12 -1
  142. package/lib/types/widgets/view-switcher-model.d.ts +2 -11
  143. package/package.json +7 -7
  144. package/src/theme/adwaita.css +58 -0
@@ -1,19 +1,35 @@
1
1
  import { Image } from '@nativescript/core';
2
+ import { type ConstructProps } from './construct-props.js';
2
3
  /** Default decorative-icon size, in DIPs — the Adwaita 16px symbolic grid. */
3
4
  export declare const DEFAULT_GTK_IMAGE_SIZE = 16;
4
- export declare class GtkImage extends Image {
5
- private _iconSvg;
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;
6
18
  private _iconColor;
7
19
  private _explicitColor;
8
20
  private _iconSize;
9
21
  private _unsubScheme;
10
- constructor();
22
+ constructor(props?: ConstructProps<GtkImage>);
11
23
  /** Adopt the active scheme's default fill (no-op if the caller pinned a colour). */
12
24
  private _syncThemeColor;
13
25
  private _render;
14
- /** The Adwaita symbolic SVG string to render (e.g. `panDownSymbolic`). */
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
+ */
15
31
  get iconName(): string;
16
- set iconName(svg: string);
32
+ set iconName(value: string);
17
33
  /** The icon fill colour (hex). Setting it PINS the colour (it no longer follows
18
34
  * the light/dark scheme) — use it for context colours like white on a suggested
19
35
  * button or destructive red, which must survive both schemes. */
@@ -23,3 +39,4 @@ export declare class GtkImage extends Image {
23
39
  get iconSize(): number;
24
40
  set iconSize(raw: number | string);
25
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,6 +1,7 @@
1
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
  /** Payload of the {@link MENU_ITEM_ACTIVATED} event. */
@@ -21,7 +22,7 @@ export declare class GtkMenuButton extends AdwImageButton {
21
22
  private _model;
22
23
  private _actions;
23
24
  private _menuTitle;
24
- constructor();
25
+ constructor(props?: ConstructProps<GtkMenuButton>);
25
26
  /**
26
27
  * The menu, normalised (ADR 0042) — opened as a native `action()` sheet on tap.
27
28
  *
@@ -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,8 +18,14 @@ 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
31
  export type { MenuItemActivatedEventData } from './gtk-menu-button.js';
@@ -27,7 +33,7 @@ export { MENU_CANCEL_LABEL, menuSheetActions, menuSheetRows, presentMenuSheet, r
27
33
  export type { MenuSheetPresenter, MenuSheetRow } from './menu-sheet.js';
28
34
  export { GtkImage, DEFAULT_GTK_IMAGE_SIZE } from './gtk-image.js';
29
35
  export { AdwBanner, BUTTON_CLICKED } from './adw-banner.js';
30
- export { AdwAvatar, DEFAULT_AVATAR_SIZE, avatarInitials } from './adw-avatar.js';
36
+ export { AVATAR_DEFAULT_ICON, AdwAvatar, DEFAULT_AVATAR_SIZE, avatarInitials } from './adw-avatar.js';
31
37
  export { AdwWindowTitle } from './adw-window-title.js';
32
38
  export { AdwClamp, DEFAULT_CLAMP_MAX_SIZE } from './adw-clamp.js';
33
39
  export { AdwHeaderBar } from './adw-header-bar.js';
@@ -85,6 +91,11 @@ export type { AdwAlertResponse, AdwResponseAppearance, AdwResponseOptions, Notif
85
91
  export { AdwAboutDialog, CLOSED as ABOUT_CLOSED } from './adw-about-dialog.js';
86
92
  export { AdwPreferencesDialog, CLOSED as PREFERENCES_CLOSED } from './adw-preferences-dialog.js';
87
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';
88
99
  export { ADWAITA_ICON_GRID, DEFAULT_ICON_COLOR, DEFAULT_ICON_COLOR_DARK, extractIconPaths, extractPathData, renderSymbolicIcon, } from './icons.js';
89
100
  export type { IconPath, SymbolicIconOptions } from './icons.js';
90
101
  export { adwaitaColorScheme, isThemeIconColor, onAdwaitaColorSchemeChanged, setAdwaitaColorScheme, themeIconColor, toggleAdwaitaColorScheme, } from './color-scheme.js';
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The string a `Gtk.Label` puts in `Label.text` for a given `label` and the two flags
3
+ * that transform it.
4
+ *
5
+ * ORDER MATTERS AND FOLLOWS THE C: markup is reduced first, the mnemonic marker second.
6
+ * `gtk_label_set_markup_with_mnemonic` parses the markup and then takes the underscore out
7
+ * of the resulting TEXT, so an `_` inside a tag's attributes is not a mnemonic. Doing it
8
+ * the other way round would let `<span font_desc="Sans">` lose its underscore and stop
9
+ * parsing.
10
+ */
11
+ export declare function labelDisplayText(label: string, useMarkup: boolean, useUnderline: boolean): string;
12
+ /** Whether `label` carries markup this port could not reduce, so the raw string is shown. */
13
+ export declare function labelMarkupIsUnparseable(label: string, useMarkup: boolean): boolean;
@@ -37,7 +37,7 @@ export interface NsButtonRowIconVisuals {
37
37
  * title through a second state object would give one label two sources of truth.
38
38
  * {@link rowLabelVisuals} paints it.
39
39
  *
40
- * The icon payload is the symbolic SVG SOURCE, not GTK's icon name, because `GtkImage`
40
+ * The icon payload is whatever the caller set — a name or the symbolic SVG source, because `GtkImage`
41
41
  * renders SVG rather than resolving a name. `ButtonRowState` is indifferent: its rule
42
42
  * is `string_is_not_empty`, which reads the first byte.
43
43
  */
@@ -0,0 +1,40 @@
1
+ import type { EventData, Observable } from '@nativescript/core';
2
+ /** The two methods the mixin adds. Named so a consumer can annotate with it. */
3
+ export interface GObjectSignals {
4
+ /**
5
+ * Subscribe to `eventName` — a NativeScript event, or one of the `notify::<prop>`
6
+ * events this port's widgets emit — and get back the id that `disconnect` takes.
7
+ *
8
+ * The callback receives the emitting widget FIRST, as a GJS signal handler does,
9
+ * then the NativeScript payload.
10
+ */
11
+ connect(eventName: string, callback: (self: this, data: EventData) => void): number;
12
+ /** Remove exactly the handler `connect` returned this id for. Throws on an id nothing holds. */
13
+ disconnect(handlerId: number): void;
14
+ }
15
+ /**
16
+ * A constructor the mixin can wrap: anything that is an `Observable`, abstract or not.
17
+ *
18
+ * `any[]` and not `unknown[]`: TypeScript accepts a mixin base only as a constructor with a
19
+ * single rest parameter of type `any[]` (TS2545), so the wider spelling is the one the
20
+ * language requires here rather than a shortcut.
21
+ */
22
+ export type ObservableConstructor = abstract new (...args: any[]) => Observable;
23
+ /**
24
+ * Give a `@nativescript/core` base GJS's `connect` / `disconnect`.
25
+ *
26
+ * Applied ONCE per class that extends a platform base — `extends withSignals(GridLayout)`
27
+ * — and never on a class whose base is already a widget of this package, which inherits
28
+ * the two methods and would otherwise carry a second, identical copy one prototype up.
29
+ */
30
+ export declare function withSignals<TBase extends ObservableConstructor>(Base: TBase): (abstract new (...args: any[]) => {
31
+ connect(eventName: string, callback: (self: /*elided*/ any, data: EventData) => void): number;
32
+ disconnect(handlerId: number): void;
33
+ _emit(eventName: string): void;
34
+ addEventListener(eventName: string, callback: (data: EventData) => void, thisArg?: unknown, once?: boolean): void;
35
+ removeEventListener(eventName: string, callback?: (data: EventData) => void, thisArg?: unknown): void;
36
+ notify<T extends EventData>(data: T): void;
37
+ notifyPropertyChange(name: string, value: unknown, oldValue?: unknown): void;
38
+ set(name: string, value: unknown): void;
39
+ get(name: string): unknown;
40
+ }) & TBase;
@@ -10,7 +10,18 @@ export interface NotifyShowSidebarEventData extends EventData {
10
10
  /** Whether the view is in its collapsed (narrow) mode. */
11
11
  collapsed: boolean;
12
12
  }
13
- export declare abstract class AdwSplitViewBase<TState extends NsSplitViewState = NsSplitViewState> extends GridLayout {
13
+ declare const AdwSplitViewBase_base: (abstract new (...args: any[]) => {
14
+ connect(eventName: string, callback: (self: /*elided*/ any, data: EventData) => void): number;
15
+ disconnect(handlerId: number): void;
16
+ _emit(eventName: string): void;
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
+ notify<T extends EventData>(data: T): void;
20
+ notifyPropertyChange(name: string, value: unknown, oldValue?: unknown): void;
21
+ set(name: string, value: unknown): void;
22
+ get(name: string): unknown;
23
+ }) & typeof GridLayout;
24
+ export declare abstract class AdwSplitViewBase<TState extends NsSplitViewState = NsSplitViewState> extends AdwSplitViewBase_base {
14
25
  /** Which widget's width rule applies — they differ once a pane has a minimum. */
15
26
  protected readonly _widthRule: SplitViewWidthRule;
16
27
  /** The headless state machine this widget renders (`split-view-state.ts`). */
@@ -20,7 +31,7 @@ export declare abstract class AdwSplitViewBase<TState extends NsSplitViewState =
20
31
  /** The three width PROPERTIES; the drawn width is derived from them. */
21
32
  protected _widthProps: SidebarWidthProps;
22
33
  /** The container width the sidebar was last sized against, in DIPs. */
23
- protected _measuredWidth: number;
34
+ protected _splitWidth: number;
24
35
  /** An explicit `sidebarWidth` assignment, which overrides the derivation. */
25
36
  protected _sidebarWidthOverride: number | null;
26
37
  constructor(rootClass: string,
@@ -74,10 +85,10 @@ export declare abstract class AdwSplitViewBase<TState extends NsSplitViewState =
74
85
  protected _cancelPending(): void;
75
86
  /** Whether `view` is currently a child of this layout. */
76
87
  protected _isChild(view: View): boolean;
77
- /** Set (or replace) the sidebar pane. */
78
- setSidebar(view: View | null): void;
79
- /** Set (or replace) the content pane. */
80
- setContent(view: View | null): void;
88
+ /** Set (or replace) the sidebar pane — `set_sidebar` on both split views. */
89
+ set_sidebar(view: View | null): void;
90
+ /** Set (or replace) the content pane — `set_content` on both split views. */
91
+ set_content(view: View | null): void;
81
92
  /**
82
93
  * An XML child asks for `sidebar` or `content`, and a bare one is CONTENT.
83
94
  *
@@ -135,3 +146,4 @@ export declare abstract class AdwSplitViewBase<TState extends NsSplitViewState =
135
146
  /** The content pane, or `null`. */
136
147
  get content(): View | null;
137
148
  }
149
+ export {};
@@ -10,7 +10,7 @@ export declare function statusPageLabelVisibility(text: string | null | undefine
10
10
  * `has_image`, bound to the image's `visible`.
11
11
  *
12
12
  * C is `paintable || (icon_name && icon_name[0])`; this port has no `paintable`
13
- * counterpart (the icon is an SVG string handed to `GtkImage`), so only the second
13
+ * counterpart (the icon is a name or an SVG string handed to `GtkImage`), so only the second
14
14
  * half applies. Kept as its own predicate rather than folded into
15
15
  * {@link statusPageLabelVisibility} because upstream really are two closures, and
16
16
  * the missing half is a real gap rather than a simplification.
@@ -0,0 +1,61 @@
1
+ /**
2
+ * What a `styleClasses` write means here.
3
+ *
4
+ * THE DOOR TAKES A STRING AND THE READ-BACK IS A LIST, which is the DOM's own
5
+ * `className`/`classList` split and not a compromise: the two places that WRITE this are a
6
+ * NativeScript XML attribute and `View.className`, and both are strings, while
7
+ * `GtkWidget:css-classes` holds a list and so does the getter. An array-taking door would
8
+ * need a fourth attribute kind in `check-generated-website-data` — it has `number`,
9
+ * `boolean` and `json`, and `json` there means "parses to a plain OBJECT", so not even
10
+ * `'["pill"]'` reaches it — and inventing one to offer a second spelling of a door that
11
+ * already works is the "second way to say what the table can already say" that gate's own
12
+ * header refuses.
13
+ *
14
+ * NO ARRAY ARM. It had one, "because the widget's internals rebuild the list through it";
15
+ * the internals are the two setters and both are typed `string | null | undefined`, so the
16
+ * arm was unreachable and its `String(name)` coercion guarded nothing.
17
+ */
18
+ export type AdwStyleClassesInput = string | null | undefined;
19
+ /**
20
+ * The class list a `styleClasses` write means: split on whitespace, trimmed,
21
+ * de-duplicated, order preserved.
22
+ *
23
+ * A STRING IS THE XML DOOR. NativeScript's `setPropertyValue` ends in `instance[name] =
24
+ * value`, so `<gtk:Button styleClasses="pill suggested-action">` hands the setter that
25
+ * whole string — the same fact `xmlNumber`/`xmlBoolean` exist for, one type over.
26
+ */
27
+ export declare function normalizeStyleClasses(value: AdwStyleClassesInput): string[];
28
+ /**
29
+ * `className` for a widget whose own class is `base` and which carries `classes`.
30
+ *
31
+ * AN EMPTY `base` IS A WIDGET WITH NO CLASS OF ITS OWN, and two of them ship: `Gtk.Box`
32
+ * and `Gtk.Label` are transparent — there is no Adwaita fill, radius or typography to give
33
+ * a box or a bare label, so they carry only what a caller puts on them. The empties are
34
+ * filtered rather than joined, because `` `${''} ${'title-1'}` `` is a leading space and
35
+ * NativeScript's `className` splitter turns that into an empty class name.
36
+ */
37
+ export declare function classNameWith(base: string, classes: readonly string[]): string;
38
+ /**
39
+ * The list after `gtk_widget_add_css_class(name)` — GTK's own method, and the door a GJS
40
+ * snippet reaches for.
41
+ *
42
+ * WHY THE METHODS EXIST BESIDE THE `styleClasses` PROPERTY. A NativeScript XML attribute
43
+ * can only carry a string, which is what `styleClasses` is for; a TypeScript caller ported
44
+ * off GJS writes `button.add_css_class('pill')`, and that line is in every Adwaita snippet
45
+ * that gives a button a look. The two doors hold the SAME list, so a widget that offers
46
+ * both cannot have them disagree — which is why the mutation is a pure function over the
47
+ * list rather than a second `className` rewrite per method.
48
+ *
49
+ * ADDS AT THE END, AND ONLY IF ABSENT. `gtk_widget_add_css_class` is a no-op for a class
50
+ * the widget already has (the quark is already in the list), so a second add does not move
51
+ * it — measured under gjs 1.88.1: `add_css_class('a'); add_css_class('b');
52
+ * add_css_class('a')` reads back two classes.
53
+ *
54
+ * ONE NAME, TRIMMED. GTK takes a single class name and would happily intern `'a b'` as one
55
+ * unmatchable class; here the string door already means "a whitespace-separated list", so a
56
+ * name with whitespace in it is the caller confusing the two doors. It is trimmed, and an
57
+ * empty name is dropped rather than added as a class nothing can be.
58
+ */
59
+ export declare function withCssClass(classes: readonly string[], name: string): string[];
60
+ /** The list after `gtk_widget_remove_css_class(name)`. Absent is a no-op, as in C. */
61
+ export declare function withoutCssClass(classes: readonly string[], name: string): string[];
@@ -11,11 +11,22 @@ export declare const NOTIFY_SELECTED = "notify::selected";
11
11
  */
12
12
  export interface NotifyViewSelectedEventData extends EventData, ViewSwitcherNotifyPayload {
13
13
  }
14
+ declare const AdwViewSwitcherBase_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;
14
25
  /**
15
26
  * Shared base: a switcher bar (row 0) + a content area (row 1), one page visible.
16
27
  * Subclasses set the bar/button CSS classes for their look.
17
28
  */
18
- export declare abstract class AdwViewSwitcherBase extends GridLayout {
29
+ export declare abstract class AdwViewSwitcherBase extends AdwViewSwitcherBase_base {
19
30
  /** The horizontal switcher bar holding the buttons. */
20
31
  protected readonly _bar: GridLayout;
21
32
  /** `Adw.ViewSwitcher:policy`, default NARROW as in C. */
@@ -10,7 +10,7 @@ import type { AdwViewSwitcherPageInit, ViewSwitcherStateChange } from '@gjsify/a
10
10
  *
11
11
  * `icon` is an Adwaita symbolic SVG DOCUMENT here, not a GTK icon name: `GtkImage`
12
12
  * rasterises the path data natively. The core treats the field as an opaque
13
- * handle and only ever interprets "absent or empty"; {@link nsIconSvg} resolves
13
+ * handle and only ever interprets "absent or empty"; `icon-theme.ts` resolves
14
14
  * the fallback sentinel it hands back.
15
15
  */
16
16
  export interface AdwViewPage {
@@ -18,7 +18,7 @@ export interface AdwViewPage {
18
18
  title?: string;
19
19
  /** The page content view, shown when this page is selected. */
20
20
  content: View;
21
- /** Adwaita symbolic SVG shown on the switcher button; absent means none. */
21
+ /** The icon shown on the switcher button — a NAME or SVG source; absent means none. */
22
22
  icon?: string;
23
23
  /** Stable id used by `visible-child-name`; defaults to the page's position. */
24
24
  name?: string;
@@ -47,15 +47,6 @@ export declare function createViewSwitcherBarState(): ViewSwitcherBarState;
47
47
  export declare function viewSwitcherPageSpec(page: AdwViewPage, index: number): AdwViewSwitcherPageInit;
48
48
  /** {@link viewSwitcherPageSpec} over a whole page list. */
49
49
  export declare function viewSwitcherPageSpecs(pages: readonly AdwViewPage[]): AdwViewSwitcherPageInit[];
50
- /**
51
- * Resolve the core's icon slot to something `GtkImage` can rasterise.
52
- *
53
- * The core substitutes the NAME `image-missing` for an absent icon. On the browser
54
- * side that name becomes a CSS mask class; here it has to become the actual
55
- * symbolic document, so the sentinel is swapped for the vendored
56
- * `image-missing-symbolic` SVG. Anything else is already an SVG and passes through.
57
- */
58
- export declare function nsIconSvg(iconName: string): string;
59
50
  /**
60
51
  * The `visibility` each page's content view must carry for the current
61
52
  * selection, in page order. Exactly one entry is `'visible'` — none when nothing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/adwaita-nativescript",
3
- "version": "0.48.0",
3
+ "version": "0.49.0",
4
4
  "description": "Native Adwaita widgets for the NativeScript runtime — real NativeScript components (StackLayout/GridLayout/Switch/Label) styled like Libadwaita, not a webview",
5
5
  "type": "module",
6
6
  "module": "lib/esm/index.js",
@@ -51,10 +51,10 @@
51
51
  "design-system"
52
52
  ],
53
53
  "dependencies": {
54
- "@gjsify/adwaita-core": "^0.48.0",
55
- "@gjsify/adwaita-fonts": "^0.48.0",
56
- "@gjsify/adwaita-icons": "^0.48.0",
57
- "@gjsify/native-platform": "^0.48.0"
54
+ "@gjsify/adwaita-core": "^0.49.0",
55
+ "@gjsify/adwaita-fonts": "^0.49.0",
56
+ "@gjsify/adwaita-icons": "^0.49.0",
57
+ "@gjsify/native-platform": "^0.49.0"
58
58
  },
59
59
  "peerDependencies": {
60
60
  "@nativescript/core": "*"
@@ -65,8 +65,8 @@
65
65
  }
66
66
  },
67
67
  "devDependencies": {
68
- "@gjsify/cli": "^0.48.0",
69
- "@gjsify/unit": "^0.48.0",
68
+ "@gjsify/cli": "^0.49.0",
69
+ "@gjsify/unit": "^0.49.0",
70
70
  "@types/node": "^25.9.2",
71
71
  "typescript": "^6.0.3"
72
72
  },
@@ -499,6 +499,49 @@ Page.adw-window {
499
499
  padding: 10 32 10 32;
500
500
  }
501
501
 
502
+ /* `%circular_button` — the explicit exception to the 9px rounded square: a full
503
+ * circle at 34×34 with no padding (_buttons.scss:312-317). It is the shape an
504
+ * icon-only button takes, which is why the rule arrives with the icon: while
505
+ * `Gtk.Button` was the platform's text-only `Button` the variant "had no counterpart
506
+ * at all", and a class with no rule would have drawn a rounded rectangle instead. The
507
+ * 34 is the same number `.adw-image-button` above carries, from the same line. */
508
+ .adw-button.circular {
509
+ width: 34;
510
+ height: 34;
511
+ border-radius: 9999;
512
+ padding: 0;
513
+ }
514
+
515
+ /* The button's OWN label, and it exists because the button is a `GridLayout`.
516
+ *
517
+ * `.adw-button` above declares `color` and `font-weight`; a `GridLayout` has no text,
518
+ * so neither reaches anything and the label would render at the platform default —
519
+ * silently, since a wrong font is not an error. `.adw-button-content-label` next to it
520
+ * had to exist for the same reason, and these are the same numbers: the 15pt / 700 of
521
+ * libadwaita's `button { font-weight: bold }` (_buttons.scss:1) over the label colour
522
+ * `.adw-button` carries.
523
+ *
524
+ * NOT MERGED WITH `.adw-button-content-label`: that class is `Adw.ButtonContent`'s and
525
+ * comes with the icon's 6 right-margin and the content's own padding rule; a plain
526
+ * text button has neither, and one selector for both would give every text button
527
+ * `image-text-button` spacing. */
528
+ .adw-button-label {
529
+ font-size: 15;
530
+ font-weight: 700;
531
+ color: rgba(0, 0, 0, 0.8);
532
+ }
533
+
534
+ /* On a suggested/destructive button the label takes the button's intent colour — the
535
+ * explicit label colour above would otherwise win over the inherited one, which is the
536
+ * same override `.adw-button-content-label` needs two blocks down. */
537
+ .adw-button.suggested-action .adw-button-label {
538
+ color: #ffffff;
539
+ }
540
+
541
+ .adw-button.destructive-action .adw-button-label {
542
+ color: #c01c28;
543
+ }
544
+
502
545
  /* Pressed (`:highlighted`) — Adwaita darkens the button on press rather than
503
546
  * showing a Material ripple. Mirrors adwaita-web's `:active` shades
504
547
  * (`--button-active-color` / darker `--accent-color`). Pill inherits the base. */
@@ -1740,6 +1783,21 @@ Page.ns-dark.adw-window {
1740
1783
  color: #ffffff;
1741
1784
  }
1742
1785
 
1786
+ /* Dark: the button's own label. Same three colours the dark `.adw-button` rules
1787
+ * carry — near-white on the plain and flat button, white on suggested, the dark
1788
+ * destructive red. */
1789
+ .ns-dark .adw-button-label {
1790
+ color: #ffffff;
1791
+ }
1792
+
1793
+ .ns-dark .adw-button.suggested-action .adw-button-label {
1794
+ color: #ffffff;
1795
+ }
1796
+
1797
+ .ns-dark .adw-button.destructive-action .adw-button-label {
1798
+ color: #ff7b80;
1799
+ }
1800
+
1743
1801
  /* Dark pressed (`:highlighted`) — Adwaita's lighter-overlay press shade. */
1744
1802
  .ns-dark .adw-button:highlighted {
1745
1803
  background-color: rgba(255, 255, 255, 0.22);