@xaui/native 0.9.1-alpha.0 → 0.9.1-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-JDS6KGCM.cjs → chunk-2FEDC7U5.cjs} +39 -119
- package/dist/chunk-3QBT3Q65.cjs +125 -0
- package/dist/chunk-3TIDEII6.js +57 -0
- package/dist/chunk-66OVPWF4.js +716 -0
- package/dist/chunk-7D262JCJ.cjs +716 -0
- package/dist/{chunk-T3ZI2PZ6.js → chunk-7XGOXTGT.js} +9 -89
- package/dist/chunk-EQGTD5F6.js +353 -0
- package/dist/chunk-ERCOAOO6.cjs +353 -0
- package/dist/chunk-LMUPNKPH.cjs +57 -0
- package/dist/chunk-X2K2FX3W.js +125 -0
- package/dist/components/button/index.cjs +12 -0
- package/dist/components/button/index.d.cts +192 -0
- package/dist/components/button/index.d.ts +192 -0
- package/dist/components/button/index.js +12 -0
- package/dist/create-recipe-BjSP0zL_.d.cts +210 -0
- package/dist/create-recipe-Dn9kj5Rs.d.ts +210 -0
- package/dist/index.cjs +122 -3
- package/dist/index.d.cts +74 -2
- package/dist/index.d.ts +74 -2
- package/dist/index.js +122 -3
- package/dist/system/index.cjs +53 -0
- package/dist/system/index.d.cts +262 -0
- package/dist/system/index.d.ts +262 -0
- package/dist/system/index.js +53 -0
- package/dist/theme/index.cjs +6 -2
- package/dist/theme/index.d.cts +24 -153
- package/dist/theme/index.d.ts +24 -153
- package/dist/theme/index.js +7 -3
- package/dist/theme.type-C9bFJKFm.d.cts +159 -0
- package/dist/theme.type-C9bFJKFm.d.ts +159 -0
- package/package.json +39 -8
package/dist/theme/index.d.cts
CHANGED
|
@@ -1,157 +1,8 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
background: string;
|
|
7
|
-
foreground: string;
|
|
8
|
-
surface: string;
|
|
9
|
-
surfaceForeground: string;
|
|
10
|
-
surfaceSecondary: string;
|
|
11
|
-
surfaceSecondaryForeground: string;
|
|
12
|
-
surfaceTertiary: string;
|
|
13
|
-
surfaceTertiaryForeground: string;
|
|
14
|
-
overlay: string;
|
|
15
|
-
overlayForeground: string;
|
|
16
|
-
backdrop: string;
|
|
17
|
-
muted: string;
|
|
18
|
-
default: string;
|
|
19
|
-
defaultForeground: string;
|
|
20
|
-
accent: string;
|
|
21
|
-
accentForeground: string;
|
|
22
|
-
fieldBackground: string;
|
|
23
|
-
fieldForeground: string;
|
|
24
|
-
fieldPlaceholder: string;
|
|
25
|
-
fieldBorder: string;
|
|
26
|
-
success: string;
|
|
27
|
-
successForeground: string;
|
|
28
|
-
warning: string;
|
|
29
|
-
warningForeground: string;
|
|
30
|
-
danger: string;
|
|
31
|
-
dangerForeground: string;
|
|
32
|
-
segment: string;
|
|
33
|
-
segmentForeground: string;
|
|
34
|
-
border: string;
|
|
35
|
-
separator: string;
|
|
36
|
-
focus: string;
|
|
37
|
-
link: string;
|
|
38
|
-
};
|
|
39
|
-
/** The derived layer — computed by `deriveColors`, never written by hand. */
|
|
40
|
-
type XAUIDerivedColors = {
|
|
41
|
-
accentPressed: string;
|
|
42
|
-
successPressed: string;
|
|
43
|
-
warningPressed: string;
|
|
44
|
-
dangerPressed: string;
|
|
45
|
-
defaultPressed: string;
|
|
46
|
-
surfacePressed: string;
|
|
47
|
-
defaultSoft: string;
|
|
48
|
-
defaultSoftForeground: string;
|
|
49
|
-
defaultSoftPressed: string;
|
|
50
|
-
accentSoft: string;
|
|
51
|
-
accentSoftForeground: string;
|
|
52
|
-
accentSoftPressed: string;
|
|
53
|
-
successSoft: string;
|
|
54
|
-
successSoftForeground: string;
|
|
55
|
-
successSoftPressed: string;
|
|
56
|
-
warningSoft: string;
|
|
57
|
-
warningSoftForeground: string;
|
|
58
|
-
warningSoftPressed: string;
|
|
59
|
-
dangerSoft: string;
|
|
60
|
-
dangerSoftForeground: string;
|
|
61
|
-
dangerSoftPressed: string;
|
|
62
|
-
backgroundSecondary: string;
|
|
63
|
-
backgroundTertiary: string;
|
|
64
|
-
backgroundInverse: string;
|
|
65
|
-
borderSecondary: string;
|
|
66
|
-
borderTertiary: string;
|
|
67
|
-
separatorSecondary: string;
|
|
68
|
-
separatorTertiary: string;
|
|
69
|
-
fieldPressed: string;
|
|
70
|
-
fieldFocus: string;
|
|
71
|
-
fieldBorderPressed: string;
|
|
72
|
-
fieldBorderFocus: string;
|
|
73
|
-
};
|
|
74
|
-
/** Constant across both modes. */
|
|
75
|
-
type XAUIPrimitiveColors = {
|
|
76
|
-
white: string;
|
|
77
|
-
black: string;
|
|
78
|
-
snow: string;
|
|
79
|
-
eclipse: string;
|
|
80
|
-
};
|
|
81
|
-
/** Everything a component reads, flattened. */
|
|
82
|
-
type XAUIColors = XAUISourceColors & XAUIDerivedColors & XAUIPrimitiveColors;
|
|
83
|
-
type ColorMode = 'light' | 'dark';
|
|
84
|
-
type Size = 'xs' | 'sm' | 'md' | 'lg';
|
|
85
|
-
type RadiusKey = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | 'field' | 'full';
|
|
86
|
-
type FontSizeKey = Size | 'xl' | '2xl' | '3xl' | '4xl';
|
|
87
|
-
type FontWeightKey = 'regular' | 'medium' | 'semibold' | 'bold';
|
|
88
|
-
type XAUIRadius = Record<RadiusKey, number>;
|
|
89
|
-
type XAUIShadow = {
|
|
90
|
-
shadowColor: string;
|
|
91
|
-
shadowOffset: {
|
|
92
|
-
width: number;
|
|
93
|
-
height: number;
|
|
94
|
-
};
|
|
95
|
-
shadowOpacity: number;
|
|
96
|
-
shadowRadius: number;
|
|
97
|
-
elevation: number;
|
|
98
|
-
};
|
|
99
|
-
type XAUITheme = {
|
|
100
|
-
id: string;
|
|
101
|
-
mode: ColorMode;
|
|
102
|
-
colors: XAUIColors;
|
|
103
|
-
/** Base 4 — `spacing(3) === 12`. A function, so there is no "what do we call 12px". */
|
|
104
|
-
spacing: (steps: number) => number;
|
|
105
|
-
radius: XAUIRadius;
|
|
106
|
-
borderWidth: {
|
|
107
|
-
default: number;
|
|
108
|
-
field: number;
|
|
109
|
-
};
|
|
110
|
-
fontSizes: Record<FontSizeKey, number>;
|
|
111
|
-
lineHeights: Record<FontSizeKey, number>;
|
|
112
|
-
fontWeights: Record<FontWeightKey, string>;
|
|
113
|
-
fontFamilies: {
|
|
114
|
-
body: string;
|
|
115
|
-
heading: string;
|
|
116
|
-
mono: string;
|
|
117
|
-
};
|
|
118
|
-
/** Semantic roles, not a scale: dark mode drops the surface shadow entirely. */
|
|
119
|
-
shadows: {
|
|
120
|
-
surface: XAUIShadow;
|
|
121
|
-
overlay: XAUIShadow;
|
|
122
|
-
field: XAUIShadow;
|
|
123
|
-
};
|
|
124
|
-
opacity: {
|
|
125
|
-
disabled: number;
|
|
126
|
-
};
|
|
127
|
-
controlHeights: Record<Size, number>;
|
|
128
|
-
};
|
|
129
|
-
type XAUIThemeConfig = {
|
|
130
|
-
colors?: {
|
|
131
|
-
light?: Partial<XAUISourceColors & XAUIDerivedColors>;
|
|
132
|
-
dark?: Partial<XAUISourceColors & XAUIDerivedColors>;
|
|
133
|
-
};
|
|
134
|
-
/** The single base the whole radius scale derives from. */
|
|
135
|
-
radius?: number;
|
|
136
|
-
spacingUnit?: number;
|
|
137
|
-
borderWidth?: Partial<XAUITheme['borderWidth']>;
|
|
138
|
-
fontSizes?: Partial<XAUITheme['fontSizes']>;
|
|
139
|
-
lineHeights?: Partial<XAUITheme['lineHeights']>;
|
|
140
|
-
fontWeights?: Partial<XAUITheme['fontWeights']>;
|
|
141
|
-
fontFamilies?: Partial<XAUITheme['fontFamilies']>;
|
|
142
|
-
/** Per role, and `shadowOffset` is replaced whole — a half-set offset is not a shadow. */
|
|
143
|
-
shadows?: {
|
|
144
|
-
[K in keyof XAUITheme['shadows']]?: Partial<XAUIShadow>;
|
|
145
|
-
};
|
|
146
|
-
opacity?: Partial<XAUITheme['opacity']>;
|
|
147
|
-
controlHeights?: Partial<XAUITheme['controlHeights']>;
|
|
148
|
-
};
|
|
149
|
-
/** What `createTheme` returns: both modes, resolved, sharing one id. */
|
|
150
|
-
type XAUIThemeSet = {
|
|
151
|
-
id: string;
|
|
152
|
-
light: XAUITheme;
|
|
153
|
-
dark: XAUITheme;
|
|
154
|
-
};
|
|
3
|
+
import { i as XAUIThemeSet, h as XAUIThemeConfig, f as XAUISourceColors, b as XAUIDerivedColors, g as XAUITheme, d as XAUIRadius, C as ColorMode, X as XAUIColors } from '../theme.type-C9bFJKFm.cjs';
|
|
4
|
+
export { F as FontSizeKey, a as FontWeightKey, R as RadiusKey, S as Size, c as XAUIPrimitiveColors, e as XAUIShadow } from '../theme.type-C9bFJKFm.cjs';
|
|
5
|
+
import 'react-native';
|
|
155
6
|
|
|
156
7
|
/** `'system'` follows the device; the resolved value is never `'system'`. */
|
|
157
8
|
type ColorModePreference = 'light' | 'dark' | 'system';
|
|
@@ -196,6 +47,26 @@ declare const defaultTheme: XAUIThemeSet;
|
|
|
196
47
|
*/
|
|
197
48
|
declare function deriveColors(s: XAUISourceColors): XAUIDerivedColors;
|
|
198
49
|
|
|
50
|
+
/**
|
|
51
|
+
* A raw tint, expanded into the slices a variant consumes. One `color` gives the base;
|
|
52
|
+
* the other five come out of the same OKLab formulas as `deriveColors`, so a free tint
|
|
53
|
+
* behaves exactly like `accent` or `danger` — same ratios, same rendering — instead of
|
|
54
|
+
* following a parallel mechanic.
|
|
55
|
+
*/
|
|
56
|
+
type XAUITint = {
|
|
57
|
+
base: string;
|
|
58
|
+
foreground: string;
|
|
59
|
+
soft: string;
|
|
60
|
+
softForeground: string;
|
|
61
|
+
pressed: string;
|
|
62
|
+
softPressed: string;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Memoized per tint *and* theme: sRGB → OKLab → sRGB is not free per render, and
|
|
66
|
+
* `softForeground` mixes with the theme's `foreground`, which differs between modes.
|
|
67
|
+
*/
|
|
68
|
+
declare function deriveTint(tint: string, theme: XAUITheme): XAUITint;
|
|
69
|
+
|
|
199
70
|
/**
|
|
200
71
|
* The raw palette — Tailwind's scale, 22 families x 11 shades.
|
|
201
72
|
*
|
|
@@ -666,4 +537,4 @@ declare function useColorMode(): ColorMode;
|
|
|
666
537
|
declare function useThemeColor(token: keyof XAUIColors): string;
|
|
667
538
|
declare function useThemeColor(tokens: Array<keyof XAUIColors>): string[];
|
|
668
539
|
|
|
669
|
-
export {
|
|
540
|
+
export { ColorMode, type ColorModePreference, type PaletteFamily, type PaletteShade, ThemeContext, XAUIColors, XAUIDerivedColors, XAUIProvider, type XAUIProviderProps, XAUIRadius, XAUISourceColors, XAUITheme, XAUIThemeConfig, XAUIThemeSet, type XAUITint, buildRadius, buildShadows, createTheme, defaultTheme, deriveColors, deriveTint, palette, primitives, sourceKeys, tokens, useColorMode, useThemeColor, useXAUITheme };
|
package/dist/theme/index.d.ts
CHANGED
|
@@ -1,157 +1,8 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
background: string;
|
|
7
|
-
foreground: string;
|
|
8
|
-
surface: string;
|
|
9
|
-
surfaceForeground: string;
|
|
10
|
-
surfaceSecondary: string;
|
|
11
|
-
surfaceSecondaryForeground: string;
|
|
12
|
-
surfaceTertiary: string;
|
|
13
|
-
surfaceTertiaryForeground: string;
|
|
14
|
-
overlay: string;
|
|
15
|
-
overlayForeground: string;
|
|
16
|
-
backdrop: string;
|
|
17
|
-
muted: string;
|
|
18
|
-
default: string;
|
|
19
|
-
defaultForeground: string;
|
|
20
|
-
accent: string;
|
|
21
|
-
accentForeground: string;
|
|
22
|
-
fieldBackground: string;
|
|
23
|
-
fieldForeground: string;
|
|
24
|
-
fieldPlaceholder: string;
|
|
25
|
-
fieldBorder: string;
|
|
26
|
-
success: string;
|
|
27
|
-
successForeground: string;
|
|
28
|
-
warning: string;
|
|
29
|
-
warningForeground: string;
|
|
30
|
-
danger: string;
|
|
31
|
-
dangerForeground: string;
|
|
32
|
-
segment: string;
|
|
33
|
-
segmentForeground: string;
|
|
34
|
-
border: string;
|
|
35
|
-
separator: string;
|
|
36
|
-
focus: string;
|
|
37
|
-
link: string;
|
|
38
|
-
};
|
|
39
|
-
/** The derived layer — computed by `deriveColors`, never written by hand. */
|
|
40
|
-
type XAUIDerivedColors = {
|
|
41
|
-
accentPressed: string;
|
|
42
|
-
successPressed: string;
|
|
43
|
-
warningPressed: string;
|
|
44
|
-
dangerPressed: string;
|
|
45
|
-
defaultPressed: string;
|
|
46
|
-
surfacePressed: string;
|
|
47
|
-
defaultSoft: string;
|
|
48
|
-
defaultSoftForeground: string;
|
|
49
|
-
defaultSoftPressed: string;
|
|
50
|
-
accentSoft: string;
|
|
51
|
-
accentSoftForeground: string;
|
|
52
|
-
accentSoftPressed: string;
|
|
53
|
-
successSoft: string;
|
|
54
|
-
successSoftForeground: string;
|
|
55
|
-
successSoftPressed: string;
|
|
56
|
-
warningSoft: string;
|
|
57
|
-
warningSoftForeground: string;
|
|
58
|
-
warningSoftPressed: string;
|
|
59
|
-
dangerSoft: string;
|
|
60
|
-
dangerSoftForeground: string;
|
|
61
|
-
dangerSoftPressed: string;
|
|
62
|
-
backgroundSecondary: string;
|
|
63
|
-
backgroundTertiary: string;
|
|
64
|
-
backgroundInverse: string;
|
|
65
|
-
borderSecondary: string;
|
|
66
|
-
borderTertiary: string;
|
|
67
|
-
separatorSecondary: string;
|
|
68
|
-
separatorTertiary: string;
|
|
69
|
-
fieldPressed: string;
|
|
70
|
-
fieldFocus: string;
|
|
71
|
-
fieldBorderPressed: string;
|
|
72
|
-
fieldBorderFocus: string;
|
|
73
|
-
};
|
|
74
|
-
/** Constant across both modes. */
|
|
75
|
-
type XAUIPrimitiveColors = {
|
|
76
|
-
white: string;
|
|
77
|
-
black: string;
|
|
78
|
-
snow: string;
|
|
79
|
-
eclipse: string;
|
|
80
|
-
};
|
|
81
|
-
/** Everything a component reads, flattened. */
|
|
82
|
-
type XAUIColors = XAUISourceColors & XAUIDerivedColors & XAUIPrimitiveColors;
|
|
83
|
-
type ColorMode = 'light' | 'dark';
|
|
84
|
-
type Size = 'xs' | 'sm' | 'md' | 'lg';
|
|
85
|
-
type RadiusKey = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | 'field' | 'full';
|
|
86
|
-
type FontSizeKey = Size | 'xl' | '2xl' | '3xl' | '4xl';
|
|
87
|
-
type FontWeightKey = 'regular' | 'medium' | 'semibold' | 'bold';
|
|
88
|
-
type XAUIRadius = Record<RadiusKey, number>;
|
|
89
|
-
type XAUIShadow = {
|
|
90
|
-
shadowColor: string;
|
|
91
|
-
shadowOffset: {
|
|
92
|
-
width: number;
|
|
93
|
-
height: number;
|
|
94
|
-
};
|
|
95
|
-
shadowOpacity: number;
|
|
96
|
-
shadowRadius: number;
|
|
97
|
-
elevation: number;
|
|
98
|
-
};
|
|
99
|
-
type XAUITheme = {
|
|
100
|
-
id: string;
|
|
101
|
-
mode: ColorMode;
|
|
102
|
-
colors: XAUIColors;
|
|
103
|
-
/** Base 4 — `spacing(3) === 12`. A function, so there is no "what do we call 12px". */
|
|
104
|
-
spacing: (steps: number) => number;
|
|
105
|
-
radius: XAUIRadius;
|
|
106
|
-
borderWidth: {
|
|
107
|
-
default: number;
|
|
108
|
-
field: number;
|
|
109
|
-
};
|
|
110
|
-
fontSizes: Record<FontSizeKey, number>;
|
|
111
|
-
lineHeights: Record<FontSizeKey, number>;
|
|
112
|
-
fontWeights: Record<FontWeightKey, string>;
|
|
113
|
-
fontFamilies: {
|
|
114
|
-
body: string;
|
|
115
|
-
heading: string;
|
|
116
|
-
mono: string;
|
|
117
|
-
};
|
|
118
|
-
/** Semantic roles, not a scale: dark mode drops the surface shadow entirely. */
|
|
119
|
-
shadows: {
|
|
120
|
-
surface: XAUIShadow;
|
|
121
|
-
overlay: XAUIShadow;
|
|
122
|
-
field: XAUIShadow;
|
|
123
|
-
};
|
|
124
|
-
opacity: {
|
|
125
|
-
disabled: number;
|
|
126
|
-
};
|
|
127
|
-
controlHeights: Record<Size, number>;
|
|
128
|
-
};
|
|
129
|
-
type XAUIThemeConfig = {
|
|
130
|
-
colors?: {
|
|
131
|
-
light?: Partial<XAUISourceColors & XAUIDerivedColors>;
|
|
132
|
-
dark?: Partial<XAUISourceColors & XAUIDerivedColors>;
|
|
133
|
-
};
|
|
134
|
-
/** The single base the whole radius scale derives from. */
|
|
135
|
-
radius?: number;
|
|
136
|
-
spacingUnit?: number;
|
|
137
|
-
borderWidth?: Partial<XAUITheme['borderWidth']>;
|
|
138
|
-
fontSizes?: Partial<XAUITheme['fontSizes']>;
|
|
139
|
-
lineHeights?: Partial<XAUITheme['lineHeights']>;
|
|
140
|
-
fontWeights?: Partial<XAUITheme['fontWeights']>;
|
|
141
|
-
fontFamilies?: Partial<XAUITheme['fontFamilies']>;
|
|
142
|
-
/** Per role, and `shadowOffset` is replaced whole — a half-set offset is not a shadow. */
|
|
143
|
-
shadows?: {
|
|
144
|
-
[K in keyof XAUITheme['shadows']]?: Partial<XAUIShadow>;
|
|
145
|
-
};
|
|
146
|
-
opacity?: Partial<XAUITheme['opacity']>;
|
|
147
|
-
controlHeights?: Partial<XAUITheme['controlHeights']>;
|
|
148
|
-
};
|
|
149
|
-
/** What `createTheme` returns: both modes, resolved, sharing one id. */
|
|
150
|
-
type XAUIThemeSet = {
|
|
151
|
-
id: string;
|
|
152
|
-
light: XAUITheme;
|
|
153
|
-
dark: XAUITheme;
|
|
154
|
-
};
|
|
3
|
+
import { i as XAUIThemeSet, h as XAUIThemeConfig, f as XAUISourceColors, b as XAUIDerivedColors, g as XAUITheme, d as XAUIRadius, C as ColorMode, X as XAUIColors } from '../theme.type-C9bFJKFm.js';
|
|
4
|
+
export { F as FontSizeKey, a as FontWeightKey, R as RadiusKey, S as Size, c as XAUIPrimitiveColors, e as XAUIShadow } from '../theme.type-C9bFJKFm.js';
|
|
5
|
+
import 'react-native';
|
|
155
6
|
|
|
156
7
|
/** `'system'` follows the device; the resolved value is never `'system'`. */
|
|
157
8
|
type ColorModePreference = 'light' | 'dark' | 'system';
|
|
@@ -196,6 +47,26 @@ declare const defaultTheme: XAUIThemeSet;
|
|
|
196
47
|
*/
|
|
197
48
|
declare function deriveColors(s: XAUISourceColors): XAUIDerivedColors;
|
|
198
49
|
|
|
50
|
+
/**
|
|
51
|
+
* A raw tint, expanded into the slices a variant consumes. One `color` gives the base;
|
|
52
|
+
* the other five come out of the same OKLab formulas as `deriveColors`, so a free tint
|
|
53
|
+
* behaves exactly like `accent` or `danger` — same ratios, same rendering — instead of
|
|
54
|
+
* following a parallel mechanic.
|
|
55
|
+
*/
|
|
56
|
+
type XAUITint = {
|
|
57
|
+
base: string;
|
|
58
|
+
foreground: string;
|
|
59
|
+
soft: string;
|
|
60
|
+
softForeground: string;
|
|
61
|
+
pressed: string;
|
|
62
|
+
softPressed: string;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Memoized per tint *and* theme: sRGB → OKLab → sRGB is not free per render, and
|
|
66
|
+
* `softForeground` mixes with the theme's `foreground`, which differs between modes.
|
|
67
|
+
*/
|
|
68
|
+
declare function deriveTint(tint: string, theme: XAUITheme): XAUITint;
|
|
69
|
+
|
|
199
70
|
/**
|
|
200
71
|
* The raw palette — Tailwind's scale, 22 families x 11 shades.
|
|
201
72
|
*
|
|
@@ -666,4 +537,4 @@ declare function useColorMode(): ColorMode;
|
|
|
666
537
|
declare function useThemeColor(token: keyof XAUIColors): string;
|
|
667
538
|
declare function useThemeColor(tokens: Array<keyof XAUIColors>): string[];
|
|
668
539
|
|
|
669
|
-
export {
|
|
540
|
+
export { ColorMode, type ColorModePreference, type PaletteFamily, type PaletteShade, ThemeContext, XAUIColors, XAUIDerivedColors, XAUIProvider, type XAUIProviderProps, XAUIRadius, XAUISourceColors, XAUITheme, XAUIThemeConfig, XAUIThemeSet, type XAUITint, buildRadius, buildShadows, createTheme, defaultTheme, deriveColors, deriveTint, palette, primitives, sourceKeys, tokens, useColorMode, useThemeColor, useXAUITheme };
|
package/dist/theme/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
ThemeContext,
|
|
3
2
|
XAUIProvider,
|
|
4
3
|
buildRadius,
|
|
5
4
|
buildShadows,
|
|
@@ -9,11 +8,15 @@ import {
|
|
|
9
8
|
palette,
|
|
10
9
|
primitives,
|
|
11
10
|
sourceKeys,
|
|
12
|
-
tokens
|
|
11
|
+
tokens
|
|
12
|
+
} from "../chunk-7XGOXTGT.js";
|
|
13
|
+
import {
|
|
14
|
+
ThemeContext,
|
|
15
|
+
deriveTint,
|
|
13
16
|
useColorMode,
|
|
14
17
|
useThemeColor,
|
|
15
18
|
useXAUITheme
|
|
16
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-X2K2FX3W.js";
|
|
17
20
|
export {
|
|
18
21
|
ThemeContext,
|
|
19
22
|
XAUIProvider,
|
|
@@ -22,6 +25,7 @@ export {
|
|
|
22
25
|
createTheme,
|
|
23
26
|
defaultTheme,
|
|
24
27
|
deriveColors,
|
|
28
|
+
deriveTint,
|
|
25
29
|
palette,
|
|
26
30
|
primitives,
|
|
27
31
|
sourceKeys,
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { TextStyle } from 'react-native';
|
|
2
|
+
|
|
3
|
+
/** The source layer — the only surface a consumer writes by hand, per mode. */
|
|
4
|
+
type XAUISourceColors = {
|
|
5
|
+
background: string;
|
|
6
|
+
foreground: string;
|
|
7
|
+
surface: string;
|
|
8
|
+
surfaceForeground: string;
|
|
9
|
+
surfaceSecondary: string;
|
|
10
|
+
surfaceSecondaryForeground: string;
|
|
11
|
+
surfaceTertiary: string;
|
|
12
|
+
surfaceTertiaryForeground: string;
|
|
13
|
+
overlay: string;
|
|
14
|
+
overlayForeground: string;
|
|
15
|
+
backdrop: string;
|
|
16
|
+
muted: string;
|
|
17
|
+
default: string;
|
|
18
|
+
defaultForeground: string;
|
|
19
|
+
accent: string;
|
|
20
|
+
accentForeground: string;
|
|
21
|
+
fieldBackground: string;
|
|
22
|
+
fieldForeground: string;
|
|
23
|
+
fieldPlaceholder: string;
|
|
24
|
+
fieldBorder: string;
|
|
25
|
+
success: string;
|
|
26
|
+
successForeground: string;
|
|
27
|
+
warning: string;
|
|
28
|
+
warningForeground: string;
|
|
29
|
+
danger: string;
|
|
30
|
+
dangerForeground: string;
|
|
31
|
+
segment: string;
|
|
32
|
+
segmentForeground: string;
|
|
33
|
+
border: string;
|
|
34
|
+
separator: string;
|
|
35
|
+
focus: string;
|
|
36
|
+
link: string;
|
|
37
|
+
};
|
|
38
|
+
/** The derived layer — computed by `deriveColors`, never written by hand. */
|
|
39
|
+
type XAUIDerivedColors = {
|
|
40
|
+
accentPressed: string;
|
|
41
|
+
successPressed: string;
|
|
42
|
+
warningPressed: string;
|
|
43
|
+
dangerPressed: string;
|
|
44
|
+
defaultPressed: string;
|
|
45
|
+
surfacePressed: string;
|
|
46
|
+
defaultSoft: string;
|
|
47
|
+
defaultSoftForeground: string;
|
|
48
|
+
defaultSoftPressed: string;
|
|
49
|
+
accentSoft: string;
|
|
50
|
+
accentSoftForeground: string;
|
|
51
|
+
accentSoftPressed: string;
|
|
52
|
+
successSoft: string;
|
|
53
|
+
successSoftForeground: string;
|
|
54
|
+
successSoftPressed: string;
|
|
55
|
+
warningSoft: string;
|
|
56
|
+
warningSoftForeground: string;
|
|
57
|
+
warningSoftPressed: string;
|
|
58
|
+
dangerSoft: string;
|
|
59
|
+
dangerSoftForeground: string;
|
|
60
|
+
dangerSoftPressed: string;
|
|
61
|
+
backgroundSecondary: string;
|
|
62
|
+
backgroundTertiary: string;
|
|
63
|
+
backgroundInverse: string;
|
|
64
|
+
borderSecondary: string;
|
|
65
|
+
borderTertiary: string;
|
|
66
|
+
separatorSecondary: string;
|
|
67
|
+
separatorTertiary: string;
|
|
68
|
+
fieldPressed: string;
|
|
69
|
+
fieldFocus: string;
|
|
70
|
+
fieldBorderPressed: string;
|
|
71
|
+
fieldBorderFocus: string;
|
|
72
|
+
};
|
|
73
|
+
/** Constant across both modes. */
|
|
74
|
+
type XAUIPrimitiveColors = {
|
|
75
|
+
white: string;
|
|
76
|
+
black: string;
|
|
77
|
+
snow: string;
|
|
78
|
+
eclipse: string;
|
|
79
|
+
};
|
|
80
|
+
/** Everything a component reads, flattened. */
|
|
81
|
+
type XAUIColors = XAUISourceColors & XAUIDerivedColors & XAUIPrimitiveColors;
|
|
82
|
+
type ColorMode = 'light' | 'dark';
|
|
83
|
+
type Size = 'xs' | 'sm' | 'md' | 'lg';
|
|
84
|
+
type RadiusKey = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | 'field' | 'full';
|
|
85
|
+
type FontSizeKey = Size | 'xl' | '2xl' | '3xl' | '4xl';
|
|
86
|
+
type FontWeightKey = 'regular' | 'medium' | 'semibold' | 'bold';
|
|
87
|
+
type XAUIRadius = Record<RadiusKey, number>;
|
|
88
|
+
type XAUIShadow = {
|
|
89
|
+
shadowColor: string;
|
|
90
|
+
shadowOffset: {
|
|
91
|
+
width: number;
|
|
92
|
+
height: number;
|
|
93
|
+
};
|
|
94
|
+
shadowOpacity: number;
|
|
95
|
+
shadowRadius: number;
|
|
96
|
+
elevation: number;
|
|
97
|
+
};
|
|
98
|
+
type XAUITheme = {
|
|
99
|
+
id: string;
|
|
100
|
+
mode: ColorMode;
|
|
101
|
+
colors: XAUIColors;
|
|
102
|
+
/** Base 4 — `spacing(3) === 12`. A function, so there is no "what do we call 12px". */
|
|
103
|
+
spacing: (steps: number) => number;
|
|
104
|
+
radius: XAUIRadius;
|
|
105
|
+
borderWidth: {
|
|
106
|
+
default: number;
|
|
107
|
+
field: number;
|
|
108
|
+
};
|
|
109
|
+
fontSizes: Record<FontSizeKey, number>;
|
|
110
|
+
lineHeights: Record<FontSizeKey, number>;
|
|
111
|
+
/**
|
|
112
|
+
* Typed as RN's own `fontWeight` rather than `string`: a `string` does not assign to
|
|
113
|
+
* it, so every component reading `t.fontWeights.medium` would have needed a cast.
|
|
114
|
+
*/
|
|
115
|
+
fontWeights: Record<FontWeightKey, TextStyle['fontWeight']>;
|
|
116
|
+
fontFamilies: {
|
|
117
|
+
body: string;
|
|
118
|
+
heading: string;
|
|
119
|
+
mono: string;
|
|
120
|
+
};
|
|
121
|
+
/** Semantic roles, not a scale: dark mode drops the surface shadow entirely. */
|
|
122
|
+
shadows: {
|
|
123
|
+
surface: XAUIShadow;
|
|
124
|
+
overlay: XAUIShadow;
|
|
125
|
+
field: XAUIShadow;
|
|
126
|
+
};
|
|
127
|
+
opacity: {
|
|
128
|
+
disabled: number;
|
|
129
|
+
};
|
|
130
|
+
controlHeights: Record<Size, number>;
|
|
131
|
+
};
|
|
132
|
+
type XAUIThemeConfig = {
|
|
133
|
+
colors?: {
|
|
134
|
+
light?: Partial<XAUISourceColors & XAUIDerivedColors>;
|
|
135
|
+
dark?: Partial<XAUISourceColors & XAUIDerivedColors>;
|
|
136
|
+
};
|
|
137
|
+
/** The single base the whole radius scale derives from. */
|
|
138
|
+
radius?: number;
|
|
139
|
+
spacingUnit?: number;
|
|
140
|
+
borderWidth?: Partial<XAUITheme['borderWidth']>;
|
|
141
|
+
fontSizes?: Partial<XAUITheme['fontSizes']>;
|
|
142
|
+
lineHeights?: Partial<XAUITheme['lineHeights']>;
|
|
143
|
+
fontWeights?: Partial<XAUITheme['fontWeights']>;
|
|
144
|
+
fontFamilies?: Partial<XAUITheme['fontFamilies']>;
|
|
145
|
+
/** Per role, and `shadowOffset` is replaced whole — a half-set offset is not a shadow. */
|
|
146
|
+
shadows?: {
|
|
147
|
+
[K in keyof XAUITheme['shadows']]?: Partial<XAUIShadow>;
|
|
148
|
+
};
|
|
149
|
+
opacity?: Partial<XAUITheme['opacity']>;
|
|
150
|
+
controlHeights?: Partial<XAUITheme['controlHeights']>;
|
|
151
|
+
};
|
|
152
|
+
/** What `createTheme` returns: both modes, resolved, sharing one id. */
|
|
153
|
+
type XAUIThemeSet = {
|
|
154
|
+
id: string;
|
|
155
|
+
light: XAUITheme;
|
|
156
|
+
dark: XAUITheme;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export type { ColorMode as C, FontSizeKey as F, RadiusKey as R, Size as S, XAUIColors as X, FontWeightKey as a, XAUIDerivedColors as b, XAUIPrimitiveColors as c, XAUIRadius as d, XAUIShadow as e, XAUISourceColors as f, XAUITheme as g, XAUIThemeConfig as h, XAUIThemeSet as i };
|