@gjsify/adwaita-nativescript 0.30.0 → 0.32.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-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 +2 -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 +8 -3
- 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 +21 -4
- 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 +159 -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 +55 -12
- package/lib/types/widgets/split-view-state.d.ts +196 -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 +61 -32
- package/lib/types/widgets/view-switcher-model.d.ts +114 -0
- package/lib/types/widgets/wrap-box-layout.d.ts +43 -0
- package/lib/types/wrap-box.spec.d.ts +2 -0
- package/package.json +7 -7
- package/src/theme/adwaita.css +393 -8
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { ADW_BANNER_BUTTON_STYLE_CLASSES, ADW_BANNER_DEFAULTS, ADW_CLAMP_SIZE_CLASSES, ADW_SPINNER_MIN_SIZE, ADW_TOOLBAR_BAR_CLASSES, ADW_TOOLBAR_VIEW_CLASSES, ADW_TOOLBAR_VIEW_DEFAULTS, type AdwBannerButtonStyle, type AdwBannerProps, type AdwClampSizeClass, type AdwToolbarStyle } from '@gjsify/adwaita-core';
|
|
2
|
+
export { ADW_BANNER_BUTTON_STYLE_CLASSES, ADW_BANNER_DEFAULTS, ADW_CLAMP_SIZE_CLASSES, ADW_SPINNER_MIN_SIZE, ADW_TOOLBAR_BAR_CLASSES, ADW_TOOLBAR_VIEW_CLASSES, ADW_TOOLBAR_VIEW_DEFAULTS, };
|
|
3
|
+
export type { AdwBannerButtonStyle, AdwClampSizeClass, AdwToolbarStyle };
|
|
4
|
+
/** `Adw.Clamp:maximum-size` default, in DIPs. */
|
|
5
|
+
export declare const DEFAULT_CLAMP_MAX_SIZE: number;
|
|
6
|
+
/** `Adw.Clamp:tightening-threshold` default, in DIPs. */
|
|
7
|
+
export declare const DEFAULT_CLAMP_TIGHTENING_THRESHOLD: number;
|
|
8
|
+
/** The two clamp properties, as the widget holds them. */
|
|
9
|
+
export interface ClampProps {
|
|
10
|
+
/** How wide the child may ever get. Defaults to libadwaita's 600. */
|
|
11
|
+
maximumSize: number;
|
|
12
|
+
/** Where the eased tightening starts. Defaults to libadwaita's 400. */
|
|
13
|
+
tighteningThreshold: number;
|
|
14
|
+
}
|
|
15
|
+
/** The property defaults a fresh clamp starts with. */
|
|
16
|
+
export declare function defaultClampProps(): ClampProps;
|
|
17
|
+
/**
|
|
18
|
+
* Normalise one clamp property, keeping a nonsense value out of the layout.
|
|
19
|
+
*
|
|
20
|
+
* Delegates to core so the NativeScript widget and the browser element agree on
|
|
21
|
+
* the three inputs they used to answer differently — `0` (valid, and NOT the
|
|
22
|
+
* default), a non-numeric value (never reaches the layout, so the DEFAULT
|
|
23
|
+
* applies), and a negative (clamped to the range floor).
|
|
24
|
+
*/
|
|
25
|
+
export declare function normalizeClampProp(value: number | string | null | undefined, fallback: number): number;
|
|
26
|
+
/** What one clamp layout pass tells the widget to do with its child. */
|
|
27
|
+
export interface ClampAllocationForWidth {
|
|
28
|
+
/**
|
|
29
|
+
* The child's `width` — a DIP number, or `'auto'` while the clamp has not
|
|
30
|
+
* been laid out yet, which leaves the child at its natural size instead of
|
|
31
|
+
* pinning it to a width derived from a container of size zero.
|
|
32
|
+
*/
|
|
33
|
+
width: number | 'auto';
|
|
34
|
+
/** The `small`/`medium`/`large` class the child carries, or `null` before the first layout. */
|
|
35
|
+
sizeClass: AdwClampSizeClass | null;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The child width and size class for a clamp `availableWidth` DIPs wide.
|
|
39
|
+
*
|
|
40
|
+
* `availableWidth <= 0` means NativeScript has not laid the view out yet — it
|
|
41
|
+
* reports a zero size before the first pass — and the honest answer there is
|
|
42
|
+
* "do not constrain", the same shape `sidebarWidthFor` uses for the same reason.
|
|
43
|
+
* Anything else runs libadwaita's curve, so a narrow container yields a narrow
|
|
44
|
+
* child rather than the maximum.
|
|
45
|
+
*
|
|
46
|
+
* `childMin`/`childNat` are 0: NativeScript does not expose a child's measured
|
|
47
|
+
* minimum before layout, and `lower = MAX (…, child_min)` only ever RAISES the
|
|
48
|
+
* child's width — an NS child whose own content is wider than the clamp already
|
|
49
|
+
* overflows rather than being cut, so nothing is lost by leaving it out.
|
|
50
|
+
*/
|
|
51
|
+
export declare function clampAllocationFor(availableWidth: number, props: ClampProps): ClampAllocationForWidth;
|
|
52
|
+
/**
|
|
53
|
+
* Default spinner diameter in DIPs — `Adw.Spinner`'s measured natural size,
|
|
54
|
+
* which equals its minimum (adw-spinner.c:78-81).
|
|
55
|
+
*
|
|
56
|
+
* Replaces an invented 32: nothing in libadwaita produces that number.
|
|
57
|
+
*/
|
|
58
|
+
export declare const DEFAULT_SPINNER_SIZE = 16;
|
|
59
|
+
/**
|
|
60
|
+
* The diameter an `ActivityIndicator` is sized to for a requested `size`.
|
|
61
|
+
*
|
|
62
|
+
* The platform indicator fills its view, so the view IS the ring: floored at the
|
|
63
|
+
* measured minimum 16 and capped at Adwaita's 64, with the odd-size flooring
|
|
64
|
+
* (`31` draws a 30 DIP ring) coming from the paintable rather than from here.
|
|
65
|
+
*/
|
|
66
|
+
export declare function spinnerDiameter(value: number | string | null | undefined): number;
|
|
67
|
+
/** The four toolbar-view properties the style classes are derived from. */
|
|
68
|
+
export interface ToolbarViewProps {
|
|
69
|
+
/** `top-bar-style`. */
|
|
70
|
+
topBarStyle: AdwToolbarStyle;
|
|
71
|
+
/** `bottom-bar-style`. */
|
|
72
|
+
bottomBarStyle: AdwToolbarStyle;
|
|
73
|
+
/** `extend-content-to-top-edge`. */
|
|
74
|
+
extendContentToTopEdge: boolean;
|
|
75
|
+
/** `extend-content-to-bottom-edge`. */
|
|
76
|
+
extendContentToBottomEdge: boolean;
|
|
77
|
+
}
|
|
78
|
+
/** The property defaults a fresh toolbar view starts with. */
|
|
79
|
+
export declare function defaultToolbarViewProps(): ToolbarViewProps;
|
|
80
|
+
/** The three `className` strings a toolbar view distributes over its own node and its two bar boxes. */
|
|
81
|
+
export interface ToolbarViewClassNames {
|
|
82
|
+
/** `className` for the view. */
|
|
83
|
+
view: string;
|
|
84
|
+
/** `className` for the top-bar box. */
|
|
85
|
+
topBar: string;
|
|
86
|
+
/** `className` for the bottom-bar box. */
|
|
87
|
+
bottomBar: string;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Swap the classes a widget MANAGES on a NativeScript `className`, leaving every
|
|
91
|
+
* other token in place.
|
|
92
|
+
*
|
|
93
|
+
* NS views carry a space-separated string rather than a `classList`, so there is
|
|
94
|
+
* no `toggle`: the whole string is rewritten on every derivation. Composing from
|
|
95
|
+
* a fixed base instead would silently drop what a CONSUMER added — the storybook
|
|
96
|
+
* appends `sb-sidebar-pane` to an `AdwToolbarView`, and a re-style would have
|
|
97
|
+
* taken it away again.
|
|
98
|
+
*/
|
|
99
|
+
export declare function replaceClasses(current: string, managed: readonly string[], next: readonly string[]): string;
|
|
100
|
+
/** The child `className` for a clamp allocation — the size class, and nothing else touched. */
|
|
101
|
+
export declare function clampChildClassName(current: string, sizeClass: AdwClampSizeClass | null): string;
|
|
102
|
+
/** The five banner properties, as the widget holds them. */
|
|
103
|
+
export type BannerProps = AdwBannerProps;
|
|
104
|
+
/**
|
|
105
|
+
* The property defaults a fresh banner starts with — libadwaita's, not this
|
|
106
|
+
* port's.
|
|
107
|
+
*
|
|
108
|
+
* This is the whole reason the banner is here. `AdwBanner` used to initialise
|
|
109
|
+
* `_revealed = true` AND never write `visibility` in its constructor, so a
|
|
110
|
+
* banner put itself on screen on a device while the same markup stayed hidden in
|
|
111
|
+
* the browser. `Adw.Banner:revealed` defaults to FALSE (adw-banner.c:456-459) —
|
|
112
|
+
* "Banners are hidden by default" (:47) — and `use-markup` to TRUE (:422-425),
|
|
113
|
+
* which the port had backwards as well.
|
|
114
|
+
*/
|
|
115
|
+
export declare function defaultBannerProps(): BannerProps;
|
|
116
|
+
/**
|
|
117
|
+
* The text the NS title `Label` is given.
|
|
118
|
+
*
|
|
119
|
+
* `Adw.Banner`'s title is Pango markup by default (:422-425) and the NS CSS
|
|
120
|
+
* subset has no inline-markup layer at all, so the honest reduction is the
|
|
121
|
+
* markup's PLAIN TEXT: `<b>Metered</b>` reads `Metered`, which is what GTK
|
|
122
|
+
* paints minus the weight, where writing the raw string would paint the tags.
|
|
123
|
+
* Unparseable markup keeps the raw string, reproducing the C fallback that
|
|
124
|
+
* {@link stripMarkup} already models.
|
|
125
|
+
*/
|
|
126
|
+
export declare function bannerTitleText(title: string, useMarkup: boolean): string;
|
|
127
|
+
/**
|
|
128
|
+
* The NS `visibility` for a `revealed` value.
|
|
129
|
+
*
|
|
130
|
+
* `Adw.Banner` reveals through a `GtkRevealer` (:817); the NS subset has no
|
|
131
|
+
* revealer, so `collapse` — which takes the view out of layout entirely — is the
|
|
132
|
+
* closest thing to a fully retracted one.
|
|
133
|
+
*/
|
|
134
|
+
export declare function bannerVisibility(revealed: boolean): 'visible' | 'collapse';
|
|
135
|
+
/**
|
|
136
|
+
* The `className` for the banner button — the managed `button-style` class
|
|
137
|
+
* swapped in, every other token left alone.
|
|
138
|
+
*
|
|
139
|
+
* `adw_banner_set_button_style` only ever adds or removes `suggested-action`
|
|
140
|
+
* (:766, :769); it never rewrites the button's class list, and neither does
|
|
141
|
+
* this.
|
|
142
|
+
*/
|
|
143
|
+
export declare function bannerButtonClassName(current: string, style: AdwBannerButtonStyle): string;
|
|
144
|
+
/**
|
|
145
|
+
* The `className` strings for a toolbar view, given its CURRENT ones, its
|
|
146
|
+
* properties and the measured bar heights.
|
|
147
|
+
*
|
|
148
|
+
* `topBarHeight`/`bottomBarHeight` are the ALLOCATED heights, exactly as
|
|
149
|
+
* `update_undershoots` reads `gtk_widget_get_height (self->top_bar)` — a bar box
|
|
150
|
+
* that was never given a height fades nothing, so it gets no undershoot.
|
|
151
|
+
*/
|
|
152
|
+
export declare function toolbarViewClassNames(current: {
|
|
153
|
+
view: string;
|
|
154
|
+
topBar: string;
|
|
155
|
+
bottomBar: string;
|
|
156
|
+
}, props: ToolbarViewProps, heights: {
|
|
157
|
+
topBarHeight: number;
|
|
158
|
+
bottomBarHeight: number;
|
|
159
|
+
}): ToolbarViewClassNames;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { AdwDataGridRowVariant, DataGridTrack } from '@gjsify/adwaita-core';
|
|
2
|
+
import type { GridUnitType } from '@nativescript/core';
|
|
3
|
+
/** The two numbers a NativeScript `ItemSpec` is constructed from. */
|
|
4
|
+
export interface DataGridItemSpec {
|
|
5
|
+
/** The `ItemSpec` value: a star weight, a pixel length, or 1 for `auto`. */
|
|
6
|
+
value: number;
|
|
7
|
+
/** The `GridUnitType` — `'star'`, `'pixel'` or `'auto'`. */
|
|
8
|
+
type: GridUnitType;
|
|
9
|
+
}
|
|
10
|
+
/** The class the header row's background carries. */
|
|
11
|
+
export declare const DATA_GRID_HEADER_ROW_CLASS = "adw-data-grid-row header";
|
|
12
|
+
/** The class a section row's single spanning cell carries. */
|
|
13
|
+
export declare const DATA_GRID_SECTION_CELL_CLASS = "adw-data-grid-cell align-start section-cell";
|
|
14
|
+
/** The class a header CELL carries, on top of its column's own classes. */
|
|
15
|
+
export declare const DATA_GRID_HEADER_CELL_CLASS = "header-cell";
|
|
16
|
+
/**
|
|
17
|
+
* A fixed track's CSS length in device-independent pixels, or `null` when this
|
|
18
|
+
* renderer cannot resolve it.
|
|
19
|
+
*
|
|
20
|
+
* `DataGridTrack`'s `fixed` kind carries the author's `width` string verbatim,
|
|
21
|
+
* because only a CSS engine can resolve every unit CSS has. NativeScript has
|
|
22
|
+
* exactly one length unit — the DIP — and its own stylesheet subset writes it as
|
|
23
|
+
* a bare number (`min-height: 34`, `padding: 5 10 5 10`), so BOTH `'80px'` and
|
|
24
|
+
* `'80'` are read as 80 here and everything else (`6rem`, `50%`, `calc(...)`)
|
|
25
|
+
* is unresolvable and falls back to a content-sized track.
|
|
26
|
+
*
|
|
27
|
+
* That bare-number acceptance is a deliberate divergence from the browser, where
|
|
28
|
+
* `width: '80'` is not a valid CSS length and takes the WHOLE
|
|
29
|
+
* `grid-template-columns` declaration down with it. Falling back to `auto` for
|
|
30
|
+
* one column is the smaller failure, and refusing a spelling that is valid in
|
|
31
|
+
* this renderer's own stylesheet would be the surprising half.
|
|
32
|
+
*
|
|
33
|
+
* A negative or non-finite length is rejected rather than clamped: `ItemSpec`
|
|
34
|
+
* refuses one, and a column silently pinned to 0 reads as a missing column.
|
|
35
|
+
*/
|
|
36
|
+
export declare function parseDataGridWidth(css: string): number | null;
|
|
37
|
+
/**
|
|
38
|
+
* The `ItemSpec` numbers for one column track.
|
|
39
|
+
*
|
|
40
|
+
* The four track kinds map onto the three `GridUnitType`s:
|
|
41
|
+
* - `slack` → `1 star`. The slack column takes what the fixed and content
|
|
42
|
+
* columns leave, which is what `minmax(0px, 1fr)` does in the browser.
|
|
43
|
+
* - `flex` → `<weight> star`, the same proportional share `<weight>fr` gives.
|
|
44
|
+
* - `fixed` → `<px> pixel` when {@link parseDataGridWidth} can read the length,
|
|
45
|
+
* `auto` when it cannot.
|
|
46
|
+
* - `auto` → `1 auto` (the value is ignored for an auto track).
|
|
47
|
+
*
|
|
48
|
+
* A `flex` weight of 0 becomes a ZERO-WIDTH PIXEL track rather than a star one:
|
|
49
|
+
* `0fr` collapses the column in the browser, and `ItemSpec(0, 'star')` is not a
|
|
50
|
+
* spelling for that — a star weight is a divisor. Same for a negative or
|
|
51
|
+
* non-finite weight, which cannot mean anything a layout can honour.
|
|
52
|
+
*/
|
|
53
|
+
export declare function dataGridItemSpec(track: DataGridTrack): DataGridItemSpec;
|
|
54
|
+
/**
|
|
55
|
+
* A stable key for a track list — what the widget re-declares its columns on.
|
|
56
|
+
*
|
|
57
|
+
* The precedent is `AdwViewSwitcherBar`, which rebuilds its buttons only when the
|
|
58
|
+
* page COUNT moves so that a selection change cannot replace the button under
|
|
59
|
+
* the user's finger. The same discipline applies here, with one difference the
|
|
60
|
+
* grid forces: a column list can change WITHOUT changing length — pinning a
|
|
61
|
+
* column's `width` on a narrow screen is exactly that — and a count guard would
|
|
62
|
+
* keep painting against the old tracks. So the guard is the tracks themselves,
|
|
63
|
+
* which is a strict superset: whenever the count moves the key moves too, and a
|
|
64
|
+
* repaint (new rows, a toggled `interactive`) never touches the columns.
|
|
65
|
+
*/
|
|
66
|
+
export declare function dataGridTracksKey(tracks: ReadonlyArray<DataGridTrack>): string;
|
|
67
|
+
/**
|
|
68
|
+
* A stable key for the grid's SHAPE — what the widget rebuilds its views on.
|
|
69
|
+
*
|
|
70
|
+
* Rows and columns only, deliberately: every row is built with one cell per
|
|
71
|
+
* column whatever its variant, and a `section` row spans its first cell over the
|
|
72
|
+
* rest instead of dropping them. So changing a row's variant is a repaint, not a
|
|
73
|
+
* rebuild, and the cell views survive a data change of the same size.
|
|
74
|
+
*/
|
|
75
|
+
export declare function dataGridShapeKey(columnCount: number, rowCount: number): string;
|
|
76
|
+
/**
|
|
77
|
+
* The classes a data row's background carries.
|
|
78
|
+
*
|
|
79
|
+
* The row background is a NativeScript-only node and this is why it exists: the
|
|
80
|
+
* browser paints the fill, the hairline rules and the hover affordance on the
|
|
81
|
+
* row ELEMENT, which is a real element there because it is a subgrid. Here the
|
|
82
|
+
* cells are direct children of the one grid, so a full-width `StackLayout`
|
|
83
|
+
* placed first at the same row — below the cells, spanning every column — is
|
|
84
|
+
* what carries them, plus the tap target and the press feedback.
|
|
85
|
+
*
|
|
86
|
+
* `interactive` is a class rather than a widget flag so the press-darken keys off
|
|
87
|
+
* it: `attachRowPressFeedback` is wired on EVERY data row, and a non-interactive
|
|
88
|
+
* one gets a `highlighted` pseudo-class that no stylesheet rule claims.
|
|
89
|
+
*/
|
|
90
|
+
export declare function dataGridRowClass(variant: AdwDataGridRowVariant, interactive: boolean): string;
|
|
91
|
+
/**
|
|
92
|
+
* The classes a body cell carries: its column's own, plus the row's variant.
|
|
93
|
+
*
|
|
94
|
+
* The variant is repeated onto the CELL because of the same structural
|
|
95
|
+
* difference: the browser bolds a subtotal's figures with
|
|
96
|
+
* `.variant-subtotal .adw-data-grid-cell`, a DESCENDANT selector, and here the
|
|
97
|
+
* cell is not inside the row background — the two are siblings in one grid. So
|
|
98
|
+
* the row class cannot reach the cells and the cell has to say it itself.
|
|
99
|
+
*
|
|
100
|
+
* `normal` adds nothing: it is every row in a statement but the handful that
|
|
101
|
+
* carry emphasis, and a class the stylesheet has no rule for is only noise in
|
|
102
|
+
* the one place a reader looks when the emphasis is wrong.
|
|
103
|
+
*/
|
|
104
|
+
export declare function dataGridCellClass(columnClasses: ReadonlyArray<string>, variant: AdwDataGridRowVariant): string;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { EntryRowRenderState, PasswordEntryRowRenderState } from '@gjsify/adwaita-core';
|
|
2
|
+
/** The two NS visibility values the Adwaita widgets use — `collapse` takes no space. */
|
|
3
|
+
export type NsVisibility = 'visible' | 'collapse';
|
|
4
|
+
/** A view the render state shows or hides. */
|
|
5
|
+
export interface ToggleableView {
|
|
6
|
+
visibility: string;
|
|
7
|
+
}
|
|
8
|
+
/** A view whose CSS class list the render state drives. */
|
|
9
|
+
export interface ClassedView {
|
|
10
|
+
className: string;
|
|
11
|
+
}
|
|
12
|
+
/** The views an entry row paints, narrowed to what the render state touches. */
|
|
13
|
+
export interface EntryRowViews {
|
|
14
|
+
/** The row itself — carries the `focused` / `empty` state classes (C:183-186). */
|
|
15
|
+
row: ClassedView;
|
|
16
|
+
/** The large placeholder title (`empty_title` in adw-entry-row.ui). */
|
|
17
|
+
emptyTitle: ToggleableView;
|
|
18
|
+
/** The small label above the value (`title` in adw-entry-row.ui). */
|
|
19
|
+
title: ToggleableView;
|
|
20
|
+
/** The editable field. */
|
|
21
|
+
field: {
|
|
22
|
+
text: string;
|
|
23
|
+
editable: boolean;
|
|
24
|
+
};
|
|
25
|
+
/** The trailing pencil — hidden AND desensitized independently (C:149-150). */
|
|
26
|
+
editIcon: ToggleableView & ClassedView & {
|
|
27
|
+
opacity: number;
|
|
28
|
+
};
|
|
29
|
+
/** The caps-lock warning slot. */
|
|
30
|
+
indicator: ToggleableView;
|
|
31
|
+
/** The apply button. */
|
|
32
|
+
applyButton: ToggleableView;
|
|
33
|
+
}
|
|
34
|
+
/** The views a password entry row adds. */
|
|
35
|
+
export interface PasswordEntryRowViews {
|
|
36
|
+
/** The masked field. */
|
|
37
|
+
field: {
|
|
38
|
+
secure: boolean;
|
|
39
|
+
};
|
|
40
|
+
/** The peek toggle, whose `icon` takes an Adwaita symbolic SVG string. */
|
|
41
|
+
peekButton: {
|
|
42
|
+
icon: string;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/** Base class list of an entry row, before the state classes. */
|
|
46
|
+
export declare const NS_ENTRY_ROW_CLASS = "adw-row adw-action-row adw-entry-row";
|
|
47
|
+
/** Base class list of a password entry row. */
|
|
48
|
+
export declare const NS_PASSWORD_ENTRY_ROW_CLASS = "adw-row adw-action-row adw-entry-row adw-password-entry-row";
|
|
49
|
+
/** Class list of the trailing pencil. */
|
|
50
|
+
export declare const NS_EDIT_ICON_CLASS = "adw-icon adw-entry-edit";
|
|
51
|
+
/**
|
|
52
|
+
* Marker class for a desensitized part. NS has no insensitive state, so the
|
|
53
|
+
* class is only a styling hook — {@link NS_INSENSITIVE_OPACITY} is what the user
|
|
54
|
+
* actually sees.
|
|
55
|
+
*/
|
|
56
|
+
export declare const NS_INSENSITIVE_CLASS = "adw-insensitive";
|
|
57
|
+
/** Opacity of a desensitized part (`gtk_widget_set_sensitive (…, FALSE)`, C:150). */
|
|
58
|
+
export declare const NS_INSENSITIVE_OPACITY = 0.4;
|
|
59
|
+
/** Map a boolean onto NativeScript's `visibility`. */
|
|
60
|
+
export declare function nsVisibility(visible: boolean): NsVisibility;
|
|
61
|
+
/**
|
|
62
|
+
* The row's class list for one render snapshot.
|
|
63
|
+
*
|
|
64
|
+
* `focused` is libadwaita's own class name — `text_state_flags_changed_cb` adds
|
|
65
|
+
* and removes it on the ROW node (adw-entry-row.c:183-186). `empty` has no C
|
|
66
|
+
* counterpart (GTK animates instead of styling), but the NS CSS subset cannot
|
|
67
|
+
* express `:focus-within` at all, so both states have to be reachable as classes
|
|
68
|
+
* or they are not reachable at all on this port.
|
|
69
|
+
*/
|
|
70
|
+
export declare function entryRowClassName(base: string, state: EntryRowRenderState): string;
|
|
71
|
+
/**
|
|
72
|
+
* Paint one entry-row render snapshot.
|
|
73
|
+
*
|
|
74
|
+
* The two titles are the endpoints of libadwaita's cross-fade (C:433-439): GTK
|
|
75
|
+
* lerps between them over `EMPTY_ANIMATION_DURATION_MS`, NS swaps at
|
|
76
|
+
* `emptyTarget` because its CSS subset has no transform/animation.
|
|
77
|
+
*/
|
|
78
|
+
export declare function applyEntryRowState(views: EntryRowViews, state: EntryRowRenderState, base: string): void;
|
|
79
|
+
/**
|
|
80
|
+
* The Adwaita symbolic SVG for a canonical peek icon name.
|
|
81
|
+
*
|
|
82
|
+
* The core names the icon the way the C does (`view-reveal-symbolic` /
|
|
83
|
+
* `view-conceal-symbolic`, adw-password-entry-row.c:68,73); this is the one
|
|
84
|
+
* place that maps a name onto the asset `@gjsify/adwaita-icons` ships.
|
|
85
|
+
*/
|
|
86
|
+
export declare function peekIconSvg(iconName: PasswordEntryRowRenderState['peekIconName']): string;
|
|
87
|
+
/** Paint one password-entry-row render snapshot — `notify_visibility_cb` (C:62-81). */
|
|
88
|
+
export declare function applyPasswordEntryRowState(views: PasswordEntryRowViews, state: PasswordEntryRowRenderState): void;
|
|
@@ -31,6 +31,26 @@ export declare function extractIconPaths(svg: string): IconPath[];
|
|
|
31
31
|
* `''` when the SVG carries no path data.
|
|
32
32
|
*/
|
|
33
33
|
export declare function extractPathData(svg: string): string;
|
|
34
|
+
/** A colour split into the 0..1 components UIKit and CoreGraphics take. */
|
|
35
|
+
export interface IconColorComponents {
|
|
36
|
+
red: number;
|
|
37
|
+
green: number;
|
|
38
|
+
blue: number;
|
|
39
|
+
alpha: number;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Parse `#RGB` / `#RRGGBB` / `#AARRGGBB` into 0..1 components.
|
|
43
|
+
*
|
|
44
|
+
* Android does not need this — `android.graphics.Color.parseColor` takes the
|
|
45
|
+
* string directly — but UIKit has no hex constructor, so the iOS backend has to
|
|
46
|
+
* do the arithmetic. Note the ALPHA-FIRST order in the 8-digit form: that is the
|
|
47
|
+
* Android convention {@link SymbolicIconOptions.color} is documented in, and the
|
|
48
|
+
* two backends must read the same string the same way.
|
|
49
|
+
*
|
|
50
|
+
* Returns opaque black for anything unparsable, so a typo in a caller's colour
|
|
51
|
+
* yields a visible icon rather than an invisible one.
|
|
52
|
+
*/
|
|
53
|
+
export declare function parseHexColor(hex: string): IconColorComponents;
|
|
34
54
|
/**
|
|
35
55
|
* Space-separate the two single-digit ARC FLAGS (large-arc, sweep) in every
|
|
36
56
|
* elliptical-arc command (`A`/`a`) of an SVG path-data string.
|
|
@@ -0,0 +1,13 @@
|
|
|
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 iOS, or
|
|
5
|
+
* `null` when the SVG has no path data / UIKit is unavailable.
|
|
6
|
+
*
|
|
7
|
+
* Drawn at `size` points × the screen scale so it stays crisp on Retina; place
|
|
8
|
+
* it in an `Image` sized `size`×`size` with `stretch:'aspectFit'`, exactly as on
|
|
9
|
+
* Android.
|
|
10
|
+
*/
|
|
11
|
+
export declare function renderSymbolicIcon(svg: string, options?: SymbolicIconOptions): ImageSource | null;
|
|
12
|
+
export { ADWAITA_ICON_GRID, DEFAULT_ICON_COLOR, DEFAULT_ICON_COLOR_DARK, extractIconPaths, extractPathData, } from './icon-path.js';
|
|
13
|
+
export type { IconPath, SymbolicIconOptions } from './icon-path.js';
|
|
@@ -6,8 +6,12 @@ export type { NotifyActiveEventData } from './adw-switch-row.js';
|
|
|
6
6
|
export { AdwEntryRow, NOTIFY_TEXT } from './adw-entry-row.js';
|
|
7
7
|
export type { NotifyTextEventData } from './adw-entry-row.js';
|
|
8
8
|
export { AdwPasswordEntryRow } from './adw-password-entry-row.js';
|
|
9
|
+
export { AdwEntry, ACTIVATE as ENTRY_ACTIVATE, NOTIFY_TEXT as NOTIFY_ENTRY_TEXT } from './adw-entry.js';
|
|
10
|
+
export type { NotifyEntryTextEventData } from './adw-entry.js';
|
|
9
11
|
export { AdwComboRow, ComboState, NOTIFY_SELECTED } from './adw-combo-row.js';
|
|
10
12
|
export type { AdwComboOption, ComboStateChange, ComboStateListener, NotifySelectedEventData } from './adw-combo-row.js';
|
|
13
|
+
export { AdwDropDown, NOTIFY_SELECTED as NOTIFY_DROP_DOWN_SELECTED } from './adw-drop-down.js';
|
|
14
|
+
export type { NotifyDropDownSelectedEventData } from './adw-drop-down.js';
|
|
11
15
|
export { AdwSpinRow, NOTIFY_VALUE, SpinState } from './adw-spin-row.js';
|
|
12
16
|
export type { NotifyValueEventData, SpinStateChange, SpinStateListener } from './adw-spin-row.js';
|
|
13
17
|
export { AdwSliderRow, NOTIFY_SLIDER_VALUE } from './adw-slider-row.js';
|
|
@@ -27,6 +31,10 @@ export { AdwClamp, DEFAULT_CLAMP_MAX_SIZE } from './adw-clamp.js';
|
|
|
27
31
|
export { AdwHeaderBar } from './adw-header-bar.js';
|
|
28
32
|
export { AdwToolbarView } from './adw-toolbar-view.js';
|
|
29
33
|
export { AdwWrapBox } from './adw-wrap-box.js';
|
|
34
|
+
export { AdwDataGrid, ROW_ACTIVATED } from './adw-data-grid.js';
|
|
35
|
+
export type { RowActivatedEventData } from './adw-data-grid.js';
|
|
36
|
+
export { DATA_GRID_HEADER_CELL_CLASS, DATA_GRID_HEADER_ROW_CLASS, DATA_GRID_SECTION_CELL_CLASS, dataGridCellClass, dataGridItemSpec, dataGridRowClass, dataGridShapeKey, dataGridTracksKey, parseDataGridWidth, } from './data-grid-model.js';
|
|
37
|
+
export type { DataGridItemSpec } from './data-grid-model.js';
|
|
30
38
|
export { AdwSpinner, DEFAULT_SPINNER_SIZE } from './adw-spinner.js';
|
|
31
39
|
export { AdwStatusPage } from './adw-status-page.js';
|
|
32
40
|
export { AdwButtonRow, ACTIVATED } from './adw-button-row.js';
|
|
@@ -42,18 +50,25 @@ export type { AdwViewPage, NotifyViewSelectedEventData } from './view-switcher-b
|
|
|
42
50
|
export { AdwViewSwitcher } from './adw-view-switcher.js';
|
|
43
51
|
export { AdwViewSwitcherBar } from './adw-view-switcher-bar.js';
|
|
44
52
|
export { AdwInlineViewSwitcher } from './adw-inline-view-switcher.js';
|
|
45
|
-
export { AdwTabView } from './adw-tab-view.js';
|
|
46
|
-
export {
|
|
47
|
-
export
|
|
53
|
+
export { AdwTabView, CLOSE_PAGE, NOTIFY_SELECTED_PAGE, PAGES_CHANGED } from './adw-tab-view.js';
|
|
54
|
+
export type { ClosePageEventData, NotifySelectedPageEventData, PagesChangedEventData } from './adw-tab-view.js';
|
|
55
|
+
export { applyTabViewVisibility, createTabViewState, tabBarVisibility, tabCloseVisibilities, tabLabelText, tabPageVisibilities, tabTooltipText, tabViewNotifyPayload, } from './tab-view-state.js';
|
|
56
|
+
export type { AdwTabPage, NsVisibility, TabViewNotifyPayload } from './tab-view-state.js';
|
|
57
|
+
export { AdwCarousel, DEFAULT_CAROUSEL_PAGE_WIDTH, NOTIFY_N_PAGES, NOTIFY_POSITION, PAGE_CHANGED, } from './adw-carousel.js';
|
|
58
|
+
export type { NotifyPositionEventData, PageChangedEventData } from './adw-carousel.js';
|
|
59
|
+
export { CarouselScrollSync, applyCarouselDots, carouselDotClasses, carouselNotifyPayload, carouselPositionAtOffset, carouselScrollOffset, createCarouselState, normalizeCarouselPageWidth, } from './carousel-state.js';
|
|
60
|
+
export type { CarouselNotifyPayload, NsCarouselStateOptions } from './carousel-state.js';
|
|
48
61
|
export { AdwNavigationView, NOTIFY_VISIBLE_PAGE } from './adw-navigation-view.js';
|
|
49
62
|
export type { NotifyVisiblePageEventData } from './adw-navigation-view.js';
|
|
50
|
-
export { AdwSplitViewBase,
|
|
63
|
+
export { AdwSplitViewBase, NOTIFY_SHOW_SIDEBAR } from './split-view-base.js';
|
|
51
64
|
export type { NotifyShowSidebarEventData } from './split-view-base.js';
|
|
52
65
|
export { AdwNavigationSplitView } from './adw-navigation-split-view.js';
|
|
53
66
|
export { AdwOverlaySplitView } from './adw-overlay-split-view.js';
|
|
67
|
+
export { NsNavigationSplitViewState, NsOverlaySplitViewState, splitViewColumns } from './split-view-state.js';
|
|
68
|
+
export type { NsShowSidebarNotification, NsSplitViewHost, NsSplitViewState } from './split-view-state.js';
|
|
54
69
|
export { AdwSidebar, NOTIFY_SELECTED as NOTIFY_SIDEBAR_SELECTED } from './adw-sidebar.js';
|
|
55
70
|
export type { NotifySidebarSelectedEventData } from './adw-sidebar.js';
|
|
56
|
-
export { AdwBottomSheet, NOTIFY_OPEN } from './adw-bottom-sheet.js';
|
|
71
|
+
export { AdwBottomSheet, CLOSE_ATTEMPT, NOTIFY_OPEN, SHEET_CLOSE } from './adw-bottom-sheet.js';
|
|
57
72
|
export type { NotifyOpenEventData } from './adw-bottom-sheet.js';
|
|
58
73
|
export { AdwToast, AdwToastOverlay, AdwToastQueue, DEFAULT_TOAST_TIMEOUT, TOAST_BUTTON_CLICKED, } from './adw-toast-overlay.js';
|
|
59
74
|
export type { AdwToastOptions, AdwToastQueueHandlers, AdwToastQueueOptions, ToastScheduler, ToastTimerHandle, } from './adw-toast-overlay.js';
|
|
@@ -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;
|