@gjsify/adwaita-core 0.64.12-next.279 → 0.64.12-next.281

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.
@@ -16,8 +16,31 @@ export type AdwComboOptionInput = string | {
16
16
  };
17
17
  /** A normalised portable list model — what a `model` property holds on every surface. */
18
18
  export type AdwListModel = ReadonlyArray<AdwComboOption>;
19
- /** What a `model` property ACCEPTS: the widened form of {@link AdwListModel}. */
20
- export type AdwListModelInput = ReadonlyArray<AdwComboOptionInput>;
19
+ /**
20
+ * The two methods this module needs off a REAL model — `g_list_model_get_n_items` and
21
+ * `g_list_model_get_item`, nothing else.
22
+ *
23
+ * Duck-typed on purpose. This module is pure data and must not import `Gtk.StringList`, which
24
+ * is a GObject and would drag the whole object system into every surface that only wants to
25
+ * normalise items. `Gio.ListModel` IS these two methods, so matching them is matching the
26
+ * interface rather than guessing at a class.
27
+ */
28
+ export interface AdwListModelSource {
29
+ /** `g_list_model_get_n_items`. */
30
+ get_n_items(): number;
31
+ /** `g_list_model_get_item` — `null` past the end. */
32
+ get_item(position: number): unknown;
33
+ }
34
+ /**
35
+ * What a `model` property ACCEPTS: the widened form of {@link AdwListModel}, plus a real
36
+ * {@link AdwListModelSource}.
37
+ *
38
+ * The model arm is new in ADR 0122, which made `Gtk.StringList` a `Gio.ListModel` instead of
39
+ * an `Array` subclass — the one value that used to satisfy BOTH arms at once. It is not a
40
+ * permanent widening: ADR 0122 § 6 narrows `Adw.ComboRow:model` to `Gio.ListModel` alone, and
41
+ * the array arm goes with the widget that still reads a markup attribute.
42
+ */
43
+ export type AdwListModelInput = ReadonlyArray<AdwComboOptionInput> | AdwListModelSource;
21
44
  /**
22
45
  * Raw authored items → the stable `{ value, label }` descriptors every list surface
23
46
  * works with.
@@ -28,6 +51,11 @@ export type AdwListModelInput = ReadonlyArray<AdwComboOptionInput>;
28
51
  * by `undefined`. ONE home for the rule, so no two list widgets can accept two different
29
52
  * item vocabularies.
30
53
  *
54
+ * A REAL `Gio.ListModel` is read through {@link AdwListModelSource}, and its items through the
55
+ * same three rules as any other entry: a `Gtk.StringObject` arrives as the string it holds,
56
+ * anything else falls to the descriptor rule it already matches or does not. There is no
57
+ * fourth vocabulary for items that came out of a model rather than out of an array.
58
+ *
31
59
  * TOTAL — it throws for no input. The doors this reaches are a property assignment and a
32
60
  * markup attribute, and an author's typo must not take the widget down.
33
61
  */
@@ -0,0 +1,15 @@
1
+ export interface RGBAInit {
2
+ red: number;
3
+ green: number;
4
+ blue: number;
5
+ alpha: number;
6
+ }
7
+ export declare class RGBA {
8
+ red: number;
9
+ green: number;
10
+ blue: number;
11
+ alpha: number;
12
+ constructor(init?: Partial<RGBAInit>);
13
+ equal(other: RGBA): boolean;
14
+ to_string(): string;
15
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: () => Promise<void>;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: () => Promise<void>;
2
+ export default _default;
@@ -1,3 +1,5 @@
1
+ import { type AdwAccentColorName } from './accent.js';
2
+ import { RGBA } from './rgba.js';
1
3
  import { GIR_TYPE, GObjectObject } from './gobject.js';
2
4
  /** Where a platform reads "is the interface dark" and hears it change. */
3
5
  export interface StyleSource {
@@ -8,6 +10,10 @@ export interface StyleSource {
8
10
  force?(dark: boolean | null): void;
9
11
  /** Whether the platform reports a light/dark preference at all. Absent means it cannot. */
10
12
  supportsColorSchemes?(): boolean;
13
+ /** Whether the platform asks for more contrast. Absent means it cannot. */
14
+ highContrast?(): boolean;
15
+ /** The system accent, snapped to one of the nine; `null` (or absent) when the platform has none. */
16
+ accentColor?(): AdwAccentColorName | null;
11
17
  }
12
18
  /** `Adw.ColorScheme`, with the values of the GIR. */
13
19
  export declare const ColorScheme: {
@@ -17,6 +23,20 @@ export declare const ColorScheme: {
17
23
  readonly PREFER_DARK: 3;
18
24
  readonly FORCE_DARK: 4;
19
25
  };
26
+ /** `Adw.AccentColor`, with the values of the GIR, and its two functions. */
27
+ export declare const AccentColor: {
28
+ BLUE: number;
29
+ TEAL: number;
30
+ GREEN: number;
31
+ YELLOW: number;
32
+ ORANGE: number;
33
+ RED: number;
34
+ PINK: number;
35
+ PURPLE: number;
36
+ SLATE: number;
37
+ to_rgba: (accent: number) => RGBA;
38
+ to_standalone_rgba: (accent: number, dark: boolean) => RGBA;
39
+ };
20
40
  export declare class StyleManagerBase extends GObjectObject {
21
41
  static [GIR_TYPE]: string;
22
42
  static source: StyleSource | undefined;
@@ -25,6 +45,14 @@ export declare class StyleManagerBase extends GObjectObject {
25
45
  get_dark(): boolean;
26
46
  get system_supports_color_schemes(): boolean;
27
47
  get_system_supports_color_schemes(): boolean;
48
+ get high_contrast(): boolean;
49
+ get_high_contrast(): boolean;
50
+ get system_supports_accent_colors(): boolean;
51
+ get_system_supports_accent_colors(): boolean;
52
+ get accent_color(): number;
53
+ get_accent_color(): number;
54
+ get accent_color_rgba(): RGBA;
55
+ get_accent_color_rgba(): RGBA;
28
56
  get color_scheme(): number;
29
57
  set color_scheme(scheme: number);
30
58
  get_color_scheme(): number;
@@ -1,7 +1,10 @@
1
+ import { type PointNode } from './graphene.js';
1
2
  /** The slice of a DOM element these members read; core has no DOM lib. */
2
- interface WidgetNode {
3
+ interface WidgetNode extends PointNode {
3
4
  dir: string;
4
5
  readonly isConnected: boolean;
6
+ readonly offsetWidth: number;
7
+ readonly offsetHeight: number;
5
8
  removeAttribute(name: string): void;
6
9
  hasAttribute(name: string): boolean;
7
10
  toggleAttribute(name: string, force?: boolean): boolean;
@@ -30,6 +30,23 @@ export declare class WindowMemberState<TWidget> {
30
30
  /** The platform says which widget holds focus. Returns whether that was news. */
31
31
  reportFocus(next: TWidget | null): boolean;
32
32
  }
33
+ /** The `Gtk.Window` size properties, in the order GTK notifies them. */
34
+ export type DefaultSizeProperty = 'default-height' | 'default-width';
35
+ /** What `gtk_window_set_default_size` does with one call. */
36
+ export interface DefaultSizeStep {
37
+ readonly width: number;
38
+ readonly height: number;
39
+ /** The properties that moved, in notification order: height BEFORE width. */
40
+ readonly changed: readonly DefaultSizeProperty[];
41
+ }
42
+ /**
43
+ * `gtk_window_set_default_size` (gtkwindow.c:5030, `gtk_window_set_default_size_internal`): `-1`
44
+ * and `0` both mean "no size asked", anything below `-1` is a `g_return_if_fail` — a CRITICAL and no
45
+ * change — and a write that equals the held value does not notify. When both move, `default-height`
46
+ * notifies first. Answers `null` for a refused call, else the sizes to hold and what to notify; the
47
+ * port stores the sizes and fires the notifications.
48
+ */
49
+ export declare function stepDefaultSize(current: readonly [number, number], width: number, height: number): DefaultSizeStep | null;
33
50
  /**
34
51
  * `_gtk_boolean_handled_accumulator` for `close-request`: the first handler to return something
35
52
  * truthy has handled the signal and STOPS the emission — the remaining handlers and the class
@@ -106,6 +123,9 @@ export interface WindowCommon<TWidget = unknown> {
106
123
  is_maximized(): boolean;
107
124
  maximize(): void;
108
125
  unmaximize(): void;
126
+ /** `Gtk.Window:default-width` / `default-height`; `[0, 0]` until one is set. */
127
+ get_default_size(): [number, number];
128
+ set_default_size(width: number, height: number): void;
109
129
  present(): void;
110
130
  /**
111
131
  * `Gtk.Window:application`; writing it is `set_application`, which adds the window to the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/adwaita-core",
3
- "version": "0.64.12-next.279",
3
+ "version": "0.64.12-next.281",
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",
@@ -67,9 +67,9 @@
67
67
  "headless"
68
68
  ],
69
69
  "devDependencies": {
70
- "@gjsify/cli": "0.64.12-next.279",
70
+ "@gjsify/cli": "0.64.12-next.281",
71
71
  "@gjsify/node-gi": "file:../../../packages/node-gi/node-gi",
72
- "@gjsify/unit": "0.64.12-next.279",
72
+ "@gjsify/unit": "0.64.12-next.281",
73
73
  "@types/node": "^25.9.2",
74
74
  "typescript": "^6.0.3"
75
75
  },
@@ -93,5 +93,5 @@
93
93
  "url": "https://github.com/gjsify/gjsify/issues"
94
94
  },
95
95
  "homepage": "https://github.com/gjsify/gjsify/tree/main/packages/web/adwaita-core#readme",
96
- "gitHead": "e9026ad9f11b386102628e9e6fb93cb8b6cbd5ee"
96
+ "gitHead": "c4d2e266c0d9849860b9828c14ebfe37b6d493b8"
97
97
  }