@gryt/ui 0.8.0 → 0.9.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/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1142 -941
- package/dist/index.js.map +1 -1
- package/dist/theme/theme.d.ts +51 -0
- package/dist/theme/theme.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { GrytThemeOptions } from './createGrytTheme.js';
|
|
2
|
+
export type GrytAppearance = "dark" | "light";
|
|
3
|
+
export declare const GRYT_HUE_KEYS: readonly ["accent", "accentLight", "secondary", "secondaryLight", "success", "danger", "dangerLight", "warning", "onAccent", "onSecondary", "onDanger"];
|
|
4
|
+
export declare const GRYT_NEUTRAL_KEYS: readonly ["bg", "surface", "surfaceRaised", "surfaceHover", "border", "muted", "text"];
|
|
5
|
+
export declare const GRYT_RADIUS_KEYS: readonly ["sm", "md", "lg", "xl", "full"];
|
|
6
|
+
export type GrytHueKey = (typeof GRYT_HUE_KEYS)[number];
|
|
7
|
+
export type GrytNeutralKey = (typeof GRYT_NEUTRAL_KEYS)[number];
|
|
8
|
+
export type GrytRadiusKey = (typeof GRYT_RADIUS_KEYS)[number];
|
|
9
|
+
export type GrytHues = Record<GrytHueKey, string>;
|
|
10
|
+
export type GrytNeutrals = Record<GrytNeutralKey, string>;
|
|
11
|
+
export interface GrytTheme {
|
|
12
|
+
hue: GrytHues;
|
|
13
|
+
/** Null when light borrows the hues above, which is the usual case. */
|
|
14
|
+
lightHue: GrytHues | null;
|
|
15
|
+
dark: GrytNeutrals;
|
|
16
|
+
light: GrytNeutrals;
|
|
17
|
+
radius: Record<GrytRadiusKey, number>;
|
|
18
|
+
}
|
|
19
|
+
/** What the library ships, as a document. */
|
|
20
|
+
export declare const grytTheme: GrytTheme;
|
|
21
|
+
export declare function cloneGrytTheme(theme: GrytTheme): GrytTheme;
|
|
22
|
+
/** Which hues this appearance reads. */
|
|
23
|
+
export declare function grytThemeHues(theme: GrytTheme, appearance: GrytAppearance): GrytHues;
|
|
24
|
+
/** One appearance of a theme, in the shape createGrytTheme takes. */
|
|
25
|
+
export declare function grytThemeToOptions(theme: GrytTheme, appearance: GrytAppearance): GrytThemeOptions;
|
|
26
|
+
export declare function isHexColor(value: string): boolean;
|
|
27
|
+
/** #abc to #aabbcc, lower case, so two of the same colour compare equal. */
|
|
28
|
+
export declare function normalizeHexColor(value: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* The theme as query parameters, carrying only what differs from Gryt's own.
|
|
31
|
+
*
|
|
32
|
+
* `appearance` is which half the sender was looking at, and it rides along
|
|
33
|
+
* because a shared link that opens on the other one is showing something the
|
|
34
|
+
* sender never saw.
|
|
35
|
+
*/
|
|
36
|
+
export declare function encodeGrytTheme(theme: GrytTheme, appearance?: GrytAppearance): URLSearchParams;
|
|
37
|
+
export interface DecodedGrytTheme {
|
|
38
|
+
theme: GrytTheme;
|
|
39
|
+
/** Which half the link was sent from. Dark unless it says otherwise. */
|
|
40
|
+
appearance: GrytAppearance;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Whatever somebody pasted.
|
|
44
|
+
*
|
|
45
|
+
* A whole URL, a bare query string, or the JSON form — one function, because
|
|
46
|
+
* from the outside they are the same act. Null when there is no theme in it at
|
|
47
|
+
* all; a value it cannot parse is left at Gryt's, so one mistyped colour does
|
|
48
|
+
* not throw the rest away.
|
|
49
|
+
*/
|
|
50
|
+
export declare function decodeGrytTheme(input: string): DecodedGrytTheme | null;
|
|
51
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/theme/theme.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,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