@gjsify/adwaita-core 0.41.0 → 0.42.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/breakpoint.js +1 -1
- package/lib/types/breakpoint.d.ts +11 -1
- package/lib/types/conformance/about-dialog.d.ts +27 -6
- package/lib/types/conformance/chrome.d.ts +4 -0
- package/lib/types/conformance/spinner.d.ts +5 -2
- package/lib/types/conformance/split-view.d.ts +15 -3
- package/lib/types/conformance/tab-view.d.ts +1 -1
- package/package.json +3 -3
package/lib/esm/breakpoint.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./_virtual/_rolldown/runtime.js";const e=/^(min|max)-(width|height)\s*:\s*(\d+(?:\.\d+)?)\s*(px|sp|pt)?$/i;function isLeaf(e){return e.op===void 0}function splitOn(e,t){let n=0;for(let r=e.length-1;r>=0;r--){let i=e[r];if(i===`)`)n++;else if(i===`(`)n--;else if(n===0){let n=r-t.length+1;if(n>0&&r+1<e.length&&/\s/.test(e[n-1])&&/\s/.test(e[r+1])&&e.slice(n,r+1).toLowerCase()===t)return{left:e.slice(0,n),right:e.slice(r+1)}}}return null}function splitTopLevel(e){for(let t of[`or`,`and`]){let n=splitOn(e,t);if(n)return{op:t,...n}}return null}function parseBreakpointCondition(t){let n=t.trim();if(!n)return null;let r=splitTopLevel(n);if(r){let e=parseBreakpointCondition(r.left),t=parseBreakpointCondition(r.right);return!e||!t?null:{op:r.op,left:e,right:t}}if(n.startsWith(`(`)&&n.endsWith(`)`))return parseBreakpointCondition(n.slice(1,-1));let i=e.exec(n);return i?{bound:i[1].toLowerCase(),dimension:i[2].toLowerCase(),value:Number.parseFloat(i[3])}:null}function evaluateBreakpointCondition(e,t){if(isLeaf(e)){let n=e.dimension===`width`?t.width:t.height;return e.bound===`max`?n<=e.value:n>=e.value}let n=evaluateBreakpointCondition(e.left,t);return e.op===`and`?n&&evaluateBreakpointCondition(e.right,t):n||evaluateBreakpointCondition(e.right,t)}var AdwBreakpoint=class{constructor(e,t){this._applied=!1,this.condition=typeof e==`string`?parseBreakpointCondition(e):e??null,this._handlers=t}get applied(){return this._applied}evaluate(e){let t=this.condition?evaluateBreakpointCondition(this.condition,e):!1;return t===this._applied?this._applied:(this._applied=t,t?this._handlers.onApply():this._handlers.onUnapply?.(),this._applied)}};export{AdwBreakpoint,evaluateBreakpointCondition,parseBreakpointCondition};
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";const e=/^(min|max)-(width|height)\s*:\s*(\d+(?:\.\d+)?)\s*(px|sp|pt)?$/i;function isLeaf(e){return e.op===void 0}function splitOn(e,t){let n=0;for(let r=e.length-1;r>=0;r--){let i=e[r];if(i===`)`)n++;else if(i===`(`)n--;else if(n===0){let n=r-t.length+1;if(n>0&&r+1<e.length&&/\s/.test(e[n-1])&&/\s/.test(e[r+1])&&e.slice(n,r+1).toLowerCase()===t)return{left:e.slice(0,n),right:e.slice(r+1)}}}return null}function splitTopLevel(e){for(let t of[`or`,`and`]){let n=splitOn(e,t);if(n)return{op:t,...n}}return null}function parseBreakpointCondition(t){let n=t.trim();if(!n)return null;let r=splitTopLevel(n);if(r){let e=parseBreakpointCondition(r.left),t=parseBreakpointCondition(r.right);return!e||!t?null:{op:r.op,left:e,right:t}}if(n.startsWith(`(`)&&n.endsWith(`)`))return parseBreakpointCondition(n.slice(1,-1));let i=e.exec(n);return i?{bound:i[1].toLowerCase(),dimension:i[2].toLowerCase(),value:Number.parseFloat(i[3])}:null}function evaluateBreakpointCondition(e,t){if(isLeaf(e)){let n=e.dimension===`width`?t.width:t.height;return e.bound===`max`?n<=e.value:n>=e.value}let n=evaluateBreakpointCondition(e.left,t);return e.op===`and`?n&&evaluateBreakpointCondition(e.right,t):n||evaluateBreakpointCondition(e.right,t)}var AdwBreakpoint=class{constructor(e,t,n=!1){this._applied=!1,this.condition=typeof e==`string`?parseBreakpointCondition(e):e??null,this._handlers=t,this._applied=n}get applied(){return this._applied}evaluate(e){let t=this.condition?evaluateBreakpointCondition(this.condition,e):!1;return t===this._applied?this._applied:(this._applied=t,t?this._handlers.onApply():this._handlers.onUnapply?.(),this._applied)}};export{AdwBreakpoint,evaluateBreakpointCondition,parseBreakpointCondition};
|
|
@@ -48,7 +48,17 @@ export declare class AdwBreakpoint {
|
|
|
48
48
|
readonly condition: BreakpointConditionNode | null;
|
|
49
49
|
private _handlers;
|
|
50
50
|
private _applied;
|
|
51
|
-
|
|
51
|
+
/**
|
|
52
|
+
* `applied` is the state this breakpoint INHERITS — the one a breakpoint it replaces
|
|
53
|
+
* had reached. It exists because {@link evaluate} fires on a TRANSITION only: a
|
|
54
|
+
* renderer that has to rebuild the object (a browser element rebinding its
|
|
55
|
+
* ResizeObserver after a re-parent) otherwise restarts at `false`, and a view the
|
|
56
|
+
* old breakpoint had collapsed, re-evaluated where the condition is FALSE, matches
|
|
57
|
+
* its own starting state and never hears `onUnapply`. Measured: a
|
|
58
|
+
* `<adw-navigation-split-view>` moved 800px → 500px → 900px stayed collapsed at
|
|
59
|
+
* 900px, and only a narrow→wide cycle IN PLACE healed it.
|
|
60
|
+
*/
|
|
61
|
+
constructor(condition: string | BreakpointConditionNode | null, handlers: AdwBreakpointHandlers, applied?: boolean);
|
|
52
62
|
/** Whether the condition is currently satisfied (apply has fired, not unapply). */
|
|
53
63
|
get applied(): boolean;
|
|
54
64
|
/**
|
|
@@ -38,7 +38,12 @@ export interface TranslatorCreditsVector {
|
|
|
38
38
|
* and no section is drawn, where JS `''.split('\n')` is `['']` and
|
|
39
39
|
* draws the section with one blank row.
|
|
40
40
|
*
|
|
41
|
-
* CORE-ONLY:
|
|
41
|
+
* CORE-ONLY: GAP — `adw-about-dialog` has no `translator-credits` property, and the browser
|
|
42
|
+
* spec skips every row that sets one (`if (input.translatorCredits !== undefined) continue`, in
|
|
43
|
+
* adw-about-dialog.spec.ts). So the empty-string row above — the one this docblock singles out
|
|
44
|
+
* as what a port gets wrong — reaches nothing outside the core suite. It was exempted here as an
|
|
45
|
+
* internal step of ABOUT_DIALOG_CREDITS_LEGAL_VECTORS, a three-boolean visibility table with no
|
|
46
|
+
* translator input at all. Tracked in #1072
|
|
42
47
|
*/
|
|
43
48
|
export declare const TRANSLATOR_CREDITS_VECTORS: ReadonlyArray<TranslatorCreditsVector>;
|
|
44
49
|
/** One assembled credits-page expectation. */
|
|
@@ -190,7 +195,11 @@ export interface AboutDialogLabelVector {
|
|
|
190
195
|
* page "About <app>" AND labelling the dialog "About <app>" says the app's name
|
|
191
196
|
* three times on one screen.
|
|
192
197
|
*
|
|
193
|
-
* CORE-ONLY:
|
|
198
|
+
* CORE-ONLY: GAP — the renderers read these strings THROUGH `ADW_ABOUT_DIALOG_LABELS`, so a
|
|
199
|
+
* spec reading them back would be circular with respect to the `.ui` fidelity this table exists
|
|
200
|
+
* to pin. ABOUT_DIALOG_HEADER/DETAILS_VECTORS are about icon and name visibility and row
|
|
201
|
+
* presence, never the label text, and `whatsNewRow` — the U+2019 row above — is filtered out of
|
|
202
|
+
* the browser spec. Tracked in #1072
|
|
194
203
|
*/
|
|
195
204
|
export declare const ABOUT_DIALOG_LABEL_VECTORS: ReadonlyArray<AboutDialogLabelVector>;
|
|
196
205
|
/** One `gtk_license_info` row expectation. */
|
|
@@ -211,7 +220,12 @@ export interface LicenseInfoVector {
|
|
|
211
220
|
* - 1 == GTK_LICENSE_0BSD)` is the C's own drift check; this is that
|
|
212
221
|
* assertion, ported.
|
|
213
222
|
*
|
|
214
|
-
* CORE-ONLY:
|
|
223
|
+
* CORE-ONLY: GAP — `adw-about-dialog` has no `license-type` property. It derives the type as
|
|
224
|
+
* CUSTOM or UNKNOWN from whether `license` is empty (elements/adw-about-dialog.ts), and nothing
|
|
225
|
+
* on either side reads an `spdxId` or a `url`, so rows 2, 7 and 18 reach no renderer; the
|
|
226
|
+
* NativeScript bridge ships the widget without a spec. It was exempted here as an internal step
|
|
227
|
+
* of ABOUT_DIALOG_CREDITS_LEGAL_VECTORS, a three-boolean visibility table whose only licence
|
|
228
|
+
* input is `hasLegal`. Tracked in #1072
|
|
215
229
|
*/
|
|
216
230
|
export declare const LICENSE_INFO_VECTORS: ReadonlyArray<LicenseInfoVector>;
|
|
217
231
|
/** One SPDX-id lookup expectation. */
|
|
@@ -225,7 +239,8 @@ export interface LicenseSpdxVector {
|
|
|
225
239
|
/**
|
|
226
240
|
* The two lookup loops in `populate_from_appdata`.
|
|
227
241
|
*
|
|
228
|
-
* CORE-ONLY:
|
|
242
|
+
* CORE-ONLY: GAP — both lookups run inside `populate_from_appdata`, and neither renderer has an
|
|
243
|
+
* appdata path to route an SPDX id through. Tracked in #1072
|
|
229
244
|
*/
|
|
230
245
|
export declare const LICENSE_SPDX_VECTORS: ReadonlyArray<LicenseSpdxVector>;
|
|
231
246
|
/** One `get_license_text` expectation. */
|
|
@@ -239,7 +254,10 @@ export interface LicenseTextVector {
|
|
|
239
254
|
/**
|
|
240
255
|
* `get_license_text`.
|
|
241
256
|
*
|
|
242
|
-
* CORE-ONLY:
|
|
257
|
+
* CORE-ONLY: GAP — `getLicenseText` is called by no renderer. The browser element writes
|
|
258
|
+
* `this.license` straight into the Legal page and never builds the stock preamble with its URL
|
|
259
|
+
* and Pango markup, so the rows for types 7 and 18 reach nothing outside the core suite.
|
|
260
|
+
* Tracked in #1072
|
|
243
261
|
*/
|
|
244
262
|
export declare const LICENSE_TEXT_VECTORS: ReadonlyArray<LicenseTextVector>;
|
|
245
263
|
/** One licence-setter step. */
|
|
@@ -267,7 +285,10 @@ export interface LicenseSetterVector {
|
|
|
267
285
|
* licence-type change DOES switch the type, while assigning `""` to an already
|
|
268
286
|
* empty licence does not.
|
|
269
287
|
*
|
|
270
|
-
* CORE-ONLY: a property-ordering table with no rendered surface — the RESULT is
|
|
288
|
+
* CORE-ONLY: a property-ordering table with no rendered surface — the RESULT is
|
|
289
|
+
* ABOUT_DIALOG_CREDITS_LEGAL_VECTORS, driven by the browser suite. ONE renderer, not two: the
|
|
290
|
+
* NativeScript bridge ships an `adw-about-dialog` widget and no spec for it, so nothing on that
|
|
291
|
+
* side is held to ANY about-dialog vector.
|
|
271
292
|
*/
|
|
272
293
|
export declare const LICENSE_SETTER_VECTORS: ReadonlyArray<LicenseSetterVector>;
|
|
273
294
|
/** One Legal-page visibility expectation. */
|
|
@@ -15,6 +15,8 @@ export interface ClampThresholdsVector {
|
|
|
15
15
|
* `lower`/`max`/`upper`.
|
|
16
16
|
*
|
|
17
17
|
* CORE-ONLY: an internal step of a pipeline whose COMPOSED result is renderer-driven — driving it separately would assert the same thing twice (CLAMP_ALLOCATE_VECTORS)
|
|
18
|
+
* Not for every row: both renderer suites filter that table to `params.childMin === 0`, so the
|
|
19
|
+
* three rows below that set a child minimum are asserted here alone. Tracked in #1072
|
|
18
20
|
*/
|
|
19
21
|
export declare const CLAMP_THRESHOLD_VECTORS: ReadonlyArray<ClampThresholdsVector>;
|
|
20
22
|
/** One `clampChildSize` expectation. */
|
|
@@ -31,6 +33,8 @@ export interface ClampChildSizeVector {
|
|
|
31
33
|
* `child_size_from_clamp`.
|
|
32
34
|
*
|
|
33
35
|
* CORE-ONLY: an internal step of a pipeline whose COMPOSED result is renderer-driven — driving it separately would assert the same thing twice (CLAMP_ALLOCATE_VECTORS)
|
|
36
|
+
* Not for every row: one row below sets `childMin: 150`, and both renderer suites filter that
|
|
37
|
+
* table to `params.childMin === 0`, so that row is asserted here alone. Tracked in #1072
|
|
34
38
|
*/
|
|
35
39
|
export declare const CLAMP_CHILD_SIZE_VECTORS: ReadonlyArray<ClampChildSizeVector>;
|
|
36
40
|
/** One `clampSizeFromChild` expectation. */
|
|
@@ -35,8 +35,11 @@ export interface SpinnerArcShapeVector {
|
|
|
35
35
|
/**
|
|
36
36
|
* The moments worth naming in one arc cycle.
|
|
37
37
|
*
|
|
38
|
-
* CORE-ONLY: the arc is drawn per frame from `spinnerArc` and a renderer can only show
|
|
39
|
-
*
|
|
38
|
+
* CORE-ONLY: GAP — the arc is drawn per frame from `spinnerArc` and a renderer can only show the
|
|
39
|
+
* RESULT. What the browser suite checks is the round caps, and that the arc BREATHES at all
|
|
40
|
+
* (`spread > 0`, whose discriminator is the constant 90° chase this element used to draw). The
|
|
41
|
+
* envelope these rows pin — never outside [MIN_ARC_LENGTH, MAX_ARC_LENGTH] — is checked by no
|
|
42
|
+
* renderer. Tracked in #1072
|
|
40
43
|
*/
|
|
41
44
|
export declare const SPINNER_ARC_PHASE_VECTORS: ReadonlyArray<SpinnerArcShapeVector>;
|
|
42
45
|
/** One "is this constant what the C says" expectation. */
|
|
@@ -12,7 +12,11 @@ export interface AdwLengthUnitVector {
|
|
|
12
12
|
/**
|
|
13
13
|
* `adw_length_unit_to_px`.
|
|
14
14
|
*
|
|
15
|
-
* CORE-ONLY: an internal step of a pipeline whose COMPOSED result is renderer-driven — driving it
|
|
15
|
+
* CORE-ONLY: an internal step of a pipeline whose COMPOSED result is renderer-driven — driving it
|
|
16
|
+
* separately would assert the same thing twice (SIDEBAR_BOUNDS_VECTORS, driven by the browser suite).
|
|
17
|
+
* ONE renderer, not two: NativeScript drives SIDEBAR_WIDTH_VECTORS instead, and works in DIPs, so
|
|
18
|
+
* `split-view-width.spec.ts` skips every row that sets a unit or a dpi — no NativeScript surface
|
|
19
|
+
* reaches this conversion at all.
|
|
16
20
|
*/
|
|
17
21
|
export declare const ADW_LENGTH_UNIT_VECTORS: ReadonlyArray<AdwLengthUnitVector>;
|
|
18
22
|
/** One `glibClamp` expectation. */
|
|
@@ -30,7 +34,11 @@ export interface GlibClampVector {
|
|
|
30
34
|
* `high` there, and `allocate_uncollapsed` reaches inverted bounds whenever the
|
|
31
35
|
* content pane's own minimum leaves less room than `min-sidebar-width`.
|
|
32
36
|
*
|
|
33
|
-
* CORE-ONLY: GLib’s CLAMP itself
|
|
37
|
+
* CORE-ONLY: GLib’s CLAMP itself, a primitive with no widget surface. What separates it from
|
|
38
|
+
* `Math.min`/`Math.max` is the inverted rows, and those ARE driven — `resolveNavigationSidebarWidth`
|
|
39
|
+
* inverts the bounds at 300px total width, which is a row of SIDEBAR_WIDTH_VECTORS.
|
|
40
|
+
* Its other reachers, `toolbarViewAllocate` and `carouselClampPosition`, do not reach a driven table;
|
|
41
|
+
* the earlier wording here claimed every reacher did, which was false in two places.
|
|
34
42
|
*/
|
|
35
43
|
export declare const GLIB_CLAMP_VECTORS: ReadonlyArray<GlibClampVector>;
|
|
36
44
|
/** One `resolveSidebarBounds` expectation. */
|
|
@@ -106,7 +114,11 @@ export interface SplitViewMeasureVector {
|
|
|
106
114
|
* Without this container minimum the content pane shrinks to nothing instead of the window
|
|
107
115
|
* refusing to get narrower.
|
|
108
116
|
*
|
|
109
|
-
* CORE-ONLY: the container minimum lands as `min-width: min-content` on the content pane,
|
|
117
|
+
* CORE-ONLY: GAP — the container minimum lands as `min-width: min-content` on the content pane,
|
|
118
|
+
* CSS’s own spelling of the same rule, so there is no computed number of ours for a renderer to
|
|
119
|
+
* compare against. What the browser suite checks is the weaker property that the pane is not
|
|
120
|
+
* crushable (`getComputedStyle(content).minWidth !== '0px'`, split-views.spec.ts); the numbers in
|
|
121
|
+
* these rows reach no renderer. Tracked in #1072
|
|
110
122
|
*/
|
|
111
123
|
export declare const SPLIT_VIEW_MEASURE_VECTORS: ReadonlyArray<SplitViewMeasureVector>;
|
|
112
124
|
/** One `layoutNavigationSplitView` expectation. */
|
|
@@ -347,7 +347,7 @@ export interface TabTooltipVector {
|
|
|
347
347
|
* browser sets `tab.title = tabTooltip(page)` (`elements/adw-tab-view.ts`),
|
|
348
348
|
* NativeScript re-exports it as `tabTooltipText` (`widgets/tab-view-state.ts`) —
|
|
349
349
|
* and neither is held to these rows. Both surfaces are readable from their own
|
|
350
|
-
* suites, so wiring them is a loop, not new capability.
|
|
350
|
+
* suites, so wiring them is a loop, not new capability. Tracked in #1072
|
|
351
351
|
*/
|
|
352
352
|
export declare const TAB_TOOLTIP_VECTORS: ReadonlyArray<TabTooltipVector>;
|
|
353
353
|
/** One `tabIconState` expectation. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/adwaita-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.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.42.0",
|
|
50
|
+
"@gjsify/unit": "^0.42.0",
|
|
51
51
|
"@types/node": "^25.9.2",
|
|
52
52
|
"typescript": "^6.0.3"
|
|
53
53
|
},
|