@multiplatform.one/theme 7.43.0 → 7.45.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/package.json +5 -5
- package/src/theme/createDefaultThemeConfig.ts +3 -3
- package/src/theme/defaults/fonts.ts +50 -0
- package/src/theme/fieldFocus.spec.ts +58 -0
- package/src/theme/fieldFocus.ts +54 -0
- package/src/theme/headingCategoryFamilies.spec.ts +51 -0
- package/src/theme/index.ts +1 -0
- package/src/theme/scale/scaleFonts.ts +2 -1
- package/types/theme/defaults/fonts.d.ts +3 -1
- package/types/theme/defaults/fonts.d.ts.map +1 -1
- package/types/theme/fieldFocus.d.ts +37 -0
- package/types/theme/fieldFocus.d.ts.map +1 -0
- package/types/theme/index.d.ts +1 -0
- package/types/theme/index.d.ts.map +1 -1
- package/types/theme/scale/scaleFonts.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplatform.one/theme",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.45.0",
|
|
4
4
|
"description": "Tamagui theme system for multiplatform.one",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"multiplatform",
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"access": "public"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@multiplatform.one/platform": "^7.
|
|
63
|
-
"@multiplatform.one/store": "^7.
|
|
62
|
+
"@multiplatform.one/platform": "^7.45.0",
|
|
63
|
+
"@multiplatform.one/store": "^7.45.0",
|
|
64
64
|
"@tamagui/animations-react-native": "2.7.6",
|
|
65
65
|
"@tamagui/colors": "2.7.6",
|
|
66
66
|
"@tamagui/config": "2.7.6",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
"react-cookie": "^8.1.2"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@multiplatform.one/config": "7.
|
|
77
|
-
"@multiplatform.one/test-utils": "7.
|
|
76
|
+
"@multiplatform.one/config": "7.45.0",
|
|
77
|
+
"@multiplatform.one/test-utils": "7.45.0",
|
|
78
78
|
"@tamagui/animations-css": "2.7.6",
|
|
79
79
|
"@tamagui/animations-reanimated": "2.7.6",
|
|
80
80
|
"@tamagui/font-inter": "2.7.6",
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
import { defaultAccentTheme } from "./defaults/accent";
|
|
13
13
|
import { defaultBaseTheme } from "./defaults/base";
|
|
14
14
|
import { defaultBuilderOptions } from "./defaults/builderOptions";
|
|
15
|
-
import { defaultFonts } from "./defaults/fonts";
|
|
15
|
+
import { defaultFonts, withDerivedHeadingCategories } from "./defaults/fonts";
|
|
16
16
|
import { scaleFontSet } from "./scale/scaleFonts";
|
|
17
17
|
import type { Preset } from "./preset.types";
|
|
18
18
|
import { type SizeRecipeInputs } from "./recipeInputs";
|
|
@@ -147,11 +147,11 @@ export function createDefaultThemeConfig(
|
|
|
147
147
|
// pipeline (e.g. the Frappe SPA) where runtime JS themes are required.
|
|
148
148
|
// Always keep themes to ensure TamaguiProvider has valid theme data.
|
|
149
149
|
const themes = options.subset ? subsetThemes(builtThemes, options.subset) : builtThemes;
|
|
150
|
-
const fonts = {
|
|
150
|
+
const fonts = withDerivedHeadingCategories({
|
|
151
151
|
...defaultConfig.fonts,
|
|
152
152
|
...defaultFonts,
|
|
153
153
|
...options.fonts,
|
|
154
|
-
} as Record<string, GenericFont
|
|
154
|
+
} as Record<string, GenericFont>);
|
|
155
155
|
return createThemeConfig(
|
|
156
156
|
{
|
|
157
157
|
...defaultConfig,
|
|
@@ -133,6 +133,7 @@ export function createCategoryFont(
|
|
|
133
133
|
family: string,
|
|
134
134
|
tables: ScaleFonts = defaultTypeTables,
|
|
135
135
|
scope: "body" | "heading" = "body",
|
|
136
|
+
face?: GenericFont["face"],
|
|
136
137
|
): GenericFont {
|
|
137
138
|
const sizes = scope === "heading" ? tables.headingSizes : tables.bodySizes;
|
|
138
139
|
return createFont({
|
|
@@ -141,6 +142,7 @@ export function createCategoryFont(
|
|
|
141
142
|
lineHeight: categoryLineHeights(category, tables, scope),
|
|
142
143
|
weight: scope === "heading" ? headingWeights : bodyWeights,
|
|
143
144
|
letterSpacing: neutralTracking(sizes),
|
|
145
|
+
...(face ? { face } : {}),
|
|
144
146
|
}) as GenericFont;
|
|
145
147
|
}
|
|
146
148
|
|
|
@@ -293,3 +295,51 @@ export const defaultFonts = {
|
|
|
293
295
|
blackletter: defaultBlackletterFont,
|
|
294
296
|
geometric: defaultGeometricFont,
|
|
295
297
|
} as const;
|
|
298
|
+
|
|
299
|
+
type HeadingSource = {
|
|
300
|
+
category: FontCategory;
|
|
301
|
+
family: string;
|
|
302
|
+
face?: GenericFont["face"];
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
const derivedHeadingSources = new WeakMap<GenericFont, HeadingSource>();
|
|
306
|
+
|
|
307
|
+
function deriveHeading(source: HeadingSource, tables: ScaleFonts): GenericFont {
|
|
308
|
+
const font = createCategoryFont(source.category, source.family, tables, "heading", source.face);
|
|
309
|
+
derivedHeadingSources.set(font, source);
|
|
310
|
+
return font;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export function withDerivedHeadingCategories(
|
|
314
|
+
fonts: Record<string, GenericFont>,
|
|
315
|
+
tables: ScaleFonts = defaultTypeTables,
|
|
316
|
+
): Record<string, GenericFont> {
|
|
317
|
+
const result = { ...fonts };
|
|
318
|
+
for (const [category, key] of Object.entries(headingCategoryFontKeys)) {
|
|
319
|
+
const source = fonts[category];
|
|
320
|
+
if (
|
|
321
|
+
fonts[key] !== defaultFonts[key] ||
|
|
322
|
+
!source ||
|
|
323
|
+
source === defaultFonts[category as keyof typeof defaultFonts]
|
|
324
|
+
)
|
|
325
|
+
continue;
|
|
326
|
+
const family = source.family as string | { val: string };
|
|
327
|
+
result[key] = deriveHeading(
|
|
328
|
+
{
|
|
329
|
+
category: category as FontCategory,
|
|
330
|
+
family: typeof family === "string" ? family : family.val,
|
|
331
|
+
face: source.face,
|
|
332
|
+
},
|
|
333
|
+
tables,
|
|
334
|
+
);
|
|
335
|
+
}
|
|
336
|
+
return result;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
export function rescaleDerivedHeadingFont(
|
|
340
|
+
font: GenericFont,
|
|
341
|
+
tables: ScaleFonts,
|
|
342
|
+
): GenericFont | undefined {
|
|
343
|
+
const source = derivedHeadingSources.get(font);
|
|
344
|
+
return source ? deriveHeading(source, tables) : undefined;
|
|
345
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { createThemesBuilder } from "./createThemes";
|
|
3
|
+
import { defaultAccentTheme } from "./defaults/accent";
|
|
4
|
+
import { defaultBaseTheme } from "./defaults/base";
|
|
5
|
+
import { defaultBuilderOptions } from "./defaults/builderOptions";
|
|
6
|
+
import {
|
|
7
|
+
FIELD_FOCUS_COLOR,
|
|
8
|
+
FIELD_FOCUS_REST,
|
|
9
|
+
FIELD_FOCUS_STYLE,
|
|
10
|
+
fieldFocusCss,
|
|
11
|
+
fieldFocusHoldsContrast,
|
|
12
|
+
} from "./fieldFocus";
|
|
13
|
+
|
|
14
|
+
const themes = createThemesBuilder(
|
|
15
|
+
defaultBaseTheme,
|
|
16
|
+
defaultAccentTheme,
|
|
17
|
+
defaultBuilderOptions,
|
|
18
|
+
).themes() as Record<string, Record<string, string>>;
|
|
19
|
+
|
|
20
|
+
describe("FZ-7717: one field focus look", () => {
|
|
21
|
+
it("is the accent border at the same width, with no ring, gap or shadow", () => {
|
|
22
|
+
expect(FIELD_FOCUS_STYLE.borderColor).toBe("$accentColor");
|
|
23
|
+
expect(FIELD_FOCUS_COLOR).toBe("$accentColor");
|
|
24
|
+
expect(FIELD_FOCUS_STYLE.outlineWidth).toBe(0);
|
|
25
|
+
expect(FIELD_FOCUS_REST.outlineWidth).toBe(0);
|
|
26
|
+
for (const key of Object.keys(FIELD_FOCUS_STYLE)) {
|
|
27
|
+
expect(key).not.toMatch(/^(borderWidth|outlineOffset|shadow|elevation|boxShadow)/);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("web css paints the accent border and drops the ring on pointer and keyboard focus", () => {
|
|
32
|
+
const css = fieldFocusCss("[data-mp-input-box]");
|
|
33
|
+
expect(css).toContain("[data-mp-input-box]:has(input:focus)");
|
|
34
|
+
expect(css).toContain("[data-mp-input-box]:focus-visible");
|
|
35
|
+
expect(css).toContain("border-color: var(--accentColor");
|
|
36
|
+
expect(css).toContain("outline: none");
|
|
37
|
+
expect(css).not.toMatch(/outline-offset|box-shadow|border-width/);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// WCAG 2.4.7 / 1.4.11: the focused border must hold 3:1 against the field
|
|
41
|
+
// fill ($background) and the grounds a field sits on, in every colour theme.
|
|
42
|
+
for (const [name, theme] of Object.entries(themes)) {
|
|
43
|
+
if (!/^(light|dark)(_(blue|gray|green|orange|pink|purple|red|yellow|neutral))?$/.test(name))
|
|
44
|
+
continue;
|
|
45
|
+
it(`${name}: $accentColor holds 3:1 on the field fill and page grounds`, () => {
|
|
46
|
+
expect(theme.accentColor, name).toBeTruthy();
|
|
47
|
+
expect(
|
|
48
|
+
fieldFocusHoldsContrast(theme.accentColor, [
|
|
49
|
+
theme.background,
|
|
50
|
+
theme.color1,
|
|
51
|
+
theme.color2,
|
|
52
|
+
theme.color3,
|
|
53
|
+
]),
|
|
54
|
+
`${name}: ${theme.accentColor} on ${theme.background}`,
|
|
55
|
+
).toBe(true);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { focusRingColorMeetsContrast } from "./focusState";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* FZ-7717: the ONE focus look for every focusable MPO field (Input, TextArea,
|
|
5
|
+
* Select, Duration, Date and Time, Number, OTP and every other Input.Box).
|
|
6
|
+
* Clay's pick (rv_a60d41af5f9beea6): the field's own border turns the accent
|
|
7
|
+
* colour at the width it already has. No ring, no gap, no shadow.
|
|
8
|
+
*
|
|
9
|
+
* `$accentColor` is the accent ink, held at 4.5:1 on color1..color3 by
|
|
10
|
+
* holdAccentFloor, so the border clears the 3:1 focus floor on every field
|
|
11
|
+
* ground. Fields spread these fragments; they never define their own.
|
|
12
|
+
*/
|
|
13
|
+
export const FIELD_FOCUS_COLOR = "$accentColor";
|
|
14
|
+
|
|
15
|
+
export const FIELD_FOCUS_STYLE = {
|
|
16
|
+
borderColor: FIELD_FOCUS_COLOR,
|
|
17
|
+
outlineWidth: 0,
|
|
18
|
+
outlineStyle: "solid" as const,
|
|
19
|
+
outlineColor: "transparent",
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/** The same field at rest: no outline left over from a ring recipe. */
|
|
23
|
+
export const FIELD_FOCUS_REST = {
|
|
24
|
+
outlineWidth: 0,
|
|
25
|
+
outlineStyle: "solid" as const,
|
|
26
|
+
outlineColor: "transparent",
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Web: the focused element is the inner <input>, not the painted Box, so the
|
|
31
|
+
* Box takes the look through `:has()`. Covers pointer and keyboard focus;
|
|
32
|
+
* `:focus-visible` on the Box covers button-like Boxes (Select, Date).
|
|
33
|
+
* `deep` also lights the Box when any inner control has keyboard focus, for
|
|
34
|
+
* Boxes whose adornment is the field itself (PhoneInput's country picker).
|
|
35
|
+
* A Box with a separate inner action (SearchInput's clear) stays shallow.
|
|
36
|
+
*/
|
|
37
|
+
export function fieldFocusCss(box: string, { deep = false }: { deep?: boolean } = {}): string {
|
|
38
|
+
const selectors = [
|
|
39
|
+
`${box}:has(input:focus)`,
|
|
40
|
+
`${box}:has(textarea:focus)`,
|
|
41
|
+
`${box}:has([data-mp-input-area]:focus)`,
|
|
42
|
+
`${box}:focus-visible`,
|
|
43
|
+
...(deep ? [`${box}:has(:focus-visible)`] : []),
|
|
44
|
+
];
|
|
45
|
+
return `${selectors.join(",\n")} {
|
|
46
|
+
border-color: var(--accentColor, CanvasText) !important;
|
|
47
|
+
outline: none !important;
|
|
48
|
+
}`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** True when the accent border clears 3:1 against every given field ground. */
|
|
52
|
+
export function fieldFocusHoldsContrast(accent: string, grounds: string[]): boolean {
|
|
53
|
+
return grounds.every((ground) => focusRingColorMeetsContrast(accent, ground));
|
|
54
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from "vitest";
|
|
2
|
+
|
|
3
|
+
vi.mock("tamagui", () => ({ createTamagui: (config: unknown) => config }));
|
|
4
|
+
vi.mock("./animations/index", () => ({ animations: {} }));
|
|
5
|
+
|
|
6
|
+
import { createDefaultFont } from "../font";
|
|
7
|
+
import { createDefaultThemeConfig } from "./createDefaultThemeConfig";
|
|
8
|
+
import { defaultFonts, headingCategoryFontKeys } from "./defaults/fonts";
|
|
9
|
+
import { generateScale } from "./scale/generateScale";
|
|
10
|
+
import { defaultScaleInputs } from "./scale/scaleInputs";
|
|
11
|
+
import { scaleFontSet } from "./scale/scaleFonts";
|
|
12
|
+
|
|
13
|
+
describe("heading category family registration", () => {
|
|
14
|
+
it("uses a consumer category family and face without inheriting body metrics", () => {
|
|
15
|
+
const face = { 400: { normal: "CustomScript" }, 700: { normal: "CustomScriptBold" } };
|
|
16
|
+
const cursive = createDefaultFont({ family: "Custom Script", face });
|
|
17
|
+
const config = createDefaultThemeConfig({ fonts: { cursive } });
|
|
18
|
+
const fonts = config.tamagui.fonts;
|
|
19
|
+
expect(fonts.headingCursive.family).toBe(cursive.family);
|
|
20
|
+
expect(fonts.headingCursive.face).toMatchObject(face);
|
|
21
|
+
expect(fonts.headingCursive.size).toEqual(defaultFonts.headingCursive.size);
|
|
22
|
+
expect(fonts.headingCursive.weight).toEqual(defaultFonts.headingCursive.weight);
|
|
23
|
+
expect(fonts.headingCursive.lineHeight).toEqual(defaultFonts.headingCursive.lineHeight);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("keeps each inherited category family on the heading ladder after a preset scale change", () => {
|
|
27
|
+
const families = Object.fromEntries(
|
|
28
|
+
Object.keys(headingCategoryFontKeys).map((category) => [
|
|
29
|
+
category,
|
|
30
|
+
createDefaultFont({ family: `Loaded-${category}` }),
|
|
31
|
+
]),
|
|
32
|
+
);
|
|
33
|
+
const config = createDefaultThemeConfig({ fonts: families });
|
|
34
|
+
const from = generateScale(defaultScaleInputs).fonts;
|
|
35
|
+
const to = generateScale({ ...defaultScaleInputs, type: 19 }).fonts;
|
|
36
|
+
const scaled = scaleFontSet(config.tamagui.fonts, from, to);
|
|
37
|
+
for (const [category, key] of Object.entries(headingCategoryFontKeys)) {
|
|
38
|
+
expect(scaled[key].family).toBe(`Loaded-${category}`);
|
|
39
|
+
expect(scaled[key].size).toEqual(to.headingSizes);
|
|
40
|
+
expect(scaled[key].weight).toEqual(defaultFonts[key].weight);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it("lets an explicit heading category override win", () => {
|
|
45
|
+
const headingCursive = { ...defaultFonts.headingCursive, family: "Heading Only" };
|
|
46
|
+
const config = createDefaultThemeConfig({
|
|
47
|
+
fonts: { cursive: createDefaultFont({ family: "Body Only" }), headingCursive },
|
|
48
|
+
});
|
|
49
|
+
expect(config.tamagui.fonts.headingCursive.family).toBe("Heading Only");
|
|
50
|
+
});
|
|
51
|
+
});
|
package/src/theme/index.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from "./createDefaultThemeConfig";
|
|
|
8
8
|
export * from "./createThemes";
|
|
9
9
|
export * from "./defaults/index";
|
|
10
10
|
export * from "./devtools/ThemeDevtoolsPanel";
|
|
11
|
+
export * from "./fieldFocus";
|
|
11
12
|
export * from "./focusState";
|
|
12
13
|
export * from "./glyphPaint";
|
|
13
14
|
export * from "./fontCategoryMetrics";
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
defaultFonts,
|
|
7
7
|
fontFamilyStacks,
|
|
8
8
|
headingCategoryFontKeys,
|
|
9
|
+
rescaleDerivedHeadingFont,
|
|
9
10
|
} from "../defaults/fonts";
|
|
10
11
|
import type { FontCategory } from "../knobs";
|
|
11
12
|
import type { ScaleFonts } from "./generateScale";
|
|
@@ -99,7 +100,7 @@ export function scaleFontSet(
|
|
|
99
100
|
to,
|
|
100
101
|
);
|
|
101
102
|
} else {
|
|
102
|
-
out[name] = rescaleFont(font, from, to);
|
|
103
|
+
out[name] = rescaleDerivedHeadingFont(font, to) ?? rescaleFont(font, from, to);
|
|
103
104
|
}
|
|
104
105
|
}
|
|
105
106
|
return out;
|
|
@@ -30,7 +30,7 @@ export type FontFamilyCategory = FontCategory;
|
|
|
30
30
|
/** Scope leading raised to the category's LC-11 floor. */
|
|
31
31
|
export declare function categoryLineHeights(category: FontCategory, tables?: ScaleFonts, scope?: "body" | "heading"): Record<string, number>;
|
|
32
32
|
/** Category family on the selected scope's size and weight ladder. */
|
|
33
|
-
export declare function createCategoryFont(category: FontCategory, family: string, tables?: ScaleFonts, scope?: "body" | "heading"): GenericFont;
|
|
33
|
+
export declare function createCategoryFont(category: FontCategory, family: string, tables?: ScaleFonts, scope?: "body" | "heading", face?: GenericFont["face"]): GenericFont;
|
|
34
34
|
/** Inter `$heading` on a generated scale's heading ladder. */
|
|
35
35
|
export declare function createHeadingFont(tables?: ScaleFonts): import("@tamagui/web").FillInFont<{
|
|
36
36
|
face: {
|
|
@@ -442,4 +442,6 @@ export declare const defaultFonts: {
|
|
|
442
442
|
readonly blackletter: GenericFont;
|
|
443
443
|
readonly geometric: GenericFont;
|
|
444
444
|
};
|
|
445
|
+
export declare function withDerivedHeadingCategories(fonts: Record<string, GenericFont>, tables?: ScaleFonts): Record<string, GenericFont>;
|
|
446
|
+
export declare function rescaleDerivedHeadingFont(font: GenericFont, tables: ScaleFonts): GenericFont | undefined;
|
|
445
447
|
//# sourceMappingURL=fonts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fonts.d.ts","sourceRoot":"","sources":["../../../src/theme/defaults/fonts.ts"],"names":[],"mappings":"AAKA,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAG5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAmBxE,6DAA6D;AAC7D,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED,yEAAyE;AACzE,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAE1C,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEvD;AAmCD;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAsC,CAAC;AAExF,uEAAuE;AACvE,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAEtD,CAAC;AAWF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,8BAAqB,CAAC;AAEnD,MAAM,MAAM,kBAAkB,GAAG,YAAY,CAAC;AAE9C,0DAA0D;AAC1D,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,YAAY,EACtB,MAAM,GAAE,UAA8B,EACtC,KAAK,GAAE,MAAM,GAAG,SAAkB,GACjC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAUxB;AAED,sEAAsE;AACtE,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,YAAY,EACtB,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,UAA8B,EACtC,KAAK,GAAE,MAAM,GAAG,SAAkB,
|
|
1
|
+
{"version":3,"file":"fonts.d.ts","sourceRoot":"","sources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A2B,aAKvC,CAAC;AAEF,6EAA6E;AAC7E,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwBf,CAAC;AAgBX,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EAClC,MAAM,GAAE,UAA8B,GACrC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAqB7B;AAED,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,UAAU,GACjB,WAAW,GAAG,SAAS,CAGzB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FZ-7717: the ONE focus look for every focusable MPO field (Input, TextArea,
|
|
3
|
+
* Select, Duration, Date and Time, Number, OTP and every other Input.Box).
|
|
4
|
+
* Clay's pick (rv_a60d41af5f9beea6): the field's own border turns the accent
|
|
5
|
+
* colour at the width it already has. No ring, no gap, no shadow.
|
|
6
|
+
*
|
|
7
|
+
* `$accentColor` is the accent ink, held at 4.5:1 on color1..color3 by
|
|
8
|
+
* holdAccentFloor, so the border clears the 3:1 focus floor on every field
|
|
9
|
+
* ground. Fields spread these fragments; they never define their own.
|
|
10
|
+
*/
|
|
11
|
+
export declare const FIELD_FOCUS_COLOR = "$accentColor";
|
|
12
|
+
export declare const FIELD_FOCUS_STYLE: {
|
|
13
|
+
borderColor: string;
|
|
14
|
+
outlineWidth: number;
|
|
15
|
+
outlineStyle: "solid";
|
|
16
|
+
outlineColor: string;
|
|
17
|
+
};
|
|
18
|
+
/** The same field at rest: no outline left over from a ring recipe. */
|
|
19
|
+
export declare const FIELD_FOCUS_REST: {
|
|
20
|
+
outlineWidth: number;
|
|
21
|
+
outlineStyle: "solid";
|
|
22
|
+
outlineColor: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Web: the focused element is the inner <input>, not the painted Box, so the
|
|
26
|
+
* Box takes the look through `:has()`. Covers pointer and keyboard focus;
|
|
27
|
+
* `:focus-visible` on the Box covers button-like Boxes (Select, Date).
|
|
28
|
+
* `deep` also lights the Box when any inner control has keyboard focus, for
|
|
29
|
+
* Boxes whose adornment is the field itself (PhoneInput's country picker).
|
|
30
|
+
* A Box with a separate inner action (SearchInput's clear) stays shallow.
|
|
31
|
+
*/
|
|
32
|
+
export declare function fieldFocusCss(box: string, { deep }?: {
|
|
33
|
+
deep?: boolean;
|
|
34
|
+
}): string;
|
|
35
|
+
/** True when the accent border clears 3:1 against every given field ground. */
|
|
36
|
+
export declare function fieldFocusHoldsContrast(accent: string, grounds: string[]): boolean;
|
|
37
|
+
//# sourceMappingURL=fieldFocus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fieldFocus.d.ts","sourceRoot":"","sources":["../../src/theme/fieldFocus.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD,eAAO,MAAM,iBAAiB;;;;;CAK7B,CAAC;AAEF,uEAAuE;AACvE,eAAO,MAAM,gBAAgB;;;;CAI5B,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,IAAY,EAAE,GAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,MAAM,CAY5F;AAED,+EAA+E;AAC/E,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAElF"}
|
package/types/theme/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from "./createDefaultThemeConfig";
|
|
|
8
8
|
export * from "./createThemes";
|
|
9
9
|
export * from "./defaults/index";
|
|
10
10
|
export * from "./devtools/ThemeDevtoolsPanel";
|
|
11
|
+
export * from "./fieldFocus";
|
|
11
12
|
export * from "./focusState";
|
|
12
13
|
export * from "./glyphPaint";
|
|
13
14
|
export * from "./fontCategoryMetrics";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,YAAY,EAAE,MAAM,IAAI,gBAAgB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACjF,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,c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ts","sourceRoot":"","sources":["../../../src/theme/scale/scaleFonts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAWhD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAQlD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,WAAW,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,GAAG,CAAC,CAqC/F;AAQD;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EAClC,IAAI,EAAE,UAAU,EAChB,EAAE,EAAE,UAAU,GACb,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CA2B7B"}
|