-
Notifications
You must be signed in to change notification settings - Fork 77
feat: add support for makeResetStyles transforms #236
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "type": "minor", | ||
| "comment": "feat: add support for makeResetStyles transforms", | ||
| "packageName": "@griffel/babel-preset", | ||
| "email": "olfedias@microsoft.com", | ||
| "dependentChangeType": "patch" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "type": "minor", | ||
| "comment": "feat: add support for makeResetStyles transforms", | ||
| "packageName": "@griffel/webpack-loader", | ||
| "email": "olfedias@microsoft.com", | ||
| "dependentChangeType": "patch" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import { makeResetStyles } from '@griffel/react'; | ||
|
|
||
| import blank from './blank.jpg'; | ||
| import blankDuplicate from './blank.jpg'; | ||
| import empty from './empty.jpg'; | ||
|
|
||
| export const useStyles = makeResetStyles({ | ||
| backgroundImage: `url(${blank})`, | ||
| ':hover': { backgroundImage: `url(${blankDuplicate})` }, | ||
| ':focus': { backgroundImage: `url(${empty})` }, | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import _asset2 from './empty.jpg'; | ||
| import _asset from './blank.jpg'; | ||
| import { __resetStyles } from '@griffel/react'; | ||
| import blank from './blank.jpg'; | ||
| import blankDuplicate from './blank.jpg'; | ||
| import empty from './empty.jpg'; | ||
| export const useStyles = __resetStyles('ra9m047', null, [ | ||
| `.ra9m047{background-image:url(${_asset});}`, | ||
| `.ra9m047:hover{background-image:url(${_asset});}`, | ||
| `.ra9m047:focus{background-image:url(${_asset2});}`, | ||
| ]); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| const react_make_styles_1 = require('@griffel/react'); | ||
|
|
||
| export const useStyles = react_make_styles_1.makeResetStyles({ | ||
| fontSize: '14px', | ||
| lineHeight: 1, | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| const react_make_styles_1 = require('@griffel/react'); | ||
|
|
||
| export const useStyles = react_make_styles_1.__resetStyles('r1qlvv59', null, [ | ||
| '.r1qlvv59{font-size:14px;line-height:1;}', | ||
| ]); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import { makeResetStyles } from '@griffel/react'; | ||
|
|
||
| export const useStyles = makeResetStyles({ | ||
| color: 'red', | ||
| paddingLeft: '4px', | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { __resetStyles } from '@griffel/react'; | ||
| export const useStyles = __resetStyles('rjefjbm', 'r7z97ji', [ | ||
| '.rjefjbm{color:red;padding-left:4px;}', | ||
| '.r7z97ji{color:red;padding-right:4px;}', | ||
| ]); |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3,7 +3,11 @@ import type { EvalRule } from '@linaria/babel-preset'; | |||||||||
|
|
||||||||||
| export type BabelPluginOptions = { | ||||||||||
| /** Defines set of modules and imports handled by a transformPlugin. */ | ||||||||||
| modules?: { moduleSource: string; importName: string }[]; | ||||||||||
| modules?: { | ||||||||||
| moduleSource: string; | ||||||||||
| importName: string; | ||||||||||
| resetImportName?: string; | ||||||||||
|
Comment on lines
+8
to
+9
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
it's a bit longer, but it might make things clearer in the plugin code
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's the part of public API so a change there will be BC, that's why it's like that 🥲 |
||||||||||
| }[]; | ||||||||||
|
|
||||||||||
| /** | ||||||||||
| * If you need to specify custom Babel configuration, you can pass them here. These options will be used by the | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
both makeStyles and makeResetStyles accept an object only as param right ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, will check it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restored to the previous condition, don't remember why it looks like that