@xaui/native 0.9.1-alpha.0 → 0.9.1-alpha.1

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