Skip to content

Commit

Permalink
Typography block support: add typography support and defaults (#34064)
Browse files Browse the repository at this point in the history
* Initial commit. Adding typography fontSize and lineHeight supports defaults in block.json where the block supports each.

* Removing line height typography default support
Opting-in to all typography supports for text blocks (except font-family for code block)
Site title: toggle all typography options as default
Other titles (heading, post title, query title): add weight and style, and text-transform defaults

* Using `fontAppearance` in __experimentalDefaultControls to flag that the fontStyle/fontWeight support control should show as default.

* Removing Font family and Text decoration opt-in until a second pass.

Apply suggestions from code review

Co-authored-by: Aaron Robertshaw <[email protected]>

Reinstating typography opt-ins pending further advice

* Reinstating typography opt-ins pending further advice

* Remove __experimentalTextTransform

since the rendered output is a number
  • Loading branch information
ramonjd authored Nov 3, 2021
1 parent 0ca8df8 commit 1b0ff7e
Show file tree
Hide file tree
Showing 28 changed files with 214 additions and 27 deletions.
5 changes: 4 additions & 1 deletion packages/block-library/src/button/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@
},
"typography": {
"fontSize": true,
"__experimentalFontFamily": true
"__experimentalFontFamily": true,
"__experimentalDefaultControls": {
"fontSize": true
}
},
"reusable": false,
"spacing": {
Expand Down
10 changes: 9 additions & 1 deletion packages/block-library/src/code/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@
"anchor": true,
"__experimentalSelector": ".wp-block-code > code",
"typography": {
"fontSize": true
"fontSize": true,
"lineHeight": true,
"__experimentalFontStyle": true,
"__experimentalFontWeight": true,
"__experimentalLetterSpacing": true,
"__experimentalTextTransform": true,
"__experimentalDefaultControls": {
"fontSize": true
}
},
"spacing": {
"margin": [ "top", "bottom" ],
Expand Down
10 changes: 9 additions & 1 deletion packages/block-library/src/heading/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,15 @@
"typography": {
"fontSize": true,
"lineHeight": true,
"__experimentalFontWeight": true
"__experimentalFontStyle": true,
"__experimentalFontWeight": true,
"__experimentalLetterSpacing": true,
"__experimentalTextTransform": true,
"__experimentalDefaultControls": {
"fontSize": true,
"fontAppearance": true,
"textTransform": true
}
},
"__experimentalSelector": "h1,h2,h3,h4,h5,h6",
"__unstablePasteTextInline": true,
Expand Down
10 changes: 9 additions & 1 deletion packages/block-library/src/list/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,15 @@
"className": false,
"typography": {
"fontSize": true,
"__experimentalFontFamily": true
"__experimentalFontFamily": true,
"lineHeight": true,
"__experimentalFontStyle": true,
"__experimentalFontWeight": true,
"__experimentalLetterSpacing": true,
"__experimentalTextTransform": true,
"__experimentalDefaultControls": {
"fontSize": true
}
},
"color": {
"gradients": true,
Expand Down
5 changes: 4 additions & 1 deletion packages/block-library/src/navigation/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@
"__experimentalFontWeight": true,
"__experimentalTextTransform": true,
"__experimentalFontFamily": true,
"__experimentalTextDecoration": true
"__experimentalTextDecoration": true,
"__experimentalDefaultControls": {
"fontSize": true
}
},
"spacing": {
"blockGap": true,
Expand Down
7 changes: 5 additions & 2 deletions packages/block-library/src/paragraph/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,12 @@
"typography": {
"fontSize": true,
"lineHeight": true,
"__experimentalFontStyle": true,
"__experimentalFontWeight": true,
"__experimentalLetterSpacing": true,
"__experimentalTextTransform": true,
"__experimentalDefaultControls": {
"fontSize": true,
"lineHeight": true
"fontSize": true
}
},
"__experimentalSelector": "p",
Expand Down
9 changes: 8 additions & 1 deletion packages/block-library/src/post-author/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,14 @@
},
"typography": {
"fontSize": true,
"lineHeight": true
"lineHeight": true,
"__experimentalFontStyle": true,
"__experimentalFontWeight": true,
"__experimentalLetterSpacing": true,
"__experimentalTextTransform": true,
"__experimentalDefaultControls": {
"fontSize": true
}
},
"color": {
"gradients": true,
Expand Down
5 changes: 4 additions & 1 deletion packages/block-library/src/post-comment-date/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@
"__experimentalFontWeight": true,
"__experimentalFontStyle": true,
"__experimentalTextTransform": true,
"__experimentalLetterSpacing": true
"__experimentalLetterSpacing": true,
"__experimentalDefaultControls": {
"fontSize": true
}
}
}
}
8 changes: 7 additions & 1 deletion packages/block-library/src/post-comments-count/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@
},
"typography": {
"fontSize": true,
"lineHeight": true
"lineHeight": true,
"__experimentalFontStyle": true,
"__experimentalFontWeight": true,
"__experimentalLetterSpacing": true,
"__experimentalDefaultControls": {
"fontSize": true
}
}
}
}
9 changes: 8 additions & 1 deletion packages/block-library/src/post-comments-form/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@
},
"typography": {
"fontSize": true,
"lineHeight": true
"lineHeight": true,
"__experimentalFontStyle": true,
"__experimentalFontWeight": true,
"__experimentalLetterSpacing": true,
"__experimentalTextTransform": true,
"__experimentalDefaultControls": {
"fontSize": true
}
}
},
"style": [ "wp-block-post-comments-form", "wp-block-buttons", "wp-block-button" ]
Expand Down
9 changes: 8 additions & 1 deletion packages/block-library/src/post-comments-link/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@
},
"typography": {
"fontSize": true,
"lineHeight": true
"lineHeight": true,
"__experimentalFontStyle": true,
"__experimentalFontWeight": true,
"__experimentalLetterSpacing": true,
"__experimentalTextTransform": true,
"__experimentalDefaultControls": {
"fontSize": true
}
}
}
}
9 changes: 8 additions & 1 deletion packages/block-library/src/post-comments/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@
"align": [ "wide", "full" ],
"typography": {
"fontSize": true,
"lineHeight": true
"lineHeight": true,
"__experimentalFontStyle": true,
"__experimentalFontWeight": true,
"__experimentalLetterSpacing": true,
"__experimentalTextTransform": true,
"__experimentalDefaultControls": {
"fontSize": true
}
},
"color": {
"gradients": true,
Expand Down
5 changes: 4 additions & 1 deletion packages/block-library/src/post-date/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
"__experimentalFontWeight": true,
"__experimentalFontStyle": true,
"__experimentalTextTransform": true,
"__experimentalLetterSpacing": true
"__experimentalLetterSpacing": true,
"__experimentalDefaultControls": {
"fontSize": true
}
}
}
}
9 changes: 8 additions & 1 deletion packages/block-library/src/post-excerpt/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@
},
"typography": {
"fontSize": true,
"lineHeight": true
"lineHeight": true,
"__experimentalFontStyle": true,
"__experimentalFontWeight": true,
"__experimentalLetterSpacing": true,
"__experimentalTextTransform": true,
"__experimentalDefaultControls": {
"fontSize": true
}
}
},
"editorStyle": "wp-block-post-excerpt-editor",
Expand Down
9 changes: 8 additions & 1 deletion packages/block-library/src/post-navigation-link/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@
"html": false,
"typography": {
"fontSize": true,
"lineHeight": true
"lineHeight": true,
"__experimentalFontStyle": true,
"__experimentalFontWeight": true,
"__experimentalLetterSpacing": true,
"__experimentalTextTransform": true,
"__experimentalDefaultControls": {
"fontSize": true
}
}
}
}
8 changes: 7 additions & 1 deletion packages/block-library/src/post-terms/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@
"typography": {
"lineHeight": true,
"fontSize": true,
"__experimentalFontWeight": true
"__experimentalFontStyle": true,
"__experimentalFontWeight": true,
"__experimentalLetterSpacing": true,
"__experimentalTextTransform": true,
"__experimentalDefaultControls": {
"fontSize": true
}
}
},
"style": "wp-block-post-terms"
Expand Down
8 changes: 7 additions & 1 deletion packages/block-library/src/post-title/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@
"__experimentalFontFamily": true,
"__experimentalFontWeight": true,
"__experimentalFontStyle": true,
"__experimentalTextTransform": true
"__experimentalTextTransform": true,
"__experimentalLetterSpacing": true,
"__experimentalDefaultControls": {
"fontSize": true,
"fontAppearance": true,
"textTransform": true
}
}
},
"style": "wp-block-post-title"
Expand Down
10 changes: 9 additions & 1 deletion packages/block-library/src/preformatted/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,15 @@
"gradients": true
},
"typography": {
"fontSize": true
"fontSize": true,
"lineHeight": true,
"__experimentalFontStyle": true,
"__experimentalFontWeight": true,
"__experimentalLetterSpacing": true,
"__experimentalTextTransform": true,
"__experimentalDefaultControls": {
"fontSize": true
}
}
},
"style": "wp-block-preformatted"
Expand Down
12 changes: 12 additions & 0 deletions packages/block-library/src/pullquote/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@
"background": true,
"link": true
},
"typography": {
"fontSize": true,
"lineHeight": true,
"__experimentalFontStyle": true,
"__experimentalFontWeight": true,
"__experimentalLetterSpacing": true,
"__experimentalTextTransform": true,
"__experimentalDefaultControls": {
"fontSize": true,
"fontAppearance": true
}
},
"__experimentalBorder": {
"color": true,
"radius": true,
Expand Down
9 changes: 8 additions & 1 deletion packages/block-library/src/query-pagination-next/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@
},
"typography": {
"fontSize": true,
"lineHeight": true
"lineHeight": true,
"__experimentalFontStyle": true,
"__experimentalFontWeight": true,
"__experimentalLetterSpacing": true,
"__experimentalTextTransform": true,
"__experimentalDefaultControls": {
"fontSize": true
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@
},
"typography": {
"fontSize": true,
"lineHeight": true
"lineHeight": true,
"__experimentalFontStyle": true,
"__experimentalFontWeight": true,
"__experimentalLetterSpacing": true,
"__experimentalTextTransform": true,
"__experimentalDefaultControls": {
"fontSize": true
}
}
}
}
11 changes: 10 additions & 1 deletion packages/block-library/src/query-title/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,16 @@
"typography": {
"fontSize": true,
"lineHeight": true,
"__experimentalFontFamily": true
"__experimentalFontFamily": true,
"__experimentalFontStyle": true,
"__experimentalFontWeight": true,
"__experimentalLetterSpacing": true,
"__experimentalTextTransform": true,
"__experimentalDefaultControls": {
"fontSize": true,
"fontAppearance": true,
"textTransform": true
}
}
},
"editorStyle": "wp-block-query-title-editor"
Expand Down
14 changes: 13 additions & 1 deletion packages/block-library/src/quote/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,19 @@
},
"supports": {
"anchor": true,
"__experimentalSlashInserter": true
"__experimentalSlashInserter": true,
"typography": {
"fontSize": true,
"lineHeight": true,
"__experimentalFontStyle": true,
"__experimentalFontWeight": true,
"__experimentalLetterSpacing": true,
"__experimentalTextTransform": true,
"__experimentalDefaultControls": {
"fontSize": true,
"fontAppearance": true
}
}
},
"styles": [
{
Expand Down
5 changes: 4 additions & 1 deletion packages/block-library/src/site-tagline/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@
"__experimentalTextTransform": true,
"__experimentalFontStyle": true,
"__experimentalFontWeight": true,
"__experimentalLetterSpacing": true
"__experimentalLetterSpacing": true,
"__experimentalDefaultControls": {
"fontSize": true
}
}
},
"editorStyle": "wp-block-site-tagline-editor"
Expand Down
9 changes: 8 additions & 1 deletion packages/block-library/src/site-title/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,14 @@
"__experimentalTextTransform": true,
"__experimentalFontStyle": true,
"__experimentalFontWeight": true,
"__experimentalLetterSpacing": true
"__experimentalLetterSpacing": true,
"__experimentalDefaultControls": {
"fontSize": true,
"lineHeight": true,
"fontAppearance": true,
"letterSpacing": true,
"textTransform": true
}
}
},
"editorStyle": "wp-block-site-title-editor"
Expand Down
Loading

0 comments on commit 1b0ff7e

Please sign in to comment.