@gryt/ui 0.22.0 → 0.24.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.
Files changed (34) hide show
  1. package/dist/components/ThemeEditor/ColorField.d.ts +20 -0
  2. package/dist/components/ThemeEditor/ColorField.d.ts.map +1 -0
  3. package/dist/components/ThemeEditor/ContrastReport.d.ts +16 -0
  4. package/dist/components/ThemeEditor/ContrastReport.d.ts.map +1 -0
  5. package/dist/components/ThemeEditor/CurveEditor.d.ts +20 -0
  6. package/dist/components/ThemeEditor/CurveEditor.d.ts.map +1 -0
  7. package/dist/components/ThemeEditor/FontField.d.ts +11 -0
  8. package/dist/components/ThemeEditor/FontField.d.ts.map +1 -0
  9. package/dist/components/ThemeEditor/MotionField.d.ts +8 -0
  10. package/dist/components/ThemeEditor/MotionField.d.ts.map +1 -0
  11. package/dist/components/ThemeEditor/ScaleStrip.d.ts +15 -0
  12. package/dist/components/ThemeEditor/ScaleStrip.d.ts.map +1 -0
  13. package/dist/components/ThemeEditor/ThemeEditor.d.ts +32 -0
  14. package/dist/components/ThemeEditor/ThemeEditor.d.ts.map +1 -0
  15. package/dist/components/ThemeEditor/contrast.d.ts +21 -0
  16. package/dist/components/ThemeEditor/contrast.d.ts.map +1 -0
  17. package/dist/components/ThemeEditor/draft.d.ts +35 -0
  18. package/dist/components/ThemeEditor/draft.d.ts.map +1 -0
  19. package/dist/components/ThemeEditor/fonts.d.ts +25 -0
  20. package/dist/components/ThemeEditor/fonts.d.ts.map +1 -0
  21. package/dist/components/ThemeEditor/generate.d.ts +43 -0
  22. package/dist/components/ThemeEditor/generate.d.ts.map +1 -0
  23. package/dist/components/ThemeEditor/share.d.ts +17 -0
  24. package/dist/components/ThemeEditor/share.d.ts.map +1 -0
  25. package/dist/index.cjs +18 -1
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.cts +9 -0
  28. package/dist/index.d.ts +9 -0
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +2099 -910
  31. package/dist/index.js.map +1 -1
  32. package/dist/styles.css +1 -1
  33. package/dist/theme.css +40 -6
  34. package/package.json +2 -2
@@ -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,20 @@
1
+ import { GrytBezier } from '@gryt/theme';
2
+ interface CurveEditorProps {
3
+ value: GrytBezier;
4
+ onChange: (next: GrytBezier) => void;
5
+ /** Drawn faintly behind, to compare against. */
6
+ reference?: readonly number[];
7
+ /**
8
+ * A sampled curve to draw instead of the bezier, with no handles.
9
+ *
10
+ * For the named curves. A spring is not a cubic bezier and cannot be shown
11
+ * as one, so while a named curve is selected the graph draws the samples the
12
+ * theme will actually run and offers nothing to drag — the alternative was
13
+ * a prominent line that was not the curve in effect, which is worse than no
14
+ * line at all.
15
+ */
16
+ samples?: readonly number[];
17
+ }
18
+ export declare function CurveEditor({ value, onChange, reference, samples }: CurveEditorProps): import("react").JSX.Element;
19
+ export {};
20
+ //# sourceMappingURL=CurveEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CurveEditor.d.ts","sourceRoot":"","sources":["../../../src/components/ThemeEditor/CurveEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAuB9C,UAAU,gBAAgB;IACxB,KAAK,EAAE,UAAU,CAAC;IAClB,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;IACrC,gDAAgD;IAChD,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7B;AAID,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,QAAQ,EACR,SAAS,EACT,OAAO,EACR,EAAE,gBAAgB,+BA2IlB"}
@@ -0,0 +1,11 @@
1
+ import { GrytFontKey, GrytFonts } from '@gryt/theme';
2
+ interface FontFieldProps {
3
+ role: GrytFontKey;
4
+ fonts: GrytFonts | null | undefined;
5
+ onChange: (stack: string) => void;
6
+ /** Says so when a remote face will not be fetched on this machine. */
7
+ remoteAllowed?: boolean;
8
+ }
9
+ export declare function FontField({ role, fonts, onChange, remoteAllowed }: FontFieldProps): import("react").JSX.Element;
10
+ export {};
11
+ //# sourceMappingURL=FontField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FontField.d.ts","sourceRoot":"","sources":["../../../src/components/ThemeEditor/FontField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AA6B1D,UAAU,cAAc;IACtB,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,CAAC;IACpC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,sEAAsE;IACtE,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAID,wBAAgB,SAAS,CAAC,EACxB,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,aAAoB,EACrB,EAAE,cAAc,+BAqFhB"}
@@ -0,0 +1,8 @@
1
+ import { GrytMotion } from '@gryt/theme';
2
+ interface MotionFieldProps {
3
+ motion: GrytMotion | null | undefined;
4
+ onChange: (next: GrytMotion) => void;
5
+ }
6
+ export declare function MotionField({ motion, onChange }: MotionFieldProps): import("react").JSX.Element;
7
+ export {};
8
+ //# sourceMappingURL=MotionField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MotionField.d.ts","sourceRoot":"","sources":["../../../src/components/ThemeEditor/MotionField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,UAAU,EAAmB,MAAM,aAAa,CAAC;AAoC3E,UAAU,gBAAgB;IACxB,MAAM,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,CAAC;IACtC,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;CACtC;AAED,wBAAgB,WAAW,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,gBAAgB,+BAuHjE"}
@@ -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,32 @@
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
+ /**
17
+ * Whether a face this machine has to fetch will actually be fetched.
18
+ *
19
+ * The client keeps that behind a setting, so the picker says when a choice
20
+ * will not take effect rather than letting somebody pick a font and wonder
21
+ * why nothing changed. Defaults to true, which is right for the docs site
22
+ * and for anything with no such setting.
23
+ */
24
+ remoteFontsAllowed?: boolean;
25
+ /** End of the header row. Where a host puts its own copy or save control. */
26
+ actions?: ReactNode;
27
+ /** Under the controls. Where the docs site puts the export tabs. */
28
+ footer?: ReactNode;
29
+ className?: string;
30
+ }
31
+ export declare function ThemeEditor({ value: draft, onChange, appearance, onAppearanceChange, remoteFontsAllowed, actions, footer, className }: ThemeEditorProps): import("react").JSX.Element;
32
+ //# 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,EAA2B,MAAM,aAAa,CAAC;AAU3E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AA0BvC,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;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,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,kBAAyB,EACzB,OAAO,EACP,MAAM,EACN,SAAS,EACV,EAAE,gBAAgB,+BAsblB"}
@@ -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,25 @@
1
+ import { GrytFontKey, GrytFonts } from '@gryt/theme';
2
+ export interface FontChoice {
3
+ /** What the picker shows. */
4
+ label: string;
5
+ /** The whole stack, fallbacks included. */
6
+ stack: string;
7
+ /** Needs fetching from Google. False for anything already on the machine. */
8
+ remote: boolean;
9
+ /** One line on what it is for. */
10
+ note: string;
11
+ }
12
+ export declare const FONT_CHOICES: FontChoice[];
13
+ /** Roles in the order somebody sets them, with what each one is actually for. */
14
+ export declare const FONT_ROLE_LABELS: Record<GrytFontKey, string>;
15
+ export declare const FONT_ROLE_HINTS: Record<GrytFontKey, string>;
16
+ /** The stack a role is on, whether or not the theme carries any fonts. */
17
+ export declare function fontFor(fonts: GrytFonts | null | undefined, role: GrytFontKey): string;
18
+ /** The listed choice a stack corresponds to, if it is one of them. */
19
+ export declare function choiceFor(stack: string): FontChoice | undefined;
20
+ /**
21
+ * The family a stack asks for first, for a picker to show and a loader to
22
+ * fetch. `"Inter", ui-sans-serif, …` is Inter.
23
+ */
24
+ export declare function primaryFamily(stack: string): string;
25
+ //# sourceMappingURL=fonts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fonts.d.ts","sourceRoot":"","sources":["../../../src/components/ThemeEditor/fonts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAoB1D,MAAM,WAAW,UAAU;IACzB,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,MAAM,EAAE,OAAO,CAAC;IAChB,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;CACd;AAMD,eAAO,MAAM,YAAY,EAAE,UAAU,EA+EpC,CAAC;AAEF,iFAAiF;AACjF,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAIxD,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAIvD,CAAC;AAEF,0EAA0E;AAC1E,wBAAgB,OAAO,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,EAAE,IAAI,EAAE,WAAW,GAAG,MAAM,CAEtF;AAED,sEAAsE;AACtE,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAE/D;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGnD"}
@@ -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"}