forked from WordPress/gutenberg
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Block supports: add fluid typography (WordPress#39529)
* Initial commit * Enabling fluid type in theme.json Only allowing rem and px * Alternative calculation for fluid type * Implementing new algorithm using max and mix viewport widths * Refactoring the method to accept a `maxSize` * The linter of doom! Testing out a new model that allows all values to be custom, with a fallback clamp implementation. * Extracting internal implementation. * Added missing doc comment for fluid prop in theme.json * Remove dupe presets * Remove dupe settings * Creating new compat file for 6.1 * Created fallback for min and max viewport widths Returning `min()` CSS rule where there's only a maximum font size Returning `max()` CSS rule where there's only a minimum font size Removing `fluidFormula` as a property and related logic * Checking for valid units Adding tests Docs * Looking in layout settings for viewport width fallbacks * Post-rebase file shuffling. Renaming properties to `__experimental*` * Update CHANGELOG.md * min(), max() and clamp() automatically parse mathematic expressions so removing calc() props @wongjn * We're now supporting passing single values to the fluid type calculator, and returning clamp values based on a set of defaults: minFontSizeFactor, maxFontSizeFactor and scaleFactor. So that themes can opt-in to the system, typography.fluid should be true, in which case default values will be used, or an object of viewport width, minFontSizeFactor, maxFontSizeFactor and scaleFactor. The values in fontSizes will take precedence, then, if they're not there, we'll calculate a min and max font size based on the scale value. The calculations for min() and max() have been removed since we'll always have a min and max font size value. This means we're returning a clamp() value always. I think that's okay as it also removes any unexpected side effects. * Refactoring function signatures to pass options array instead of multiple args. * Merge default args in gutenberg_get_typography_value_and_unit using wp_parse_args * Fix merge conflicts with trunk. Updated JSON schema. * - add to settings > fluid would be a boolean true to enable the feature. - remove content settings as fallbacks - rename fluidSize to fluid in the typography settings for each font. - unit tests * - update docs * reverse min/max viewport width Updated tests Co-authored-by: Ben Dwyer <[email protected]>
- Loading branch information
Showing
6 changed files
with
311 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters