@ankhorage/surface 0.2.3 → 1.0.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/CHANGELOG.md +41 -0
- package/dist/examples/DocsExamples.d.ts.map +1 -1
- package/dist/examples/DocsExamples.js +0 -2
- package/dist/examples/DocsExamples.js.map +1 -1
- package/dist/internal/resolvers/resolveControlSize.d.ts +2 -2
- package/dist/internal/resolvers/resolveControlSize.d.ts.map +1 -1
- package/dist/internal/resolvers/resolveControlSize.js.map +1 -1
- package/dist/internal/resolvers/resolveIconSize.d.ts +2 -2
- package/dist/internal/resolvers/resolveIconSize.d.ts.map +1 -1
- package/dist/internal/resolvers/resolveIconSize.js.map +1 -1
- package/dist/internal/resolvers/resolveInteractiveColors.d.ts +3 -3
- package/dist/internal/resolvers/resolveInteractiveColors.d.ts.map +1 -1
- package/dist/internal/resolvers/resolveInteractiveColors.js.map +1 -1
- package/dist/internal/resolvers/resolveSelectionControlColors.d.ts +2 -2
- package/dist/internal/resolvers/resolveSelectionControlColors.d.ts.map +1 -1
- package/dist/internal/resolvers/resolveSelectionControlColors.js.map +1 -1
- package/dist/internal/resolvers/resolveTextColor.d.ts +3 -3
- package/dist/internal/resolvers/resolveTextColor.d.ts.map +1 -1
- package/dist/internal/resolvers/resolveTextColor.js.map +1 -1
- package/dist/internal/resolvers/resolveTextStyles.d.ts +3 -3
- package/dist/internal/resolvers/resolveTextStyles.d.ts.map +1 -1
- package/dist/internal/resolvers/resolveTextStyles.js.map +1 -1
- package/dist/internal/resolvers/resolveTone.d.ts +2 -2
- package/dist/internal/resolvers/resolveTone.d.ts.map +1 -1
- package/dist/internal/resolvers/resolveTone.js.map +1 -1
- package/dist/layout/Container.d.ts +2 -2
- package/dist/layout/Container.d.ts.map +1 -1
- package/dist/layout/Container.js.map +1 -1
- package/dist/layout/helpers.d.ts +9 -9
- package/dist/layout/helpers.d.ts.map +1 -1
- package/dist/layout/helpers.js.map +1 -1
- package/dist/primitives/heading/resolveHeadingStyle.d.ts +2 -2
- package/dist/primitives/heading/resolveHeadingStyle.d.ts.map +1 -1
- package/dist/primitives/heading/resolveHeadingStyle.js.map +1 -1
- package/dist/primitives/icon/Icon.d.ts +3 -3
- package/dist/primitives/icon/Icon.d.ts.map +1 -1
- package/dist/primitives/icon/Icon.js.map +1 -1
- package/dist/theme/ThemeContext.d.ts +3 -3
- package/dist/theme/ThemeContext.d.ts.map +1 -1
- package/dist/theme/ThemeContext.js.map +1 -1
- package/dist/theme/colorEngine.d.ts +10 -11
- package/dist/theme/colorEngine.d.ts.map +1 -1
- package/dist/theme/colorEngine.js +102 -412
- package/dist/theme/colorEngine.js.map +1 -1
- package/dist/theme/createTheme.d.ts +3 -3
- package/dist/theme/createTheme.d.ts.map +1 -1
- package/dist/theme/createTheme.js +2 -4
- package/dist/theme/createTheme.js.map +1 -1
- package/dist/theme/types.d.ts +5 -17
- package/dist/theme/types.d.ts.map +1 -1
- package/dist/theme/types.js.map +1 -1
- package/package.json +4 -4
- package/src/examples/DocsExamples.tsx +0 -2
- package/src/internal/resolvers/resolveControlSize.ts +5 -2
- package/src/internal/resolvers/resolveIconSize.ts +2 -2
- package/src/internal/resolvers/resolveInteractiveColors.ts +3 -3
- package/src/internal/resolvers/resolveSelectionControlColors.ts +2 -2
- package/src/internal/resolvers/resolveTextColor.ts +3 -3
- package/src/internal/resolvers/resolveTextStyles.ts +6 -6
- package/src/internal/resolvers/resolveTone.ts +2 -2
- package/src/layout/Container.tsx +2 -2
- package/src/layout/helpers.test.ts +2 -2
- package/src/layout/helpers.ts +12 -9
- package/src/primitives/heading/resolveHeadingStyle.ts +2 -2
- package/src/primitives/icon/Icon.tsx +3 -3
- package/src/theme/ThemeContext.tsx +2 -2
- package/src/theme/colorEngine.test.ts +158 -154
- package/src/theme/colorEngine.ts +128 -477
- package/src/theme/createTheme.ts +6 -8
- package/src/theme/types.ts +15 -18
- package/src/utils/deepMerge.test.ts +0 -4
|
@@ -68,12 +68,10 @@ export const DEFAULT_CONFIG = {
|
|
|
68
68
|
light: {
|
|
69
69
|
primaryColor: '#3B82F6',
|
|
70
70
|
harmony: 'monochromatic',
|
|
71
|
-
colorTone: 'neutral',
|
|
72
71
|
},
|
|
73
72
|
dark: {
|
|
74
73
|
primaryColor: '#3B82F6',
|
|
75
74
|
harmony: 'monochromatic',
|
|
76
|
-
colorTone: 'neutral',
|
|
77
75
|
},
|
|
78
76
|
};
|
|
79
77
|
/**
|
|
@@ -87,11 +85,11 @@ function toPascalCase(str) {
|
|
|
87
85
|
.join('');
|
|
88
86
|
}
|
|
89
87
|
export function createTheme(config = DEFAULT_CONFIG, mode = 'light', activeFontId) {
|
|
90
|
-
const { colors,
|
|
88
|
+
const { colors, swatches, semantics } = generatePalette(config, mode);
|
|
91
89
|
const theme = {
|
|
92
90
|
...DEFAULT_TOKENS,
|
|
93
91
|
colors: colors,
|
|
94
|
-
|
|
92
|
+
swatches,
|
|
95
93
|
semantics,
|
|
96
94
|
config,
|
|
97
95
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTheme.js","sourceRoot":"","sources":["../../src/theme/createTheme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGhD,MAAM,CAAC,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"createTheme.js","sourceRoot":"","sources":["../../src/theme/createTheme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGhD,MAAM,CAAC,MAAM,cAAc,GAA2D;IACpF,OAAO,EAAE;QACP,IAAI,EAAE,CAAC;QACP,EAAE,EAAE,CAAC;QACL,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,EAAE;QACL,CAAC,EAAE,EAAE;QACL,EAAE,EAAE,EAAE;QACN,GAAG,EAAE,EAAE;KACR;IACD,KAAK,EAAE;QACL,IAAI,EAAE,CAAC;QACP,CAAC,EAAE,CAAC;Q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AC,CAAC;QAE9F,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACpB,2DAA2D;YAC3D,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,GAAG,UAAU,IAAI,CAAC,SAAS,CAAC;YAC/D,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,GAAG,UAAU,IAAI,CAAC,QAAQ,CAAC;QAChE,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { generatePalette } from './colorEngine';\nimport type { FontWeight, SurfaceTheme, ThemeConfig, ThemeTokens } from './types';\n\nexport const DEFAULT_TOKENS: Omit<ThemeTokens, 'colors' | 'swatches' | 'semantics'> = {\n spacing: {\n none: 0,\n xs: 4,\n s: 8,\n m: 16,\n l: 24,\n xl: 32,\n xxl: 48,\n },\n radii: {\n none: 0,\n s: 4,\n m: 8,\n l: 16,\n full: 9999,\n },\n typography: {\n headings: {\n 1: { size: 32, lineHeight: 40, weight: 'bold' },\n 2: { size: 24, lineHeight: 32, weight: 'bold' },\n 3: { size: 20, lineHeight: 28, weight: 'bold' },\n 4: { size: 18, lineHeight: 24, weight: 'semiBold' },\n 5: { size: 16, lineHeight: 22, weight: 'semiBold' },\n 6: { size: 14, lineHeight: 20, weight: 'semiBold' },\n },\n sizes: {\n xs: 12,\n s: 14,\n m: 16,\n l: 18,\n xl: 20,\n xxl: 24,\n '3xl': 30,\n h1: 32,\n h2: 24,\n h3: 20,\n h4: 18,\n h5: 16,\n h6: 14,\n },\n weights: {\n thin: '100',\n extraLight: '200',\n light: '300',\n regular: '400',\n medium: '500',\n semiBold: '600',\n bold: '700',\n extraBold: '800',\n black: '900',\n },\n fonts: {\n normal: {} as Record<FontWeight, string | undefined>,\n italic: {} as Record<FontWeight, string | undefined>,\n },\n },\n shadows: {\n soft: 2,\n medium: 4,\n hard: 8,\n },\n};\n\nexport const DEFAULT_CONFIG: ThemeConfig = {\n id: 'default',\n name: 'Default',\n light: {\n primaryColor: '#3B82F6',\n harmony: 'monochromatic',\n },\n dark: {\n primaryColor: '#3B82F6',\n harmony: 'monochromatic',\n },\n};\n\n/**\n * Normalizes font family name to PascalCase for consistent key generation\n * matches GoogleFontsPlugin logic.\n */\nfunction toPascalCase(str: string) {\n return str\n .split(/[- ]+/)\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join('');\n}\n\nexport function createTheme(\n config: ThemeConfig = DEFAULT_CONFIG,\n mode: 'light' | 'dark' = 'light',\n activeFontId?: string | null,\n): SurfaceTheme {\n const { colors, swatches, semantics } = generatePalette(config, mode);\n\n const theme = {\n ...DEFAULT_TOKENS,\n colors: colors as SurfaceTheme['colors'],\n swatches,\n semantics,\n config,\n };\n\n if (activeFontId) {\n const familyName = toPascalCase(activeFontId);\n const weights: FontWeight[] = ['100', '200', '300', '400', '500', '600', '700', '800', '900'];\n\n weights.forEach((w) => {\n // Convention from GoogleFonts plugin: Family_WeightRegular\n theme.typography.fonts.normal[w] = `${familyName}_${w}Regular`;\n theme.typography.fonts.italic[w] = `${familyName}_${w}Italic`;\n });\n }\n\n return theme;\n}\n"]}
|
package/dist/theme/types.d.ts
CHANGED
|
@@ -1,19 +1,7 @@
|
|
|
1
|
+
import type { GeneratedThemeSwatches } from '@ankhorage/color-theory';
|
|
1
2
|
import type { ThemeConfig as ContractsThemeConfig } from '@ankhorage/contracts';
|
|
2
|
-
export type { ColorHarmony,
|
|
3
|
-
export
|
|
4
|
-
[key: number]: string;
|
|
5
|
-
50: string;
|
|
6
|
-
100: string;
|
|
7
|
-
200: string;
|
|
8
|
-
300: string;
|
|
9
|
-
400: string;
|
|
10
|
-
500: string;
|
|
11
|
-
600: string;
|
|
12
|
-
700: string;
|
|
13
|
-
800: string;
|
|
14
|
-
900: string;
|
|
15
|
-
950: string;
|
|
16
|
-
}
|
|
3
|
+
export type { ColorHarmony, ColorSwatch, ColorSwatchStep, GeneratedColorRole, GeneratedThemeModeColors, GeneratedThemeSwatches, HexColor, SemanticColorReferenceMap, SemanticColorToken, } from '@ankhorage/color-theory';
|
|
4
|
+
export type { ThemeConfig, ThemeModeConfig } from '@ankhorage/contracts';
|
|
17
5
|
export interface NeutralSemantics {
|
|
18
6
|
bg: string;
|
|
19
7
|
bgSubtle: string;
|
|
@@ -89,7 +77,7 @@ export interface ThemeTokens {
|
|
|
89
77
|
warning: string;
|
|
90
78
|
[key: string]: string;
|
|
91
79
|
};
|
|
92
|
-
|
|
80
|
+
swatches: GeneratedThemeSwatches;
|
|
93
81
|
semantics: ThemeSemantics;
|
|
94
82
|
spacing: {
|
|
95
83
|
none: 0;
|
|
@@ -155,7 +143,7 @@ export interface ThemeTokens {
|
|
|
155
143
|
[key: string]: number;
|
|
156
144
|
};
|
|
157
145
|
}
|
|
158
|
-
export interface
|
|
146
|
+
export interface SurfaceTheme extends ThemeTokens {
|
|
159
147
|
config: ContractsThemeConfig;
|
|
160
148
|
}
|
|
161
149
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/theme/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/theme/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,IAAI,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAEhF,YAAY,EACV,YAAY,EACZ,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,wBAAwB,EACxB,sBAAsB,EACtB,QAAQ,EACR,yBAAyB,EACzB,kBAAkB,GACnB,MAAM,yBAAyB,CAAC;AACjC,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEzE,MAAM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YACxD,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;YAC/C,wDAAwD;YACxD,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;SAChD,CAAC;KACH,CAAC;IACF,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;KACvB,CAAC;CACH;AAED,MAAM,WAAW,YAAa,SAAQ,WAAW;IAC/C,MAAM,EAAE,oBAAoB,CAAC;CAC9B"}
|
package/dist/theme/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/theme/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/theme/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { GeneratedThemeSwatches } from '@ankhorage/color-theory';\nimport type { ThemeConfig as ContractsThemeConfig } from '@ankhorage/contracts';\n\nexport type {\n ColorHarmony,\n ColorSwatch,\n ColorSwatchStep,\n GeneratedColorRole,\n GeneratedThemeModeColors,\n GeneratedThemeSwatches,\n HexColor,\n SemanticColorReferenceMap,\n SemanticColorToken,\n} from '@ankhorage/color-theory';\nexport type { ThemeConfig, ThemeModeConfig } from '@ankhorage/contracts';\n\nexport interface NeutralSemantics {\n bg: string;\n bgSubtle: string;\n surface: string;\n surfaceHover: string;\n surfaceActive: string;\n border: string;\n borderStrong: string;\n divider: string;\n text: string;\n textMuted: string;\n textSubtle: string;\n}\n\nexport interface RoleSemantics {\n base: string;\n hover: string;\n strong: string;\n softBg: string;\n softHover: string;\n softActive: string;\n outline: string;\n onSolidText: string;\n}\n\nexport interface SurfaceSemantics {\n default: string;\n subtle: string;\n raised: string;\n}\n\nexport interface ContentSemantics {\n default: string;\n muted: string;\n subtle: string;\n inverse: string;\n}\n\nexport interface BorderSemantics {\n default: string;\n strong: string;\n focus: string;\n}\n\nexport interface ActionSemantics {\n primary: RoleSemantics;\n neutral: RoleSemantics;\n danger: RoleSemantics;\n}\n\nexport interface ThemeSemantics {\n neutral: NeutralSemantics;\n brand: RoleSemantics;\n secondary: RoleSemantics;\n accent: RoleSemantics;\n highlight: RoleSemantics;\n danger: RoleSemantics;\n success: RoleSemantics;\n warning: RoleSemantics;\n surface: SurfaceSemantics;\n content: ContentSemantics;\n border: BorderSemantics;\n action: ActionSemantics;\n}\n\nexport type FontWeight =\n | '100'\n | '200'\n | '300'\n | '400'\n | '500'\n | '600'\n | '700'\n | '800'\n | '900'\n | 'bold'\n | 'normal';\n\nexport interface ThemeTokens {\n colors: {\n primary: string;\n secondary: string;\n accent: string;\n highlight: string;\n background: string;\n surface: string;\n text: string;\n textSecondary: string;\n border: string;\n error: string;\n success: string;\n warning: string;\n [key: string]: string;\n };\n swatches: GeneratedThemeSwatches;\n semantics: ThemeSemantics;\n spacing: {\n none: 0;\n xs: number;\n s: number;\n m: number;\n l: number;\n xl: number;\n xxl: number;\n [key: string]: number;\n };\n radii: {\n none: 0;\n s: number;\n m: number;\n l: number;\n full: number;\n };\n typography: {\n headings: Record<\n 1 | 2 | 3 | 4 | 5 | 6,\n {\n size: number;\n lineHeight: number;\n weight: 'regular' | 'medium' | 'semiBold' | 'bold';\n }\n >;\n sizes: {\n xs: number;\n s: number;\n m: number;\n l: number;\n xl: number;\n xxl: number;\n '3xl': number;\n h1: number;\n h2: number;\n h3: number;\n h4: number;\n h5: number;\n h6: number;\n [key: string]: number;\n };\n weights: {\n thin: FontWeight;\n extraLight: FontWeight;\n light: FontWeight;\n regular: FontWeight;\n medium: FontWeight;\n semiBold: FontWeight;\n bold: FontWeight;\n extraBold: FontWeight;\n black: FontWeight;\n };\n fonts: {\n /** Map of weight -> fontFamily name for normal style */\n normal: Record<FontWeight, string | undefined>;\n /** Map of weight -> fontFamily name for italic style */\n italic: Record<FontWeight, string | undefined>;\n };\n };\n shadows: {\n soft: number;\n medium: number;\n hard: number;\n [key: string]: number;\n };\n}\n\nexport interface SurfaceTheme extends ThemeTokens {\n config: ContractsThemeConfig;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/surface",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "1.0.0",
|
|
5
5
|
"description": "Stable UI foundation for React Native and React Native Web.",
|
|
6
6
|
"homepage": "https://github.com/ankhorage/surface#readme",
|
|
7
7
|
"bugs": {
|
|
@@ -41,9 +41,8 @@
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@ankhorage/
|
|
45
|
-
"@
|
|
46
|
-
"culori": "^4.0.2"
|
|
44
|
+
"@ankhorage/color-theory": "^0.0.2",
|
|
45
|
+
"@ankhorage/contracts": "^1.1.0"
|
|
47
46
|
},
|
|
48
47
|
"files": [
|
|
49
48
|
"dist",
|
|
@@ -72,6 +71,7 @@
|
|
|
72
71
|
"lint": "eslint . --max-warnings=0",
|
|
73
72
|
"lint:fix": "eslint . --fix --max-warnings=0",
|
|
74
73
|
"format": "prettier --write .",
|
|
74
|
+
"format:check": "prettier --check .",
|
|
75
75
|
"prepack": "bun run build",
|
|
76
76
|
"test": "bun test src",
|
|
77
77
|
"version-packages": "changeset version"
|
|
@@ -30,12 +30,10 @@ const docsThemeConfig = {
|
|
|
30
30
|
light: {
|
|
31
31
|
harmony: 'monochromatic' as const,
|
|
32
32
|
primaryColor: '#2563eb',
|
|
33
|
-
colorTone: 'neutral' as const,
|
|
34
33
|
},
|
|
35
34
|
dark: {
|
|
36
35
|
harmony: 'monochromatic' as const,
|
|
37
36
|
primaryColor: '#2563eb',
|
|
38
|
-
colorTone: 'neutral' as const,
|
|
39
37
|
},
|
|
40
38
|
};
|
|
41
39
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SurfaceTheme } from '../../theme/types';
|
|
2
2
|
|
|
3
3
|
export type ControlSize = 's' | 'm' | 'l';
|
|
4
4
|
|
|
@@ -11,7 +11,10 @@ export interface ResolvedControlSize {
|
|
|
11
11
|
iconSize: number;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export function resolveControlSize(
|
|
14
|
+
export function resolveControlSize(
|
|
15
|
+
theme: SurfaceTheme,
|
|
16
|
+
size: ControlSize = 'm',
|
|
17
|
+
): ResolvedControlSize {
|
|
15
18
|
switch (size) {
|
|
16
19
|
case 's':
|
|
17
20
|
return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SurfaceTheme } from '../../theme/types';
|
|
2
2
|
import { type ControlSize, resolveControlSize } from './resolveControlSize';
|
|
3
3
|
|
|
4
|
-
export function resolveIconSize(theme:
|
|
4
|
+
export function resolveIconSize(theme: SurfaceTheme, size: ControlSize = 'm'): number {
|
|
5
5
|
return resolveControlSize(theme, size).iconSize;
|
|
6
6
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SurfaceTheme } from '../../theme/types';
|
|
2
2
|
import type { FieldState } from './resolveFieldState';
|
|
3
3
|
import type { InteractionState } from './resolveInteractiveState';
|
|
4
4
|
import { type ComponentTone, resolveTone } from './resolveTone';
|
|
@@ -13,7 +13,7 @@ export interface ResolvedInteractiveColors {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export function resolveButtonColors(
|
|
16
|
-
theme:
|
|
16
|
+
theme: SurfaceTheme,
|
|
17
17
|
{
|
|
18
18
|
variant,
|
|
19
19
|
tone,
|
|
@@ -81,7 +81,7 @@ export function resolveButtonColors(
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
export function resolveInputColors(
|
|
84
|
-
theme:
|
|
84
|
+
theme: SurfaceTheme,
|
|
85
85
|
fieldState: FieldState,
|
|
86
86
|
): ResolvedInteractiveColors & { placeholderColor: string } {
|
|
87
87
|
if (fieldState.disabled) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SurfaceTheme } from '../../theme/types';
|
|
2
2
|
import type { FieldState } from './resolveFieldState';
|
|
3
3
|
import { type ComponentTone, resolveTone } from './resolveTone';
|
|
4
4
|
|
|
@@ -13,7 +13,7 @@ export interface ResolvedSelectionControlColors {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export function resolveSelectionControlColors(
|
|
16
|
-
theme:
|
|
16
|
+
theme: SurfaceTheme,
|
|
17
17
|
{
|
|
18
18
|
tone = 'primary',
|
|
19
19
|
fieldState,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resolveToken } from '../../theme/resolveToken';
|
|
2
|
-
import type {
|
|
2
|
+
import type { SurfaceTheme } from '../../theme/types';
|
|
3
3
|
|
|
4
4
|
export type TextTone =
|
|
5
5
|
| 'default'
|
|
@@ -9,10 +9,10 @@ export type TextTone =
|
|
|
9
9
|
| 'danger'
|
|
10
10
|
| 'success'
|
|
11
11
|
| 'warning';
|
|
12
|
-
export type TextColorValue = keyof
|
|
12
|
+
export type TextColorValue = keyof SurfaceTheme['colors'] | string;
|
|
13
13
|
|
|
14
14
|
export function resolveTextColor(
|
|
15
|
-
theme:
|
|
15
|
+
theme: SurfaceTheme,
|
|
16
16
|
tone: TextTone = 'default',
|
|
17
17
|
color?: TextColorValue,
|
|
18
18
|
): string {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { TextStyle } from 'react-native';
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type { FontWeight, SurfaceTheme } from '../../theme/types';
|
|
4
4
|
|
|
5
5
|
export type TextVariant = 'body' | 'bodySmall' | 'caption' | 'label' | 'mono';
|
|
6
|
-
export type TextWeight = keyof
|
|
6
|
+
export type TextWeight = keyof SurfaceTheme['typography']['weights'] | FontWeight;
|
|
7
7
|
|
|
8
8
|
interface VariantStyle {
|
|
9
9
|
fontSize: number;
|
|
@@ -19,15 +19,15 @@ export interface ResolveTextStyleOptions {
|
|
|
19
19
|
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
function resolveWeight(theme:
|
|
22
|
+
function resolveWeight(theme: SurfaceTheme, value: TextWeight | undefined): FontWeight {
|
|
23
23
|
if (!value) return theme.typography.weights.regular;
|
|
24
24
|
if (value in theme.typography.weights) {
|
|
25
|
-
return theme.typography.weights[value as keyof
|
|
25
|
+
return theme.typography.weights[value as keyof SurfaceTheme['typography']['weights']];
|
|
26
26
|
}
|
|
27
27
|
return value as FontWeight;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
function getVariantStyle(theme:
|
|
30
|
+
function getVariantStyle(theme: SurfaceTheme, variant: TextVariant): VariantStyle {
|
|
31
31
|
switch (variant) {
|
|
32
32
|
case 'bodySmall':
|
|
33
33
|
return {
|
|
@@ -64,7 +64,7 @@ function getVariantStyle(theme: AnkhTheme, variant: TextVariant): VariantStyle {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
export function resolveTextStyles(
|
|
67
|
-
theme:
|
|
67
|
+
theme: SurfaceTheme,
|
|
68
68
|
options: ResolveTextStyleOptions = {},
|
|
69
69
|
): TextStyle {
|
|
70
70
|
const { level, variant = 'body', align, weight, italic = false } = options;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RoleSemantics, SurfaceTheme } from '../../theme/types';
|
|
2
2
|
|
|
3
3
|
export type ComponentTone = 'primary' | 'neutral' | 'danger' | 'success' | 'warning';
|
|
4
4
|
|
|
5
|
-
export function resolveTone(theme:
|
|
5
|
+
export function resolveTone(theme: SurfaceTheme, tone: ComponentTone = 'primary'): RoleSemantics {
|
|
6
6
|
switch (tone) {
|
|
7
7
|
case 'neutral':
|
|
8
8
|
return theme.semantics.action.neutral;
|
package/src/layout/Container.tsx
CHANGED
|
@@ -3,14 +3,14 @@ import { View } from 'react-native';
|
|
|
3
3
|
|
|
4
4
|
import { resolveResponsive, type Responsive, useResponsiveRuntime } from '../core/responsive';
|
|
5
5
|
import { useTheme } from '../theme/ThemeContext';
|
|
6
|
-
import type {
|
|
6
|
+
import type { SurfaceTheme } from '../theme/types';
|
|
7
7
|
import { Box, type BoxProps } from './Box';
|
|
8
8
|
import { resolveSpacing } from './helpers';
|
|
9
9
|
|
|
10
10
|
export interface ContainerProps extends Omit<BoxProps, 'children'> {
|
|
11
11
|
children?: React.ReactNode;
|
|
12
12
|
maxWidth?: Responsive<number>;
|
|
13
|
-
px?: Responsive<number | keyof
|
|
13
|
+
px?: Responsive<number | keyof SurfaceTheme['spacing']>;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export function Container({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, test } from 'bun:test';
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type { SurfaceTheme } from '../theme/types';
|
|
4
4
|
import { resolveBoxStyles } from './helpers';
|
|
5
5
|
|
|
6
6
|
const mockTheme = {
|
|
@@ -16,7 +16,7 @@ const mockTheme = {
|
|
|
16
16
|
primary: '#007AFF',
|
|
17
17
|
surface: '#FFFFFF',
|
|
18
18
|
},
|
|
19
|
-
} as unknown as
|
|
19
|
+
} as unknown as SurfaceTheme;
|
|
20
20
|
|
|
21
21
|
describe('resolveBoxStyles', () => {
|
|
22
22
|
test('resolves padding and margins correctly', () => {
|
package/src/layout/helpers.ts
CHANGED
|
@@ -3,11 +3,11 @@ import type { StyleProp, ViewStyle } from 'react-native';
|
|
|
3
3
|
import { resolveResponsive } from '../core/responsive/resolve';
|
|
4
4
|
import type { Breakpoint, Responsive } from '../core/responsive/types';
|
|
5
5
|
import { resolveToken } from '../theme/resolveToken';
|
|
6
|
-
import type {
|
|
6
|
+
import type { SurfaceTheme } from '../theme/types';
|
|
7
7
|
|
|
8
|
-
type SpaceToken = keyof
|
|
9
|
-
type RadiusToken = keyof
|
|
10
|
-
type ColorToken = keyof
|
|
8
|
+
type SpaceToken = keyof SurfaceTheme['spacing'];
|
|
9
|
+
type RadiusToken = keyof SurfaceTheme['radii'];
|
|
10
|
+
type ColorToken = keyof SurfaceTheme['colors'];
|
|
11
11
|
|
|
12
12
|
export type SpaceValue = number | SpaceToken;
|
|
13
13
|
export type RadiusValue = number | RadiusToken;
|
|
@@ -55,7 +55,7 @@ export interface BoxStyleProps {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
export function resolveSpacing(
|
|
58
|
-
theme:
|
|
58
|
+
theme: SurfaceTheme,
|
|
59
59
|
value: SpaceValue | undefined,
|
|
60
60
|
): number | undefined {
|
|
61
61
|
if (value === undefined) return undefined;
|
|
@@ -64,7 +64,7 @@ export function resolveSpacing(
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
export function resolveRadius(
|
|
67
|
-
theme:
|
|
67
|
+
theme: SurfaceTheme,
|
|
68
68
|
value: RadiusValue | undefined,
|
|
69
69
|
): number | undefined {
|
|
70
70
|
if (value === undefined) return undefined;
|
|
@@ -72,7 +72,10 @@ export function resolveRadius(
|
|
|
72
72
|
return theme.radii[value];
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
export function resolveColor(
|
|
75
|
+
export function resolveColor(
|
|
76
|
+
theme: SurfaceTheme,
|
|
77
|
+
value: ColorValue | undefined,
|
|
78
|
+
): string | undefined {
|
|
76
79
|
if (value === undefined) return undefined;
|
|
77
80
|
if (Object.prototype.hasOwnProperty.call(theme.colors, value)) {
|
|
78
81
|
return theme.colors[value];
|
|
@@ -81,7 +84,7 @@ export function resolveColor(theme: AnkhTheme, value: ColorValue | undefined): s
|
|
|
81
84
|
}
|
|
82
85
|
|
|
83
86
|
export function resolveDimension(
|
|
84
|
-
theme:
|
|
87
|
+
theme: SurfaceTheme,
|
|
85
88
|
value: number | string | undefined,
|
|
86
89
|
): number | string | undefined {
|
|
87
90
|
if (value === undefined || typeof value === 'number') return value;
|
|
@@ -93,7 +96,7 @@ function assignIfDefined<T, K extends keyof T>(target: T, key: K, value: T[K] |
|
|
|
93
96
|
}
|
|
94
97
|
|
|
95
98
|
export function resolveBoxStyles(
|
|
96
|
-
theme:
|
|
99
|
+
theme: SurfaceTheme,
|
|
97
100
|
breakpoint: Breakpoint,
|
|
98
101
|
props: BoxStyleProps,
|
|
99
102
|
): ViewStyle {
|
|
@@ -2,11 +2,11 @@ import type { TextStyle } from 'react-native';
|
|
|
2
2
|
|
|
3
3
|
import { resolveTextColor } from '../../internal/resolvers/resolveTextColor';
|
|
4
4
|
import { resolveTextStyles } from '../../internal/resolvers/resolveTextStyles';
|
|
5
|
-
import type {
|
|
5
|
+
import type { SurfaceTheme } from '../../theme/types';
|
|
6
6
|
import type { HeadingLevel, HeadingProps } from './types';
|
|
7
7
|
|
|
8
8
|
export function resolveHeadingTextStyle(
|
|
9
|
-
theme:
|
|
9
|
+
theme: SurfaceTheme,
|
|
10
10
|
level: HeadingLevel,
|
|
11
11
|
align?: HeadingProps['align'],
|
|
12
12
|
): TextStyle {
|
|
@@ -3,7 +3,7 @@ import { type StyleProp, type TextStyle } from 'react-native';
|
|
|
3
3
|
|
|
4
4
|
import { resolveToken } from '../../theme/resolveToken';
|
|
5
5
|
import { useTheme } from '../../theme/ThemeContext';
|
|
6
|
-
import type {
|
|
6
|
+
import type { SurfaceTheme } from '../../theme/types';
|
|
7
7
|
import { resolveExpoIconComponent } from './resolveExpoIconComponent';
|
|
8
8
|
|
|
9
9
|
export type IconProvider = string;
|
|
@@ -11,8 +11,8 @@ export type IconProvider = string;
|
|
|
11
11
|
export interface IconProps {
|
|
12
12
|
name: string;
|
|
13
13
|
provider?: IconProvider;
|
|
14
|
-
size?: keyof
|
|
15
|
-
color?: keyof
|
|
14
|
+
size?: keyof SurfaceTheme['spacing'] | number;
|
|
15
|
+
color?: keyof SurfaceTheme['colors'] | string;
|
|
16
16
|
style?: StyleProp<TextStyle>;
|
|
17
17
|
testID?: string;
|
|
18
18
|
}
|
|
@@ -6,12 +6,12 @@ import { OverlayProvider } from '../internal/overlay/OverlayProvider';
|
|
|
6
6
|
import { isDeepEqual } from '../utils/deepEqual';
|
|
7
7
|
import { deepMerge } from '../utils/deepMerge';
|
|
8
8
|
import { createTheme } from './createTheme';
|
|
9
|
-
import type {
|
|
9
|
+
import type { SurfaceTheme, ThemeConfig } from './types';
|
|
10
10
|
|
|
11
11
|
const defaultTheme = createTheme();
|
|
12
12
|
|
|
13
13
|
export const ThemeContext = createContext<{
|
|
14
|
-
theme:
|
|
14
|
+
theme: SurfaceTheme;
|
|
15
15
|
mode: 'light' | 'dark';
|
|
16
16
|
setThemeConfig: (config: Partial<ThemeConfig>) => void;
|
|
17
17
|
setMode: (mode: 'light' | 'dark') => void;
|