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

Update @capsizecss/core to v4 #243

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

renovate[bot]
Copy link

@renovate renovate bot commented Jan 30, 2025

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
@capsizecss/core (source) ^3.0.0 -> ^4.0.0 age adoption passing confidence

Release Notes

seek-oss/capsize (@​capsizecss/core)

v4.1.2

Compare Source

Patch Changes
  • #​200 6238501 Thanks @​michaeltaranto! - createFontStack: Prefer postscriptName or fullName for fallback source

    The @font-face declaration aliases generated by createFontStack now favour postscriptName and fullName over familyName from the provided metrics when selecting a local font face as a fallback.

    MDN recommends using either fullName and postscriptName when accessing local fonts to ensure the best matching across platforms, while also enabling selection of a single font face within a larger family, e.g. Arial Bold or Arial-BoldMT within Arial.
    For details see MDN.

    ⚠️ Note: Falling back to familyName (original behaviour) makes this work backwards compatible with older versions of font metrics.

v4.1.1

Compare Source

Patch Changes
  • #​198 f55acae Thanks @​michaeltaranto! - createFontStack: Apply line-gap-override with no lineGap in preferred font

    Ensure that the line-gap-override property is applied correctly when overriding a fallback font with a web font that has no lineGap.
    Previously if the override was zero it would be omitted from the declaration, rather than the correct behaviour of overriding the fallback metric to zero.

  • #​199 630a5fe Thanks @​michaeltaranto! - createFontStack: Ensure provided `size-adjust` is factored into metric overrides

    Ensures a custom size-adjust value provided via the fontFaceProperties option is factored into the calculations for the metric overrides.

Example

If a custom size-adjust value is provided:

createFontStack([merriweatherSans, arial], {
  fontFaceProperties: {
    sizeAdjust: '300%',
  },
});

The resulting metric overrides are now adjusted accordingly:

 @​font-face {
   font-family: "Merriweather Sans Fallback";
   src: local('Arial');
-  ascent-override: 92.3409%;
+  ascent-override: 32.8%;
-  descent-override: 25.619%;
+  descent-override: 9.1%;
   line-gap-override: 0%;
   size-adjust: 300%;
 }

v4.1.0

Compare Source

Minor Changes
  • #​177 879208b Thanks @​michaeltaranto! - xWidthAvg: Add subset support for non-latin character sets

    Previously the xWidthAvg metric was calculated based on the character frequency as measured from English text only.
    This resulted in the xWidthAvg metric being incorrect for languages that use a different unicode subset range, e.g. Thai.

    Supporting Thai now enables adding support for other unicode ranges in the future.

What's changed?
@capsizecss/metrics

The subsets field has been added to the metrics object, providing the xWidthAvg metric for each subset — calculated against the relevant character frequency data.

 {
   "familyName": "Abril Fatface",
   ...
+  "subsets": {
+    "latin": {
+      "xWidthAvg": 512
+    },
+    "thai": {
+      "xWidthAvg": 200
+    }
+  }
 }

There are no changes to any of the other existing metrics.

@capsizecss/core

Fallback font stacks can now be generated per subset, allowing the correct xWidthAvg metric to be used for the relevant subset.

The createFontStack API now accepts subset as an option:

const { fontFamily, fontFaces } = createFontStack([lobster, arial], {
  subset: 'thai',
});

v4.0.0

Compare Source

Major Changes
  • #​168 8819ff1 Thanks @​mrm007! - Precompile Capsize packages with Crackle

    Migrating Capsize packages to be precompiled with Crackle, with a key change being Crackle now handles entry points instead of Preconstruct.

    Other benefits include:

    • Modern module entry point syntax using the "exports" field with better tooling compatibility.
    • Improved types and better ESM and CJS compatibility
    • Better alignment between compiled code and module entry points
BREAKING CHANGES:
API changes

While technically a breaking change, consumers of Capsize's public APIs are not affected by this change.
If you are affected due to reaching into package internals, please get in touch and see if we can find a more maintainable approach.

TypeScript

TypeScript consumers should ensure they are using a compatible [moduleResolution strategy in TSConfig][moduleResolution strategy in TSConfig] — either node16, nodenext or bundler. This will ensure types are correctly resolved across the different module specifications.

Patch Changes
  • #​164 a308885 Thanks @​michaeltaranto! - createFontStack: Append original fallback font name to the font stack

    The fontFamily returned from createFontStack now includes the original fallback font name(s). These are appended to the end of the font stack in the case the preferred font and generated fallbacks are not available.

    import lobster from '@​capsizecss/metrics/lobster';
    import arial from '@​capsizecss/metrics/arial';
    
    const { fontFamily } = createFontStack([lobster, arial]);

    Where fontFamily is now:

    - `Lobster, 'Lobster Fallback: Arial'`
    + `Lobster, 'Lobster Fallback: Arial', Arial`
  • #​164 a308885 Thanks @​michaeltaranto! - createFontStack: Quote font-family in @font-face declaration if needed

    Previously, when using fontFaceFormat: 'styleObject', the generated fallback name was not quoted as necessary within the @font-face declaration.
    This could cause issues if the font family name contained spaces or other characters that required quoting.


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

Copy link

changeset-bot bot commented Jan 30, 2025

⚠️ No Changeset found

Latest commit: 94c9982

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants