@gjsify/adwaita-core 0.36.0 → 0.38.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/accent.js +1 -0
- package/lib/esm/conformance/accent.js +1 -0
- package/lib/esm/conformance/index.js +1 -1
- package/lib/esm/conformance/shortcut-label.js +1 -0
- package/lib/esm/index.js +1 -1
- package/lib/esm/shortcut-label.js +1 -0
- package/lib/types/about-dialog.d.ts +92 -98
- package/lib/types/accent.d.ts +36 -0
- package/lib/types/accent.spec.d.ts +2 -0
- package/lib/types/action-row.d.ts +95 -125
- package/lib/types/avatar.d.ts +30 -37
- package/lib/types/banner.d.ts +25 -53
- package/lib/types/breakpoint.d.ts +6 -7
- package/lib/types/button-content.d.ts +41 -80
- package/lib/types/carousel.d.ts +175 -252
- package/lib/types/checks.d.ts +13 -30
- package/lib/types/chrome.d.ts +90 -136
- package/lib/types/color-scheme.d.ts +5 -6
- package/lib/types/conformance/about-dialog.d.ts +64 -91
- package/lib/types/conformance/accent.d.ts +20 -0
- package/lib/types/conformance/action-row.d.ts +26 -46
- package/lib/types/conformance/avatar.d.ts +8 -10
- package/lib/types/conformance/banner.d.ts +17 -37
- package/lib/types/conformance/button-content.d.ts +24 -46
- package/lib/types/conformance/carousel.d.ts +35 -75
- package/lib/types/conformance/checks.d.ts +0 -4
- package/lib/types/conformance/chrome.d.ts +28 -36
- package/lib/types/conformance/data-grid.d.ts +28 -47
- package/lib/types/conformance/dialog.d.ts +4 -9
- package/lib/types/conformance/entry-row.d.ts +20 -39
- package/lib/types/conformance/index.d.ts +4 -0
- package/lib/types/conformance/navigation-view.d.ts +0 -4
- package/lib/types/conformance/popover.d.ts +4 -9
- package/lib/types/conformance/preferences.d.ts +15 -28
- package/lib/types/conformance/rows.d.ts +5 -12
- package/lib/types/conformance/shortcut-label.d.ts +34 -0
- package/lib/types/conformance/sidebar.d.ts +28 -49
- package/lib/types/conformance/spinner.d.ts +21 -27
- package/lib/types/conformance/split-button.d.ts +21 -43
- package/lib/types/conformance/split-view.d.ts +29 -36
- package/lib/types/conformance/tab-view.d.ts +32 -73
- package/lib/types/conformance/view-stack.d.ts +0 -12
- package/lib/types/conformance/view-switcher.d.ts +46 -114
- package/lib/types/conformance/wrap-box.d.ts +40 -63
- package/lib/types/data-grid.d.ts +38 -48
- package/lib/types/dialog.d.ts +39 -51
- package/lib/types/easing.d.ts +6 -12
- package/lib/types/entry-row.d.ts +94 -123
- package/lib/types/glib.d.ts +17 -25
- package/lib/types/index.d.ts +4 -0
- package/lib/types/length-unit.d.ts +7 -12
- package/lib/types/navigation-view.d.ts +62 -68
- package/lib/types/popover.d.ts +39 -66
- package/lib/types/preferences.d.ts +83 -100
- package/lib/types/rows.d.ts +45 -63
- package/lib/types/shortcut-label.d.ts +79 -0
- package/lib/types/shortcut-label.spec.d.ts +2 -0
- package/lib/types/sidebar.d.ts +95 -121
- package/lib/types/spinner.d.ts +39 -61
- package/lib/types/split-button.d.ts +78 -134
- package/lib/types/split-view.d.ts +74 -89
- package/lib/types/tab-view.d.ts +174 -256
- package/lib/types/view-stack.d.ts +87 -129
- package/lib/types/view-switcher.d.ts +126 -211
- package/lib/types/wrap-box.d.ts +62 -123
- package/package.json +3 -3
package/lib/types/wrap-box.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type AdwLengthUnit } from './length-unit.js';
|
|
2
|
-
/** `AdwJustifyMode` — the three values of `Adw.WrapBox:justify
|
|
2
|
+
/** `AdwJustifyMode` — the three values of `Adw.WrapBox:justify`. */
|
|
3
3
|
export type AdwWrapBoxJustify = 'none' | 'fill' | 'spread';
|
|
4
|
-
/** `AdwWrapPolicy` — whether children may shrink before a line wraps
|
|
4
|
+
/** `AdwWrapPolicy` — whether children may shrink before a line wraps. */
|
|
5
5
|
export type AdwWrapPolicy = 'minimum' | 'natural';
|
|
6
6
|
/** `AdwPackDirection` — which end of a line children are packed from. */
|
|
7
7
|
export type AdwWrapBoxPackDirection = 'start-to-end' | 'end-to-start';
|
|
@@ -11,133 +11,82 @@ export type AdwWrapBoxOrientation = 'horizontal' | 'vertical';
|
|
|
11
11
|
export declare const ADW_WRAP_BOX_JUSTIFY_MODES: readonly AdwWrapBoxJustify[];
|
|
12
12
|
/** The two wrap policies, for validating an attribute against the C enum. */
|
|
13
13
|
export declare const ADW_WRAP_POLICIES: readonly AdwWrapPolicy[];
|
|
14
|
-
/**
|
|
15
|
-
* `
|
|
16
|
-
*
|
|
17
|
-
* Both are `g_param_spec_int (…, 0, G_MAXINT, 0, …)` — adw-wrap-box.c:285-287
|
|
18
|
-
* and :393-395. The NativeScript port defaulted BOTH to 6 DIPs, so identical
|
|
19
|
-
* markup was looser on a phone than in the browser.
|
|
20
|
-
*/
|
|
14
|
+
/** `Adw.WrapBox:child-spacing` / `:line-spacing` default, in px — both
|
|
15
|
+
* `g_param_spec_int (…, 0, G_MAXINT, 0, …)`. */
|
|
21
16
|
export declare const ADW_WRAP_BOX_DEFAULT_SPACING = 0;
|
|
22
|
-
/**
|
|
23
|
-
* `
|
|
24
|
-
*
|
|
25
|
-
* Declared `g_param_spec_float (…, 0, 1, 0, …)`, so GObject validates an
|
|
26
|
-
* out-of-range value back into `[0, 1]` on set.
|
|
27
|
-
*/
|
|
17
|
+
/** `Adw.WrapBox:align` default — `g_param_spec_float (…, 0, 1, 0, …)`, so GObject
|
|
18
|
+
* clamps back into `[0, 1]` on set. */
|
|
28
19
|
export declare const ADW_WRAP_BOX_DEFAULT_ALIGN = 0;
|
|
29
|
-
/** `Adw.WrapBox:justify` default — `ADW_JUSTIFY_NONE
|
|
20
|
+
/** `Adw.WrapBox:justify` default — `ADW_JUSTIFY_NONE`. */
|
|
30
21
|
export declare const ADW_WRAP_BOX_DEFAULT_JUSTIFY: AdwWrapBoxJustify;
|
|
31
|
-
/** `Adw.WrapBox:justify-last-line` default — `FALSE
|
|
22
|
+
/** `Adw.WrapBox:justify-last-line` default — `FALSE`. */
|
|
32
23
|
export declare const ADW_WRAP_BOX_DEFAULT_JUSTIFY_LAST_LINE = false;
|
|
33
|
-
/** `Adw.WrapBox:wrap-policy` default — `ADW_WRAP_NATURAL
|
|
24
|
+
/** `Adw.WrapBox:wrap-policy` default — `ADW_WRAP_NATURAL`. */
|
|
34
25
|
export declare const ADW_WRAP_BOX_DEFAULT_WRAP_POLICY: AdwWrapPolicy;
|
|
35
|
-
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* `-1` is not "zero length": it means the box asks for whatever its children
|
|
40
|
-
* need, so a renderer must not write it into a size.
|
|
41
|
-
*/
|
|
26
|
+
/** `Adw.WrapBox:natural-line-length` default — `-1` = UNSET, range `-1 … G_MAXINT`.
|
|
27
|
+
* Not "zero length": the box asks for whatever its
|
|
28
|
+
* children need, so a renderer must not write it into a size. */
|
|
42
29
|
export declare const ADW_WRAP_BOX_NATURAL_LINE_LENGTH_UNSET = -1;
|
|
43
|
-
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* Note this DIFFERS from the split views, which default to `sp`
|
|
48
|
-
* (`DEFAULT_SIDEBAR_WIDTH_UNIT`). Sharing `normalizeLengthUnit` between them is
|
|
49
|
-
* only safe because the default is the caller's argument, not the helper's.
|
|
50
|
-
*/
|
|
30
|
+
/** The unit default for all three length properties — `ADW_LENGTH_UNIT_PX`. DIFFERS from
|
|
31
|
+
* the split views' `sp` (`DEFAULT_SIDEBAR_WIDTH_UNIT`); sharing `normalizeLengthUnit` is
|
|
32
|
+
* only safe because the default is the caller's argument, not the helper's. */
|
|
51
33
|
export declare const ADW_WRAP_BOX_DEFAULT_LENGTH_UNIT: AdwLengthUnit;
|
|
52
|
-
/** `Adw.WrapBox:pack-direction` default — `ADW_PACK_START_TO_END
|
|
34
|
+
/** `Adw.WrapBox:pack-direction` default — `ADW_PACK_START_TO_END`. */
|
|
53
35
|
export declare const ADW_WRAP_BOX_DEFAULT_PACK_DIRECTION: AdwWrapBoxPackDirection;
|
|
54
36
|
/** The two pack directions, for validating an attribute against the C enum. */
|
|
55
37
|
export declare const ADW_WRAP_BOX_PACK_DIRECTIONS: readonly AdwWrapBoxPackDirection[];
|
|
56
|
-
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* anything else happens, so it never reaches the layout.
|
|
60
|
-
*
|
|
61
|
-
* The property is declared with a minimum of 0, which is why the clamp exists at
|
|
62
|
-
* all: without it GObject would reject the value and warn. The non-numeric cases
|
|
63
|
-
* have no C counterpart — the property is an `int` — and resolve to the default,
|
|
64
|
-
* so a typo cannot put `NaN` into a `column-gap` or a native layout pass.
|
|
65
|
-
*/
|
|
38
|
+
/** `adw_wrap_box_set_child_spacing` / `set_line_spacing` — a negative spacing is clamped to 0 before it can reach the layout.
|
|
39
|
+
* The non-numeric cases have no C counterpart (the property is an `int`) and
|
|
40
|
+
* resolve to the default, so a typo cannot put `NaN` into a `column-gap`. */
|
|
66
41
|
export declare function normalizeWrapBoxSpacing(value: unknown): number;
|
|
67
|
-
/** `Adw.WrapBox:align` — `g_param_spec_float (…, 0, 1, 0, …)`,
|
|
42
|
+
/** `Adw.WrapBox:align` — `g_param_spec_float (…, 0, 1, 0, …)`, so GObject clamps on set. */
|
|
68
43
|
export declare function normalizeWrapBoxAlign(value: unknown): number;
|
|
69
44
|
/** An out-of-range enum value leaves a GObject property at its default. */
|
|
70
45
|
export declare function normalizeWrapBoxJustify(value: unknown): AdwWrapBoxJustify;
|
|
71
46
|
/** `Adw.WrapBox:wrap-policy` — same enum gate, defaulting to `natural`. */
|
|
72
47
|
export declare function normalizeWrapPolicy(value: unknown): AdwWrapPolicy;
|
|
73
|
-
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* Anything below -1 is out of the declared range, so it lands on the sentinel
|
|
77
|
-
* rather than on 0: a GObject setter would have refused it and left the property
|
|
78
|
-
* where it was, and "unset" is what the property was born as.
|
|
79
|
-
*/
|
|
48
|
+
/** `Adw.WrapBox:natural-line-length` — an `int` in `[-1, G_MAXINT]`. Any NEGATIVE value
|
|
49
|
+
* lands on the sentinel rather than on 0: a GObject setter would have refused an
|
|
50
|
+
* out-of-range write, and "unset" is where the property started. */
|
|
80
51
|
export declare function normalizeNaturalLineLength(value: unknown): number;
|
|
81
52
|
/** `Adw.WrapBox`'s three length units — `px` by default, unlike the split views' `sp`. */
|
|
82
53
|
export declare function normalizeWrapBoxLengthUnit(value: unknown): AdwLengthUnit;
|
|
83
54
|
/** `Adw.WrapBox:pack-direction` — the same enum gate, defaulting to `start-to-end`. */
|
|
84
55
|
export declare function normalizeWrapBoxPackDirection(value: unknown): AdwWrapBoxPackDirection;
|
|
85
|
-
/**
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
* The UNSET natural line length passes through untouched, mirroring the C's own
|
|
91
|
-
* `if (self->natural_line_length >= 0)` gate (:562): converting `-1` would turn
|
|
92
|
-
* a sentinel into a length, and at dpi ≠ 96 it would not even stay -1.
|
|
93
|
-
*/
|
|
56
|
+
/** One length property resolved to pixels — the `adw_length_unit_to_px` call the measure
|
|
57
|
+
* and allocate paths both make. The UNSET natural line length passes through untouched,
|
|
58
|
+
* mirroring the C's `if (self->natural_line_length >= 0)` gate: converting `-1` would turn
|
|
59
|
+
* a sentinel into a length, and at dpi ≠ 96 would not even leave it -1. */
|
|
94
60
|
export declare function wrapBoxLengthToPx(value: number, unit: AdwLengthUnit, dpi?: number): number;
|
|
95
61
|
/** What a renderer has to do with a line's leftover space. */
|
|
96
62
|
export interface WrapBoxLineLayout {
|
|
97
|
-
/**
|
|
98
|
-
*
|
|
99
|
-
* the widget's `justify` for every line except the final one, and for the
|
|
100
|
-
* final one only when `justify-last-line` is set
|
|
101
|
-
* (adw-wrap-layout.c:397-400, :705-706).
|
|
102
|
-
*/
|
|
63
|
+
/** The justify mode governing THIS line, after the last-line gate — the widget's
|
|
64
|
+
* `justify` except on the final line, which needs `justify-last-line`. */
|
|
103
65
|
justify: AdwWrapBoxJustify;
|
|
104
|
-
/**
|
|
105
|
-
*
|
|
106
|
-
* `available_size`, adw-wrap-layout.c:336-341). CSS: `flex-grow` on the
|
|
107
|
-
* items.
|
|
108
|
-
*/
|
|
66
|
+
/** Whether the CHILDREN absorb the leftover (`allocated_size` grows to
|
|
67
|
+
* `available_size`). CSS: `flex-grow` on the items. */
|
|
109
68
|
growChildren: boolean;
|
|
110
|
-
/**
|
|
111
|
-
*
|
|
112
|
-
* are spread apart by `size_delta` (adw-wrap-layout.c:338-339, :752-757).
|
|
113
|
-
* CSS: `justify-content: space-between`.
|
|
114
|
-
*/
|
|
69
|
+
/** Whether the GAPS absorb it instead — children keep `minimum_size` and are spread by
|
|
70
|
+
* `size_delta`. CSS: `justify-content: space-between`. */
|
|
115
71
|
growGaps: boolean;
|
|
116
|
-
/**
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
* (
|
|
120
|
-
* axis, 1 at its end. Meaningless — and reported as 0 — as soon as the line
|
|
121
|
-
* is justified, because C only computes `length_delta` inside
|
|
122
|
-
* `if (!justify_line)`.
|
|
123
|
-
*/
|
|
72
|
+
/** The MAIN-axis offset factor applied to the whole line block when nothing grows:
|
|
73
|
+
* `widget_offset += roundf (length_delta * align)`, 0 = line start, 1 = line end.
|
|
74
|
+
* Reported as 0 once the line is justified, because C computes `length_delta` only
|
|
75
|
+
* inside `if (!justify_line)`. */
|
|
124
76
|
align: number;
|
|
125
77
|
}
|
|
126
78
|
/**
|
|
127
79
|
* The line-layout decision, straight from the C.
|
|
128
80
|
*
|
|
129
|
-
* `lastLine` is the FINAL line, complete or not (`i == *n_lines - 1
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
81
|
+
* `lastLine` is the FINAL line, complete or not (`i == *n_lines - 1`), so a wrap box whose
|
|
82
|
+
* children all fit on one line has that line governed by `justify-last-line` rather than
|
|
83
|
+
* by `justify` — which makes the single-line case, the common one, the counter-intuitive
|
|
84
|
+
* one.
|
|
133
85
|
*
|
|
134
|
-
* `spread` with exactly ONE child in the line does not spread anything:
|
|
135
|
-
*
|
|
136
|
-
* lone child is STRETCHED instead, which the property documentation states
|
|
137
|
-
* outright (adw-wrap-box.c:349-352).
|
|
86
|
+
* `spread` with exactly ONE child in the line does not spread anything: `n_children > 1`
|
|
87
|
+
* guards the branch that keeps children at `minimum_size`, so a lone child is STRETCHED.
|
|
138
88
|
*
|
|
139
|
-
* Held to `WRAP_BOX_LINE_VECTORS` in `@gjsify/adwaita-core/conformance
|
|
140
|
-
* both renderer suites drive their real widgets with.
|
|
89
|
+
* Held to `WRAP_BOX_LINE_VECTORS` in `@gjsify/adwaita-core/conformance`.
|
|
141
90
|
*/
|
|
142
91
|
export declare function resolveWrapBoxLine(input: {
|
|
143
92
|
justify: AdwWrapBoxJustify;
|
|
@@ -148,24 +97,19 @@ export declare function resolveWrapBoxLine(input: {
|
|
|
148
97
|
}): WrapBoxLineLayout;
|
|
149
98
|
/**
|
|
150
99
|
* `wrap-policy` as the child `flex-shrink` both flex-based renderers express it
|
|
151
|
-
* with.
|
|
152
|
-
*
|
|
153
|
-
* `ADW_WRAP_NATURAL` wraps "as soon as the previous line cannot fit any more
|
|
100
|
+
* with. `ADW_WRAP_NATURAL` wraps "as soon as the previous line cannot fit any more
|
|
154
101
|
* children without shrinking them past their natural size"; `ADW_WRAP_MINIMUM`
|
|
155
|
-
* "shrink[s] them down to their minimum size before wrapping"
|
|
156
|
-
* (adw-wrap-box.c:476-489).
|
|
102
|
+
* "shrink[s] them down to their minimum size before wrapping".
|
|
157
103
|
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
* lets them spill, and that half is faithful.
|
|
104
|
+
* NOT a full mapping, and the limit matters: flexbox breaks lines on the items'
|
|
105
|
+
* HYPOTHETICAL main sizes and `flex-shrink` only distributes negative free space WITHIN an
|
|
106
|
+
* already-broken line, so no value of it packs more children per line — which is what
|
|
107
|
+
* `minimum` is for. It does faithfully decide whether an overflowing line squeezes its
|
|
108
|
+
* children or lets them spill.
|
|
164
109
|
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
* on every wrap box, silently.
|
|
110
|
+
* Deriving it is still worth it for the DEFAULT: CSS defaults `flex-shrink` to 1
|
|
111
|
+
* (= `minimum`) where libadwaita defaults `wrap-policy` to `natural`, so a renderer with
|
|
112
|
+
* no policy silently draws the one Adwaita does not choose.
|
|
169
113
|
*/
|
|
170
114
|
export declare function wrapPolicyFlexShrink(policy: AdwWrapPolicy): number;
|
|
171
115
|
/** Which child-list operation is being resolved. */
|
|
@@ -173,20 +117,15 @@ export type WrapBoxChildOrderOp = 'insert-after' | 'reorder-after';
|
|
|
173
117
|
/**
|
|
174
118
|
* Where `adw_wrap_box_insert_child_after` / `reorder_child_after` put a child.
|
|
175
119
|
*
|
|
176
|
-
* Both delegate to `gtk_widget_insert_after (child, self, sibling)
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
* last. Reading it as "append" is the obvious misreading, and it is silent —
|
|
180
|
-
* the child lands somewhere plausible.
|
|
181
|
-
*
|
|
182
|
-
* The guards are the C's `g_return_if_fail`s, expressed as a refusal rather than
|
|
183
|
-
* a throw because a renderer has no `g_critical` to fall through to: an insert
|
|
184
|
-
* demands the child be UNPARENTED and the sibling be a child of this box, a
|
|
185
|
-
* reorder demands the child already be one, and `child === sibling` is an
|
|
186
|
-
* explicit early return in both.
|
|
120
|
+
* Both delegate to `gtk_widget_insert_after (child, self, sibling)`, whose rule is
|
|
121
|
+
* counter-intuitive: a NULL sibling inserts at the FIRST position, not the last. Reading
|
|
122
|
+
* it as "append" fails silently — the child lands somewhere plausible.
|
|
187
123
|
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
124
|
+
* MODIFICATION: the C's `g_return_if_fail`s become a refusal (`null`) rather than a throw,
|
|
125
|
+
* because a renderer has no `g_critical` to fall through to; the caller then leaves its
|
|
126
|
+
* view tree untouched, as C does. Insert demands an UNPARENTED child and a sibling of this
|
|
127
|
+
* box, reorder demands the child already be one, and `child === sibling` returns early in
|
|
128
|
+
* both.
|
|
190
129
|
*/
|
|
191
130
|
export declare function resolveWrapBoxChildOrder<T>(input: {
|
|
192
131
|
/** The box's children, in order. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/adwaita-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.0",
|
|
4
4
|
"description": "Headless Adwaita widget behavior (breakpoint condition grammar + apply/unapply state machine, color-scheme observable, avatar derivation) shared by the web and NativeScript Adwaita renderers — pure TS, no platform imports",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"headless"
|
|
47
47
|
],
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@gjsify/cli": "^0.
|
|
50
|
-
"@gjsify/unit": "^0.
|
|
49
|
+
"@gjsify/cli": "^0.38.0",
|
|
50
|
+
"@gjsify/unit": "^0.38.0",
|
|
51
51
|
"@types/node": "^25.9.2",
|
|
52
52
|
"typescript": "^6.0.3"
|
|
53
53
|
},
|