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

feat(standard): add theme color meta #772

Merged
merged 4 commits into from
Aug 13, 2024

Conversation

davidlj95
Copy link
Owner

@davidlj95 davidlj95 commented Aug 12, 2024

Issue or need

Fixes #771

Proposed changes

Adds a new metadata provider for standard module to manage <meta name="theme-color">

This one is a bit tricky as:

  1. A media attribute can be specified. To specify a theme color based on a CSS media query context. Like one for light mode and another for dark mode.
  2. Multiple elements may be specified. Which makes sense if using media attribute to specify one for light mode and one for dark mode.

API

The introduced metadata manager allows for most cases:

  1. No color: provide undefined or null, as usual
  2. One color (without media query): provide a string with that color
  3. Multiple colors each with a media CSS query: provide an array with objects specifying media query and color
  4. Multiple colors, but one without media CSS query: provide an array with objects specifying (or not) media query and color
  5. One color with a media query: provide an array with only 1 element that contains media query and color
  6. No color: can be achieved by providing an empty array too

This should be cover all possible cases.

To think about

  • Rename content to color? Yup, much more expressive
  • Simplify API possible values by dropping the string value. If you want just 1 colour, specify an array with only 1 object with that color. This reduces a bit of code. A bit inconvenient if just 1 colour to set though. Not much code would be reduced, given we need to have that branch of code anyway for null | undefined values. Leaving it there for now

Pending

  • Add to features list

Quick reminders

  • 🤝 I will follow Code of Conduct
  • No existing pull request already does almost same changes
  • 👁️ Contributing docs are something I've taken a look at
  • 📝 Commit messages convention has been followed
  • 💬 TSDoc comments have been added or updated indicating API visibility if API surface has changed.
  • 🧪 Tests have been added if needed. For instance, if adding new features or fixing a bug. Or removed if removing features.
  • ⚙️ API Report has been updated if API surface is altered.

Copy link
Owner Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @davidlj95 and the rest of your teammates on Graphite Graphite

@davidlj95 davidlj95 force-pushed the stacked/feat-standard-add-theme-color-meta branch from 2c2d90a to 9d869c1 Compare August 12, 2024 20:41
Copy link

codecov bot commented Aug 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.42%. Comparing base (9083287) to head (00b9d3d).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #772      +/-   ##
==========================================
+ Coverage   97.31%   97.42%   +0.11%     
==========================================
  Files          74       75       +1     
  Lines         335      350      +15     
  Branches       58       61       +3     
==========================================
+ Hits          326      341      +15     
  Partials        9        9              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@davidlj95 davidlj95 force-pushed the stacked/feat-standard-add-theme-color-meta branch from 9d869c1 to 917dfd9 Compare August 12, 2024 20:53
@davidlj95 davidlj95 force-pushed the stacked/feat-standard-add-theme-color-meta branch from 917dfd9 to 6f99454 Compare August 12, 2024 20:59
Copy link

github-actions bot commented Aug 12, 2024

📦 Bundle size (Angular v15)

Git ref: 00b9d3d662c5263e7fd879267d31c51521b20602

Module file Size Base size Difference
ngx-meta-core.mjs 3513 bytes (3.5KiB) 3501 bytes (3.5KiB) .34%: 12 bytes (12B)
ngx-meta-json-ld.mjs 386 bytes (386B) 386 bytes (386B) No change
ngx-meta-open-graph.mjs 1246 bytes (1.3KiB) 1246 bytes (1.3KiB) No change
ngx-meta-routing.mjs 1009 bytes (1009B) 1009 bytes (1009B) No change
ngx-meta-standard.mjs 1089 bytes (1.1KiB) 881 bytes (881B) 23.60%: 208 bytes (208B)
ngx-meta-twitter-card.mjs 667 bytes (667B) 667 bytes (667B) No change
Total 7910 bytes (7.8KiB) 7690 bytes (7.6KiB) 2.86%: 220 bytes (220B)

Copy link

github-actions bot commented Aug 12, 2024

📦 Bundle size (Angular v16)

Git ref: 00b9d3d662c5263e7fd879267d31c51521b20602

Module file Size Base size Difference
ngx-meta-core.mjs 3513 bytes (3.5KiB) 3501 bytes (3.5KiB) .34%: 12 bytes (12B)
ngx-meta-json-ld.mjs 386 bytes (386B) 386 bytes (386B) No change
ngx-meta-open-graph.mjs 1246 bytes (1.3KiB) 1246 bytes (1.3KiB) No change
ngx-meta-routing.mjs 1009 bytes (1009B) 1009 bytes (1009B) No change
ngx-meta-standard.mjs 1089 bytes (1.1KiB) 881 bytes (881B) 23.60%: 208 bytes (208B)
ngx-meta-twitter-card.mjs 667 bytes (667B) 667 bytes (667B) No change
Total 7910 bytes (7.8KiB) 7690 bytes (7.6KiB) 2.86%: 220 bytes (220B)

Copy link

github-actions bot commented Aug 12, 2024

📦 Bundle size (Angular v18)

Git ref: 00b9d3d662c5263e7fd879267d31c51521b20602

Module file Size Base size Difference
ngx-meta-core.mjs 3108 bytes (3.1KiB) 3098 bytes (3.1KiB) .32%: 10 bytes (10B)
ngx-meta-json-ld.mjs 226 bytes (226B) 226 bytes (226B) No change
ngx-meta-open-graph.mjs 899 bytes (899B) 899 bytes (899B) No change
ngx-meta-routing.mjs 843 bytes (843B) 843 bytes (843B) No change
ngx-meta-standard.mjs 990 bytes (990B) 764 bytes (764B) 29.58%: 226 bytes (226B)
ngx-meta-twitter-card.mjs 510 bytes (510B) 510 bytes (510B) No change
Total 6576 bytes (6.5KiB) 6340 bytes (6.2KiB) 3.72%: 236 bytes (236B)

Copy link

github-actions bot commented Aug 12, 2024

📦 Bundle size (Angular v17)

Git ref: 00b9d3d662c5263e7fd879267d31c51521b20602

Module file Size Base size Difference
ngx-meta-core.mjs 3108 bytes (3.1KiB) 3098 bytes (3.1KiB) .32%: 10 bytes (10B)
ngx-meta-json-ld.mjs 226 bytes (226B) 226 bytes (226B) No change
ngx-meta-open-graph.mjs 899 bytes (899B) 899 bytes (899B) No change
ngx-meta-routing.mjs 843 bytes (843B) 843 bytes (843B) No change
ngx-meta-standard.mjs 990 bytes (990B) 764 bytes (764B) 29.58%: 226 bytes (226B)
ngx-meta-twitter-card.mjs 510 bytes (510B) 510 bytes (510B) No change
Total 6576 bytes (6.5KiB) 6340 bytes (6.2KiB) 3.72%: 236 bytes (236B)

@davidlj95 davidlj95 force-pushed the stacked/feat-standard-add-theme-color-meta branch from 82e62fd to 1dfa28b Compare August 13, 2024 00:27
@davidlj95 davidlj95 added the preview docs Enables previewing docs in a PR label Aug 13, 2024
@davidlj95 davidlj95 marked this pull request as ready for review August 13, 2024 00:36
@davidlj95 davidlj95 enabled auto-merge (squash) August 13, 2024 00:36
@davidlj95 davidlj95 disabled auto-merge August 13, 2024 00:37
@davidlj95 davidlj95 merged commit 3205f08 into main Aug 13, 2024
34 checks passed
@davidlj95 davidlj95 deleted the stacked/feat-standard-add-theme-color-meta branch August 13, 2024 01:23
Copy link

🎉 This PR is included in version 1.0.0-beta.11 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preview docs Enables previewing docs in a PR released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add theme-color standard meta
1 participant