@gjsify/adwaita-nativescript 0.31.0 → 0.33.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/widgets/adw-action-row.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 -0
- package/lib/esm/widgets/adw-drop-down.js +1 -0
- package/lib/esm/widgets/adw-entry-row.js +1 -1
- package/lib/esm/widgets/adw-entry.js +1 -0
- 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-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-sidebar.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-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-window-title.js +1 -1
- package/lib/esm/widgets/adw-wrap-box.js +1 -1
- package/lib/esm/widgets/avatar-color.js +1 -0
- package/lib/esm/widgets/bottom-sheet-state.js +1 -0
- package/lib/esm/widgets/button-content.js +1 -0
- package/lib/esm/widgets/carousel-state.js +1 -0
- package/lib/esm/widgets/chrome.js +1 -0
- package/lib/esm/widgets/data-grid-model.js +1 -0
- package/lib/esm/widgets/entry-row-view.js +1 -0
- package/lib/esm/widgets/icon-path.js +2 -2
- package/lib/esm/widgets/icons.ios.js +1 -0
- package/lib/esm/widgets/index.js +1 -1
- package/lib/esm/widgets/navigation-stack.js +1 -0
- package/lib/esm/widgets/preferences-group-state.js +1 -0
- package/lib/esm/widgets/preferences-search.js +1 -0
- package/lib/esm/widgets/row-state.js +1 -0
- package/lib/esm/widgets/sidebar-model.js +1 -0
- package/lib/esm/widgets/split-button.js +1 -0
- package/lib/esm/widgets/split-view-base.js +1 -1
- package/lib/esm/widgets/split-view-state.js +1 -0
- package/lib/esm/widgets/split-view-width.js +1 -0
- package/lib/esm/widgets/status-page-content.js +1 -0
- package/lib/esm/widgets/svg-path.js +2 -0
- package/lib/esm/widgets/tab-view-state.js +1 -0
- package/lib/esm/widgets/view-stack-state.js +1 -0
- package/lib/esm/widgets/view-switcher-base.js +1 -1
- package/lib/esm/widgets/view-switcher-model.js +1 -0
- package/lib/esm/widgets/wrap-box-layout.js +1 -0
- package/lib/types/banner.spec.d.ts +2 -0
- package/lib/types/bottom-sheet.spec.d.ts +2 -0
- package/lib/types/button-content.spec.d.ts +2 -0
- package/lib/types/carousel.spec.d.ts +1 -0
- package/lib/types/chrome.spec.d.ts +2 -0
- package/lib/types/data-grid.spec.d.ts +2 -0
- package/lib/types/drop-down.spec.d.ts +2 -0
- package/lib/types/entry-rows.spec.d.ts +2 -0
- package/lib/types/entry.spec.d.ts +2 -0
- package/lib/types/index.d.ts +2 -2
- package/lib/types/navigation-view.spec.d.ts +2 -0
- package/lib/types/preferences.spec.d.ts +2 -0
- package/lib/types/row-state.spec.d.ts +2 -0
- package/lib/types/sidebar.spec.d.ts +1 -0
- package/lib/types/split-button.spec.d.ts +1 -0
- package/lib/types/split-view-state.spec.d.ts +2 -0
- package/lib/types/split-view-width.spec.d.ts +2 -0
- package/lib/types/status-page.spec.d.ts +2 -0
- package/lib/types/svg-path.spec.d.ts +2 -0
- package/lib/types/tab-view.spec.d.ts +2 -0
- package/lib/types/view-stack.spec.d.ts +2 -0
- package/lib/types/view-switcher.spec.d.ts +1 -0
- package/lib/types/widgets/adw-action-row.d.ts +63 -7
- package/lib/types/widgets/adw-avatar.d.ts +2 -7
- package/lib/types/widgets/adw-banner.d.ts +26 -7
- package/lib/types/widgets/adw-bottom-sheet.d.ts +29 -11
- package/lib/types/widgets/adw-button-content.d.ts +41 -6
- package/lib/types/widgets/adw-button-row.d.ts +31 -9
- package/lib/types/widgets/adw-carousel.d.ts +70 -15
- package/lib/types/widgets/adw-clamp.d.ts +21 -4
- package/lib/types/widgets/adw-combo-row.d.ts +9 -0
- package/lib/types/widgets/adw-data-grid.d.ts +73 -0
- package/lib/types/widgets/adw-drop-down.d.ts +45 -0
- package/lib/types/widgets/adw-entry-row.d.ts +98 -2
- package/lib/types/widgets/adw-entry.d.ts +43 -0
- package/lib/types/widgets/adw-expander-row.d.ts +3 -0
- package/lib/types/widgets/adw-header-bar.d.ts +11 -2
- package/lib/types/widgets/adw-inline-view-switcher.d.ts +26 -0
- package/lib/types/widgets/adw-navigation-split-view.d.ts +23 -1
- package/lib/types/widgets/adw-navigation-view.d.ts +71 -16
- package/lib/types/widgets/adw-overlay-split-view.d.ts +29 -2
- package/lib/types/widgets/adw-password-entry-row.d.ts +33 -3
- package/lib/types/widgets/adw-preferences-dialog.d.ts +18 -0
- package/lib/types/widgets/adw-preferences-group.d.ts +56 -8
- package/lib/types/widgets/adw-preferences-page.d.ts +32 -1
- package/lib/types/widgets/adw-sidebar.d.ts +49 -7
- package/lib/types/widgets/adw-spinner.d.ts +22 -6
- package/lib/types/widgets/adw-split-button.d.ts +48 -13
- package/lib/types/widgets/adw-status-page.d.ts +5 -10
- package/lib/types/widgets/adw-switch-row.d.ts +21 -1
- package/lib/types/widgets/adw-tab-view.d.ts +129 -15
- package/lib/types/widgets/adw-toolbar-view.d.ts +39 -0
- package/lib/types/widgets/adw-view-stack.d.ts +30 -27
- package/lib/types/widgets/adw-view-switcher-bar.d.ts +22 -10
- package/lib/types/widgets/adw-window-title.d.ts +12 -8
- package/lib/types/widgets/adw-wrap-box.d.ts +93 -7
- package/lib/types/widgets/avatar-color.d.ts +14 -0
- package/lib/types/widgets/bottom-sheet-state.d.ts +73 -0
- package/lib/types/widgets/button-content.d.ts +43 -0
- package/lib/types/widgets/carousel-state.d.ts +85 -0
- package/lib/types/widgets/chrome.d.ts +161 -0
- package/lib/types/widgets/data-grid-model.d.ts +104 -0
- package/lib/types/widgets/entry-row-view.d.ts +88 -0
- package/lib/types/widgets/icon-path.d.ts +20 -0
- package/lib/types/widgets/icons.ios.d.ts +13 -0
- package/lib/types/widgets/index.d.ts +20 -5
- package/lib/types/widgets/navigation-stack.d.ts +153 -0
- package/lib/types/widgets/preferences-group-state.d.ts +52 -0
- package/lib/types/widgets/preferences-search.d.ts +68 -0
- package/lib/types/widgets/row-state.d.ts +71 -0
- package/lib/types/widgets/sidebar-model.d.ts +18 -0
- package/lib/types/widgets/split-button.d.ts +55 -0
- package/lib/types/widgets/split-view-base.d.ts +72 -12
- package/lib/types/widgets/split-view-state.d.ts +228 -0
- package/lib/types/widgets/split-view-width.d.ts +76 -0
- package/lib/types/widgets/status-page-content.d.ts +23 -0
- package/lib/types/widgets/svg-path.d.ts +28 -0
- package/lib/types/widgets/tab-view-state.d.ts +74 -0
- package/lib/types/widgets/view-stack-state.d.ts +35 -0
- package/lib/types/widgets/view-switcher-base.d.ts +75 -33
- package/lib/types/widgets/view-switcher-model.d.ts +114 -0
- package/lib/types/widgets/wrap-box-layout.d.ts +97 -0
- package/lib/types/wrap-box.spec.d.ts +2 -0
- package/package.json +7 -7
- package/src/theme/adwaita.css +413 -8
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import type { AdwNavigationPageProps, NavigationDiagnosticListener, NavigationShortcutResult } from '@gjsify/adwaita-core';
|
|
2
|
+
import type { View } from '@nativescript/core';
|
|
3
|
+
/** Event name emitted when the visible page changes. Mirrors GObject `notify::visible-page`. */
|
|
4
|
+
export declare const NOTIFY_VISIBLE_PAGE = "notify::visible-page";
|
|
5
|
+
/** Emitted after a page has been pushed. Mirrors `AdwNavigationView::pushed`. */
|
|
6
|
+
export declare const PUSHED = "pushed";
|
|
7
|
+
/** Emitted after a page has been popped — once per popped page, top-first. Mirrors `AdwNavigationView::popped`. */
|
|
8
|
+
export declare const POPPED = "popped";
|
|
9
|
+
/** Emitted after the whole stack has been replaced. Mirrors `AdwNavigationView::replaced`. */
|
|
10
|
+
export declare const REPLACED = "replaced";
|
|
11
|
+
/** The NS visibility values a navigation page is toggled between. */
|
|
12
|
+
export type NsPageVisibility = 'visible' | 'collapse';
|
|
13
|
+
/** The CSS class every managed page carries, so `_navigation-view.scss` applies. */
|
|
14
|
+
export declare const NS_NAVIGATION_PAGE_CLASS = "adw-navigation-page";
|
|
15
|
+
/** Append the navigation-page class to a view's existing class list. */
|
|
16
|
+
export declare function navigationPageClassName(existing: string | null | undefined): string;
|
|
17
|
+
/** One signal the widget must re-emit, already reduced to its payload. */
|
|
18
|
+
export interface NsNavigationEvent {
|
|
19
|
+
/** {@link PUSHED}, {@link POPPED}, {@link REPLACED} or {@link NOTIFY_VISIBLE_PAGE}. */
|
|
20
|
+
name: string;
|
|
21
|
+
/** The page the signal is about — `null` for `replaced` and for an emptied view. */
|
|
22
|
+
page: View | null;
|
|
23
|
+
/**
|
|
24
|
+
* That page's tag, or `null`. A page destroyed by the SAME mutation has already
|
|
25
|
+
* left the registry, so its tag reads `null` — the page handle is the reliable
|
|
26
|
+
* identity in an event payload.
|
|
27
|
+
*/
|
|
28
|
+
tag: string | null;
|
|
29
|
+
/** The stack depth after the change. */
|
|
30
|
+
depth: number;
|
|
31
|
+
}
|
|
32
|
+
/** The NativeScript side of the adapter: child management + signal emission. */
|
|
33
|
+
export interface NsNavigationHost {
|
|
34
|
+
/** Add `view` as an overlaying child of the navigation grid. */
|
|
35
|
+
attachPage(view: View): void;
|
|
36
|
+
/** Remove `view` from the grid — the page has been destroyed. */
|
|
37
|
+
detachPage(view: View): void;
|
|
38
|
+
/** Show or hide a page. Instant: the NS CSS subset has no transition. */
|
|
39
|
+
setPageVisibility(view: View, visibility: NsPageVisibility): void;
|
|
40
|
+
/** Re-emit a GObject-style signal on the widget. */
|
|
41
|
+
emit(event: NsNavigationEvent): void;
|
|
42
|
+
}
|
|
43
|
+
/** Construction seams. */
|
|
44
|
+
export interface NsNavigationStackOptions {
|
|
45
|
+
/** Where rejected mutations go — the widget logs them; a test collects them. */
|
|
46
|
+
onDiagnostic?: NavigationDiagnosticListener;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* `Adw.NavigationView` bound to a NativeScript view tree.
|
|
50
|
+
*
|
|
51
|
+
* Holds a `NavigationViewState` and keeps the grid's children in step with its
|
|
52
|
+
* registry: a page enters the tree when it is registered and leaves when it is
|
|
53
|
+
* destroyed, and the top of the stack is the only visible one. The widget keeps
|
|
54
|
+
* ZERO navigation state.
|
|
55
|
+
*/
|
|
56
|
+
export declare class NsNavigationStack {
|
|
57
|
+
private readonly _state;
|
|
58
|
+
private readonly _host;
|
|
59
|
+
/** The views currently in the grid — the mirror of the core's registry. */
|
|
60
|
+
private readonly _attached;
|
|
61
|
+
private readonly _onDiagnostic;
|
|
62
|
+
private _pending;
|
|
63
|
+
constructor(host: NsNavigationHost, options?: NsNavigationStackOptions);
|
|
64
|
+
/** The currently-visible page view, or `null`. */
|
|
65
|
+
get visiblePage(): View | null;
|
|
66
|
+
/** The currently-visible page tag, or `null`. */
|
|
67
|
+
get visiblePageTag(): string | null;
|
|
68
|
+
/** The current navigation stack depth. */
|
|
69
|
+
get depth(): number;
|
|
70
|
+
/** The navigation stack, bottom-first. */
|
|
71
|
+
get stack(): readonly View[];
|
|
72
|
+
/** Every registered page — static and dynamically pushed. */
|
|
73
|
+
get pages(): readonly View[];
|
|
74
|
+
/**
|
|
75
|
+
* `Adw.NavigationView:animate-transitions`. Stored and honoured by the shared
|
|
76
|
+
* change payload, but NativeScript paints the swap instantly either way — the
|
|
77
|
+
* CSS subset has no transition, so a real app animates with `View.animate()`.
|
|
78
|
+
*/
|
|
79
|
+
get animateTransitions(): boolean;
|
|
80
|
+
/** `Adw.NavigationView:pop-on-escape` — consulted by {@link popFromEscape}. */
|
|
81
|
+
get popOnEscape(): boolean;
|
|
82
|
+
/** Whether `view` is known to this navigation view. */
|
|
83
|
+
isRegistered(view: View): boolean;
|
|
84
|
+
/** `view`'s tag, or `null`. */
|
|
85
|
+
tagOf(view: View): string | null;
|
|
86
|
+
/** `view`'s title (`''` when untitled). */
|
|
87
|
+
titleOf(view: View): string;
|
|
88
|
+
/** Whether `view` may be popped by a shortcut or a back button. */
|
|
89
|
+
canPopOf(view: View): boolean;
|
|
90
|
+
/** The page with this tag, or `null`. */
|
|
91
|
+
findPage(tag: string): View | null;
|
|
92
|
+
/** The page popping `view` would reveal, or `null`. */
|
|
93
|
+
getPreviousPage(view: View): View | null;
|
|
94
|
+
/** Whether a back button belongs on the visible page. */
|
|
95
|
+
canGoBack(): boolean;
|
|
96
|
+
/** The back button's tooltip — the previous page's title, or `null` when there is no button. */
|
|
97
|
+
backButtonTooltip(fallback?: string): string | null;
|
|
98
|
+
/**
|
|
99
|
+
* Register a page (optionally with a tag for `push(tag)`). A page added while
|
|
100
|
+
* the stack is EMPTY is pushed automatically, so the view is never blank.
|
|
101
|
+
*/
|
|
102
|
+
add(view: View, tag?: string | null, options?: Omit<AdwNavigationPageProps, 'tag'>): boolean;
|
|
103
|
+
/** Remove a page. One that is on the stack is removed when it is POPPED. */
|
|
104
|
+
remove(view: View): boolean;
|
|
105
|
+
/** Push a page (a previously-registered tag, or a fresh view) onto the stack. */
|
|
106
|
+
push(viewOrTag: View | string, options?: AdwNavigationPageProps): boolean;
|
|
107
|
+
/** Push the page carrying `tag`. */
|
|
108
|
+
pushByTag(tag: string): boolean;
|
|
109
|
+
/** Pop the top page. `can-pop` does NOT gate this — it gates the shortcuts. */
|
|
110
|
+
pop(): boolean;
|
|
111
|
+
/** Pop until `view` is visible, in ONE transition. */
|
|
112
|
+
popToPage(view: View): boolean;
|
|
113
|
+
/** Pop until the page carrying `tag` is visible. */
|
|
114
|
+
popToTag(tag: string): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Replace the whole stack. String entries are resolved BEFORE anything is
|
|
117
|
+
* mutated, so replacing the stack with the tag of a dynamically-pushed page
|
|
118
|
+
* keeps that page (replace_with_tags:3136-3147).
|
|
119
|
+
*/
|
|
120
|
+
replace(entries: ReadonlyArray<View | string | null>, props?: (view: View) => AdwNavigationPageProps | undefined): void;
|
|
121
|
+
/** Replace the stack with the pages carrying `tags`. */
|
|
122
|
+
replaceWithTags(tags: readonly string[]): void;
|
|
123
|
+
/** Set a page's tag. Rejected when another page already owns it. */
|
|
124
|
+
setTag(view: View, tag: string | null): boolean;
|
|
125
|
+
/** Set a page's title — the NEXT page's back-button tooltip. */
|
|
126
|
+
setTitle(view: View, title: string): boolean;
|
|
127
|
+
/** Set a page's `can-pop`: gates the shortcuts and a back button, not `pop()`. */
|
|
128
|
+
setCanPop(view: View, canPop: boolean): boolean;
|
|
129
|
+
/** Set `animate-transitions`. */
|
|
130
|
+
setAnimateTransitions(value: boolean): boolean;
|
|
131
|
+
/** Set `pop-on-escape`. */
|
|
132
|
+
setPopOnEscape(value: boolean): boolean;
|
|
133
|
+
/** The `can-pop`-aware pop behind a hardware back button or Alt+Left. */
|
|
134
|
+
popFromShortcut(): NavigationShortcutResult;
|
|
135
|
+
/** Escape-to-pop, gated on `pop-on-escape`. */
|
|
136
|
+
popFromEscape(): NavigationShortcutResult;
|
|
137
|
+
/**
|
|
138
|
+
* Settle the transition (a no-op here beyond what {@link _flush} already did):
|
|
139
|
+
* NativeScript never defers, so this exists only so the widget exposes the
|
|
140
|
+
* whole `Adw.NavigationView` surface.
|
|
141
|
+
*/
|
|
142
|
+
finishTransition(): readonly View[];
|
|
143
|
+
/**
|
|
144
|
+
* Apply the change the last mutation produced: bring the view tree in step,
|
|
145
|
+
* then re-emit the signals. The tree is synced FIRST so a listener reading
|
|
146
|
+
* `visiblePage` from the event sees a mounted page.
|
|
147
|
+
*/
|
|
148
|
+
private _flush;
|
|
149
|
+
private _emit;
|
|
150
|
+
private _notify;
|
|
151
|
+
/** Mirror the core's registry into the grid, then raise the top of the stack. */
|
|
152
|
+
private _sync;
|
|
153
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { PreferencesGroupHeaderState } from '@gjsify/adwaita-core';
|
|
2
|
+
/** The two `View.visibility` values a preferences group ever assigns. */
|
|
3
|
+
export type NsVisibility = 'visible' | 'collapse';
|
|
4
|
+
/** The header box's base style class. */
|
|
5
|
+
export declare const PREFERENCES_GROUP_HEADER_CLASS = "adw-preferences-group-header";
|
|
6
|
+
/**
|
|
7
|
+
* The style class libadwaita toggles for a one-line header. Not cosmetic: the
|
|
8
|
+
* stylesheet gives `.single-line` a `min-height` and everything else a bottom
|
|
9
|
+
* margin, so a header without it is laid out as if it had two lines.
|
|
10
|
+
*/
|
|
11
|
+
export declare const PREFERENCES_GROUP_SINGLE_LINE_CLASS = "single-line";
|
|
12
|
+
/** What a group knows about itself when it re-derives its visuals. */
|
|
13
|
+
export interface NsPreferencesGroupInput {
|
|
14
|
+
/** `AdwPreferencesGroup:title`. */
|
|
15
|
+
title?: string | null;
|
|
16
|
+
/** `AdwPreferencesGroup:description`. */
|
|
17
|
+
description?: string | null;
|
|
18
|
+
/** Whether a `header-suffix` view is set. */
|
|
19
|
+
hasHeaderSuffix?: boolean;
|
|
20
|
+
/** How many children the boxed list holds. */
|
|
21
|
+
rowCount?: number;
|
|
22
|
+
}
|
|
23
|
+
/** The NativeScript form of {@link PreferencesGroupHeaderState}. */
|
|
24
|
+
export interface NsPreferencesGroupVisuals {
|
|
25
|
+
/** `visibility` for the title label. */
|
|
26
|
+
titleVisibility: NsVisibility;
|
|
27
|
+
/** `visibility` for the description label. */
|
|
28
|
+
descriptionVisibility: NsVisibility;
|
|
29
|
+
/** `visibility` for the whole header box. */
|
|
30
|
+
headerVisibility: NsVisibility;
|
|
31
|
+
/** `className` for the header box, carrying `single-line` when it applies. */
|
|
32
|
+
headerClassName: string;
|
|
33
|
+
/** `visibility` for the `.boxed-list` container. */
|
|
34
|
+
listboxVisibility: NsVisibility;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The five derived states for a group.
|
|
38
|
+
*
|
|
39
|
+
* `useMarkup: false` is deliberate and is the same choice the browser renderer
|
|
40
|
+
* makes: an NS `Label` shows the string verbatim (it has no Pango markup), so
|
|
41
|
+
* visibility must be judged on the string that is actually painted. Rendering
|
|
42
|
+
* markup is a separate, still-open gap; closing it flips this one flag.
|
|
43
|
+
*/
|
|
44
|
+
export declare function preferencesGroupHeaderState(input: NsPreferencesGroupInput): PreferencesGroupHeaderState;
|
|
45
|
+
/**
|
|
46
|
+
* `visibility` / `className` a group must apply for the given inputs.
|
|
47
|
+
*
|
|
48
|
+
* `'collapse'` rather than `'hidden'`: a hidden NS view still occupies its
|
|
49
|
+
* space, which would leave the header's padding behind on a group that has no
|
|
50
|
+
* header — the very thing `update_header_visibility` exists to avoid.
|
|
51
|
+
*/
|
|
52
|
+
export declare function preferencesGroupVisuals(input: NsPreferencesGroupInput): NsPreferencesGroupVisuals;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { PreferencesSearchPage, PreferencesSearchResult, SearchPreferencesOptions } from '@gjsify/adwaita-core';
|
|
2
|
+
/**
|
|
3
|
+
* What the search reads off a row widget.
|
|
4
|
+
*
|
|
5
|
+
* `isActionRow` is a declared property rather than an `instanceof` test,
|
|
6
|
+
* because the NativeScript hierarchy does NOT match the GObject one:
|
|
7
|
+
* `AdwEntryRow extends AdwActionRow` here so it can reuse the row chrome, while
|
|
8
|
+
* in C it derives from `AdwPreferencesRow` (adw-entry-row.c:90) and its text is
|
|
9
|
+
* therefore deliberately NOT searchable. The row classes carry the C answer.
|
|
10
|
+
*/
|
|
11
|
+
export interface NsSearchableRow {
|
|
12
|
+
/** `AdwPreferencesRow:title`. */
|
|
13
|
+
readonly title?: string;
|
|
14
|
+
/** `AdwActionRow:subtitle`; only consulted when `isActionRow`. */
|
|
15
|
+
readonly subtitle?: string;
|
|
16
|
+
/** Whether the row derives from `AdwActionRow` in libadwaita. */
|
|
17
|
+
readonly isActionRow?: boolean;
|
|
18
|
+
/** NS `View.visibility`. */
|
|
19
|
+
readonly visibility?: string;
|
|
20
|
+
}
|
|
21
|
+
/** What the search reads off a group widget. */
|
|
22
|
+
export interface NsSearchableGroup {
|
|
23
|
+
/** `AdwPreferencesGroup:title`. */
|
|
24
|
+
readonly title?: string;
|
|
25
|
+
/** NS `View.visibility`. */
|
|
26
|
+
readonly visibility?: string;
|
|
27
|
+
/** The group's boxed-list rows, in order. */
|
|
28
|
+
searchRows(): readonly NsSearchableRow[];
|
|
29
|
+
}
|
|
30
|
+
/** What the search reads off a page widget. */
|
|
31
|
+
export interface NsSearchablePage {
|
|
32
|
+
/** `AdwPreferencesPage:title`. */
|
|
33
|
+
readonly title?: string;
|
|
34
|
+
/** `AdwPreferencesPage:name` — the view-stack child name. */
|
|
35
|
+
readonly name?: string;
|
|
36
|
+
/** `AdwPreferencesPage:use-underline`. */
|
|
37
|
+
readonly useUnderline?: boolean;
|
|
38
|
+
/** NS `View.visibility`. */
|
|
39
|
+
readonly visibility?: string;
|
|
40
|
+
/** The page's groups, in order. */
|
|
41
|
+
searchGroups(): readonly NsSearchableGroup[];
|
|
42
|
+
}
|
|
43
|
+
/** Any node a search result can point back at. */
|
|
44
|
+
export type NsSearchableNode = NsSearchablePage | NsSearchableGroup | NsSearchableRow;
|
|
45
|
+
/** A described NS preferences tree, ready for `searchPreferences`. */
|
|
46
|
+
export type NsPreferencesSearchPage = PreferencesSearchPage<NsSearchableNode>;
|
|
47
|
+
/** One NS search result, carrying the page and row widgets it came from. */
|
|
48
|
+
export type NsPreferencesSearchResult = PreferencesSearchResult<NsSearchableNode>;
|
|
49
|
+
/**
|
|
50
|
+
* `gtk_widget_get_visible` for a NativeScript view.
|
|
51
|
+
*
|
|
52
|
+
* NS has THREE values where GTK has a boolean, and only `'visible'` counts as
|
|
53
|
+
* shown: `'collapse'` removes the view from layout and `'hidden'` keeps its
|
|
54
|
+
* space but paints nothing — neither is something a user can read or reach, so
|
|
55
|
+
* neither belongs in a search index. An undefined value is a view that never
|
|
56
|
+
* set the property, i.e. the NS default `'visible'`.
|
|
57
|
+
*/
|
|
58
|
+
export declare function isNsVisible(visibility: string | undefined): boolean;
|
|
59
|
+
/** Describe a list of page widgets as the tree `searchPreferences` indexes. */
|
|
60
|
+
export declare function describeNsPreferencesPages(pages: readonly NsSearchablePage[]): NsPreferencesSearchPage[];
|
|
61
|
+
/**
|
|
62
|
+
* Search a list of NativeScript preferences pages.
|
|
63
|
+
*
|
|
64
|
+
* An empty query returns the WHOLE corpus, which is what C does
|
|
65
|
+
* (`strstr (title, "")` is non-NULL) and what keeps the results list populated
|
|
66
|
+
* before the user has typed.
|
|
67
|
+
*/
|
|
68
|
+
export declare function searchNsPreferences(pages: readonly NsSearchablePage[], query: string, options?: SearchPreferencesOptions): NsPreferencesSearchResult[];
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { ActionRowState, ButtonRowState, SwitchRowState, WindowTitleState } from '@gjsify/adwaita-core';
|
|
2
|
+
import type { AdwRowLabelInput, AdwRowLabels, ButtonRowRenderState } from '@gjsify/adwaita-core';
|
|
3
|
+
import type { View } from '@nativescript/core';
|
|
4
|
+
export { ActionRowState, ButtonRowState, SwitchRowState, WindowTitleState };
|
|
5
|
+
export type { AdwRowLabels, ButtonRowRenderState };
|
|
6
|
+
/** The two `View.visibility` values an Adwaita row ever assigns. */
|
|
7
|
+
export type NsVisibility = 'visible' | 'collapse';
|
|
8
|
+
/**
|
|
9
|
+
* `visibility` for a shown/hidden view.
|
|
10
|
+
*
|
|
11
|
+
* `'collapse'` rather than `'hidden'`: a hidden NS view still occupies its
|
|
12
|
+
* space, so an empty subtitle would leave its whole line behind — which is the
|
|
13
|
+
* one thing the binding exists to prevent.
|
|
14
|
+
*/
|
|
15
|
+
export declare function nsVisibility(shown: boolean): NsVisibility;
|
|
16
|
+
/** The NativeScript form of a title/subtitle label pair. */
|
|
17
|
+
export interface NsRowLabelVisuals {
|
|
18
|
+
/** Text for the title `Label`. */
|
|
19
|
+
title: string;
|
|
20
|
+
/** `visibility` for the title `Label`. */
|
|
21
|
+
titleVisibility: NsVisibility;
|
|
22
|
+
/** Text for the subtitle `Label`. */
|
|
23
|
+
subtitle: string;
|
|
24
|
+
/** `visibility` for the subtitle `Label`. */
|
|
25
|
+
subtitleVisibility: NsVisibility;
|
|
26
|
+
}
|
|
27
|
+
/** What a row must apply to its two labels for the given title/subtitle. */
|
|
28
|
+
export declare function rowLabelVisuals(input: AdwRowLabelInput): NsRowLabelVisuals;
|
|
29
|
+
/** The same mapping, for a state object that already holds the derivation. */
|
|
30
|
+
export declare function toLabelVisuals(labels: AdwRowLabels): NsRowLabelVisuals;
|
|
31
|
+
/** The NativeScript form of an `Adw.ButtonRow`'s two icons. */
|
|
32
|
+
export interface NsButtonRowIconVisuals {
|
|
33
|
+
/** Payload for the leading icon. */
|
|
34
|
+
startIcon: string;
|
|
35
|
+
/** `visibility` for the leading icon. */
|
|
36
|
+
startIconVisibility: NsVisibility;
|
|
37
|
+
/** Payload for the trailing icon. */
|
|
38
|
+
endIcon: string;
|
|
39
|
+
/** `visibility` for the trailing icon. */
|
|
40
|
+
endIconVisibility: NsVisibility;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* What a button row must apply to its two icons.
|
|
44
|
+
*
|
|
45
|
+
* The TITLE half of `ButtonRowRenderState` is deliberately not mapped here: the
|
|
46
|
+
* NativeScript button row reuses the action row's title `Label` and therefore
|
|
47
|
+
* its title state, so routing the title through a second state object would give
|
|
48
|
+
* one label two sources of truth — the exact shape this package exists to
|
|
49
|
+
* remove. {@link rowLabelVisuals} paints it.
|
|
50
|
+
*
|
|
51
|
+
* NOTE ON THE ICON PAYLOAD: GTK stores an icon NAME and resolves it through the
|
|
52
|
+
* icon theme; this port stores the symbolic SVG source itself, because `AdwIcon`
|
|
53
|
+
* renders SVG rather than looking a name up. `ButtonRowState` is indifferent —
|
|
54
|
+
* the rule it applies is `string_is_not_empty`, which reads the first byte and
|
|
55
|
+
* does not care what the string means.
|
|
56
|
+
*/
|
|
57
|
+
export declare function buttonRowIconVisuals(state: ButtonRowRenderState): NsButtonRowIconVisuals;
|
|
58
|
+
/**
|
|
59
|
+
* Whether a view is "sensitive" in the sense the `activatable-widget` binding
|
|
60
|
+
* reads (`GtkWidget:sensitive` → `GtkListBoxRow:activatable`,
|
|
61
|
+
* adw-action-row.c:729-732).
|
|
62
|
+
*
|
|
63
|
+
* NativeScript has no `sensitive`; `isUserInteractionEnabled` is the nearest
|
|
64
|
+
* flag it surfaces (its own docs map it to `gtk_widget_set_can_target`). The two
|
|
65
|
+
* are not identical in GTK — an insensitive widget is also greyed out, a
|
|
66
|
+
* can't-target one is not — but `isUserInteractionEnabled` is the only property
|
|
67
|
+
* a NativeScript view has for "the user cannot operate this", so it is what the
|
|
68
|
+
* binding reads here. A view that has never been touched reports `true`, which
|
|
69
|
+
* is also GTK's default.
|
|
70
|
+
*/
|
|
71
|
+
export declare function isViewSensitive(view: Pick<View, 'isUserInteractionEnabled'> | null | undefined): boolean;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SidebarState } from '@gjsify/adwaita-core';
|
|
2
|
+
import type { AdwSidebarItemSpec, AdwSidebarSectionSpec, SidebarItemFilter } from '@gjsify/adwaita-core';
|
|
3
|
+
export { SidebarState };
|
|
4
|
+
export type { AdwSidebarItemSpec, AdwSidebarSectionSpec, SidebarItemFilter };
|
|
5
|
+
/**
|
|
6
|
+
* The section list a flat `AdwSidebar.setItems(labels)` call means: one untitled
|
|
7
|
+
* section, which renders no header at all (a first + untitled section's header is
|
|
8
|
+
* bound to a non-empty title, adw-sidebar.c:1521-1527).
|
|
9
|
+
*/
|
|
10
|
+
export declare function sidebarSectionsFromLabels(labels: readonly string[]): AdwSidebarSectionSpec[];
|
|
11
|
+
/**
|
|
12
|
+
* The class string one navigation row carries.
|
|
13
|
+
*
|
|
14
|
+
* `selectionVisible` is false in page mode, where libadwaita tracks the
|
|
15
|
+
* selection but never paints it (adw-sidebar.c:2948-2951) — its rows are plain
|
|
16
|
+
* boxed-list `AdwActionRow`s with no selected state.
|
|
17
|
+
*/
|
|
18
|
+
export declare function sidebarRowClassName(selected: boolean, selectionVisible: boolean): string;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { AdwArrowIcon, AdwMenuEntry, SplitButtonDirection, SplitButtonState } from '@gjsify/adwaita-core';
|
|
2
|
+
export type { AdwMenuEntry, SplitButtonDirection };
|
|
3
|
+
/** Text of the sheet's dismiss button. */
|
|
4
|
+
export declare const MENU_CANCEL_LABEL = "Cancel";
|
|
5
|
+
/**
|
|
6
|
+
* The libadwaita arrow glyph names mapped to real Adwaita symbolic SVGs.
|
|
7
|
+
*
|
|
8
|
+
* Keyed by {@link AdwArrowIcon} and therefore TOTAL: which glyph a direction gets
|
|
9
|
+
* is decided in core, and a glyph this table has no SVG for is a compile error
|
|
10
|
+
* rather than a fallback arrow.
|
|
11
|
+
*/
|
|
12
|
+
export declare const ARROW_SVGS: Readonly<Record<AdwArrowIcon, string>>;
|
|
13
|
+
/**
|
|
14
|
+
* Normalise a menu assigned from XML or app code into entries.
|
|
15
|
+
*
|
|
16
|
+
* A bare `string[]` is accepted because that is what `AdwSplitButton.menu` used
|
|
17
|
+
* to be and what the storybook still passes; it widens to the shared
|
|
18
|
+
* {@link AdwMenuEntry} without breaking a caller.
|
|
19
|
+
*/
|
|
20
|
+
export declare function toMenuEntries(value: readonly (string | AdwMenuEntry)[] | null | undefined): AdwMenuEntry[];
|
|
21
|
+
/**
|
|
22
|
+
* The strings handed to `Dialogs.action()`, one per entry and each unique.
|
|
23
|
+
*
|
|
24
|
+
* A label that collides with another entry — or with the dismiss button — gets
|
|
25
|
+
* zero-width spaces appended until it is distinct. Nothing changes on screen;
|
|
26
|
+
* what changes is that {@link resolveMenuChoice} can now tell the entries apart.
|
|
27
|
+
*/
|
|
28
|
+
export declare function menuSheetActions(entries: readonly AdwMenuEntry[], cancelLabel?: string): string[];
|
|
29
|
+
/**
|
|
30
|
+
* The position the user chose, or `-1` when the sheet was dismissed.
|
|
31
|
+
*
|
|
32
|
+
* Feed it the SAME array {@link menuSheetActions} produced: the strings are
|
|
33
|
+
* unique there, so the lookup is a position and not a guess.
|
|
34
|
+
*/
|
|
35
|
+
export declare function resolveMenuChoice(sheetActions: readonly string[], chosen: string | null | undefined): number;
|
|
36
|
+
/**
|
|
37
|
+
* The arrow SVG for a direction, keyed off the SPLIT BUTTON's glyph map — so
|
|
38
|
+
* `none` is the down caret (_buttons.scss:621-623), not the hamburger this widget
|
|
39
|
+
* used to render for it.
|
|
40
|
+
*/
|
|
41
|
+
export declare function splitButtonArrowSvg(direction: SplitButtonDirection): string;
|
|
42
|
+
/**
|
|
43
|
+
* Apply `AdwSplitButton.actionIcon = svg` to the content machine.
|
|
44
|
+
*
|
|
45
|
+
* The SVG string IS the icon identity on NativeScript (no icon theme is
|
|
46
|
+
* resolved), so it goes in where GTK puts the icon NAME. Clearing it is the
|
|
47
|
+
* mapping worth having in one place: C offers no "unset the icon", only the
|
|
48
|
+
* side effect of filling another slot (adw-split-button.c:749-771), so an empty
|
|
49
|
+
* SVG clears the content and lets the label half take over again — which is what
|
|
50
|
+
* every caller assigning `actionIcon` from a nullable lookup expects.
|
|
51
|
+
*
|
|
52
|
+
* Lives here rather than in the widget so it is unit-testable off-device: the
|
|
53
|
+
* widget module `extends GridLayout` and cannot be imported on GJS/Node.
|
|
54
|
+
*/
|
|
55
|
+
export declare function setActionIcon(state: SplitButtonState, svg: string | null | undefined): void;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { type Cancelable, type EventData, GridLayout, type View } from '@nativescript/core';
|
|
2
|
+
import { type SidebarWidthProps, type SplitViewWidthRule } from './split-view-width.js';
|
|
3
|
+
import type { AdwPackType, NsShowSidebarNotification, NsSplitViewState } from './split-view-state.js';
|
|
4
|
+
import type { AdwTextDirection } from '@gjsify/adwaita-core';
|
|
2
5
|
/** Event name emitted when the sidebar visibility changes. */
|
|
3
6
|
export declare const NOTIFY_SHOW_SIDEBAR = "notify::show-sidebar";
|
|
4
7
|
/** Payload of the `notify::show-sidebar` event. */
|
|
@@ -8,24 +11,54 @@ export interface NotifyShowSidebarEventData extends EventData {
|
|
|
8
11
|
/** Whether the view is in its collapsed (narrow) mode. */
|
|
9
12
|
collapsed: boolean;
|
|
10
13
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
export declare abstract class AdwSplitViewBase<TState extends NsSplitViewState = NsSplitViewState> extends GridLayout {
|
|
15
|
+
/** Which widget's width rule applies — they differ once a pane has a minimum. */
|
|
16
|
+
protected readonly _widthRule: SplitViewWidthRule;
|
|
17
|
+
/** The headless state machine this widget renders (`split-view-state.ts`). */
|
|
18
|
+
protected readonly _state: TState;
|
|
14
19
|
protected _sidebar: View | null;
|
|
15
20
|
protected _content: View | null;
|
|
16
|
-
|
|
17
|
-
protected
|
|
18
|
-
|
|
19
|
-
protected
|
|
20
|
-
|
|
21
|
+
/** The three width PROPERTIES; the drawn width is derived from them. */
|
|
22
|
+
protected _widthProps: SidebarWidthProps;
|
|
23
|
+
/** The container width the sidebar was last sized against, in DIPs. */
|
|
24
|
+
protected _measuredWidth: number;
|
|
25
|
+
/** An explicit `sidebarWidth` assignment, which overrides the derivation. */
|
|
26
|
+
protected _sidebarWidthOverride: number | null;
|
|
27
|
+
constructor(rootClass: string,
|
|
28
|
+
/** Which widget's width rule applies — they differ once a pane has a minimum. */
|
|
29
|
+
_widthRule: SplitViewWidthRule,
|
|
30
|
+
/** The headless state machine this widget renders (`split-view-state.ts`). */
|
|
31
|
+
_state: TState);
|
|
21
32
|
/**
|
|
22
33
|
* (Re)declare the two columns so the sidebar's column is fixed-width ('auto')
|
|
23
34
|
* and the content's is expanding ('star'), ordered by {@link sidebarPosition}:
|
|
24
35
|
* `start` → [sidebar auto, content star]; `end` → [content star, sidebar auto].
|
|
25
36
|
* Without this an `end` sidebar would land in the expanding column and float
|
|
26
37
|
* away from the right edge (leaving a gap), with the content squeezed.
|
|
38
|
+
*
|
|
39
|
+
* `splitViewColumns()` is the other half of the same rule — which column each
|
|
40
|
+
* PANE is written into. The two must agree, or an `end` sidebar ends up in the
|
|
41
|
+
* expanding column with the content squeezed into the fixed one.
|
|
27
42
|
*/
|
|
28
43
|
protected _syncColumns(): void;
|
|
44
|
+
/**
|
|
45
|
+
* Publish which visual side the pane is on, so the theme can put the divider
|
|
46
|
+
* there — the CSS counterpart to `_sidebars.scss`'s `:dir()` x `.end`
|
|
47
|
+
* product. A fixed `border-right` drew it on the wrong edge for an `end`
|
|
48
|
+
* sidebar and for every RTL layout.
|
|
49
|
+
*/
|
|
50
|
+
protected _syncSidebarSide(view?: View | null): void;
|
|
51
|
+
/**
|
|
52
|
+
* The reading direction `start` / `end` resolve against.
|
|
53
|
+
*
|
|
54
|
+
* `direction` is an INHERITED CSS property on NativeScript's `Style`, so a
|
|
55
|
+
* `direction: rtl` on the Page reaches every split view under it — the same
|
|
56
|
+
* way GTK's text direction reaches a widget from its window. It defaults to
|
|
57
|
+
* unset, which is `ltr`.
|
|
58
|
+
*/
|
|
59
|
+
get textDirection(): AdwTextDirection;
|
|
60
|
+
/** Re-emit `notify::show-sidebar` for a state change. */
|
|
61
|
+
protected _emitShowSidebar(event: NsShowSidebarNotification): void;
|
|
29
62
|
/** Subclass-specific layout application for the current collapsed/show state. */
|
|
30
63
|
protected abstract _applyLayout(): void;
|
|
31
64
|
/** Apply a user-initiated show/hide toggle. The default is an instant re-layout;
|
|
@@ -54,20 +87,47 @@ export declare abstract class AdwSplitViewBase extends GridLayout {
|
|
|
54
87
|
showSidebarPane(): void;
|
|
55
88
|
/** Hide the sidebar (relevant in collapsed mode). */
|
|
56
89
|
hideSidebarPane(): void;
|
|
57
|
-
/**
|
|
90
|
+
/**
|
|
91
|
+
* Whether the view is in collapsed (narrow / single-pane) mode.
|
|
92
|
+
*
|
|
93
|
+
* On an OVERLAY split view this is not an independent flag: unless the sidebar
|
|
94
|
+
* is pinned, collapsing hides it and uncollapsing shows it, emitting
|
|
95
|
+
* `notify::show-sidebar` first — the state machine owns that, not this setter.
|
|
96
|
+
*/
|
|
58
97
|
get collapsed(): boolean;
|
|
59
98
|
set collapsed(value: boolean);
|
|
60
99
|
/** Whether the sidebar is shown. Toggling emits `notify::show-sidebar`. */
|
|
61
100
|
get showSidebar(): boolean;
|
|
62
101
|
set showSidebar(value: boolean);
|
|
63
|
-
/**
|
|
102
|
+
/**
|
|
103
|
+
* The sidebar pane width in DIPs, DERIVED from the container size unless a
|
|
104
|
+
* caller assigned one. `Adw.OverlaySplitView` has no stored width — see
|
|
105
|
+
* `split-view-width.ts` for why the old fixed 240 could not be right.
|
|
106
|
+
*/
|
|
64
107
|
get sidebarWidth(): number;
|
|
65
108
|
set sidebarWidth(value: number);
|
|
109
|
+
/** Lower bound in DIPs (`Adw.OverlaySplitView:min-sidebar-width`, default 180). */
|
|
110
|
+
get minSidebarWidth(): number;
|
|
111
|
+
set minSidebarWidth(value: number);
|
|
112
|
+
/** Upper bound in DIPs (`Adw.OverlaySplitView:max-sidebar-width`, default 280). */
|
|
113
|
+
get maxSidebarWidth(): number;
|
|
114
|
+
set maxSidebarWidth(value: number);
|
|
115
|
+
/** Share of the container the sidebar asks for (default 0.25). */
|
|
116
|
+
get sidebarWidthFraction(): number;
|
|
117
|
+
set sidebarWidthFraction(value: number);
|
|
118
|
+
/**
|
|
119
|
+
* Re-measure the container and re-size the sidebar.
|
|
120
|
+
*
|
|
121
|
+
* Called from `layoutChanged`, the same size source `addBreakpoints` uses —
|
|
122
|
+
* NativeScript has no window-resize signal, so a view's post-layout size is
|
|
123
|
+
* the closest thing to the window size Adwaita evaluates against.
|
|
124
|
+
*/
|
|
125
|
+
protected _applySidebarWidth(): void;
|
|
66
126
|
/** Which side the sidebar sits on — `'start'` (leading / left) or `'end'`
|
|
67
127
|
* (trailing / right). Mirrors `Adw.OverlaySplitView`'s `sidebar-position`
|
|
68
128
|
* (the storybook controls overlay uses `'end'`). */
|
|
69
|
-
get sidebarPosition():
|
|
70
|
-
set sidebarPosition(value:
|
|
129
|
+
get sidebarPosition(): AdwPackType;
|
|
130
|
+
set sidebarPosition(value: AdwPackType);
|
|
71
131
|
/** The sidebar pane, or `null`. */
|
|
72
132
|
get sidebar(): View | null;
|
|
73
133
|
/** The content pane, or `null`. */
|