stylex
stylex copied to clipboard
Is stylex/open-props automatically generated from argyleink/open-props?
Describe the feature request
If not, I can work on this.
It's not. Currently it's manually copied. Happy to have you work on automating this, although there are parts that are not easy to automate. Some parts are incompatible altogether. So I would recommend a system that can detect incompatible patterns and stubs those out to be filled manually or manually omitted.
Is it alright if the API changes? Right now, my script puts all tokens in a single open-props.tokens.ts
file. (And yeah, I'm also using typescript instead of flow but we can change that if needed).
For example, the API for the color tokens is blue[0]
instead of colors.blue0
.
-
borders.radius1
is nowradius[1]
-
var(--radius-conditional-1)
becomesradiusConditional[1]
I feel like this is more aligned with the original CSS variable names.
tsc spits out type errors:
../stylex/lib/StyleXTypes.d.ts:227:12 - error TS2344: Type 'TVars' does not satisfy the constraint 'VarGroup<unknown, symbol>'.
Type 'VarGroup<unknown, unknown>' is not assignable to type 'VarGroup<unknown, symbol>'.
Type 'VarGroup<unknown, unknown>' is not assignable to type 'Readonly<{ __opaqueId: symbol; __tokens: unknown; }>'.
Type 'TVars' is not assignable to type 'Readonly<{ __opaqueId: symbol; __tokens: unknown; }>'.
Type 'VarGroup<unknown, unknown>' is not assignable to type 'Readonly<{ __opaqueId: symbol; __tokens: unknown; }>'.
Types of property '__opaqueId' are incompatible.
Type 'unknown' is not assignable to type 'symbol'.
227 ) => Theme<TVars, ThemeID>;
~~~~~
Found 16 errors.
The last error is the same in https://github.com/facebook/stylex/issues/452
Describe the feature request
If not, I can work on this.
I think this is a great idea, let me know if you need any help.