Compare commits

..

50 Commits

Author SHA1 Message Date
Cory LaViska
8be2eea04a Merge branch 'next' into card-image-rounding 2025-07-17 11:55:16 -04:00
Cory LaViska
c9e6895ef7 fix pill buttons in groups; closes #1165 (#1191) 2025-07-17 11:28:57 -04:00
Konnor Rogers
64c8647dee build speed improvements and add optional incremental builds (#1183)
* build speed improvments

* fix button

* prettier

* move things to plugins / transformers

* final fixes

* build fixes

* fix build issues

* add comment

* build sstuf

* prettier

* fix badge.css

* fix build stuff

* fix eleventy stuff

* prettier
2025-07-16 17:37:47 -04:00
Cory LaViska
c328671992 fix media rounding; closes #1107 2025-07-16 17:01:29 -04:00
randomguy-2650
9e9a00547a fix: fix incorrect documentation link used in @documentation JSDoc (#1187) 2025-07-16 12:02:35 -04:00
Lindsay M
f747483e32 Add --track-height to <wa-progress-bar> (#1159)
* add `--track-height` to `<wa-progress-bar>`

* fix custom `<wa-progress-bar>` height instances

* add changelog
2025-07-14 18:16:19 -04:00
Lindsay M
8719bbc88b Fix extra whitespace in <wa-textarea> with resize="auto" (#1175)
* fix extra whitespace

* fix the fix

* add changelog
2025-07-14 17:56:53 -04:00
Cory LaViska
0ff5e7fb7a Fix domain in documentation links (#1180)
* fix domain in doc links

* unprettier
2025-07-14 17:19:28 -04:00
Konnor Rogers
2a52b2766f fix badge pulsing (#1173)
* fix badge pulsing

* use and document `--pulse-color`

* Add changelog entry

---------

Co-authored-by: lindsaym-fa <dev@lindsaym.design>
2025-07-14 17:00:35 -04:00
Cory LaViska
1e8bbc3b06 fix domain (#1179) 2025-07-14 16:57:44 -04:00
Cory LaViska
1ef9cb9601 add missing dependency (#1176) 2025-07-14 16:55:43 -04:00
Lindsay M
5b54410212 Revise native styles documentation (#1153) 2025-07-14 16:21:15 -04:00
Joe Marquardt
f621fbb224 fix the build on windows (#1148)
- make-react importPath variable
 - esbuild entryPoints globby usage requires forward slashes
2025-07-14 16:13:11 -04:00
Cory LaViska
f5624fbf4a Slider hint (#1174)
* update example

* show hint in correct position when present

* update example

* update example
2025-07-14 16:05:02 -04:00
randomguy-2650
f65bc3918e fix: fix the language name in it.ts (#1171) 2025-07-14 15:48:18 -04:00
Lindsay M
f49c10b05b Replace old --wa-flow-spacing with --wa-content-spacing (#1157)
* remove old `--wa-flow-spacing`

* add changelog
2025-07-11 15:03:18 -04:00
Konnor Rogers
3b6c018fed Fix react imports to include a class name (#1158) 2025-07-10 15:40:45 -04:00
Lindsay M
c10e1e77c9 Update <wa-select> "Sizes" documentation (#1162) 2025-07-10 15:37:37 -04:00
Lindsay M
a1e879035c Fix code example styles (#1156) 2025-07-10 15:36:03 -04:00
Lindsay M
d2625fccab Remove extra stylesheets from CodePen editing (#1161) 2025-07-10 14:09:50 -04:00
randomguy-2650
29c8ad08bb Fix links pointing to / instead of the current page (#1145) 2025-07-09 13:11:24 -04:00
Mischa
0f68e6f0dd Refactor copy button documentation layout for improved alignment with input (#1141) 2025-07-09 13:09:53 -04:00
Tu Nguyen
4dca2b9541 Fixed a minor doc typo (#1137) 2025-07-09 12:17:20 -04:00
konnorrogers
36ccaa4aaa bump package.json 2025-07-03 18:32:12 -04:00
konnorrogers
c86d7635aa Bump package.json version 2025-07-03 18:31:59 -04:00
Konnor Rogers
d84e842a4e fixing select + tests (#1136)
* fixing select + tests

* fix TS

* prettier

* prettier

* fix CI test

* fix changelog
2025-07-03 18:29:02 -04:00
Lindsay M
fb8c06235f Fix link hover styles (#1135) 2025-07-03 14:20:51 -04:00
Cory LaViska
f6a10e9dda update changelog (#1134) 2025-07-03 12:06:38 -04:00
Lindsay M
5ce34677ed Add GitHub repository links (#1128)
* add repository links

* fix mobile navigation drawer
2025-07-03 11:26:35 -04:00
Lindsay M
8ebc839dfd Fix text colors on accent backgrounds (#1130) 2025-07-03 11:26:28 -04:00
Lindsay M
2779eb1753 Fix :active Awesome button text colors (#1129) 2025-07-03 09:24:47 -04:00
Cory LaViska
341ca809e9 Themes page fix (#1125)
* fix themes + palettes

* fix copy button color

* unimprove code links
2025-07-02 21:39:50 +00:00
Cory LaViska
7232ddee5d Dropdown fix (#1122)
* _blank

* fix dropdown flip/shift/ behavior when the viewport doesn't have space
2025-07-02 15:06:50 -04:00
whjvenyl
f63001f18e remove duplicate property (#1119)
Co-authored-by: Tobias Bannwart <tobias.bannwart@bison-group.com>
2025-07-02 14:10:15 -04:00
Lindsay M
8b831f6ece Improve organization of essential and optional styles (#1113)
* include all essential styles in `styles/themes/default.css` + cleanup

* tweak installation quick start description

* more docs updates
2025-07-02 13:58:55 -04:00
Lindsay M
4dee3d0f2d Add opt-in class to highlight table rows on hover (#1111)
* add `.wa-hover-rows`

* update docs

* update changelog
2025-07-02 09:20:17 -04:00
Cory LaViska
10a78d99af add missing items (#1117) 2025-07-02 08:21:52 -04:00
Lindsay M
99d9024339 Fix filled + outlined appearances (#1112)
* fix filled + outlined appearances

* docs consistency
2025-07-01 16:50:28 -04:00
Alan Chambers
313e31a3f2 Adjust package.json styles exports (#1104) 2025-07-01 16:45:55 -04:00
Konnor Rogers
4eeabc57e5 fix component paths....again (#1098) 2025-06-30 18:52:49 -04:00
Konnor Rogers
c8c0d0f848 disable runaway popup example (#1097) 2025-06-30 18:37:36 -04:00
Konnor Rogers
e8687b895d fix component paths (#1096) 2025-06-30 17:50:59 -04:00
Konnor Rogers
7743b670ed update docs (#1095)
* update docs

* add publish access config

* update package-lock
2025-06-30 15:32:08 -04:00
Konnor Rogers
88e99d7cd3 add placeholder readme.md (#1093) 2025-06-30 13:57:19 -04:00
Konnor Rogers
c0d18ab9f0 add dist-cdn to files (#1092) 2025-06-30 13:40:52 -04:00
Konnor Rogers
6576f67cfa center cta (#1091) 2025-06-30 13:37:22 -04:00
Konnor Rogers
057ff5fb31 change to webawesome (#1089)
* change to webawesome

* change to webawesome

* update index.md

* whitespace

* add thanks for being a webawesome pro subscriber

* add stub for currentUser

* add source code link

* add source code link

* prettier

* fix raw call
2025-06-30 13:29:56 -04:00
Cory LaViska
1dac76a35e fix blurb (#1090) 2025-06-30 13:03:28 -04:00
Konnor Rogers
e7f2962984 Pro fixes (#1088)
* add pro badge to themer

* add isPro flag to palettes

* show based on currentUser.hasPro

* fix logged out user stuff

---------

Co-authored-by: Cory LaViska <cory@abeautifulsite.net>
2025-06-30 12:13:21 -04:00
Lindsay M
956dc9bdd9 Fix avatar colors in theme showcase (#1087) 2025-06-30 10:53:23 -04:00
131 changed files with 1909 additions and 1432 deletions

32
package-lock.json generated
View File

@@ -589,6 +589,10 @@
"node": ">=12.17"
}
},
"node_modules/@awesome.me/webawesome": {
"resolved": "packages/webawesome",
"link": true
},
"node_modules/@babel/code-frame": {
"version": "7.23.5",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz",
@@ -2484,10 +2488,6 @@
"resolved": "https://registry.npmjs.org/@shoelace-style/localize/-/localize-3.2.1.tgz",
"integrity": "sha512-r4C9C/5kSfMBIr0D9imvpRdCNXtUNgyYThc4YlS6K5Hchv1UyxNQ9mxwj+BTRH2i1Neits260sR3OjKMnplsFA=="
},
"node_modules/@shoelace-style/webawesome": {
"resolved": "packages/webawesome",
"link": true
},
"node_modules/@shoelace-style/webawesome-pro": {
"resolved": "packages/webawesome-pro",
"link": true
@@ -13974,8 +13974,8 @@
}
},
"packages/webawesome": {
"name": "@shoelace-style/webawesome",
"version": "3.0.0-beta.1",
"name": "@awesome.me/webawesome",
"version": "3.0.0-beta.2",
"license": "MIT",
"dependencies": {
"@ctrl/tinycolor": "^4.1.0",
@@ -13984,6 +13984,7 @@
"@shoelace-style/localize": "^3.2.1",
"composed-offset-position": "^0.0.6",
"lit": "^3.2.1",
"nanoid": "^5.1.5",
"qr-creator": "^1.0.0",
"style-observer": "^0.0.7"
},
@@ -13994,7 +13995,7 @@
},
"packages/webawesome-pro": {
"name": "@shoelace-style/webawesome-pro",
"version": "3.0.0-beta.1",
"version": "3.0.0-beta.2",
"license": "TODO",
"dependencies": {
"@ctrl/tinycolor": "^4.1.0",
@@ -14010,6 +14011,23 @@
"engines": {
"node": ">=14.17.0"
}
},
"packages/webawesome/node_modules/nanoid": {
"version": "5.1.5",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.1.5.tgz",
"integrity": "sha512-Ir/+ZpE9fDsNH0hQ3C68uyThDXzYcim2EqcZ8zn8Chtt1iylPT9xXJB0kPCnqzgcEGikO9RxSrh63MsmVCU7Fw==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"bin": {
"nanoid": "bin/nanoid.js"
},
"engines": {
"node": "^18 || >=20"
}
}
}
}

View File

@@ -0,0 +1 @@
Visit our documentation! <https://webawesome.com>

View File

@@ -1,30 +1,63 @@
import { parse as HTMLParse } from 'node-html-parser';
import * as fs from 'node:fs';
import * as path from 'node:path';
import { parse } from 'path';
import { anchorHeadingsPlugin } from './_utils/anchor-headings.js';
import { codeExamplesPlugin } from './_utils/code-examples.js';
import { copyCodePlugin } from './_utils/copy-code.js';
import { currentLink } from './_utils/current-link.js';
import { highlightCodePlugin } from './_utils/highlight-code.js';
import { anchorHeadingsTransformer } from './_transformers/anchor-headings.js';
import { codeExamplesTransformer } from './_transformers/code-examples.js';
import { copyCodeTransformer } from './_transformers/copy-code.js';
import { currentLinkTransformer } from './_transformers/current-link.js';
import { highlightCodeTransformer } from './_transformers/highlight-code.js';
import { outlineTransformer } from './_transformers/outline.js';
import { getComponents } from './_utils/manifest.js';
import { markdown } from './_utils/markdown.js';
// import { formatCodePlugin } from './_utils/format-code.js';
import { SimulateWebAwesomeApp } from './_utils/simulate-webawesome-app.js';
// import { formatCodePlugin } from './_plugins/format-code.js';
// import litPlugin from '@lit-labs/eleventy-plugin-lit';
import { readFile } from 'fs/promises';
import nunjucks from 'nunjucks';
import process from 'process';
import * as url from 'url';
import { outlinePlugin } from './_utils/outline.js';
import { replaceTextPlugin } from './_utils/replace-text.js';
import { searchPlugin } from './_utils/search.js';
import { replaceTextPlugin } from './_plugins/replace-text.js';
import { searchPlugin } from './_plugins/search.js';
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
const isDev = process.argv.includes('--develop');
const passThroughExtensions = ['js', 'css', 'png', 'svg', 'jpg', 'mp4'];
async function getPackageData() {
return JSON.parse(await readFile(path.join(__dirname, '..', 'package.json'), 'utf-8'));
}
export default async function (eleventyConfig) {
const packageData = JSON.parse(await readFile(path.join(__dirname, '..', 'package.json'), 'utf-8'));
const docsDir = path.join(process.env.BASE_DIR || '.', 'docs');
const allComponents = getComponents();
let packageData = await getPackageData();
let allComponents = getComponents();
const distDir = process.env.UNBUNDLED_DIST_DIRECTORY || path.resolve(__dirname, '../dist');
const customElementsManifest = path.join(distDir, 'custom-elements.json');
const stylesheets = path.join(distDir, 'styles');
eleventyConfig.addWatchTarget(customElementsManifest);
eleventyConfig.setWatchThrottleWaitTime(10); // in milliseconds
eleventyConfig.on('eleventy.beforeWatch', async function (changedFiles) {
let updatePackageData = false;
let updateComponentData = false;
changedFiles.forEach(file => {
if (file.includes('package.json')) {
updatePackageData = true;
}
if (file.includes('custom-elements.json')) {
updateComponentData = true;
}
});
if (updatePackageData) {
packageData = await getPackageData();
}
if (updateComponentData) {
allComponents = getComponents();
}
});
/**
* If you plan to add or remove any of these extensions, make sure to let either Konnor or Cory know as these
@@ -52,7 +85,7 @@ export default async function (eleventyConfig) {
// Template filters - {{ content | filter }}
eleventyConfig.addFilter('inlineMarkdown', content => markdown.renderInline(content || ''));
eleventyConfig.addFilter('markdown', content => markdown.render(content || ''));
eleventyConfig.addFilter('stripExtension', string => parse(string + '').name);
eleventyConfig.addFilter('stripExtension', string => path.parse(string + '').name);
eleventyConfig.addFilter('stripPrefix', content => content.replace(/^wa-/, ''));
// Trims whitespace and pipes from the start and end of a string. Useful for CEM types, which can be pipe-delimited.
// With Prettier 3, this means a leading pipe will exist be present when the line wraps.
@@ -109,28 +142,6 @@ export default async function (eleventyConfig) {
return '';
});
eleventyConfig.addTransform('second-nunjucks-transform', function NunjucksTransform(content) {
// For a server build, we expect a server to run the second transform.
if (serverBuild) {
return content;
}
// Only run the transform on files nunjucks would transform.
if (!this.page.inputPath.match(/.(md|html|njk)$/)) {
return content;
}
/** This largely mimics what an app would do and just stubs out what we don't care about. */
return nunjucks.renderString(content, {
// Stub the server EJS shortcodes.
server: {
head: '',
loginOrAvatar: '',
flashes: '',
},
});
});
// Paired shortcodes - {% shortCode %}content{% endShortCode %}
eleventyConfig.addPairedShortcode('markdown', content => markdown.render(content || ''));
@@ -149,33 +160,33 @@ export default async function (eleventyConfig) {
eleventyConfig.setLibrary('md', markdown);
// Add anchors to headings
eleventyConfig.addPlugin(anchorHeadingsPlugin({ container: '#content' }));
eleventyConfig.addTransform('doc-transforms', function (content) {
let doc = HTMLParse(content, { blockTextElements: { code: true } });
// Add an outline to the page
eleventyConfig.addPlugin(
outlinePlugin({
container: '#content',
target: '.outline-links',
selector: 'h2, h3',
ifEmpty: doc => {
doc.querySelector('#outline')?.remove();
},
}),
);
const transformers = [
anchorHeadingsTransformer({ container: '#content' }),
outlineTransformer({
container: '#content',
target: '.outline-links',
selector: 'h2, h3',
ifEmpty: doc => {
doc.querySelector('#outline')?.remove();
},
}),
// Add current link classes
currentLinkTransformer(),
codeExamplesTransformer(),
highlightCodeTransformer(),
copyCodeTransformer(),
];
// Add current link classes
eleventyConfig.addPlugin(currentLink());
for (const transformer of transformers) {
transformer.call(this, doc);
}
// Add code examples for `<code class="example">` blocks
eleventyConfig.addPlugin(codeExamplesPlugin());
return doc.toString();
});
// Highlight code blocks with Prism
eleventyConfig.addPlugin(highlightCodePlugin());
// Add copy code buttons to code blocks
eleventyConfig.addPlugin(copyCodePlugin);
// Various text replacements
eleventyConfig.addPlugin(
replaceTextPlugin([
{
@@ -185,17 +196,17 @@ export default async function (eleventyConfig) {
// Replace [issue:1234] with a link to the issue on GitHub
{
replace: /\[pr:([0-9]+)\]/gs,
replaceWith: '<a href="https://github.com/shoelace-style/webawesome/pull/$1">#$1</a>',
replaceWith: '<a href="https://github.com/shoelace-style/webawesome/pull/$1" target="_blank">#$1</a>',
},
// Replace [pr:1234] with a link to the pull request on GitHub
{
replace: /\[issue:([0-9]+)\]/gs,
replaceWith: '<a href="https://github.com/shoelace-style/webawesome/issues/$1">#$1</a>',
replaceWith: '<a href="https://github.com/shoelace-style/webawesome/issues/$1" target="_blank">#$1</a>',
},
// Replace [discuss:1234] with a link to the discussion on GitHub
{
replace: /\[discuss:([0-9]+)\]/gs,
replaceWith: '<a href="https://github.com/shoelace-style/webawesome/discussions/$1">#$1</a>',
replaceWith: '<a href="https://github.com/shoelace-style/webawesome/discussions/$1" target="_blank">#$1</a>',
},
]),
);
@@ -219,15 +230,14 @@ export default async function (eleventyConfig) {
// }
let assetsDir = path.join(process.env.BASE_DIR || 'docs', 'assets');
fs.cpSync(assetsDir, path.join(eleventyConfig.directories.output, 'assets'), { recursive: true });
const siteAssetsDir = path.join(eleventyConfig.directories.output, 'assets');
fs.cpSync(assetsDir, siteAssetsDir, { recursive: true });
for (let glob of passThrough) {
eleventyConfig.addPassthroughCopy(glob);
}
// // SSR plugin
// // Make sure this is the last thing, we don't want to run the risk of accidentally transforming shadow roots with
// // the nunjucks 2nd transform.
// if (!isDev) {
// //
// // Problematic components in SSR land:
@@ -250,6 +260,23 @@ export default async function (eleventyConfig) {
// componentModules,
// });
// }
if (!isDev) {
eleventyConfig.addTransform('simulate-webawesome-app', function (content) {
// For a server build, we expect a server to run the second transform.
if (serverBuild) {
return content;
}
// Only run the transform on files nunjucks would transform.
if (!this.page.inputPath.match(/.(md|html|njk)$/)) {
return content;
}
/** This largely mimics what an app would do and just stubs out what we don't care about. */
return SimulateWebAwesomeApp(content);
});
}
}
export const config = {

View File

@@ -13,7 +13,7 @@
<script type="module" src="/assets/scripts/color-scheme.js"></script>
<script type="module" src="/assets/scripts/theme.js"></script>
{% if hasSidebar %}<script type="module" src="/assets/scripts/sidebar.js"></script>{% endif %}
<script defer data-domain="backers.webawesome.com" src="https://plausible.io/js/script.js"></script>
<script defer data-domain="webawesome.com" src="https://plausible.io/js/script.js"></script>
{# Docs styles #}
<link rel="stylesheet" href="/assets/styles/docs.css" />
@@ -61,19 +61,27 @@
<wa-badge variant="brand" appearance="filled" class="wa-desktop-only">Beta</wa-badge>
</div>
<div id="docs-toolbar" class="wa-cluster wa-gap-xs">
<div id="docs-toolbar" class="wa-cluster">
{# Desktop selectors #}
<div class="wa-desktop-only wa-cluster wa-gap-xs">
{% include "theme-selector.njk" %}
{% include "color-scheme-selector.njk" %}
</div>
{# Search #}
<wa-button id="search-trigger" appearance="outlined" size="small" data-search>
<wa-icon slot="start" name="magnifying-glass"></wa-icon>
Search
<kbd slot="end" class="wa-desktop-only">/</kbd>
</wa-button>
<wa-divider orientation="vertical" class="wa-desktop-only"></wa-divider>
<div id="github-buttons" class="wa-cluster wa-gap-xs">
<wa-button id="github-repo-button" href="https://github.com/shoelace-style/webawesome" rel="noopener noreferrer" target="_blank" appearance="filled" size="small">
<wa-icon family="brands" name="github" label="GitHub"></wa-icon>
</wa-button>
<wa-tooltip for="github-repo-button" distance="2">GitHub</wa-tooltip>
<wa-button id="github-star-button" href="https://github.com/shoelace-style/webawesome/stargazers" rel="noopener noreferrer" target="_blank" appearance="filled" size="small">
<wa-icon name="star" variant="regular" label="Star this repository"></wa-icon>
</wa-button>
<wa-tooltip for="github-star-button" distance="2">Star this repository</wa-tooltip>
</div>
<wa-divider orientation="vertical"></wa-divider>
{# Login #}
{% server "loginOrAvatar" %}
@@ -84,7 +92,7 @@
{% if hasSidebar %}
{# Mobile selectors #}
<div class="wa-mobile-only" slot="navigation-header">
<div class="wa-cluster wa-gap-xs">
<div class="wa-cluster wa-gap-xs" style="flex-wrap: nowrap;">
{% include "theme-selector.njk" %}
{% include "color-scheme-selector.njk" %}
</div>

View File

@@ -1,4 +1,4 @@
<wa-select class="color-scheme-selector" appearance="filled" size="small" value="auto" pill title="Press \ to toggle">
<wa-select class="color-scheme-selector" appearance="filled" size="small" value="auto" title="Press \ to toggle">
<wa-icon class="only-light" slot="start" name="sun" variant="regular"></wa-icon>
<wa-icon class="only-dark" slot="start" name="moon" variant="regular"></wa-icon>
<wa-option value="light">

View File

@@ -1,3 +1,10 @@
{# Search #}
<wa-button id="search-trigger" appearance="outlined" size="small" data-search>
<wa-icon slot="start" name="magnifying-glass"></wa-icon>
Search
<kbd slot="end" class="wa-desktop-only">/</kbd>
</wa-button>
{# Getting started #}
<h2>Getting Started</h2>
<ul>
@@ -12,6 +19,7 @@
<h2>Resources</h2>
<ul>
<li><a href="https://github.com/shoelace-style/webawesome/discussions" target="_blank">Help &amp; Support</a></li>
<li><a href="https://github.com/shoelace-style/webawesome/">Source Code</a></li>
<li><a href="/docs/resources/community">Community</a></li>
<li><a href="/docs/resources/accessibility">Accessibility</a></li>
<li><a href="/docs/resources/browser-support">Browser Support</a></li>

View File

@@ -1,4 +1,4 @@
<wa-select appearance="filled" size="small" value="default" pill class="theme-selector">
<wa-select appearance="filled" size="small" value="default" class="theme-selector">
<wa-icon slot="start" name="paintbrush" variant="regular"></wa-icon>
{# Free themes #}

View File

@@ -26,7 +26,7 @@
<p>Learn more about <a href="/docs/usage/#slots">using slots</a>.</p>
<wa-scroller>
<table class="component-table">
<table class="component-table wa-hover-rows">
<thead>
<tr>
<th class="table-name">Name</th>
@@ -57,7 +57,7 @@
<p>Learn more about <a href="/docs/usage/#attributes-and-properties">attributes and properties</a>.</p>
<wa-scroller>
<table class="component-table">
<table class="component-table wa-hover-rows">
<thead>
<tr>
<th class="table-name">Name</th>
@@ -104,7 +104,7 @@
<p>Learn more about <a href="/docs/usage/#methods">methods</a>.</p>
<wa-scroller>
<table class="component-table">
<table class="component-table wa-hover-rows">
<thead>
<tr>
<th class="table-name">Name</th>
@@ -139,7 +139,7 @@
<p>Learn more about <a href="/docs/usage/#events">events</a>.</p>
<wa-scroller>
<table class="component-table">
<table class="component-table wa-hover-rows">
<thead>
<tr>
<th class="table-name">Name</th>
@@ -166,7 +166,7 @@
<p>Learn more about <a href="/docs/customizing/#custom-properties">CSS custom properties</a>.</p>
<wa-scroller>
<table class="component-table">
<table class="component-table wa-hover-rows">
<thead>
<tr>
<th class="table-name">Name</th>
@@ -198,7 +198,7 @@
<p>Learn more about <a href="/docs/customizing/#custom-states">custom states</a>.</p>
<wa-scroller>
<table class="component-table">
<table class="component-table wa-hover-rows">
<thead>
<tr>
<th class="table-name">Name</th>
@@ -225,7 +225,7 @@
<p>Learn more about <a href="/docs/customizing/#css-parts">CSS parts</a>.</p>
<wa-scroller>
<table class="component-table">
<table class="component-table wa-hover-rows">
<thead>
<tr>
<th class="table-name">Name</th>
@@ -264,6 +264,9 @@
The <a href="/docs/#quick-start-autoloading-via-cdn">autoloader</a> is the recommended way to import components. If you prefer to do it manually, use one of the following code snippets.
</p>
{% set componentName = component.tagName | stripPrefix %}
{% set componentPath = ["components/", componentName, "/", componentName, ".js"] | join("") %}
<wa-tab-group label="How would you like to import this component?">
<wa-tab panel="cdn">CDN</wa-tab>
<wa-tab panel="npm">npm</wa-tab>
@@ -272,19 +275,20 @@
<p>
To manually import this component from the CDN, use the following code.
</p>
<pre><code class="language-js">import '{% cdnUrl component.path %}';</code></pre>
<pre><code class="language-js">import '{% cdnUrl componentPath %}';</code></pre>
</wa-tab-panel>
<wa-tab-panel name="npm">
Coming soon!
<p>
To manually import this component from NPM, use the following code.
</p>
<pre><code class="language-js">import '@awesome.me/webawesome/dist/{{ componentPath }}';</code></pre>
</wa-tab-panel>
<wa-tab-panel name="react">
Coming soon!
{# NOTE - disabled for alpha/beta
<p>
To manually import this component from React, use the following code.
</p>
<pre><code class="language-js">import '@shoelace-style/webawesome/react/{{ component.tagName | stripPrefix }}';</code></pre>
#}
<pre><code class="language-js">import {{ component.name }} from '@awesome.me/webawesome/dist/react/{{ componentName }}';</code></pre>
</wa-tab-panel>
</wa-tab-group>

View File

@@ -1,4 +1,5 @@
/* eslint-disable no-invalid-this */
import { readFileSync } from 'fs';
import { mkdir, writeFile } from 'fs/promises';
import lunr from 'lunr';
import { parse } from 'node-html-parser';
@@ -23,19 +24,22 @@ export function searchPlugin(options = {}) {
...options,
};
// Hoist above so that it can "cache" properly for incremental builds.
return function (eleventyConfig) {
const pagesToIndex = new Map();
let pagesToIndex = new Map();
eleventyConfig.addPreprocessor('exclude-unlisted-from-search', '*', function (data, content) {
if (data.unlisted) {
// no-op
pagesToIndex.delete(data.page.inputPath);
} else {
pagesToIndex.set(data.page.inputPath, {});
pagesToIndex.set(data.page.inputPath, true);
}
return content;
});
// With incremental builds we need this to be last in case stuff was added from metadata. _BUT_ in incremental builds, not every page is added to the "transform".
eleventyConfig.addTransform('search', function (content) {
if (!pagesToIndex.has(this.page.inputPath)) {
return content;
@@ -67,11 +71,30 @@ export function searchPlugin(options = {}) {
return content;
});
eleventyConfig.on('eleventy.after', ({ directories }) => {
eleventyConfig.on('eleventy.after', async ({ directories }) => {
const { output } = directories;
const outputFilename = path.resolve(join(output, 'search.json'));
const cachedPages = path.resolve(join(output, 'cached_pages.json'));
function getCachedPages() {
let content = { pages: [] };
try {
content = JSON.parse(readFileSync(cachedPages));
} catch (e) {}
const cachedPagesMap = new Map(content.pages);
for (const [key, value] of cachedPagesMap.entries()) {
// A page uses a cached value if `true` and it didnt get its value set in the "transform" hook. This is to get around the limitation of incremental builds not going over every file in transform.
if (pagesToIndex.get(key) === true) {
pagesToIndex.set(key, value);
}
}
}
const map = [];
const searchIndex = lunr(async function () {
getCachedPages();
const searchIndex = lunr(function () {
let index = 0;
this.ref('id');
@@ -84,9 +107,11 @@ export function searchPlugin(options = {}) {
map[index] = { title: page.title, description: page.description, url: page.url };
index++;
}
await mkdir(dirname(outputFilename), { recursive: true });
await writeFile(outputFilename, JSON.stringify({ searchIndex, map }), 'utf-8');
});
await mkdir(dirname(outputFilename), { recursive: true });
await writeFile(outputFilename, JSON.stringify({ searchIndex, map }), 'utf-8');
await writeFile(cachedPages, JSON.stringify({ pages: [...pagesToIndex.entries()] }, null, 2));
});
};
}

View File

@@ -0,0 +1,81 @@
import { parse } from 'node-html-parser';
import slugify from 'slugify';
import { v4 as uuid } from 'uuid';
function createId(text) {
let slug = slugify(String(text), {
remove: /[^\w|\s]/g,
lower: true,
});
// ids must start with a letter
if (!/^[a-z]/i.test(slug)) {
slug = `wa_${slug}`;
}
return slug;
}
/**
* Eleventy plugin to add anchors to headings to content.
*/
export function anchorHeadingsTransformer(options = {}) {
options = {
container: 'body',
headingSelector: 'h2, h3, h4, h5, h6',
anchorLabel: 'Jump to heading',
...options,
};
/** doc is a parsed HTML document */
return function (doc) {
const container = doc.querySelector(options.container);
if (!container) {
return doc;
}
// Look for headings
let selector = `:is(${options.headingSelector}):not([data-no-anchor], [data-no-anchor] *)`;
container.querySelectorAll(selector).forEach(heading => {
const hasAnchor = heading.querySelector('a');
const existingId = heading.getAttribute('id');
const clone = parse(heading.outerHTML);
// Create a clone of the heading so we can remove [data-no-anchor] elements from the text content
clone.querySelectorAll('[data-no-anchor]').forEach(el => el.remove());
if (hasAnchor) {
return;
}
let id = existingId;
if (!id) {
const slug = createId(clone.textContent ?? '') ?? uuid().slice(-12);
id = slug;
let suffix = 1;
// Make sure the slug is unique in the document
while (doc.getElementById(id) !== null) {
id = `${slug}-${++suffix}`;
}
}
// Create the anchor
const anchor = parse(`
<a href="#${encodeURIComponent(id)}">
<span class="wa-visually-hidden"></span>
<span aria-hidden="true">#</span>
</a>
`);
anchor.querySelector('.wa-visually-hidden').textContent = options.anchorLabel;
// Update the heading
if (!existingId) {
heading.setAttribute('id', id);
}
heading.classList.add('anchor-heading');
heading.appendChild(anchor);
});
};
}

View File

@@ -1,43 +1,51 @@
import { parse } from 'node-html-parser';
import { v4 as uuid } from 'uuid';
import { markdown } from '../_utils/markdown.js';
import { copyCode } from './copy-code.js';
import { highlightCode } from './highlight-code.js';
/**
* Eleventy plugin to turn `<code class="example">` blocks into live examples.
*/
export function codeExamplesPlugin(options = {}) {
export function codeExamplesTransformer(options = {}) {
options = {
container: 'body',
...options,
};
return function (eleventyConfig) {
eleventyConfig.addTransform('code-examples', content => {
const doc = parse(content, { blockTextElements: { code: true } });
const container = doc.querySelector(options.container);
return function (doc) {
const container = doc.querySelector(options.container);
if (!container) {
return content;
}
if (!container) {
return;
}
// Look for external links
container.querySelectorAll('code.example').forEach(code => {
const pre = code.closest('pre');
const hasButtons = !code.classList.contains('no-buttons');
const isOpen = code.classList.contains('open') || !hasButtons;
const noEdit = code.classList.contains('no-edit');
const id = `code-example-${uuid().slice(-12)}`;
let preview = pre.textContent;
// Look for external links
container.querySelectorAll('code.example').forEach(code => {
let pre = code.closest('pre');
const hasButtons = !code.classList.contains('no-buttons');
const isOpen = code.classList.contains('open') || !hasButtons;
const noEdit = code.classList.contains('no-edit');
const id = `code-example-${uuid().slice(-12)}`;
let preview = pre.textContent;
// Run preview scripts as modules to prevent collisions
const root = parse(preview, { blockTextElements: { script: true } });
root.querySelectorAll('script').forEach(script => script.setAttribute('type', 'module'));
preview = root.toString();
const langClass = [...code.classList.values()].find(val => val.startsWith('language-'));
const lang = langClass ? langClass.replace(/^language-/, '') : 'plain';
const codeExample = parse(`
code.innerHTML = highlightCode(code.textContent ?? '', lang);
// Run preview scripts as modules to prevent collisions
const root = parse(preview, { blockTextElements: { script: true } });
root.querySelectorAll('script').forEach(script => script.setAttribute('type', 'module'));
preview = root.toString();
copyCode(code);
const codeExample = parse(`
<div class="code-example ${isOpen ? 'open' : ''}">
<div class="code-example-preview">
${preview}
<div>
${preview}
</div>
<div class="code-example-resizer" aria-hidden="true">
<wa-icon name="grip-lines-vertical"></wa-icon>
</div>
@@ -77,10 +85,7 @@ export function codeExamplesPlugin(options = {}) {
</div>
`);
pre.replaceWith(codeExample);
});
return doc.toString();
pre.replaceWith(codeExample);
});
};
}

View File

@@ -0,0 +1,38 @@
export function copyCode(code) {
const pre = code.closest('pre');
let preId = pre.getAttribute('id') || `code-block-${crypto.randomUUID()}`;
let codeId = code.getAttribute('id') || `${preId}-inner`;
if (!code.getAttribute('id')) {
code.setAttribute('id', codeId);
}
if (!pre.getAttribute('id')) {
pre.setAttribute('id', preId);
}
// Add a copy button
pre.innerHTML += `<wa-copy-button from="${codeId}" class="copy-button wa-dark"></wa-copy-button>`;
}
/**
* Eleventy plugin to add copy buttons to code blocks.
*/
export function copyCodeTransformer(options = {}) {
options = {
container: 'body',
...options,
};
return function (doc) {
const container = doc.querySelector(options.container);
if (!container) {
return;
}
// Look for code blocks
container.querySelectorAll('pre > code').forEach(code => {
copyCode(code);
});
};
}

View File

@@ -24,30 +24,25 @@ function normalize(pathname) {
/**
* Eleventy plugin to decorate current links with a custom class.
*/
export function currentLink(options = {}) {
export function currentLinkTransformer(options = {}) {
options = {
container: 'body',
className: 'current',
...options,
};
return function (eleventyConfig) {
eleventyConfig.addTransform('current-link', function (content) {
const doc = parse(content);
const container = doc.querySelector(options.container);
return function (doc) {
const container = doc.querySelector(options.container);
if (!container) {
return content;
if (!container) {
return;
}
// Compare the href attribute to 11ty's page URL
container.querySelectorAll('a[href]').forEach(a => {
if (normalize(a.getAttribute('href')) === normalize(this.page.url)) {
a.classList.add(options.className);
}
// Compare the href attribute to 11ty's page URL
container.querySelectorAll('a[href]').forEach(a => {
if (normalize(a.getAttribute('href')) === normalize(this.page.url)) {
a.classList.add(options.className);
}
});
return doc.toString();
});
};
}

View File

@@ -37,36 +37,31 @@ export function highlightCode(code, language = 'plain') {
* Eleventy plugin to highlight code blocks with the `language-*` attribute using Prism.js. Unlike most plugins, this
* works on the entire document not just markdown content.
*/
export function highlightCodePlugin(options = {}) {
export function highlightCodeTransformer(options = {}) {
options = {
container: 'body',
...options,
};
return function (eleventyConfig) {
eleventyConfig.addTransform('highlight-code', content => {
const doc = parse(content, { blockTextElements: { code: true } });
const container = doc.querySelector(options.container);
return function (doc) {
const container = doc.querySelector(options.container);
if (!container) {
return content;
}
if (!container) {
return;
}
// Look for <code class="language-*"> and highlight each one
container.querySelectorAll('code[class*="language-"]').forEach(code => {
const langClass = [...code.classList.values()].find(val => val.startsWith('language-'));
const lang = langClass ? langClass.replace(/^language-/, '') : 'plain';
// Look for <code class="language-*"> and highlight each one
container.querySelectorAll('code[class*="language-"]').forEach(code => {
const langClass = [...code.classList.values()].find(val => val.startsWith('language-'));
const lang = langClass ? langClass.replace(/^language-/, '') : 'plain';
try {
code.innerHTML = highlightCode(code.textContent ?? '', lang);
} catch (err) {
if (!options.ignoreMissingLangs) {
throw new Error(err.message);
}
try {
code.innerHTML = highlightCode(code.textContent ?? '', lang);
} catch (err) {
if (!options.ignoreMissingLangs) {
throw new Error(err.message);
}
});
return doc.toString();
}
});
};
}

View File

@@ -0,0 +1,64 @@
import { parse } from 'node-html-parser';
/**
* Eleventy plugin to add an outline (table of contents) to the page. Headings must have an id, otherwise they won't be
* included in the outline. An unordered list containing links will be appended to the target element.
*
* If no headings are found for the outline, the `ifEmpty()` function will be called with a `node-html-parser` object as
* the first argument. This can be used to toggle classes or remove elements when the outline is empty.
*
* See the `node-html-parser` docs for more details: https://www.npmjs.com/package/node-html-parser
*/
export function outlineTransformer(options = {}) {
options = {
container: 'body',
target: '.outline',
selector: 'h2,h3',
ifEmpty: () => null,
...options,
};
return function (doc) {
const container = doc.querySelector(options.container);
const ul = parse('<ul></ul>');
let numLinks = 0;
if (!container) {
return;
}
container.querySelectorAll(options.selector).forEach(heading => {
const id = heading.getAttribute('id');
const level = heading.tagName.slice(1);
const clone = parse(heading.outerHTML);
if (heading.closest('[data-no-outline]')) {
return;
}
// Create a clone of the heading so we can remove links and [data-no-outline] elements from the text content
clone.querySelectorAll('.wa-visually-hidden, [hidden], [aria-hidden="true"]').forEach(el => el.remove());
clone.querySelectorAll('[data-no-outline]').forEach(el => el.remove());
// Generate the link
const li = parse(`<li data-level="${level}"><a></a></li>`);
const a = li.querySelector('a');
a.setAttribute('href', `#${encodeURIComponent(id)}`);
a.textContent = clone.textContent.trim().replace(/#$/, '');
// Add it to the list
ul.firstChild.appendChild(li);
numLinks++;
});
if (numLinks > 0) {
// Append the list to all matching targets
doc.querySelectorAll(options.target).forEach(target => {
target.appendChild(parse(ul.outerHTML));
});
} else {
// Remove if empty
options.ifEmpty(doc);
}
};
}

View File

@@ -1,85 +0,0 @@
import { parse } from 'node-html-parser';
import slugify from 'slugify';
import { v4 as uuid } from 'uuid';
function createId(text) {
let slug = slugify(String(text), {
remove: /[^\w|\s]/g,
lower: true,
});
// ids must start with a letter
if (!/^[a-z]/i.test(slug)) {
slug = `wa_${slug}`;
}
return slug;
}
/**
* Eleventy plugin to add anchors to headings to content.
*/
export function anchorHeadingsPlugin(options = {}) {
options = {
container: 'body',
headingSelector: 'h2, h3, h4, h5, h6',
anchorLabel: 'Jump to heading',
...options,
};
return function (eleventyConfig) {
eleventyConfig.addTransform('anchor-headings', content => {
const doc = parse(content);
const container = doc.querySelector(options.container);
if (!container) {
return content;
}
// Look for headings
let selector = `:is(${options.headingSelector}):not([data-no-anchor], [data-no-anchor] *)`;
container.querySelectorAll(selector).forEach(heading => {
const hasAnchor = heading.querySelector('a');
const existingId = heading.getAttribute('id');
const clone = parse(heading.outerHTML);
// Create a clone of the heading so we can remove [data-no-anchor] elements from the text content
clone.querySelectorAll('[data-no-anchor]').forEach(el => el.remove());
if (hasAnchor) {
return;
}
let id = existingId;
if (!id) {
const slug = createId(clone.textContent ?? '') ?? uuid().slice(-12);
id = slug;
let suffix = 1;
// Make sure the slug is unique in the document
while (doc.getElementById(id) !== null) {
id = `${slug}-${++suffix}`;
}
}
// Create the anchor
const anchor = parse(`
<a href="#${encodeURIComponent(id)}">
<span class="wa-visually-hidden"></span>
<span aria-hidden="true">#</span>
</a>
`);
anchor.querySelector('.wa-visually-hidden').textContent = options.anchorLabel;
// Update the heading
if (!existingId) {
heading.setAttribute('id', id);
}
heading.classList.add('anchor-heading');
heading.appendChild(anchor);
});
return doc.toString();
});
};
}

View File

@@ -1,41 +0,0 @@
import { parse } from 'node-html-parser';
/**
* Eleventy plugin to add copy buttons to code blocks.
*/
export function copyCodePlugin(eleventyConfig, options = {}) {
options = {
container: 'body',
...options,
};
let codeCount = 0;
eleventyConfig.addTransform('copy-code', content => {
const doc = parse(content, { blockTextElements: { code: true } });
const container = doc.querySelector(options.container);
if (!container) {
return content;
}
// Look for code blocks
container.querySelectorAll('pre > code').forEach(code => {
const pre = code.closest('pre');
let preId = pre.getAttribute('id') || `code-block-${++codeCount}`;
let codeId = code.getAttribute('id') || `${preId}-inner`;
if (!code.getAttribute('id')) {
code.setAttribute('id', codeId);
}
if (!pre.getAttribute('id')) {
pre.setAttribute('id', preId);
}
// Add a copy button
pre.innerHTML += `<wa-button href="#${preId}" class="block-link-icon" appearance="plain" size="small"><wa-icon name="link" label="Copy link"></wa-icon></wa-button>
<wa-copy-button from="${codeId}" class="copy-button"></wa-copy-button>`;
});
return doc.toString();
});
}

View File

@@ -1,69 +0,0 @@
import { parse } from 'node-html-parser';
/**
* Eleventy plugin to add an outline (table of contents) to the page. Headings must have an id, otherwise they won't be
* included in the outline. An unordered list containing links will be appended to the target element.
*
* If no headings are found for the outline, the `ifEmpty()` function will be called with a `node-html-parser` object as
* the first argument. This can be used to toggle classes or remove elements when the outline is empty.
*
* See the `node-html-parser` docs for more details: https://www.npmjs.com/package/node-html-parser
*/
export function outlinePlugin(options = {}) {
options = {
container: 'body',
target: '.outline',
selector: 'h2,h3',
ifEmpty: () => null,
...options,
};
return function (eleventyConfig) {
eleventyConfig.addTransform('outline', content => {
const doc = parse(content);
const container = doc.querySelector(options.container);
const ul = parse('<ul></ul>');
let numLinks = 0;
if (!container) {
return content;
}
container.querySelectorAll(options.selector).forEach(heading => {
const id = heading.getAttribute('id');
const level = heading.tagName.slice(1);
const clone = parse(heading.outerHTML);
if (heading.closest('[data-no-outline]')) {
return;
}
// Create a clone of the heading so we can remove links and [data-no-outline] elements from the text content
clone.querySelectorAll('.wa-visually-hidden, [hidden], [aria-hidden="true"]').forEach(el => el.remove());
clone.querySelectorAll('[data-no-outline]').forEach(el => el.remove());
// Generate the link
const li = parse(`<li data-level="${level}"><a></a></li>`);
const a = li.querySelector('a');
a.setAttribute('href', `#${encodeURIComponent(id)}`);
a.textContent = clone.textContent.trim().replace(/#$/, '');
// Add it to the list
ul.firstChild.appendChild(li);
numLinks++;
});
if (numLinks > 0) {
// Append the list to all matching targets
doc.querySelectorAll(options.target).forEach(target => {
target.appendChild(parse(ul.outerHTML));
});
} else {
// Remove if empty
options.ifEmpty(doc);
}
return doc.toString();
});
};
}

View File

@@ -0,0 +1,18 @@
import nunjucks from 'nunjucks';
/**
* This function simulates what a server would do running "on top" of eleventy.
*/
export function SimulateWebAwesomeApp(str) {
return nunjucks.renderString(str, {
// Stub the server EJS shortcodes.
currentUser: {
hasPro: false,
},
server: {
head: '',
loginOrAvatar: '',
flashes: '',
},
});
}

View File

@@ -57,9 +57,7 @@ document.addEventListener('click', event => {
const cdnUrl = document.documentElement.dataset.cdnUrl;
const html =
`<script data-fa-kit-code="b10bfbde90" type="module" src="${cdnUrl}webawesome.loader.js"></script>\n` +
`<link rel="stylesheet" href="${cdnUrl}styles/themes/default.css">\n` +
`<link rel="stylesheet" href="${cdnUrl}styles/webawesome.css">\n` +
`<link rel="stylesheet" href="${cdnUrl}styles/utilities.css">\n\n` +
`<link rel="stylesheet" href="${cdnUrl}styles/webawesome.css">\n\n` +
`${code.textContent}`;
const css = 'html > body {\n padding: 2rem !important;\n}';
const js = '';

View File

@@ -3,7 +3,7 @@
border: var(--wa-border-style) var(--wa-panel-border-width) var(--wa-color-neutral-border-quiet);
border-radius: var(--wa-border-radius-l);
color: var(--wa-color-text-normal);
margin-block-end: var(--wa-flow-spacing);
margin-block-end: var(--wa-content-spacing);
isolation: isolate;
}
@@ -100,8 +100,8 @@
.code-example-buttons {
display: flex;
align-items: stretch;
background: var(--wa-color-surface-default) !important; /* TODO - remove after native styles refactor */
color: var(--wa-color-text-quiet) !important; /* TODO - remove after native styles refactor */
background: var(--wa-color-surface-default);
color: var(--wa-color-text-quiet);
border-bottom-left-radius: inherit;
border-bottom-right-radius: inherit;
@@ -116,14 +116,6 @@
padding: 0.5rem;
cursor: pointer;
@media (hover: hover) {
&:hover {
border-left: var(--wa-border-style) var(--wa-panel-border-width) var(--wa-color-neutral-border-quiet) !important; /* TODO - remove after native styles refactor */
background: var(--wa-color-surface-default) !important; /* TODO - remove after native styles refactor */
color: var(--wa-color-text-quiet) !important; /* TODO - remove after native styles refactor */
}
}
&:first-of-type {
border-left: none;
border-bottom-left-radius: var(--wa-border-radius-l);

View File

@@ -1,7 +1,8 @@
/* Only code blocks generated by our docs get these styles */
pre[id*='code-block-'] {
background-color: var(--wa-color-gray-20);
color-scheme: dark;
color: white;
background-color: var(--wa-color-neutral-20);
/* Ensures a discernible background color in dark mode
* Useful for themes that use gray-20 as --wa-color-surface-default */

View File

@@ -25,6 +25,11 @@ wa-copy-button.copy-button {
border-radius: var(--wa-border-radius-m);
padding: 0.25rem;
&::part(button) {
background: transparent;
cursor: copy;
}
@media (hover: hover) {
&:hover {
color: white;
@@ -45,19 +50,3 @@ wa-copy-button.copy-button {
opacity: 1;
}
}
.block-link-icon {
position: absolute;
inset-block-start: 0;
inset-inline-end: calc(100% + var(--wa-space-s));
transition: var(--wa-transition-slow);
&:not(:hover, :focus) {
opacity: 50%;
}
:not(:hover, :focus-within) > & {
opacity: 0;
}
}

View File

@@ -26,10 +26,6 @@ body.theme-transitioning {
transition: opacity 200ms ease-out;
}
wa-page {
--wa-flow-spacing: var(--wa-space-xl);
}
/* Header */
wa-page::part(header) {
background-color: var(--wa-color-surface-default);
@@ -73,7 +69,33 @@ wa-page > header {
#docs-toolbar {
display: flex;
align-items: center;
gap: var(--wa-space-xs);
gap: var(--wa-space-s);
.color-scheme-selector,
.theme-selector {
max-inline-size: 20ch;
}
wa-divider:last-child {
display: none;
}
}
#github-buttons {
> wa-button {
&::part(base) {
color: var(--wa-color-on-quiet);
background-color: var(--wa-color-fill-quiet);
}
> wa-icon {
font-size: round(1.25em, 1px);
}
}
> wa-tooltip {
--wa-tooltip-arrow-size: 0;
font-size: var(--wa-font-size-xs);
}
}
#version-number {
@@ -86,14 +108,6 @@ wa-page > header {
font-size: var(--wa-font-size-2xs);
text-transform: uppercase;
}
wa-button#search-trigger {
--background-color: var(--wa-form-control-background-color);
--border-color: var(--wa-form-control-border-color);
}
#search-trigger kbd {
font-size: var(--wa-font-size-2xs);
line-height: var(--wa-form-control-value-line-height);
}
}
#sidebar,
@@ -130,8 +144,8 @@ wa-page > header {
border-inline-start: var(--wa-border-width-s) solid var(--wa-color-surface-border);
font-size: var(--wa-font-size-s);
line-height: var(--wa-line-height-condensed);
margin: 0;
padding-inline-start: var(--wa-space-m);
margin: 0;
}
ul ul {
@@ -144,6 +158,7 @@ wa-page > header {
li {
list-style: none;
margin: 0;
+ li {
margin-block-start: var(--wa-space-m);
@@ -242,6 +257,12 @@ wa-button.delete {
}
}
[slot='navigation-header'] {
wa-select::part(listbox) {
font-weight: var(--wa-font-weight-normal);
}
}
#sidebar-close-button {
display: none;
}
@@ -290,7 +311,7 @@ h1.title {
gap: var(--wa-space-xs);
flex-wrap: wrap;
align-items: center;
margin-block-end: var(--wa-flow-spacing);
margin-block-end: var(--wa-content-spacing);
code {
line-height: var(--wa-line-height-condensed);
@@ -333,7 +354,7 @@ h1.title {
border: var(--wa-border-style) var(--wa-border-width-s);
border-radius: var(--wa-border-radius-l);
padding: 1rem;
margin-block-end: var(--wa-flow-spacing);
margin-block-end: var(--wa-content-spacing);
:first-child {
margin-block-start: 0;
@@ -379,6 +400,22 @@ h1.title {
}
}
/* Search trigger */
wa-button#search-trigger {
&::part(base) {
background-color: var(--wa-form-control-background-color);
border: var(--wa-form-control-border-width) var(--wa-form-control-border-style) var(--wa-form-control-border-color);
box-shadow: none;
}
&::part(label) {
width: 100%;
}
}
#search-trigger kbd {
font-size: var(--wa-font-size-2xs);
line-height: var(--wa-form-control-value-line-height);
}
/* Search list pages */
wa-page > main:has(> .search-list) {
max-width: 120ch;
@@ -584,12 +621,6 @@ table.colors {
min-inline-size: 8rem;
}
/* Utilities */
.two-columns {
columns: 2;
gap: 1rem;
}
/* Component API tables */
wa-scroller:has(.component-table) {
margin-block-end: var(--wa-space-xl);
@@ -630,7 +661,7 @@ wa-scroller:has(.component-table) {
}
/** desktop */
@media screen and not (max-width: 768px) {
@media screen and not (max-width: 1180px) {
/* Navigation sidebar */
wa-page::part(navigation) {
border-right: var(--wa-border-style) var(--wa-panel-border-width) var(--wa-color-surface-border);

View File

@@ -55,7 +55,7 @@ it is rarely a good idea to mix sizes within the same button group.
Set the `orientation` attribute to `vertical` to make a vertical button group.
```html {.example}
<wa-button-group orientation="vertical" label="Options" style="max-width: 120px;">
<wa-button-group orientation="vertical" label="Options">
<wa-button>
<wa-icon slot="start" name="plus"></wa-icon>
New

View File

@@ -251,4 +251,4 @@ This example demonstrates how to style buttons using a custom class. This is the
outline-offset: 4px;
}
</style>
```
```

View File

@@ -56,10 +56,12 @@ To copy data from an attribute, use `from="id[attr]"` where `id` is the id of th
<br /><br />
<!-- Copies the input's "value" property -->
<wa-input id="my-input" type="text" value="User input" style="display: inline-block; max-width: 300px;"></wa-input>
<wa-copy-button from="my-input.value"></wa-copy-button>
<span class="wa-align-items-center wa-gap-2xs">
<wa-input id="my-input" type="text" value="User input" style="display: inline-block; max-width: 300px;"></wa-input>
<wa-copy-button from="my-input.value"></wa-copy-button>
</span>
<br /><br />
<br />
<!-- Copies the link's "href" attribute -->
<a id="my-link" href="https://shoelace.style/">Web Awesome Website</a>
@@ -88,6 +90,7 @@ Copy buttons can be disabled by adding the `disabled` attribute.
A success indicator is briefly shown after copying. You can customize the length of time the indicator is shown using the `feedback-duration` attribute.
```html {.example}
<wa-copy-button value="Web Awesome rocks!" feedback-duration="250"></wa-copy-button>
```
@@ -132,4 +135,4 @@ You can customize the button to your liking with CSS.
outline-offset: 4px;
}
</style>
```
```

View File

@@ -86,11 +86,11 @@ Use the `appearance` attribute to change the elements visual appearance.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
</wa-details>
<wa-details summary="Filled" appearance="filled">
<wa-details summary="Filled + Outlined" appearance="filled outlined">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
</wa-details>
<wa-details summary="Filled + Outlined" appearance="filled outlined">
<wa-details summary="Filled" appearance="filled">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
</wa-details>

View File

@@ -32,7 +32,7 @@ Dropdowns are designed to work well with [dropdown items](/docs/components/dropd
<wa-dropdown-item slot="submenu" value="show-thumbnails">Show Thumbnails</wa-dropdown-item>
</wa-dropdown-item>
<wa-divider></wa-divider>
<wa-dropdown-item type="checkbox" checked>Emoji Shortcuts<wa-dropdown-item>
<wa-dropdown-item type="checkbox" checked>Emoji Shortcuts</wa-dropdown-item>
<wa-dropdown-item type="checkbox" checked>Word Wrap</wa-dropdown-item>
<wa-divider></wa-divider>
<wa-dropdown-item variant="danger">

View File

@@ -416,6 +416,8 @@ By default, the arrow will be aligned as close to the center of the _anchor_ as
</div>
```
{# TODO: this example totally destroys browsers. Needs investigation.
### Syncing with the Anchor's Dimensions
Use the `sync` attribute to make the popup the same width or height as the anchor element. This is useful for controls that need the popup to stay the same width or height as the trigger.
@@ -467,6 +469,7 @@ Use the `sync` attribute to make the popup the same width or height as the ancho
sync.addEventListener('change', () => (popup.sync = sync.value));
</script>
```
#}
### Flip
@@ -848,4 +851,4 @@ This example anchors a popup to the mouse cursor using a virtual element. As suc
The following classes can be applied to the popup's `popup` part to animate it in or out programmatically. You can control the animation duration with the `--show-duration` and `--hide-duration` custom properties.
- `show` / `hide` - Shows or hides the popover with a fade
- `show-with-scale` / `hide-with-scale` - Shows or hides the popover with a fade and subtle scale effect
- `show-with-scale` / `hide-with-scale` - Shows or hides the popover with a fade and subtle scale effect

View File

@@ -21,10 +21,10 @@ Use the `label` attribute to label the progress bar and tell assistive devices h
### Custom Height
Use the `height` CSS property to set the progress bar's height.
Use the `--track-height` custom property to set the progress bar's height.
```html {.example}
<wa-progress-bar value="50" style="height: 6px;"></wa-progress-bar>
<wa-progress-bar value="50" style="--track-height: 6px;"></wa-progress-bar>
```
### Showing Values

View File

@@ -7,7 +7,7 @@ category: Form Controls
```html {.example}
<wa-select>
<wa-option value="option-1">Option 1</wa-option>
<wa-option value="">Option 1</wa-option>
<wa-option value="option-2">Option 2</wa-option>
<wa-option value="option-3">Option 3</wa-option>
<wa-option value="option-4">Option 4</wa-option>
@@ -173,7 +173,7 @@ Use `<wa-divider>` to group listbox items visually. You can also use `<small>` t
### Sizes
Use the `size` attribute to change a select's size. Note that size does not apply to listbox options.
Use the `size` attribute to change a select's size.
```html {.example}
<wa-select placeholder="Small" size="small">
@@ -366,6 +366,7 @@ Here's a comprehensive example showing different lazy loading scenarios:
const option = document.createElement('wa-option');
option.setAttribute('value', 'foo');
option.selected = true
option.innerText = 'Foo';
// For the multiple select with existing selected options, make the new option selected
@@ -402,4 +403,4 @@ Here's a comprehensive example showing different lazy loading scenarios:
:::info
The key principle is that the select component prioritizes user interactions and explicit selections over programmatic changes, ensuring a predictable user experience even with dynamically loaded content.
:::
:::

View File

@@ -7,8 +7,8 @@ category: Form Controls
```html {.example}
<wa-slider
label="Number of cats"
hint="Limit six per household"
label="Number of users"
hint="Limit six per team"
name="value"
value="3"
min="0"
@@ -40,7 +40,7 @@ Use the `label` attribute to give the slider an accessible label. For labels tha
Add descriptive hint to a slider with the `hint` attribute. For hints that contain HTML, use the `hint` slot instead.
```html {.example}
<wa-slider label="Volume" hint="Controls the volume of the current song." min="0" max="100"></wa-slider>
<wa-slider label="Volume" hint="Controls the volume of the current song." min="0" max="100" value="50"></wa-slider>
```
### Showing tooltips
@@ -72,7 +72,15 @@ Use the `with-markers` attribute to display visual indicators at each step incre
Use the `reference` slot to add contextual labels below the slider. References are automatically spaced using `space-between`, making them easy to align with the start, center, and end positions.
```html {.example}
<wa-slider label="Speed" name="speed" min="1" max="5" value="3" with-markers>
<wa-slider
label="Speed"
name="speed"
min="1"
max="5"
value="3"
with-markers
hint="Controls the speed of the thing you're currently doing."
>
<span slot="reference">Slow</span>
<span slot="reference">Medium</span>
<span slot="reference">Fast</span>
@@ -249,8 +257,8 @@ By default, the filled indicator extends from the minimum value to the current p
```html {.example}
<wa-slider
label="Cat playfulness"
hint="Energy level during playtime"
label="User Friendliness"
hint="Did you find our product easy to use?"
name="value"
value="0"
min="-5"
@@ -259,8 +267,9 @@ By default, the filled indicator extends from the minimum value to the current p
with-markers
with-tooltip
>
<span slot="reference">Lazy</span>
<span slot="reference">Zoomies</span>
<span slot="reference">Easy</span>
<span slot="reference">Moderate</span>
<span slot="reference">Difficult</span>
</wa-slider>
```

View File

@@ -23,42 +23,38 @@ The default appearance is `outlined filled`.
```html {.example}
<div class="wa-stack">
<p>
<wa-tag variant="brand" appearance="outlined accent">Outlined accent</wa-tag>
<wa-tag variant="brand" appearance="accent">Accent</wa-tag>
<wa-tag variant="brand" appearance="outlined">Outlined</wa-tag>
<wa-tag variant="brand" appearance="filled outlined">Filled + Outlined</wa-tag>
<wa-tag variant="brand" appearance="filled">Filled</wa-tag>
<wa-tag variant="brand" appearance="outlined filled">Outlined Filled</wa-tag>
<wa-tag variant="brand" appearance="outlined">Outlined</wa-tag>
</p>
<p>
<wa-tag variant="success" appearance="outlined accent">Outlined accent</wa-tag>
<wa-tag variant="success" appearance="accent">Accent</wa-tag>
<wa-tag variant="success" appearance="outlined">Outlined</wa-tag>
<wa-tag variant="success" appearance="filled outlined">Filled + Outlined</wa-tag>
<wa-tag variant="success" appearance="filled">Filled</wa-tag>
<wa-tag variant="success" appearance="outlined filled">Outlined Filled</wa-tag>
<wa-tag variant="success" appearance="outlined">Outlined</wa-tag>
</p>
<p>
<wa-tag variant="neutral" appearance="outlined accent">Outlined accent</wa-tag>
<wa-tag variant="neutral" appearance="accent">Accent</wa-tag>
<wa-tag variant="neutral" appearance="outlined">Outlined</wa-tag>
<wa-tag variant="neutral" appearance="filled outlined">Filled + Outlined</wa-tag>
<wa-tag variant="neutral" appearance="filled">Filled</wa-tag>
<wa-tag variant="neutral" appearance="outlined filled">Outlined Filled</wa-tag>
<wa-tag variant="neutral" appearance="outlined">Outlined</wa-tag>
</p>
<p>
<wa-tag variant="warning" appearance="outlined accent">Outlined accent</wa-tag>
<wa-tag variant="warning" appearance="accent">Accent</wa-tag>
<wa-tag variant="warning" appearance="outlined">Outlined</wa-tag>
<wa-tag variant="warning" appearance="filled outlined">Filled + Outlined</wa-tag>
<wa-tag variant="warning" appearance="filled">Filled</wa-tag>
<wa-tag variant="warning" appearance="outlined filled">Outlined Filled</wa-tag>
<wa-tag variant="warning" appearance="outlined">Outlined</wa-tag>
</p>
<p>
<wa-tag variant="danger" appearance="outlined accent">Outlined accent</wa-tag>
<wa-tag variant="danger" appearance="accent">Accent</wa-tag>
<wa-tag variant="danger" appearance="outlined">Outlined</wa-tag>
<wa-tag variant="danger" appearance="filled outlined">Filled + Outlined</wa-tag>
<wa-tag variant="danger" appearance="filled">Filled</wa-tag>
<wa-tag variant="danger" appearance="outlined filled">Outlined Filled</wa-tag>
<wa-tag variant="danger" appearance="outlined">Outlined</wa-tag>
</p>
</div>
```

View File

@@ -6,7 +6,7 @@ category: Imagery
---
```html {.example}
<wa-zoomable-frame src="https://backers.webawesome.com/" zoom="0.5"> </wa-zoomable-frame>
<wa-zoomable-frame src="https://webawesome.com/" zoom="0.5"> </wa-zoomable-frame>
```
## Examples
@@ -43,7 +43,7 @@ Set the `zoom` attribute to control the frame's zoom level. Use `1` for 100%, `2
Define specific zoom increments with the `zoom-levels` attribute using space-separated percentages and decimal values like `zoom-levels="0.25 0.5 75% 100%"`.
```html {.example}
<wa-zoomable-frame src="https://backers.webawesome.com/" zoom="0.5" zoom-levels="50% 0.75 100%"> </wa-zoomable-frame>
<wa-zoomable-frame src="https://webawesome.com/" zoom="0.5" zoom-levels="50% 0.75 100%"> </wa-zoomable-frame>
```
### Hiding zoom controls
@@ -51,7 +51,7 @@ Define specific zoom increments with the `zoom-levels` attribute using space-sep
Add the `without-controls` attribute to hide the zoom control interface from the frame.
```html {.example}
<wa-zoomable-frame src="https://backers.webawesome.com/" without-controls zoom="0.5"> </wa-zoomable-frame>
<wa-zoomable-frame src="https://webawesome.com/" without-controls zoom="0.5"> </wa-zoomable-frame>
```
### Preventing user interaction
@@ -59,5 +59,5 @@ Add the `without-controls` attribute to hide the zoom control interface from the
Apply the `without-interaction` attribute to make the frame non-interactive. Note that this prevents keyboard navigation into the frame, which may impact accessibility for some users.
```html {.example}
<wa-zoomable-frame src="https://backers.webawesome.com/" zoom="0.5" without-interaction> </wa-zoomable-frame>
<wa-zoomable-frame src="https://webawesome.com/" zoom="0.5" without-interaction> </wa-zoomable-frame>
```

View File

@@ -10,17 +10,16 @@ You can customize the look and feel of Web Awesome at a high level with themes.
Web Awesome uses [themes](/docs/themes) to apply a cohesive look and feel across the entire library. Themes are built with a collection of predefined CSS custom properties, which we call [design tokens](/docs/tokens), and there are many premade themes you can choose from.
To use a theme, simply add a link to the theme's stylesheet to the `<head>` of your page. For example, you can replace the link to `default.css` in the [installation code](/docs/#quick-start-autoloading-via-cdn) with this snippet to use the *Awesome* theme:
To use a theme, simply add a link to the theme's stylesheet to the `<head>` of your page. For example, you can add this snippet alongside th [installation code](/docs/#quick-start-autoloading-via-cdn) to use the *Awesome* theme:
```html
<link rel="stylesheet" href="{% cdnUrl 'styles/themes/awesome.css' %}" />
```
You can [customize any theme](/docs/themes/creating) just with CSS — no preprocessor required. All design tokens are prefixed with `--wa-` to avoid collisions with other libraries or your own custom properties. Simply override any design token in your own stylesheet by scoping your styles to `:where(:root)`, `:host`, the class for the specific theme you want to override (if needed), and the class for the relevant color scheme (if needed). Here's an example that changes the default brand color to purple in light mode:
You can customize any theme just with CSS — no preprocessor required. All design tokens are prefixed with `--wa-` to avoid collisions with other libraries and your own custom properties. Simply override any design token in your own stylesheet by scoping your styles to `:root`, the class for the specific theme you want to override (if needed), and the class for the relevant color scheme (if needed). Here's an example that changes the default brand color to purple in light mode:
```css
:where(:root),
:host,
:root,
.wa-light,
.wa-dark .wa-invert {
--wa-color-brand-fill-quiet: var(--wa-color-purple-95);
@@ -35,10 +34,6 @@ You can [customize any theme](/docs/themes/creating) just with CSS — no prepro
}
```
:::info
Wrapping the `:root` selector in `:where()` gives this selector 0 specificity. This allows us to define our design tokens' default values while ensuring they can be cleanly overridden as needed.
:::
For a complete list of all custom properties used for theming, refer to `src/styles/themes/default.css` in the project's source code.
## Components

View File

@@ -26,8 +26,8 @@ If you're using a bundler, make sure it comes _before_ any components are import
// Make sure this import is first.
import '@lit-labs/ssr-client/lit-element-hydrate-support.js';
import 'webawesome/dist/components/button/button.js';
import 'webawesome/dist/components/input/input.js';
import '@awesome.me/webawesome/dist/components/button/button.js';
import '@awesome.me/webawesome/dist/components/input/input.js';
```
## Enable Server Rendering
@@ -43,7 +43,7 @@ import litPlugin from '@lit-labs/eleventy-plugin-lit';
eleventyConfig.addPlugin(litPlugin, {
mode: 'worker',
componentModules: ['webawesome/dist/components/button/button.js', 'webawesome/dist/components/input/input.js'],
componentModules: ['@awesome.me/webawesome/dist/components/button/button.js', '@awesome.me/webawesome/dist/components/input/input.js'],
});
```
@@ -114,4 +114,4 @@ Here are some known issues and things we're still working on.
- `@shoelace-style/localize` (our localization library) has no way to set a language currently so it always falls back to `en`.
- `<wa-icon>` has no fallback if there's no JS besides a blank `<svg>`. There's perhaps some backend mechanisms we can use to fetch. But requires altering APIs. Should also have a way to set height / widths, but we don't want to increase pain for SSR users.
- `<wa-qr-code>` QR Code will not error on the backend and will render a blank canvas at the appropriate size, but will not render the canvas until the client component connects.
- `setBasePath` and `kit codes` may need reconfiguring to work with SSR.
- `setBasePath` and `kit codes` may need reconfiguring to work with SSR.

View File

@@ -4,20 +4,12 @@ description: Choose the installation method that works best for you.
layout: page-outline
---
Welcome to your exclusive early access to Web Awesome Beta! 👋
At this time, we're offering access to Web Awesome Free and Pro through a temporary CDN while we prepare for a public release. This beta is tried, true, and stable, but please be aware that things may change here and there before our production release to the public.
Thank you so much for backing us!
Welcome to Web Awesome beta! [Learn more](https://webawesome.com/) about this project and [how to contribute to it](https://webawesome.com/docs/resources/contributing).
- [Report a bug](https://github.com/shoelace-style/webawesome/issues)
- [Get help / ask a question](https://github.com/shoelace-style/webawesome/discussions)
- [See what's new since the last version](/docs/resources/changelog)
:::warning
As a Web Awesome backer, this beta release is _just for you_. Please refrain from sharing it for the time being!
:::
---
## Quick Start (Autoloading via CDN)
@@ -25,15 +17,13 @@ As a Web Awesome backer, this beta release is _just for you_. Please refrain fro
To get everything included in Web Awesome, add the following code to the `<head>` of your site:
```html
<link rel="stylesheet" href="{% cdnUrl 'styles/themes/default.css' %}" />
<link rel="stylesheet" href="{% cdnUrl 'styles/webawesome.css' %}" />
<script type="module" src="{% cdnUrl 'webawesome.loader.js' %}"></script>
```
This snippet includes three parts:
1. **The default theme**, a stylesheet that gives a cohesive look to Web Awesome components with both light and dark modes
2. **Web Awesome styles**, an optional stylesheet that [styles native HTML elements](/docs/utilities/native) and includes [utility classes](/docs/utilities) you can use in your project
3. **The autoloader**, a lightweight script watches the DOM for unregistered Web Awesome elements and lazy loads them for you — even if they're added dynamically
This snippet adds:
- **Web Awesome styles**, a collection of stylesheets including essential default theme styles, optional [styles for native elements](/docs/utilities/native) and optional [utility classes](/docs/utilities)
- **The autoloader**, a lightweight script watches the DOM for unregistered Web Awesome elements and lazy loads them for you — even if they're added dynamically
Now you can [start using Web Awesome!](/docs/usage)
@@ -60,13 +50,9 @@ Font Awesome users can set their kit code to unlock Font Awesome Pro icons. You
The autoloader is the easiest way to use Web Awesome, but different projects (or your own preferences!) may require different installation methods.
### Installing via npm
### Cherry Picking from CDN
An npm package isn't yet available, but we'll have one soon! For now, please enjoy [Web Awesome from the CDN](#quick-start-autoloading-via-cdn).
### Cherry Picking
Cherry picking will only load the components you need up front, while limiting the number of files the browser has to download. The disadvantage is that you need to import each individual component on each page it's used. You'll still need to include the default theme (`styles/themes/default.css`) or another theme to style any imported components.
Cherry picking will only load the components you need up front, while limiting the number of files the browser has to download. The disadvantage is that you need to import each individual component on each page it's used. Additionally, you must include the default theme (`styles/themes/default.css`) to style any imported components. To use a different theme, include your preferred theme _in addition to_ the default theme.
Here's an example that loads only the button component.
@@ -86,6 +72,32 @@ You can copy and paste the code to import a component from the "Importing" secti
You will see files named `chunk.[hash].js` in the `chunks` directory. Never import these files directly, as they are generated and change from version to version.
:::
### Installing via npm
```bash
npm install @awesome.me/webawesome
```
And then in your JavaScript files, import the components you need.
:::warning
Web Awesome does not a provide a single import with all Web Awesome components. Instead, you must "cherry pick" the components you want to use.
:::
```js
// Option 1: import all Web Awesome styles
import "@awesome.me/webawesome/dist/styles/webawesome.css"
// Option 2: import only the default theme
import "@awesome.me/webawesome/dist/styles/themes/default.css"
// <wa-button>
import "@awesome.me/webawesome/dist/components/button/button.js"
// <wa-input>
import "@awesome.me/webawesome/dist/components/input/input.js"
```
Once they've been imported, you can use them in your HTML normally. Component imports are located in the "Importing" section of each component's documentation.
### Setting the Base Path
@@ -95,12 +107,12 @@ Some components rely on assets (icons, images, etc.) and Web Awesome needs to kn
```html
<!-- Option 1: the data-webawesome attribute -->
<script src="bundle.js" data-webawesome="/path/to/web-awesome/dist"></script>
<script src="bundle.js" data-webawesome="/path/to/webawesome/dist"></script>
<!-- Option 2: the setBasePath() method -->
<script type="module">
import { setBasePath } from '/path/to/web-awesome/dist/webawesome.js';
setBasePath('/path/to/web-awesome/dist');
import { setBasePath } from '/path/to/webawesome/dist/webawesome.js';
setBasePath('/path/to/webawesome/dist');
</script>
```
@@ -110,7 +122,7 @@ Most of the magic behind assets is handled internally by Web Awesome, but if you
```html
<script type="module">
import { getBasePath, setBasePath } from '/path/to/web-awesome/dist/webawesome.js';
import { getBasePath, setBasePath } from '/path/to/webawesome/dist/webawesome.js';
setBasePath('/path/to/assets');
@@ -123,3 +135,14 @@ Most of the magic behind assets is handled internally by Web Awesome, but if you
const assetPath = getBasePath('file.ext');
</script>
```
## The difference between `/dist` and `/dist-cdn`
If you have Web Awesome installed locally via NPM, you'll notice 2 directories. `/dist-cdn` and `/cdn`.
The `/dist-cdn` files are bundled differently than the `/dist` files. The `/dist-cdn` files come pre-bundled, which means all dependencies are "inlined" so there are no "bare" references like `import "lit"`. The `/dist` files **DO NOT** come pre-bundled, allowing your bundler of choice to more efficiently de-duplicate dependencies, resulting in smaller bundles and optimal code sharing.
TLDR:
- `@awesome.me/webawesome/dist-cdn` is for CDNs or people not using a bundler.
- `@awesome.me/webawesome/dist` is for bundlers or importmaps.

View File

@@ -8,6 +8,42 @@ Web Awesome follows [Semantic Versioning](https://semver.org/). Breaking changes
Components with the <wa-badge variant="warning">Experimental</wa-badge> badge should not be used in production. They are made available as release candidates for development and testing purposes. As such, changes to experimental components will not be subject to semantic versioning.
## Next
### New Features {data-no-outline}
- Added `--track-height` custom property to `<wa-progress-bar>` [pr:1154]
- Added `--pulse-color` custom property to `<wa-badge>` [pr:1173]
### Bug Fixes and Improvements {data-no-outline}
- Fixed a bug in `<wa-badge>` where `appearance="pulse"` was not working as expected [pr:1173]
- Fixed a missing TypeScript type for `<wa-badge>` for its `attention` property missing `bounce` value. [pr:1173]
- Fixed the missing `nanoid` dependency in `package.json` [discuss:1139]
- Fixed a bug in `<wa-slider>` that prevented the hint from showing up [discuss:1172]
- Fixed a bug in `<wa-textarea>` where setting `resize="auto"` caused the height of the textarea to double [issue:1155]
- Fixed a bug in `<wa-card>` that caused slotted media to have incorrectly rounded corners [issue:1107]
- Fixed a bug in `<wa-button-group>` that prevented pill buttons from rendering corners properly [issue:1165]
- Fixed a bug in `<wa-button-group>` that caused some vertical groups to appear horizontal [issue:1152]
## 3.0.0-beta.2
### New Features {data-no-outline}
- Added `.wa-hover-rows` to native styles to opt-in to highlighting table rows on hover.
### Bug Fixes and Improvements {data-no-outline}
- Fixed a bug in `<wa-select>` with options that had blank string values. [pr:1136]
- Added `.wa-hover-rows` to native styles to opt-in to highlighting table rows on hover [pr:1111]
- Added missing changelog entries for beta.1 [pr:1117]
- Fixed a bug in `<wa-dropdown>` that prevented the menu from flipping/shifting to keep the menu in the viewport [pr:1122]
- Fixed the themes page so it shows the correct palette and imports [pr:1125]
- Fixed `filled` and `outlined` appearance styles in various components [issue:1102]
- Fixed active state styles in the Awesome theme [pr:1129]
- Fixed native text styles when applied to certain backgrounds [pr:https://github.com/shoelace-style/webawesome/pull/1130]
- Improved the organization of essential and optional styles [pr:1113]
## 3.0.0-beta.1
We're excited to share the first beta release of Web Awesome, which includes some breaking changes that make the library significantly more intuitive and consistent!
@@ -28,7 +64,8 @@ Many of these changes and improvements were the direct result of feedback from u
- Renamed the `classic` theme to `shoelace`
- Removed `:root` selector from all theme, color palette, and semantic color stylesheets except for the default theme and colors. All of these styles are now solely scoped to classes, such as `.wa-theme-awesome`, `.wa-palette-bright`, and `.wa-brand-orange`.
- Removed most custom properties from components that can otherwise be styled with `::part()` selectors and standard CSS properties.
- Renamed `pulse` attribute in `<wa-badge>` to `attention="pulse"` and added `attention="bounce"` [issue:#940]
- `<wa-dropdown>` was reworked and simplified to not use menu, menu item, menu label; use `<wa-dropdown-item>` instead
- Renamed `pulse` attribute in `<wa-badge>` to `attention="pulse"` and added `attention="bounce"` [issue:940]
- Renamed the `vertical` attribute to `orientation="vertical"` in `<wa-split-panel>` and `<wa-divider>` to align with other components and the platform [issue:674]
- Renamed certain boolean attributes to be consistent using the `with-*` and `without-*` pattern:
- `<wa-button caret>` => `<wa-button with-caret>`
@@ -73,6 +110,7 @@ Many of these changes and improvements were the direct result of feedback from u
- Added a new free component: `<wa-zoomable-frame>` (#3 of 14 per stretch goals)
- Added a `min-block-size` to `<wa-divider orientation="vertical">` to ensure the divider is visible regardless of container height
- Added support for `name` in `<wa-details>` for exclusively opening one in a group
- Added `--wa-content-spacing` to themes to set default spacing between HTML elements in Native Styles
- Added `--checked-icon-scale` to `<wa-checkbox>`
- Added `--tag-max-size` to `<wa-select>` when using `multiple`
- Added support for `data-dialog="open <id>"` to `<wa-dialog>`
@@ -96,6 +134,9 @@ Many of these changes and improvements were the direct result of feedback from u
### Removals {data-no-outline}
- Removed the experimental `<wa-code-demo>` component
- `<wa-menu>`, `<wa-menu-item>`, `<wa-menu-label>` were dropped; use `<wa-dropdown-item>` instead
- `<wa-icon-button>` was removed; icon buttons can be added via `<wa-button>` now
- `<wa-radio-button>` was dropped; use `<wa-radio appearance="button">` instead
<details>
<summary>Alpha Changelogs</summary>

View File

@@ -17,7 +17,7 @@ The [discussion forum](https://github.com/shoelace-style/shoelace/discussions) i
- Show the community what you're working on
- Learn more about the project, its values, and its roadmap
<wa-button variant="brand" href="https://github.com/shoelace-style/shoelace/discussions" target="_blank" style="margin-block-end: var(--wa-flow-spacing);">
<wa-button variant="brand" href="https://github.com/shoelace-style/shoelace/discussions" target="_blank" style="margin-block-end: var(--wa-content-spacing);">
<wa-icon name="github" family="brands" slot="start"></wa-icon>
Join the Discussion
</wa-button>
@@ -31,7 +31,7 @@ The [community chat](https://discord.gg/mg8f26C) is open to the public and power
- Show the community what you're working on
- Chat live with other designers, developers, and Web Awesome fans
<wa-button variant="brand" href="https://discord.gg/mg8f26C" target="_blank" style="margin-block-end: var(--wa-flow-spacing);">
<wa-button variant="brand" href="https://discord.gg/mg8f26C" target="_blank" style="margin-block-end: var(--wa-content-spacing);">
<wa-icon name="discord" family="brands" slot="start"></wa-icon>
Join the Chat
</wa-button>
@@ -42,7 +42,7 @@ Follow [@webawesomer](https://twitter.com/webawesomer) on Twitter for general up
**Please avoid using Twitter for support questions.** The [discussion forum](https://github.com/shoelace-style/shoelace/discussions) is a much better place to share code snippets, screenshots, and other troubleshooting info. You'll have much better luck there, as more users will have a chance to help you.
<wa-button variant="brand" href="https://twitter.com/webawesomer" target="_blank" style="margin-block-end: var(--wa-flow-spacing);">
<wa-button variant="brand" href="https://twitter.com/webawesomer" target="_blank" style="margin-block-end: var(--wa-content-spacing);">
<wa-icon name="twitter" family="brands" slot="start"></wa-icon>
Follow on Twitter
</wa-button>
</wa-button>

View File

@@ -4,95 +4,100 @@ description: Themes galore
layout: page
---
<div class="wa-stack wa-gap-3xl">
<div class="wa-split">
<h1>{{ title }}</h1>
<wa-button variant="brand" href="/themer">
<wa-icon slot="start" name="plus" variant="regular"></wa-icon>
Create a Theme
</wa-button>
</div>
<div class="wa-split">
<h1>{{ title }}</h1>
<wa-button variant="brand" href="/themer">
<wa-icon slot="start" name="plus" variant="regular"></wa-icon>
Create a Theme
</wa-button>
</div>
<div id="theme-viewer">
<div id="theme-viewer">
{% raw %}
{% if not currentUser.hasPro %}
<p>
Additional themes are available to pro users. Please <a href="/login">login to view pro themes</a>.
</p>
{% endif %}
{% endraw %}
<wa-radio-group id="theme-picker" label="Theme Selector" value="default" orientation="horizontal">
{% for theme in themer.themes %}
{% if not theme.isPro %}
<wa-radio-group id="theme-picker" label="Theme Selector" value="default" orientation="horizontal">
{% for theme in themer.themes %}
{% if not theme.isPro %}
<wa-radio
class="theme-card"
value="{{ theme.filename | stripExtension }}"
data-description="{{ theme.description }}"
data-title="{{ theme.name }}"
data-palette="{{ theme.palette.filename | stripExtension}}"
data-brand="{{ theme.colorBrand.color }}"
{% if theme.isPro %}data-is-pro{% endif %}
>
{{ theme.name }}
</wa-radio>
{% else %}
{% raw %}
{% if currentUser.hasPro %}
{% endraw %}
<wa-radio
class="theme-card"
value="{{ theme.filename | stripExtension }}"
data-description="{{ theme.description }}"
data-title="{{ theme.name }}"
data-palette="{{ theme.palette.filename | stripExtension}}"
data-brand="{{ theme.colorBrand.color }}"
{% if theme.isPro %}data-is-pro{% endif %}
>
{{ theme.name }}
</wa-radio>
{% else %}
{% raw %}
{% if currentUser.hasPro %}
{% endraw %}
<wa-radio
class="theme-card"
value="{{ theme.filename | stripExtension }}"
data-description="{{ theme.description }}"
data-title="{{ theme.name }}"
{% if theme.isPro %}data-is-pro{% endif %}
>
{{ theme.name }}
</wa-radio>
{% raw %}
{% endif %}
{% endraw %}
{% endif %}
{% endfor %}
</wa-radio-group>
</div>
<div id="theme-preview" class="wa-stack">
<header class="wa-stack">
<div class="wa-cluster">
<h2 data-theme-name="name">Theme</h2>
<wa-badge data-free-badge appearance="outlined" variant="neutral" hidden>FREE</wa-badge>
<wa-badge data-pro-badge appearance="accent" hidden>PRO</wa-badge>
</div>
<p data-theme-description>Description</p>
</header>
<wa-comparison position="80">
<wa-zoomable-frame
src="/examples/themes/showcase?color-scheme=dark"
slot="before"
without-controls
without-interaction
></wa-zoomable-frame>
<wa-zoomable-frame
src="/examples/themes/showcase"
slot="after"
without-controls
without-interaction
></wa-zoomable-frame>
</wa-comparison>
</div>
<h2>Using This Theme</h2>
<div id="import-code">
{% for theme in themer.themes %}
<div class="theme-instructions" data-theme="{{ theme.filename | stripExtension }}" {% if not loop.first %}hidden{% endif %}>
<p>
To import this theme, set <code>&lt;html class=&quot;wa-theme-{{ theme.filename | stripExtension }}&quot;&gt;</code> and import the following stylesheet:
</p>
<pre><code class="language-html">&lt;link rel=&quot;stylesheet&quot; href=&quot;{% cdnUrl %}styles/themes/{{ theme.filename }}&quot; /&gt;</code></pre>
</div>
{% raw %}
{% endif %}
{% endraw %}
{% endif %}
{% endfor %}
</div>
</wa-radio-group>
</div>
<div id="theme-preview" class="wa-stack">
<header class="wa-stack">
<div class="wa-cluster">
<h2 data-theme-name="name">Theme</h2>
<wa-badge data-free-badge appearance="outlined" variant="neutral" hidden>FREE</wa-badge>
<wa-badge data-pro-badge appearance="accent" hidden>PRO</wa-badge>
</div>
<p data-theme-description>Description</p>
</header>
<wa-comparison position="80">
<wa-zoomable-frame
src="/examples/themes/showcase?color-scheme=dark"
slot="before"
without-controls
without-interaction
></wa-zoomable-frame>
<wa-zoomable-frame
src="/examples/themes/showcase"
slot="after"
without-controls
without-interaction
></wa-zoomable-frame>
</wa-comparison>
</div>
<h2>Using This Theme</h2>
<div id="import-code">
{% for theme in themer.themes %}
<div class="theme-instructions" data-theme="{{ theme.filename | stripExtension }}" {% if not loop.first %}hidden{% endif %}>
<p>
To import this theme, apply the following classes to the <code>&lt;html&gt;</code> element and import the theme's stylesheet.
</p>
<pre><code class="language-html">&lt;html class=&quot;wa-theme-{{ theme.filename | stripExtension }} wa-palette-{{ theme.palette.filename | stripExtension }} wa-brand-{{ theme.colorBrand.color}}&quot;&gt;
...
&lt;link rel=&quot;stylesheet&quot; href=&quot;{% cdnUrl %}styles/themes/{{ theme.filename }}&quot; /&gt;</code></pre>
</div>
{% endfor %}
</div>
<script type="module">
import { doViewTransition } from '/assets/scripts/view-transitions.js';
@@ -104,23 +109,25 @@ layout: page
const freeBadge = document.querySelector('[data-free-badge]');
const proBadge = document.querySelector('[data-pro-badge]');
function updateFrames(selectedValue, title, description, isPro) {
function updateFrames(selectedValue, title, description, isPro, palette, brand) {
// Update theme classes on both frames
[afterFrame, beforeFrame].forEach(frame => {
if (frame.contentDocument) {
const html = frame.contentDocument.documentElement;
if (!html) return;
// Remove all existing wa-theme-* classes
html.classList.forEach(className => {
if (className.startsWith('wa-theme-')) {
// Remove all existing wa-theme-*, wa-palette-*, and wa-brand-* classes
[...html.classList].forEach(className => {
if (className.startsWith('wa-theme-') || className.startsWith('wa-palette-') || className.startsWith('wa-brand-')) {
html.classList.remove(className);
}
});
// Add new theme class if not default
// Add new theme, palette, and brand classes
if (selectedValue !== 'default') {
html.classList.add(`wa-theme-${selectedValue}`);
html.classList.add(`wa-palette-${palette}`);
html.classList.add(`wa-brand-${brand}`);
}
}
});
@@ -148,8 +155,10 @@ layout: page
defaultRadio.checked = true;
const title = defaultRadio.getAttribute('data-title');
const description = defaultRadio.getAttribute('data-description');
const palette = defaultRadio.getAttribute('data-palette');
const brand = defaultRadio.getAttribute('data-brand');
const isPro = defaultRadio.hasAttribute('data-is-pro');
updateFrames('default', title, description, isPro);
updateFrames('default', title, description, isPro, palette, brand);
}
// Listen for radio changes
@@ -157,9 +166,11 @@ layout: page
const selectedRadio = event.target.querySelector(':state(checked)');
const title = selectedRadio.getAttribute('data-title');
const description = selectedRadio.getAttribute('data-description');
const palette = selectedRadio.getAttribute('data-palette');
const brand = selectedRadio.getAttribute('data-brand');
const isPro = selectedRadio.hasAttribute('data-is-pro');
doViewTransition(() => {
updateFrames(selectedRadio.value, title, description, isPro);
updateFrames(selectedRadio.value, title, description, isPro, palette, brand);
});
});
</script>
@@ -169,6 +180,11 @@ layout: page
display: none !important;
}
#theme-preview,
#using-this-theme {
margin-block-start: var(--wa-space-3xl);
}
.title {
display: none;
}

View File

@@ -55,9 +55,9 @@ Web Awesome's color system is made up of CSS custom properties to help with cons
Color is organized by three main categories:
- [Color scales](/#color-scales) that gives you a full spectrum of hues to work with
- [Foundational colors](/#foundational-colors) that lay the groundwork for your theme
- [Semantic colors](/#semantic-colors) that draw attention and convey meaning
- [Color scales](#color-scales) that gives you a full spectrum of hues to work with
- [Foundational colors](#foundational-colors) that lay the groundwork for your theme
- [Semantic colors](#semantic-colors) that draw attention and convey meaning
## Color Scales

View File

@@ -5,27 +5,52 @@ layout: page-outline
tags: styleUtilities
---
Web Awesome provides optional Native Styles that make native HTML elements look good so you can continue using what you know and gradually adopt Web Awesome as you see fit.
Native styles use design tokens to spruce up native HTML elements so that they match the look and feel of your theme. While these native styles are completely optional, they're a great starting point for a cohesive design and a huge help when using a combination of native elements and Web Awesome components in your project.
## Installation
## Using native styles
To use all Web Awesome page styles (including [utilities](/docs/utilities/)), include the following stylesheet in your project:
To use all Web Awesome styles (including [utilities](/docs/utilities/)), include the following stylesheet in your project:
```html
<link rel="stylesheet" href="{% cdnUrl 'styles/webawesome.css' %}" />
```
Or, to _only_ include styles for native elements:
Or, if you only want styles for native elements, include the default theme and native styles individually:
```html
<link rel="stylesheet" href="{% cdnUrl 'styles/themes/default.css' %}" />
<link rel="stylesheet" href="{% cdnUrl 'styles/native.css' %}" />
```
## Elements
You can additionally include any pre-made [theme](/docs/themes/) or [color palette](/docs/color-palettes/) to change the look of native elements.
## Content flow
Native styles set default space between many block-level HTML elements using the `--wa-content-spacing` token from your theme. This helps ensure that your content is readable.
```html {.example}
<h3>Curabitur odio ligula</h3>
<p>Fusce mollis quam lorem, et gravida arcu laoreet ut. Pellentesque et malesuada mi. Morbi faucibus nisl nec nulla porta, ac scelerisque elit finibus.</p>
<blockquote>The Road goes ever on and on<br />
Out from the door where it began.</blockquote>
<p>Donec varius, ipsum sit amet lobortis tristique, quam arcu pellentesque turpis, non porta lacus arcu non arcu. Morbi luctus at nisl sit amet faucibus.</p>
<hr />
<ul>
<li>Aenean imperdiet</li>
<li>Vivamus consectetur at est</li>
<li>Quisque vel leo in leo semper</li>
</ul>
```
To remove this default spacing, you can set `--wa-content-spacing: 0` in your styles.
## Typography
Native styles use [typography design tokens](/docs/tokens/typography/) to style text elements. A number of styles — such as `color`, `font-family`, `font-size`, `font-weight`, and `line-height` — are set on the `<body>` element to be inherited by child elements.
### Headings
Semantic heading elements with proper hierarchy and styling.
Create headings with `<h1>` through `<h6>`. Headings use tokens with the `-heading` suffix, condensed line height, and `text-wrap: balance` for a prominent yet compact appearance.
```html {.example}
<h1>Heading 1</h1>
@@ -38,7 +63,7 @@ Semantic heading elements with proper hierarchy and styling.
### Paragraphs
Standard paragraph text with optimal spacing and readability.
Create paragraphs with `<p>`. Paragraphs inherit the default text styles set on the `<body>` element and use `text-wrap: pretty` to prevent orphaned lines in supported browsers.
```html {.example}
<p>
@@ -55,7 +80,7 @@ Standard paragraph text with optimal spacing and readability.
### Blockquotes
Styled quotations that stand out from regular text.
Emphasize longer quotations with `<blockquote>`. Block quotes use your theme's serif font family and a leading border to stand out.
```html {.example}
<blockquote>
@@ -67,51 +92,51 @@ Styled quotations that stand out from regular text.
### Lists
Organized content in bulleted or numbered format with proper nesting support.
Create ordered and unordered lists with `<ol>` and `<ul>`, plus `<li>` for list items within.
```html {.example}
<ul>
<li>List item 1</li>
<li>
List item 2
<ul>
<li>Subitem a</li>
<li>Subitem b</li>
</ul>
</li>
<li>List item 3</li>
</ul>
<div class="wa-grid">
<ol>
<li>First item</li>
<li>
Another item
<ol>
<li>Nested item</li>
<li>Another nested item</li>
</ol>
</li>
<li>Final item</li>
</ol>
<ol>
<li>List item 1</li>
<li>
List item 2
<ol>
<li>Subitem a</li>
<li>Subitem b</li>
</ol>
</li>
<li>List item 3</li>
</ol>
<ul>
<li>First item</li>
<li>
Another item
<ul>
<li>Nested item</li>
<li>Another nested item</li>
</ul>
</li>
<li>Final item</li>
</ul>
</div>
```
### Description Lists
Term and definition pairs for glossaries and descriptions.
Use `<dl>` to create lists of terms (`<dt>`) and definitions (`<dd>`).
```html {.example}
<dl>
<dt>Definition 1</dt>
<dt>First term</dt>
<dd>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
</dd>
<dt>Definition 2</dt>
<dt>Second term</dt>
<dd>
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur
sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</dd>
<dt>Definition 3</dt>
<dt>Final term</dt>
<dd>
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam,
eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.
@@ -119,13 +144,153 @@ Term and definition pairs for glossaries and descriptions.
</dl>
```
### Code blocks
Create code blocks or other preformatted text with `<pre>`. Preformatted text uses your theme's monospace font family and a subtle background color.
```html {.example}
<pre>
// do a thing
export function thing() {
return true;
}
</pre>
```
### Inline text
Use any inline text element like `<strong>`, `<em>`, `<a>`, `<kbd>`, and others to stylize or emphasize text.
```html {.example}
<div class="wa-grid">
<div class="wa-stack wa-align-items-start">
<strong>Bold</strong>
<em>Italic</em>
<u>Underline</u>
<s>Strike-through</s>
<del>Deleted</del>
<ins>Inserted</ins>
<small>Small</small>
</div>
<div class="wa-stack wa-align-items-start">
<span>Subscript <sub>Sub</sub></span>
<span>Superscript <sup>Sup</sup></span>
<abbr title="Abbreviation">Abbr.</abbr>
<mark>Highlighted</mark>
<a href="#">Link text</a>
<code>Inline code</code>
<kbd>Keyboard</kbd>
</div>
</div>
```
## Widgets & media
### Media
Add responsive media with `<img>`, `<svg>`, `<video>`, `<iframe>`, and others. Media takes up 100% width by default and scales according to its container's width.
```html {.example}
<img
src="https://images.unsplash.com/photo-1620196244888-d31ff5bbf163?q=80&w=1000&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"
alt="A gray kitten lays next to a toy"
/>
```
### Tables
Structure tabular data with `<table>` and related elements like `<caption>`, `<thead>`, `<tbody>`, `<th>`, `<tr>`, and `<td>`.
```html {.example}
<table>
<caption>
This <code>&lt;caption&gt;</code> describes the table
</caption>
<thead>
<tr>
<th>First column</th>
<th>Second column</th>
<th>Third column</th>
<th>Final column</th>
</tr>
</thead>
<tbody>
<tr>
<td>Data</td>
<td>Data</td>
<td>Data</td>
<td>Data</td>
</tr>
<tr>
<td>Data</td>
<td>Data</td>
<td>Data</td>
<td>Data</td>
</tr>
<tr>
<td>Data</td>
<td>Data</td>
<td>Data</td>
<td>Data</td>
</tr>
<tr>
<td>Data</td>
<td>Data</td>
<td>Data</td>
<td>Data</td>
</tr>
</tbody>
</table>
```
Add the `wa-hover-rows` class to highlight table rows on hover and the `wa-zebra-rows` class to add alternating row colors to your table.
```html {.example}
<table class="wa-zebra-rows wa-hover-rows">
<thead>
<tr>
<th>First column</th>
<th>Second column</th>
<th>Third column</th>
<th>Final column</th>
</tr>
</thead>
<tbody>
<tr>
<td>Data</td>
<td>Data</td>
<td>Data</td>
<td>Data</td>
</tr>
<tr>
<td>Data</td>
<td>Data</td>
<td>Data</td>
<td>Data</td>
</tr>
<tr>
<td>Data</td>
<td>Data</td>
<td>Data</td>
<td>Data</td>
</tr>
<tr>
<td>Data</td>
<td>Data</td>
<td>Data</td>
<td>Data</td>
</tr>
</tbody>
</table>
```
### Details
Collapsible content sections with expand/collapse functionality.
Create disclosure widgets with `<details>` and `<summary>`. Details closely match the appearance of [`<wa-details>`](/docs/components/details/).
```html {.example}
<details>
<summary>Tincidunt nunc pulvinar</summary>
<summary>Summary</summary>
<p>
Ut lectus arcu bibendum at varius. Convallis a cras semper auctor neque vitae. Odio pellentesque diam volutpat
commodo sed egestas. Amet dictum sit amet justo donec enim diam vulputate ut.
@@ -135,7 +300,7 @@ Collapsible content sections with expand/collapse functionality.
### Dialog
Modal dialog windows for alerts, confirmations, and overlays.
Create modal and non-modal dialog boxes with `<dialog>`. Dialogs closely match the appearance of [`<wa-dialog>`](/docs/components/dialog/).
```html {.example}
<dialog id="dialog-example">
@@ -155,55 +320,9 @@ Modal dialog windows for alerts, confirmations, and overlays.
</script>
```
### Inline Text
### Progress
Various text formatting elements for emphasis and semantic meaning.
```html {.example}
<div class="two-columns">
<p><strong>Bold</strong></p>
<p><em>Italic</em></p>
<p><u>Underline</u></p>
<p><s>Strike-through</s></p>
<p><del>Deleted</del></p>
<p><ins>Inserted</ins></p>
<p><small>Small</small></p>
<p>
<span>Subscript <sub>Sub</sub></span>
</p>
<p>
<span>Superscript <sup>Sup</sup></span>
</p>
<p><abbr title="Abbreviation">Abbr.</abbr></p>
<p><mark>Highlighted</mark></p>
<p><a href="#">Link text</a></p>
<p><code>Inline code</code></p>
<p><kbd>Keyboard</kbd></p>
</div>
```
### Code Blocks
Formatted code snippets with proper syntax styling.
```html {.example}
<pre>
// do a thing
export function thing() {
return true;
}
</pre>
```
### Images
Responsive images with proper scaling and styling.
![A gray kitten lays next to a toy](https://images.unsplash.com/photo-1620196244888-d31ff5bbf163?q=80&w=1000&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D)
### Progress Bars
Visual indicators for task completion and loading states.
Create progress indicators with `<progress>`. Progress indicators closely match the appearance of [`<wa-progress-bar>`](/docs/components/progress-bar/).
```html {.example}
<progress value="40" max="100"></progress>
@@ -211,156 +330,43 @@ Visual indicators for task completion and loading states.
<progress></progress>
```
### Tables
## Forms
Structured data presentation with clean styling and optional zebra striping.
```html {.example}
<table>
<caption>
I'm just a table
</caption>
<thead>
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
<th>Column 4</th>
</tr>
</thead>
<tbody>
<tr>
<td>Cell</td>
<td>Cell</td>
<td>Cell</td>
<td>Cell</td>
</tr>
<tr>
<td>Cell</td>
<td>Cell</td>
<td>Cell</td>
<td>Cell</td>
</tr>
<tr>
<td>Cell</td>
<td>Cell</td>
<td>Cell</td>
<td>Cell</td>
</tr>
<tr>
<td>Cell</td>
<td>Cell</td>
<td>Cell</td>
<td>Cell</td>
</tr>
</tbody>
</table>
```
You can use the `wa-zebra-rows` class to add alternating row colors to your table:
```html {.example}
<table class="wa-zebra-rows">
<caption>
I'm just a table
</caption>
<thead>
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
<th>Column 4</th>
</tr>
</thead>
<tbody>
<tr>
<td>Cell</td>
<td>Cell</td>
<td>Cell</td>
<td>Cell</td>
</tr>
<tr>
<td>Cell</td>
<td>Cell</td>
<td>Cell</td>
<td>Cell</td>
</tr>
<tr>
<td>Cell</td>
<td>Cell</td>
<td>Cell</td>
<td>Cell</td>
</tr>
<tr>
<td>Cell</td>
<td>Cell</td>
<td>Cell</td>
<td>Cell</td>
</tr>
</tbody>
</table>
```
## Form Controls
Native styles use [form control design tokens](/docs/tokens/component-groups/#form-controls) to style form elements like buttons and inputs. Form elements additionally inherit `font-family` from the `<body>` element.
### Buttons
Use the [variant utility classes](../utilities/color.md) to set the button's semantic variant.
Create buttons with `<button>` or `<input type="button | submit | reset">`. Buttons closely match the appearance of [`<wa-button>`](/docs/components/button/).
```html {.example}
<button class="wa-neutral"><wa-icon name="home"></wa-icon> Neutral</button>
<button>Button</button>
<input type="button" value="Input (button)" />
<input type="submit" value="Input (submit)" />
<input type="reset" value="Input (reset)" />
```
Add the `wa-brand`, `wa-neutral`, `wa-success`, `wa-warning`, or `wa-danger` class to specify the button's [color variant](/docs/utilities/color/).
```html {.example}
<button class="wa-neutral">Neutral</button>
<button class="wa-brand">Brand</button>
<button class="wa-success">Success</button>
<button class="wa-warning">Warning</button>
<button class="wa-danger">Danger</button>
```
Use the [appearance utility classes](/docs/utilities/appearance) to change the button's visual appearance:
Add the `wa-accent`, `wa-filled`, `wa-outlined`, or `wa-plain` class to specify the button's visual appearance.
```html {.example}
<div style="margin-block-end: 1rem;">
<button class="wa-accent wa-outlined wa-neutral">A + O</button>
<button class="wa-accent wa-neutral">Accent</button>
<button class="wa-outlined wa-neutral">Outlined</button>
<button class="wa-filled wa-outlined wa-neutral">F + O</button>
<button class="wa-filled wa-neutral">Filled</button>
<button class="wa-plain wa-neutral">Plain</button>
</div>
<div style="margin-block-end: 1rem;">
<button class="wa-accent wa-outlined wa-brand">A + O</button>
<button class="wa-accent wa-brand">Accent</button>
<button class="wa-outlined wa-brand">Outlined</button>
<button class="wa-filled wa-outlined wa-brand">F + O</button>
<button class="wa-filled wa-brand">Filled</button>
<button class="wa-plain wa-brand">Plain</button>
</div>
<div style="margin-block-end: 1rem;">
<button class="wa-accent wa-outlined wa-success">A + O</button>
<button class="wa-accent wa-success">Accent</button>
<button class="wa-outlined wa-success">Outlined</button>
<button class="wa-filled wa-outlined wa-success">F + O</button>
<button class="wa-filled wa-success">Filled</button>
<button class="wa-plain wa-success">Plain</button>
</div>
<div style="margin-block-end: 1rem;">
<button class="wa-accent wa-outlined wa-warning">A + O</button>
<button class="wa-accent wa-warning">Accent</button>
<button class="wa-outlined wa-warning">Outlined</button>
<button class="wa-filled wa-outlined wa-warning">F + O</button>
<button class="wa-filled wa-warning">Filled</button>
<button class="wa-plain wa-warning">Plain</button>
</div>
<div>
<button class="wa-accent wa-outlined wa-danger">A + O</button>
<button class="wa-accent wa-danger">Accent</button>
<button class="wa-outlined wa-danger">Outlined</button>
<button class="wa-filled wa-outlined wa-danger">F + O</button>
<button class="wa-filled wa-danger">Filled</button>
<button class="wa-plain wa-danger">Plain</button>
</div>
<button class="wa-accent wa-neutral">Accent</button>
<button class="wa-filled wa-outlined wa-neutral">Filled + Outlined</button>
<button class="wa-filled wa-neutral">Filled</button>
<button class="wa-outlined wa-neutral">Outlined</button>
<button class="wa-plain wa-neutral">Plain</button>
```
Use the [size utility classes](../utilities/size.md) to change a button's size.
Add the `wa-size-s`, `wa-size-m`, or `wa-size-l` class to specify the size of the button.
```html {.example}
<button class="wa-size-s">Small</button>
@@ -368,131 +374,113 @@ Use the [size utility classes](../utilities/size.md) to change a button's size.
<button class="wa-size-l">Large</button>
```
Use the `wa-pill` class to give buttons rounded edges.
Add the `wa-pill` class to give buttons rounded edges.
```html {.example}
<button class="wa-size-s wa-pill">Small</button>
<button class="wa-size-m wa-pill">Medium</button>
<button class="wa-size-l wa-pill">Large</button>
<button class="wa-pill">Pill button</button>
```
### Checkboxes
### Form controls
Multi-select form controls with checked, indeterminate, and disabled states.
Create a variety of form controls with `<input type="">`, `<select>`, and `<textarea>`. Each control closely matches the appearance of the corresponding Web Awesome component.
```html {.example}
<label><input type="checkbox" checked /> Checked</label><br />
<label><input type="checkbox" class="indeterminate" /> Indeterminate</label><br />
<label><input type="checkbox" disabled /> Disabled</label>
<div class="wa-stack">
<label>Text <input type="text" placeholder="add some text" /></label>
<label>Date <input type="date" /></label>
<label>Time <input type="time" /></label>
<label>Number <input type="number" placeholder="12345" /></label>
<label>Color <input type="color" value="#f36944" /></label>
<label>Range <input type="range" /></label>
<label>Select
<select>
<option value="option-1">Option 1</option>
<option value="option-2">Option 2</option>
<option value="option-3">Option 3</option>
</select>
</label>
<label>Textarea <textarea placeholder="add more text"></textarea></label>
<div class="wa-cluster">
<label><input type="checkbox" checked /> Checked</label>
<label><input type="checkbox" class="indeterminate" /> Indeterminate</label>
<label><input type="checkbox" /> Unchecked</label>
</div>
<div class="wa-cluster">
<label><input type="radio" name="radio-group" value="1" checked /> First radio</label>
<label><input type="radio" name="radio-group" value="2" /> Second radio</label>
<label><input type="radio" name="radio-group" value="3" /> Third radio</label>
</div>
</div>
<script>
document.querySelector('.indeterminate').indeterminate = true;
</script>
```
### Radios
Single-select form controls for mutually exclusive choices.
You can wrap native radios in a flex container to give them a horizontal or vertical orientation with even spacing. The convenience [`wa-cluster`](/docs/utilities/cluster) and [`wa-stack`](/docs/utilities/stack) utilities make this easy.
Add the `wa-filled` class to an input to give it a filled background.
```html {.example}
<div class="wa-cluster">
<label><input type="radio" name="b" value="1" checked /> Option 1</label>
<label><input type="radio" name="b" value="2" /> Option 2</label>
<label><input type="radio" name="b" value="3" /> Option 3</label>
</div>
<div class="wa-stack" style="margin-block-start: var(--wa-space-2xl);">
<label><input type="radio" name="g" value="1" checked /> Option 1</label>
<label><input type="radio" name="g" value="2" /> Option 2</label>
<label><input type="radio" name="g" value="3" /> Option 3</label>
</div>
```
### Selects
Dropdown menus for choosing from a list of options.
```html {.example}
<label
>Select
<select id="select">
<option value="option-1">Option 1</option>
<option value="option-2">Option 2</option>
<option value="option-3">Option 3</option>
<div class="wa-stack">
<input type="text" placeholder="Filled input" class="wa-filled" />
<select class="wa-filled">
<option value="filled">Filled select</option>
</select>
</label>
<textarea placeholder="Filled textarea" class="wa-filled"></textarea>
</div>
```
### Sliders
Range inputs for selecting numeric values within a specified range.
Add the `wa-pill` class to an input or select to give it rounded edges.
```html {.example}
<label>Select a value: <input type="range" /></label>
```
### Text Fields
Various input types for collecting user text and data.
```html {.example}
<label>Text <input type="text" placeholder="placeholder" /></label>
<label>Number <input type="number" /></label>
<label>Password <input type="password" required /></label>
<label>Email <input type="email" /></label>
<label>Search <input type="search" /></label>
<label>Telephone <input type="tel" /></label>
<label>URL <input type="url" /></label>
```
Add the `wa-pill` class to an `<input>` to make it pill-shaped.
```html {.example}
<label>Input <input type="text" placeholder="placeholder" class="wa-pill" /></label>
```
### Color Pickers
Visual color selection interface with hex value input.
```html {.example}
<label>Input (color) <input type="color" value="#ff0066" /></label>
```
### Date & Time Pickers
Specialized inputs for selecting dates, times, and datetime values.
```html {.example}
<label>Input (datetime-local) <input type="datetime-local" /></label>
<label>Input (date) <input type="date" /></label>
<label>Input (time) <input type="time" /></label>
```
### Textareas
Multi-line text input fields for longer content.
```html {.example}
<label>Textarea <textarea placeholder="Type something"></textarea></label>
<div class="wa-stack">
<input type="text" placeholder="Pill input" class="wa-pill" />
<select class="wa-pill">
<option value="pill">Pill select</option>
</select>
</div>
```
### Fieldsets
Group form controls together with `<fieldset>` and `<legend>`.
```html {.example}
<fieldset>
<fieldset class="wa-stack wa-align-items-start">
<legend>Legend</legend>
Nunc mi ipsum faucibus vitae aliquet nec ullamcorper. Tincidunt id aliquet risus feugiat in ante. Ac turpis egestas
integer eget aliquet nibh praesent tristique magna.
<label><input type="radio" name="legends" value="1" checked /> King Arthur</label>
<label><input type="radio" name="legends" value="2" /> Robin Hood</label>
<label><input type="radio" name="legends" value="3" /> Odysseus</label>
</fieldset>
```
### Form layouts
Wrap form controls in a flex container to arrange them horizontally or vertically with even spacing. Layout utility classes like [`wa-cluster`](/docs/utilities/cluster) and [`wa-stack`](/docs/utilities/stack) can be added directly to a `<fieldset>` or `<form>` to make this especially easy.
```html {.example}
<fieldset class="wa-cluster">
<legend>Ducks in a row</legend>
<label><input type="checkbox" checked /> Mallard</label>
<label><input type="checkbox" /> Common Loon</label>
<label><input type="checkbox" /> Least Grebe</label>
</fieldset>
<br />
<form class="wa-stack">
<label>Number of pancakes <input type="number" value="5" /></label>
<label>Syrup flavor
<select>
<option value="maple">Maple</option>
<option value="strawberry">Strawberry</option>
<option value="blueberry">Blueberry</option>
<option value="pecan">Butter pecan</option>
</select>
</label>
<label><input type="checkbox" checked /> Add whipped butter</label>
<button>
<wa-icon name="pancakes"></wa-icon>
Stack 'em up
</button>
</form>
```

View File

@@ -100,7 +100,7 @@ layout: false
<div class="wa-flank">
<wa-avatar
shape="rounded"
style="--background-color: var(--wa-color-green-60); --text-color: var(--wa-color-green-95)"
style="background-color: var(--wa-color-green-60); color: var(--wa-color-green-95)"
>
<wa-icon slot="icon" name="sword-laser"></wa-icon>
</wa-avatar>
@@ -119,7 +119,7 @@ layout: false
<div class="wa-flank">
<wa-avatar
shape="rounded"
style="--background-color: var(--wa-color-cyan-60); --text-color: var(--wa-color-cyan-95)"
style="background-color: var(--wa-color-cyan-60); color: var(--wa-color-cyan-95)"
>
<wa-icon slot="icon" name="robot-astromech"></wa-icon>
</wa-avatar>
@@ -403,7 +403,7 @@ layout: false
<a href="" class="wa-flank wa-link-plain" tabindex="-1">
<wa-avatar
shape="rounded"
style="--background-color: var(--wa-color-yellow-90); --text-color: var(--wa-color-yellow-50)"
style="background-color: var(--wa-color-yellow-90); color: var(--wa-color-yellow-50)"
>
<wa-icon slot="icon" name="egg-fried"></wa-icon>
</wa-avatar>
@@ -435,7 +435,7 @@ layout: false
<a href="" class="wa-flank wa-align-items-start wa-link-plain" tabindex="-1">
<wa-avatar
shape="rounded"
style="--background-color: var(--wa-color-blue-90); color: var(--wa-color-blue-50)"
style="background-color: var(--wa-color-blue-90); color: var(--wa-color-blue-50)"
>
<wa-icon slot="icon" name="shield"></wa-icon>
</wa-avatar>
@@ -449,7 +449,7 @@ layout: false
<a href="" class="wa-flank wa-align-items-start wa-link-plain" tabindex="-1">
<wa-avatar
shape="rounded"
style="--background-color: var(--wa-color-green-90); color: var(--wa-color-green-50)"
style="background-color: var(--wa-color-green-90); color: var(--wa-color-green-50)"
>
<wa-icon slot="icon" name="chevrons-up"></wa-icon>
</wa-avatar>
@@ -463,7 +463,7 @@ layout: false
<a href="" class="wa-flank wa-align-items-start wa-link-plain" tabindex="-1">
<wa-avatar
shape="rounded"
style="--background-color: var(--wa-color-red-90); color: var(--wa-color-red-50)"
style="background-color: var(--wa-color-red-90); color: var(--wa-color-red-50)"
>
<wa-icon slot="icon" name="explosion"></wa-icon>
</wa-avatar>
@@ -477,7 +477,7 @@ layout: false
<a href="" class="wa-flank wa-align-items-start wa-link-plain" tabindex="-1">
<wa-avatar
shape="rounded"
style="--background-color: var(--wa-color-yellow-90); color: var(--wa-color-yellow-50)"
style="background-color: var(--wa-color-yellow-90); color: var(--wa-color-yellow-50)"
>
<wa-icon slot="icon" name="moon-stars"></wa-icon>
</wa-avatar>
@@ -616,8 +616,8 @@ layout: false
}
}
wa-progress-bar::part(base) {
height: 0.5em;
wa-progress-bar {
--track-height: 0.5em;
}
</style>
</body>

View File

@@ -136,35 +136,21 @@ layout: page
margin-block-start: 1rem;
}
}
.link-panel {
background-color: var(--wa-color-neutral-fill-quiet);
border-radius: 0.75rem;
padding: 1.25rem;
& h3 {
font-size: 1rem;
}
& .icon-heading wa-icon {
background-color: var(--wa-color-neutral-fill-loud);
color: var(--wa-color-neutral-on-loud);
}
& p {
font-size: 0.875rem;
}
}
.icon-heading {
display: flex;
align-items: center;
gap: 1rem;
margin-block-end: 1rem;
& wa-icon {
> wa-icon {
display: flex;
align-items: center;
justify-content: center;
background-color: var(--wa-brand-orange);
color: white;
background-color: var(--wa-color-neutral-fill-loud);
color: var(--wa-color-neutral-on-loud);
border-radius: 0.25rem;
aspect-ratio: 1;
padding: 0.5em;
&.brand-orange {
background-color: var(--wa-brand-orange);
color: white;
}
}
& h3 {
font-size: 1rem;
@@ -224,8 +210,8 @@ layout: page
text-align: left;
white-space: wrap;
}
wa-button.tile::part(end) {
display: none;
wa-button.tile::part(label) {
width: 100%;
}
wa-button.tile {
width: 100%;
@@ -266,11 +252,17 @@ layout: page
</div>
<h1 class="brand-font">Make something <span class="emphasis">awesome</span> with open-source web components</h1>
<div class="hero-cta">
<span><em>Psst!</em> You can pre-order Web Awesome Pro at a low, guaranteed-for-life price &mdash; but not for long. Get in while the gettins good.</span>
<wa-button class="wa-dark" size="small" href="https://www.kickstarter.com/projects/fontawesome/web-awesome">
<wa-icon slot="start" name="person-running"></wa-icon>
Pre-order WA Pro
</wa-button>
{%- raw -%}
{% if currentUser.hasPro %}
<span style="text-align: center; width: 100%; font-size: var(--wa-font-size-l);">Thanks for being a Web Awesome Pro subscriber!</span>
{% else %}
<span><em>Psst!</em> You can pre-order Web Awesome Pro at a low, guaranteed-for-life price &mdash; but not for long. Get in while the gettins good.</span>
<wa-button class="wa-dark" size="small" href="https://www.kickstarter.com/projects/fontawesome/web-awesome">
<wa-icon slot="start" name="person-running"></wa-icon>
Pre-order WA Pro
</wa-button>
{% endif %}
{% endraw %}
</div>
</div>
</div>
@@ -279,23 +271,27 @@ layout: page
<div class="beta-notice">
<div>
<wa-callout variant="brand">
<div class="icon-heading">
<wa-icon name="sparkles" variant="regular" fixed-width></wa-icon>
<h3>Rise and shine, backers!</h3>
<div class="wa-stack">
<div class="wa-cluster icon-heading">
<wa-icon name="sparkles" variant="regular" fixed-width></wa-icon>
<h3>Bigger and beta than ever</h3>
</div>
<p>This beta is battle-tested and built to last, but if you see something, say something. Please <a href="https://github.com/shoelace-style/webawesome/issues">report bugs</a> or <a href="https://github.com/shoelace-style/webawesome/discussions">ask for help</a>!</p>
</div>
<p>Dig in to your exclusive Web Awesome Beta access. This beta is battle-tested and built to last, but if you see something, say something. Please <a href="https://github.com/shoelace-style/webawesome/issues">report bugs</a> or <a href="https://github.com/shoelace-style/webawesome/discussions">ask for help</a>!</p>
</wa-callout>
</div>
<div>
<wa-button href="/docs/" appearance="outlined" class="tile">
<div style="display: flex; justify-content: space-between; align-items: center; margin-block-end: 1rem;">
<div class="icon-heading" style="margin-block-end: 0;">
<wa-icon name="pen-ruler" fixed-width></wa-icon>
<h3>Get started</h3>
<div class="wa-stack">
<div class="wa-split">
<div class="wa-cluster icon-heading">
<wa-icon name="pen-ruler" fixed-width class="brand-orange"></wa-icon>
<h3>Get started</h3>
</div>
<wa-icon name="arrow-right" fixed-width></wa-icon>
</div>
<wa-icon name="arrow-right" fixed-width></wa-icon>
<p>Check out our installation guide to start building with Web Awesome.</p>
</div>
<p>Check out our installation guide to start building with Web Awesome.</p>
</wa-button>
</div>
</div>
@@ -304,30 +300,30 @@ layout: page
<h2 class="brand-font">What's <span class="emphasis">Web</span> Awesome?</h2>
<p>Web Awesome is the biggest open-source library of meticulously designed, highly customizable, and framework-agnostic UI components.</p>
<div class="grid">
<div>
<div class="icon-heading">
<wa-icon name="code" fixed-width></wa-icon>
<div class="wa-stack">
<div class="wa-cluster icon-heading">
<wa-icon name="code" fixed-width class="brand-orange"></wa-icon>
<h3>Entirely native</h3>
</div>
<p>Built on web standards to last for years to come. No excess tooling. No third-party bloat.</p>
</div>
<div>
<div class="icon-heading">
<wa-icon name="palette" fixed-width></wa-icon>
<div class="wa-stack">
<div class="wa-cluster icon-heading">
<wa-icon name="palette" fixed-width class="brand-orange"></wa-icon>
<h3>Fully customizable</h3>
</div>
<p>Show off your own style with components that consistently adapt to your theme.</p>
</div>
<div>
<div class="icon-heading">
<wa-icon name="wheelchair-move" fixed-width></wa-icon>
<div class="wa-stack">
<div class="wa-cluster icon-heading">
<wa-icon name="wheelchair-move" fixed-width class="brand-orange"></wa-icon>
<h3>Accessibility forward</h3>
</div>
<p>Build a website that everyone can use. Designed to be inclusive and usable by everyone.</p>
</div>
<div>
<div class="icon-heading">
<wa-icon name="handshake-simple" fixed-width></wa-icon>
<div class="wa-stack">
<div class="wa-cluster icon-heading">
<wa-icon name="handshake-simple" fixed-width class="brand-orange"></wa-icon>
<h3>Proudly open source</h3>
</div>
<p>Use Web Awesome Free however you like. Always free, always open source.</p>
@@ -342,20 +338,80 @@ layout: page
<p>Whether youre a developer, designer, or budding tech nerd, we want you a part of the conversation.</p>
</div>
<div>
<div class="link-panel">
<div class="icon-heading">
<wa-icon name="envelope-open" fixed-width></wa-icon>
<h3>Get in touch</h3>
<wa-button href="https://github.com/shoelace-style/webawesome" rel="noopener noreferrer" target="_blank" appearance="filled" class="tile">
<div class="wa-stack">
<div class="wa-split">
<div class="wa-cluster icon-heading">
<wa-icon family="brands" name="github" fixed-width></wa-icon>
<h3>GitHub</h3>
</div>
<wa-icon name="arrow-up-right" fixed-width></wa-icon>
</div>
<p>Get involved by opening issues, contributing to discussions, or creating PRs.</p>
</div>
<p>Have a question? Want to share your feedback? Just stopping by to say 'hi'? Email us at <a href="mailto:hello@webawesome.com">hello@webawesome.com</a>.</p>
</div>
<div class="link-panel">
<div class="icon-heading">
<wa-icon name="hashtag" fixed-width></wa-icon>
<h3>Follow us</h3>
</wa-button>
<wa-button href="https://discord.gg/a74U7eYH" rel="noopener noreferrer" target="_blank" appearance="filled" class="tile">
<div class="wa-stack">
<div class="wa-split">
<div class="wa-cluster icon-heading">
<wa-icon family="brands" name="discord" fixed-width></wa-icon>
<h3>Discord</h3>
</div>
<wa-icon name="arrow-up-right" fixed-width></wa-icon>
</div>
<p>Share your work, ask questions, and explore ideas with other Web Awesome builders.</p>
</div>
<p>Keep up with Web Awesome through updates, announcements, and polls. Find us on <a href="https://bsky.app/profile/webawesome.com">Bluesky</a>, <a href="https://x.com/webawesomer">Twitter (X)</a>, and <a href="https://www.threads.com/@web.awesome">Threads</a>.</p>
</div>
</wa-button>
<wa-button href="mailto:hello@webawesome.com" appearance="filled" class="tile">
<div class="wa-split">
<div class="wa-cluster icon-heading">
<wa-icon name="envelope-open" fixed-width></wa-icon>
<h3 class="wa-cluster wa-gap-xs">
<span>hello@webawesome.com</span>
<wa-icon name="hand-wave" variant="regular"></wa-icon>
</h3>
</div>
<wa-icon name="arrow-up-right" fixed-width></wa-icon>
</div>
</wa-button>
</div>
</div>
<wa-divider></wa-divider>
<div class="wa-stack wa-gap-xl">
<h2 class="wa-cluster brand-font">
<wa-icon name="hashtag" style="color: var(--wa-brand-orange);"></wa-icon>
<span>Stay in the know</span>
</h2>
<div class="wa-grid">
<wa-button href="https://bsky.app/profile/webawesome.com" rel="noopener noreferrer" target="_blank" appearance="filled" class="tile">
<div class="wa-split">
<div class="wa-cluster icon-heading">
<wa-icon family="brands" name="bluesky" fixed-width></wa-icon>
<h3>Bluesky</h3>
</div>
<wa-icon name="arrow-up-right" fixed-width></wa-icon>
</div>
</wa-button>
<wa-button href="https://x.com/webawesomer" rel="noopener noreferrer" target="_blank" appearance="filled" class="tile">
<div class="wa-split">
<div class="wa-cluster icon-heading">
<wa-icon family="brands" name="x-twitter" fixed-width></wa-icon>
<h3>Twitter (X)</h3>
</div>
<wa-icon name="arrow-up-right" fixed-width></wa-icon>
</div>
</wa-button>
<wa-button href="https://www.threads.com/@web.awesome" rel="noopener noreferrer" target="_blank" appearance="filled" class="tile">
<div class="wa-split">
<div class="wa-cluster icon-heading">
<wa-icon family="brands" name="threads" fixed-width></wa-icon>
<h3>Threads</h3>
</div>
<wa-icon name="arrow-up-right" fixed-width></wa-icon>
</div>
</wa-button>
</div>
</div>
@@ -373,9 +429,9 @@ layout: page
<div class="attribution">
<span>Special thanks</span>
<div class="button-list">
<wa-button appearance="filled" pill href="https://www.11ty.dev/">11ty</wa-button>
<wa-button appearance="filled" pill href="https://lit.dev/">Lit</wa-button>
<wa-button appearance="filled" pill href="https://github.com/open-wc/custom-elements-manifest">Custom Elements Manifest</wa-button>
<wa-button appearance="filled" pill href="https://www.11ty.dev/">11ty</wa-button>
<wa-button appearance="filled" pill href="https://floating-ui.com/">Floating UI</wa-button>
<wa-button appearance="filled" pill href="https://animate.style/">animate.css</wa-button>
<wa-button appearance="filled" pill href="https://lunrjs.com/">Lunr</wa-button>

View File

@@ -1,7 +1,10 @@
{
"name": "@shoelace-style/webawesome",
"name": "@awesome.me/webawesome",
"publishConfig": {
"access": "public"
},
"description": "A forward-thinking library of web components.",
"version": "3.0.0-beta.1",
"version": "3.0.0-beta.2",
"homepage": "https://webawesome.com/",
"author": "Web Awesome",
"license": "MIT",
@@ -18,8 +21,8 @@
"./dist/custom-elements.json": "./dist/custom-elements.json",
"./dist/webawesome.js": "./dist/webawesome.js",
"./dist/webawesome.loader.js": "./dist/webawesome.loader.js",
"./dist/themes": "./dist/themes",
"./dist/themes/*": "./dist/themes/*",
"./dist/styles": "./dist/styles",
"./dist/styles/*": "./dist/styles/*",
"./dist/components": "./dist/components",
"./dist/components/*": "./dist/components/*",
"./dist/react": "./dist/react/index.js",
@@ -28,8 +31,9 @@
"./dist/translations/*": "./dist/translations/*"
},
"files": [
"README.md",
"dist",
"cdn"
"dist-cdn"
],
"keywords": [
"web components",
@@ -73,10 +77,10 @@
"@shoelace-style/localize": "^3.2.1",
"composed-offset-position": "^0.0.6",
"lit": "^3.2.1",
"nanoid": "^5.1.5",
"qr-creator": "^1.0.0",
"style-observer": "^0.0.7"
},
"devDependencies": {},
"lint-staged": {
"*.{ts,js}": [
"prettier --write"

View File

@@ -4,19 +4,20 @@ import { execSync } from 'child_process';
import { deleteAsync } from 'del';
import esbuild from 'esbuild';
import { replace } from 'esbuild-plugin-replace';
import { mkdir, readFile } from 'fs/promises';
import getPort, { portNumbers } from 'get-port';
import { globby } from 'globby';
import { dirname, join, relative } from 'node:path';
import { dirname, extname, join, posix, relative } from 'node:path';
import process from 'node:process';
import { fileURLToPath } from 'node:url';
import ora from 'ora';
import copy from 'recursive-copy';
import { getCdnDir, getDistDir, getDocsDir, getRootDir, getSiteDir, runScript } from './utils.js';
import { SimulateWebAwesomeApp } from '../docs/_utils/simulate-webawesome-app.js';
import { generateDocs } from './docs.js';
import { getCdnDir, getDistDir, getDocsDir, getRootDir, getSiteDir } from './utils.js';
const __dirname = dirname(fileURLToPath(import.meta.url));
const isDeveloping = process.argv.includes('--develop');
const spinner = ora({ text: 'Web Awesome', color: 'cyan' }).start();
const getPackageData = async () => JSON.parse(await readFile(join(getRootDir(), 'package.json'), 'utf-8'));
const getVersion = async () => JSON.stringify((await getPackageData()).version.toString());
@@ -25,6 +26,10 @@ let buildContexts = {
unbundledContext: {},
};
const debugPerf = process.env.DEBUG_PERFORMANCE === '1';
const isDeveloping = process.argv.includes('--develop');
/**
* @typedef {Object} BuildOptions
* @property {Array<string>} [watchedSrcDirectories]
@@ -44,6 +49,8 @@ export async function build(options = {}) {
options.watchedDocsDirectories = [getDocsDir()];
}
function measureStep() {}
/**
* Runs the full build.
*/
@@ -51,17 +58,24 @@ export async function build(options = {}) {
const start = Date.now();
try {
await cleanup();
await generateManifest();
await generateReactWrappers();
await generateTypes();
await generateStyles();
const steps = [cleanup, generateManifest, generateReactWrappers, generateTypes, generateStyles];
for (const step of steps) {
if (debugPerf) {
const stepStart = Date.now();
await step();
const elapsedTime = (Date.now() - stepStart) / 1000 + 's';
spinner.succeed(`${step.name}: ${elapsedTime}`);
} else {
await step();
}
}
// copy everything to unbundled before we generate bundles.
await copy(getCdnDir(), getDistDir(), { overwrite: true });
await generateBundle();
await generateDocs();
await generateDocs({ spinner });
const time = (Date.now() - start) / 1000 + 's';
spinner.succeed(`The build is complete ${chalk.gray(`(finished in ${time})`)}`);
@@ -186,11 +200,11 @@ export async function build(options = {}) {
join(rootDir, 'src/webawesome.loader.ts'),
join(rootDir, 'src/webawesome.ssr-loader.ts'),
// Individual components
...(await globby(join(rootDir, 'src/components/**/!(*.(style|test)).ts'))),
...(await globby(posix.join(rootDir, 'src/components/**/!(*.(style|test)).ts'))),
// Translations
...(await globby(join(rootDir, 'src/translations/**/*.ts'))),
...(await globby(posix.join(rootDir, 'src/translations/**/*.ts'))),
// React wrappers
...(await globby(join(rootDir, 'src/react/**/*.ts'))),
...(await globby(posix.join(rootDir, 'src/react/**/*.ts'))),
],
outdir: getCdnDir(),
chunkNames: 'chunks/[name].[hash]',
@@ -258,49 +272,6 @@ export async function build(options = {}) {
spinner.succeed();
}
/**
* Generates the documentation site.
*/
async function generateDocs() {
/**
* Used by the webawesome-app to skip doc generation since it will do its own.
*/
if (process.env.SKIP_ELEVENTY === 'true') {
return;
}
spinner.start('Writing the docs');
const args = [];
if (isDeveloping) args.push('--develop');
let output;
try {
// 11ty
output = (await runScript(join(__dirname, 'docs.js'), args, { env: process.env }))
// Cleanup the output
.replace('[11ty]', '')
.replace(' seconds', 's')
.replace(/\(.*?\)/, '')
.toLowerCase()
.trim();
// Copy dist (production only)
if (!isDeveloping) {
await copy(getCdnDir(), join(getSiteDir(), 'dist'));
}
spinner.succeed(`Writing the docs ${chalk.gray(`(${output}`)})`);
} catch (error) {
console.error('\n\n' + chalk.red(error) + '\n');
spinner.fail(chalk.red(`Error while writing the docs.`));
if (!isDeveloping) {
process.exit(1);
}
}
}
// Initial build
await buildAll();
@@ -338,6 +309,46 @@ export async function build(options = {}) {
'/dist/': './dist-cdn/',
},
},
middleware: [
function simulateWebawesomeApp(req, res, next) {
// Accumulator for strings so we can pass them through nunjucks a second time similar to how the webawesome-app
// will be running nunjucks twice.
const finalString = [];
const encoding = 'utf-8';
if (!next) {
return;
}
if (!req.url) {
next();
return;
}
const extension = extname(req.url);
if (extension !== '' && extension !== '.html') {
// Assume its something like .svg / .png / .css etc. that we don't want to transform.
next();
return;
}
const _write = res.write;
res.write = function (chunk, encoding) {
// Buffer chunks into an array so that we do a single transform.
finalString.push(chunk.toString());
};
const _end = res.end;
res.end = function (...args) {
const transformedStr = SimulateWebAwesomeApp(finalString.join(''));
_write.call(res, transformedStr, encoding);
_end.call(res, ...args);
};
next();
},
],
callbacks: {
ready: (_err, instance) => {
// 404 errors
@@ -397,7 +408,6 @@ export async function build(options = {}) {
if (typeof options.onWatchEvent === 'function') {
await options.onWatchEvent(evt, filename);
}
await regenerateBundle();
// Copy stylesheets when CSS files change
if (isCssStylesheet) {
@@ -409,8 +419,12 @@ export async function build(options = {}) {
await generateManifest();
}
// copy everything to unbundled before we generate bundles.
await copy(getCdnDir(), getDistDir(), { overwrite: true });
await regenerateBundle();
// This needs to be outside of "isComponent" check because SSR needs to run on CSS files too.
await generateDocs();
await generateDocs({ spinner });
reload();
} catch (err) {
@@ -438,7 +452,7 @@ export async function build(options = {}) {
if (typeof options.onWatchEvent === 'function') {
await options.onWatchEvent(evt, filename);
}
await generateDocs();
await generateDocs({ spinner });
reload();
};
}

View File

@@ -1,14 +1,257 @@
import Eleventy from '@11ty/eleventy';
import copy from 'recursive-copy';
import chalk from 'chalk';
import { deleteAsync } from 'del';
import { getDocsDir, getEleventyConfigPath, getSiteDir } from './utils.js';
import { join } from 'path';
import { getCdnDir, getDocsDir, getEleventyConfigPath, getSiteDir } from './utils.js';
const elev = new Eleventy(getDocsDir(), getSiteDir(), {
quietMode: true,
configPath: getEleventyConfigPath(),
});
let eleventyBuildResolver;
let eleventyBuildPromise;
// Cleanup
await deleteAsync(getSiteDir());
function queueBuild() {
eleventyBuildPromise = new Promise(resolve => {
eleventyBuildResolver = resolve;
});
}
// Write it
await elev.write();
// 11ty
export async function createEleventy(options = {}) {
let { isIncremental, isDeveloping, rootDir } = options;
isDeveloping ??= process.argv.includes('--develop');
isIncremental ??= isDeveloping && !process.argv.includes('--no-incremental');
const eleventy = new Eleventy(rootDir || getDocsDir(), getSiteDir(), {
quietMode: true,
configPath: getEleventyConfigPath(),
config: eleventyConfig => {
if (isDeveloping || isIncremental) {
eleventyConfig.setUseTemplateCache(false);
eleventyConfig.on('eleventy.before', function () {
queueBuild();
});
eleventyConfig.on('eleventy.beforeWatch', async function () {
queueBuild();
});
eleventyConfig.on('eleventy.after', async function () {
eleventyBuildResolver();
});
}
},
source: 'script',
runMode: isIncremental ? 'watch' : 'build',
});
eleventy.setIncrementalBuild(isIncremental);
await eleventy.init();
eleventy.logger.isChalkEnabled = false;
eleventy.logger.overrideLogger(new CustomLogger());
if (isIncremental) {
await eleventy.watch();
process.on('SIGINT', async () => {
await eleventy.stopWatch();
process.exitCode = 0;
});
}
return eleventy;
}
/**
* Generates the documentation site.
*/
export async function generateDocs(options = {}) {
let { spinner, isIncremental, isDeveloping } = options;
isDeveloping ??= process.argv.includes('--develop');
isIncremental ??= isDeveloping && !process.argv.includes('--no-incremental');
let eleventy = globalThis.eleventy;
/**
* Used by the webawesome-app to skip doc generation since it will do its own.
*/
if (process.env.SKIP_ELEVENTY === 'true') {
return;
}
spinner?.start?.('Writing the docs');
const outputs = {
warn: [],
};
function stubConsole(key) {
const originalFn = console[key];
console[key] = function (...args) {
outputs[key].push(...args);
};
return originalFn;
}
// Works around a bug in 11ty where it still prints warnings despite the logger being overriden and in quietMode.
const originalWarn = stubConsole('warn');
let output = '';
try {
if (isIncremental) {
if (!globalThis.eleventy) {
// First run
globalThis.eleventy = await createEleventy(options);
eleventy = globalThis.eleventy;
output = chalk.gray(`(${eleventy.logFinished()})`);
} else {
// eleventy incremental does its own writing, so we just kinda trust it for right now.
eleventy = globalThis.eleventy;
await eleventyBuildPromise;
let info = eleventy.logger.logger.outputs.log;
// TODO: The first write with incremental seems to be 1 behind. Not sure why. But its good enough for now.
info = info.filter(line => {
return !line.includes('Watching');
});
const lastLine = info[info.length - 1];
output = chalk.gray(`(${lastLine})`);
eleventy.logger.logger.reset();
}
} else {
// Cleanup
await deleteAsync(getSiteDir());
globalThis.eleventy = await createEleventy(options);
eleventy = globalThis.eleventy;
// Write it
await eleventy.write();
output = chalk.gray(`(${eleventy.logFinished()})`);
}
// Copy dist (production only)
if (!isDeveloping) {
await copy(getCdnDir(), join(getSiteDir(), 'dist'));
}
spinner?.succeed?.(`Writing the docs ${output}`);
} catch (error) {
console.warn = originalWarn;
console.error('\n\n' + chalk.red(error) + '\n');
spinner?.fail?.(chalk.red(`Error while writing the docs.`));
if (!isDeveloping) {
process.exit(1);
}
}
}
/**
* Much of this code is taken from 11ty's ConsoleLogger here:
* https://github.com/11ty/eleventy/blob/main/src/Util/ConsoleLogger.js
*
* Patches 11ty logger so it doesnt log everything, but we can still use its output for our own build.
* @typedef {'error'|'log'|'warn'|'info'} LogType
*/
class CustomLogger {
#outputStream;
constructor() {
this.reset();
}
flush() {
Object.keys(this.outputs).forEach(outputType => {
console[outputType](this.outputs[outputType].join(''));
});
this.reset();
}
reset() {
this.outputs = {
log: [],
info: [],
warn: [],
error: [],
};
}
/** @param {string} msg */
log(msg) {
this.message(msg);
}
/**
* @typedef LogOptions
* @property {string} message
* @property {string=} prefix
* @property {LogType=} type
* @property {string=} color
* @property {boolean=} force
* @param {LogOptions} options
*/
logWithOptions({ message, type, prefix, color, force }) {
this.message(message, type, color, force, prefix);
}
/** @param {string} msg */
forceLog(msg) {
this.message(msg, undefined, undefined, true);
}
/** @param {string} msg */
info(msg) {
this.message(msg, 'info', 'blue');
}
/** @param {string} msg */
warn(msg) {
this.message(msg, 'warn', 'yellow');
}
/** @param {string} msg */
error(msg) {
this.message(msg, 'error', 'red');
}
get outputStream() {
if (!this.#outputStream) {
this.#outputStream = new Readable({
read() {},
});
}
return this.#outputStream;
}
/** @param {string} msg */
toStream(msg) {
this.outputStream.push(msg);
}
closeStream() {
this.outputStream.push(null);
return this.outputStream;
}
/**
* Formats the message to log.
*
* @param {string} message - The raw message to log.
* @param {LogType} [type='log'] - The error level to log.
* @param {string|undefined} [chalkColor=undefined] - Color name or falsy to disable
* @param {boolean} [forceToConsole=false] - Enforce a log on console instead of specified target.
*/
message(message, type = 'log', chalkColor = undefined, _forceToConsole = false, prefix = '') {
// if (chalkColor && this.isChalkEnabled) {
// message = `${chalk.gray(prefix)} ${message.split("\n").join(`\n${chalk.gray(prefix)} `)}`;
// this.outputs[type].push(chalk[chalkColor](message));
// } else {
message = `${prefix}${message.split('\n').join(`\n${prefix}`)}`;
this.outputs[type].push(message);
// }
}
}

View File

@@ -25,7 +25,7 @@ for await (const component of components) {
const tagWithoutPrefix = component.tagName.replace(/^wa-/, '');
const componentDir = path.join(reactDir, tagWithoutPrefix);
const componentFile = path.join(componentDir, 'index.ts');
const importPath = path.relative(srcDir, component.path);
const importPath = path.posix.relative(srcDir, component.path);
// We only want to wrap wa- prefixed events, because the others are native
const eventsToWrap = component.events?.filter(event => event.name.startsWith('wa-')) || [];

View File

@@ -6,7 +6,7 @@ import styles from './{{ tagWithoutPrefix tag }}.css';
/**
* @summary Short summary of the component's intended use.
* @documentation https://backers.webawesome.com/docs/components/{{ tagWithoutPrefix tag }}
* @documentation https://webawesome.com/docs/components/{{ tagWithoutPrefix tag }}
* @status experimental
* @since 3.0
*

View File

@@ -9,7 +9,7 @@ import styles from './animated-image.css';
/**
* @summary A component for displaying animated GIFs and WEBPs that play and pause on interaction.
* @documentation https://backers.webawesome.com/docs/components/animated-image
* @documentation https://webawesome.com/docs/components/animated-image
* @status stable
* @since 2.0
*

View File

@@ -10,7 +10,7 @@ import { animations } from './animations.js';
/**
* @summary Animate elements declaratively with nearly 100 baked-in presets, or roll your own with custom keyframes. Powered by the [Web Animations API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API).
* @documentation https://backers.webawesome.com/docs/components/animation
* @documentation https://webawesome.com/docs/components/animation
* @status stable
* @since 2.0
*

View File

@@ -8,7 +8,7 @@ import styles from './avatar.css';
/**
* @summary Avatars are used to represent a person or object.
* @documentation https://backers.webawesome.com/docs/components/avatar
* @documentation https://webawesome.com/docs/components/avatar
* @status stable
* @since 2.0
*

View File

@@ -1,4 +1,6 @@
:host {
--pulse-color: var(--wa-color-fill-loud, var(--wa-color-brand-fill-loud));
display: inline-flex;
align-items: center;
justify-content: center;
@@ -19,29 +21,31 @@
}
/* Appearance modifiers */
:host([appearance~='plain']) {
color: var(--wa-color-on-quiet, var(--wa-color-brand-on-quiet));
background-color: transparent;
border-color: transparent;
}
:host([appearance~='outlined']) {
--pulse-color: var(--wa-color-border-loud, var(--wa-color-brand-border-loud));
color: var(--wa-color-on-quiet, var(--wa-color-brand-on-quiet));
background-color: transparent;
border-color: var(--wa-color-border-loud, var(--wa-color-brand-border-loud));
}
:host([appearance~='filled']) {
--pulse-color: var(--wa-color-fill-normal, var(--wa-color-brand-fill-normal));
color: var(--wa-color-on-normal, var(--wa-color-brand-on-normal));
background-color: var(--wa-color-fill-normal, var(--wa-color-brand-fill-normal));
border-color: transparent;
}
&:host([appearance~='outlined']) {
border-color: var(--wa-color-border-normal, var(--wa-color-brand-border-normal));
}
:host([appearance~='filled'][appearance~='outlined']) {
--pulse-color: var(--wa-color-border-normal, var(--wa-color-brand-border-normal));
border-color: var(--wa-color-border-normal, var(--wa-color-brand-border-normal));
}
:host([appearance~='accent']) {
--pulse-color: var(--wa-color-fill-loud, var(--wa-color-brand-fill-loud));
color: var(--wa-color-on-loud, var(--wa-color-brand-on-loud));
background-color: var(--wa-color-fill-loud, var(--wa-color-brand-fill-loud));
border-color: transparent;
@@ -54,8 +58,6 @@
/* Pulse attention */
:host([attention='pulse']) {
--pulse-color: var(--background-color);
animation: pulse 1.5s infinite;
}

View File

@@ -6,7 +6,7 @@ import styles from './badge.css';
/**
* @summary Badges are used to draw attention and display statuses or counts.
* @documentation https://backers.webawesome.com/docs/components/badge
* @documentation https://webawesome.com/docs/components/badge
* @status stable
* @since 2.0
*
@@ -14,6 +14,8 @@ import styles from './badge.css';
*
* @csspart base - The component's base wrapper.
*
* @cssproperty --pulse-color - The color of the badge's pulse effect when using `attention="pulse"`.
*
*/
@customElement('wa-badge')
export default class WaBadge extends WebAwesomeElement {
@@ -28,8 +30,8 @@ export default class WaBadge extends WebAwesomeElement {
/** Draws a pill-style badge with rounded edges. */
@property({ type: Boolean, reflect: true }) pill = false;
/** Makes the badge pulsate to draw attention. */
@property({ reflect: true }) attention: 'none' | 'pulse' = 'none';
/** Adds an animation to draw attention to the badge. */
@property({ reflect: true }) attention: 'none' | 'pulse' | 'bounce' = 'none';
render() {
return html` <slot part="base" role="status"></slot>`;

View File

@@ -7,7 +7,7 @@ import styles from './breadcrumb-item.css';
/**
* @summary Breadcrumb Items are used inside breadcrumbs to represent different links.
* @documentation https://backers.webawesome.com/docs/components/breadcrumb-item
* @documentation https://webawesome.com/docs/components/breadcrumb-item
* @status stable
* @since 2.0
*

View File

@@ -8,7 +8,7 @@ import styles from './breadcrumb.css';
/**
* @summary Breadcrumbs provide a group of links so users can easily navigate a website's hierarchy.
* @documentation https://backers.webawesome.com/docs/components/breadcrumb
* @documentation https://webawesome.com/docs/components/breadcrumb
* @status stable
* @since 2.0
*

View File

@@ -26,8 +26,7 @@
z-index: 2 !important;
}
}
:host([orientation='vertical']) {
:host([orientation='vertical']) .button-group {
flex-direction: column;
}

View File

@@ -10,7 +10,7 @@ import styles from './button-group.css';
/**
* @summary Button groups can be used to group related buttons into sections.
* @documentation https://backers.webawesome.com/docs/components/button-group
* @documentation https://webawesome.com/docs/components/button-group
* @status stable
* @since 2.0
*
@@ -101,7 +101,10 @@ export default class WaButtonGroup extends WebAwesomeElement {
return html`
<slot
part="base"
class=${classMap({ 'button-group': true, 'has-outlined': this.hasOutlined })}
class=${classMap({
'button-group': true,
'has-outlined': this.hasOutlined,
})}
role="${this.disableRole ? 'presentation' : 'group'}"
aria-label=${this.label}
aria-orientation=${this.orientation}

View File

@@ -103,10 +103,10 @@
var(--wa-color-mix-active)
);
}
}
&:host([appearance~='outlined']) .button {
border-color: var(--wa-color-border-normal, var(--wa-color-neutral-border-normal));
}
:host([appearance~='filled'][appearance~='outlined']) .button {
border-color: var(--wa-color-border-normal, var(--wa-color-neutral-border-normal));
}
:host([appearance~='accent']) {
@@ -309,22 +309,22 @@ slot[name='end']::slotted(*),
}
/* Handle pill modifier for button groups */
:host([pill]) .wa-button-group__horizontal.wa-button-group__button-first {
:host([pill].wa-button-group__horizontal.wa-button-group__button-first) .button {
border-start-start-radius: var(--wa-border-radius-pill);
border-end-start-radius: var(--wa-border-radius-pill);
}
:host([pill]) .wa-button-group__horizontal.wa-button-group__button-last {
:host([pill].wa-button-group__horizontal.wa-button-group__button-last) .button {
border-start-end-radius: var(--wa-border-radius-pill);
border-end-end-radius: var(--wa-border-radius-pill);
}
:host([pill]) .wa-button-group__vertical.wa-button-group__button-first {
:host([pill].wa-button-group__vertical.wa-button-group__button-first) .button {
border-start-start-radius: var(--wa-border-radius-pill);
border-start-end-radius: var(--wa-border-radius-pill);
}
:host([pill]) .wa-button-group__vertical.wa-button-group__button-last {
:host([pill].wa-button-group__vertical.wa-button-group__button-last) .button {
border-end-start-radius: var(--wa-border-radius-pill);
border-end-end-radius: var(--wa-border-radius-pill);
}

View File

@@ -16,7 +16,7 @@ import styles from './button.css';
/**
* @summary Buttons represent actions that are available to the user.
* @documentation https://backers.webawesome.com/docs/components/button
* @documentation https://webawesome.com/docs/components/button
* @status stable
* @since 2.0
*

View File

@@ -25,10 +25,10 @@
:host([appearance~='filled']) {
background-color: var(--wa-color-fill-quiet, var(--wa-color-brand-fill-quiet));
border-color: transparent;
}
&:host([appearance~='outlined']) {
border-color: var(--wa-color-border-quiet, var(--wa-color-brand-border-quiet));
}
:host([appearance~='filled'][appearance~='outlined']) {
border-color: var(--wa-color-border-quiet, var(--wa-color-brand-border-quiet));
}
:host([appearance~='accent']) {

View File

@@ -7,7 +7,7 @@ import styles from './callout.css';
/**
* @summary Callouts are used to display important messages inline.
* @documentation https://backers.webawesome.com/docs/components/callout
* @documentation https://webawesome.com/docs/components/callout
* @status stable
* @since 2.0
*
@@ -22,7 +22,7 @@ export default class WaCallout extends WebAwesomeElement {
static css = [styles, variantStyles, sizeStyles];
/** The callout's theme variant. Defaults to `brand` if not within another element with a variant. */
@property({ reflect: true }) variant: 'brand' | 'neutral' | 'success' | 'warning' | 'danger' | 'brand' = 'brand';
@property({ reflect: true }) variant: 'brand' | 'neutral' | 'success' | 'warning' | 'danger' = 'brand';
/** The callout's visual appearance. */
@property({ reflect: true }) appearance:

View File

@@ -30,10 +30,10 @@
:host([appearance~='filled']) {
background-color: var(--wa-color-neutral-fill-quiet);
border-color: transparent;
}
&:host([appearance~='outlined']) {
border-color: var(--wa-color-neutral-border-quiet);
}
:host([appearance~='filled'][appearance~='outlined']) {
border-color: var(--wa-color-neutral-border-quiet);
}
:host([appearance~='accent']) {
@@ -63,7 +63,7 @@
&::slotted(*) {
display: block;
width: 100%;
border-radius: 0;
border-radius: 0 !important;
}
}

View File

@@ -7,7 +7,7 @@ import styles from './card.css';
/**
* @summary Cards can be used to group related subjects in a container.
* @documentation https://backers.webawesome.com/docs/components/card
* @documentation https://webawesome.com/docs/components/card
* @status stable
* @since 2.0
*

View File

@@ -15,7 +15,7 @@ import styles from './checkbox.css';
/**
* @summary Checkboxes allow the user to toggle an option on or off.
* @documentation https://backers.webawesome.com/docs/components/checkbox
* @documentation https://webawesome.com/docs/components/checkbox
* @status stable
* @since 2.0
*

View File

@@ -39,7 +39,7 @@ declare const EyeDropper: EyeDropperConstructor;
/**
* @summary Color pickers allow the user to select a color.
* @documentation https://backers.webawesome.com/docs/components/color-picker
* @documentation https://webawesome.com/docs/components/color-picker
* @status stable
* @since 2.0
*

View File

@@ -11,7 +11,7 @@ import styles from './comparison.css';
/**
* @summary Compare visual differences between similar content with a sliding panel.
* @documentation https://backers.webawesome.com/docs/components/comparison
* @documentation https://webawesome.com/docs/components/comparison
* @status stable
* @since 2.0
*

View File

@@ -14,7 +14,7 @@ import styles from './copy-button.css';
/**
* @summary Copies text data to the clipboard when the user clicks the trigger.
* @documentation https://backers.webawesome.com/docs/components/copy
* @documentation https://webawesome.com/docs/components/copy
* @status experimental
* @since 2.7
*

View File

@@ -49,32 +49,26 @@ details {
}
/* Appearance modifiers */
:host([appearance~='plain']) {
details {
background-color: transparent;
border-color: transparent;
}
:host([appearance~='plain']) details {
background-color: transparent;
border-color: transparent;
}
:host([appearance~='outlined']) {
details {
background-color: var(--wa-color-surface-default);
border-color: var(--wa-color-surface-border);
}
:host([appearance~='outlined']) details {
background-color: var(--wa-color-surface-default);
border-color: var(--wa-color-surface-border);
}
:host([appearance~='filled']) {
details {
background-color: var(--wa-color-neutral-fill-quiet);
border-color: transparent;
}
&:host([appearance~='outlined']) details {
border-color: var(--wa-color-neutral-border-quiet);
}
:host([appearance~='filled']) details {
background-color: var(--wa-color-neutral-fill-quiet);
border-color: transparent;
}
:host([appearance='plain']) {
:host([appearance~='filled'][appearance~='outlined']) details {
border-color: var(--wa-color-neutral-border-quiet);
}
:host([appearance='plain']) details {
border-radius: 0;
}

View File

@@ -196,8 +196,9 @@ describe('<wa-details>', () => {
await first.show();
await second.show();
expect(firstBody.clientHeight).to.equal(200);
expect(secondBody.clientHeight).to.equal(400);
// height + 32 (padding probably?)
expect(firstBody.clientHeight).to.equal(232);
expect(secondBody.clientHeight).to.equal(432);
});
});
}

View File

@@ -14,7 +14,7 @@ import styles from './details.css';
/**
* @summary Details show a brief summary and expand to show additional content.
* @documentation https://backers.webawesome.com/docs/components/details
* @documentation https://webawesome.com/docs/components/details
* @status stable
* @since 2.0
*

View File

@@ -17,7 +17,7 @@ import styles from './dialog.css';
/**
* @summary Dialogs, sometimes called "modals", appear above the page and require the user's immediate attention.
* @documentation https://backers.webawesome.com/docs/components/dialog
* @documentation https://webawesome.com/docs/components/dialog
* @status stable
* @since 2.0
*

View File

@@ -5,7 +5,7 @@ import styles from './divider.css';
/**
* @summary Dividers are used to visually separate or group elements.
* @documentation https://backers.webawesome.com/docs/components/divider
* @documentation https://webawesome.com/docs/components/divider
* @status stable
* @since 2.0
*

View File

@@ -17,7 +17,7 @@ import styles from './drawer.css';
/**
* @summary Drawers slide in from a container to expose additional options and information.
* @documentation https://backers.webawesome.com/docs/components/drawer
* @documentation https://webawesome.com/docs/components/drawer
* @status stable
* @since 2.0
*

View File

@@ -8,7 +8,7 @@ import styles from './dropdown-item.css';
/**
* @summary Represents an individual item within a dropdown menu, supporting standard items, checkboxes, and submenus.
* @documentation https://backers.webawesome.com/docs/components/dropdown-item
* @documentation https://webawesome.com/docs/components/dropdown-item
* @status experimental
* @since 3.0
*

View File

@@ -6,9 +6,6 @@
#menu {
display: flex;
position: absolute;
top: 0;
left: 0;
flex-direction: column;
width: max-content;
margin: 0;

View File

@@ -24,7 +24,7 @@ const openDropdowns = new Set<WaDropdown>();
/**
* @summary Dropdowns display a list of options that can be triggered by a button or other element. They support
* keyboard navigation, submenus, and various customization options.
* @documentation https://backers.webawesome.com/docs/components/dropdown
* @documentation https://webawesome.com/docs/components/dropdown
* @status stable
* @since 2.0
*
@@ -698,7 +698,16 @@ export default class WaDropdown extends WebAwesomeElement {
let active = this.hasUpdated ? this.popup.active : this.open;
return html`
<wa-popup placement=${this.placement} distance=${this.distance} skidding=${this.skidding} ?active=${active}>
<wa-popup
placement=${this.placement}
distance=${this.distance}
skidding=${this.skidding}
?active=${active}
flip
flip-fallback-strategy="best-fit"
shift
shift-padding="8"
>
<slot
name="trigger"
slot="anchor"

View File

@@ -4,7 +4,7 @@ import { LocalizeController } from '../../utilities/localize.js';
/**
* @summary Formats a number as a human readable bytes value.
* @documentation https://backers.webawesome.com/docs/components/format-bytes
* @documentation https://webawesome.com/docs/components/format-bytes
* @status stable
* @since 2.0
*/

View File

@@ -5,7 +5,7 @@ import { LocalizeController } from '../../utilities/localize.js';
/**
* @summary Formats a date/time using the specified locale and options.
* @documentation https://backers.webawesome.com/docs/components/format-date
* @documentation https://webawesome.com/docs/components/format-date
* @status stable
* @since 2.0
*/

View File

@@ -4,7 +4,7 @@ import { LocalizeController } from '../../utilities/localize.js';
/**
* @summary Formats a number using the specified locale and options.
* @documentation https://backers.webawesome.com/docs/components/format-number
* @documentation https://webawesome.com/docs/components/format-number
* @status stable
* @since 2.0
*/

View File

@@ -24,7 +24,7 @@ interface IconSource {
/**
* @summary Icons are symbols that can be used to represent various options within an application.
* @documentation https://backers.webawesome.com/docs/components/icon
* @documentation https://webawesome.com/docs/components/icon
* @status stable
* @since 2.0
*

View File

@@ -9,7 +9,7 @@ import { requestInclude } from './request.js';
/**
* @summary Includes give you the power to embed external HTML files into the page.
* @documentation https://backers.webawesome.com/docs/components/include
* @documentation https://webawesome.com/docs/components/include
* @status stable
* @since 2.0
*

View File

@@ -44,22 +44,18 @@
}
/* Appearance modifiers */
:host([appearance~='outlined']) {
.text-field {
background-color: var(--wa-form-control-background-color);
border-color: var(--wa-form-control-border-color);
}
:host([appearance~='outlined']) .text-field {
background-color: var(--wa-form-control-background-color);
border-color: var(--wa-form-control-border-color);
}
:host([appearance~='filled']) {
.text-field {
background-color: var(--wa-color-neutral-fill-quiet);
border-color: var(--wa-color-neutral-fill-quiet);
}
:host([appearance~='filled']) .text-field {
background-color: var(--wa-color-neutral-fill-quiet);
border-color: var(--wa-color-neutral-fill-quiet);
}
&:host([appearance~='outlined']) .text-field {
border-color: var(--wa-form-control-border-color);
}
:host([appearance~='filled'][appearance~='outlined']) .text-field {
border-color: var(--wa-form-control-border-color);
}
:host([pill]) .text-field {

View File

@@ -17,7 +17,7 @@ import styles from './input.css';
/**
* @summary Inputs collect data from the user.
* @documentation https://backers.webawesome.com/docs/components/input
* @documentation https://webawesome.com/docs/components/input
* @status stable
* @since 2.0
*

View File

@@ -7,7 +7,7 @@ import styles from './mutation-observer.css';
/**
* @summary The Mutation Observer component offers a thin, declarative interface to the [`MutationObserver API`](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver).
* @documentation https://backers.webawesome.com/docs/components/mutation-observer
* @documentation https://webawesome.com/docs/components/mutation-observer
* @status stable
* @since 2.0
*

View File

@@ -9,7 +9,7 @@ import styles from './option.css';
/**
* @summary Options define the selectable items within a select component.
* @documentation https://backers.webawesome.com/docs/components/option
* @documentation https://webawesome.com/docs/components/option
* @status stable
* @since 2.0
*

View File

@@ -79,7 +79,7 @@ function toLength(px: number | string): string {
/**
* @summary Pages offer an easy way to scaffold entire page layouts using minimal markup.
* @documentation https://backers.webawesome.com/docs/components/page
* @documentation https://webawesome.com/docs/components/page
* @status experimental
* @since 3.0
*

View File

@@ -18,7 +18,7 @@ const openPopovers = new Set<WaPopover>();
/**
* @summary Popovers display contextual content and interactive elements in a floating panel.
* @documentation https://backers.webawesome.com/docs/components/popover
* @documentation https://webawesome.com/docs/components/popover
* @status stable
* @since 3.0
*

View File

@@ -37,7 +37,7 @@ const SUPPORTS_POPOVER = globalThis?.HTMLElement?.prototype.hasOwnProperty('popo
/**
* @summary Popup is a utility that lets you declaratively anchor "popup" containers to another element.
* @documentation https://backers.webawesome.com/docs/components/popup
* @documentation https://webawesome.com/docs/components/popup
* @status stable
* @since 2.0
*

View File

@@ -1,4 +1,5 @@
:host {
--track-height: 1rem;
--track-color: var(--wa-color-neutral-fill-normal);
--indicator-color: var(--wa-color-brand-fill-loud);
@@ -10,10 +11,11 @@
display: flex;
position: relative;
overflow: hidden;
height: 1rem;
height: var(--track-height);
border-radius: var(--wa-border-radius-pill);
background-color: var(--track-color);
color: var(--wa-color-brand-on-loud);
font-size: var(--wa-font-size-s);
}
.indicator {

View File

@@ -9,7 +9,7 @@ import styles from './progress-bar.css';
/**
* @summary Progress bars are used to show the status of an ongoing operation.
* @documentation https://backers.webawesome.com/docs/components/progress-bar
* @documentation https://webawesome.com/docs/components/progress-bar
* @status stable
* @since 2.0
*
@@ -19,8 +19,9 @@ import styles from './progress-bar.css';
* @csspart indicator - The progress bar's indicator.
* @csspart label - The progress bar's label.
*
* @cssproperty --track-color - The color of the track.
* @cssproperty --indicator-color - The color of the indicator.
* @cssproperty [--track-height=1rem] - The color of the track.
* @cssproperty [--track-color=var(--wa-color-neutral-fill-normal)] - The color of the track.
* @cssproperty [--indicator-color=var(--wa-color-brand-fill-loud)] - The color of the indicator.
*/
@customElement('wa-progress-bar')
export default class WaProgressBar extends WebAwesomeElement {

View File

@@ -7,7 +7,7 @@ import styles from './progress-ring.css';
/**
* @summary Progress rings are used to show the progress of a determinate operation in a circular fashion.
* @documentation https://backers.webawesome.com/docs/components/progress-ring
* @documentation https://webawesome.com/docs/components/progress-ring
* @status stable
* @since 2.0
*

View File

@@ -10,7 +10,7 @@ let QrCreator: _QrCreator.default;
/**
* @summary Generates a [QR code](https://www.qrcode.com/) and renders it using the [Canvas API](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API).
* @documentation https://backers.webawesome.com/docs/components/qr-code
* @documentation https://webawesome.com/docs/components/qr-code
* @status stable
* @since 2.0
*

View File

@@ -14,7 +14,7 @@ import styles from './radio-group.css';
/**
* @summary Radio groups are used to group multiple [radios](/docs/components/radio) so they function as a single form control.
* @documentation https://backers.webawesome.com/docs/components/radio-group
* @documentation https://webawesome.com/docs/components/radio-group
* @status stable
* @since 2.0
*

View File

@@ -9,7 +9,7 @@ import styles from './radio.css';
/**
* @summary Radios allow the user to select a single option from a group.
* @documentation https://backers.webawesome.com/docs/components/radio
* @documentation https://webawesome.com/docs/components/radio
* @status stable
* @since 2.0
*

View File

@@ -14,7 +14,7 @@ import styles from './rating.css';
/**
* @summary Ratings give users a way to quickly view and provide feedback.
* @documentation https://backers.webawesome.com/docs/components/rating
* @documentation https://webawesome.com/docs/components/rating
* @status stable
* @since 2.0
*

View File

@@ -20,7 +20,7 @@ const availableUnits: UnitConfig[] = [
/**
* @summary Outputs a localized time phrase relative to the current date and time.
* @documentation https://backers.webawesome.com/docs/components/relative-time
* @documentation https://webawesome.com/docs/components/relative-time
* @status stable
* @since 2.0
*/

Some files were not shown because too many files have changed in this diff Show More