+
+
diff --git a/docs/src/content/docs/components/baseline-status.mdx b/docs/src/content/docs/components/baseline-status.mdx
index a2e05be..af4c9f0 100644
--- a/docs/src/content/docs/components/baseline-status.mdx
+++ b/docs/src/content/docs/components/baseline-status.mdx
@@ -18,9 +18,6 @@ import { BaselineStatus } from 'astro-embed';
---
-
-
-
````
@@ -28,9 +25,6 @@ import { BaselineStatus } from 'astro-embed';
import { BaselineStatus } from 'astro-embed';
-
-
-
````
@@ -39,9 +33,170 @@ import { BaselineStatus } from 'astro-embed';
The above code produces the following result:
+
+### The `id` attribute
+
+The `` component requires an `id` attribute which sets the web feature to display browser support data for.
+This ID is the slug of the feature as stored in the [`web-platform-dx/web-features`](https://github.com/web-platform-dx/web-features) repository.
+The [Web Platform Status](https://webstatus.dev/) site is also a helpful place to search for feature IDs.
+
+For example, the ID for the CSS `:has()` selector is `has`:
+
+```astro
+
+```
+
-
-
+
+## Styling the component
+
+Due to its relatively complex layout and content, the `` component uses [Declarative Shadow DOM](https://web.dev/articles/declarative-shadow-dom) to isolate its markup from your site’s styles.
+You can override the default styles using the [`::part()` pseudo-element](https://developer.mozilla.org/en-US/docs/Web/CSS/::part).
+
+```css
+.baseline-status::part(root) {
+ color-scheme: light;
+ background: floralwhite;
+ color: darkblue;
+ font-family: fantasy;
+ border: 1px dashed;
+}
+
+.baseline-status::part(feature-name) {
+ color: purple;
+ font-weight: bold;
+}
+```
+
+The above styles would render `` like this:
+
+import StyledBaseline from './_examples/StyledBaseline.astro';
+
+
+
+### Light/dark theming support
+
+The default styles make a best effort to adapt automatically to a site’s color theme.
+
+By default, text color is inherited from the document styles and the component has a transparent background. Colors used in iconography adapt to the user’s color scheme preference using a `prefers-color-scheme` media query.
+
+In browsers that support the [`light-dark()` CSS function](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/light-dark), if your site sets the correct `color-scheme` values, `` will adapt to match the current theme even if it does not match system-level color scheme preferences.
+
+
+
+#### Supporting a custom theme picker
+
+If your site uses a theme picker to set the current theme and you need to support older browsers, you can add custom styles to control the color variables `` uses.
+
+For example, if you use a `data-theme="dark"` attribute to enable dark mode on your site, configure colors when that is set:
+
+```css
+[data-theme="dark"] .baseline-status::part(root) {
+ --baseline-status-color-limited: var(--baseline-status-color-limited--dark);
+ --baseline-status-color-newly: var(--baseline-status-color-newly--dark);
+ --baseline-status-color-widely: var(--baseline-status-color-widely--dark);
+ /* ... */
+}
+```
+
+See [“Custom properties API”](#custom-properties-api) below for a full list of available variables.
+
+### Component parts API
+
+The following component parts are exposed to set custom styles in your CSS.
+
+#### `::part(root)`
+
+Selects the wrapper at the base of the component.
+Particularly useful for setting CSS variables that impact component styles.
+
+
+#### `::part(feature-name)`
+
+The name of the feature support information is being displayed for.
+
+#### `::part(details)`
+
+The `` element.
+
+#### `::part(summary)`
+
+The `` element.
+
+#### `::part(summary-content)`
+
+The main content of the `` element. This includes the visible text (`summary-label`) and browser icons (`browsers`), but excludes the Baseline icon and disclosure caret (`caret`).
+
+#### `::part(summary-label)`
+
+Element specifying the global support level in the ``, e.g. text reading “Baseline: Widely available” or “Limited availability”.
+
+#### `::part(badge)`
+
+Badge element added to highlight newly available Baseline features.
+
+#### `::part(browsers)`
+
+Wrapper element around the browser support icons.
+
+#### `::part(browser-support)`
+
+A browser support lockup, including browser logo, support level icon, and accessible text label.
+
+#### `::part(browser-support-label)`
+
+Accessible text label for browser support, visually hidden by default.
+
+#### `::part(caret)`
+
+The disclosure caret displayed instead of the default `` marker.
+
+#### `::part(description)`
+
+The detailed description of the support level visible when the component is expanded.
+
+#### `::part(link)`
+
+The link element visible when the component is expanded.
+
+### Custom properties API
+
+The `` component supports the following API for controlling its styles with CSS custom properties.
+
+```css
+.baseline-status::part(root) {
+ /* Light color scheme */
+ --baseline-status-color-limited--light: #ea8600;
+ --baseline-status-color-newly--light: #1a73e8;
+ --baseline-status-color-widely--light: #1e8e3e;
+ --baseline-status-color-no_data--light: #707070;
+ --baseline-status-color-outline--light: #d9d9d9;
+ --baseline-status-color-text--light: inherit;
+ --baseline-status-color-link--light: #1a73e8;
+ --baseline-icon-limited-front--light: #f09409;
+ --baseline-icon-limited-back--light: #c6c6c6;
+ --baseline-icon-widely-front--light: #1ea446;
+ --baseline-icon-widely-back--light: #c4eed0;
+ --baseline-icon-newly-front--light: #1b6ef3;
+ --baseline-icon-newly-back--light: #a8c7fa;
+ --baseline-icon-no_data--light: #909090;
+ /* Dark color scheme */
+ --baseline-status-color-limited--dark: #f09418;
+ --baseline-status-color-newly--dark: #4185ff;
+ --baseline-status-color-widely--dark: #24a446;
+ --baseline-status-color-no_data--dark: #868686;
+ --baseline-status-color-outline--dark: #d9d9d9;
+ --baseline-status-color-text--dark: inherit;
+ --baseline-status-color-link--dark: #5aa1ff;
+ --baseline-icon-limited-front--dark: #f09409;
+ --baseline-icon-limited-back--dark: #565656;
+ --baseline-icon-widely-front--dark: #1ea446;
+ --baseline-icon-widely-back--dark: #125225;
+ --baseline-icon-newly-front--dark: #4185ff;
+ --baseline-icon-newly-back--dark: #2d509e;
+ --baseline-icon-no_data--dark: #666666;
+}
+```
## Standalone installation
From 6f78c6651125f8c35fb40640d51dad8efd3a62bc Mon Sep 17 00:00:00 2001
From: Chris Swithinbank
Date: Sat, 26 Oct 2024 00:30:20 +0200
Subject: [PATCH 24/42] One more example on the demo page
---
demo/src/pages/baseline-status.astro | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/demo/src/pages/baseline-status.astro b/demo/src/pages/baseline-status.astro
index c3221d2..ee9ac34 100644
--- a/demo/src/pages/baseline-status.astro
+++ b/demo/src/pages/baseline-status.astro
@@ -17,6 +17,10 @@ import Base from '../layouts/Base.astro';
<BaselineStatus id="masonry" />
+
+ <BaselineStatus id="has" />
+
+
Missing feature
<BaselineStatus id="rainbow-unicorns" />
From df68d573835eb8b7ddbd1e3370145b1e29c488af Mon Sep 17 00:00:00 2001
From: Chris Swithinbank
Date: Sat, 26 Oct 2024 00:47:31 +0200
Subject: [PATCH 25/42] Add changeset
---
.changeset/calm-actors-hug.md | 8 ++++++++
1 file changed, 8 insertions(+)
create mode 100644 .changeset/calm-actors-hug.md
diff --git a/.changeset/calm-actors-hug.md b/.changeset/calm-actors-hug.md
new file mode 100644
index 0000000..ccbef38
--- /dev/null
+++ b/.changeset/calm-actors-hug.md
@@ -0,0 +1,8 @@
+---
+"@astro-community/astro-embed-baseline-status": minor
+"astro-embed": minor
+---
+
+Adds new `` component
+
+This component displays the status of a web feature according to the [Baseline](https://web.dev/baseline/) project.
From 7eaf0a10bf593c33ec57d6e8e32cc0f6d236c4c2 Mon Sep 17 00:00:00 2001
From: Chris Swithinbank
Date: Sat, 26 Oct 2024 00:49:45 +0200
Subject: [PATCH 26/42] Link `` implementation in docs
---
docs/src/content/docs/components/baseline-status.mdx | 1 +
1 file changed, 1 insertion(+)
diff --git a/docs/src/content/docs/components/baseline-status.mdx b/docs/src/content/docs/components/baseline-status.mdx
index af4c9f0..861336c 100644
--- a/docs/src/content/docs/components/baseline-status.mdx
+++ b/docs/src/content/docs/components/baseline-status.mdx
@@ -7,6 +7,7 @@ import { Tabs, TabItem } from '@astrojs/starlight/components';
import { BaselineStatus } from '@astro-community/astro-embed-baseline-status';
The `` component displays browser support for a given web feature according to the [Baseline](https://web.dev/baseline/) project.
+This component is based on the [official `` custom element](https://github.com/web-platform-dx/baseline-status), but avoids using any client-side JavaScript.
## Usage
From afa5a2f7789a114d0a01cd59baf05be362c6fa36 Mon Sep 17 00:00:00 2001
From: Chris Swithinbank
Date: Sat, 26 Oct 2024 18:21:14 +0200
Subject: [PATCH 27/42] Add color variables for newly available badge
---
.../docs/components/baseline-status.mdx | 7 +++++--
package-lock.json | 3 ++-
.../BaselineStatus.astro | 20 +++++++++++++++++--
3 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/docs/src/content/docs/components/baseline-status.mdx b/docs/src/content/docs/components/baseline-status.mdx
index 861336c..fe40ca9 100644
--- a/docs/src/content/docs/components/baseline-status.mdx
+++ b/docs/src/content/docs/components/baseline-status.mdx
@@ -92,7 +92,7 @@ If your site uses a theme picker to set the current theme and you need to suppor
For example, if you use a `data-theme="dark"` attribute to enable dark mode on your site, configure colors when that is set:
```css
-[data-theme="dark"] .baseline-status::part(root) {
+[data-theme='dark'] .baseline-status::part(root) {
--baseline-status-color-limited: var(--baseline-status-color-limited--dark);
--baseline-status-color-newly: var(--baseline-status-color-newly--dark);
--baseline-status-color-widely: var(--baseline-status-color-widely--dark);
@@ -111,7 +111,6 @@ The following component parts are exposed to set custom styles in your CSS.
Selects the wrapper at the base of the component.
Particularly useful for setting CSS variables that impact component styles.
-
#### `::part(feature-name)`
The name of the feature support information is being displayed for.
@@ -174,6 +173,8 @@ The `` component supports the following API for controlling its
--baseline-status-color-outline--light: #d9d9d9;
--baseline-status-color-text--light: inherit;
--baseline-status-color-link--light: #1a73e8;
+ --baseline-badge-background--light: #3367d6;
+ --baseline-badge-text--light: #fff;
--baseline-icon-limited-front--light: #f09409;
--baseline-icon-limited-back--light: #c6c6c6;
--baseline-icon-widely-front--light: #1ea446;
@@ -189,6 +190,8 @@ The `` component supports the following API for controlling its
--baseline-status-color-outline--dark: #d9d9d9;
--baseline-status-color-text--dark: inherit;
--baseline-status-color-link--dark: #5aa1ff;
+ --baseline-badge-background--dark: #3367d6;
+ --baseline-badge-text--dark: #fff;
--baseline-icon-limited-front--dark: #f09409;
--baseline-icon-limited-back--dark: #565656;
--baseline-icon-widely-front--dark: #1ea446;
diff --git a/package-lock.json b/package-lock.json
index 05a145d..9f1ab6e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -12567,6 +12567,7 @@
"version": "0.7.4",
"license": "MIT",
"dependencies": {
+ "@astro-community/astro-embed-baseline-status": "^0.0.1",
"@astro-community/astro-embed-integration": "^0.7.2",
"@astro-community/astro-embed-link-preview": "^0.2.2",
"@astro-community/astro-embed-twitter": "^0.5.6",
@@ -12617,7 +12618,7 @@
},
"packages/astro-embed-twitter": {
"name": "@astro-community/astro-embed-twitter",
- "version": "0.5.6",
+ "version": "0.5.7",
"license": "MIT",
"dependencies": {
"@astro-community/astro-embed-utils": "^0.1.0"
diff --git a/packages/astro-embed-baseline-status/BaselineStatus.astro b/packages/astro-embed-baseline-status/BaselineStatus.astro
index 27c1f36..5980780 100644
--- a/packages/astro-embed-baseline-status/BaselineStatus.astro
+++ b/packages/astro-embed-baseline-status/BaselineStatus.astro
@@ -157,6 +157,8 @@ const year =
--baseline-status-color-outline--light: #d9d9d9;
--baseline-status-color-text--light: inherit;
--baseline-status-color-link--light: #1a73e8;
+ --baseline-badge-background--light: #3367d6;
+ --baseline-badge-text--light: #fff;
--baseline-icon-limited-front--light: #f09409;
--baseline-icon-limited-back--light: #c6c6c6;
--baseline-icon-widely-front--light: #1ea446;
@@ -172,6 +174,8 @@ const year =
--baseline-status-color-outline--dark: #d9d9d9;
--baseline-status-color-text--dark: inherit;
--baseline-status-color-link--dark: #5aa1ff;
+ --baseline-badge-background--dark: #3367d6;
+ --baseline-badge-text--dark: #fff;
--baseline-icon-limited-front--dark: #f09409;
--baseline-icon-limited-back--dark: #565656;
--baseline-icon-widely-front--dark: #1ea446;
@@ -194,6 +198,8 @@ const year =
);
--baseline-status-color-text: var(--baseline-status-color-text--light);
--baseline-status-color-link: var(--baseline-status-color-link--light);
+ --baseline-badge-background: var(--baseline-badge-background--light);
+ --baseline-badge-text: var(--baseline-badge-text--light);
--baseline-icon-limited-front: var(--baseline-icon-limited-front--light);
--baseline-icon-limited-back: var(--baseline-icon-limited-back--light);
--baseline-icon-widely-front: var(--baseline-icon-widely-front--light);
@@ -230,6 +236,8 @@ const year =
);
--baseline-status-color-text: var(--baseline-status-color-text--dark);
--baseline-status-color-link: var(--baseline-status-color-link--dark);
+ --baseline-badge-background: var(--baseline-badge-background--dark);
+ --baseline-badge-text: var(--baseline-badge-text--dark);
--baseline-icon-limited-front: var(--baseline-icon-limited-front--dark);
--baseline-icon-limited-back: var(--baseline-icon-limited-back--dark);
--baseline-icon-widely-front: var(--baseline-icon-widely-front--dark);
@@ -271,6 +279,14 @@ const year =
var(--baseline-status-color-link--light),
var(--baseline-status-color-link--dark)
);
+ --baseline-badge-background: light-dark(
+ var(--baseline-badge-background--light),
+ var(--baseline-badge-background--dark)
+ );
+ --baseline-badge-text: light-dark(
+ var(--baseline-badge-text--light),
+ var(--baseline-badge-text--dark)
+ );
--baseline-icon-limited-front: light-dark(
var(--baseline-icon-limited-front--light),
var(--baseline-icon-limited-front--dark)
@@ -343,8 +359,8 @@ const year =
}
.baseline-status::part(badge) {
- background: #3367d6;
- color: #fff;
+ background: var(--baseline-badge-background);
+ color: var(--baseline-badge-text);
font-size: 0.6875rem;
padding-inline: 4px;
border-radius: 2px;
From ac34cb1a73811c7209383a41f2d0a96c09781359 Mon Sep 17 00:00:00 2001
From: Chris Swithinbank
Date: Sat, 26 Oct 2024 18:32:36 +0200
Subject: [PATCH 28/42] Simplify custom property naming
---
.../docs/components/baseline-status.mdx | 92 +++----
.../BaselineIcon.astro | 8 +-
.../BaselineStatus.astro | 246 +++++++++---------
.../SupportIcon.astro | 10 +-
4 files changed, 172 insertions(+), 184 deletions(-)
diff --git a/docs/src/content/docs/components/baseline-status.mdx b/docs/src/content/docs/components/baseline-status.mdx
index fe40ca9..6c256af 100644
--- a/docs/src/content/docs/components/baseline-status.mdx
+++ b/docs/src/content/docs/components/baseline-status.mdx
@@ -93,15 +93,58 @@ For example, if you use a `data-theme="dark"` attribute to enable dark mode on y
```css
[data-theme='dark'] .baseline-status::part(root) {
- --baseline-status-color-limited: var(--baseline-status-color-limited--dark);
- --baseline-status-color-newly: var(--baseline-status-color-newly--dark);
- --baseline-status-color-widely: var(--baseline-status-color-widely--dark);
+ --color-limited: var(--color-limited--dark);
+ --color-newly: var(--color-newly--dark);
+ --color-widely: var(--color-widely--dark);
/* ... */
}
```
See [“Custom properties API”](#custom-properties-api) below for a full list of available variables.
+### Custom properties API
+
+The `` component supports the following API for controlling its styles with CSS custom properties.
+
+```css
+.baseline-status::part(root) {
+ /* Light color scheme */
+ --color-limited--light: #ea8600;
+ --color-newly--light: #1a73e8;
+ --color-widely--light: #1e8e3e;
+ --color-no_data--light: #707070;
+ --color-outline--light: #d9d9d9;
+ --color-text--light: inherit;
+ --color-link--light: #1a73e8;
+ --color-badge-background--light: #3367d6;
+ --color-badge-text--light: #fff;
+ --color-icon-limited-front--light: #f09409;
+ --color-icon-limited-back--light: #c6c6c6;
+ --color-icon-widely-front--light: #1ea446;
+ --color-icon-widely-back--light: #c4eed0;
+ --color-icon-newly-front--light: #1b6ef3;
+ --color-icon-newly-back--light: #a8c7fa;
+ --color-icon-no_data--light: #909090;
+ /* Dark color scheme */
+ --color-limited--dark: #f09418;
+ --color-newly--dark: #4185ff;
+ --color-widely--dark: #24a446;
+ --color-no_data--dark: #868686;
+ --color-outline--dark: #d9d9d9;
+ --color-text--dark: inherit;
+ --color-link--dark: #5aa1ff;
+ --color-badge-background--dark: #3367d6;
+ --color-badge-text--dark: #fff;
+ --color-icon-limited-front--dark: #f09409;
+ --color-icon-limited-back--dark: #565656;
+ --color-icon-widely-front--dark: #1ea446;
+ --color-icon-widely-back--dark: #125225;
+ --color-icon-newly-front--dark: #4185ff;
+ --color-icon-newly-back--dark: #2d509e;
+ --color-icon-no_data--dark: #666666;
+}
+```
+
### Component parts API
The following component parts are exposed to set custom styles in your CSS.
@@ -159,49 +202,6 @@ The detailed description of the support level visible when the component is expa
The link element visible when the component is expanded.
-### Custom properties API
-
-The `` component supports the following API for controlling its styles with CSS custom properties.
-
-```css
-.baseline-status::part(root) {
- /* Light color scheme */
- --baseline-status-color-limited--light: #ea8600;
- --baseline-status-color-newly--light: #1a73e8;
- --baseline-status-color-widely--light: #1e8e3e;
- --baseline-status-color-no_data--light: #707070;
- --baseline-status-color-outline--light: #d9d9d9;
- --baseline-status-color-text--light: inherit;
- --baseline-status-color-link--light: #1a73e8;
- --baseline-badge-background--light: #3367d6;
- --baseline-badge-text--light: #fff;
- --baseline-icon-limited-front--light: #f09409;
- --baseline-icon-limited-back--light: #c6c6c6;
- --baseline-icon-widely-front--light: #1ea446;
- --baseline-icon-widely-back--light: #c4eed0;
- --baseline-icon-newly-front--light: #1b6ef3;
- --baseline-icon-newly-back--light: #a8c7fa;
- --baseline-icon-no_data--light: #909090;
- /* Dark color scheme */
- --baseline-status-color-limited--dark: #f09418;
- --baseline-status-color-newly--dark: #4185ff;
- --baseline-status-color-widely--dark: #24a446;
- --baseline-status-color-no_data--dark: #868686;
- --baseline-status-color-outline--dark: #d9d9d9;
- --baseline-status-color-text--dark: inherit;
- --baseline-status-color-link--dark: #5aa1ff;
- --baseline-badge-background--dark: #3367d6;
- --baseline-badge-text--dark: #fff;
- --baseline-icon-limited-front--dark: #f09409;
- --baseline-icon-limited-back--dark: #565656;
- --baseline-icon-widely-front--dark: #1ea446;
- --baseline-icon-widely-back--dark: #125225;
- --baseline-icon-newly-front--dark: #4185ff;
- --baseline-icon-newly-back--dark: #2d509e;
- --baseline-icon-no_data--dark: #666666;
-}
-```
-
## Standalone installation
If you only need the `` component, you can install the package directly instead of the main `astro-embed` package:
diff --git a/packages/astro-embed-baseline-status/BaselineIcon.astro b/packages/astro-embed-baseline-status/BaselineIcon.astro
index 08d52c1..005833a 100644
--- a/packages/astro-embed-baseline-status/BaselineIcon.astro
+++ b/packages/astro-embed-baseline-status/BaselineIcon.astro
@@ -6,10 +6,10 @@ interface Props {
}
const paths = {
- limited: ``,
- widely: ``,
- newly: ``,
- no_data: ``,
+ limited: ``,
+ widely: ``,
+ newly: ``,
+ no_data: ``,
};
---
diff --git a/packages/astro-embed-baseline-status/BaselineStatus.astro b/packages/astro-embed-baseline-status/BaselineStatus.astro
index 5980780..bcc791e 100644
--- a/packages/astro-embed-baseline-status/BaselineStatus.astro
+++ b/packages/astro-embed-baseline-status/BaselineStatus.astro
@@ -150,67 +150,61 @@ const year =
From e978111db00288a61b5d563e61dcb92095ae3c0a Mon Sep 17 00:00:00 2001
From: Chris Swithinbank
Date: Sat, 26 Oct 2024 19:24:33 +0200
Subject: [PATCH 35/42] Let summary label and browser icons wrap on small
screens
---
packages/astro-embed-baseline-status/BaselineStatus.astro | 2 ++
1 file changed, 2 insertions(+)
diff --git a/packages/astro-embed-baseline-status/BaselineStatus.astro b/packages/astro-embed-baseline-status/BaselineStatus.astro
index 0506059..b7befc8 100644
--- a/packages/astro-embed-baseline-status/BaselineStatus.astro
+++ b/packages/astro-embed-baseline-status/BaselineStatus.astro
@@ -316,6 +316,7 @@ const year =
.baseline-status::part(summary-label) {
display: flex;
+ flex-wrap: wrap;
align-items: center;
gap: 0.2rem;
}
@@ -336,6 +337,7 @@ const year =
font-size: 0;
max-width: 12.5rem;
display: flex;
+ flex-wrap: wrap;
gap: 1rem;
}
From cf50030e5f1c68c6a5a37d97e5feb078dbba7266 Mon Sep 17 00:00:00 2001
From: Chris Swithinbank
Date: Sat, 26 Oct 2024 19:50:39 +0200
Subject: [PATCH 36/42] Tweak line heights/alignment
---
packages/astro-embed-baseline-status/BaselineStatus.astro | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/packages/astro-embed-baseline-status/BaselineStatus.astro b/packages/astro-embed-baseline-status/BaselineStatus.astro
index b7befc8..b3307aa 100644
--- a/packages/astro-embed-baseline-status/BaselineStatus.astro
+++ b/packages/astro-embed-baseline-status/BaselineStatus.astro
@@ -200,6 +200,7 @@ const year =
max-width: 50rem;
font-family: Roboto, sans-serif;
font-size: 0.875rem;
+ line-height: calc(1.5 / 0.875);
font-style: normal;
}
@@ -282,6 +283,7 @@ const year =
.baseline-status::part(feature-name) {
font-size: 1.25rem;
+ line-height: calc(1.5 / 1.25);
margin: 0;
}
@@ -295,6 +297,7 @@ const year =
display: flex;
cursor: pointer;
font-size: 1rem;
+ line-height: calc(1.5 / 1);
display: flex;
flex-wrap: wrap;
gap: 1rem;
@@ -311,6 +314,7 @@ const year =
display: flex;
flex-wrap: wrap;
justify-content: space-between;
+ align-items: center;
flex: 1;
}
@@ -325,10 +329,10 @@ const year =
background: var(--color-badge-background);
color: var(--color-badge-text);
font-size: 0.6875rem;
+ line-height: calc(1.25 / 0.6875);
padding-inline: 0.25rem;
border-radius: 0.125rem;
text-transform: uppercase;
- line-height: 1.8;
margin-inline: 0.5rem;
white-space: nowrap;
}
From c0bc4acc1942538a029a18b8f12d5c3421a53339 Mon Sep 17 00:00:00 2001
From: Chris Swithinbank
Date: Sat, 26 Oct 2024 23:43:02 +0200
Subject: [PATCH 37/42] Add variant class name API
---
.../docs/components/baseline-status.mdx | 20 +++++++++++++++++++
.../BaselineStatus.astro | 2 +-
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/docs/src/content/docs/components/baseline-status.mdx b/docs/src/content/docs/components/baseline-status.mdx
index 11474e9..9a1b1f9 100644
--- a/docs/src/content/docs/components/baseline-status.mdx
+++ b/docs/src/content/docs/components/baseline-status.mdx
@@ -143,6 +143,26 @@ The `` component supports the following API for controlling its
}
```
+### CSS class names API
+
+The root element of the `` component can be targeted using the `.baseline-status` selector.
+
+In addition, the following variant class names are applied and can be used to customise appearance for the different Baseline status levels:
+
+- `.baseline-status--limited`: applied if the feature has limited availability
+- `.baseline-status--newly`: applied if the feature is newly available
+- `.baseline-status--widely`: applied if the feature is widely available
+- `.baseline-status--no_data`: applied if there is no data available for the feature
+
+For example, you could use these to set a custom outline color for widely available features:
+
+```css
+.baseline-status--widely::part(root) {
+ --color-outline--light: green;
+ --color-outline--dark: lime;
+}
+```
+
### Component parts API
The following component parts are exposed to set custom styles in your CSS.
diff --git a/packages/astro-embed-baseline-status/BaselineStatus.astro b/packages/astro-embed-baseline-status/BaselineStatus.astro
index b3307aa..6aae8a5 100644
--- a/packages/astro-embed-baseline-status/BaselineStatus.astro
+++ b/packages/astro-embed-baseline-status/BaselineStatus.astro
@@ -84,7 +84,7 @@ const year =
baseline === 'newly' && baselineDate ? baselineDate.split(' ')[1]! : '';
---
-
+
{feature.name}
From cfd1bd1ac8634231a29484c7b4863b14e4c88eb2 Mon Sep 17 00:00:00 2001
From: Chris Swithinbank
Date: Sat, 26 Oct 2024 23:50:03 +0200
Subject: [PATCH 38/42] Add custom property for card background
---
docs/src/content/docs/components/baseline-status.mdx | 2 ++
.../astro-embed-baseline-status/BaselineStatus.astro | 9 +++++++++
2 files changed, 11 insertions(+)
diff --git a/docs/src/content/docs/components/baseline-status.mdx b/docs/src/content/docs/components/baseline-status.mdx
index 9a1b1f9..33a4969 100644
--- a/docs/src/content/docs/components/baseline-status.mdx
+++ b/docs/src/content/docs/components/baseline-status.mdx
@@ -114,6 +114,7 @@ The `` component supports the following API for controlling its
.baseline-status::part(root) {
/* Light color scheme */
--color-outline--light: #d9d9d9;
+ --color-background--light: transparent;
--color-text--light: inherit;
--color-link--light: #1a73e8;
--color-badge-background--light: #3367d6;
@@ -128,6 +129,7 @@ The `` component supports the following API for controlling its
--color-no_data-secondary--light: #909090;
/* Dark color scheme */
--color-outline--dark: #d9d9d9;
+ --color-background--dark: transparent;
--color-text--dark: inherit;
--color-link--dark: #5aa1ff;
--color-badge-background--dark: #3367d6;
diff --git a/packages/astro-embed-baseline-status/BaselineStatus.astro b/packages/astro-embed-baseline-status/BaselineStatus.astro
index 6aae8a5..21f5f33 100644
--- a/packages/astro-embed-baseline-status/BaselineStatus.astro
+++ b/packages/astro-embed-baseline-status/BaselineStatus.astro
@@ -150,6 +150,7 @@ const year =
.baseline-status::part(root) {
/* Light palette */
--color-outline--light: #d9d9d9;
+ --color-background--light: transparent;
--color-text--light: inherit;
--color-link--light: #1a73e8;
--color-badge-background--light: #3367d6;
@@ -164,6 +165,7 @@ const year =
--color-no_data-secondary--light: #909090;
/* Dark palette */
--color-outline--dark: #666666;
+ --color-background--dark: transparent;
--color-text--dark: inherit;
--color-link--dark: #5aa1ff;
--color-badge-background--dark: #3367d6;
@@ -183,6 +185,7 @@ const year =
--color-widely: var(--color-widely--light);
--color-no_data: var(--color-no_data--light);
--color-outline: var(--color-outline--light);
+ --color-background: var(--color-background--light);
--color-text: var(--color-text--light);
--color-link: var(--color-link--light);
--color-badge-background: var(--color-badge-background--light);
@@ -195,6 +198,7 @@ const year =
color: var(--color-text);
border: solid 1px var(--color-outline);
border-radius: 0.5rem;
+ background: var(--color-background);
padding-top: 1rem;
padding-inline: 1.5rem;
max-width: 50rem;
@@ -212,6 +216,7 @@ const year =
--color-widely: var(--color-widely--dark);
--color-no_data: var(--color-no_data--dark);
--color-outline: var(--color-outline--dark);
+ --color-background: var(--color-background--dark);
--color-text: var(--color-text--dark);
--color-link: var(--color-link--dark);
--color-badge-background: var(--color-badge-background--dark);
@@ -246,6 +251,10 @@ const year =
var(--color-outline--light),
var(--color-outline--dark)
);
+ --color-background: light-dark(
+ var(--color-background--light),
+ var(--color-background--dark)
+ );
--color-text: light-dark(
var(--color-text--light),
var(--color-text--dark)
From 37f9eb532a36a03d9f60b16ca1b696cda92d81bf Mon Sep 17 00:00:00 2001
From: Chris Swithinbank
Date: Sat, 26 Oct 2024 23:50:50 +0200
Subject: [PATCH 39/42] Add custom style test to demo page
---
demo/src/pages/baseline-status.astro | 30 ++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/demo/src/pages/baseline-status.astro b/demo/src/pages/baseline-status.astro
index ee9ac34..efd6dda 100644
--- a/demo/src/pages/baseline-status.astro
+++ b/demo/src/pages/baseline-status.astro
@@ -26,4 +26,34 @@ import Base from '../layouts/Base.astro';
<BaselineStatus id="rainbow-unicorns" />
+
With custom styles
+
+
+ <BaselineStatus id="anchor-positioning" />
+
+
+
+ <BaselineStatus id="has" />
+
+
+
+ <BaselineStatus id="scroll-snap" />
+
+
+
+
+
From 5d8ab735427945346c69d92fa491d8fafa6f7dda Mon Sep 17 00:00:00 2001
From: Chris Swithinbank
Date: Sun, 27 Oct 2024 00:01:11 +0200
Subject: [PATCH 40/42] Improve CSS class name docs example
---
.../_examples/StyledBaselineVariants.astro | 19 +++++++++++++++++++
.../docs/components/baseline-status.mdx | 12 +++++++++---
2 files changed, 28 insertions(+), 3 deletions(-)
create mode 100644 docs/src/content/docs/components/_examples/StyledBaselineVariants.astro
diff --git a/docs/src/content/docs/components/_examples/StyledBaselineVariants.astro b/docs/src/content/docs/components/_examples/StyledBaselineVariants.astro
new file mode 100644
index 0000000..5430a34
--- /dev/null
+++ b/docs/src/content/docs/components/_examples/StyledBaselineVariants.astro
@@ -0,0 +1,19 @@
+---
+import { BaselineStatus } from '@astro-community/astro-embed-baseline-status';
+import type { ComponentProps } from 'astro/types';
+
+export type Props = ComponentProps;
+---
+
+
+
+
+
+
diff --git a/docs/src/content/docs/components/baseline-status.mdx b/docs/src/content/docs/components/baseline-status.mdx
index 33a4969..a78c805 100644
--- a/docs/src/content/docs/components/baseline-status.mdx
+++ b/docs/src/content/docs/components/baseline-status.mdx
@@ -156,15 +156,21 @@ In addition, the following variant class names are applied and can be used to cu
- `.baseline-status--widely`: applied if the feature is widely available
- `.baseline-status--no_data`: applied if there is no data available for the feature
-For example, you could use these to set a custom outline color for widely available features:
+For example, you could use these to display custom colors only for widely available features:
```css
.baseline-status--widely::part(root) {
- --color-outline--light: green;
- --color-outline--dark: lime;
+ --color-outline--light: hsl(120, 100%, 80%);
+ --color-background--light: hsl(120, 100%, 95%);
+ --color-outline--dark: hsl(120, 100%, 20%);
+ --color-background--dark: hsl(120, 100%, 5%);
}
```
+import BaselineVariants from './_examples/StyledBaselineVariants.astro';
+
+
+
### Component parts API
The following component parts are exposed to set custom styles in your CSS.
From 3c048fbdd2edf5672ec16dbfdfdb78b7f798eb78 Mon Sep 17 00:00:00 2001
From: Chris Swithinbank
Date: Sun, 27 Oct 2024 11:37:58 +0100
Subject: [PATCH 41/42] Improve `package.json`
---
package-lock.json | 3 +++
.../astro-embed-baseline-status/package.json | 17 ++++++++++++++---
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 9f1ab6e..2f00cc9 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -12584,6 +12584,9 @@
"license": "MIT",
"dependencies": {
"@astro-community/astro-embed-utils": "^0.1.0"
+ },
+ "peerDependencies": {
+ "astro": "^4.0.0-beta || ^5.0.0-beta"
}
},
"packages/astro-embed-integration": {
diff --git a/packages/astro-embed-baseline-status/package.json b/packages/astro-embed-baseline-status/package.json
index ba3b2a8..451147a 100644
--- a/packages/astro-embed-baseline-status/package.json
+++ b/packages/astro-embed-baseline-status/package.json
@@ -4,13 +4,21 @@
"description": "Component to easily embed the Baseline status of a web feature on your Astro site",
"type": "module",
"exports": {
- ".": "./index.ts",
- "./matcher": "./matcher.ts"
+ ".": "./index.ts"
},
"repository": {
"type": "git",
- "url": "git+https://github.com/delucis/astro-embed.git"
+ "url": "git+https://github.com/delucis/astro-embed.git",
+ "directory": "packages/astro-embed-baseline-status"
},
+ "keywords": [
+ "astro",
+ "astro-component",
+ "ui",
+ "embeds",
+ "baseline"
+ ],
+ "author": "delucis",
"license": "MIT",
"bugs": {
"url": "https://github.com/delucis/astro-embed/issues"
@@ -18,5 +26,8 @@
"homepage": "https://github.com/delucis/astro-embed/tree/main/packages/astro-embed-baseline-status#readme",
"dependencies": {
"@astro-community/astro-embed-utils": "^0.1.0"
+ },
+ "peerDependencies": {
+ "astro": "^4.0.0-beta || ^5.0.0-beta"
}
}
From ea56cdda24ec3a0d0f43e8cdec7ea0f6b7f38090 Mon Sep 17 00:00:00 2001
From: Chris Swithinbank
Date: Sun, 27 Oct 2024 11:44:05 +0100
Subject: [PATCH 42/42] Fix colors in Chrome logo
---
.../icons/browsers/chrome.svg | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/packages/astro-embed-baseline-status/icons/browsers/chrome.svg b/packages/astro-embed-baseline-status/icons/browsers/chrome.svg
index 43b617d..91c9b78 100644
--- a/packages/astro-embed-baseline-status/icons/browsers/chrome.svg
+++ b/packages/astro-embed-baseline-status/icons/browsers/chrome.svg
@@ -1,7 +1,7 @@
-