@gjsify/adwaita-nativescript 0.48.0 → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/esm/index.js +1 -1
- package/lib/esm/namespace/gtk.js +1 -1
- package/lib/esm/widgets/adw-about-dialog.js +1 -1
- package/lib/esm/widgets/adw-action-row.js +1 -1
- package/lib/esm/widgets/adw-alert-dialog.js +1 -1
- package/lib/esm/widgets/adw-avatar.js +1 -1
- package/lib/esm/widgets/adw-banner.js +1 -1
- package/lib/esm/widgets/adw-bottom-sheet.js +1 -1
- package/lib/esm/widgets/adw-button-content.js +1 -1
- package/lib/esm/widgets/adw-button-row.js +1 -1
- package/lib/esm/widgets/adw-carousel.js +1 -1
- package/lib/esm/widgets/adw-clamp.js +1 -1
- package/lib/esm/widgets/adw-combo-row.js +1 -1
- package/lib/esm/widgets/adw-data-grid.js +1 -1
- package/lib/esm/widgets/adw-entry-row.js +1 -1
- package/lib/esm/widgets/adw-expander-row.js +1 -1
- package/lib/esm/widgets/adw-header-bar.js +1 -1
- package/lib/esm/widgets/adw-image-button.js +1 -1
- package/lib/esm/widgets/adw-inline-view-switcher.js +1 -1
- package/lib/esm/widgets/adw-navigation-split-view.js +1 -1
- package/lib/esm/widgets/adw-navigation-view.js +1 -1
- package/lib/esm/widgets/adw-overlay-split-view.js +1 -1
- package/lib/esm/widgets/adw-password-entry-row.js +1 -1
- package/lib/esm/widgets/adw-preferences-dialog.js +1 -1
- package/lib/esm/widgets/adw-preferences-group.js +1 -1
- package/lib/esm/widgets/adw-preferences-page.js +1 -1
- package/lib/esm/widgets/adw-shortcut-label.js +1 -1
- package/lib/esm/widgets/adw-sidebar.js +1 -1
- package/lib/esm/widgets/adw-slider-row.js +1 -1
- package/lib/esm/widgets/adw-spin-row.js +1 -1
- package/lib/esm/widgets/adw-spinner.js +1 -1
- package/lib/esm/widgets/adw-split-button.js +1 -1
- package/lib/esm/widgets/adw-status-page.js +1 -1
- package/lib/esm/widgets/adw-switch-row.js +1 -1
- package/lib/esm/widgets/adw-tab-view.js +1 -1
- package/lib/esm/widgets/adw-toast-overlay.js +1 -1
- package/lib/esm/widgets/adw-toggle-group.js +1 -1
- package/lib/esm/widgets/adw-toolbar-view.js +1 -1
- package/lib/esm/widgets/adw-view-stack.js +1 -1
- package/lib/esm/widgets/adw-view-switcher-bar.js +1 -1
- package/lib/esm/widgets/adw-view-switcher.js +1 -1
- package/lib/esm/widgets/adw-window-title.js +1 -1
- package/lib/esm/widgets/adw-wrap-box.js +1 -1
- package/lib/esm/widgets/avatar-view.js +1 -0
- package/lib/esm/widgets/box-layout.js +1 -0
- package/lib/esm/widgets/button-content.js +1 -1
- package/lib/esm/widgets/button-slot.js +1 -0
- package/lib/esm/widgets/construct-props.js +1 -0
- package/lib/esm/widgets/entry-row-view.js +1 -1
- package/lib/esm/widgets/gtk-align.js +1 -0
- package/lib/esm/widgets/gtk-box.js +1 -0
- package/lib/esm/widgets/gtk-button.js +1 -1
- package/lib/esm/widgets/gtk-drop-down.js +1 -1
- package/lib/esm/widgets/gtk-entry.js +1 -1
- package/lib/esm/widgets/gtk-icon-size.js +1 -0
- package/lib/esm/widgets/gtk-image.js +1 -1
- package/lib/esm/widgets/gtk-label.js +1 -0
- package/lib/esm/widgets/gtk-menu-button.js +1 -1
- package/lib/esm/widgets/icon-theme.js +1 -0
- package/lib/esm/widgets/index.js +1 -1
- package/lib/esm/widgets/label-text.js +1 -0
- package/lib/esm/widgets/signals.js +1 -0
- package/lib/esm/widgets/split-view-base.js +1 -1
- package/lib/esm/widgets/style-classes.js +1 -0
- package/lib/esm/widgets/view-switcher-base.js +1 -1
- package/lib/esm/widgets/view-switcher-model.js +1 -1
- package/lib/types/avatar.spec.d.ts +2 -0
- package/lib/types/box-layout.spec.d.ts +2 -0
- package/lib/types/button-slot.spec.d.ts +2 -0
- package/lib/types/construct-props.spec.d.ts +2 -0
- package/lib/types/icon-size.spec.d.ts +2 -0
- package/lib/types/icon-theme.spec.d.ts +2 -0
- package/lib/types/index.d.ts +2 -2
- package/lib/types/label-text.spec.d.ts +2 -0
- package/lib/types/namespace/gtk.d.ts +2 -0
- package/lib/types/signals.spec.d.ts +2 -0
- package/lib/types/style-classes.spec.d.ts +2 -0
- package/lib/types/widgets/adw-about-dialog.d.ts +16 -3
- package/lib/types/widgets/adw-action-row.d.ts +38 -10
- package/lib/types/widgets/adw-alert-dialog.d.ts +30 -13
- package/lib/types/widgets/adw-avatar.d.ts +49 -3
- package/lib/types/widgets/adw-banner.d.ts +16 -3
- package/lib/types/widgets/adw-bottom-sheet.d.ts +32 -16
- package/lib/types/widgets/adw-button-content.d.ts +18 -4
- package/lib/types/widgets/adw-button-row.d.ts +6 -3
- package/lib/types/widgets/adw-carousel.d.ts +19 -7
- package/lib/types/widgets/adw-clamp.d.ts +17 -5
- package/lib/types/widgets/adw-combo-row.d.ts +2 -1
- package/lib/types/widgets/adw-data-grid.d.ts +17 -4
- package/lib/types/widgets/adw-entry-row.d.ts +13 -11
- package/lib/types/widgets/adw-expander-row.d.ts +19 -8
- package/lib/types/widgets/adw-header-bar.d.ts +39 -14
- package/lib/types/widgets/adw-image-button.d.ts +52 -10
- package/lib/types/widgets/adw-inline-view-switcher.d.ts +2 -1
- package/lib/types/widgets/adw-navigation-split-view.d.ts +2 -1
- package/lib/types/widgets/adw-navigation-view.d.ts +40 -21
- package/lib/types/widgets/adw-overlay-split-view.d.ts +3 -2
- package/lib/types/widgets/adw-password-entry-row.d.ts +2 -1
- package/lib/types/widgets/adw-preferences-dialog.d.ts +16 -3
- package/lib/types/widgets/adw-preferences-group.d.ts +19 -6
- package/lib/types/widgets/adw-preferences-page.d.ts +37 -8
- package/lib/types/widgets/adw-shortcut-label.d.ts +15 -2
- package/lib/types/widgets/adw-sidebar.d.ts +15 -2
- package/lib/types/widgets/adw-slider-row.d.ts +15 -2
- package/lib/types/widgets/adw-spin-row.d.ts +2 -1
- package/lib/types/widgets/adw-spinner.d.ts +14 -2
- package/lib/types/widgets/adw-split-button.d.ts +15 -2
- package/lib/types/widgets/adw-status-page.d.ts +20 -6
- package/lib/types/widgets/adw-switch-row.d.ts +2 -1
- package/lib/types/widgets/adw-tab-view.d.ts +34 -8
- package/lib/types/widgets/adw-toast-overlay.d.ts +19 -7
- package/lib/types/widgets/adw-toggle-group.d.ts +14 -2
- package/lib/types/widgets/adw-toolbar-view.d.ts +21 -8
- package/lib/types/widgets/adw-view-stack.d.ts +38 -5
- package/lib/types/widgets/adw-view-switcher-bar.d.ts +16 -3
- package/lib/types/widgets/adw-view-switcher.d.ts +2 -1
- package/lib/types/widgets/adw-window-title.d.ts +16 -3
- package/lib/types/widgets/adw-wrap-box.d.ts +21 -8
- package/lib/types/widgets/avatar-view.d.ts +57 -0
- package/lib/types/widgets/bottom-sheet-state.d.ts +1 -1
- package/lib/types/widgets/box-layout.d.ts +39 -0
- package/lib/types/widgets/button-content.d.ts +4 -4
- package/lib/types/widgets/button-slot.d.ts +16 -0
- package/lib/types/widgets/construct-props.d.ts +102 -0
- package/lib/types/widgets/entry-row-view.d.ts +8 -7
- package/lib/types/widgets/gtk-align.d.ts +59 -0
- package/lib/types/widgets/gtk-box.d.ts +75 -0
- package/lib/types/widgets/gtk-button.d.ts +110 -28
- package/lib/types/widgets/gtk-drop-down.d.ts +15 -2
- package/lib/types/widgets/gtk-entry.d.ts +15 -2
- package/lib/types/widgets/gtk-icon-size.d.ts +96 -0
- package/lib/types/widgets/gtk-image.d.ts +61 -10
- package/lib/types/widgets/gtk-label.d.ts +82 -0
- package/lib/types/widgets/gtk-menu-button.d.ts +2 -1
- package/lib/types/widgets/icon-theme.d.ts +77 -0
- package/lib/types/widgets/icons.d.ts +3 -1
- package/lib/types/widgets/index.d.ts +15 -3
- package/lib/types/widgets/label-text.d.ts +13 -0
- package/lib/types/widgets/row-state.d.ts +1 -1
- package/lib/types/widgets/signals.d.ts +40 -0
- package/lib/types/widgets/split-view-base.d.ts +18 -6
- package/lib/types/widgets/status-page-content.d.ts +1 -1
- package/lib/types/widgets/style-classes.d.ts +61 -0
- package/lib/types/widgets/view-switcher-base.d.ts +12 -1
- package/lib/types/widgets/view-switcher-model.d.ts +2 -11
- package/package.json +7 -7
- package/src/theme/adwaita.css +58 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Label, StackLayout, type EventData } from '@nativescript/core';
|
|
2
2
|
import type { AdwComboOption, AdwListModelInput } from '@gjsify/adwaita-core';
|
|
3
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,7 +13,18 @@ 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
|
-
|
|
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. */
|
|
@@ -21,7 +33,7 @@ export declare class GtkDropDown extends StackLayout {
|
|
|
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
39
|
/** The list model (`Gtk.DropDown:model`). Updates the button label. */
|
|
@@ -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
|
-
|
|
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,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every `Gtk.IconSize` member, in GIR declaration order.
|
|
3
|
+
*
|
|
4
|
+
* Held against `GtkIconSizeNick` in `packages/framework/gtk-host/src/generated/props.ts` by
|
|
5
|
+
* arm 7 of `scripts/check-nativescript-xml-doors.mjs` — in-repo, GIR-derived, emitted by a
|
|
6
|
+
* generator that has never heard of this port — so this array is a copy that cannot drift
|
|
7
|
+
* rather than a second source. No member is an alias, so unlike `Gtk.Align` the positions
|
|
8
|
+
* ARE the values.
|
|
9
|
+
*/
|
|
10
|
+
export declare const GTK_ICON_SIZE_NICKS: readonly ["inherit", "normal", "large"];
|
|
11
|
+
/** One of the three `Gtk.IconSize` members, spelled as its nick. */
|
|
12
|
+
export type GtkIconSizeNick = (typeof GTK_ICON_SIZE_NICKS)[number];
|
|
13
|
+
/**
|
|
14
|
+
* What each member renders at, in DIPs — the measurement in this file's header.
|
|
15
|
+
*
|
|
16
|
+
* `inherit` means "take the size from the context" on GTK, where a parent's
|
|
17
|
+
* `-gtk-icon-size` cascades. NativeScript has no such cascade — an `Image` is sized by its
|
|
18
|
+
* own `width`/`height` and nothing inherits one — so there is nothing here to inherit FROM,
|
|
19
|
+
* and the honest reading of `inherit` is the size GTK itself falls back to when no ancestor
|
|
20
|
+
* sets one, which the measurement puts at 16. That it equals `normal` is not a coincidence
|
|
21
|
+
* to be tidied away: the two agree on GTK too, and they would stop agreeing the day this
|
|
22
|
+
* port grows a context that carries a size.
|
|
23
|
+
*/
|
|
24
|
+
export declare const GTK_ICON_SIZE_PIXELS: Readonly<Record<GtkIconSizeNick, number>>;
|
|
25
|
+
/** The size an icon draws at when neither property was set — the Adwaita 16px symbolic grid. */
|
|
26
|
+
export declare const DEFAULT_ICON_PIXEL_SIZE: number;
|
|
27
|
+
/**
|
|
28
|
+
* Every `Gtk.IconSize` member, nick to constant.
|
|
29
|
+
*
|
|
30
|
+
* The positions ARE the values here, and that is a fact about THIS enum rather than a
|
|
31
|
+
* shortcut: no member of `Gtk.IconSize` is an alias, so nothing shifts below anything.
|
|
32
|
+
* `Gtk.Align` is the counter-example the sibling file is built around — `GTK_ALIGN_BASELINE`
|
|
33
|
+
* was deprecated into an alias in GTK 4.12, so 2 of its 7 members are not their position —
|
|
34
|
+
* which is why this is DERIVED from the nick order and then held against the committed,
|
|
35
|
+
* typelib-read `ENUM_VALUES` in `packages/framework/gtk-host/src/generated/enum-values.mts`
|
|
36
|
+
* by arm 7 of `check-nativescript-xml-doors.mjs`. A derivation that happens to be right is
|
|
37
|
+
* worth nothing without the oracle beside it.
|
|
38
|
+
*/
|
|
39
|
+
export declare const GTK_ICON_SIZE: Readonly<Record<GtkIconSizeNick, number>>;
|
|
40
|
+
/** Is `value` one of the three members? */
|
|
41
|
+
export declare function isGtkIconSizeNick(value: unknown): value is GtkIconSizeNick;
|
|
42
|
+
/**
|
|
43
|
+
* A `Gtk.IconSize` value as its NICK — the nick itself, or the constant a GJS caller's
|
|
44
|
+
* `Gtk.IconSize.LARGE` is.
|
|
45
|
+
*
|
|
46
|
+
* A NON-NUMBER goes back unchanged, for the SETTER to refuse with the one message that names
|
|
47
|
+
* the three members — one refusal, not two. A number that is no member is refused HERE
|
|
48
|
+
* instead, and the two are not the same mistake: by writing a number the caller has said
|
|
49
|
+
* "constant", so the setter could only report it as a bad nick, where `24` is a size in DIPs
|
|
50
|
+
* written under the wrong name and the throw can say exactly that.
|
|
51
|
+
*
|
|
52
|
+
* ADR 0034 § 4's second spelling, and it lives HERE rather than in the setter on purpose: a
|
|
53
|
+
* setter that widened its declared type to admit the constant would drag the number into the
|
|
54
|
+
* XML ATTRIBUTE door, which has no coercer. The construct-props bag is the one door that
|
|
55
|
+
* carries a real JS value, so it is the one that coerces — the arrangement `Gtk.Align`
|
|
56
|
+
* already has in `construct-props.ts`.
|
|
57
|
+
*/
|
|
58
|
+
export declare function iconSizeNickOf(value: unknown): unknown;
|
|
59
|
+
/**
|
|
60
|
+
* `value` as a `Gtk.IconSize` member, or a THROW naming what it was and what is accepted.
|
|
61
|
+
*
|
|
62
|
+
* The one setter in this package that refuses rather than falling back, and the reason is
|
|
63
|
+
* the defect it replaces: a number setter fed `'large'` substituted its default, so a typo,
|
|
64
|
+
* a value copied out of the GTK documentation and a deliberate choice all produced the same
|
|
65
|
+
* silent 16 DIPs. There are exactly three legal values and no range to be lenient about, so
|
|
66
|
+
* "not one of them" is a caller mistake and nothing else — the same reasoning
|
|
67
|
+
* `parseWidgetSelector`'s empty-selector refusal follows, and the opposite of `xmlNumber`,
|
|
68
|
+
* which is lenient because a number genuinely has a sensible default.
|
|
69
|
+
*
|
|
70
|
+
* `fallback` is NAMED IN THE MESSAGE and never returned — this throws. The widget's current
|
|
71
|
+
* setting survives because nothing was assigned to it, not because of this parameter; the
|
|
72
|
+
* parameter is there so the error can say which setting that is.
|
|
73
|
+
*/
|
|
74
|
+
export declare function gtkIconSizeNick(value: unknown, fallback: GtkIconSizeNick): GtkIconSizeNick;
|
|
75
|
+
/**
|
|
76
|
+
* GTK's "`pixel-size` is not set" sentinel — what `gtk_image_get_pixel_size` answers when
|
|
77
|
+
* the icon size is in charge.
|
|
78
|
+
*
|
|
79
|
+
* A sentinel rather than `null` because it is the value the PROPERTY carries: a getter that
|
|
80
|
+
* answered the size the image happens to draw at would make `image.pixelSize =
|
|
81
|
+
* image.pixelSize` PIN that size, and the setter falls back to the getter (every number
|
|
82
|
+
* setter in this package does — `xmlNumber(raw, this.<prop>)`), so an unparseable
|
|
83
|
+
* assignment would pin it too.
|
|
84
|
+
*/
|
|
85
|
+
export declare const PIXEL_SIZE_UNSET = -1;
|
|
86
|
+
/** An assignment to `pixel-size` as the value to store: a positive size, or the sentinel. */
|
|
87
|
+
export declare function storedPixelSize(value: number): number;
|
|
88
|
+
/**
|
|
89
|
+
* The size to draw at, in DIPs: the explicit `pixelSize` when there is one, else what
|
|
90
|
+
* `iconSize` resolves to.
|
|
91
|
+
*
|
|
92
|
+
* That precedence is `Gtk.Image`'s own — `gtk_image_set_pixel_size` documents -1 as "unset,
|
|
93
|
+
* the icon size decides" and any other value as an override. Any non-positive or non-finite
|
|
94
|
+
* value reads as unset here, because a 0-DIP image is not a rendering anyone asked for.
|
|
95
|
+
*/
|
|
96
|
+
export declare function iconPixelSize(iconSize: GtkIconSizeNick, pixelSize: number): number;
|
|
@@ -1,25 +1,76 @@
|
|
|
1
1
|
import { Image } from '@nativescript/core';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { type GtkIconSizeNick } from './gtk-icon-size.js';
|
|
3
|
+
import { type ConstructProps } from './construct-props.js';
|
|
4
|
+
/**
|
|
5
|
+
* The size this image draws at when neither size property was set, in DIPs — the Adwaita
|
|
6
|
+
* 16px symbolic grid.
|
|
7
|
+
*
|
|
8
|
+
* PUBLISHED NAME, kept pointing at {@link DEFAULT_ICON_PIXEL_SIZE} rather than renamed:
|
|
9
|
+
* it predates #1584's split and means what it always meant, a NUMBER of DIPs. Read it as
|
|
10
|
+
* `pixelSize`'s default; `iconSize` now defaults to the nick `'inherit'`, which resolves
|
|
11
|
+
* to this same number.
|
|
12
|
+
*/
|
|
13
|
+
export declare const DEFAULT_GTK_IMAGE_SIZE: number;
|
|
14
|
+
declare const GtkImage_base: (abstract new (...args: any[]) => {
|
|
15
|
+
connect(eventName: string, callback: (self: /*elided*/ any, data: import("@nativescript/core").EventData) => void): number;
|
|
16
|
+
disconnect(handlerId: number): void;
|
|
17
|
+
_emit(eventName: string): void;
|
|
18
|
+
addEventListener(eventName: string, callback: (data: import("@nativescript/core").EventData) => void, thisArg?: unknown, once?: boolean): void;
|
|
19
|
+
removeEventListener(eventName: string, callback?: (data: import("@nativescript/core").EventData) => void, thisArg?: unknown): void;
|
|
20
|
+
notify<T extends import("@nativescript/core").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 Image;
|
|
25
|
+
export declare class GtkImage extends GtkImage_base {
|
|
26
|
+
private _icon;
|
|
6
27
|
private _iconColor;
|
|
7
28
|
private _explicitColor;
|
|
8
29
|
private _iconSize;
|
|
30
|
+
private _pixelSize;
|
|
9
31
|
private _unsubScheme;
|
|
10
|
-
constructor();
|
|
32
|
+
constructor(props?: ConstructProps<GtkImage>);
|
|
11
33
|
/** Adopt the active scheme's default fill (no-op if the caller pinned a colour). */
|
|
12
34
|
private _syncThemeColor;
|
|
35
|
+
/** The size this image draws at right now: `pixelSize` when set, else `iconSize`. */
|
|
36
|
+
private get _renderedSize();
|
|
37
|
+
/** Resize the image box and re-rasterise the glyph into it. */
|
|
38
|
+
private _applySize;
|
|
13
39
|
private _render;
|
|
14
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* The icon to render: an Adwaita icon NAME (`'list-add-symbolic'`) or an Adwaita
|
|
42
|
+
* symbolic SVG SOURCE string (e.g. `panDownSymbolic`). A name the compiled subset
|
|
43
|
+
* does not carry draws the `image-missing` glyph; `''` draws nothing.
|
|
44
|
+
*/
|
|
15
45
|
get iconName(): string;
|
|
16
|
-
set iconName(
|
|
46
|
+
set iconName(value: string);
|
|
17
47
|
/** The icon fill colour (hex). Setting it PINS the colour (it no longer follows
|
|
18
48
|
* the light/dark scheme) — use it for context colours like white on a suggested
|
|
19
49
|
* button or destructive red, which must survive both schemes. */
|
|
20
50
|
get iconColor(): string;
|
|
21
51
|
set iconColor(value: string);
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
|
|
52
|
+
/**
|
|
53
|
+
* `Gtk.Image:icon-size` — one of `inherit`, `normal` (16 DIPs) or `large` (32).
|
|
54
|
+
*
|
|
55
|
+
* THE ENUM, not a number, and that is the whole of #1584: this name used to take a
|
|
56
|
+
* count of DIPs, so `<gtk:Image iconSize="large" />` — which is what a reader of the
|
|
57
|
+
* GTK documentation writes — failed to parse, fell back, and rendered at 16 with
|
|
58
|
+
* nothing reported. For a size in DIPs use {@link pixelSize}, which is the GTK
|
|
59
|
+
* property that means one. A value that is not a member THROWS, naming it and the
|
|
60
|
+
* three that are accepted: there is no range here to be lenient about.
|
|
61
|
+
*/
|
|
62
|
+
get iconSize(): GtkIconSizeNick;
|
|
63
|
+
set iconSize(value: GtkIconSizeNick);
|
|
64
|
+
/**
|
|
65
|
+
* `Gtk.Image:pixel-size` — the edge length in DIPs, overriding {@link iconSize}.
|
|
66
|
+
*
|
|
67
|
+
* This is what the property called `iconSize` did before #1584, under the name GTK
|
|
68
|
+
* gives it. It reads back `-1` while unset, which is what `gtk_image_get_pixel_size`
|
|
69
|
+
* answers and NOT the size the image draws at: a getter that answered the drawn size
|
|
70
|
+
* would make `image.pixelSize = image.pixelSize` pin it. Assigning any non-positive
|
|
71
|
+
* value clears the override and hands the size back to {@link iconSize}.
|
|
72
|
+
*/
|
|
73
|
+
get pixelSize(): number;
|
|
74
|
+
set pixelSize(raw: number | string);
|
|
25
75
|
}
|
|
76
|
+
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}.
|
|
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
|
|
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,12 @@ 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 { DEFAULT_ICON_PIXEL_SIZE, GTK_ICON_SIZE_NICKS, GTK_ICON_SIZE_PIXELS, type GtkIconSizeNick, isGtkIconSizeNick, PIXEL_SIZE_UNSET, } from './gtk-icon-size.js';
|
|
98
|
+
export { ICON_FALLBACK_NAME, compiledIconNames, iconValueKind, isIconAvailable, registerIcon, registeredIconNames, resolveIconSource, unregisterIcon, } from './icon-theme.js';
|
|
99
|
+
export type { IconValueKind } from './icon-theme.js';
|
|
88
100
|
export { ADWAITA_ICON_GRID, DEFAULT_ICON_COLOR, DEFAULT_ICON_COLOR_DARK, extractIconPaths, extractPathData, renderSymbolicIcon, } from './icons.js';
|
|
89
101
|
export type { IconPath, SymbolicIconOptions } from './icons.js';
|
|
90
102
|
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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
79
|
-
/** Set (or replace) the content pane. */
|
|
80
|
-
|
|
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.
|