@uniflowed/stylex 0.8.0 → 0.9.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/index.js +4 -1
- package/package.json +2 -2
- package/theme.js +3 -3
- package/tokens.stylex.js +53 -4
package/index.js
CHANGED
|
@@ -153,10 +153,13 @@ export function create<T extends { readonly [string]: mixed }>(
|
|
|
153
153
|
|
|
154
154
|
/**
|
|
155
155
|
* Declare design tokens, and hand back the `var(--…)` references to them.
|
|
156
|
+
* Every compiled value is a string, including a token with a numeric default.
|
|
156
157
|
*
|
|
157
158
|
* Compile-time, for the same reason as `create`.
|
|
158
159
|
*/
|
|
159
|
-
export function defineVars<T extends { readonly [string]: ThemeValue }>(
|
|
160
|
+
export function defineVars<T extends { readonly [string]: ThemeValue }>(
|
|
161
|
+
tokens: T,
|
|
162
|
+
): { readonly [Key in keyof T]: string } {
|
|
160
163
|
return nativeRuntimeRequired(MODULE, "stylex.defineVars");
|
|
161
164
|
}
|
|
162
165
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniflowed/stylex",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Flow declarations for @uniflowed/stylex, part of the Unified Toolchain for Flow.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"!*.test.js"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@uniflowed/core": "0.
|
|
26
|
+
"@uniflowed/core": "0.9.0"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"react-native": ">=0.86.0"
|
package/theme.js
CHANGED
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
// actually pairs, and `crates/uf_stylex/src/tests/preset.rs` computes those
|
|
52
52
|
// ratios from the compiled stylesheet.
|
|
53
53
|
|
|
54
|
-
import { stylex } from "@uniflowed/stylex";
|
|
54
|
+
import { stylex, type CompiledStyle } from "@uniflowed/stylex";
|
|
55
55
|
|
|
56
56
|
import { ufTokens } from "./tokens.stylex.js";
|
|
57
57
|
|
|
@@ -61,7 +61,7 @@ import { ufTokens } from "./tokens.stylex.js";
|
|
|
61
61
|
* Every entry is conditional, so this theme is inert in light mode and costs
|
|
62
62
|
* exactly one `@media (prefers-color-scheme: dark)` block.
|
|
63
63
|
*/
|
|
64
|
-
export const ufAutoTheme = stylex.createTheme(ufTokens, {
|
|
64
|
+
export const ufAutoTheme: CompiledStyle = stylex.createTheme(ufTokens, {
|
|
65
65
|
canvas: { "@media (prefers-color-scheme: dark)": "#141413" },
|
|
66
66
|
sunken: { "@media (prefers-color-scheme: dark)": "#0f0f0e" },
|
|
67
67
|
surface: { "@media (prefers-color-scheme: dark)": "#1c1c1a" },
|
|
@@ -87,7 +87,7 @@ export const ufAutoTheme = stylex.createTheme(ufTokens, {
|
|
|
87
87
|
* For a subtree that is dark whatever the system says, and for the stored
|
|
88
88
|
* preference a reader chose.
|
|
89
89
|
*/
|
|
90
|
-
export const ufDarkTheme = stylex.createTheme(ufTokens, {
|
|
90
|
+
export const ufDarkTheme: CompiledStyle = stylex.createTheme(ufTokens, {
|
|
91
91
|
canvas: "#141413",
|
|
92
92
|
sunken: "#0f0f0e",
|
|
93
93
|
surface: "#1c1c1a",
|
package/tokens.stylex.js
CHANGED
|
@@ -59,10 +59,59 @@
|
|
|
59
59
|
|
|
60
60
|
import { stylex } from "@uniflowed/stylex";
|
|
61
61
|
|
|
62
|
-
//
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
// The explicit key set is also the module interface downstream themes read.
|
|
63
|
+
export type UFTokens = {|
|
|
64
|
+
readonly canvas: string,
|
|
65
|
+
readonly sunken: string,
|
|
66
|
+
readonly surface: string,
|
|
67
|
+
readonly surfaceHover: string,
|
|
68
|
+
readonly border: string,
|
|
69
|
+
readonly ink: string,
|
|
70
|
+
readonly muted: string,
|
|
71
|
+
readonly accent: string,
|
|
72
|
+
readonly accentHover: string,
|
|
73
|
+
readonly accentInk: string,
|
|
74
|
+
readonly accentSoft: string,
|
|
75
|
+
readonly danger: string,
|
|
76
|
+
readonly dangerHover: string,
|
|
77
|
+
readonly dangerInk: string,
|
|
78
|
+
readonly dangerSoft: string,
|
|
79
|
+
readonly focus: string,
|
|
80
|
+
readonly scrim: string,
|
|
81
|
+
readonly fontSans: string,
|
|
82
|
+
readonly fontMono: string,
|
|
83
|
+
readonly textXs: string,
|
|
84
|
+
readonly textSm: string,
|
|
85
|
+
readonly textMd: string,
|
|
86
|
+
readonly textLg: string,
|
|
87
|
+
readonly textXl: string,
|
|
88
|
+
readonly text2Xl: string,
|
|
89
|
+
readonly leadingTight: string,
|
|
90
|
+
readonly leadingBase: string,
|
|
91
|
+
readonly weightRegular: string,
|
|
92
|
+
readonly weightMedium: string,
|
|
93
|
+
readonly weightBold: string,
|
|
94
|
+
readonly space1: string,
|
|
95
|
+
readonly space2: string,
|
|
96
|
+
readonly space3: string,
|
|
97
|
+
readonly space4: string,
|
|
98
|
+
readonly space6: string,
|
|
99
|
+
readonly space8: string,
|
|
100
|
+
readonly space12: string,
|
|
101
|
+
readonly radiusSm: string,
|
|
102
|
+
readonly radiusMd: string,
|
|
103
|
+
readonly radiusLg: string,
|
|
104
|
+
readonly radiusPill: string,
|
|
105
|
+
readonly sizeControl: string,
|
|
106
|
+
readonly durationFast: string,
|
|
107
|
+
readonly durationBase: string,
|
|
108
|
+
readonly durationSlow: string,
|
|
109
|
+
readonly easing: string,
|
|
110
|
+
readonly easingEnter: string,
|
|
111
|
+
readonly easingExit: string,
|
|
112
|
+
|};
|
|
113
|
+
|
|
114
|
+
export const ufTokens: UFTokens = stylex.defineVars({
|
|
66
115
|
// Surfaces, from furthest back to nearest front.
|
|
67
116
|
canvas: "#f6f6f4",
|
|
68
117
|
sunken: "#eeeeeb",
|