facebook / stylex

StyleX is the styling system for ambitious user interfaces.
https://stylexjs.com
MIT License
8.34k stars 307 forks source link

Is stylex/open-props automatically generated from argyleink/open-props? #557

Closed aspizu closed 3 months ago

aspizu commented 5 months ago

Describe the feature request

If not, I can work on this.

nmn commented 5 months ago

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.

aspizu commented 5 months ago

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.

I feel like this is more aligned with the original CSS variable names.

aspizu commented 5 months ago

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.
aspizu commented 5 months ago

The last error is the same in https://github.com/facebook/stylex/issues/452

derekjwilliams commented 5 months ago

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.