@chipmobilesdk/rn-theme 1.2.0 → 1.3.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 +111 -0
- package/README.md +3 -1
- package/lib/commonjs/color/categorical.js +35 -0
- package/lib/commonjs/color/categorical.js.map +1 -0
- package/lib/commonjs/color/contrast.js +199 -0
- package/lib/commonjs/color/contrast.js.map +1 -0
- package/lib/commonjs/color/parse.js +110 -0
- package/lib/commonjs/color/parse.js.map +1 -0
- package/lib/commonjs/color/roles.js +235 -0
- package/lib/commonjs/color/roles.js.map +1 -0
- package/lib/commonjs/index.js +94 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/integration/navigationTheme.js +43 -0
- package/lib/commonjs/integration/navigationTheme.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/presets/byTone.js +28 -0
- package/lib/commonjs/presets/byTone.js.map +1 -0
- package/lib/commonjs/presets/layout.js +67 -0
- package/lib/commonjs/presets/layout.js.map +1 -0
- package/lib/commonjs/presets/themePresets.js +115 -0
- package/lib/commonjs/presets/themePresets.js.map +1 -0
- package/lib/commonjs/theme/buildThemes.js +211 -0
- package/lib/commonjs/theme/buildThemes.js.map +1 -0
- package/lib/commonjs/theme/errors.js +49 -0
- package/lib/commonjs/theme/errors.js.map +1 -0
- package/lib/commonjs/theme/overrides.js +125 -0
- package/lib/commonjs/theme/overrides.js.map +1 -0
- package/lib/commonjs/theme/validateThemeConfig.js +157 -0
- package/lib/commonjs/theme/validateThemeConfig.js.map +1 -0
- package/lib/commonjs/tokens/defaults.js +132 -0
- package/lib/commonjs/tokens/defaults.js.map +1 -0
- package/lib/commonjs/tokens/typography.js +136 -0
- package/lib/commonjs/tokens/typography.js.map +1 -0
- package/lib/commonjs/types/brand.js +2 -0
- package/lib/commonjs/types/brand.js.map +1 -0
- package/lib/commonjs/types/colors.js +2 -0
- package/lib/commonjs/types/colors.js.map +1 -0
- package/lib/commonjs/types/index.js +2 -0
- package/lib/commonjs/types/index.js.map +1 -0
- package/lib/commonjs/types/theme.js +6 -0
- package/lib/commonjs/types/theme.js.map +1 -0
- package/lib/commonjs/types/tokens.js +2 -0
- package/lib/commonjs/types/tokens.js.map +1 -0
- package/lib/commonjs/types/typography.js +2 -0
- package/lib/commonjs/types/typography.js.map +1 -0
- package/lib/commonjs/unistyles/createUnistylesConfig.js +113 -0
- package/lib/commonjs/unistyles/createUnistylesConfig.js.map +1 -0
- package/lib/commonjs/unistyles/themeMode.js +39 -0
- package/lib/commonjs/unistyles/themeMode.js.map +1 -0
- package/lib/commonjs/vendor/mcu/LICENSE +191 -0
- package/lib/commonjs/vendor/mcu/hct/cam16.js +362 -0
- package/lib/commonjs/vendor/mcu/hct/cam16.js.map +1 -0
- package/lib/commonjs/vendor/mcu/hct/hct.js +183 -0
- package/lib/commonjs/vendor/mcu/hct/hct.js.map +1 -0
- package/lib/commonjs/vendor/mcu/hct/hct_solver.js +401 -0
- package/lib/commonjs/vendor/mcu/hct/hct_solver.js.map +1 -0
- package/lib/commonjs/vendor/mcu/hct/viewing_conditions.js +116 -0
- package/lib/commonjs/vendor/mcu/hct/viewing_conditions.js.map +1 -0
- package/lib/commonjs/vendor/mcu/index.js +27 -0
- package/lib/commonjs/vendor/mcu/index.js.map +1 -0
- package/lib/commonjs/vendor/mcu/palettes/tonal_palette.js +177 -0
- package/lib/commonjs/vendor/mcu/palettes/tonal_palette.js.map +1 -0
- package/lib/commonjs/vendor/mcu/utils/color_utils.js +298 -0
- package/lib/commonjs/vendor/mcu/utils/color_utils.js.map +1 -0
- package/lib/commonjs/vendor/mcu/utils/math_utils.js +158 -0
- package/lib/commonjs/vendor/mcu/utils/math_utils.js.map +1 -0
- package/lib/module/color/categorical.js +31 -0
- package/lib/module/color/categorical.js.map +1 -0
- package/lib/module/color/contrast.js +194 -0
- package/lib/module/color/contrast.js.map +1 -0
- package/lib/module/color/parse.js +101 -0
- package/lib/module/color/parse.js.map +1 -0
- package/lib/module/color/roles.js +229 -0
- package/lib/module/color/roles.js.map +1 -0
- package/lib/module/index.js +23 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/integration/navigationTheme.js +39 -0
- package/lib/module/integration/navigationTheme.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/presets/byTone.js +24 -0
- package/lib/module/presets/byTone.js.map +1 -0
- package/lib/module/presets/layout.js +63 -0
- package/lib/module/presets/layout.js.map +1 -0
- package/lib/module/presets/themePresets.js +110 -0
- package/lib/module/presets/themePresets.js.map +1 -0
- package/lib/module/theme/buildThemes.js +208 -0
- package/lib/module/theme/buildThemes.js.map +1 -0
- package/lib/module/theme/errors.js +43 -0
- package/lib/module/theme/errors.js.map +1 -0
- package/lib/module/theme/overrides.js +119 -0
- package/lib/module/theme/overrides.js.map +1 -0
- package/lib/module/theme/validateThemeConfig.js +152 -0
- package/lib/module/theme/validateThemeConfig.js.map +1 -0
- package/lib/module/tokens/defaults.js +120 -0
- package/lib/module/tokens/defaults.js.map +1 -0
- package/lib/module/tokens/typography.js +129 -0
- package/lib/module/tokens/typography.js.map +1 -0
- package/lib/module/types/brand.js +2 -0
- package/lib/module/types/brand.js.map +1 -0
- package/lib/module/types/colors.js +2 -0
- package/lib/module/types/colors.js.map +1 -0
- package/lib/module/types/index.js +2 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/module/types/theme.js +4 -0
- package/lib/module/types/theme.js.map +1 -0
- package/lib/module/types/tokens.js +2 -0
- package/lib/module/types/tokens.js.map +1 -0
- package/lib/module/types/typography.js +2 -0
- package/lib/module/types/typography.js.map +1 -0
- package/lib/module/unistyles/createUnistylesConfig.js +109 -0
- package/lib/module/unistyles/createUnistylesConfig.js.map +1 -0
- package/lib/module/unistyles/themeMode.js +36 -0
- package/lib/module/unistyles/themeMode.js.map +1 -0
- package/lib/module/vendor/mcu/LICENSE +191 -0
- package/lib/module/vendor/mcu/hct/cam16.js +356 -0
- package/lib/module/vendor/mcu/hct/cam16.js.map +1 -0
- package/lib/module/vendor/mcu/hct/hct.js +178 -0
- package/lib/module/vendor/mcu/hct/hct.js.map +1 -0
- package/lib/module/vendor/mcu/hct/hct_solver.js +396 -0
- package/lib/module/vendor/mcu/hct/hct_solver.js.map +1 -0
- package/lib/module/vendor/mcu/hct/viewing_conditions.js +110 -0
- package/lib/module/vendor/mcu/hct/viewing_conditions.js.map +1 -0
- package/lib/module/vendor/mcu/index.js +8 -0
- package/lib/module/vendor/mcu/index.js.map +1 -0
- package/lib/module/vendor/mcu/palettes/tonal_palette.js +172 -0
- package/lib/module/vendor/mcu/palettes/tonal_palette.js.map +1 -0
- package/lib/module/vendor/mcu/utils/color_utils.js +277 -0
- package/lib/module/vendor/mcu/utils/color_utils.js.map +1 -0
- package/lib/module/vendor/mcu/utils/math_utils.js +146 -0
- package/lib/module/vendor/mcu/utils/math_utils.js.map +1 -0
- package/lib/typescript/commonjs/color/categorical.d.ts +7 -0
- package/lib/typescript/commonjs/color/categorical.d.ts.map +1 -0
- package/lib/typescript/commonjs/color/contrast.d.ts +26 -0
- package/lib/typescript/commonjs/color/contrast.d.ts.map +1 -0
- package/lib/typescript/commonjs/color/parse.d.ts +25 -0
- package/lib/typescript/commonjs/color/parse.d.ts.map +1 -0
- package/lib/typescript/commonjs/color/roles.d.ts +26 -0
- package/lib/typescript/commonjs/color/roles.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +18 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/integration/navigationTheme.d.ts +30 -0
- package/lib/typescript/commonjs/integration/navigationTheme.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/presets/byTone.d.ts +19 -0
- package/lib/typescript/commonjs/presets/byTone.d.ts.map +1 -0
- package/lib/typescript/commonjs/presets/layout.d.ts +63 -0
- package/lib/typescript/commonjs/presets/layout.d.ts.map +1 -0
- package/lib/typescript/commonjs/presets/themePresets.d.ts +11 -0
- package/lib/typescript/commonjs/presets/themePresets.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/buildThemes.d.ts +18 -0
- package/lib/typescript/commonjs/theme/buildThemes.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/errors.d.ts +23 -0
- package/lib/typescript/commonjs/theme/errors.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/overrides.d.ts +11 -0
- package/lib/typescript/commonjs/theme/overrides.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/validateThemeConfig.d.ts +6 -0
- package/lib/typescript/commonjs/theme/validateThemeConfig.d.ts.map +1 -0
- package/lib/typescript/commonjs/tokens/defaults.d.ts +23 -0
- package/lib/typescript/commonjs/tokens/defaults.d.ts.map +1 -0
- package/lib/typescript/commonjs/tokens/typography.d.ts +14 -0
- package/lib/typescript/commonjs/tokens/typography.d.ts.map +1 -0
- package/lib/typescript/commonjs/types/brand.d.ts +21 -0
- package/lib/typescript/commonjs/types/brand.d.ts.map +1 -0
- package/lib/typescript/commonjs/types/colors.d.ts +76 -0
- package/lib/typescript/commonjs/types/colors.d.ts.map +1 -0
- package/lib/typescript/commonjs/types/index.d.ts +6 -0
- package/lib/typescript/commonjs/types/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/types/theme.d.ts +140 -0
- package/lib/typescript/commonjs/types/theme.d.ts.map +1 -0
- package/lib/typescript/commonjs/types/tokens.d.ts +79 -0
- package/lib/typescript/commonjs/types/tokens.d.ts.map +1 -0
- package/lib/typescript/commonjs/types/typography.d.ts +53 -0
- package/lib/typescript/commonjs/types/typography.d.ts.map +1 -0
- package/lib/typescript/commonjs/unistyles/createUnistylesConfig.d.ts +52 -0
- package/lib/typescript/commonjs/unistyles/createUnistylesConfig.d.ts.map +1 -0
- package/lib/typescript/commonjs/unistyles/themeMode.d.ts +13 -0
- package/lib/typescript/commonjs/unistyles/themeMode.d.ts.map +1 -0
- package/lib/typescript/commonjs/vendor/mcu/hct/cam16.d.ts +132 -0
- package/lib/typescript/commonjs/vendor/mcu/hct/cam16.d.ts.map +1 -0
- package/lib/typescript/commonjs/vendor/mcu/hct/hct.d.ts +93 -0
- package/lib/typescript/commonjs/vendor/mcu/hct/hct.d.ts.map +1 -0
- package/lib/typescript/commonjs/vendor/mcu/hct/hct_solver.d.ts +147 -0
- package/lib/typescript/commonjs/vendor/mcu/hct/hct_solver.d.ts.map +1 -0
- package/lib/typescript/commonjs/vendor/mcu/hct/viewing_conditions.d.ts +75 -0
- package/lib/typescript/commonjs/vendor/mcu/hct/viewing_conditions.d.ts.map +1 -0
- package/lib/typescript/commonjs/vendor/mcu/index.d.ts +4 -0
- package/lib/typescript/commonjs/vendor/mcu/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/vendor/mcu/palettes/tonal_palette.d.ts +56 -0
- package/lib/typescript/commonjs/vendor/mcu/palettes/tonal_palette.d.ts.map +1 -0
- package/lib/typescript/commonjs/vendor/mcu/utils/color_utils.d.ts +129 -0
- package/lib/typescript/commonjs/vendor/mcu/utils/color_utils.d.ts.map +1 -0
- package/lib/typescript/commonjs/vendor/mcu/utils/math_utils.d.ts +83 -0
- package/lib/typescript/commonjs/vendor/mcu/utils/math_utils.d.ts.map +1 -0
- package/lib/typescript/module/color/categorical.d.ts +7 -0
- package/lib/typescript/module/color/categorical.d.ts.map +1 -0
- package/lib/typescript/module/color/contrast.d.ts +26 -0
- package/lib/typescript/module/color/contrast.d.ts.map +1 -0
- package/lib/typescript/module/color/parse.d.ts +25 -0
- package/lib/typescript/module/color/parse.d.ts.map +1 -0
- package/lib/typescript/module/color/roles.d.ts +26 -0
- package/lib/typescript/module/color/roles.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +18 -0
- package/lib/typescript/module/index.d.ts.map +1 -0
- package/lib/typescript/module/integration/navigationTheme.d.ts +30 -0
- package/lib/typescript/module/integration/navigationTheme.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/presets/byTone.d.ts +19 -0
- package/lib/typescript/module/presets/byTone.d.ts.map +1 -0
- package/lib/typescript/module/presets/layout.d.ts +63 -0
- package/lib/typescript/module/presets/layout.d.ts.map +1 -0
- package/lib/typescript/module/presets/themePresets.d.ts +11 -0
- package/lib/typescript/module/presets/themePresets.d.ts.map +1 -0
- package/lib/typescript/module/theme/buildThemes.d.ts +18 -0
- package/lib/typescript/module/theme/buildThemes.d.ts.map +1 -0
- package/lib/typescript/module/theme/errors.d.ts +23 -0
- package/lib/typescript/module/theme/errors.d.ts.map +1 -0
- package/lib/typescript/module/theme/overrides.d.ts +11 -0
- package/lib/typescript/module/theme/overrides.d.ts.map +1 -0
- package/lib/typescript/module/theme/validateThemeConfig.d.ts +6 -0
- package/lib/typescript/module/theme/validateThemeConfig.d.ts.map +1 -0
- package/lib/typescript/module/tokens/defaults.d.ts +23 -0
- package/lib/typescript/module/tokens/defaults.d.ts.map +1 -0
- package/lib/typescript/module/tokens/typography.d.ts +14 -0
- package/lib/typescript/module/tokens/typography.d.ts.map +1 -0
- package/lib/typescript/module/types/brand.d.ts +21 -0
- package/lib/typescript/module/types/brand.d.ts.map +1 -0
- package/lib/typescript/module/types/colors.d.ts +76 -0
- package/lib/typescript/module/types/colors.d.ts.map +1 -0
- package/lib/typescript/module/types/index.d.ts +6 -0
- package/lib/typescript/module/types/index.d.ts.map +1 -0
- package/lib/typescript/module/types/theme.d.ts +140 -0
- package/lib/typescript/module/types/theme.d.ts.map +1 -0
- package/lib/typescript/module/types/tokens.d.ts +79 -0
- package/lib/typescript/module/types/tokens.d.ts.map +1 -0
- package/lib/typescript/module/types/typography.d.ts +53 -0
- package/lib/typescript/module/types/typography.d.ts.map +1 -0
- package/lib/typescript/module/unistyles/createUnistylesConfig.d.ts +52 -0
- package/lib/typescript/module/unistyles/createUnistylesConfig.d.ts.map +1 -0
- package/lib/typescript/module/unistyles/themeMode.d.ts +13 -0
- package/lib/typescript/module/unistyles/themeMode.d.ts.map +1 -0
- package/lib/typescript/module/vendor/mcu/hct/cam16.d.ts +132 -0
- package/lib/typescript/module/vendor/mcu/hct/cam16.d.ts.map +1 -0
- package/lib/typescript/module/vendor/mcu/hct/hct.d.ts +93 -0
- package/lib/typescript/module/vendor/mcu/hct/hct.d.ts.map +1 -0
- package/lib/typescript/module/vendor/mcu/hct/hct_solver.d.ts +147 -0
- package/lib/typescript/module/vendor/mcu/hct/hct_solver.d.ts.map +1 -0
- package/lib/typescript/module/vendor/mcu/hct/viewing_conditions.d.ts +75 -0
- package/lib/typescript/module/vendor/mcu/hct/viewing_conditions.d.ts.map +1 -0
- package/lib/typescript/module/vendor/mcu/index.d.ts +4 -0
- package/lib/typescript/module/vendor/mcu/index.d.ts.map +1 -0
- package/lib/typescript/module/vendor/mcu/palettes/tonal_palette.d.ts +56 -0
- package/lib/typescript/module/vendor/mcu/palettes/tonal_palette.d.ts.map +1 -0
- package/lib/typescript/module/vendor/mcu/utils/color_utils.d.ts +129 -0
- package/lib/typescript/module/vendor/mcu/utils/color_utils.d.ts.map +1 -0
- package/lib/typescript/module/vendor/mcu/utils/math_utils.d.ts +83 -0
- package/lib/typescript/module/vendor/mcu/utils/math_utils.d.ts.map +1 -0
- package/package.json +40 -16
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export type ColorScheme = 'light' | 'dark';
|
|
2
|
+
/** Colours whose roles come in sets of four: X, onX, XContainer, onXContainer. */
|
|
3
|
+
export type AccentRoleName = 'primary' | 'secondary' | 'tertiary' | 'error' | 'success' | 'warning' | 'info';
|
|
4
|
+
export interface ColorRoles {
|
|
5
|
+
primary: string;
|
|
6
|
+
onPrimary: string;
|
|
7
|
+
primaryContainer: string;
|
|
8
|
+
onPrimaryContainer: string;
|
|
9
|
+
secondary: string;
|
|
10
|
+
onSecondary: string;
|
|
11
|
+
secondaryContainer: string;
|
|
12
|
+
onSecondaryContainer: string;
|
|
13
|
+
tertiary: string;
|
|
14
|
+
onTertiary: string;
|
|
15
|
+
tertiaryContainer: string;
|
|
16
|
+
onTertiaryContainer: string;
|
|
17
|
+
/** Error text/fill; ≥ 4.5:1 on `background` and `surface`. */
|
|
18
|
+
error: string;
|
|
19
|
+
onError: string;
|
|
20
|
+
errorContainer: string;
|
|
21
|
+
onErrorContainer: string;
|
|
22
|
+
success: string;
|
|
23
|
+
onSuccess: string;
|
|
24
|
+
successContainer: string;
|
|
25
|
+
onSuccessContainer: string;
|
|
26
|
+
warning: string;
|
|
27
|
+
onWarning: string;
|
|
28
|
+
warningContainer: string;
|
|
29
|
+
onWarningContainer: string;
|
|
30
|
+
info: string;
|
|
31
|
+
onInfo: string;
|
|
32
|
+
infoContainer: string;
|
|
33
|
+
onInfoContainer: string;
|
|
34
|
+
background: string;
|
|
35
|
+
onBackground: string;
|
|
36
|
+
surface: string;
|
|
37
|
+
onSurface: string;
|
|
38
|
+
surfaceVariant: string;
|
|
39
|
+
/** Muted text; ≥ 4.5:1 on `background`, `surface` and `surfaceVariant`. */
|
|
40
|
+
onSurfaceVariant: string;
|
|
41
|
+
surfaceContainerLowest: string;
|
|
42
|
+
surfaceContainerLow: string;
|
|
43
|
+
surfaceContainer: string;
|
|
44
|
+
surfaceContainerHigh: string;
|
|
45
|
+
surfaceContainerHighest: string;
|
|
46
|
+
inverseSurface: string;
|
|
47
|
+
inverseOnSurface: string;
|
|
48
|
+
inversePrimary: string;
|
|
49
|
+
/** Boundary of interactive components; ≥ 3:1 on `background` and `surface`. */
|
|
50
|
+
outline: string;
|
|
51
|
+
/** Decorative dividers; no contrast guarantee. */
|
|
52
|
+
outlineVariant: string;
|
|
53
|
+
scrim: string;
|
|
54
|
+
shadow: string;
|
|
55
|
+
/**
|
|
56
|
+
* Inactive content. A state colour, exempt from contrast targets
|
|
57
|
+
* (WCAG 1.4.3) — never use it for readable muted text; that is
|
|
58
|
+
* `onSurfaceVariant`.
|
|
59
|
+
*/
|
|
60
|
+
disabled: string;
|
|
61
|
+
}
|
|
62
|
+
export type StandardToneName = 'neutral' | 'primary' | 'info' | 'success' | 'warning' | 'error';
|
|
63
|
+
/** A matched colour set for one tone, for use with `byTone`. */
|
|
64
|
+
export interface ToneColors {
|
|
65
|
+
/** Text or icon in this tone on `background`/`surface` (≥ 4.5:1). */
|
|
66
|
+
fg: string;
|
|
67
|
+
container: string;
|
|
68
|
+
/** Text on `container` (≥ 4.5:1). */
|
|
69
|
+
onContainer: string;
|
|
70
|
+
/** Boundary in this tone (≥ 3:1 on `background`). */
|
|
71
|
+
border: string;
|
|
72
|
+
fill: string;
|
|
73
|
+
/** Text on `fill` (≥ 4.5:1). */
|
|
74
|
+
onFill: string;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=colors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../../../src/types/colors.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;AAE3C,kFAAkF;AAClF,MAAM,MAAM,cAAc,GACzB,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC;AAEjF,MAAM,WAAW,UAAU;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,OA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AAC;IAClB,qCAAqC;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,MAAM,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { BrandColors, SeedColors } from './brand';
|
|
2
|
+
export type { AccentRoleName, ColorRoles, ColorScheme, StandardToneName, ToneColors, } from './colors';
|
|
3
|
+
export type { FontConfig, FontToken, FontWeightName, FontWeights, FontWeightValue, Typography, TypographyConfig, TypographyRole, TypographyStyleName, TypographyToken, } from './typography';
|
|
4
|
+
export type { BorderWidthTokens, EasingCurve, MotionTokens, OpacityTokens, RadiusTokens, ShadowToken, ShadowTokens, SizeTokens, SpacingKey, SpacingTokens, ZIndexTokens, } from './tokens';
|
|
5
|
+
export type { BaseTheme, BorderPresets, BoxPresets, DeepPartial, EmptyExtension, ExtendContext, InlinePreset, NamedThemeConfig, StackPreset, TextPreset, TextPresets, Theme, ThemeConfig, ThemeName, Themes, } from './theme';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACvD,YAAY,EACX,cAAc,EACd,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,UAAU,GACV,MAAM,UAAU,CAAC;AAClB,YAAY,EACX,UAAU,EACV,SAAS,EACT,cAAc,EACd,WAAW,EACX,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,eAAe,GACf,MAAM,cAAc,CAAC;AACtB,YAAY,EACX,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,UAAU,EACV,UAAU,EACV,aAAa,EACb,YAAY,GACZ,MAAM,UAAU,CAAC;AAClB,YAAY,EACX,SAAS,EACT,aAAa,EACb,UAAU,EACV,WAAW,EACX,cAAc,EACd,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,WAAW,EACX,KAAK,EACL,WAAW,EACX,SAAS,EACT,MAAM,GACN,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import type { BrandColors, SeedColors } from './brand';
|
|
2
|
+
import type { ColorRoles, ColorScheme, StandardToneName, ToneColors } from './colors';
|
|
3
|
+
import type { BorderWidthTokens, MotionTokens, OpacityTokens, RadiusTokens, ShadowTokens, SizeTokens, SpacingKey, SpacingTokens, ZIndexTokens } from './tokens';
|
|
4
|
+
import type { FontToken, FontWeightName, FontWeights, Typography, TypographyConfig, TypographyToken } from './typography';
|
|
5
|
+
export type DeepPartial<T> = {
|
|
6
|
+
[K in keyof T]?: T[K] extends readonly unknown[] ? T[K] : T[K] extends object ? DeepPartial<T[K]> : T[K];
|
|
7
|
+
};
|
|
8
|
+
/** A typography token with its colour, ready to spread into a text style. */
|
|
9
|
+
export interface TextPreset extends TypographyToken {
|
|
10
|
+
color: string;
|
|
11
|
+
}
|
|
12
|
+
export interface TextPresets {
|
|
13
|
+
body: TextPreset;
|
|
14
|
+
bodyMuted: TextPreset;
|
|
15
|
+
label: TextPreset;
|
|
16
|
+
labelMuted: TextPreset;
|
|
17
|
+
caption: TextPreset;
|
|
18
|
+
title: TextPreset;
|
|
19
|
+
headline: TextPreset;
|
|
20
|
+
/** Uses the contrast-exempt `disabled` colour. */
|
|
21
|
+
disabled: TextPreset;
|
|
22
|
+
}
|
|
23
|
+
export interface StackPreset {
|
|
24
|
+
flexDirection: 'column';
|
|
25
|
+
gap: number;
|
|
26
|
+
}
|
|
27
|
+
export interface InlinePreset {
|
|
28
|
+
flexDirection: 'row';
|
|
29
|
+
alignItems: 'center';
|
|
30
|
+
gap: number;
|
|
31
|
+
}
|
|
32
|
+
export interface BorderPresets {
|
|
33
|
+
/** Hairline divider on every side (`outlineVariant`). */
|
|
34
|
+
hairline: {
|
|
35
|
+
borderWidth: number;
|
|
36
|
+
borderColor: string;
|
|
37
|
+
};
|
|
38
|
+
/** Divider above (`outlineVariant`). */
|
|
39
|
+
top: {
|
|
40
|
+
borderTopWidth: number;
|
|
41
|
+
borderTopColor: string;
|
|
42
|
+
};
|
|
43
|
+
/** Divider below (`outlineVariant`). */
|
|
44
|
+
bottom: {
|
|
45
|
+
borderBottomWidth: number;
|
|
46
|
+
borderBottomColor: string;
|
|
47
|
+
};
|
|
48
|
+
/** Boundary of an interactive component (`outline`, ≥ 3:1). */
|
|
49
|
+
all: {
|
|
50
|
+
borderWidth: number;
|
|
51
|
+
borderColor: string;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export interface BoxPresets {
|
|
55
|
+
outlined: {
|
|
56
|
+
borderWidth: number;
|
|
57
|
+
borderColor: string;
|
|
58
|
+
borderRadius: number;
|
|
59
|
+
padding: number;
|
|
60
|
+
gap: number;
|
|
61
|
+
};
|
|
62
|
+
card: {
|
|
63
|
+
backgroundColor: string;
|
|
64
|
+
borderRadius: number;
|
|
65
|
+
padding: number;
|
|
66
|
+
gap: number;
|
|
67
|
+
};
|
|
68
|
+
sheet: {
|
|
69
|
+
backgroundColor: string;
|
|
70
|
+
borderTopLeftRadius: number;
|
|
71
|
+
borderTopRightRadius: number;
|
|
72
|
+
padding: number;
|
|
73
|
+
gap: number;
|
|
74
|
+
};
|
|
75
|
+
touchTarget: {
|
|
76
|
+
minWidth: number;
|
|
77
|
+
minHeight: number;
|
|
78
|
+
justifyContent: 'center';
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
export interface BaseTheme<TTone extends string = never> {
|
|
82
|
+
color: ColorRoles;
|
|
83
|
+
tone: Record<StandardToneName | TTone, ToneColors>;
|
|
84
|
+
typography: Typography;
|
|
85
|
+
/** Family + weight per named weight, resolved for the current platform. */
|
|
86
|
+
font: Record<FontWeightName, FontToken>;
|
|
87
|
+
fontWeight: FontWeights;
|
|
88
|
+
spacing: SpacingTokens;
|
|
89
|
+
radius: RadiusTokens;
|
|
90
|
+
borderWidth: BorderWidthTokens;
|
|
91
|
+
size: SizeTokens;
|
|
92
|
+
opacity: OpacityTokens;
|
|
93
|
+
motion: MotionTokens;
|
|
94
|
+
shadow: ShadowTokens;
|
|
95
|
+
zIndex: ZIndexTokens;
|
|
96
|
+
/** Ceiling for `maxFontSizeMultiplier` on the app's `Text`. */
|
|
97
|
+
maxFontScale: number;
|
|
98
|
+
/** Chart series colours (≥ 3:1 on `surface`), starting at the primary hue. */
|
|
99
|
+
categorical: string[];
|
|
100
|
+
text: TextPresets;
|
|
101
|
+
stack: Record<SpacingKey, StackPreset>;
|
|
102
|
+
inline: Record<SpacingKey, InlinePreset>;
|
|
103
|
+
border: BorderPresets;
|
|
104
|
+
box: BoxPresets;
|
|
105
|
+
}
|
|
106
|
+
export type EmptyExtension = Record<never, never>;
|
|
107
|
+
export type Theme<TExt extends object = EmptyExtension, TTone extends string = never> = BaseTheme<TTone> & TExt;
|
|
108
|
+
export type ThemeName<TName extends string = never> = 'light' | 'dark' | TName;
|
|
109
|
+
export type Themes<TExt extends object = EmptyExtension, TTone extends string = never, TName extends string = never> = Record<ThemeName<TName>, Theme<TExt, TTone>>;
|
|
110
|
+
export interface ExtendContext<TTone extends string = never, TName extends string = never> {
|
|
111
|
+
name: ThemeName<TName>;
|
|
112
|
+
scheme: ColorScheme;
|
|
113
|
+
theme: BaseTheme<TTone>;
|
|
114
|
+
}
|
|
115
|
+
/** An extra theme beyond light and dark. Omitted colours come from the base config. */
|
|
116
|
+
export interface NamedThemeConfig<TTone extends string = never> {
|
|
117
|
+
scheme: ColorScheme;
|
|
118
|
+
brandColors?: BrandColors;
|
|
119
|
+
seeds?: SeedColors;
|
|
120
|
+
tones?: Partial<Record<TTone, string>>;
|
|
121
|
+
}
|
|
122
|
+
/** Extension keys may not replace base groups. */
|
|
123
|
+
type NoBaseKeys = {
|
|
124
|
+
[K in keyof BaseTheme]?: never;
|
|
125
|
+
};
|
|
126
|
+
export interface ThemeConfig<TExt extends object = EmptyExtension, TTone extends string = never, TName extends string = never> {
|
|
127
|
+
brandColors: BrandColors;
|
|
128
|
+
seeds?: SeedColors;
|
|
129
|
+
/** Custom tones from one opaque seed each, e.g. `{ accent: '#BD260F' }`. */
|
|
130
|
+
tones?: Record<TTone, string>;
|
|
131
|
+
typography?: TypographyConfig;
|
|
132
|
+
/** App-specific token groups, derived per theme from the generated tokens. */
|
|
133
|
+
extend?: (context: ExtendContext<TTone, TName>) => TExt & NoBaseKeys;
|
|
134
|
+
themes?: Record<TName, NamedThemeConfig<TTone>>;
|
|
135
|
+
overrides?: NoInfer<Partial<Record<ThemeName<TName>, DeepPartial<Theme<TExt, TTone>>>>>;
|
|
136
|
+
/** Throw instead of warning when an override breaks a contrast guarantee. */
|
|
137
|
+
strict?: boolean;
|
|
138
|
+
}
|
|
139
|
+
export {};
|
|
140
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../src/types/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtF,OAAO,KAAK,EACX,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,UAAU,EACV,aAAa,EACb,YAAY,EACZ,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EACX,SAAS,EACT,cAAc,EACd,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,MAAM,cAAc,CAAC;AAEtB,MAAM,MAA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
|
7
|
+
md: number;
|
|
8
|
+
mdPlus: number;
|
|
9
|
+
lg: number;
|
|
10
|
+
xl: number;
|
|
11
|
+
xlPlus: number;
|
|
12
|
+
xxl: number;
|
|
13
|
+
xxxl: number;
|
|
14
|
+
}
|
|
15
|
+
export type SpacingKey = keyof SpacingTokens;
|
|
16
|
+
export interface RadiusTokens {
|
|
17
|
+
none: number;
|
|
18
|
+
xs: number;
|
|
19
|
+
sm: number;
|
|
20
|
+
md: number;
|
|
21
|
+
lg: number;
|
|
22
|
+
xl: number;
|
|
23
|
+
full: number;
|
|
24
|
+
}
|
|
25
|
+
export interface BorderWidthTokens {
|
|
26
|
+
hairline: number;
|
|
27
|
+
thin: number;
|
|
28
|
+
thick: number;
|
|
29
|
+
}
|
|
30
|
+
export interface SizeTokens {
|
|
31
|
+
/** Minimum touch target side, in points (WCAG 2.5.8 / standards V). */
|
|
32
|
+
touchTarget: number;
|
|
33
|
+
icon: {
|
|
34
|
+
sm: number;
|
|
35
|
+
md: number;
|
|
36
|
+
lg: number;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/** Material 3 state-layer and disabled opacities. */
|
|
40
|
+
export interface OpacityTokens {
|
|
41
|
+
hover: number;
|
|
42
|
+
focus: number;
|
|
43
|
+
pressed: number;
|
|
44
|
+
dragged: number;
|
|
45
|
+
disabledContent: number;
|
|
46
|
+
disabledContainer: number;
|
|
47
|
+
}
|
|
48
|
+
/** Cubic-bezier control points `[x1, y1, x2, y2]`, e.g. for `Easing.bezier`. */
|
|
49
|
+
export type EasingCurve = [number, number, number, number];
|
|
50
|
+
export interface MotionTokens {
|
|
51
|
+
duration: {
|
|
52
|
+
short: number;
|
|
53
|
+
medium: number;
|
|
54
|
+
long: number;
|
|
55
|
+
};
|
|
56
|
+
easing: {
|
|
57
|
+
standard: EasingCurve;
|
|
58
|
+
emphasized: EasingCurve;
|
|
59
|
+
decelerate: EasingCurve;
|
|
60
|
+
accelerate: EasingCurve;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export interface ShadowToken {
|
|
64
|
+
/** CSS-style shadow list, rendered by React Native on iOS and Android. */
|
|
65
|
+
boxShadow: string;
|
|
66
|
+
}
|
|
67
|
+
export interface ShadowTokens {
|
|
68
|
+
sm: ShadowToken;
|
|
69
|
+
md: ShadowToken;
|
|
70
|
+
lg: ShadowToken;
|
|
71
|
+
}
|
|
72
|
+
export interface ZIndexTokens {
|
|
73
|
+
base: number;
|
|
74
|
+
raised: number;
|
|
75
|
+
modal: number;
|
|
76
|
+
overlay: number;
|
|
77
|
+
toast: number;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../../src/types/tokens.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACb;AAED,MAAM,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC;AAE7C,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,iBAAiB;IACjC,QAAQ,EAAE,MAA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,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export type FontWeightName = 'regular' | 'medium' | 'semibold' | 'bold' | 'heavy';
|
|
2
|
+
/** The weight strings the package emits; each is a valid React Native `fontWeight`. */
|
|
3
|
+
export type FontWeightValue = 'normal' | '400' | '500' | '600' | '700' | '800' | '900';
|
|
4
|
+
/**
|
|
5
|
+
* Custom font files per weight. Android cannot pick a weight inside a family,
|
|
6
|
+
* so every weight needs its own family name there; iOS resolves weights within
|
|
7
|
+
* one family unless a per-weight name is given.
|
|
8
|
+
*/
|
|
9
|
+
export interface FontConfig {
|
|
10
|
+
/** Family used where no per-weight name applies. */
|
|
11
|
+
family?: string;
|
|
12
|
+
ios?: Partial<Record<FontWeightName, string>>;
|
|
13
|
+
android?: Partial<Record<FontWeightName, string>>;
|
|
14
|
+
}
|
|
15
|
+
export interface TypographyConfig {
|
|
16
|
+
/** Single family for every weight (0.2.x behaviour). Defaults to `System`. */
|
|
17
|
+
fontFamily?: string;
|
|
18
|
+
fonts?: FontConfig;
|
|
19
|
+
baseFontSize?: number;
|
|
20
|
+
/** Design-time multiplier. It does not track the OS text-size setting. */
|
|
21
|
+
fontScale?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Ceiling for the OS text-size multiplier, applied by the app's `Text`
|
|
24
|
+
* through `maxFontSizeMultiplier`. Defaults to 2 (WCAG 1.4.4).
|
|
25
|
+
*/
|
|
26
|
+
maxFontScale?: number;
|
|
27
|
+
}
|
|
28
|
+
export type TypographyRole = 'display' | 'headline' | 'title' | 'body' | 'label' | 'caption';
|
|
29
|
+
export type TypographyStyleName = TypographyRole | `${TypographyRole}Small` | `${TypographyRole}Large`;
|
|
30
|
+
export interface TypographyToken {
|
|
31
|
+
fontSize: number;
|
|
32
|
+
lineHeight: number;
|
|
33
|
+
fontWeight: FontWeightValue;
|
|
34
|
+
fontFamily: string;
|
|
35
|
+
letterSpacing?: number;
|
|
36
|
+
}
|
|
37
|
+
/** The six 0.2.x role names resolve to the medium size. */
|
|
38
|
+
export type Typography = {
|
|
39
|
+
fontFamily: string;
|
|
40
|
+
} & Record<TypographyStyleName, TypographyToken>;
|
|
41
|
+
/** The fixed weight scale behind the weight names. */
|
|
42
|
+
export interface FontWeights {
|
|
43
|
+
regular: '400';
|
|
44
|
+
medium: '500';
|
|
45
|
+
semibold: '600';
|
|
46
|
+
bold: '700';
|
|
47
|
+
heavy: '800';
|
|
48
|
+
}
|
|
49
|
+
export interface FontToken {
|
|
50
|
+
fontFamily: string;
|
|
51
|
+
fontWeight: FontWeightValue;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=typography.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../../../../src/types/typography.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC;AAElF,uFAAuF;AACvF,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAEvF;;;;GAIG;AACH,MAAM,WAAW,UAAU;IAC1B,oDAAoD;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;IAC9C,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;CAClD;AAED,MAAM,WAAW,gBAAgB;IAChC,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0EAA0E;IAC1E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAE7F,MAAM,MAAM,mBAAmB,GAC9B,cAAc,GAAG,GAAG,cAAc,OAAO,GAAG,GAAG,cAAc,OAAO,CAAC;AAEtE,MAAM,WAAW,eAAe;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,eAAe,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,2DAA2D;AAC3D,MAAM,MAAM,UAAU,GAAG;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAAC,mBAAmB,EAAE,eAAe,CAAC,CAAC;AAE/F,sDAAsD;AACtD,MAAM,WAAW,WAAW;IAC3B,OAAO,EAAE,KAAK,CAAC;IACf,MAAM,EAAE,KAAK,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC;IAChB,IAAI,EAAE,KAAK,CAAC;IACZ,KAAK,EAAE,KAAK,CAAC;CACb;AAED,MAAM,WAAW,SAAS;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,eAAe,CAAC;CAC5B"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type BuildThemesOptions } from '../theme/buildThemes';
|
|
2
|
+
import { DEFAULT_BREAKPOINTS } from '../tokens/defaults';
|
|
3
|
+
import type { EmptyExtension, ThemeConfig, ThemeName, Themes } from '../types/theme';
|
|
4
|
+
type Breakpoints = Record<string, number>;
|
|
5
|
+
interface UnistylesBaseSettings {
|
|
6
|
+
CSSVars?: boolean;
|
|
7
|
+
nativeBreakpointsMode?: 'pixels' | 'points';
|
|
8
|
+
}
|
|
9
|
+
export type UnistylesConfigOptions<TName extends string = never, TBreakpoints extends Breakpoints = typeof DEFAULT_BREAKPOINTS> = UnistylesBaseSettings & BuildThemesOptions & {
|
|
10
|
+
/** Replaces the default `compact`/`medium`/`expanded` breakpoints; one must be 0. */
|
|
11
|
+
breakpoints?: TBreakpoints;
|
|
12
|
+
} & ({
|
|
13
|
+
/** Theme active on first launch. Defaults to 'light'. */
|
|
14
|
+
initialTheme?: ThemeName<TName> | (() => ThemeName<TName>);
|
|
15
|
+
adaptiveThemes?: false;
|
|
16
|
+
} | {
|
|
17
|
+
/** Follow the system colour scheme between light and dark. */
|
|
18
|
+
adaptiveThemes: boolean;
|
|
19
|
+
initialTheme?: never;
|
|
20
|
+
});
|
|
21
|
+
type UnistylesSettings<TName extends string> = UnistylesBaseSettings & ({
|
|
22
|
+
initialTheme: ThemeName<TName> | (() => ThemeName<TName>);
|
|
23
|
+
adaptiveThemes?: false;
|
|
24
|
+
} | {
|
|
25
|
+
adaptiveThemes: true;
|
|
26
|
+
initialTheme?: never;
|
|
27
|
+
});
|
|
28
|
+
export interface UnistylesConfig<TExt extends object = EmptyExtension, TTone extends string = never, TName extends string = never, TBreakpoints extends Breakpoints = typeof DEFAULT_BREAKPOINTS> {
|
|
29
|
+
themes: Themes<TExt, TTone, TName>;
|
|
30
|
+
settings: UnistylesSettings<TName>;
|
|
31
|
+
breakpoints: TBreakpoints;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Builds the object for `StyleSheet.configure`: every theme, settings and
|
|
35
|
+
* breakpoints.
|
|
36
|
+
*
|
|
37
|
+
* ```ts
|
|
38
|
+
* const config = createUnistylesConfig({ brandColors: BRAND_COLORS }, { initialTheme: 'light' });
|
|
39
|
+
*
|
|
40
|
+
* type AppThemes = typeof config.themes;
|
|
41
|
+
* type AppBreakpoints = typeof config.breakpoints;
|
|
42
|
+
* declare module 'react-native-unistyles' {
|
|
43
|
+
* export interface UnistylesThemes extends AppThemes {}
|
|
44
|
+
* export interface UnistylesBreakpoints extends AppBreakpoints {}
|
|
45
|
+
* }
|
|
46
|
+
*
|
|
47
|
+
* StyleSheet.configure(config);
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export declare function createUnistylesConfig<TExt extends object = EmptyExtension, TTone extends string = never, TName extends string = never, TBreakpoints extends Breakpoints = typeof DEFAULT_BREAKPOINTS>(config: ThemeConfig<TExt, TTone, TName>, options?: UnistylesConfigOptions<NoInfer<TName>, TBreakpoints>): UnistylesConfig<TExt, TTone, TName, TBreakpoints>;
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=createUnistylesConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createUnistylesConfig.d.ts","sourceRoot":"","sources":["../../../../src/unistyles/createUnistylesConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAI5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAErF,KAAK,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE1C,UAAU,qBAAqB;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,qBAAqB,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC5C;AAED,MAAM,MAAM,sBAAsB,CACjC,KAAK,SAAS,MAAM,GAAG,KAAK,EAC5B,YAAY,SAAS,WAAW,GAAG,OAAO,mBAAmB,IAC1D,qBAAqB,GACxB,kBAAkB,GAAG;IACpB,qFAAqF;IACrF,WAAW,CAAC,EAAE,YAAY,CAAC;CAC3B,GAAG,CACD;IACA,yDAAyD;IACzD,YAAY,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3D,cAAc,CAAC,EAAE,KAAK,C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emeMode = 'system' | 'light' | 'dark';
|
|
2
|
+
/** The two runtime calls a mode change needs. */
|
|
3
|
+
export interface ThemeModeRuntime {
|
|
4
|
+
setAdaptiveThemes(enabled: boolean): void;
|
|
5
|
+
setTheme(name: string): void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Applies a light/dark/system preference. Adaptive themes are switched off
|
|
9
|
+
* before a manual theme is set; in the other order the next OS colour-scheme
|
|
10
|
+
* change overrides the user's choice. Persisting the preference is the app's.
|
|
11
|
+
*/
|
|
12
|
+
export declare function applyThemeMode(mode: ThemeMode, runtime?: ThemeModeRuntime): void;
|
|
13
|
+
//# sourceMappingURL=themeMode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themeMode.d.ts","sourceRoot":"","sources":["../../../../src/unistyles/themeMode.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAEpD,iDAAiD;AACjD,MAAM,WAAW,gBAAgB;IAChC,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAwBD;;;;GAIG;AACH,wBAAgB,cAAc,CAC7B,IAAI,EAAE,SAAS,EACf,OAAO,GAAE,gBAAmC,GAC1C,IAAI,CAQN"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { ViewingConditions } from './viewing_conditions';
|
|
18
|
+
/**
|
|
19
|
+
* CAM16, a color appearance model. Colors are not just defined by their hex
|
|
20
|
+
* code, but rather, a hex code and viewing conditions.
|
|
21
|
+
*
|
|
22
|
+
* CAM16 instances also have coordinates in the CAM16-UCS space, called J*, a*,
|
|
23
|
+
* b*, or jstar, astar, bstar in code. CAM16-UCS is included in the CAM16
|
|
24
|
+
* specification, and should be used when measuring distances between colors.
|
|
25
|
+
*
|
|
26
|
+
* In traditional color spaces, a color can be identified solely by the
|
|
27
|
+
* observer's measurement of the color. Color appearance models such as CAM16
|
|
28
|
+
* also use information about the environment where the color was
|
|
29
|
+
* observed, known as the viewing conditions.
|
|
30
|
+
*
|
|
31
|
+
* For example, white under the traditional assumption of a midday sun white
|
|
32
|
+
* point is accurately measured as a slightly chromatic blue by CAM16. (roughly,
|
|
33
|
+
* hue 203, chroma 3, lightness 100)
|
|
34
|
+
*/
|
|
35
|
+
export declare class Cam16 {
|
|
36
|
+
readonly hue: number;
|
|
37
|
+
readonly chroma: number;
|
|
38
|
+
readonly j: number;
|
|
39
|
+
readonly q: number;
|
|
40
|
+
readonly m: number;
|
|
41
|
+
readonly s: number;
|
|
42
|
+
readonly jstar: number;
|
|
43
|
+
readonly astar: number;
|
|
44
|
+
readonly bstar: number;
|
|
45
|
+
/**
|
|
46
|
+
* All of the CAM16 dimensions can be calculated from 3 of the dimensions, in
|
|
47
|
+
* the following combinations:
|
|
48
|
+
* - {j or q} and {c, m, or s} and hue
|
|
49
|
+
* - jstar, astar, bstar
|
|
50
|
+
* Prefer using a static method that constructs from 3 of those dimensions.
|
|
51
|
+
* This constructor is intended for those methods to use to return all
|
|
52
|
+
* possible dimensions.
|
|
53
|
+
*
|
|
54
|
+
* @param hue
|
|
55
|
+
* @param chroma informally, colorfulness / color intensity. like saturation
|
|
56
|
+
* in HSL, except perceptually accurate.
|
|
57
|
+
* @param j lightness
|
|
58
|
+
* @param q brightness; ratio of lightness to white point's lightness
|
|
59
|
+
* @param m colorfulness
|
|
60
|
+
* @param s saturation; ratio of chroma to white point's chroma
|
|
61
|
+
* @param jstar CAM16-UCS J coordinate
|
|
62
|
+
* @param astar CAM16-UCS a coordinate
|
|
63
|
+
* @param bstar CAM16-UCS b coordinate
|
|
64
|
+
*/
|
|
65
|
+
constructor(hue: number, chroma: number, j: number, q: number, m: number, s: number, jstar: number, astar: number, bstar: number);
|
|
66
|
+
/**
|
|
67
|
+
* CAM16 instances also have coordinates in the CAM16-UCS space, called J*,
|
|
68
|
+
* a*, b*, or jstar, astar, bstar in code. CAM16-UCS is included in the CAM16
|
|
69
|
+
* specification, and is used to measure distances between colors.
|
|
70
|
+
*/
|
|
71
|
+
distance(other: Cam16): number;
|
|
72
|
+
/**
|
|
73
|
+
* @param argb ARGB representation of a color.
|
|
74
|
+
* @return CAM16 color, assuming the color was viewed in default viewing
|
|
75
|
+
* conditions.
|
|
76
|
+
*/
|
|
77
|
+
static fromInt(argb: number): Cam16;
|
|
78
|
+
/**
|
|
79
|
+
* @param argb ARGB representation of a color.
|
|
80
|
+
* @param viewingConditions Information about the environment where the color
|
|
81
|
+
* was observed.
|
|
82
|
+
* @return CAM16 color.
|
|
83
|
+
*/
|
|
84
|
+
static fromIntInViewingConditions(argb: number, viewingConditions: ViewingConditions): Cam16;
|
|
85
|
+
/**
|
|
86
|
+
* @param j CAM16 lightness
|
|
87
|
+
* @param c CAM16 chroma
|
|
88
|
+
* @param h CAM16 hue
|
|
89
|
+
*/
|
|
90
|
+
static fromJch(j: number, c: number, h: number): Cam16;
|
|
91
|
+
/**
|
|
92
|
+
* @param j CAM16 lightness
|
|
93
|
+
* @param c CAM16 chroma
|
|
94
|
+
* @param h CAM16 hue
|
|
95
|
+
* @param viewingConditions Information about the environment where the color
|
|
96
|
+
* was observed.
|
|
97
|
+
*/
|
|
98
|
+
static fromJchInViewingConditions(j: number, c: number, h: number, viewingConditions: ViewingConditions): Cam16;
|
|
99
|
+
/**
|
|
100
|
+
* @param jstar CAM16-UCS lightness.
|
|
101
|
+
* @param astar CAM16-UCS a dimension. Like a* in L*a*b*, it is a Cartesian
|
|
102
|
+
* coordinate on the Y axis.
|
|
103
|
+
* @param bstar CAM16-UCS b dimension. Like a* in L*a*b*, it is a Cartesian
|
|
104
|
+
* coordinate on the X axis.
|
|
105
|
+
*/
|
|
106
|
+
static fromUcs(jstar: number, astar: number, bstar: number): Cam16;
|
|
107
|
+
/**
|
|
108
|
+
* @param jstar CAM16-UCS lightness.
|
|
109
|
+
* @param astar CAM16-UCS a dimension. Like a* in L*a*b*, it is a Cartesian
|
|
110
|
+
* coordinate on the Y axis.
|
|
111
|
+
* @param bstar CAM16-UCS b dimension. Like a* in L*a*b*, it is a Cartesian
|
|
112
|
+
* coordinate on the X axis.
|
|
113
|
+
* @param viewingConditions Information about the environment where the color
|
|
114
|
+
* was observed.
|
|
115
|
+
*/
|
|
116
|
+
static fromUcsInViewingConditions(jstar: number, astar: number, bstar: number, viewingConditions: ViewingConditions): Cam16;
|
|
117
|
+
/**
|
|
118
|
+
* @return ARGB representation of color, assuming the color was viewed in
|
|
119
|
+
* default viewing conditions, which are near-identical to the default
|
|
120
|
+
* viewing conditions for sRGB.
|
|
121
|
+
*/
|
|
122
|
+
toInt(): number;
|
|
123
|
+
/**
|
|
124
|
+
* @param viewingConditions Information about the environment where the color
|
|
125
|
+
* will be viewed.
|
|
126
|
+
* @return ARGB representation of color
|
|
127
|
+
*/
|
|
128
|
+
viewed(viewingConditions: ViewingConditions): number;
|
|
129
|
+
static fromXyzInViewingConditions(x: number, y: number, z: number, viewingConditions: ViewingConditions): Cam16;
|
|
130
|
+
xyzInViewingConditions(viewingConditions: ViewingConditions): number[];
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=cam16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