@gjsify/adwaita-web 0.52.0 → 0.53.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.
@@ -22,7 +22,17 @@ export interface ApplyAccentOptions {
22
22
  * `prefers-color-scheme` only decides when neither is present.
23
23
  */
24
24
  export declare function isAdwaitaDark(element: HTMLElement): boolean;
25
- /** Set the accent custom properties for `name`. */
25
+ /** Whether the app has chosen `target`'s accent with {@link applyAdwaitaAccent}. */
26
+ export declare function hasAppChosenAccent(target: HTMLElement): boolean;
27
+ /** Write the two properties — the one place they are set, for the app's choice and the follower's alike. */
28
+ export declare function writeAdwaitaAccent(name: AdwAccentColorName, target: HTMLElement, dark: boolean): void;
29
+ /**
30
+ * Set the accent custom properties for `name` — the app's own choice, which
31
+ * from now on wins over the desktop's appearance on this element.
32
+ */
26
33
  export declare function applyAdwaitaAccent(name: AdwAccentColorName, options?: ApplyAccentOptions): void;
27
- /** Drop the properties, so the stylesheet's own values apply again. */
34
+ /**
35
+ * Drop the properties, so the stylesheet's own values apply again, and hand
36
+ * the element back to the desktop's appearance.
37
+ */
28
38
  export declare function clearAdwaitaAccent(target?: HTMLElement): void;
@@ -0,0 +1,2 @@
1
+ import '@gjsify/adwaita-web';
2
+ export declare const AdwAppearanceTest: () => Promise<void>;
@@ -0,0 +1,41 @@
1
+ import { type AdwAccentColorName } from '@gjsify/adwaita-core';
2
+ /** Which source the root's accent currently comes from. */
3
+ export type AdwAccentSource = 'app' | 'handoff' | 'system' | 'default';
4
+ /**
5
+ * The browser's CSS system colour `AccentColor`, snapped to the nearest of the
6
+ * nine — or `null` where the engine does not support the keyword or the
7
+ * resolved colour cannot be read.
8
+ *
9
+ * SUPPORT IS UNEVEN AND NOT ASSUMED: Chrome announced shipping `AccentColor`
10
+ * only in 2026, and what Firefox resolves it to on Linux is not established;
11
+ * Firefox 156 on macOS resolves it to `rgb(0, 122, 255)`. An engine may also
12
+ * report a fixed default instead of the real accent (fingerprinting
13
+ * protection), which a page cannot detect.
14
+ */
15
+ export declare function readSystemAccent(): {
16
+ accent: AdwAccentColorName;
17
+ accentRgb: string;
18
+ } | null;
19
+ /** The source the root's accent comes from right now. */
20
+ export declare function adwaitaAccentSource(): AdwAccentSource;
21
+ /**
22
+ * Start following: read the handoff tags, and re-apply when they change, when
23
+ * the colour scheme flips (the standalone accent differs between light and
24
+ * dark) and when the page regains focus (`AccentColor` changes with no event).
25
+ * Idempotent; `@gjsify/adwaita-web` calls it on import in a browser.
26
+ */
27
+ export declare function followDesktopAppearance(): void;
28
+ /**
29
+ * Follow the CSS system colour `AccentColor` (#1821); `false` stops following
30
+ * it. A server handoff and the app's own choice still win; where the engine
31
+ * cannot resolve `AccentColor` the page keeps Adwaita blue. Returns the accent
32
+ * the system colour snapped to, or `null` (always when disabling).
33
+ */
34
+ export declare function applySystemAccent(enabled?: boolean): AdwAccentColorName | null;
35
+ /**
36
+ * Apply a desktop appearance handed over at runtime — the JSON a gjsify server
37
+ * sends when the desktop changes (over SSE, a WebSocket, a message port). The
38
+ * value is validated, so an untrusted payload is safe to pass straight in; it
39
+ * REPLACES the previous handoff, including one from the `<meta>` tags.
40
+ */
41
+ export declare function applyDesktopAppearance(appearance: unknown): void;
@@ -0,0 +1,2 @@
1
+ import '@gjsify/adwaita-web';
2
+ export declare const AdwFontStackTest: () => Promise<void>;
@@ -1,6 +1,8 @@
1
1
  export { addBreakpoints, bindBreakpointSetter } from './breakpoints.js';
2
2
  export { ACCENT_BG_PROPERTY, ACCENT_PROPERTY, applyAdwaitaAccent, clearAdwaitaAccent, isAdwaitaDark, } from './accent.js';
3
3
  export type { ApplyAccentOptions } from './accent.js';
4
+ export { adwaitaAccentSource, applyDesktopAppearance, applySystemAccent, followDesktopAppearance, readSystemAccent, } from './appearance.js';
5
+ export type { AdwAccentSource } from './appearance.js';
4
6
  export { AdwScrollShading } from './scroll-shading.js';
5
7
  export type { AdwUndershootEdges } from './scroll-shading.js';
6
8
  export { buildSharedTree, mountSharedTree } from './shared-tree-builder.js';