stylex icon indicating copy to clipboard operation
stylex copied to clipboard

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

Open aspizu opened this issue 9 months ago • 5 comments

Describe the feature request

If not, I can work on this.

aspizu avatar Apr 26 '24 22:04 aspizu

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.

nmn avatar Apr 26 '24 23:04 nmn

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 now radius[1]
  • var(--radius-conditional-1) becomes radiusConditional[1]

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

aspizu avatar Apr 27 '24 13:04 aspizu

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 avatar Apr 27 '24 13:04 aspizu

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

aspizu avatar Apr 27 '24 13:04 aspizu

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.

derekjwilliams avatar Apr 30 '24 17:04 derekjwilliams