@gjsify/adwaita-web 0.37.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/dist/adwaita-web.css +71 -1
- package/dist/adwaita-web.css.map +1 -1
- package/lib/types/accent.d.ts +28 -0
- package/lib/types/adw-accent.spec.d.ts +2 -0
- package/lib/types/index.d.ts +2 -0
- package/lib/types/styles.generated.d.ts +1 -1
- package/package.json +18 -7
- package/scss/_theme.scss +20 -2
- package/scss/_variables.scss +9 -1
- package/src/accent.ts +74 -0
- package/src/adw-accent.spec.ts +105 -0
- package/src/index.ts +11 -0
- package/src/styles.generated.ts +1 -1
- package/src/test.browser.mts +2 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type AdwAccentColorName } from '@gjsify/adwaita-core';
|
|
2
|
+
/** The custom property carrying the accent fill. */
|
|
3
|
+
export declare const ACCENT_BG_PROPERTY = "--accent-bg-color";
|
|
4
|
+
/** The custom property carrying the standalone accent, for text on the window. */
|
|
5
|
+
export declare const ACCENT_PROPERTY = "--accent-color";
|
|
6
|
+
/** Where and how to apply the accent. */
|
|
7
|
+
export interface ApplyAccentOptions {
|
|
8
|
+
/** The element to set the properties on. Defaults to `document.documentElement`. */
|
|
9
|
+
readonly target?: HTMLElement;
|
|
10
|
+
/**
|
|
11
|
+
* Which standalone variant to use. Defaults to the target's RESOLVED scheme,
|
|
12
|
+
* because the standalone colour is the one thing about an accent that differs
|
|
13
|
+
* between light and dark — reading it beats assuming light.
|
|
14
|
+
*/
|
|
15
|
+
readonly dark?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Whether `element` is currently rendering dark.
|
|
19
|
+
*
|
|
20
|
+
* `.theme-dark` / `.theme-light` are the stylesheet's manual overrides and win
|
|
21
|
+
* over the media query, so an explicit class is checked first and
|
|
22
|
+
* `prefers-color-scheme` only decides when neither is present.
|
|
23
|
+
*/
|
|
24
|
+
export declare function isAdwaitaDark(element: HTMLElement): boolean;
|
|
25
|
+
/** Set the accent custom properties for `name`. */
|
|
26
|
+
export declare function applyAdwaitaAccent(name: AdwAccentColorName, options?: ApplyAccentOptions): void;
|
|
27
|
+
/** Drop the properties, so the stylesheet's own values apply again. */
|
|
28
|
+
export declare function clearAdwaitaAccent(target?: HTMLElement): void;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import '@gjsify/adwaita-fonts';
|
|
2
2
|
export { addBreakpoints, bindBreakpointSetter } from './breakpoints.js';
|
|
3
|
+
export { ACCENT_BG_PROPERTY, ACCENT_PROPERTY, applyAdwaitaAccent, clearAdwaitaAccent, isAdwaitaDark, } from './accent.js';
|
|
4
|
+
export type { ApplyAccentOptions } from './accent.js';
|
|
3
5
|
export { AdwAvatar } from './elements/adw-avatar.js';
|
|
4
6
|
export { AdwBanner } from './elements/adw-banner.js';
|
|
5
7
|
export { AdwCard } from './elements/adw-card.js';
|