-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
added outline support for blocks via theme.json #43526
Changes from all commits
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,55 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import type { GeneratedCSSRule, Style, StyleOptions } from '../../types'; | ||
import { generateRule } from '../utils'; | ||
|
||
const color = { | ||
name: 'color', | ||
generate: ( | ||
style: Style, | ||
options: StyleOptions, | ||
path: string[] = [ 'outline', 'color' ], | ||
ruleKey: string = 'outlineColor' | ||
Comment on lines
+12
to
+13
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. I think these two arguments are for box model generation (top, right, bottom, left) which outline doesn't have. They should probably be removed here and passed directly to the @ramonjd am I correct in thinking that? Or does this not matter? 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. Thanks for the ping!
While they share similar arguments, box model generation should use Example is margin. Note the const margin = {
name: 'margin',
generate: ( style: Style, options: StyleOptions ) => {
return generateBoxRules( style, options, [ 'spacing', 'margin' ], {
default: 'margin',
individual: 'margin%s',
} );
},
}; So I think this looks okay.
I don't think it matters in practice, but in theory it might be better to be explicit about the arguments passed to There is little risk of it I'd say, but it would prevent unexpected See how typography is set up, e.g., :
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. |
||
): GeneratedCSSRule[] => { | ||
return generateRule( style, options, path, ruleKey ); | ||
}, | ||
}; | ||
|
||
const offset = { | ||
name: 'offset', | ||
generate: ( | ||
style: Style, | ||
options: StyleOptions, | ||
path: string[] = [ 'outline', 'offset' ], | ||
ruleKey: string = 'outlineColor' | ||
): GeneratedCSSRule[] => { | ||
return generateRule( style, options, path, ruleKey ); | ||
}, | ||
}; | ||
|
||
const outlineStyle = { | ||
name: 'style', | ||
generate: ( | ||
style: Style, | ||
options: StyleOptions, | ||
path: string[] = [ 'outline', 'style' ], | ||
ruleKey: string = 'outlineStyle' | ||
): GeneratedCSSRule[] => { | ||
return generateRule( style, options, path, ruleKey ); | ||
}, | ||
}; | ||
|
||
const width = { | ||
name: 'width', | ||
generate: ( | ||
style: Style, | ||
options: StyleOptions, | ||
path: string[] = [ 'outline', 'width' ], | ||
ruleKey: string = 'outlineWidth' | ||
): GeneratedCSSRule[] => { | ||
return generateRule( style, options, path, ruleKey ); | ||
}, | ||
}; | ||
|
||
export default [ color, outlineStyle, offset, width ]; |
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.
These changes need an Unreleased change log entry, e.g.,