Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for @value #213

Merged
merged 9 commits into from
Jun 16, 2024
Merged

Support for @value #213

merged 9 commits into from
Jun 16, 2024

Conversation

mizdra
Copy link
Owner

@mizdra mizdra commented Aug 5, 2023

close: #212
depends: #265

Example

Basic

Input (1.css):

.basic {
}
@value value: #BF4040;

Generated (1.css.d.ts):

declare const styles:
  & Readonly<{ "basic": string }>
  & Readonly<{ "value": string }>
;
export default styles;
//# sourceMappingURL=./1.css.d.ts.map

Import values from other modules

Input (1.css):

@value value1 from './2.css'; /* single token */
@value value2, value3 from './2.css'; /* multiple tokens */
@value value4 as alias from './2.css'; /* alias */
@value value5 from './2.css'; /* re-exported token */

Input (2.css):

@value value1: '';
@value value2: '';
@value value3: '';
@value value4: '';
@value value5 from './3.css';

Input (3.css):

@value value5: '';

Generated (1.css.d.ts):

declare const styles:
  & Readonly<Pick<(typeof import("./2.css"))["default"], "value1">>
  & Readonly<Pick<(typeof import("./2.css"))["default"], "value2">>
  & Readonly<Pick<(typeof import("./2.css"))["default"], "value3">>
  & Readonly<{ "alias": (typeof import("./2.css"))["default"]["value4"] }>
  & Readonly<Pick<(typeof import("./3.css"))["default"], "value5">>
;
export default styles;
//# sourceMappingURL=./1.css.d.ts.map

Definition jumps are also fully supported.

2024-06-16.12.23.30.mov

@mizdra mizdra added the Type: Add Add new features. label Aug 5, 2023
@mizdra mizdra force-pushed the support-at-value branch 5 times, most recently from b98fd04 to 784e328 Compare May 19, 2024 12:59
@mizdra mizdra force-pushed the support-at-value branch 4 times, most recently from 0a8b19c to 3640407 Compare June 15, 2024 07:55
@mizdra mizdra marked this pull request as ready for review June 16, 2024 03:28
@mizdra
Copy link
Owner Author

mizdra commented Jun 16, 2024

It is finally completed!

@mizdra mizdra merged commit fa9d107 into main Jun 16, 2024
6 checks passed
@mizdra mizdra deleted the support-at-value branch June 16, 2024 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Add Add new features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for @value definitions
1 participant