@gryt/ui 0.21.1 → 0.23.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/components/Avatar/Avatar.d.ts +20 -0
- package/dist/components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/components/ThemeEditor/ColorField.d.ts +20 -0
- package/dist/components/ThemeEditor/ColorField.d.ts.map +1 -0
- package/dist/components/ThemeEditor/ContrastReport.d.ts +16 -0
- package/dist/components/ThemeEditor/ContrastReport.d.ts.map +1 -0
- package/dist/components/ThemeEditor/ScaleStrip.d.ts +15 -0
- package/dist/components/ThemeEditor/ScaleStrip.d.ts.map +1 -0
- package/dist/components/ThemeEditor/ThemeEditor.d.ts +23 -0
- package/dist/components/ThemeEditor/ThemeEditor.d.ts.map +1 -0
- package/dist/components/ThemeEditor/contrast.d.ts +21 -0
- package/dist/components/ThemeEditor/contrast.d.ts.map +1 -0
- package/dist/components/ThemeEditor/draft.d.ts +35 -0
- package/dist/components/ThemeEditor/draft.d.ts.map +1 -0
- package/dist/components/ThemeEditor/generate.d.ts +43 -0
- package/dist/components/ThemeEditor/generate.d.ts.map +1 -0
- package/dist/components/ThemeEditor/share.d.ts +17 -0
- package/dist/components/ThemeEditor/share.d.ts.map +1 -0
- package/dist/index.cjs +18 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1706 -909
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -3
|
@@ -19,6 +19,26 @@ export interface AvatarProps extends Omit<ComponentPropsWithoutRef<typeof BaseAv
|
|
|
19
19
|
* that rule exists to prevent.
|
|
20
20
|
*/
|
|
21
21
|
seed?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Draws this seed's eggs, from @gryt/owl.
|
|
24
|
+
*
|
|
25
|
+
* Named for the drawing rather than for what it stands for, because what it
|
|
26
|
+
* stands for has already changed once. These were written for server icons,
|
|
27
|
+
* and are now the generated image for a group chat that has not uploaded
|
|
28
|
+
* one; server icons are getting their own generator. A prop called
|
|
29
|
+
* `serverSeed` would have been wrong twice over — wrong for group chats, and
|
|
30
|
+
* squatting on the name the real server one will want.
|
|
31
|
+
*
|
|
32
|
+
* Separate from `seed` rather than a flag on it. `seed` draws a person's
|
|
33
|
+
* owl, and passing the wrong prop should give you the wrong kind of thing
|
|
34
|
+
* rather than the same thing in another colour.
|
|
35
|
+
*
|
|
36
|
+
* The corner is the caller's. This clips to whatever radius its className
|
|
37
|
+
* sets and the drawing is square, so asking for `rounded-(--gryt-radius-md)`
|
|
38
|
+
* gets the theme's radius in pixels rather than a fraction of the box baked
|
|
39
|
+
* into the SVG.
|
|
40
|
+
*/
|
|
41
|
+
eggSeed?: string;
|
|
22
42
|
fallback?: ReactNode;
|
|
23
43
|
}
|
|
24
44
|
export declare const Avatar: import('react').ForwardRefExoticComponent<AvatarProps & import('react').RefAttributes<HTMLSpanElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../src/components/Avatar/Avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAG7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGjE,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AActD,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../src/components/Avatar/Avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAG7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGjE,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AActD,MAAM,WAAW,WAAY,SAAQ,IAAI,CACvC,wBAAwB,CAAC,OAAO,UAAU,CAAC,IAAI,CAAC,EAChD,WAAW,CACZ;IACC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;;;;;;;;;;;;;OAkBG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAGjB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,eAAO,MAAM,MAAM,yGAyEjB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface ColorFieldProps {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string;
|
|
4
|
+
onChange: (value: string) => void;
|
|
5
|
+
/** Set when a contrast check blames this colour. */
|
|
6
|
+
warning?: string;
|
|
7
|
+
/** Shown but not editable, for values something else is computing. */
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* One anchor: the swatch, and the hex beside it.
|
|
12
|
+
*
|
|
13
|
+
* Two controls for one value, because they are good at different things. The
|
|
14
|
+
* native picker is how you find a colour you cannot name; the text box is how
|
|
15
|
+
* you paste the one your brand already has. The text box only commits when what
|
|
16
|
+
* is in it parses, so typing "#1a" halfway through does not repaint the page
|
|
17
|
+
* with black.
|
|
18
|
+
*/
|
|
19
|
+
export declare function ColorField({ label, value, onChange, warning, disabled }: ColorFieldProps): import("react").JSX.Element;
|
|
20
|
+
//# sourceMappingURL=ColorField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorField.d.ts","sourceRoot":"","sources":["../../../src/components/ThemeEditor/ColorField.tsx"],"names":[],"mappings":"AAKA,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,oDAAoD;IACpD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,KAAK,EACL,QAAQ,EACR,OAAO,EACP,QAAgB,EACjB,EAAE,eAAe,+BAsDjB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ContrastCheck } from './contrast.js';
|
|
2
|
+
export interface ContrastReportProps {
|
|
3
|
+
checks: ContrastCheck[];
|
|
4
|
+
/** Absent when nothing is failing. */
|
|
5
|
+
onRepair?: () => void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* What the library's own tests would say about this theme.
|
|
9
|
+
*
|
|
10
|
+
* Ratios rather than a verdict, because "3.9 against 4.5" tells somebody how
|
|
11
|
+
* far off they are and "fails" does not. The repair only moves the colours
|
|
12
|
+
* whose job is to be read — it will not quietly redesign an accent somebody
|
|
13
|
+
* chose on purpose.
|
|
14
|
+
*/
|
|
15
|
+
export declare function ContrastReport({ checks, onRepair }: ContrastReportProps): import("react").JSX.Element;
|
|
16
|
+
//# sourceMappingURL=ContrastReport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContrastReport.d.ts","sourceRoot":"","sources":["../../../src/components/ThemeEditor/ContrastReport.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAcD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,mBAAmB,+BA8DvE"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The twelve steps a family generated, under the anchors that generated them.
|
|
3
|
+
*
|
|
4
|
+
* This is the part that makes the page worth building rather than describing.
|
|
5
|
+
* Changing one hex value moves a whole ramp — component backgrounds, hover
|
|
6
|
+
* states, borders, the text step — and seeing that happen is the difference
|
|
7
|
+
* between "it takes a colour" and "it takes a colour and knows what to do with
|
|
8
|
+
* it".
|
|
9
|
+
*/
|
|
10
|
+
export interface ScaleStripProps {
|
|
11
|
+
label: string;
|
|
12
|
+
steps: string[];
|
|
13
|
+
}
|
|
14
|
+
export declare function ScaleStrip({ label, steps }: ScaleStripProps): import("react").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=ScaleStrip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScaleStrip.d.ts","sourceRoot":"","sources":["../../../src/components/ThemeEditor/ScaleStrip.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,eAAe,+BAkB3D"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { GrytAppearance } from '@gryt/theme';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { ThemeDraft } from './draft.js';
|
|
4
|
+
export interface ThemeEditorProps {
|
|
5
|
+
/** The theme being edited. Controlled, so the host can preview it. */
|
|
6
|
+
value: ThemeDraft;
|
|
7
|
+
onChange: (next: ThemeDraft) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Which half is on the bench.
|
|
10
|
+
*
|
|
11
|
+
* The host's, not the editor's: editing the light half while the app around
|
|
12
|
+
* it is dark would be looking at two themes at once.
|
|
13
|
+
*/
|
|
14
|
+
appearance: GrytAppearance;
|
|
15
|
+
onAppearanceChange: (next: GrytAppearance) => void;
|
|
16
|
+
/** End of the header row. Where a host puts its own copy or save control. */
|
|
17
|
+
actions?: ReactNode;
|
|
18
|
+
/** Under the controls. Where the docs site puts the export tabs. */
|
|
19
|
+
footer?: ReactNode;
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function ThemeEditor({ value: draft, onChange, appearance, onAppearanceChange, actions, footer, className }: ThemeEditorProps): import("react").JSX.Element;
|
|
23
|
+
//# sourceMappingURL=ThemeEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeEditor.d.ts","sourceRoot":"","sources":["../../../src/components/ThemeEditor/ThemeEditor.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAIlD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAwBvC,OAAO,KAAK,EAKV,UAAU,EACX,MAAM,SAAS,CAAC;AA8BjB,MAAM,WAAW,gBAAgB;IAC/B,sEAAsE;IACtE,KAAK,EAAE,UAAU,CAAC;IAClB,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;IACrC;;;;;OAKG;IACH,UAAU,EAAE,cAAc,CAAC;IAC3B,kBAAkB,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC;IACnD,6EAA6E;IAC7E,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,oEAAoE;IACpE,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EAAE,KAAK,EACZ,QAAQ,EACR,UAAU,EACV,kBAAkB,EAClB,OAAO,EACP,MAAM,EACN,SAAS,EACV,EAAE,gBAAgB,+BAwZlB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { Appearance, DraftPath, ThemeDraft } from './draft.js';
|
|
3
|
+
export type CheckLevel = "pass" | "tight" | "fail";
|
|
4
|
+
export interface ContrastCheck {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
foreground: string;
|
|
8
|
+
background: string;
|
|
9
|
+
ratio: number;
|
|
10
|
+
min: number;
|
|
11
|
+
level: CheckLevel;
|
|
12
|
+
/** Advisory checks never read as a failure; they read as "look at this". */
|
|
13
|
+
advisory: boolean;
|
|
14
|
+
/** Which editable colours are responsible, so the fields can flag. */
|
|
15
|
+
paths: DraftPath[];
|
|
16
|
+
}
|
|
17
|
+
export declare function contrastChecks(draft: ThemeDraft, theme: CSSProperties, appearance: Appearance): ContrastCheck[];
|
|
18
|
+
/** Every field a failing check blames, for the warning markers on the editor. */
|
|
19
|
+
export declare function failingPaths(checks: ContrastCheck[]): Set<DraftPath>;
|
|
20
|
+
export declare function countFailures(checks: ContrastCheck[]): number;
|
|
21
|
+
//# sourceMappingURL=contrast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contrast.d.ts","sourceRoot":"","sources":["../../../src/components/ThemeEditor/contrast.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGjE,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAEnD,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,UAAU,CAAC;IAClB,4EAA4E;IAC5E,QAAQ,EAAE,OAAO,CAAC;IAClB,sEAAsE;IACtE,KAAK,EAAE,SAAS,EAAE,CAAC;CACpB;AAyCD,wBAAgB,cAAc,CAC5B,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,aAAa,EACpB,UAAU,EAAE,UAAU,GACrB,aAAa,EAAE,CA6EjB;AAED,iFAAiF;AACjF,wBAAgB,YAAY,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,GAAG,CAAC,SAAS,CAAC,CAOpE;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,CAE7D"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { grytThemeHues, isHexColor, normalizeHexColor, GrytAppearance, GrytHueKey, GrytHues, GrytNeutralKey, GrytNeutrals, GrytRadiusKey, GrytTheme } from '@gryt/theme';
|
|
2
|
+
import { CSSProperties } from 'react';
|
|
3
|
+
export type Appearance = GrytAppearance;
|
|
4
|
+
export type HueKey = GrytHueKey;
|
|
5
|
+
export type NeutralKey = GrytNeutralKey;
|
|
6
|
+
export type RadiusKey = GrytRadiusKey;
|
|
7
|
+
export type HueSet = GrytHues;
|
|
8
|
+
export type NeutralSet = GrytNeutrals;
|
|
9
|
+
export type ThemeDraft = GrytTheme;
|
|
10
|
+
export declare const HUE_KEYS: readonly ["accent", "accentLight", "secondary", "secondaryLight", "success", "danger", "dangerLight", "warning", "onAccent", "onSecondary", "onDanger"];
|
|
11
|
+
export declare const NEUTRAL_KEYS: readonly ["bg", "surface", "surfaceRaised", "surfaceHover", "border", "muted", "text"];
|
|
12
|
+
export declare const RADIUS_KEYS: readonly ["sm", "md", "lg", "xl", "full"];
|
|
13
|
+
export { isHexColor as isHex, normalizeHexColor as normalizeHex };
|
|
14
|
+
/** Where this appearance's hues live, which is what an edit has to write to. */
|
|
15
|
+
export type DraftPath = `hue.${HueKey}` | `lightHue.${HueKey}` | `dark.${NeutralKey}` | `light.${NeutralKey}`;
|
|
16
|
+
export declare const grytDraft: ThemeDraft;
|
|
17
|
+
export declare function hueSlot(draft: ThemeDraft, appearance: Appearance): "hue" | "lightHue";
|
|
18
|
+
export declare const huesFor: typeof grytThemeHues;
|
|
19
|
+
export declare function cloneDraft(draft: ThemeDraft): ThemeDraft;
|
|
20
|
+
/** The colours createGrytTheme wants, for one appearance. */
|
|
21
|
+
export declare function colorsFor(draft: ThemeDraft, appearance: Appearance): Record<string, string>;
|
|
22
|
+
/** The theme itself: CSS custom properties, ready for a style prop. */
|
|
23
|
+
export declare function themeStyle(draft: ThemeDraft, appearance: Appearance): CSSProperties;
|
|
24
|
+
/** A generated scale, read back off the built theme rather than regenerated. */
|
|
25
|
+
export declare function scaleFrom(theme: CSSProperties, family: string): string[];
|
|
26
|
+
export declare const SCALE_FAMILIES: readonly ["neutral", "accent", "secondary", "success", "danger", "warning"];
|
|
27
|
+
/** Changes anywhere in the draft, as one string. Cheap memo key. */
|
|
28
|
+
export declare function draftSignature(draft: ThemeDraft): string;
|
|
29
|
+
/** Human labels, used by the editor and by the contrast report alike. */
|
|
30
|
+
export declare const HUE_LABELS: Record<HueKey, string>;
|
|
31
|
+
export declare const NEUTRAL_LABELS: Record<NeutralKey, string>;
|
|
32
|
+
export declare const RADIUS_LABELS: Record<RadiusKey, string>;
|
|
33
|
+
/** What each radius step is actually on, so the numbers mean something. */
|
|
34
|
+
export declare const RADIUS_HINTS: Record<RadiusKey, string>;
|
|
35
|
+
//# sourceMappingURL=draft.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draft.d.ts","sourceRoot":"","sources":["../../../src/components/ThemeEditor/draft.ts"],"names":[],"mappings":"AAcA,OAAO,EAML,aAAa,EAEb,UAAU,EACV,iBAAiB,EAClB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,cAAc,EACd,UAAU,EACV,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,aAAa,EACb,SAAS,EACV,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,MAAM,MAAM,UAAU,GAAG,cAAc,CAAC;AACxC,MAAM,MAAM,MAAM,GAAG,UAAU,CAAC;AAChC,MAAM,MAAM,UAAU,GAAG,cAAc,CAAC;AACxC,MAAM,MAAM,SAAS,GAAG,aAAa,CAAC;AACtC,MAAM,MAAM,MAAM,GAAG,QAAQ,CAAC;AAC9B,MAAM,MAAM,UAAU,GAAG,YAAY,CAAC;AACtC,MAAM,MAAM,UAAU,GAAG,SAAS,CAAC;AAEnC,eAAO,MAAM,QAAQ,yJAAgB,CAAC;AACtC,eAAO,MAAM,YAAY,wFAAoB,CAAC;AAC9C,eAAO,MAAM,WAAW,2CAAmB,CAAC;AAE5C,OAAO,EAAE,UAAU,IAAI,KAAK,EAAE,iBAAiB,IAAI,YAAY,EAAE,CAAC;AAElE,gFAAgF;AAChF,MAAM,MAAM,SAAS,GACjB,OAAO,MAAM,EAAE,GACf,YAAY,MAAM,EAAE,GACpB,QAAQ,UAAU,EAAE,GACpB,SAAS,UAAU,EAAE,CAAC;AAE1B,eAAO,MAAM,SAAS,EAAE,UAAsB,CAAC;AAE/C,wBAAgB,OAAO,CACrB,KAAK,EAAE,UAAU,EACjB,UAAU,EAAE,UAAU,GACrB,KAAK,GAAG,UAAU,CAEpB;AAED,eAAO,MAAM,OAAO,sBAAgB,CAAC;AAErC,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CAQxD;AAED,6DAA6D;AAC7D,wBAAgB,SAAS,CACvB,KAAK,EAAE,UAAU,EACjB,UAAU,EAAE,UAAU,GACrB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAExB;AAED,uEAAuE;AACvE,wBAAgB,UAAU,CACxB,KAAK,EAAE,UAAU,EACjB,UAAU,EAAE,UAAU,GACrB,aAAa,CAEf;AAED,gFAAgF;AAChF,wBAAgB,SAAS,CAAC,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAMxE;AAED,eAAO,MAAM,cAAc,6EAOjB,CAAC;AAEX,oEAAoE;AACpE,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAExD;AAED,yEAAyE;AACzE,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAY7C,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAQrD,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAMnD,CAAC;AAEF,2EAA2E;AAC3E,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAMlD,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { HueSet, ThemeDraft } from './draft.js';
|
|
2
|
+
export declare function generateDraft(): ThemeDraft;
|
|
3
|
+
/**
|
|
4
|
+
* A label colour for a filled control.
|
|
5
|
+
*
|
|
6
|
+
* Ink or paper, whichever reads better on the fill, tinted toward the fill's
|
|
7
|
+
* own hue so it looks chosen rather than dropped in — black-or-white passes the
|
|
8
|
+
* same checks and looks like a placeholder.
|
|
9
|
+
*
|
|
10
|
+
* Then pushed until it clears 7:1 rather than the 4.5 the checks require. The
|
|
11
|
+
* label on a filled button is the one piece of text in an app that always sits
|
|
12
|
+
* on a saturated colour, it is usually a verb somebody is about to press, and
|
|
13
|
+
* the whole cost of AAA here is a shade of a colour that was already nearly
|
|
14
|
+
* black. Where the fill cannot carry 7 with any label at all — a mid-lightness
|
|
15
|
+
* blue tops out around 6 — this returns the best there is and the report says
|
|
16
|
+
* what it came to.
|
|
17
|
+
*/
|
|
18
|
+
export declare function readableOn(fill: string): string;
|
|
19
|
+
/** The three label colours, recomputed from the fills they sit on. */
|
|
20
|
+
export declare function withAutoLabels(hues: HueSet): HueSet;
|
|
21
|
+
/** Whether a hue set already carries the labels the auto pick would give it. */
|
|
22
|
+
export declare function labelsAreAuto(hues: HueSet): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Push a colour away from its background until it carries text.
|
|
25
|
+
*
|
|
26
|
+
* Lightness only. Moving the hue would change which colour it is, and moving
|
|
27
|
+
* chroma barely moves contrast at all — lightness is the axis that decides
|
|
28
|
+
* whether something is readable.
|
|
29
|
+
*/
|
|
30
|
+
export declare function ensureContrast(foreground: string, background: string, min: number): string;
|
|
31
|
+
/**
|
|
32
|
+
* Fix what the contrast report is complaining about, without redesigning the
|
|
33
|
+
* theme.
|
|
34
|
+
*
|
|
35
|
+
* Only the colours whose job is to be read get moved — text, muted text, and
|
|
36
|
+
* the labels on filled controls. The anchors somebody actually chose, the
|
|
37
|
+
* background and the accent, are left exactly where they are: a repair that
|
|
38
|
+
* changed the accent would be answering a question nobody asked.
|
|
39
|
+
*/
|
|
40
|
+
export declare function repairDraft(draft: ThemeDraft): ThemeDraft;
|
|
41
|
+
/** Whether a repair would change anything, so the button can say so. */
|
|
42
|
+
export declare function needsRepair(draft: ThemeDraft): boolean;
|
|
43
|
+
//# sourceMappingURL=generate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/components/ThemeEditor/generate.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAc,MAAM,EAAa,UAAU,EAAE,MAAM,SAAS,CAAC;AAmBzE,wBAAgB,aAAa,IAAI,UAAU,CAyE1C;AAQD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM/C;AAED,sEAAsE;AACtE,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOnD;AAED,gFAAgF;AAChF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAOnD;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,GACV,MAAM,CAeR;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CA0CzD;AAED,wEAAwE;AACxE,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAMtD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { decodeGrytTheme, encodeGrytTheme } from '@gryt/theme';
|
|
2
|
+
import { Appearance, ThemeDraft } from './draft.js';
|
|
3
|
+
export { encodeGrytTheme as encodeDraft, decodeGrytTheme };
|
|
4
|
+
export declare function themeCode(draft: ThemeDraft): string;
|
|
5
|
+
/** The whole draft, spelled out. What import reads back. */
|
|
6
|
+
export declare function themeJson(draft: ThemeDraft): string;
|
|
7
|
+
export interface ImportResult {
|
|
8
|
+
draft?: ThemeDraft;
|
|
9
|
+
appearance?: Appearance;
|
|
10
|
+
error?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Takes either of the two things somebody will paste: the JSON this page
|
|
14
|
+
* exports, or a link it produced.
|
|
15
|
+
*/
|
|
16
|
+
export declare function importTheme(input: string): ImportResult;
|
|
17
|
+
//# sourceMappingURL=share.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"share.d.ts","sourceRoot":"","sources":["../../../src/components/ThemeEditor/share.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,eAAe,EACf,eAAe,EAIhB,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,UAAU,EAAa,UAAU,EAAE,MAAM,SAAS,CAAC;AAEjE,OAAO,EAAE,eAAe,IAAI,WAAW,EAAE,eAAe,EAAE,CAAC;AAuD3D,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAmBnD;AAED,4DAA4D;AAC5D,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAEnD;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,CAavD"}
|