@gjsify/adwaita-nativescript 0.11.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 (100) hide show
  1. package/lib/esm/_virtual/_rolldown/runtime.js +1 -0
  2. package/lib/esm/fonts.js +2 -0
  3. package/lib/esm/index.js +1 -0
  4. package/lib/esm/widgets/adw-about-dialog.js +1 -0
  5. package/lib/esm/widgets/adw-action-row.js +1 -0
  6. package/lib/esm/widgets/adw-alert-dialog.js +1 -0
  7. package/lib/esm/widgets/adw-avatar.js +1 -0
  8. package/lib/esm/widgets/adw-banner.js +1 -0
  9. package/lib/esm/widgets/adw-bottom-sheet.js +1 -0
  10. package/lib/esm/widgets/adw-button-content.js +1 -0
  11. package/lib/esm/widgets/adw-button-row.js +1 -0
  12. package/lib/esm/widgets/adw-button.js +1 -0
  13. package/lib/esm/widgets/adw-carousel.js +1 -0
  14. package/lib/esm/widgets/adw-clamp.js +1 -0
  15. package/lib/esm/widgets/adw-combo-row.js +1 -0
  16. package/lib/esm/widgets/adw-entry-row.js +1 -0
  17. package/lib/esm/widgets/adw-expander-row.js +1 -0
  18. package/lib/esm/widgets/adw-header-bar.js +1 -0
  19. package/lib/esm/widgets/adw-icon.js +1 -0
  20. package/lib/esm/widgets/adw-image-button.js +1 -0
  21. package/lib/esm/widgets/adw-inline-view-switcher.js +1 -0
  22. package/lib/esm/widgets/adw-navigation-split-view.js +1 -0
  23. package/lib/esm/widgets/adw-navigation-view.js +1 -0
  24. package/lib/esm/widgets/adw-overlay-split-view.js +1 -0
  25. package/lib/esm/widgets/adw-password-entry-row.js +1 -0
  26. package/lib/esm/widgets/adw-preferences-dialog.js +1 -0
  27. package/lib/esm/widgets/adw-preferences-group.js +1 -0
  28. package/lib/esm/widgets/adw-preferences-page.js +1 -0
  29. package/lib/esm/widgets/adw-sidebar.js +1 -0
  30. package/lib/esm/widgets/adw-slider-row.js +1 -0
  31. package/lib/esm/widgets/adw-spin-row.js +1 -0
  32. package/lib/esm/widgets/adw-spinner.js +1 -0
  33. package/lib/esm/widgets/adw-split-button.js +1 -0
  34. package/lib/esm/widgets/adw-status-page.js +1 -0
  35. package/lib/esm/widgets/adw-switch-row.js +1 -0
  36. package/lib/esm/widgets/adw-tab-view.js +1 -0
  37. package/lib/esm/widgets/adw-toast-overlay.js +1 -0
  38. package/lib/esm/widgets/adw-toggle-group.js +1 -0
  39. package/lib/esm/widgets/adw-toolbar-view.js +1 -0
  40. package/lib/esm/widgets/adw-view-switcher.js +1 -0
  41. package/lib/esm/widgets/adw-window-title.js +1 -0
  42. package/lib/esm/widgets/adw-wrap-box.js +1 -0
  43. package/lib/esm/widgets/icon-path.js +1 -0
  44. package/lib/esm/widgets/icons.android.js +1 -0
  45. package/lib/esm/widgets/icons.js +1 -0
  46. package/lib/esm/widgets/index.js +1 -0
  47. package/lib/esm/widgets/row-press.js +1 -0
  48. package/lib/esm/widgets/split-view-base.js +1 -0
  49. package/lib/esm/widgets/view-switcher-base.js +1 -0
  50. package/lib/types/fonts.d.ts +38 -0
  51. package/lib/types/index.d.ts +16 -0
  52. package/lib/types/index.spec.d.ts +2 -0
  53. package/lib/types/widgets/adw-about-dialog.d.ts +50 -0
  54. package/lib/types/widgets/adw-action-row.d.ts +30 -0
  55. package/lib/types/widgets/adw-alert-dialog.d.ts +48 -0
  56. package/lib/types/widgets/adw-avatar.d.ts +20 -0
  57. package/lib/types/widgets/adw-banner.d.ts +25 -0
  58. package/lib/types/widgets/adw-bottom-sheet.d.ts +28 -0
  59. package/lib/types/widgets/adw-button-content.d.ts +18 -0
  60. package/lib/types/widgets/adw-button-row.d.ts +18 -0
  61. package/lib/types/widgets/adw-button.d.ts +21 -0
  62. package/lib/types/widgets/adw-carousel.d.ts +41 -0
  63. package/lib/types/widgets/adw-clamp.d.ts +15 -0
  64. package/lib/types/widgets/adw-combo-row.d.ts +42 -0
  65. package/lib/types/widgets/adw-entry-row.d.ts +17 -0
  66. package/lib/types/widgets/adw-expander-row.d.ts +24 -0
  67. package/lib/types/widgets/adw-header-bar.d.ts +35 -0
  68. package/lib/types/widgets/adw-icon.d.ts +19 -0
  69. package/lib/types/widgets/adw-image-button.d.ts +24 -0
  70. package/lib/types/widgets/adw-inline-view-switcher.d.ts +6 -0
  71. package/lib/types/widgets/adw-navigation-split-view.d.ts +11 -0
  72. package/lib/types/widgets/adw-navigation-view.d.ts +33 -0
  73. package/lib/types/widgets/adw-overlay-split-view.d.ts +28 -0
  74. package/lib/types/widgets/adw-password-entry-row.d.ts +4 -0
  75. package/lib/types/widgets/adw-preferences-dialog.d.ts +26 -0
  76. package/lib/types/widgets/adw-preferences-group.d.ts +23 -0
  77. package/lib/types/widgets/adw-preferences-page.d.ts +12 -0
  78. package/lib/types/widgets/adw-sidebar.d.ts +27 -0
  79. package/lib/types/widgets/adw-slider-row.d.ts +44 -0
  80. package/lib/types/widgets/adw-spin-row.d.ts +37 -0
  81. package/lib/types/widgets/adw-spinner.d.ts +14 -0
  82. package/lib/types/widgets/adw-split-button.d.ts +29 -0
  83. package/lib/types/widgets/adw-status-page.d.ts +36 -0
  84. package/lib/types/widgets/adw-switch-row.d.ts +17 -0
  85. package/lib/types/widgets/adw-tab-view.d.ts +9 -0
  86. package/lib/types/widgets/adw-toast-overlay.d.ts +47 -0
  87. package/lib/types/widgets/adw-toggle-group.d.ts +22 -0
  88. package/lib/types/widgets/adw-toolbar-view.d.ts +22 -0
  89. package/lib/types/widgets/adw-view-switcher.d.ts +6 -0
  90. package/lib/types/widgets/adw-window-title.d.ts +19 -0
  91. package/lib/types/widgets/adw-wrap-box.d.ts +17 -0
  92. package/lib/types/widgets/icon-path.d.ts +36 -0
  93. package/lib/types/widgets/icons.android.d.ts +11 -0
  94. package/lib/types/widgets/icons.d.ts +10 -0
  95. package/lib/types/widgets/index.d.ts +71 -0
  96. package/lib/types/widgets/row-press.d.ts +8 -0
  97. package/lib/types/widgets/split-view-base.d.ts +67 -0
  98. package/lib/types/widgets/view-switcher-base.d.ts +47 -0
  99. package/package.json +89 -0
  100. package/src/theme/adwaita.css +1234 -0
@@ -0,0 +1,9 @@
1
+ import { AdwViewSwitcherBase, type AdwViewPage } from './view-switcher-base.js';
2
+ export declare class AdwTabView extends AdwViewSwitcherBase {
3
+ constructor();
4
+ protected get barClass(): string;
5
+ protected get buttonClass(): string;
6
+ /** The tab pages — an alias of the shared {@link AdwViewSwitcherBase.views}. */
7
+ get tabs(): AdwViewPage[];
8
+ set tabs(pages: AdwViewPage[]);
9
+ }
@@ -0,0 +1,47 @@
1
+ import { Button, GridLayout, Label, View } from '@nativescript/core';
2
+ /** Default toast lifetime, in milliseconds (Adwaita's default ≈ 5 s). */
3
+ export declare const DEFAULT_TOAST_TIMEOUT = 5000;
4
+ /** Event name emitted when a toast's action button is tapped. */
5
+ export declare const TOAST_BUTTON_CLICKED = "toastButtonClicked";
6
+ /** Options for {@link AdwToastOverlay.showToast}. */
7
+ export interface AdwToastOptions {
8
+ /** Auto-dismiss timeout in ms (0 = no auto-dismiss). Default {@link DEFAULT_TOAST_TIMEOUT}. */
9
+ timeout?: number;
10
+ /** Optional action button label. */
11
+ buttonLabel?: string;
12
+ }
13
+ /**
14
+ * A single transient toast descriptor. Mirrors `Adw.Toast` — a value object
15
+ * (title + optional action) handed to {@link AdwToastOverlay.addToast}.
16
+ */
17
+ export declare class AdwToast {
18
+ /** The toast message. */
19
+ title: string;
20
+ /** Auto-dismiss timeout in ms (0 = sticky). */
21
+ timeout: number;
22
+ /** Optional action button label (empty = no button). */
23
+ buttonLabel: string;
24
+ constructor(title?: string, options?: AdwToastOptions);
25
+ }
26
+ export declare class AdwToastOverlay extends GridLayout {
27
+ /** The always-visible content layer. */
28
+ private _content;
29
+ /** The bottom-anchored toast strip. */
30
+ protected readonly _toastStrip: GridLayout;
31
+ protected readonly _toastLabel: Label;
32
+ protected readonly _toastButton: Button;
33
+ private _hasButton;
34
+ private _dismissTimer;
35
+ constructor();
36
+ /** Set (or replace) the always-visible content layer (under the toast). */
37
+ setContent(view: View | null): void;
38
+ /** Show a {@link AdwToast} descriptor. */
39
+ addToast(toast: AdwToast): void;
40
+ /** Show a transient toast with the given message and options. */
41
+ showToast(title: string, options?: AdwToastOptions): void;
42
+ /** Dismiss the current toast immediately. */
43
+ dismiss(): void;
44
+ private _dismiss;
45
+ /** Whether a toast is currently shown. */
46
+ get visible(): boolean;
47
+ }
@@ -0,0 +1,22 @@
1
+ import { SegmentedBar, type EventData } from '@nativescript/core';
2
+ /** Event name emitted when {@link AdwToggleGroup.selected} changes. Mirrors GObject `notify::selected`. */
3
+ export declare const NOTIFY_SELECTED = "notify::selected";
4
+ /** Payload of the `notify::selected` event. */
5
+ export interface NotifyToggleSelectedEventData extends EventData {
6
+ /** The newly-selected segment index. */
7
+ selected: number;
8
+ /** The newly-selected segment's label. */
9
+ value: string;
10
+ }
11
+ export declare class AdwToggleGroup extends SegmentedBar {
12
+ private _options;
13
+ constructor();
14
+ /** The segment labels. Setting them rebuilds the segmented bar items. */
15
+ get options(): string[];
16
+ set options(value: string[]);
17
+ /** The selected segment index. Two-way bound to `SegmentedBar.selectedIndex`. */
18
+ get selected(): number;
19
+ set selected(value: number);
20
+ /** The selected segment's label, or `''` when out of range. */
21
+ get selectedValue(): string;
22
+ }
@@ -0,0 +1,22 @@
1
+ import { GridLayout, StackLayout, View } from '@nativescript/core';
2
+ export declare class AdwToolbarView extends GridLayout {
3
+ /** The top-bar slot (row 0) — stack of header bars / toolbars. */
4
+ protected readonly _topBox: StackLayout;
5
+ /** The bottom-bar slot (row 2) — stack of bottom toolbars. */
6
+ protected readonly _bottomBox: StackLayout;
7
+ /** The currently-installed content view (row 1), if any. */
8
+ private _content;
9
+ constructor();
10
+ /** Append a widget (e.g. an {@link AdwHeaderBar}) to the top-bar slot. */
11
+ addTopBar(view: View): void;
12
+ /** Append a widget to the bottom-bar slot. */
13
+ addBottomBar(view: View): void;
14
+ /** Set (or replace) the main content view. Pass `null` to clear it. */
15
+ setContent(view: View | null): void;
16
+ /** The currently-installed content view, or `null`. */
17
+ get content(): View | null;
18
+ /** The top-bar slot container. */
19
+ get topBar(): StackLayout;
20
+ /** The bottom-bar slot container. */
21
+ get bottomBar(): StackLayout;
22
+ }
@@ -0,0 +1,6 @@
1
+ import { AdwViewSwitcherBase } from './view-switcher-base.js';
2
+ export declare class AdwViewSwitcher extends AdwViewSwitcherBase {
3
+ constructor();
4
+ protected get barClass(): string;
5
+ protected get buttonClass(): string;
6
+ }
@@ -0,0 +1,19 @@
1
+ import { Label, StackLayout } from '@nativescript/core';
2
+ export declare class AdwWindowTitle extends StackLayout {
3
+ /** The bold title label. */
4
+ protected readonly _titleLabel: Label;
5
+ /** The dim subtitle label (created lazily — only in the tree when set). */
6
+ protected readonly _subtitleLabel: Label;
7
+ private _hasSubtitle;
8
+ constructor();
9
+ /** The window title (bold, top line). */
10
+ get title(): string;
11
+ set title(value: string);
12
+ /**
13
+ * The subtitle (dim second line). Setting a non-empty value adds the subtitle
14
+ * label; setting empty removes it — so an empty subtitle leaves no blank gap,
15
+ * matching `Adw.WindowTitle`.
16
+ */
17
+ get subtitle(): string;
18
+ set subtitle(value: string);
19
+ }
@@ -0,0 +1,17 @@
1
+ import { View, WrapLayout } from '@nativescript/core';
2
+ export declare class AdwWrapBox extends WrapLayout {
3
+ private _childSpacing;
4
+ private _lineSpacing;
5
+ constructor();
6
+ /** Append a child; applies the uniform child/line spacing as a margin. */
7
+ add(view: View): void;
8
+ /** Remove a previously-added child. */
9
+ remove(view: View): void;
10
+ private _applySpacing;
11
+ /** Horizontal gap between items in a line, in DIPs. */
12
+ get childSpacing(): number;
13
+ set childSpacing(value: number);
14
+ /** Vertical gap between wrapped lines, in DIPs. */
15
+ get lineSpacing(): number;
16
+ set lineSpacing(value: number);
17
+ }
@@ -0,0 +1,36 @@
1
+ /** The native grid (viewBox) Adwaita symbolic icons are authored on: 16×16. */
2
+ export declare const ADWAITA_ICON_GRID = 16;
3
+ /** Default symbolic-icon fill for light theme — Adwaita's ~`rgba(0,0,0,0.8)` fg. */
4
+ export declare const DEFAULT_ICON_COLOR = "#33333A";
5
+ /** Default symbolic-icon fill for dark theme — near-white fg. */
6
+ export declare const DEFAULT_ICON_COLOR_DARK = "#FFFFFF";
7
+ /** Options for rendering a symbolic icon to a native image. */
8
+ export interface SymbolicIconOptions {
9
+ /** Rendered square size in DIPs (default {@link ADWAITA_ICON_GRID} = 16). */
10
+ size?: number;
11
+ /** Fill colour as a hex string (`#RRGGBB` / `#AARRGGBB`). Default = light fg. */
12
+ color?: string;
13
+ }
14
+ /** One fillable path of a symbolic icon: its path data + its own fill opacity. */
15
+ export interface IconPath {
16
+ /** SVG `d` path data (the `androidx` `PathParser` `pathData` grammar). */
17
+ d: string;
18
+ /** Per-path fill opacity in [0, 1] — Adwaita dims accent sub-shapes (e.g. the
19
+ * filled panel of `sidebar-show`); defaults to 1 when the path has none. */
20
+ opacity: number;
21
+ }
22
+ /**
23
+ * Extract every fillable `<path>` of a symbolic SVG as `{ d, opacity }`. Each path
24
+ * must be drawn SEPARATELY (not concatenated): Adwaita icons frequently pair a
25
+ * solid outline with a dimmed (`fill-opacity`) inner shape, and a single path's
26
+ * subpaths carve holes via the non-zero winding rule — flattening all paths into
27
+ * one fill destroys both. Returns `[]` when the SVG carries no path data.
28
+ */
29
+ export declare function extractIconPaths(svg: string): IconPath[];
30
+ /**
31
+ * Concatenate every `d="…"` path-data string of a symbolic SVG into one. Useful
32
+ * for the single-path common case; for multi-path icons prefer
33
+ * {@link extractIconPaths} (which preserves per-path opacity + winding). Returns
34
+ * `''` when the SVG carries no path data.
35
+ */
36
+ export declare function extractPathData(svg: string): string;
@@ -0,0 +1,11 @@
1
+ import { ImageSource } from '@nativescript/core';
2
+ import { type SymbolicIconOptions } from './icon-path.js';
3
+ /**
4
+ * Render an Adwaita symbolic SVG to a native {@link ImageSource} on Android, or
5
+ * `null` when the SVG has no path data / the native graphics stack is unavailable.
6
+ * The icon is drawn at `size` DIPs × the screen density so it stays crisp; place it
7
+ * in an `Image` sized `size`×`size` DIP with `stretch:'aspectFit'`.
8
+ */
9
+ export declare function renderSymbolicIcon(svg: string, options?: SymbolicIconOptions): ImageSource | null;
10
+ export { ADWAITA_ICON_GRID, DEFAULT_ICON_COLOR, DEFAULT_ICON_COLOR_DARK, extractIconPaths, extractPathData, } from './icon-path.js';
11
+ export type { IconPath, SymbolicIconOptions } from './icon-path.js';
@@ -0,0 +1,10 @@
1
+ import type { ImageSource } from '@nativescript/core';
2
+ import type { SymbolicIconOptions } from './icon-path.js';
3
+ export { ADWAITA_ICON_GRID, DEFAULT_ICON_COLOR, DEFAULT_ICON_COLOR_DARK, extractIconPaths, extractPathData, } from './icon-path.js';
4
+ export type { IconPath, SymbolicIconOptions } from './icon-path.js';
5
+ /**
6
+ * Render an Adwaita symbolic SVG string to a native {@link ImageSource}. The base
7
+ * implementation returns `null` — only the platform variants rasterise. Callers
8
+ * treat `null` as "no icon available" (the widget shows nothing / its fallback).
9
+ */
10
+ export declare function renderSymbolicIcon(_svg: string, _options?: SymbolicIconOptions): ImageSource | null;
@@ -0,0 +1,71 @@
1
+ export { AdwPreferencesPage } from './adw-preferences-page.js';
2
+ export { AdwPreferencesGroup } from './adw-preferences-group.js';
3
+ export { AdwActionRow } from './adw-action-row.js';
4
+ export { AdwSwitchRow, NOTIFY_ACTIVE } from './adw-switch-row.js';
5
+ export type { NotifyActiveEventData } from './adw-switch-row.js';
6
+ export { AdwEntryRow, NOTIFY_TEXT } from './adw-entry-row.js';
7
+ export type { NotifyTextEventData } from './adw-entry-row.js';
8
+ export { AdwPasswordEntryRow } from './adw-password-entry-row.js';
9
+ export { AdwComboRow, NOTIFY_SELECTED } from './adw-combo-row.js';
10
+ export type { AdwComboOption, NotifySelectedEventData } from './adw-combo-row.js';
11
+ export { AdwSpinRow, NOTIFY_VALUE } from './adw-spin-row.js';
12
+ export type { NotifyValueEventData } from './adw-spin-row.js';
13
+ export { AdwSliderRow, NOTIFY_SLIDER_VALUE } from './adw-slider-row.js';
14
+ export type { NotifySliderValueEventData } from './adw-slider-row.js';
15
+ export { AdwExpanderRow, NOTIFY_EXPANDED } from './adw-expander-row.js';
16
+ export type { NotifyExpandedEventData } from './adw-expander-row.js';
17
+ export { AdwButton } from './adw-button.js';
18
+ export type { AdwButtonVariant } from './adw-button.js';
19
+ export { AdwImageButton, DEFAULT_ICON_BUTTON_ICON_SIZE } from './adw-image-button.js';
20
+ export { AdwIcon, DEFAULT_ADW_ICON_SIZE } from './adw-icon.js';
21
+ export { AdwBanner, BUTTON_CLICKED } from './adw-banner.js';
22
+ export { AdwAvatar, DEFAULT_AVATAR_SIZE, avatarInitials } from './adw-avatar.js';
23
+ export { AdwWindowTitle } from './adw-window-title.js';
24
+ export { AdwClamp, DEFAULT_CLAMP_MAX_SIZE } from './adw-clamp.js';
25
+ export { AdwHeaderBar } from './adw-header-bar.js';
26
+ export { AdwToolbarView } from './adw-toolbar-view.js';
27
+ export { AdwWrapBox } from './adw-wrap-box.js';
28
+ export { AdwSpinner, DEFAULT_SPINNER_SIZE } from './adw-spinner.js';
29
+ export { AdwStatusPage } from './adw-status-page.js';
30
+ export { AdwButtonRow, ACTIVATED } from './adw-button-row.js';
31
+ export { AdwButtonContent } from './adw-button-content.js';
32
+ export { AdwSplitButton, CLICKED, MENU_TAPPED } from './adw-split-button.js';
33
+ export type { MenuTappedEventData } from './adw-split-button.js';
34
+ export { AdwToggleGroup, NOTIFY_SELECTED as NOTIFY_TOGGLE_SELECTED } from './adw-toggle-group.js';
35
+ export type { NotifyToggleSelectedEventData } from './adw-toggle-group.js';
36
+ export { AdwViewSwitcherBase, NOTIFY_SELECTED as NOTIFY_VIEW_SELECTED } from './view-switcher-base.js';
37
+ export type { AdwViewPage, NotifyViewSelectedEventData } from './view-switcher-base.js';
38
+ export { AdwViewSwitcher } from './adw-view-switcher.js';
39
+ export { AdwInlineViewSwitcher } from './adw-inline-view-switcher.js';
40
+ export { AdwTabView } from './adw-tab-view.js';
41
+ export { AdwCarousel, DEFAULT_CAROUSEL_PAGE_WIDTH, NOTIFY_POSITION } from './adw-carousel.js';
42
+ export type { NotifyPositionEventData } from './adw-carousel.js';
43
+ export { AdwNavigationView, NOTIFY_VISIBLE_PAGE } from './adw-navigation-view.js';
44
+ export type { NotifyVisiblePageEventData } from './adw-navigation-view.js';
45
+ export { AdwSplitViewBase, DEFAULT_SIDEBAR_WIDTH, NOTIFY_SHOW_SIDEBAR } from './split-view-base.js';
46
+ export type { NotifyShowSidebarEventData } from './split-view-base.js';
47
+ export { AdwNavigationSplitView } from './adw-navigation-split-view.js';
48
+ export { AdwOverlaySplitView } from './adw-overlay-split-view.js';
49
+ export { AdwSidebar, NOTIFY_SELECTED as NOTIFY_SIDEBAR_SELECTED } from './adw-sidebar.js';
50
+ export type { NotifySidebarSelectedEventData } from './adw-sidebar.js';
51
+ export { AdwBottomSheet, NOTIFY_OPEN } from './adw-bottom-sheet.js';
52
+ export type { NotifyOpenEventData } from './adw-bottom-sheet.js';
53
+ export { AdwToast, AdwToastOverlay, DEFAULT_TOAST_TIMEOUT, TOAST_BUTTON_CLICKED } from './adw-toast-overlay.js';
54
+ export type { AdwToastOptions } from './adw-toast-overlay.js';
55
+ export { AdwAlertDialog, NOTIFY_RESPONSE } from './adw-alert-dialog.js';
56
+ export type { NotifyResponseEventData } from './adw-alert-dialog.js';
57
+ export { AdwAboutDialog, CLOSED as ABOUT_CLOSED } from './adw-about-dialog.js';
58
+ export { AdwPreferencesDialog, CLOSED as PREFERENCES_CLOSED } from './adw-preferences-dialog.js';
59
+ export { attachRowPressFeedback } from './row-press.js';
60
+ export { ADWAITA_ICON_GRID, DEFAULT_ICON_COLOR, DEFAULT_ICON_COLOR_DARK, extractIconPaths, extractPathData, renderSymbolicIcon, } from './icons.js';
61
+ export type { IconPath, SymbolicIconOptions } from './icons.js';
62
+ /**
63
+ * Register all Adwaita widgets as NativeScript XML elements (idempotent).
64
+ *
65
+ * After calling this once at app bootstrap, markup like
66
+ * `<AdwSwitchRow title="Dark mode" />` resolves to the corresponding class.
67
+ * No-op (returns silently) when the `registerElement` runtime global is absent
68
+ * — i.e. off NativeScript, or when the bundler context has not injected it yet —
69
+ * so the call is safe to make unconditionally.
70
+ */
71
+ export declare function registerAdwaitaElements(): void;
@@ -0,0 +1,8 @@
1
+ import type { View } from '@nativescript/core';
2
+ /**
3
+ * Wire Adwaita press-darken onto an activatable row: add the `highlighted`
4
+ * pseudo-class while the row is held, clear it on release / scroll-cancel, so the
5
+ * theme's `*:highlighted` rules apply. Call once per view (e.g. in the row's
6
+ * constructor, or per generated sidebar row).
7
+ */
8
+ export declare function attachRowPressFeedback(view: View): void;
@@ -0,0 +1,67 @@
1
+ import { type Cancelable, type EventData, GridLayout, type View } from '@nativescript/core';
2
+ /** Event name emitted when the sidebar visibility changes. */
3
+ export declare const NOTIFY_SHOW_SIDEBAR = "notify::show-sidebar";
4
+ /** Payload of the `notify::show-sidebar` event. */
5
+ export interface NotifyShowSidebarEventData extends EventData {
6
+ /** Whether the sidebar is currently shown. */
7
+ showSidebar: boolean;
8
+ /** Whether the view is in its collapsed (narrow) mode. */
9
+ collapsed: boolean;
10
+ }
11
+ /** Default sidebar width, in DIPs. */
12
+ export declare const DEFAULT_SIDEBAR_WIDTH = 240;
13
+ export declare abstract class AdwSplitViewBase extends GridLayout {
14
+ protected _sidebar: View | null;
15
+ protected _content: View | null;
16
+ protected _collapsed: boolean;
17
+ protected _showSidebar: boolean;
18
+ protected _sidebarWidth: number;
19
+ protected _sidebarPosition: 'start' | 'end';
20
+ constructor(rootClass: string);
21
+ /** Subclass-specific layout application for the current collapsed/show state. */
22
+ protected abstract _applyLayout(): void;
23
+ /** Apply a user-initiated show/hide toggle. The default is an instant re-layout;
24
+ * the subclasses override this to slide the panes (and, for the overlay, fade a
25
+ * scrim) when collapsed. Kept separate from {@link _applyLayout} so structural
26
+ * re-layouts (setSidebar/collapsed/position changes) stay instant — only an
27
+ * on-screen `showSidebar` toggle animates. */
28
+ protected _transitionSidebar(): void;
29
+ /** In-flight animations, cancelled when a new transition supersedes them. */
30
+ protected _pending: Cancelable[];
31
+ /** Whether to run a real animation now: native `animate()` present AND on-screen.
32
+ * Off-device (the mock view tree in specs) or pre-load it returns false, so the
33
+ * caller falls back to an instant `visibility` swap. */
34
+ protected _shouldAnimate(): boolean;
35
+ /** Register an animation so a later transition can cancel it; returns a plain promise. */
36
+ protected _track(anim: Promise<void> & Cancelable): Promise<void>;
37
+ /** Cancel any in-flight animations before starting a new transition. */
38
+ protected _cancelPending(): void;
39
+ /** Whether `view` is currently a child of this layout. */
40
+ protected _isChild(view: View): boolean;
41
+ /** Set (or replace) the sidebar pane. */
42
+ setSidebar(view: View | null): void;
43
+ /** Set (or replace) the content pane. */
44
+ setContent(view: View | null): void;
45
+ /** Show the sidebar (relevant in collapsed mode). */
46
+ showSidebarPane(): void;
47
+ /** Hide the sidebar (relevant in collapsed mode). */
48
+ hideSidebarPane(): void;
49
+ /** Whether the view is in collapsed (narrow / single-pane) mode. */
50
+ get collapsed(): boolean;
51
+ set collapsed(value: boolean);
52
+ /** Whether the sidebar is shown. Toggling emits `notify::show-sidebar`. */
53
+ get showSidebar(): boolean;
54
+ set showSidebar(value: boolean);
55
+ /** The sidebar pane width, in DIPs. */
56
+ get sidebarWidth(): number;
57
+ set sidebarWidth(value: number);
58
+ /** Which side the sidebar sits on — `'start'` (leading / left) or `'end'`
59
+ * (trailing / right). Mirrors `Adw.OverlaySplitView`'s `sidebar-position`
60
+ * (the storybook controls overlay uses `'end'`). */
61
+ get sidebarPosition(): 'start' | 'end';
62
+ set sidebarPosition(value: 'start' | 'end');
63
+ /** The sidebar pane, or `null`. */
64
+ get sidebar(): View | null;
65
+ /** The content pane, or `null`. */
66
+ get content(): View | null;
67
+ }
@@ -0,0 +1,47 @@
1
+ import { Button, GridLayout, StackLayout, View, type EventData } from '@nativescript/core';
2
+ /** Event name emitted when the selected view changes. Mirrors GObject `notify::selected`. */
3
+ export declare const NOTIFY_SELECTED = "notify::selected";
4
+ /** Payload of the `notify::selected` event. */
5
+ export interface NotifyViewSelectedEventData extends EventData {
6
+ /** The newly-selected view index. */
7
+ selected: number;
8
+ /** The newly-selected view's title. */
9
+ title: string;
10
+ }
11
+ /** One page registered with a {@link AdwViewSwitcherBase}. */
12
+ export interface AdwViewPage {
13
+ /** The switcher button label. */
14
+ title: string;
15
+ /** The page content view, shown when this page is selected. */
16
+ content: View;
17
+ }
18
+ /**
19
+ * Shared base: a switcher bar (row 0) + a content area (row 1), one page visible.
20
+ * Subclasses set the bar/button CSS classes for their look.
21
+ */
22
+ export declare abstract class AdwViewSwitcherBase extends GridLayout {
23
+ /** The horizontal switcher bar holding the buttons. */
24
+ protected readonly _bar: StackLayout;
25
+ /** The content area where the selected page is shown. */
26
+ protected readonly _contentArea: GridLayout;
27
+ protected readonly _pages: AdwViewPage[];
28
+ protected readonly _buttons: Button[];
29
+ protected _selected: number;
30
+ /** CSS class applied to the switcher bar — subclass-specific. */
31
+ protected abstract get barClass(): string;
32
+ /** CSS class applied to each switcher button — subclass-specific. */
33
+ protected abstract get buttonClass(): string;
34
+ constructor(rootClass: string);
35
+ /** Initialise the bar class after the subclass fields are ready. */
36
+ protected _initClasses(): void;
37
+ /** Register the view pages. Rebuilds the switcher bar + content stack. */
38
+ setViews(pages: AdwViewPage[]): void;
39
+ /** Show only the selected page; mark its button active. */
40
+ protected _applySelection(): void;
41
+ /** The registered view pages. */
42
+ get views(): AdwViewPage[];
43
+ set views(pages: AdwViewPage[]);
44
+ /** The selected view index. Swaps the visible page + emits `notify::selected`. */
45
+ get selected(): number;
46
+ set selected(value: number);
47
+ }
package/package.json ADDED
@@ -0,0 +1,89 @@
1
+ {
2
+ "name": "@gjsify/adwaita-nativescript",
3
+ "version": "0.11.0",
4
+ "description": "Native Adwaita widgets for the NativeScript runtime — real NativeScript components (StackLayout/GridLayout/Switch/Label) styled like Libadwaita, not a webview",
5
+ "type": "module",
6
+ "module": "lib/esm/index.js",
7
+ "types": "lib/types/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./lib/types/index.d.ts",
11
+ "default": "./lib/esm/index.js"
12
+ },
13
+ "./widgets": {
14
+ "types": "./lib/types/widgets/index.d.ts",
15
+ "default": "./lib/esm/widgets/index.js"
16
+ },
17
+ "./theme/adwaita.css": "./src/theme/adwaita.css",
18
+ "./fonts": {
19
+ "types": "./lib/types/fonts.d.ts",
20
+ "default": "./lib/esm/fonts.js"
21
+ }
22
+ },
23
+ "files": [
24
+ "lib",
25
+ "src/theme/adwaita.css"
26
+ ],
27
+ "scripts": {
28
+ "clear": "rm -rf lib tsconfig.tsbuildinfo tsconfig.types.tsbuildinfo test.gjs.mjs test.node.mjs || exit 0",
29
+ "check": "gjsify tsc --noEmit",
30
+ "build": "gjsify run build:gjsify && gjsify run build:types",
31
+ "build:gjsify": "gjsify build --library 'src/**/*.{ts,js}' --exclude 'src/**/*.spec.{mts,ts}' 'src/test.{mts,ts}'",
32
+ "build:types": "gjsify tsc",
33
+ "build:test": "gjsify run build:test:gjs && gjsify run build:test:node",
34
+ "build:test:gjs": "gjsify build src/test.mts --app gjs --outfile test.gjs.mjs",
35
+ "build:test:node": "gjsify build src/test.mts --app node --outfile test.node.mjs",
36
+ "test": "gjsify run build:gjsify && gjsify run build:test && gjsify run test:node && gjsify run test:gjs",
37
+ "test:gjs": "gjsify run test.gjs.mjs",
38
+ "test:node": "node test.node.mjs"
39
+ },
40
+ "keywords": [
41
+ "gjs",
42
+ "nativescript",
43
+ "adwaita",
44
+ "gnome",
45
+ "android",
46
+ "ios",
47
+ "design-system"
48
+ ],
49
+ "dependencies": {
50
+ "@gjsify/adwaita-fonts": "^0.11.0",
51
+ "@gjsify/adwaita-icons": "^0.11.0"
52
+ },
53
+ "peerDependencies": {
54
+ "@nativescript/core": "*"
55
+ },
56
+ "peerDependenciesMeta": {
57
+ "@nativescript/core": {
58
+ "optional": true
59
+ }
60
+ },
61
+ "devDependencies": {
62
+ "@gjsify/cli": "^0.11.0",
63
+ "@gjsify/unit": "^0.11.0",
64
+ "@types/node": "^25.9.2",
65
+ "typescript": "^6.0.3"
66
+ },
67
+ "gjsify": {
68
+ "runtimes": {
69
+ "gjs": "none",
70
+ "node": "none",
71
+ "browser": "none",
72
+ "nativescript": "native"
73
+ },
74
+ "nativescriptPlatforms": [
75
+ "android",
76
+ "ios"
77
+ ]
78
+ },
79
+ "license": "MIT",
80
+ "repository": {
81
+ "type": "git",
82
+ "url": "git+https://github.com/gjsify/gjsify.git",
83
+ "directory": "packages/nativescript-bridge/adwaita"
84
+ },
85
+ "bugs": {
86
+ "url": "https://github.com/gjsify/gjsify/issues"
87
+ },
88
+ "homepage": "https://github.com/gjsify/gjsify/tree/main/packages/nativescript-bridge/adwaita#readme"
89
+ }