@gjsify/adwaita-nativescript 0.12.0 → 0.13.1
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/widgets/adw-action-row.js +1 -1
- package/lib/esm/widgets/adw-avatar.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-combo-row.js +1 -1
- package/lib/esm/widgets/adw-expander-row.js +1 -1
- package/lib/esm/widgets/adw-icon.js +1 -1
- package/lib/esm/widgets/adw-image-button.js +1 -1
- package/lib/esm/widgets/adw-menu-button.js +1 -0
- 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-spin-row.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-tab-view.js +1 -1
- package/lib/esm/widgets/adw-toggle-group.js +1 -1
- package/lib/esm/widgets/adw-view-stack.js +1 -0
- package/lib/esm/widgets/adw-view-switcher-bar.js +1 -0
- package/lib/esm/widgets/breakpoint.js +1 -0
- package/lib/esm/widgets/color-scheme.js +1 -0
- package/lib/esm/widgets/icon-path.js +2 -1
- package/lib/esm/widgets/icons.android.js +1 -1
- package/lib/esm/widgets/index.js +1 -1
- package/lib/esm/widgets/split-view-base.js +1 -1
- package/lib/esm/widgets/view-switcher-base.js +1 -1
- package/lib/types/index.d.ts +2 -2
- package/lib/types/widgets/adw-action-row.d.ts +11 -2
- package/lib/types/widgets/adw-avatar.d.ts +5 -0
- package/lib/types/widgets/adw-button-content.d.ts +11 -6
- package/lib/types/widgets/adw-button-row.d.ts +16 -6
- package/lib/types/widgets/adw-expander-row.d.ts +4 -3
- package/lib/types/widgets/adw-icon.d.ts +7 -1
- package/lib/types/widgets/adw-image-button.d.ts +6 -1
- package/lib/types/widgets/adw-menu-button.d.ts +32 -0
- package/lib/types/widgets/adw-password-entry-row.d.ts +8 -0
- package/lib/types/widgets/adw-preferences-group.d.ts +10 -0
- package/lib/types/widgets/adw-spin-row.d.ts +7 -6
- package/lib/types/widgets/adw-split-button.d.ts +23 -8
- package/lib/types/widgets/adw-status-page.d.ts +24 -6
- package/lib/types/widgets/adw-tab-view.d.ts +11 -0
- package/lib/types/widgets/adw-toggle-group.d.ts +16 -5
- package/lib/types/widgets/adw-view-stack.d.ts +46 -0
- package/lib/types/widgets/adw-view-switcher-bar.d.ts +29 -0
- package/lib/types/widgets/breakpoint.d.ts +69 -0
- package/lib/types/widgets/color-scheme.d.ts +22 -0
- package/lib/types/widgets/icon-path.d.ts +15 -0
- package/lib/types/widgets/index.d.ts +9 -0
- package/lib/types/widgets/split-view-base.d.ts +8 -0
- package/lib/types/widgets/view-switcher-base.d.ts +17 -2
- package/package.json +6 -6
- package/src/theme/adwaita.css +281 -49
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type EventData } from '@nativescript/core';
|
|
2
|
+
import { AdwImageButton } from './adw-image-button.js';
|
|
3
|
+
/** Event name emitted when a menu item is chosen. */
|
|
4
|
+
export declare const MENU_ITEM_ACTIVATED = "menuItemActivated";
|
|
5
|
+
/** One entry in an {@link AdwMenuButton}'s menu. */
|
|
6
|
+
export interface AdwMenuItem {
|
|
7
|
+
/** Stable identifier reported on activation (defaults to {@link label}). */
|
|
8
|
+
id?: string;
|
|
9
|
+
/** The menu item's display label. */
|
|
10
|
+
label: string;
|
|
11
|
+
}
|
|
12
|
+
/** Payload of the {@link MENU_ITEM_ACTIVATED} event. */
|
|
13
|
+
export interface MenuItemActivatedEventData extends EventData {
|
|
14
|
+
/** The chosen item's id (or its label when no id was given). */
|
|
15
|
+
id: string;
|
|
16
|
+
/** The chosen item's label. */
|
|
17
|
+
label: string;
|
|
18
|
+
/** The chosen item's index in {@link AdwMenuButton.menuItems}. */
|
|
19
|
+
index: number;
|
|
20
|
+
}
|
|
21
|
+
export declare class AdwMenuButton extends AdwImageButton {
|
|
22
|
+
private _items;
|
|
23
|
+
private _menuTitle;
|
|
24
|
+
constructor();
|
|
25
|
+
/** The menu items (opened as a native `action()` sheet on tap). */
|
|
26
|
+
get menuItems(): AdwMenuItem[];
|
|
27
|
+
set menuItems(value: AdwMenuItem[]);
|
|
28
|
+
/** Optional title shown atop the native menu sheet. */
|
|
29
|
+
get menuTitle(): string;
|
|
30
|
+
set menuTitle(value: string);
|
|
31
|
+
private _openMenu;
|
|
32
|
+
}
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { AdwEntryRow } from './adw-entry-row.js';
|
|
2
|
+
import { AdwImageButton } from './adw-image-button.js';
|
|
2
3
|
export declare class AdwPasswordEntryRow extends AdwEntryRow {
|
|
4
|
+
/** The trailing peek (reveal/conceal) toggle button. */
|
|
5
|
+
protected readonly _peekButton: AdwImageButton;
|
|
3
6
|
constructor();
|
|
7
|
+
/** Toggle the masked/revealed state + swap the eye icon. */
|
|
8
|
+
private _togglePeek;
|
|
9
|
+
/** Whether the password is currently revealed (the value is shown). */
|
|
10
|
+
get peeking(): boolean;
|
|
11
|
+
set peeking(value: boolean);
|
|
4
12
|
}
|
|
@@ -18,6 +18,16 @@ export declare class AdwPreferencesGroup extends StackLayout {
|
|
|
18
18
|
addRow(view: View): void;
|
|
19
19
|
/** Remove a previously-added row from the boxed list. */
|
|
20
20
|
removeRow(view: View): void;
|
|
21
|
+
/**
|
|
22
|
+
* Mark the FIRST row so it draws no top separator. Adwaita draws hairline
|
|
23
|
+
* separators BETWEEN rows only; the `.boxed-list .adw-row` top-border rule
|
|
24
|
+
* would otherwise also stroke above the first row (NS does not clip it under
|
|
25
|
+
* the card's rounded corner), reading as a stray line. NS has no
|
|
26
|
+
* `:first-child`, so toggle an `adw-row-flush-top` class. Recomputes from the
|
|
27
|
+
* live children, so it stays correct after a `listbox.removeChildren()` +
|
|
28
|
+
* re-add (the controls panel's refresh path). */
|
|
29
|
+
private _refreshRowEdges;
|
|
30
|
+
private _setFlushTop;
|
|
21
31
|
/** The boxed-list container (column of rows). */
|
|
22
32
|
get listbox(): StackLayout;
|
|
23
33
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Label, type EventData } from '@nativescript/core';
|
|
2
2
|
import { AdwActionRow } from './adw-action-row.js';
|
|
3
|
+
import { AdwImageButton } from './adw-image-button.js';
|
|
3
4
|
/** Event name emitted when {@link AdwSpinRow.value} changes. Mirrors GObject `notify::value`. */
|
|
4
5
|
export declare const NOTIFY_VALUE = "notify::value";
|
|
5
6
|
/** Payload of the `notify::value` event. */
|
|
@@ -8,11 +9,11 @@ export interface NotifyValueEventData extends EventData {
|
|
|
8
9
|
value: number;
|
|
9
10
|
}
|
|
10
11
|
export declare class AdwSpinRow extends AdwActionRow {
|
|
11
|
-
/** The `−` decrement button. */
|
|
12
|
-
protected readonly _minusButton:
|
|
13
|
-
/** The `+` increment button. */
|
|
14
|
-
protected readonly _plusButton:
|
|
15
|
-
/** The value display
|
|
12
|
+
/** The `−` decrement button (circular icon button, value-decrease symbolic). */
|
|
13
|
+
protected readonly _minusButton: AdwImageButton;
|
|
14
|
+
/** The `+` increment button (circular icon button, value-increase symbolic). */
|
|
15
|
+
protected readonly _plusButton: AdwImageButton;
|
|
16
|
+
/** The value display before the stepper buttons. */
|
|
16
17
|
protected readonly _valueLabel: Label;
|
|
17
18
|
private _value;
|
|
18
19
|
private _min;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GridLayout, Label, StackLayout, type EventData } from '@nativescript/core';
|
|
2
|
+
import { AdwIcon } from './adw-icon.js';
|
|
2
3
|
/** Event name emitted when the main action part is tapped. Mirrors `Adw.SplitButton::clicked`. */
|
|
3
4
|
export declare const CLICKED = "clicked";
|
|
4
5
|
/** Event name emitted when a dropdown menu item is chosen. */
|
|
@@ -11,19 +12,33 @@ export interface MenuTappedEventData extends EventData {
|
|
|
11
12
|
index: number;
|
|
12
13
|
}
|
|
13
14
|
export declare class AdwSplitButton extends GridLayout {
|
|
14
|
-
/** The main action
|
|
15
|
-
protected readonly
|
|
16
|
-
/** The
|
|
17
|
-
protected readonly
|
|
15
|
+
/** The main action part (column 0). */
|
|
16
|
+
protected readonly _actionPart: StackLayout;
|
|
17
|
+
/** The action label (shown when no `actionIcon` is set). */
|
|
18
|
+
protected readonly _actionLabel: Label;
|
|
19
|
+
/** The action symbolic icon (shown when an `actionIcon` is set). */
|
|
20
|
+
protected readonly _actionIcon: AdwIcon;
|
|
21
|
+
/** The dropdown-arrow part (column 1). */
|
|
22
|
+
protected readonly _dropdownPart: GridLayout;
|
|
23
|
+
/** The pan-down chevron. */
|
|
24
|
+
protected readonly _chevron: AdwIcon;
|
|
18
25
|
private _menu;
|
|
26
|
+
private _hasActionIcon;
|
|
27
|
+
private _actionIconSvg;
|
|
19
28
|
constructor();
|
|
20
29
|
private _openMenu;
|
|
21
|
-
/** The main action button's label. */
|
|
30
|
+
/** The main action button's text label (used when no `actionIcon` is set). */
|
|
22
31
|
get label(): string;
|
|
23
32
|
set label(value: string);
|
|
33
|
+
/**
|
|
34
|
+
* A symbolic SVG for the action part (e.g. `documentSaveSymbolic`). When set,
|
|
35
|
+
* the icon replaces the text label — matching `Adw.SplitButton`'s icon mode.
|
|
36
|
+
*/
|
|
37
|
+
get actionIcon(): string;
|
|
38
|
+
set actionIcon(svg: string);
|
|
24
39
|
/** The dropdown menu items (opened as a native `action()` sheet on arrow tap). */
|
|
25
40
|
get menu(): string[];
|
|
26
41
|
set menu(value: string[]);
|
|
27
|
-
/** The main action
|
|
28
|
-
get actionButton():
|
|
42
|
+
/** The main action part (for composing a custom content widget). */
|
|
43
|
+
get actionButton(): StackLayout;
|
|
29
44
|
}
|
|
@@ -1,25 +1,43 @@
|
|
|
1
1
|
import { GridLayout, Label, StackLayout, View } from '@nativescript/core';
|
|
2
|
+
import { AdwIcon } from './adw-icon.js';
|
|
2
3
|
export declare class AdwStatusPage extends GridLayout {
|
|
3
4
|
/** The centered vertical stack. */
|
|
4
5
|
protected readonly _stack: StackLayout;
|
|
5
|
-
/** The large icon
|
|
6
|
+
/** The large symbolic icon (shown when an `icon` SVG is set). */
|
|
7
|
+
protected readonly _icon: AdwIcon;
|
|
8
|
+
private _iconSvg;
|
|
9
|
+
/** The large glyph label (shown when `iconText` is set — the legacy fallback). */
|
|
6
10
|
protected readonly _iconLabel: Label;
|
|
11
|
+
private _iconGlyph;
|
|
12
|
+
/** The icon node currently in the stack (the AdwIcon or the glyph Label), or null. */
|
|
13
|
+
private _iconNode;
|
|
7
14
|
/** The bold title label. */
|
|
8
15
|
protected readonly _titleLabel: Label;
|
|
9
16
|
/** The dim description label (lazily in the tree — only when set). */
|
|
10
17
|
protected readonly _descriptionLabel: Label;
|
|
11
|
-
private _hasIcon;
|
|
12
18
|
private _hasDescription;
|
|
13
19
|
private _child;
|
|
14
20
|
constructor();
|
|
15
21
|
/**
|
|
16
|
-
* A large
|
|
17
|
-
* non-empty value
|
|
18
|
-
* removes it.
|
|
19
|
-
*
|
|
22
|
+
* A large Adwaita symbolic SVG string shown above the title (e.g.
|
|
23
|
+
* `folderSymbolic`). Setting a non-empty value shows the symbolic icon; empty
|
|
24
|
+
* removes it. Matches `Adw.StatusPage`'s themed icon. Mutually exclusive with
|
|
25
|
+
* {@link iconText} — whichever was set last wins.
|
|
26
|
+
*/
|
|
27
|
+
get icon(): string;
|
|
28
|
+
set icon(value: string);
|
|
29
|
+
/**
|
|
30
|
+
* A large glyph shown above the title (emoji / font glyph — the legacy
|
|
31
|
+
* fallback for callers that have no symbolic SVG). Mutually exclusive with
|
|
32
|
+
* {@link icon}; prefer `icon` for real Adwaita symbolics.
|
|
20
33
|
*/
|
|
21
34
|
get iconText(): string;
|
|
22
35
|
set iconText(value: string);
|
|
36
|
+
/** Swap the icon node at the TOP of the stack (above the title), or clear it. */
|
|
37
|
+
private _setIconNode;
|
|
38
|
+
/** The icon fill colour (hex). Defaults to a dim grey; light/dark callers may override. */
|
|
39
|
+
get iconColor(): string;
|
|
40
|
+
set iconColor(value: string);
|
|
23
41
|
/** The page title (bold, centered). */
|
|
24
42
|
get title(): string;
|
|
25
43
|
set title(value: string);
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
+
import type { StackLayout } from '@nativescript/core';
|
|
1
2
|
import { AdwViewSwitcherBase, type AdwViewPage } from './view-switcher-base.js';
|
|
2
3
|
export declare class AdwTabView extends AdwViewSwitcherBase {
|
|
4
|
+
/** The per-tab close buttons, parallel to {@link AdwViewSwitcherBase._buttons}. */
|
|
5
|
+
private readonly _closeButtons;
|
|
3
6
|
constructor();
|
|
4
7
|
protected get barClass(): string;
|
|
5
8
|
protected get buttonClass(): string;
|
|
9
|
+
/** Append a small ✕ close button to each tab (shown only when active). */
|
|
10
|
+
protected _buildButtonExtras(button: StackLayout, _page: AdwViewPage, index: number): void;
|
|
11
|
+
/** Reveal the close button only on the active tab (touch analogue of hover). */
|
|
12
|
+
protected _applyButtonState(_button: StackLayout, index: number, active: boolean): void;
|
|
13
|
+
/** Remove a tab + its page (no-op when only one tab remains). */
|
|
14
|
+
private _closeTab;
|
|
15
|
+
/** Rebuild from scratch — drop the stale per-tab close-button refs first. */
|
|
16
|
+
setViews(pages: AdwViewPage[]): void;
|
|
6
17
|
/** The tab pages — an alias of the shared {@link AdwViewSwitcherBase.views}. */
|
|
7
18
|
get tabs(): AdwViewPage[];
|
|
8
19
|
set tabs(pages: AdwViewPage[]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StackLayout, type EventData } from '@nativescript/core';
|
|
2
2
|
/** Event name emitted when {@link AdwToggleGroup.selected} changes. Mirrors GObject `notify::selected`. */
|
|
3
3
|
export declare const NOTIFY_SELECTED = "notify::selected";
|
|
4
4
|
/** Payload of the `notify::selected` event. */
|
|
@@ -8,13 +8,24 @@ export interface NotifyToggleSelectedEventData extends EventData {
|
|
|
8
8
|
/** The newly-selected segment's label. */
|
|
9
9
|
value: string;
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
/** One toggle: a label and an optional Adwaita symbolic SVG icon. */
|
|
12
|
+
export interface AdwToggle {
|
|
13
|
+
label: string;
|
|
14
|
+
icon?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class AdwToggleGroup extends StackLayout {
|
|
17
|
+
private _toggles;
|
|
18
|
+
private readonly _segments;
|
|
19
|
+
private _selected;
|
|
13
20
|
constructor();
|
|
14
|
-
/** The segment labels. Setting them rebuilds the
|
|
21
|
+
/** The segment labels (icon-less). Setting them rebuilds the toggle group. */
|
|
15
22
|
get options(): string[];
|
|
16
23
|
set options(value: string[]);
|
|
17
|
-
/**
|
|
24
|
+
/** Set the toggles (label + optional symbolic icon). Rebuilds the segments. */
|
|
25
|
+
setToggles(toggles: AdwToggle[]): void;
|
|
26
|
+
/** Mark only the selected segment `.active` (the raised white pill). */
|
|
27
|
+
private _applySelection;
|
|
28
|
+
/** The selected segment index. Swaps the active pill + emits `notify::selected`. */
|
|
18
29
|
get selected(): number;
|
|
19
30
|
set selected(value: number);
|
|
20
31
|
/** The selected segment's label, or `''` when out of range. */
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { GridLayout, View, type EventData } from '@nativescript/core';
|
|
2
|
+
/** Event name emitted when the visible child changes. Mirrors GObject `notify::visible-child`. */
|
|
3
|
+
export declare const NOTIFY_VISIBLE_CHILD = "notify::visible-child";
|
|
4
|
+
/** Payload of the {@link NOTIFY_VISIBLE_CHILD} event. */
|
|
5
|
+
export interface NotifyVisibleChildEventData extends EventData {
|
|
6
|
+
/** The newly-visible page's index. */
|
|
7
|
+
index: number;
|
|
8
|
+
/** The newly-visible page's name. */
|
|
9
|
+
name: string;
|
|
10
|
+
/** The newly-visible page's title. */
|
|
11
|
+
title: string;
|
|
12
|
+
}
|
|
13
|
+
/** One page registered with an {@link AdwViewStack}. */
|
|
14
|
+
export interface AdwViewStackPage {
|
|
15
|
+
/** Stable identifier used by `visibleChildName` / switcher binding. */
|
|
16
|
+
name: string;
|
|
17
|
+
/** Human-facing title shown in a bound switcher button. */
|
|
18
|
+
title: string;
|
|
19
|
+
/** Optional Adwaita symbolic SVG shown in a bound switcher button. */
|
|
20
|
+
icon?: string;
|
|
21
|
+
/** The page content view, shown when this page is selected. */
|
|
22
|
+
content: View;
|
|
23
|
+
}
|
|
24
|
+
export declare class AdwViewStack extends GridLayout {
|
|
25
|
+
private readonly _pages;
|
|
26
|
+
private _visibleIndex;
|
|
27
|
+
constructor();
|
|
28
|
+
/**
|
|
29
|
+
* Register a page. The FIRST page added becomes visible automatically so the
|
|
30
|
+
* stack is never empty, matching `Adw.ViewStack`. Returns the page handle.
|
|
31
|
+
*/
|
|
32
|
+
add(content: View, name: string, title?: string, icon?: string): AdwViewStackPage;
|
|
33
|
+
/** Convenience alias matching `Adw.ViewStack.add_titled`. */
|
|
34
|
+
addTitled(content: View, name: string, title: string): AdwViewStackPage;
|
|
35
|
+
/** All registered pages, in add order (a bound switcher reads this). */
|
|
36
|
+
get pages(): readonly AdwViewStackPage[];
|
|
37
|
+
/** The visible page index. Swaps the visible page + emits `notify::visible-child`. */
|
|
38
|
+
get visibleChildIndex(): number;
|
|
39
|
+
set visibleChildIndex(value: number);
|
|
40
|
+
/** The visible page name (`Adw.ViewStack.visible-child-name`). */
|
|
41
|
+
get visibleChildName(): string;
|
|
42
|
+
set visibleChildName(name: string);
|
|
43
|
+
/** The visible page content view, or `null`. */
|
|
44
|
+
get visibleChild(): View | null;
|
|
45
|
+
private _apply;
|
|
46
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { GridLayout } from '@nativescript/core';
|
|
2
|
+
import { AdwViewStack } from './adw-view-stack.js';
|
|
3
|
+
export declare class AdwViewSwitcherBar extends GridLayout {
|
|
4
|
+
/** The horizontal (homogeneous) row of buttons. */
|
|
5
|
+
private readonly _bar;
|
|
6
|
+
/** The tappable button containers, one per stack page, in page order. */
|
|
7
|
+
private readonly _buttons;
|
|
8
|
+
private _stack;
|
|
9
|
+
private _stackListener;
|
|
10
|
+
private _revealed;
|
|
11
|
+
constructor();
|
|
12
|
+
/** Bind to an {@link AdwViewStack}: build buttons from its pages + two-way sync. */
|
|
13
|
+
setStack(stack: AdwViewStack | null): void;
|
|
14
|
+
/** The bound stack (`Adw.ViewSwitcherBar.stack`). */
|
|
15
|
+
get stack(): AdwViewStack | null;
|
|
16
|
+
set stack(value: AdwViewStack | null);
|
|
17
|
+
/**
|
|
18
|
+
* Whether the bar is shown (`Adw.ViewSwitcherBar.reveal`). An adaptive layout
|
|
19
|
+
* sets this `true` on narrow screens and `false` on wide ones (where a header-bar
|
|
20
|
+
* `AdwViewSwitcher` takes over).
|
|
21
|
+
*/
|
|
22
|
+
get revealed(): boolean;
|
|
23
|
+
set revealed(value: boolean);
|
|
24
|
+
/** Rebuild the button row from the bound stack's pages (call after late page adds). */
|
|
25
|
+
refresh(): void;
|
|
26
|
+
private _rebuild;
|
|
27
|
+
/** Mark the button for the stack's visible page active (accent label via CSS). */
|
|
28
|
+
private _syncActive;
|
|
29
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { View } from '@nativescript/core';
|
|
2
|
+
/** The two size axes a condition can test. */
|
|
3
|
+
export type BreakpointDimension = 'width' | 'height';
|
|
4
|
+
/** Whether a leaf is a lower (`min`) or upper (`max`) bound. */
|
|
5
|
+
export type BreakpointBound = 'min' | 'max';
|
|
6
|
+
/** A single `min-/max-width/height: <value>` comparison (value in DIPs). */
|
|
7
|
+
export interface BreakpointConditionLeaf {
|
|
8
|
+
dimension: BreakpointDimension;
|
|
9
|
+
bound: BreakpointBound;
|
|
10
|
+
/** Threshold in DIPs (the parsed `px` / `sp` / `pt` value). */
|
|
11
|
+
value: number;
|
|
12
|
+
}
|
|
13
|
+
/** A boolean combination of two condition nodes. */
|
|
14
|
+
export interface BreakpointConditionGroup {
|
|
15
|
+
op: 'and' | 'or';
|
|
16
|
+
left: BreakpointConditionNode;
|
|
17
|
+
right: BreakpointConditionNode;
|
|
18
|
+
}
|
|
19
|
+
/** A parsed breakpoint condition: a leaf comparison or an and/or group. */
|
|
20
|
+
export type BreakpointConditionNode = BreakpointConditionLeaf | BreakpointConditionGroup;
|
|
21
|
+
/** A measured size in DIPs. */
|
|
22
|
+
export interface BreakpointSize {
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Parse a Libadwaita breakpoint condition string into a {@link BreakpointConditionNode}.
|
|
28
|
+
* Accepts a single comparison (`'max-width: 720sp'`), and/or chains
|
|
29
|
+
* (`'max-width: 720sp and max-height: 480sp'`), and parenthesised groups. Units
|
|
30
|
+
* are read as DIPs. Returns null when the string can't be parsed.
|
|
31
|
+
*/
|
|
32
|
+
export declare function parseBreakpointCondition(spec: string): BreakpointConditionNode | null;
|
|
33
|
+
/** Evaluate a parsed condition against a measured size (DIPs). */
|
|
34
|
+
export declare function evaluateBreakpointCondition(node: BreakpointConditionNode, size: BreakpointSize): boolean;
|
|
35
|
+
/** Callbacks run as a breakpoint's condition flips. */
|
|
36
|
+
export interface AdwBreakpointHandlers {
|
|
37
|
+
/** Run when the condition becomes true (the narrow/large state is entered). */
|
|
38
|
+
onApply: () => void;
|
|
39
|
+
/** Run when the condition becomes false again. Optional. */
|
|
40
|
+
onUnapply?: () => void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A single responsive breakpoint: a condition plus apply/unapply callbacks.
|
|
44
|
+
* Mirrors `Adw.Breakpoint`. Bind one or more to a view with {@link addBreakpoints}
|
|
45
|
+
* (or drive {@link evaluate} yourself from a custom size source).
|
|
46
|
+
*/
|
|
47
|
+
export declare class AdwBreakpoint {
|
|
48
|
+
/** The parsed condition (null when an invalid string was passed). */
|
|
49
|
+
readonly condition: BreakpointConditionNode | null;
|
|
50
|
+
private _handlers;
|
|
51
|
+
private _applied;
|
|
52
|
+
constructor(condition: string | BreakpointConditionNode | null, handlers: AdwBreakpointHandlers);
|
|
53
|
+
/** Whether the condition is currently satisfied (apply has fired, not unapply). */
|
|
54
|
+
get applied(): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Re-evaluate against `size`, firing apply / unapply ONLY on a state change
|
|
57
|
+
* (so a steady stream of layout passes doesn't re-run the callbacks). Returns
|
|
58
|
+
* the post-evaluation applied state. A null condition never applies.
|
|
59
|
+
*/
|
|
60
|
+
evaluate(size: BreakpointSize): boolean;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Bind breakpoints to a view so they re-evaluate on every layout pass (the NS
|
|
64
|
+
* stand-in for Adwaita's window-size signal): the view's `layoutChanged` event
|
|
65
|
+
* drives {@link AdwBreakpoint.evaluate} with the post-layout DIP size, and a
|
|
66
|
+
* `loaded` seed evaluates once the first size is known. Each breakpoint is
|
|
67
|
+
* evaluated independently. Returns a dispose function that detaches the listeners.
|
|
68
|
+
*/
|
|
69
|
+
export declare function addBreakpoints(view: View, breakpoints: AdwBreakpoint[]): () => void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** The two Adwaita color schemes. */
|
|
2
|
+
export type AdwColorScheme = 'light' | 'dark';
|
|
3
|
+
/** The active color scheme (default `'light'`). */
|
|
4
|
+
export declare function adwaitaColorScheme(): AdwColorScheme;
|
|
5
|
+
/**
|
|
6
|
+
* Set the active color scheme. A no-op when unchanged; otherwise notifies every
|
|
7
|
+
* subscriber (so theme-aware icons re-render). The host app should also toggle
|
|
8
|
+
* the `ns-dark` class on its root view for the CSS half.
|
|
9
|
+
*/
|
|
10
|
+
export declare function setAdwaitaColorScheme(scheme: AdwColorScheme): void;
|
|
11
|
+
/** Flip light↔dark and return the new scheme. */
|
|
12
|
+
export declare function toggleAdwaitaColorScheme(): AdwColorScheme;
|
|
13
|
+
/** The default symbolic-icon fill for the active scheme (dark fg on light, near-white on dark). */
|
|
14
|
+
export declare function themeIconColor(): string;
|
|
15
|
+
/** Whether `color` is the current scheme-default fill (i.e. not a caller-set explicit colour). */
|
|
16
|
+
export declare function isThemeIconColor(color: string): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Subscribe to scheme changes. Returns an unsubscribe function. Icon widgets
|
|
19
|
+
* subscribe while `loaded` and unsubscribe on `unloaded`, so the registry only
|
|
20
|
+
* ever holds on-screen icons.
|
|
21
|
+
*/
|
|
22
|
+
export declare function onAdwaitaColorSchemeChanged(listener: () => void): () => void;
|
|
@@ -34,3 +34,18 @@ export declare function extractIconPaths(svg: string): IconPath[];
|
|
|
34
34
|
* `''` when the SVG carries no path data.
|
|
35
35
|
*/
|
|
36
36
|
export declare function extractPathData(svg: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* Space-separate the two single-digit ARC FLAGS (large-arc, sweep) in every
|
|
39
|
+
* elliptical-arc command (`A`/`a`) of an SVG path-data string.
|
|
40
|
+
*
|
|
41
|
+
* Android's `androidx.core.graphics.PathParser` (and `VectorDrawable`) tokenise
|
|
42
|
+
* arc flags as standalone numbers and THROW ("Error in parsing …") when the SVG
|
|
43
|
+
* compact form glues a flag to the next flag or coordinate — e.g.
|
|
44
|
+
* `a3 3 0 00-1.6-.1` packs `large-arc=0`, `sweep=0`, `x=-1.6`. The SVG grammar
|
|
45
|
+
* permits this (each flag is a single `0`/`1` digit), and many Adwaita symbolic
|
|
46
|
+
* icons (notably the `legacy` set) use it, so they crash the renderer. This
|
|
47
|
+
* re-emits each arc argument group with explicit spaces; every other command
|
|
48
|
+
* passes through unchanged. (Assumes the standard `x-axis-rotation 0` Adwaita
|
|
49
|
+
* icons use — a multi-digit rotation glued directly to the flags is not split.)
|
|
50
|
+
*/
|
|
51
|
+
export declare function normalizeArcFlags(d: string): string;
|
|
@@ -17,6 +17,8 @@ export type { NotifyExpandedEventData } from './adw-expander-row.js';
|
|
|
17
17
|
export { AdwButton } from './adw-button.js';
|
|
18
18
|
export type { AdwButtonVariant } from './adw-button.js';
|
|
19
19
|
export { AdwImageButton, DEFAULT_ICON_BUTTON_ICON_SIZE } from './adw-image-button.js';
|
|
20
|
+
export { AdwMenuButton, MENU_ITEM_ACTIVATED } from './adw-menu-button.js';
|
|
21
|
+
export type { AdwMenuItem, MenuItemActivatedEventData } from './adw-menu-button.js';
|
|
20
22
|
export { AdwIcon, DEFAULT_ADW_ICON_SIZE } from './adw-icon.js';
|
|
21
23
|
export { AdwBanner, BUTTON_CLICKED } from './adw-banner.js';
|
|
22
24
|
export { AdwAvatar, DEFAULT_AVATAR_SIZE, avatarInitials } from './adw-avatar.js';
|
|
@@ -33,9 +35,12 @@ export { AdwSplitButton, CLICKED, MENU_TAPPED } from './adw-split-button.js';
|
|
|
33
35
|
export type { MenuTappedEventData } from './adw-split-button.js';
|
|
34
36
|
export { AdwToggleGroup, NOTIFY_SELECTED as NOTIFY_TOGGLE_SELECTED } from './adw-toggle-group.js';
|
|
35
37
|
export type { NotifyToggleSelectedEventData } from './adw-toggle-group.js';
|
|
38
|
+
export { AdwViewStack, NOTIFY_VISIBLE_CHILD } from './adw-view-stack.js';
|
|
39
|
+
export type { AdwViewStackPage, NotifyVisibleChildEventData } from './adw-view-stack.js';
|
|
36
40
|
export { AdwViewSwitcherBase, NOTIFY_SELECTED as NOTIFY_VIEW_SELECTED } from './view-switcher-base.js';
|
|
37
41
|
export type { AdwViewPage, NotifyViewSelectedEventData } from './view-switcher-base.js';
|
|
38
42
|
export { AdwViewSwitcher } from './adw-view-switcher.js';
|
|
43
|
+
export { AdwViewSwitcherBar } from './adw-view-switcher-bar.js';
|
|
39
44
|
export { AdwInlineViewSwitcher } from './adw-inline-view-switcher.js';
|
|
40
45
|
export { AdwTabView } from './adw-tab-view.js';
|
|
41
46
|
export { AdwCarousel, DEFAULT_CAROUSEL_PAGE_WIDTH, NOTIFY_POSITION } from './adw-carousel.js';
|
|
@@ -59,6 +64,10 @@ export { AdwPreferencesDialog, CLOSED as PREFERENCES_CLOSED } from './adw-prefer
|
|
|
59
64
|
export { attachRowPressFeedback } from './row-press.js';
|
|
60
65
|
export { ADWAITA_ICON_GRID, DEFAULT_ICON_COLOR, DEFAULT_ICON_COLOR_DARK, extractIconPaths, extractPathData, renderSymbolicIcon, } from './icons.js';
|
|
61
66
|
export type { IconPath, SymbolicIconOptions } from './icons.js';
|
|
67
|
+
export { adwaitaColorScheme, isThemeIconColor, onAdwaitaColorSchemeChanged, setAdwaitaColorScheme, themeIconColor, toggleAdwaitaColorScheme, } from './color-scheme.js';
|
|
68
|
+
export type { AdwColorScheme } from './color-scheme.js';
|
|
69
|
+
export { AdwBreakpoint, addBreakpoints, evaluateBreakpointCondition, parseBreakpointCondition, } from './breakpoint.js';
|
|
70
|
+
export type { AdwBreakpointHandlers, BreakpointBound, BreakpointConditionGroup, BreakpointConditionLeaf, BreakpointConditionNode, BreakpointDimension, BreakpointSize, } from './breakpoint.js';
|
|
62
71
|
/**
|
|
63
72
|
* Register all Adwaita widgets as NativeScript XML elements (idempotent).
|
|
64
73
|
*
|
|
@@ -18,6 +18,14 @@ export declare abstract class AdwSplitViewBase extends GridLayout {
|
|
|
18
18
|
protected _sidebarWidth: number;
|
|
19
19
|
protected _sidebarPosition: 'start' | 'end';
|
|
20
20
|
constructor(rootClass: string);
|
|
21
|
+
/**
|
|
22
|
+
* (Re)declare the two columns so the sidebar's column is fixed-width ('auto')
|
|
23
|
+
* and the content's is expanding ('star'), ordered by {@link sidebarPosition}:
|
|
24
|
+
* `start` → [sidebar auto, content star]; `end` → [content star, sidebar auto].
|
|
25
|
+
* Without this an `end` sidebar would land in the expanding column and float
|
|
26
|
+
* away from the right edge (leaving a gap), with the content squeezed.
|
|
27
|
+
*/
|
|
28
|
+
protected _syncColumns(): void;
|
|
21
29
|
/** Subclass-specific layout application for the current collapsed/show state. */
|
|
22
30
|
protected abstract _applyLayout(): void;
|
|
23
31
|
/** Apply a user-initiated show/hide toggle. The default is an instant re-layout;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GridLayout, StackLayout, View, type EventData } from '@nativescript/core';
|
|
2
2
|
/** Event name emitted when the selected view changes. Mirrors GObject `notify::selected`. */
|
|
3
3
|
export declare const NOTIFY_SELECTED = "notify::selected";
|
|
4
4
|
/** Payload of the `notify::selected` event. */
|
|
@@ -14,6 +14,8 @@ export interface AdwViewPage {
|
|
|
14
14
|
title: string;
|
|
15
15
|
/** The page content view, shown when this page is selected. */
|
|
16
16
|
content: View;
|
|
17
|
+
/** Optional Adwaita symbolic SVG shown left of the label in the switcher button. */
|
|
18
|
+
icon?: string;
|
|
17
19
|
}
|
|
18
20
|
/**
|
|
19
21
|
* Shared base: a switcher bar (row 0) + a content area (row 1), one page visible.
|
|
@@ -25,7 +27,8 @@ export declare abstract class AdwViewSwitcherBase extends GridLayout {
|
|
|
25
27
|
/** The content area where the selected page is shown. */
|
|
26
28
|
protected readonly _contentArea: GridLayout;
|
|
27
29
|
protected readonly _pages: AdwViewPage[];
|
|
28
|
-
|
|
30
|
+
/** The tappable button containers (one per page), in bar order. */
|
|
31
|
+
protected readonly _buttons: StackLayout[];
|
|
29
32
|
protected _selected: number;
|
|
30
33
|
/** CSS class applied to the switcher bar — subclass-specific. */
|
|
31
34
|
protected abstract get barClass(): string;
|
|
@@ -38,6 +41,18 @@ export declare abstract class AdwViewSwitcherBase extends GridLayout {
|
|
|
38
41
|
setViews(pages: AdwViewPage[]): void;
|
|
39
42
|
/** Show only the selected page; mark its button active. */
|
|
40
43
|
protected _applySelection(): void;
|
|
44
|
+
/**
|
|
45
|
+
* Hook: append extra chrome to a freshly-built button (after icon + label).
|
|
46
|
+
* Default no-op. Subclasses (e.g. {@link AdwTabView}) override to add a close
|
|
47
|
+
* button. The button is the tappable `StackLayout` container.
|
|
48
|
+
*/
|
|
49
|
+
protected _buildButtonExtras(_button: StackLayout, _page: AdwViewPage, _index: number): void;
|
|
50
|
+
/**
|
|
51
|
+
* Hook: react to a button's active/inactive state on every selection change.
|
|
52
|
+
* Default no-op. Subclasses override to e.g. show the close button only on the
|
|
53
|
+
* active tab.
|
|
54
|
+
*/
|
|
55
|
+
protected _applyButtonState(_button: StackLayout, _index: number, _active: boolean): void;
|
|
41
56
|
/** The registered view pages. */
|
|
42
57
|
get views(): AdwViewPage[];
|
|
43
58
|
set views(pages: AdwViewPage[]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/adwaita-nativescript",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.1",
|
|
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",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"design-system"
|
|
48
48
|
],
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@gjsify/adwaita-fonts": "^0.
|
|
51
|
-
"@gjsify/adwaita-icons": "^0.
|
|
52
|
-
"@gjsify/native-platform": "^0.
|
|
50
|
+
"@gjsify/adwaita-fonts": "^0.13.1",
|
|
51
|
+
"@gjsify/adwaita-icons": "^0.13.1",
|
|
52
|
+
"@gjsify/native-platform": "^0.13.1"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@nativescript/core": "*"
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@gjsify/cli": "^0.
|
|
64
|
-
"@gjsify/unit": "^0.
|
|
63
|
+
"@gjsify/cli": "^0.13.1",
|
|
64
|
+
"@gjsify/unit": "^0.13.1",
|
|
65
65
|
"@types/node": "^25.9.2",
|
|
66
66
|
"typescript": "^6.0.3"
|
|
67
67
|
},
|