mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-19 15:34:15 +00:00
Compare commits
3 Commits
fix-spinne
...
konnorroge
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
59646cd60a | ||
|
|
640cbb7760 | ||
|
|
f9873d2f8b |
@@ -135,7 +135,6 @@
|
||||
"noopener",
|
||||
"noreferrer",
|
||||
"noscript",
|
||||
"Notdog",
|
||||
"novalidate",
|
||||
"nowrap",
|
||||
"Numberish",
|
||||
|
||||
73
package-lock.json
generated
73
package-lock.json
generated
@@ -16,7 +16,7 @@
|
||||
"@custom-elements-manifest/analyzer": "^0.10.4",
|
||||
"@lit-labs/eleventy-plugin-lit": "^1.0.3",
|
||||
"@lit-labs/testing": "^0.2.5",
|
||||
"@lit/react": "^1.0.8",
|
||||
"@lit/react": "^1.0.6",
|
||||
"@open-wc/testing": "^3.2.0",
|
||||
"@types/mocha": "^10.0.10",
|
||||
"@types/react": "^18.2.28",
|
||||
@@ -2029,9 +2029,10 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@lit/react": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/@lit/react/-/react-1.0.8.tgz",
|
||||
"integrity": "sha512-p2+YcF+JE67SRX3mMlJ1TKCSTsgyOVdAwd/nxp3NuV1+Cb6MWALbN6nT7Ld4tpmYofcE5kcaSY1YBB9erY+6fw==",
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/@lit/react/-/react-1.0.7.tgz",
|
||||
"integrity": "sha512-cencnwwLXQKiKxjfFzSgZRngcWJzUDZi/04E0fSaF86wZgchMdvTyu+lE36DrUfvuus3bH8+xLPrhM1cTjwpzw==",
|
||||
"dev": true,
|
||||
"peerDependencies": {
|
||||
"@types/react": "17 || 18 || 19"
|
||||
}
|
||||
@@ -2875,7 +2876,8 @@
|
||||
"node_modules/@types/prop-types": {
|
||||
"version": "15.7.14",
|
||||
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.14.tgz",
|
||||
"integrity": "sha512-gNMvNH49DJ7OJYv+KAKn0Xp45p8PLl6zo2YnvDIbTd4J6MER2BmWN49TG7n9LvkyihINxeKW8+3bfS2yDC9dzQ=="
|
||||
"integrity": "sha512-gNMvNH49DJ7OJYv+KAKn0Xp45p8PLl6zo2YnvDIbTd4J6MER2BmWN49TG7n9LvkyihINxeKW8+3bfS2yDC9dzQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/qs": {
|
||||
"version": "6.9.11",
|
||||
@@ -2893,6 +2895,7 @@
|
||||
"version": "18.3.23",
|
||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.23.tgz",
|
||||
"integrity": "sha512-/LDXMQh55EzZQ0uVAZmKKhfENivEvWz6E+EYzh+/MCjMhNsotd+ZHhBGIjFDTi6+fz0OhQQQLbTgdQIxxCsC0w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/prop-types": "*",
|
||||
"csstype": "^3.0.2"
|
||||
@@ -2983,12 +2986,6 @@
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@wc-toolkit/jsx-types": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@wc-toolkit/jsx-types/-/jsx-types-1.3.0.tgz",
|
||||
"integrity": "sha512-2rcRyPNEAdesFlokSSFBuCjpPPrMySk4NqyVJsqCs/WczcAUnIGwjnJk2fd/SNmzSjxGFRIFLAhXOgFOHLPvxQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@web/browser-logs": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@web/browser-logs/-/browser-logs-0.4.0.tgz",
|
||||
@@ -5802,7 +5799,8 @@
|
||||
"node_modules/csstype": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz",
|
||||
"integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="
|
||||
"integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/custom-element-jet-brains-integration": {
|
||||
"version": "1.7.0",
|
||||
@@ -13977,82 +13975,41 @@
|
||||
},
|
||||
"packages/webawesome": {
|
||||
"name": "@awesome.me/webawesome",
|
||||
"version": "3.0.0-beta.4",
|
||||
"version": "3.0.0-beta.1",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@ctrl/tinycolor": "^4.1.0",
|
||||
"@floating-ui/dom": "^1.6.13",
|
||||
"@lit/react": "^1.0.8",
|
||||
"@shoelace-style/animations": "^1.2.0",
|
||||
"@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": {
|
||||
"@wc-toolkit/jsx-types": "^1.3.0"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"engines": {
|
||||
"node": ">=14.17.0"
|
||||
}
|
||||
},
|
||||
"packages/webawesome-pro": {
|
||||
"name": "@shoelace-style/webawesome-pro",
|
||||
"version": "3.0.0-beta.3",
|
||||
"version": "3.0.0-beta.1",
|
||||
"license": "TODO",
|
||||
"dependencies": {
|
||||
"@ctrl/tinycolor": "^4.1.0",
|
||||
"@floating-ui/dom": "^1.6.13",
|
||||
"@lit/react": "^1.0.8",
|
||||
"@shoelace-style/animations": "^1.2.0",
|
||||
"@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": {
|
||||
"@wc-toolkit/jsx-types": "^1.3.0"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"engines": {
|
||||
"node": ">=14.17.0"
|
||||
}
|
||||
},
|
||||
"packages/webawesome-pro/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"
|
||||
}
|
||||
},
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,12 +18,13 @@
|
||||
"engines": {
|
||||
"node": ">=14.17.0"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@11ty/eleventy": "3.0.0",
|
||||
"@custom-elements-manifest/analyzer": "^0.10.4",
|
||||
"@lit-labs/eleventy-plugin-lit": "^1.0.3",
|
||||
"@lit-labs/testing": "^0.2.5",
|
||||
"@lit/react": "^1.0.8",
|
||||
"@lit/react": "^1.0.6",
|
||||
"@open-wc/testing": "^3.2.0",
|
||||
"@types/mocha": "^10.0.10",
|
||||
"@types/react": "^18.2.28",
|
||||
@@ -86,3 +87,4 @@
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { jsxTypesPlugin } from '@wc-toolkit/jsx-types';
|
||||
import { customElementJetBrainsPlugin } from 'custom-element-jet-brains-integration';
|
||||
import { customElementVsCodePlugin } from 'custom-element-vs-code-integration';
|
||||
// import { customElementVuejsPlugin } from 'custom-element-vuejs-integration';
|
||||
@@ -165,7 +164,6 @@ export default {
|
||||
],
|
||||
}),
|
||||
|
||||
// Generate custom JetBrains data
|
||||
customElementJetBrainsPlugin({
|
||||
outdir: './dist-cdn',
|
||||
excludeCss: true,
|
||||
@@ -178,16 +176,6 @@ export default {
|
||||
},
|
||||
}),
|
||||
|
||||
// Generate JSX types (see https://wc-toolkit.com/integrations/jsx/)
|
||||
jsxTypesPlugin({
|
||||
fileName: 'custom-elements-jsx.d.ts',
|
||||
outdir,
|
||||
defaultExport: true,
|
||||
componentTypePath: (_name, _tag, modulePath) => {
|
||||
return `./${modulePath}`;
|
||||
},
|
||||
}),
|
||||
|
||||
//
|
||||
// TODO - figure out why this broke when events were updated
|
||||
//
|
||||
|
||||
@@ -1,63 +1,30 @@
|
||||
import { parse as HTMLParse } from 'node-html-parser';
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
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 { 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 { getComponents } from './_utils/manifest.js';
|
||||
import { markdown } from './_utils/markdown.js';
|
||||
import { SimulateWebAwesomeApp } from './_utils/simulate-webawesome-app.js';
|
||||
// import { formatCodePlugin } from './_plugins/format-code.js';
|
||||
// import { formatCodePlugin } from './_utils/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 { replaceTextPlugin } from './_plugins/replace-text.js';
|
||||
import { searchPlugin } from './_plugins/search.js';
|
||||
import { outlinePlugin } from './_utils/outline.js';
|
||||
import { replaceTextPlugin } from './_utils/replace-text.js';
|
||||
import { searchPlugin } from './_utils/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');
|
||||
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();
|
||||
}
|
||||
});
|
||||
const allComponents = getComponents();
|
||||
|
||||
/**
|
||||
* If you plan to add or remove any of these extensions, make sure to let either Konnor or Cory know as these
|
||||
@@ -85,7 +52,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 => path.parse(string + '').name);
|
||||
eleventyConfig.addFilter('stripExtension', string => 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.
|
||||
@@ -142,6 +109,31 @@ 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.
|
||||
currentUser: {
|
||||
hasPro: false,
|
||||
},
|
||||
server: {
|
||||
head: '',
|
||||
loginOrAvatar: '',
|
||||
flashes: '',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
// Paired shortcodes - {% shortCode %}content{% endShortCode %}
|
||||
eleventyConfig.addPairedShortcode('markdown', content => markdown.render(content || ''));
|
||||
|
||||
@@ -160,33 +152,33 @@ export default async function (eleventyConfig) {
|
||||
eleventyConfig.setLibrary('md', markdown);
|
||||
|
||||
// Add anchors to headings
|
||||
eleventyConfig.addTransform('doc-transforms', function (content) {
|
||||
let doc = HTMLParse(content, { blockTextElements: { code: true } });
|
||||
eleventyConfig.addPlugin(anchorHeadingsPlugin({ container: '#content' }));
|
||||
|
||||
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 an outline to the page
|
||||
eleventyConfig.addPlugin(
|
||||
outlinePlugin({
|
||||
container: '#content',
|
||||
target: '.outline-links',
|
||||
selector: 'h2, h3',
|
||||
ifEmpty: doc => {
|
||||
doc.querySelector('#outline')?.remove();
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
for (const transformer of transformers) {
|
||||
transformer.call(this, doc);
|
||||
}
|
||||
// Add current link classes
|
||||
eleventyConfig.addPlugin(currentLink());
|
||||
|
||||
return doc.toString();
|
||||
});
|
||||
// Add code examples for `<code class="example">` blocks
|
||||
eleventyConfig.addPlugin(codeExamplesPlugin());
|
||||
|
||||
// Highlight code blocks with Prism
|
||||
eleventyConfig.addPlugin(highlightCodePlugin());
|
||||
|
||||
// Add copy code buttons to code blocks
|
||||
eleventyConfig.addPlugin(copyCodePlugin);
|
||||
|
||||
// Various text replacements
|
||||
eleventyConfig.addPlugin(
|
||||
replaceTextPlugin([
|
||||
{
|
||||
@@ -196,17 +188,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" target="_blank">#$1</a>',
|
||||
replaceWith: '<a href="https://github.com/shoelace-style/webawesome/pull/$1">#$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" target="_blank">#$1</a>',
|
||||
replaceWith: '<a href="https://github.com/shoelace-style/webawesome/issues/$1">#$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" target="_blank">#$1</a>',
|
||||
replaceWith: '<a href="https://github.com/shoelace-style/webawesome/discussions/$1">#$1</a>',
|
||||
},
|
||||
]),
|
||||
);
|
||||
@@ -229,18 +221,16 @@ export default async function (eleventyConfig) {
|
||||
// eleventyConfig.addPlugin(formatCodePlugin());
|
||||
// }
|
||||
|
||||
// This needs to happen in "eleventy.after" otherwise incremental builds never update.
|
||||
eleventyConfig.on('eleventy.after', function () {
|
||||
let assetsDir = path.join(process.env.BASE_DIR || 'docs', 'assets');
|
||||
const siteAssetsDir = path.join(eleventyConfig.directories.output, 'assets');
|
||||
fs.cpSync(assetsDir, siteAssetsDir, { recursive: true });
|
||||
});
|
||||
let assetsDir = path.join(process.env.BASE_DIR || 'docs', 'assets');
|
||||
fs.cpSync(assetsDir, path.join(eleventyConfig.directories.output, 'assets'), { 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:
|
||||
@@ -263,20 +253,6 @@ export default async function (eleventyConfig) {
|
||||
// componentModules,
|
||||
// });
|
||||
// }
|
||||
|
||||
// For a server build, we expect a server to run the second transform.
|
||||
// For dev builds, we run the second transform in a middleware.
|
||||
if (!isDev && !serverBuild) {
|
||||
eleventyConfig.addTransform('simulate-webawesome-app', function (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 = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" data-fa-kit-code="38c11e3f20" data-cdn-url="{% cdnUrl %}" class="wa-cloak">
|
||||
<html lang="en" data-fa-kit-code="b10bfbde90" data-cdn-url="{% cdnUrl %}" class="wa-cloak">
|
||||
<head>
|
||||
{% include 'head.njk' %}
|
||||
<meta name="theme-color" content="#f36944">
|
||||
@@ -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="webawesome.com" src="https://plausible.io/js/script.js"></script>
|
||||
<script defer data-domain="backers.webawesome.com" src="https://plausible.io/js/script.js"></script>
|
||||
|
||||
{# Docs styles #}
|
||||
<link rel="stylesheet" href="/assets/styles/docs.css" />
|
||||
@@ -44,7 +44,7 @@
|
||||
</head>
|
||||
<body class="layout-{{ layout | stripExtension }}{{ ' page-wide' if wide }}">
|
||||
<!-- use view="desktop" as default to reduce layout jank on desktop site. -->
|
||||
<wa-page view="desktop" disable-navigation-toggle mobile-breakpoint="1180">
|
||||
<wa-page view="desktop" disable-navigation-toggle="" mobile-breakpoint="1180">
|
||||
<header slot="header" class="wa-split">
|
||||
{# Logo #}
|
||||
<div id="docs-branding">
|
||||
@@ -61,27 +61,19 @@
|
||||
<wa-badge variant="brand" appearance="filled" class="wa-desktop-only">Beta</wa-badge>
|
||||
</div>
|
||||
|
||||
<div id="docs-toolbar" class="wa-cluster">
|
||||
<div id="docs-toolbar" class="wa-cluster wa-gap-xs">
|
||||
{# Desktop selectors #}
|
||||
<div class="wa-desktop-only wa-cluster wa-gap-xs">
|
||||
{% include "theme-selector.njk" %}
|
||||
{% include "color-scheme-selector.njk" %}
|
||||
</div>
|
||||
|
||||
<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>
|
||||
{# 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>
|
||||
|
||||
{# Login #}
|
||||
{% server "loginOrAvatar" %}
|
||||
@@ -92,7 +84,7 @@
|
||||
{% if hasSidebar %}
|
||||
{# Mobile selectors #}
|
||||
<div class="wa-mobile-only" slot="navigation-header">
|
||||
<div class="wa-cluster wa-gap-xs" style="flex-wrap: nowrap;">
|
||||
<div class="wa-cluster wa-gap-xs">
|
||||
{% include "theme-selector.njk" %}
|
||||
{% include "color-scheme-selector.njk" %}
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<wa-select class="color-scheme-selector" appearance="filled" size="small" value="auto" title="Press \ to toggle">
|
||||
<wa-select class="color-scheme-selector" appearance="filled" size="small" value="auto" pill 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">
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
{# 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>
|
||||
@@ -218,8 +211,6 @@
|
||||
</li>
|
||||
<li>
|
||||
<a href="/docs/patterns/app/pagination/">Pagination</a>
|
||||
</li><li>
|
||||
<a href="/docs/patterns/app/password/">Password</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/docs/patterns/app/permissions/">Permissions</a>
|
||||
@@ -233,30 +224,18 @@
|
||||
<a href="/docs/patterns/blog-news/">Blog & News</a>
|
||||
<wa-badge class="pro" appearance="accent" attention="none">PRO</wa-badge>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/docs/patterns/blog-news/banners/">Banners</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/docs/patterns/blog-news/call-to-action/">Call To Action</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/docs/patterns/blog-news/category-list/">Category List</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/docs/patterns/blog-news/contact/">Contact</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/docs/patterns/blog-news/featured-post/">Featured Post</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/docs/patterns/blog-news/footer/">Footer</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/docs/patterns/blog-news/grid-section/">Grid Section</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/docs/patterns/blog-news/header/">Header</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/docs/patterns/blog-news/newsletter/">Newsletter</a>
|
||||
</li>
|
||||
@@ -274,19 +253,10 @@
|
||||
</li>
|
||||
<li>
|
||||
<a href="/docs/patterns/blog-news/login/">Sign Up & Login</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/docs/patterns/blog-news/numbers/">Numbers</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/docs/patterns/blog-news/social-share/">Social Share</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/docs/patterns/blog-news/teams/">Teams</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/docs/patterns/blog-news/testimonials/">Testimonials</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<wa-select appearance="filled" size="small" value="default" class="theme-selector">
|
||||
<wa-select appearance="filled" size="small" value="default" pill class="theme-selector">
|
||||
<wa-icon slot="start" name="paintbrush" variant="regular"></wa-icon>
|
||||
|
||||
{# Free themes #}
|
||||
|
||||
@@ -12,18 +12,22 @@
|
||||
<th><code>brand</code></th>
|
||||
<td>
|
||||
<div class="wa-cluster wa-gap-2xs">
|
||||
<wa-badge variant="brand" appearance="accent outlined">A+O</wa-badge>
|
||||
<wa-badge variant="brand" appearance="accent">Accent</wa-badge>
|
||||
<wa-badge variant="brand" appearance="filled outlined">Filled + Outlined</wa-badge>
|
||||
<wa-badge variant="brand" appearance="filled outlined">F+O</wa-badge>
|
||||
<wa-badge variant="brand" appearance="filled">Filled</wa-badge>
|
||||
<wa-badge variant="brand" appearance="outlined">Outlined</wa-badge>
|
||||
<wa-badge variant="brand" appearance="plain">Plain</wa-badge>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="wa-cluster wa-gap-2xs">
|
||||
<wa-badge class="wa-brand" appearance="accent outlined">A+O</wa-badge>
|
||||
<wa-badge class="wa-brand" appearance="accent">Accent</wa-badge>
|
||||
<wa-badge class="wa-brand" appearance="filled outlined">Filled + Outlined</wa-badge>
|
||||
<wa-badge class="wa-brand" appearance="filled outlined">F+O</wa-badge>
|
||||
<wa-badge class="wa-brand" appearance="filled">Filled</wa-badge>
|
||||
<wa-badge class="wa-brand" appearance="outlined">Outlined</wa-badge>
|
||||
<wa-badge class="wa-brand" appearance="plain">Plain</wa-badge>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -31,18 +35,22 @@
|
||||
<th><code>neutral</code></th>
|
||||
<td>
|
||||
<div class="wa-cluster wa-gap-2xs">
|
||||
<wa-badge variant="neutral" appearance="accent outlined">A+O</wa-badge>
|
||||
<wa-badge variant="neutral" appearance="accent">Accent</wa-badge>
|
||||
<wa-badge variant="neutral" appearance="filled outlined">Filled + Outlined</wa-badge>
|
||||
<wa-badge variant="neutral" appearance="filled outlined">F+O</wa-badge>
|
||||
<wa-badge variant="neutral" appearance="filled">Filled</wa-badge>
|
||||
<wa-badge variant="neutral" appearance="outlined">Outlined</wa-badge>
|
||||
<wa-badge variant="neutral" appearance="plain">Plain</wa-badge>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="wa-cluster wa-gap-2xs">
|
||||
<wa-badge class="wa-neutral" appearance="accent outlined">A+O</wa-badge>
|
||||
<wa-badge class="wa-neutral" appearance="accent">Accent</wa-badge>
|
||||
<wa-badge class="wa-neutral" appearance="filled outlined">Filled + Outlined</wa-badge>
|
||||
<wa-badge class="wa-neutral" appearance="filled outlined">F+O</wa-badge>
|
||||
<wa-badge class="wa-neutral" appearance="filled">Filled</wa-badge>
|
||||
<wa-badge class="wa-neutral" appearance="outlined">Outlined</wa-badge>
|
||||
<wa-badge class="wa-neutral" appearance="plain">Plain</wa-badge>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -50,18 +58,22 @@
|
||||
<th><code>success</code></th>
|
||||
<td>
|
||||
<div class="wa-cluster wa-gap-2xs">
|
||||
<wa-badge variant="success" appearance="accent outlined">A+O</wa-badge>
|
||||
<wa-badge variant="success" appearance="accent">Accent</wa-badge>
|
||||
<wa-badge variant="success" appearance="filled outlined">Filled + Outlined</wa-badge>
|
||||
<wa-badge variant="success" appearance="filled outlined">F+O</wa-badge>
|
||||
<wa-badge variant="success" appearance="filled">Filled</wa-badge>
|
||||
<wa-badge variant="success" appearance="outlined">Outlined</wa-badge>
|
||||
<wa-badge variant="success" appearance="plain">Plain</wa-badge>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="wa-cluster wa-gap-2xs">
|
||||
<wa-badge class="wa-success" appearance="accent outlined">A+O</wa-badge>
|
||||
<wa-badge class="wa-success" appearance="accent">Accent</wa-badge>
|
||||
<wa-badge class="wa-success" appearance="filled outlined">Filled + Outlined</wa-badge>
|
||||
<wa-badge class="wa-success" appearance="filled outlined">F+O</wa-badge>
|
||||
<wa-badge class="wa-success" appearance="filled">Filled</wa-badge>
|
||||
<wa-badge class="wa-success" appearance="outlined">Outlined</wa-badge>
|
||||
<wa-badge class="wa-success" appearance="plain">Plain</wa-badge>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -69,18 +81,22 @@
|
||||
<th><code>warning</code></th>
|
||||
<td>
|
||||
<div class="wa-cluster wa-gap-2xs">
|
||||
<wa-badge variant="warning" appearance="accent outlined">A+O</wa-badge>
|
||||
<wa-badge variant="warning" appearance="accent">Accent</wa-badge>
|
||||
<wa-badge variant="warning" appearance="filled outlined">Filled + Outlined</wa-badge>
|
||||
<wa-badge variant="warning" appearance="filled outlined">F+O</wa-badge>
|
||||
<wa-badge variant="warning" appearance="filled">Filled</wa-badge>
|
||||
<wa-badge variant="warning" appearance="outlined">Outlined</wa-badge>
|
||||
<wa-badge variant="warning" appearance="plain">Plain</wa-badge>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="wa-cluster wa-gap-2xs">
|
||||
<wa-badge class="wa-warning" appearance="accent outlined">A+O</wa-badge>
|
||||
<wa-badge class="wa-warning" appearance="accent">Accent</wa-badge>
|
||||
<wa-badge class="wa-warning" appearance="filled outlined">Filled + Outlined</wa-badge>
|
||||
<wa-badge class="wa-warning" appearance="filled outlined">F+O</wa-badge>
|
||||
<wa-badge class="wa-warning" appearance="filled">Filled</wa-badge>
|
||||
<wa-badge class="wa-warning" appearance="outlined">Outlined</wa-badge>
|
||||
<wa-badge class="wa-warning" appearance="plain">Plain</wa-badge>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -88,18 +104,22 @@
|
||||
<th><code>danger</code></th>
|
||||
<td>
|
||||
<div class="wa-cluster wa-gap-2xs">
|
||||
<wa-badge variant="danger" appearance="accent outlined">A+O</wa-badge>
|
||||
<wa-badge variant="danger" appearance="accent">Accent</wa-badge>
|
||||
<wa-badge variant="danger" appearance="filled outlined">Filled + Outlined</wa-badge>
|
||||
<wa-badge variant="danger" appearance="filled outlined">F+O</wa-badge>
|
||||
<wa-badge variant="danger" appearance="filled">Filled</wa-badge>
|
||||
<wa-badge variant="danger" appearance="outlined">Outlined</wa-badge>
|
||||
<wa-badge variant="danger" appearance="plain">Plain</wa-badge>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="wa-cluster wa-gap-2xs">
|
||||
<wa-badge class="wa-danger" appearance="accent outlined">A+O</wa-badge>
|
||||
<wa-badge class="wa-danger" appearance="accent">Accent</wa-badge>
|
||||
<wa-badge class="wa-danger" appearance="filled outlined">Filled + Outlined</wa-badge>
|
||||
<wa-badge class="wa-danger" appearance="filled outlined">F+O</wa-badge>
|
||||
<wa-badge class="wa-danger" appearance="filled">Filled</wa-badge>
|
||||
<wa-badge class="wa-danger" appearance="outlined">Outlined</wa-badge>
|
||||
<wa-badge class="wa-danger" appearance="plain">Plain</wa-badge>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -122,8 +142,9 @@
|
||||
<th><code>brand</code></th>
|
||||
<td>
|
||||
<div class="wa-cluster wa-gap-2xs">
|
||||
<wa-button variant="brand" appearance="accent outlined">A+O</wa-button>
|
||||
<wa-button variant="brand" appearance="accent">Accent</wa-button>
|
||||
<wa-button variant="brand" appearance="filled outlined">Filled + Outlined</wa-button>
|
||||
<wa-button variant="brand" appearance="filled outlined">F+O</wa-button>
|
||||
<wa-button variant="brand" appearance="filled">Filled</wa-button>
|
||||
<wa-button variant="brand" appearance="outlined">Outlined</wa-button>
|
||||
<wa-button variant="brand" appearance="plain">Plain</wa-button>
|
||||
@@ -131,8 +152,9 @@
|
||||
</td>
|
||||
<td>
|
||||
<div class="wa-cluster wa-gap-2xs">
|
||||
<wa-button class="wa-brand" appearance="accent outlined">A+O</wa-button>
|
||||
<wa-button class="wa-brand" appearance="accent">Accent</wa-button>
|
||||
<wa-button class="wa-brand" appearance="filled outlined">Filled + Outlined</wa-button>
|
||||
<wa-button class="wa-brand" appearance="filled outlined">F+O</wa-button>
|
||||
<wa-button class="wa-brand" appearance="filled">Filled</wa-button>
|
||||
<wa-button class="wa-brand" appearance="outlined">Outlined</wa-button>
|
||||
<wa-button class="wa-brand" appearance="plain">Plain</wa-button>
|
||||
@@ -143,8 +165,9 @@
|
||||
<th><code>neutral</code></th>
|
||||
<td>
|
||||
<div class="wa-cluster wa-gap-2xs">
|
||||
<wa-button variant="neutral" appearance="accent outlined">A+O</wa-button>
|
||||
<wa-button variant="neutral" appearance="accent">Accent</wa-button>
|
||||
<wa-button variant="neutral" appearance="filled outlined">Filled + Outlined</wa-button>
|
||||
<wa-button variant="neutral" appearance="filled outlined">F+O</wa-button>
|
||||
<wa-button variant="neutral" appearance="filled">Filled</wa-button>
|
||||
<wa-button variant="neutral" appearance="outlined">Outlined</wa-button>
|
||||
<wa-button variant="neutral" appearance="plain">Plain</wa-button>
|
||||
@@ -152,8 +175,9 @@
|
||||
</td>
|
||||
<td>
|
||||
<div class="wa-cluster wa-gap-2xs">
|
||||
<wa-button class="wa-neutral" appearance="accent outlined">A+O</wa-button>
|
||||
<wa-button class="wa-neutral" appearance="accent">Accent</wa-button>
|
||||
<wa-button class="wa-neutral" appearance="filled outlined">Filled + Outlined</wa-button>
|
||||
<wa-button class="wa-neutral" appearance="filled outlined">F+O</wa-button>
|
||||
<wa-button class="wa-neutral" appearance="filled">Filled</wa-button>
|
||||
<wa-button class="wa-neutral" appearance="outlined">Outlined</wa-button>
|
||||
<wa-button class="wa-neutral" appearance="plain">Plain</wa-button>
|
||||
@@ -164,8 +188,9 @@
|
||||
<th><code>success</code></th>
|
||||
<td>
|
||||
<div class="wa-cluster wa-gap-2xs">
|
||||
<wa-button variant="success" appearance="accent outlined">A+O</wa-button>
|
||||
<wa-button variant="success" appearance="accent">Accent</wa-button>
|
||||
<wa-button variant="success" appearance="filled outlined">Filled + Outlined</wa-button>
|
||||
<wa-button variant="success" appearance="filled outlined">F+O</wa-button>
|
||||
<wa-button variant="success" appearance="filled">Filled</wa-button>
|
||||
<wa-button variant="success" appearance="outlined">Outlined</wa-button>
|
||||
<wa-button variant="success" appearance="plain">Plain</wa-button>
|
||||
@@ -173,8 +198,9 @@
|
||||
</td>
|
||||
<td>
|
||||
<div class="wa-cluster wa-gap-2xs">
|
||||
<wa-button class="wa-success" appearance="accent outlined">A+O</wa-button>
|
||||
<wa-button class="wa-success" appearance="accent">Accent</wa-button>
|
||||
<wa-button class="wa-success" appearance="filled outlined">Filled + Outlined</wa-button>
|
||||
<wa-button class="wa-success" appearance="filled outlined">F+O</wa-button>
|
||||
<wa-button class="wa-success" appearance="filled">Filled</wa-button>
|
||||
<wa-button class="wa-success" appearance="outlined">Outlined</wa-button>
|
||||
<wa-button class="wa-success" appearance="plain">Plain</wa-button>
|
||||
@@ -185,8 +211,9 @@
|
||||
<th><code>warning</code></th>
|
||||
<td>
|
||||
<div class="wa-cluster wa-gap-2xs">
|
||||
<wa-button variant="warning" appearance="accent outlined">A+O</wa-button>
|
||||
<wa-button variant="warning" appearance="accent">Accent</wa-button>
|
||||
<wa-button variant="warning" appearance="filled outlined">Filled + Outlined</wa-button>
|
||||
<wa-button variant="warning" appearance="filled outlined">F+O</wa-button>
|
||||
<wa-button variant="warning" appearance="filled">Filled</wa-button>
|
||||
<wa-button variant="warning" appearance="outlined">Outlined</wa-button>
|
||||
<wa-button variant="warning" appearance="plain">Plain</wa-button>
|
||||
@@ -194,8 +221,9 @@
|
||||
</td>
|
||||
<td>
|
||||
<div class="wa-cluster wa-gap-2xs">
|
||||
<wa-button class="wa-warning" appearance="accent outlined">A+O</wa-button>
|
||||
<wa-button class="wa-warning" appearance="accent">Accent</wa-button>
|
||||
<wa-button class="wa-warning" appearance="filled outlined">Filled + Outlined</wa-button>
|
||||
<wa-button class="wa-warning" appearance="filled outlined">F+O</wa-button>
|
||||
<wa-button class="wa-warning" appearance="filled">Filled</wa-button>
|
||||
<wa-button class="wa-warning" appearance="outlined">Outlined</wa-button>
|
||||
<wa-button class="wa-warning" appearance="plain">Plain</wa-button>
|
||||
@@ -206,8 +234,9 @@
|
||||
<th><code>danger</code></th>
|
||||
<td>
|
||||
<div class="wa-cluster wa-gap-2xs">
|
||||
<wa-button variant="danger" appearance="accent outlined">A+O</wa-button>
|
||||
<wa-button variant="danger" appearance="accent">Accent</wa-button>
|
||||
<wa-button variant="danger" appearance="filled outlined">Filled + Outlined</wa-button>
|
||||
<wa-button variant="danger" appearance="filled outlined">F+O</wa-button>
|
||||
<wa-button variant="danger" appearance="filled">Filled</wa-button>
|
||||
<wa-button variant="danger" appearance="outlined">Outlined</wa-button>
|
||||
<wa-button variant="danger" appearance="plain">Plain</wa-button>
|
||||
@@ -215,8 +244,9 @@
|
||||
</td>
|
||||
<td>
|
||||
<div class="wa-cluster wa-gap-2xs">
|
||||
<wa-button class="wa-danger" appearance="accent outlined">A+O</wa-button>
|
||||
<wa-button class="wa-danger" appearance="accent">Accent</wa-button>
|
||||
<wa-button class="wa-danger" appearance="filled outlined">Filled + Outlined</wa-button>
|
||||
<wa-button class="wa-danger" appearance="filled outlined">F+O</wa-button>
|
||||
<wa-button class="wa-danger" appearance="filled">Filled</wa-button>
|
||||
<wa-button class="wa-danger" appearance="outlined">Outlined</wa-button>
|
||||
<wa-button class="wa-danger" appearance="plain">Plain</wa-button>
|
||||
@@ -242,13 +272,17 @@
|
||||
<th><code>brand</code></th>
|
||||
<td>
|
||||
<div class="wa-grid wa-gap-2xs">
|
||||
<wa-callout variant="brand" appearance="accent outlined">
|
||||
<wa-icon slot="icon" name="circle-star"></wa-icon>
|
||||
A+O
|
||||
</wa-callout>
|
||||
<wa-callout variant="brand" appearance="accent">
|
||||
<wa-icon slot="icon" name="circle-star"></wa-icon>
|
||||
Accent
|
||||
</wa-callout>
|
||||
<wa-callout variant="brand" appearance="filled outlined">
|
||||
<wa-icon slot="icon" name="circle-star"></wa-icon>
|
||||
Filled + Outlined
|
||||
F+O
|
||||
</wa-callout>
|
||||
<wa-callout variant="brand" appearance="filled">
|
||||
<wa-icon slot="icon" name="circle-star"></wa-icon>
|
||||
@@ -266,13 +300,17 @@
|
||||
</td>
|
||||
<td>
|
||||
<div class="wa-grid wa-gap-2xs">
|
||||
<wa-callout class="wa-brand" appearance="accent outlined">
|
||||
<wa-icon slot="icon" name="circle-star"></wa-icon>
|
||||
A+O
|
||||
</wa-callout>
|
||||
<wa-callout class="wa-brand" appearance="accent">
|
||||
<wa-icon slot="icon" name="circle-star"></wa-icon>
|
||||
Accent
|
||||
</wa-callout>
|
||||
<wa-callout class="wa-brand" appearance="filled outlined">
|
||||
<wa-icon slot="icon" name="circle-star"></wa-icon>
|
||||
Filled + Outlined
|
||||
F+O
|
||||
</wa-callout>
|
||||
<wa-callout class="wa-brand" appearance="filled">
|
||||
<wa-icon slot="icon" name="circle-star"></wa-icon>
|
||||
@@ -293,13 +331,17 @@
|
||||
<th><code>neutral</code></th>
|
||||
<td>
|
||||
<div class="wa-grid wa-gap-2xs">
|
||||
<wa-callout variant="neutral" appearance="accent outlined">
|
||||
<wa-icon slot="icon" name="circle-info"></wa-icon>
|
||||
A+O
|
||||
</wa-callout>
|
||||
<wa-callout variant="neutral" appearance="accent">
|
||||
<wa-icon slot="icon" name="circle-info"></wa-icon>
|
||||
Accent
|
||||
</wa-callout>
|
||||
<wa-callout variant="neutral" appearance="filled outlined">
|
||||
<wa-icon slot="icon" name="circle-info"></wa-icon>
|
||||
Filled + Outlined
|
||||
F+O
|
||||
</wa-callout>
|
||||
<wa-callout variant="neutral" appearance="filled">
|
||||
<wa-icon slot="icon" name="circle-info"></wa-icon>
|
||||
@@ -317,13 +359,17 @@
|
||||
</td>
|
||||
<td>
|
||||
<div class="wa-grid wa-gap-2xs">
|
||||
<wa-callout class="wa-neutral" appearance="accent outlined">
|
||||
<wa-icon slot="icon" name="circle-info"></wa-icon>
|
||||
A+O
|
||||
</wa-callout>
|
||||
<wa-callout class="wa-neutral" appearance="accent">
|
||||
<wa-icon slot="icon" name="circle-info"></wa-icon>
|
||||
Accent
|
||||
</wa-callout>
|
||||
<wa-callout class="wa-neutral" appearance="filled outlined">
|
||||
<wa-icon slot="icon" name="circle-info"></wa-icon>
|
||||
Filled + Outlined
|
||||
F+O
|
||||
</wa-callout>
|
||||
<wa-callout class="wa-neutral" appearance="filled">
|
||||
<wa-icon slot="icon" name="circle-info"></wa-icon>
|
||||
@@ -344,13 +390,17 @@
|
||||
<th><code>success</code></th>
|
||||
<td>
|
||||
<div class="wa-grid wa-gap-2xs">
|
||||
<wa-callout variant="success" appearance="accent outlined">
|
||||
<wa-icon slot="icon" name="circle-check"></wa-icon>
|
||||
A+O
|
||||
</wa-callout>
|
||||
<wa-callout variant="success" appearance="accent">
|
||||
<wa-icon slot="icon" name="circle-check"></wa-icon>
|
||||
Accent
|
||||
</wa-callout>
|
||||
<wa-callout variant="success" appearance="filled outlined">
|
||||
<wa-icon slot="icon" name="circle-check"></wa-icon>
|
||||
Filled + Outlined
|
||||
F+O
|
||||
</wa-callout>
|
||||
<wa-callout variant="success" appearance="filled">
|
||||
<wa-icon slot="icon" name="circle-check"></wa-icon>
|
||||
@@ -368,13 +418,17 @@
|
||||
</td>
|
||||
<td>
|
||||
<div class="wa-grid wa-gap-2xs">
|
||||
<wa-callout class="wa-success" appearance="accent outlined">
|
||||
<wa-icon slot="icon" name="circle-check"></wa-icon>
|
||||
A+O
|
||||
</wa-callout>
|
||||
<wa-callout class="wa-success" appearance="accent">
|
||||
<wa-icon slot="icon" name="circle-check"></wa-icon>
|
||||
Accent
|
||||
</wa-callout>
|
||||
<wa-callout class="wa-success" appearance="filled outlined">
|
||||
<wa-icon slot="icon" name="circle-check"></wa-icon>
|
||||
Filled + Outlined
|
||||
F+O
|
||||
</wa-callout>
|
||||
<wa-callout class="wa-success" appearance="filled">
|
||||
<wa-icon slot="icon" name="circle-check"></wa-icon>
|
||||
@@ -395,13 +449,17 @@
|
||||
<th><code>warning</code></th>
|
||||
<td>
|
||||
<div class="wa-grid wa-gap-2xs">
|
||||
<wa-callout variant="warning" appearance="accent outlined">
|
||||
<wa-icon slot="icon" name="circle-exclamation"></wa-icon>
|
||||
A+O
|
||||
</wa-callout>
|
||||
<wa-callout variant="warning" appearance="accent">
|
||||
<wa-icon slot="icon" name="circle-exclamation"></wa-icon>
|
||||
Accent
|
||||
</wa-callout>
|
||||
<wa-callout variant="warning" appearance="filled outlined">
|
||||
<wa-icon slot="icon" name="circle-exclamation"></wa-icon>
|
||||
Filled + Outlined
|
||||
F+O
|
||||
</wa-callout>
|
||||
<wa-callout variant="warning" appearance="filled">
|
||||
<wa-icon slot="icon" name="circle-exclamation"></wa-icon>
|
||||
@@ -419,13 +477,17 @@
|
||||
</td>
|
||||
<td>
|
||||
<div class="wa-grid wa-gap-2xs">
|
||||
<wa-callout class="wa-warning" appearance="accent outlined">
|
||||
<wa-icon slot="icon" name="circle-exclamation"></wa-icon>
|
||||
A+O
|
||||
</wa-callout>
|
||||
<wa-callout class="wa-warning" appearance="accent">
|
||||
<wa-icon slot="icon" name="circle-exclamation"></wa-icon>
|
||||
Accent
|
||||
</wa-callout>
|
||||
<wa-callout class="wa-warning" appearance="filled outlined">
|
||||
<wa-icon slot="icon" name="circle-exclamation"></wa-icon>
|
||||
Filled + Outlined
|
||||
F+O
|
||||
</wa-callout>
|
||||
<wa-callout class="wa-warning" appearance="filled">
|
||||
<wa-icon slot="icon" name="circle-exclamation"></wa-icon>
|
||||
@@ -446,13 +508,17 @@
|
||||
<th><code>danger</code></th>
|
||||
<td>
|
||||
<div class="wa-grid wa-gap-2xs">
|
||||
<wa-callout variant="danger" appearance="accent outlined">
|
||||
<wa-icon slot="icon" name="circle-xmark"></wa-icon>
|
||||
A+O
|
||||
</wa-callout>
|
||||
<wa-callout variant="danger" appearance="accent">
|
||||
<wa-icon slot="icon" name="circle-xmark"></wa-icon>
|
||||
Accent
|
||||
</wa-callout>
|
||||
<wa-callout variant="danger" appearance="filled outlined">
|
||||
<wa-icon slot="icon" name="circle-xmark"></wa-icon>
|
||||
Filled + Outlined
|
||||
F+O
|
||||
</wa-callout>
|
||||
<wa-callout variant="danger" appearance="filled">
|
||||
<wa-icon slot="icon" name="circle-xmark"></wa-icon>
|
||||
@@ -470,13 +536,17 @@
|
||||
</td>
|
||||
<td>
|
||||
<div class="wa-grid wa-gap-2xs">
|
||||
<wa-callout class="wa-danger" appearance="accent outlined">
|
||||
<wa-icon slot="icon" name="circle-xmark"></wa-icon>
|
||||
A+O
|
||||
</wa-callout>
|
||||
<wa-callout class="wa-danger" appearance="accent">
|
||||
<wa-icon slot="icon" name="circle-xmark"></wa-icon>
|
||||
Accent
|
||||
</wa-callout>
|
||||
<wa-callout class="wa-danger" appearance="filled outlined">
|
||||
<wa-icon slot="icon" name="circle-xmark"></wa-icon>
|
||||
Filled + Outlined
|
||||
F+O
|
||||
</wa-callout>
|
||||
<wa-callout class="wa-danger" appearance="filled">
|
||||
<wa-icon slot="icon" name="circle-xmark"></wa-icon>
|
||||
@@ -512,8 +582,9 @@
|
||||
<th><code>brand</code></th>
|
||||
<td>
|
||||
<div class="wa-cluster wa-gap-2xs">
|
||||
<wa-tag variant="brand" appearance="accent outlined">A+O</wa-tag>
|
||||
<wa-tag variant="brand" appearance="accent">Accent</wa-tag>
|
||||
<wa-tag variant="brand" appearance="filled outlined">Filled + Outlined</wa-tag>
|
||||
<wa-tag variant="brand" appearance="filled outlined">F+O</wa-tag>
|
||||
<wa-tag variant="brand" appearance="filled">Filled</wa-tag>
|
||||
<wa-tag variant="brand" appearance="outlined">Outlined</wa-tag>
|
||||
<wa-tag variant="brand" appearance="plain">Plain</wa-tag>
|
||||
@@ -521,8 +592,9 @@
|
||||
</td>
|
||||
<td>
|
||||
<div class="wa-cluster wa-gap-2xs">
|
||||
<wa-tag class="wa-brand" appearance="accent outlined">A+O</wa-tag>
|
||||
<wa-tag class="wa-brand" appearance="accent">Accent</wa-tag>
|
||||
<wa-tag class="wa-brand" appearance="filled outlined">Filled + Outlined</wa-tag>
|
||||
<wa-tag class="wa-brand" appearance="filled outlined">F+O</wa-tag>
|
||||
<wa-tag class="wa-brand" appearance="filled">Filled</wa-tag>
|
||||
<wa-tag class="wa-brand" appearance="outlined">Outlined</wa-tag>
|
||||
<wa-tag class="wa-brand" appearance="plain">Plain</wa-tag>
|
||||
@@ -533,8 +605,9 @@
|
||||
<th><code>neutral</code></th>
|
||||
<td>
|
||||
<div class="wa-cluster wa-gap-2xs">
|
||||
<wa-tag variant="neutral" appearance="accent outlined">A+O</wa-tag>
|
||||
<wa-tag variant="neutral" appearance="accent">Accent</wa-tag>
|
||||
<wa-tag variant="neutral" appearance="filled outlined">Filled + Outlined</wa-tag>
|
||||
<wa-tag variant="neutral" appearance="filled outlined">F+O</wa-tag>
|
||||
<wa-tag variant="neutral" appearance="filled">Filled</wa-tag>
|
||||
<wa-tag variant="neutral" appearance="outlined">Outlined</wa-tag>
|
||||
<wa-tag variant="neutral" appearance="plain">Plain</wa-tag>
|
||||
@@ -542,8 +615,9 @@
|
||||
</td>
|
||||
<td>
|
||||
<div class="wa-cluster wa-gap-2xs">
|
||||
<wa-tag class="wa-neutral" appearance="accent outlined">A+O</wa-tag>
|
||||
<wa-tag class="wa-neutral" appearance="accent">Accent</wa-tag>
|
||||
<wa-tag class="wa-neutral" appearance="filled outlined">Filled + Outlined</wa-tag>
|
||||
<wa-tag class="wa-neutral" appearance="filled outlined">F+O</wa-tag>
|
||||
<wa-tag class="wa-neutral" appearance="filled">Filled</wa-tag>
|
||||
<wa-tag class="wa-neutral" appearance="outlined">Outlined</wa-tag>
|
||||
<wa-tag class="wa-neutral" appearance="plain">Plain</wa-tag>
|
||||
@@ -554,8 +628,9 @@
|
||||
<th><code>success</code></th>
|
||||
<td>
|
||||
<div class="wa-cluster wa-gap-2xs">
|
||||
<wa-tag variant="success" appearance="accent outlined">A+O</wa-tag>
|
||||
<wa-tag variant="success" appearance="accent">Accent</wa-tag>
|
||||
<wa-tag variant="success" appearance="filled outlined">Filled + Outlined</wa-tag>
|
||||
<wa-tag variant="success" appearance="filled outlined">F+O</wa-tag>
|
||||
<wa-tag variant="success" appearance="filled">Filled</wa-tag>
|
||||
<wa-tag variant="success" appearance="outlined">Outlined</wa-tag>
|
||||
<wa-tag variant="success" appearance="plain">Plain</wa-tag>
|
||||
@@ -563,8 +638,9 @@
|
||||
</td>
|
||||
<td>
|
||||
<div class="wa-cluster wa-gap-2xs">
|
||||
<wa-tag class="wa-success" appearance="accent outlined">A+O</wa-tag>
|
||||
<wa-tag class="wa-success" appearance="accent">Accent</wa-tag>
|
||||
<wa-tag class="wa-success" appearance="filled outlined">Filled + Outlined</wa-tag>
|
||||
<wa-tag class="wa-success" appearance="filled outlined">F+O</wa-tag>
|
||||
<wa-tag class="wa-success" appearance="filled">Filled</wa-tag>
|
||||
<wa-tag class="wa-success" appearance="outlined">Outlined</wa-tag>
|
||||
<wa-tag class="wa-success" appearance="plain">Plain</wa-tag>
|
||||
@@ -575,8 +651,9 @@
|
||||
<th><code>warning</code></th>
|
||||
<td>
|
||||
<div class="wa-cluster wa-gap-2xs">
|
||||
<wa-tag variant="warning" appearance="accent outlined">A+O</wa-tag>
|
||||
<wa-tag variant="warning" appearance="accent">Accent</wa-tag>
|
||||
<wa-tag variant="warning" appearance="filled outlined">Filled + Outlined</wa-tag>
|
||||
<wa-tag variant="warning" appearance="filled outlined">F+O</wa-tag>
|
||||
<wa-tag variant="warning" appearance="filled">Filled</wa-tag>
|
||||
<wa-tag variant="warning" appearance="outlined">Outlined</wa-tag>
|
||||
<wa-tag variant="warning" appearance="plain">Plain</wa-tag>
|
||||
@@ -584,8 +661,9 @@
|
||||
</td>
|
||||
<td>
|
||||
<div class="wa-cluster wa-gap-2xs">
|
||||
<wa-tag class="wa-warning" appearance="accent outlined">A+O</wa-tag>
|
||||
<wa-tag class="wa-warning" appearance="accent">Accent</wa-tag>
|
||||
<wa-tag class="wa-warning" appearance="filled outlined">Filled + Outlined</wa-tag>
|
||||
<wa-tag class="wa-warning" appearance="filled outlined">F+O</wa-tag>
|
||||
<wa-tag class="wa-warning" appearance="filled">Filled</wa-tag>
|
||||
<wa-tag class="wa-warning" appearance="outlined">Outlined</wa-tag>
|
||||
<wa-tag class="wa-warning" appearance="plain">Plain</wa-tag>
|
||||
@@ -596,8 +674,9 @@
|
||||
<th><code>danger</code></th>
|
||||
<td>
|
||||
<div class="wa-cluster wa-gap-2xs">
|
||||
<wa-tag variant="danger" appearance="accent outlined">A+O</wa-tag>
|
||||
<wa-tag variant="danger" appearance="accent">Accent</wa-tag>
|
||||
<wa-tag variant="danger" appearance="filled outlined">Filled + Outlined</wa-tag>
|
||||
<wa-tag variant="danger" appearance="filled outlined">F+O</wa-tag>
|
||||
<wa-tag variant="danger" appearance="filled">Filled</wa-tag>
|
||||
<wa-tag variant="danger" appearance="outlined">Outlined</wa-tag>
|
||||
<wa-tag variant="danger" appearance="plain">Plain</wa-tag>
|
||||
@@ -605,8 +684,9 @@
|
||||
</td>
|
||||
<td>
|
||||
<div class="wa-cluster wa-gap-2xs">
|
||||
<wa-tag class="wa-danger" appearance="accent outlined">A+O</wa-tag>
|
||||
<wa-tag class="wa-danger" appearance="accent">Accent</wa-tag>
|
||||
<wa-tag class="wa-danger" appearance="filled outlined">Filled + Outlined</wa-tag>
|
||||
<wa-tag class="wa-danger" appearance="filled outlined">F+O</wa-tag>
|
||||
<wa-tag class="wa-danger" appearance="filled">Filled</wa-tag>
|
||||
<wa-tag class="wa-danger" appearance="outlined">Outlined</wa-tag>
|
||||
<wa-tag class="wa-danger" appearance="plain">Plain</wa-tag>
|
||||
@@ -615,4 +695,4 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -40,6 +40,66 @@
|
||||
</div>
|
||||
<wa-divider></wa-divider>
|
||||
|
||||
<h3>Button Group</h3>
|
||||
|
||||
<div class="table-scroll">
|
||||
<table>
|
||||
<thead>
|
||||
<th></th>
|
||||
<th><code>size=""</code></th>
|
||||
<th><code>.wa-size-[s|m|l]</code></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><code>small</code>/<code>s</code></th>
|
||||
<td>
|
||||
<wa-button-group orientation="horizontal" size="small">
|
||||
<wa-button value="1">Button L</wa-button>
|
||||
<wa-button value="2">Button R</wa-button>
|
||||
</wa-button-group>
|
||||
</td>
|
||||
<td>
|
||||
<wa-button-group orientation="horizontal" class="wa-size-s">
|
||||
<wa-button value="1">Button L</wa-button>
|
||||
<wa-button value="2">Button R</wa-button>
|
||||
</wa-button-group>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><code>medium</code>/<code>m</code></th>
|
||||
<td>
|
||||
<wa-button-group orientation="horizontal" size="medium">
|
||||
<wa-button value="1">Button L</wa-button>
|
||||
<wa-button value="2">Button R</wa-button>
|
||||
</wa-button-group>
|
||||
</td>
|
||||
<td>
|
||||
<wa-button-group orientation="horizontal" class="wa-size-m">
|
||||
<wa-button value="1">Button L</wa-button>
|
||||
<wa-button value="2">Button R</wa-button>
|
||||
</wa-button-group>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><code>large</code>/<code>l</code></th>
|
||||
<td>
|
||||
<wa-button-group orientation="horizontal" size="large">
|
||||
<wa-button value="1">Button L</wa-button>
|
||||
<wa-button value="2">Button R</wa-button>
|
||||
</wa-button-group>
|
||||
</td>
|
||||
<td>
|
||||
<wa-button-group orientation="horizontal" class="wa-size-l">
|
||||
<wa-button value="1">Button L</wa-button>
|
||||
<wa-button value="2">Button R</wa-button>
|
||||
</wa-button-group>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<wa-divider></wa-divider>
|
||||
|
||||
<h3>Callout</h3>
|
||||
|
||||
<div class="table-scroll">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" data-fa-kit-code="38c11e3f20" data-cdn-url="{% cdnUrl %}">
|
||||
<html lang="en" data-fa-kit-code="b10bfbde90" data-cdn-url="{% cdnUrl %}">
|
||||
<head>
|
||||
{% include 'head.njk' %}
|
||||
{% block head %}{% endblock %}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<p>Learn more about <a href="/docs/usage/#slots">using slots</a>.</p>
|
||||
|
||||
<wa-scroller>
|
||||
<table class="component-table wa-hover-rows">
|
||||
<table class="component-table">
|
||||
<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 wa-hover-rows">
|
||||
<table class="component-table">
|
||||
<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 wa-hover-rows">
|
||||
<table class="component-table">
|
||||
<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 wa-hover-rows">
|
||||
<table class="component-table">
|
||||
<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 wa-hover-rows">
|
||||
<table class="component-table">
|
||||
<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 wa-hover-rows">
|
||||
<table class="component-table">
|
||||
<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 wa-hover-rows">
|
||||
<table class="component-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="table-name">Name</th>
|
||||
@@ -264,9 +264,6 @@
|
||||
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>
|
||||
@@ -275,20 +272,19 @@
|
||||
<p>
|
||||
To manually import this component from the CDN, use the following code.
|
||||
</p>
|
||||
|
||||
<pre><code class="language-js">import '{% cdnUrl componentPath %}';</code></pre>
|
||||
<pre><code class="language-js">import '{% cdnUrl component.path %}';</code></pre>
|
||||
</wa-tab-panel>
|
||||
<wa-tab-panel name="npm">
|
||||
<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>
|
||||
Coming soon!
|
||||
</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 {{ component.name }} from '@awesome.me/webawesome/dist/react/{{ componentName }}';</code></pre>
|
||||
<pre><code class="language-js">import '@shoelace-style/webawesome/react/{{ component.tagName | stripPrefix }}';</code></pre>
|
||||
#}
|
||||
</wa-tab-panel>
|
||||
</wa-tab-group>
|
||||
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
{% set hasSidebar = true %}
|
||||
{% set hasOutline = true %}
|
||||
{% set section = 'docs' %}
|
||||
|
||||
{% block beforeContent %}
|
||||
<p>{{ description }}</p>
|
||||
{% endblock %}
|
||||
{% extends "../_includes/base.njk" %}
|
||||
@@ -1,81 +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 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);
|
||||
});
|
||||
};
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
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);
|
||||
});
|
||||
};
|
||||
}
|
||||
@@ -1,64 +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 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);
|
||||
}
|
||||
};
|
||||
}
|
||||
85
packages/webawesome/docs/_utils/anchor-headings.js
Normal file
85
packages/webawesome/docs/_utils/anchor-headings.js
Normal file
@@ -0,0 +1,85 @@
|
||||
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();
|
||||
});
|
||||
};
|
||||
}
|
||||
@@ -1,51 +1,43 @@
|
||||
import { parse } from 'node-html-parser';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import { copyCode } from './copy-code.js';
|
||||
import { highlightCode } from './highlight-code.js';
|
||||
import { markdown } from '../_utils/markdown.js';
|
||||
|
||||
/**
|
||||
* Eleventy plugin to turn `<code class="example">` blocks into live examples.
|
||||
*/
|
||||
export function codeExamplesTransformer(options = {}) {
|
||||
export function codeExamplesPlugin(options = {}) {
|
||||
options = {
|
||||
container: 'body',
|
||||
...options,
|
||||
};
|
||||
|
||||
return function (doc) {
|
||||
const container = doc.querySelector(options.container);
|
||||
return function (eleventyConfig) {
|
||||
eleventyConfig.addTransform('code-examples', content => {
|
||||
const doc = parse(content, { blockTextElements: { code: true } });
|
||||
const container = doc.querySelector(options.container);
|
||||
|
||||
if (!container) {
|
||||
return;
|
||||
}
|
||||
if (!container) {
|
||||
return content;
|
||||
}
|
||||
|
||||
// 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;
|
||||
// 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;
|
||||
|
||||
const langClass = [...code.classList.values()].find(val => val.startsWith('language-'));
|
||||
const lang = langClass ? langClass.replace(/^language-/, '') : 'plain';
|
||||
// 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();
|
||||
|
||||
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(`
|
||||
const codeExample = parse(`
|
||||
<div class="code-example ${isOpen ? 'open' : ''}">
|
||||
<div class="code-example-preview">
|
||||
<div>
|
||||
${preview}
|
||||
</div>
|
||||
${preview}
|
||||
<div class="code-example-resizer" aria-hidden="true">
|
||||
<wa-icon name="grip-lines-vertical"></wa-icon>
|
||||
</div>
|
||||
@@ -85,7 +77,10 @@ export function codeExamplesTransformer(options = {}) {
|
||||
</div>
|
||||
`);
|
||||
|
||||
pre.replaceWith(codeExample);
|
||||
pre.replaceWith(codeExample);
|
||||
});
|
||||
|
||||
return doc.toString();
|
||||
});
|
||||
};
|
||||
}
|
||||
41
packages/webawesome/docs/_utils/copy-code.js
Normal file
41
packages/webawesome/docs/_utils/copy-code.js
Normal file
@@ -0,0 +1,41 @@
|
||||
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();
|
||||
});
|
||||
}
|
||||
@@ -24,25 +24,30 @@ function normalize(pathname) {
|
||||
/**
|
||||
* Eleventy plugin to decorate current links with a custom class.
|
||||
*/
|
||||
export function currentLinkTransformer(options = {}) {
|
||||
export function currentLink(options = {}) {
|
||||
options = {
|
||||
container: 'body',
|
||||
className: 'current',
|
||||
...options,
|
||||
};
|
||||
|
||||
return function (doc) {
|
||||
const container = doc.querySelector(options.container);
|
||||
return function (eleventyConfig) {
|
||||
eleventyConfig.addTransform('current-link', function (content) {
|
||||
const doc = parse(content);
|
||||
const container = doc.querySelector(options.container);
|
||||
|
||||
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);
|
||||
if (!container) {
|
||||
return content;
|
||||
}
|
||||
|
||||
// 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();
|
||||
});
|
||||
};
|
||||
}
|
||||
@@ -37,31 +37,36 @@ 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 highlightCodeTransformer(options = {}) {
|
||||
export function highlightCodePlugin(options = {}) {
|
||||
options = {
|
||||
container: 'body',
|
||||
...options,
|
||||
};
|
||||
|
||||
return function (doc) {
|
||||
const container = doc.querySelector(options.container);
|
||||
return function (eleventyConfig) {
|
||||
eleventyConfig.addTransform('highlight-code', content => {
|
||||
const doc = parse(content, { blockTextElements: { code: true } });
|
||||
const container = doc.querySelector(options.container);
|
||||
|
||||
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';
|
||||
|
||||
try {
|
||||
code.innerHTML = highlightCode(code.textContent ?? '', lang);
|
||||
} catch (err) {
|
||||
if (!options.ignoreMissingLangs) {
|
||||
throw new Error(err.message);
|
||||
}
|
||||
if (!container) {
|
||||
return content;
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return doc.toString();
|
||||
});
|
||||
};
|
||||
}
|
||||
69
packages/webawesome/docs/_utils/outline.js
Normal file
69
packages/webawesome/docs/_utils/outline.js
Normal file
@@ -0,0 +1,69 @@
|
||||
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();
|
||||
});
|
||||
};
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
/* 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';
|
||||
@@ -24,22 +23,19 @@ export function searchPlugin(options = {}) {
|
||||
...options,
|
||||
};
|
||||
|
||||
// Hoist above so that it can "cache" properly for incremental builds.
|
||||
return function (eleventyConfig) {
|
||||
let pagesToIndex = new Map();
|
||||
const 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, true);
|
||||
pagesToIndex.set(data.page.inputPath, {});
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -71,30 +67,11 @@ export function searchPlugin(options = {}) {
|
||||
return content;
|
||||
});
|
||||
|
||||
eleventyConfig.on('eleventy.after', async ({ directories }) => {
|
||||
eleventyConfig.on('eleventy.after', ({ 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 = [];
|
||||
|
||||
getCachedPages();
|
||||
const searchIndex = lunr(function () {
|
||||
const searchIndex = lunr(async function () {
|
||||
let index = 0;
|
||||
|
||||
this.ref('id');
|
||||
@@ -107,11 +84,9 @@ 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));
|
||||
});
|
||||
};
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
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: '',
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -56,8 +56,10 @@ document.addEventListener('click', event => {
|
||||
const code = codeExample.querySelector('code');
|
||||
const cdnUrl = document.documentElement.dataset.cdnUrl;
|
||||
const html =
|
||||
`<script data-fa-kit-code="38c11e3f20" type="module" src="${cdnUrl}webawesome.loader.js"></script>\n` +
|
||||
`<link rel="stylesheet" href="${cdnUrl}styles/webawesome.css">\n\n` +
|
||||
`<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` +
|
||||
`${code.textContent}`;
|
||||
const css = 'html > body {\n padding: 2rem !important;\n}';
|
||||
const js = '';
|
||||
|
||||
@@ -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-content-spacing);
|
||||
margin-block-end: var(--wa-flow-spacing);
|
||||
isolation: isolate;
|
||||
}
|
||||
|
||||
@@ -100,8 +100,8 @@
|
||||
.code-example-buttons {
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
background: var(--wa-color-surface-default);
|
||||
color: var(--wa-color-text-quiet);
|
||||
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 */
|
||||
border-bottom-left-radius: inherit;
|
||||
border-bottom-right-radius: inherit;
|
||||
|
||||
@@ -116,6 +116,14 @@
|
||||
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);
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/* Only code blocks generated by our docs get these styles */
|
||||
pre[id*='code-block-'] {
|
||||
color-scheme: dark;
|
||||
background-color: var(--wa-color-gray-20);
|
||||
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 */
|
||||
|
||||
@@ -25,11 +25,6 @@ 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;
|
||||
@@ -50,3 +45,19 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,10 @@ 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);
|
||||
@@ -69,33 +73,7 @@ wa-page > header {
|
||||
#docs-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
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);
|
||||
}
|
||||
gap: var(--wa-space-xs);
|
||||
}
|
||||
|
||||
#version-number {
|
||||
@@ -108,6 +86,14 @@ 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,
|
||||
@@ -144,8 +130,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);
|
||||
padding-inline-start: var(--wa-space-m);
|
||||
margin: 0;
|
||||
padding-inline-start: var(--wa-space-m);
|
||||
}
|
||||
|
||||
ul ul {
|
||||
@@ -158,7 +144,6 @@ wa-page > header {
|
||||
|
||||
li {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
|
||||
+ li {
|
||||
margin-block-start: var(--wa-space-m);
|
||||
@@ -257,12 +242,6 @@ wa-button.delete {
|
||||
}
|
||||
}
|
||||
|
||||
[slot='navigation-header'] {
|
||||
wa-select::part(listbox) {
|
||||
font-weight: var(--wa-font-weight-normal);
|
||||
}
|
||||
}
|
||||
|
||||
#sidebar-close-button {
|
||||
display: none;
|
||||
}
|
||||
@@ -311,7 +290,7 @@ h1.title {
|
||||
gap: var(--wa-space-xs);
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
margin-block-end: var(--wa-content-spacing);
|
||||
margin-block-end: var(--wa-flow-spacing);
|
||||
|
||||
code {
|
||||
line-height: var(--wa-line-height-condensed);
|
||||
@@ -354,7 +333,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-content-spacing);
|
||||
margin-block-end: var(--wa-flow-spacing);
|
||||
|
||||
:first-child {
|
||||
margin-block-start: 0;
|
||||
@@ -400,23 +379,6 @@ 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) {
|
||||
text-align: start;
|
||||
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;
|
||||
@@ -622,6 +584,12 @@ 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);
|
||||
@@ -662,7 +630,7 @@ wa-scroller:has(.component-table) {
|
||||
}
|
||||
|
||||
/** desktop */
|
||||
@media screen and not (max-width: 1180px) {
|
||||
@media screen and not (max-width: 768px) {
|
||||
/* Navigation sidebar */
|
||||
wa-page::part(navigation) {
|
||||
border-right: var(--wa-border-style) var(--wa-panel-border-width) var(--wa-color-surface-border);
|
||||
|
||||
@@ -15,12 +15,47 @@ category: Actions
|
||||
|
||||
## Examples
|
||||
|
||||
### Button Sizes
|
||||
|
||||
Unless otherwise specified,
|
||||
the size of [buttons](/docs/components/button) will be determined by the Button Group's `size` attribute.
|
||||
|
||||
```html {.example}
|
||||
<wa-button-group size="small" label="Alignment">
|
||||
<wa-button>Left</wa-button>
|
||||
<wa-button>Center</wa-button>
|
||||
<wa-button>Right</wa-button>
|
||||
</wa-button-group>
|
||||
|
||||
<br /><br />
|
||||
|
||||
<wa-button-group size="medium" label="Alignment">
|
||||
<wa-button>Left</wa-button>
|
||||
<wa-button>Center</wa-button>
|
||||
<wa-button>Right</wa-button>
|
||||
</wa-button-group>
|
||||
|
||||
<br /><br />
|
||||
|
||||
<wa-button-group size="large" label="Alignment">
|
||||
<wa-button>Left</wa-button>
|
||||
<wa-button>Center</wa-button>
|
||||
<wa-button>Right</wa-button>
|
||||
</wa-button-group>
|
||||
```
|
||||
|
||||
:::info
|
||||
While you can still set the size of [buttons](/docs/components/button) individually,
|
||||
and it will override the inherited size,
|
||||
it is rarely a good idea to mix sizes within the same button group.
|
||||
:::
|
||||
|
||||
### Vertical Button Groups
|
||||
|
||||
Set the `orientation` attribute to `vertical` to make a vertical button group.
|
||||
|
||||
```html {.example}
|
||||
<wa-button-group orientation="vertical" label="Options">
|
||||
<wa-button-group orientation="vertical" label="Options" style="max-width: 120px;">
|
||||
<wa-button>
|
||||
<wa-icon slot="start" name="plus"></wa-icon>
|
||||
New
|
||||
|
||||
@@ -251,4 +251,4 @@ This example demonstrates how to style buttons using a custom class. This is the
|
||||
outline-offset: 4px;
|
||||
}
|
||||
</style>
|
||||
```
|
||||
```
|
||||
|
||||
@@ -56,12 +56,10 @@ 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 -->
|
||||
<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>
|
||||
<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>
|
||||
|
||||
<br />
|
||||
<br /><br />
|
||||
|
||||
<!-- Copies the link's "href" attribute -->
|
||||
<a id="my-link" href="https://shoelace.style/">Web Awesome Website</a>
|
||||
@@ -90,7 +88,6 @@ 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>
|
||||
```
|
||||
@@ -135,4 +132,4 @@ You can customize the button to your liking with CSS.
|
||||
outline-offset: 4px;
|
||||
}
|
||||
</style>
|
||||
```
|
||||
```
|
||||
|
||||
@@ -48,23 +48,6 @@ Use the `expand-icon` and `collapse-icon` slots to change the expand and collaps
|
||||
</style>
|
||||
```
|
||||
|
||||
### Icon Position
|
||||
|
||||
The default position for the expand and collapse icons is at the end of the summary. Set the `icon-placement` attribute to `start` to place the icon at the start of the summary.
|
||||
|
||||
```html {.example}
|
||||
<div class="wa-stack">
|
||||
<wa-details summary="Start" icon-placement="start">
|
||||
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="End" icon-placement="end">
|
||||
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>
|
||||
</div>
|
||||
```
|
||||
|
||||
### HTML in Summary
|
||||
|
||||
To use HTML in the summary, use the `summary` slot.
|
||||
@@ -85,17 +68,12 @@ Links and other interactive elements will still retain their behavior:
|
||||
|
||||
### Right-to-Left Languages
|
||||
|
||||
The details component, including its `icon-placement`, automatically adapts to right-to-left languages:
|
||||
The details component automatically adapts to right-to-left languages:
|
||||
|
||||
```html {.example}
|
||||
<div class="wa-stack">
|
||||
<wa-details summary="تبديلني" lang="ar" dir="rtl">
|
||||
استخدام طريقة لوريم إيبسوم لأنها تعطي توزيعاَ طبيعياَ -إلى حد ما- للأحرف عوضاً عن
|
||||
</wa-details>
|
||||
<wa-details summary="تبديلني" lang="ar" dir="rtl" icon-placement="start">
|
||||
استخدام طريقة لوريم إيبسوم لأنها تعطي توزيعاَ طبيعياَ -إلى حد ما- للأحرف عوضاً عن
|
||||
</wa-details>
|
||||
</div>
|
||||
<wa-details summary="تبديلني" lang="ar" dir="rtl">
|
||||
استخدام طريقة لوريم إيبسوم لأنها تعطي توزيعاَ طبيعياَ -إلى حد ما- للأحرف عوضاً عن
|
||||
</wa-details>
|
||||
```
|
||||
|
||||
### Appearance
|
||||
@@ -108,11 +86,11 @@ Use the `appearance` attribute to change the element’s 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 + 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>
|
||||
<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>
|
||||
|
||||
@@ -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">
|
||||
@@ -273,10 +273,10 @@ The distance from the panel to the trigger can be customized using the `distance
|
||||
|
||||
### Offset
|
||||
|
||||
The offset of the panel along the trigger can be customized using the `skidding` attribute. This value is specified in pixels.
|
||||
The offset of the panel along the trigger can be customized using the `offset` attribute. This value is specified in pixels.
|
||||
|
||||
```html {.example}
|
||||
<wa-dropdown skidding="30">
|
||||
<wa-dropdown offset="30">
|
||||
<wa-button slot="trigger" with-caret>Edit</wa-button>
|
||||
|
||||
<wa-dropdown-item>Cut</wa-dropdown-item>
|
||||
|
||||
@@ -7,10 +7,6 @@ category: Imagery
|
||||
|
||||
Web Awesome comes bundled with over 2,000 free icons courtesy of [Font Awesome](https://fontawesome.com/). These icons are part of the `default` icon library. Font Awesome Pro users can unlock additional icon families. Or, if you prefer, you can register your own [custom icon library](#icon-library).
|
||||
|
||||
```html {.example}
|
||||
<wa-icon name="face-awesome" variant="light" label="Awesome" style="font-size: 2em;"></wa-icon>
|
||||
```
|
||||
|
||||
:::info
|
||||
Not sure which icon to use? [Find the perfect icon over at Font Awesome!](https://fontawesome.com/search?o=r&m=free&f=brands%2Cclassic)
|
||||
:::
|
||||
@@ -21,66 +17,45 @@ Not sure which icon to use? [Find the perfect icon over at Font Awesome!](https:
|
||||
|
||||
The default icon library is Font Awesome Free, which comes with two icon families: `classic` and `brands`. Use the `family` attribute to set the icon family.
|
||||
|
||||
Many Font Awesome Pro icon families have variants such as `thin`, `light`, `regular`, and `solid`. Font Awesome Pro users can [provide their kit code](/docs/#using-font-awesome-kit-codes) to unlock additional premium icon families, including `sharp`, `duotone`, `sharp-duotone`, and additional Pro+ icon packs.
|
||||
|
||||
For supportive icon families, use the `variant` attribute to set the variant.
|
||||
Many Font Awesome Pro icon families have variants such as `thin`, `light`, `regular`, and `solid`. Font Awesome Pro users can [provide their kit code](/docs/#using-font-awesome-kit-codes) to unlock additional families, including `sharp`, `duotone`, and `sharp-duotone`. For these icon families, use the `variant` attribute to set the variant.
|
||||
|
||||
```html {.example}
|
||||
<div class="wa-stack wa-gap-xl">
|
||||
<div class="wa-flank" style="--flank-size: 12ch;">
|
||||
<span>Classic</span>
|
||||
<div class="wa-cluster" style="font-size: 1.5em;">
|
||||
<wa-icon name="eyedropper"></wa-icon>
|
||||
<wa-icon variant="regular" name="grip-vertical"></wa-icon>
|
||||
<wa-icon variant="light" name="play"></wa-icon>
|
||||
<wa-icon variant="thin" name="star"></wa-icon>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wa-flank" style="--flank-size: 12ch;">
|
||||
<span>Duotone</span>
|
||||
<div class="wa-cluster" style="font-size: 1.5em;">
|
||||
<wa-icon family="duotone" name="eyedropper"></wa-icon>
|
||||
<wa-icon family="duotone" variant="regular" name="grip-vertical"></wa-icon>
|
||||
<wa-icon family="duotone" variant="light" name="play"></wa-icon>
|
||||
<wa-icon family="duotone" variant="thin" name="star"></wa-icon>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wa-flank" style="--flank-size: 12ch;">
|
||||
<span>Sharp</span>
|
||||
<div class="wa-cluster" style="font-size: 1.5em;">
|
||||
<wa-icon family="sharp" name="eyedropper"></wa-icon>
|
||||
<wa-icon family="sharp" variant="regular" name="grip-vertical"></wa-icon>
|
||||
<wa-icon family="sharp" variant="light" name="play"></wa-icon>
|
||||
<wa-icon family="sharp" variant="thin" name="star"></wa-icon>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wa-flank" style="--flank-size: 12ch;">
|
||||
<span>Sharp Duotone</span>
|
||||
<div class="wa-cluster" style="font-size: 1.5em;">
|
||||
<wa-icon family="sharp-duotone" name="eyedropper"></wa-icon>
|
||||
<wa-icon family="sharp-duotone" variant="regular" name="grip-vertical"></wa-icon>
|
||||
<wa-icon family="sharp-duotone" variant="light" name="play"></wa-icon>
|
||||
<wa-icon family="sharp-duotone" variant="thin" name="star"></wa-icon>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wa-flank" style="--flank-size: 12ch;">
|
||||
<span>Brands</span>
|
||||
<div class="wa-cluster" style="font-size: 1.5em;">
|
||||
<wa-icon family="brands" name="font-awesome"></wa-icon>
|
||||
<wa-icon family="brands" name="web-awesome"></wa-icon>
|
||||
<wa-icon family="brands" name="github"></wa-icon>
|
||||
<wa-icon family="brands" name="discord"></wa-icon>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<wa-icon name="eyedropper"></wa-icon>
|
||||
<wa-icon name="grip-vertical"></wa-icon>
|
||||
<wa-icon name="play"></wa-icon>
|
||||
<wa-icon name="star"></wa-icon>
|
||||
<wa-icon name="user"></wa-icon>
|
||||
```
|
||||
|
||||
### Labels
|
||||
### Colors
|
||||
|
||||
For non-decorative icons, use the `label` attribute to announce it to assistive devices.
|
||||
Icons inherit their color from the current text color. Thus, you can set the `color` property on the `<wa-icon>` element or an ancestor to change the color.
|
||||
|
||||
```html {.example}
|
||||
<wa-icon name="star" label="Favorite" style="font-size: 1.5em;"></wa-icon>
|
||||
<div style="color: #4a90e2;">
|
||||
<wa-icon name="exclamation-triangle"></wa-icon>
|
||||
<wa-icon name="archive"></wa-icon>
|
||||
<wa-icon name="battery-three-quarters"></wa-icon>
|
||||
<wa-icon name="bell"></wa-icon>
|
||||
</div>
|
||||
<div style="color: #9013fe;">
|
||||
<wa-icon name="clock"></wa-icon>
|
||||
<wa-icon name="cloud"></wa-icon>
|
||||
<wa-icon name="download"></wa-icon>
|
||||
<wa-icon name="file"></wa-icon>
|
||||
</div>
|
||||
<div style="color: #417505;">
|
||||
<wa-icon name="flag"></wa-icon>
|
||||
<wa-icon name="heart"></wa-icon>
|
||||
<wa-icon name="image"></wa-icon>
|
||||
<wa-icon name="bolt-lightning"></wa-icon>
|
||||
</div>
|
||||
<div style="color: #f5a623;">
|
||||
<wa-icon name="microphone"></wa-icon>
|
||||
<wa-icon name="search"></wa-icon>
|
||||
<wa-icon name="star"></wa-icon>
|
||||
<wa-icon name="trash"></wa-icon>
|
||||
</div>
|
||||
```
|
||||
|
||||
### Sizing
|
||||
@@ -88,7 +63,7 @@ For non-decorative icons, use the `label` attribute to announce it to assistive
|
||||
Icons are sized relative to the current font size. To change their size, set the `font-size` property on the icon itself or on a parent element as shown below.
|
||||
|
||||
```html {.example}
|
||||
<div class="wa-cluster" style="font-size: 44px;">
|
||||
<div style="font-size: 32px;">
|
||||
<wa-icon name="bell"></wa-icon>
|
||||
<wa-icon name="heart"></wa-icon>
|
||||
<wa-icon name="image"></wa-icon>
|
||||
@@ -98,317 +73,27 @@ Icons are sized relative to the current font size. To change their size, set the
|
||||
</div>
|
||||
```
|
||||
|
||||
### Auto Width
|
||||
### Fixed Width Icons
|
||||
|
||||
By default, icons have a 1em height and a fixed 1em width. Use the `auto-width` attribute to allow the icon to use its natural variable width.
|
||||
By default, icons have a 1em height and a variable width. Use the `fixed-width` attribute to render the host element in a 1em by 1em box.
|
||||
|
||||
```html {.example}
|
||||
Without auto-width<br />
|
||||
<div style="font-size: 1.5em; color: #193154;">
|
||||
<wa-icon family="solid" name="exclamation" style="background: lightsalmon;"></wa-icon>
|
||||
<wa-icon family="solid" name="circle-check" style="background: lightsalmon;"></wa-icon>
|
||||
<wa-icon family="solid" name="input-numeric" style="background: lightsalmon;"></wa-icon>
|
||||
<wa-icon family="solid" name="ruler-vertical" style="background: lightsalmon;"></wa-icon>
|
||||
<wa-icon family="solid" name="ruler-horizontal" style="background: lightsalmon;"></wa-icon>
|
||||
<wa-icon family="solid" name="airplay" style="background: lightsalmon;"></wa-icon>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
|
||||
With auto-width<br />
|
||||
<div style="font-size: 1.5em; color: #193154;">
|
||||
<wa-icon auto-width family="solid" name="exclamation" style="background: lightsalmon;"></wa-icon>
|
||||
<wa-icon auto-width family="solid" name="circle-check" style="background: lightsalmon;"></wa-icon>
|
||||
<wa-icon auto-width family="solid" name="input-numeric" style="background: lightsalmon;"></wa-icon>
|
||||
<wa-icon auto-width family="solid" name="ruler-vertical" style="background: lightsalmon;"></wa-icon>
|
||||
<wa-icon auto-width family="solid" name="ruler-horizontal" style="background: lightsalmon;"></wa-icon>
|
||||
<wa-icon auto-width family="solid" name="airplay" style="background: lightsalmon;"></wa-icon>
|
||||
</div>
|
||||
<wa-icon fixed-width name="cloud"></wa-icon>
|
||||
<wa-icon fixed-width name="user"></wa-icon>
|
||||
<wa-icon fixed-width name="truck"></wa-icon>
|
||||
<wa-icon fixed-width name="file"></wa-icon>
|
||||
<wa-icon fixed-width name="skating"></wa-icon>
|
||||
<wa-icon fixed-width name="snowplow"></wa-icon>
|
||||
```
|
||||
|
||||
### Colors
|
||||
### Labels
|
||||
|
||||
Icons inherit their color from the current text color. Thus, you can set the `color` property on the `<wa-icon>` element or an ancestor to change the color.
|
||||
For non-decorative icons, use the `label` attribute to announce it to assistive devices.
|
||||
|
||||
```html {.example}
|
||||
<div class="wa-cluster" style="font-size: 1.5em;">
|
||||
<wa-icon name="strawberry" style="color: salmon;"></wa-icon>
|
||||
<wa-icon name="crab" style="color: coral;"></wa-icon>
|
||||
<wa-icon name="sun" style="color: gold;"></wa-icon>
|
||||
<wa-icon name="leaf" style="color: mediumseagreen;"></wa-icon>
|
||||
<wa-icon name="cloud-showers-heavy" style="color: steelblue;"></wa-icon>
|
||||
<wa-icon name="cat-space" style="color: mediumpurple;"></wa-icon>
|
||||
</div>
|
||||
<wa-icon name="star" label="Add to favorites"></wa-icon>
|
||||
```
|
||||
|
||||
### Duotone
|
||||
|
||||
Font Awesome's [Duotone icons](https://docs.fontawesome.com/web/style/duotone) change with the `color` property as well, but you can customize the primary and secondary colors independently using the `--primary-color` and `--secondary-color` custom properties. To change the opacity of either, use `--primary-opacity` and `--secondary-opacity`.
|
||||
|
||||
Note that these custom properties will not inherit and _must be applied directly to the icon_.
|
||||
|
||||
```html {.example}
|
||||
<div class="wa-stack">
|
||||
<div class="wa-cluster" style="font-size: 1.5em;">
|
||||
<wa-icon
|
||||
family="duotone"
|
||||
name="crow"
|
||||
style="--primary-color: dodgerblue; --secondary-color: gold; --secondary-opacity: 1.0;"
|
||||
></wa-icon>
|
||||
<wa-icon
|
||||
family="duotone"
|
||||
name="campfire"
|
||||
style="--primary-color: sienna; --secondary-color: red; --secondary-opacity: 1.0;"
|
||||
></wa-icon>
|
||||
<wa-icon
|
||||
family="duotone"
|
||||
name="birthday-cake"
|
||||
style="--primary-color: pink; --secondary-color: palevioletred; --secondary-opacity: 1.0;"
|
||||
></wa-icon>
|
||||
<wa-icon
|
||||
family="duotone"
|
||||
name="ear"
|
||||
style="--primary-color: sandybrown; --secondary-color: bisque; --secondary-opacity: 1.0;"
|
||||
></wa-icon>
|
||||
<wa-icon
|
||||
family="duotone"
|
||||
name="corn"
|
||||
style="--primary-color: mediumseagreen; --secondary-color: gold; --secondary-opacity: 1.0;"
|
||||
></wa-icon>
|
||||
<wa-icon
|
||||
family="duotone"
|
||||
name="cookie-bite"
|
||||
style="--primary-color: saddlebrown; --secondary-color: burlywood; --secondary-opacity: 1.0;"
|
||||
></wa-icon>
|
||||
</div>
|
||||
|
||||
<div class="wa-cluster" style="font-size: 1.5em;">
|
||||
<wa-icon
|
||||
family="duotone"
|
||||
variant="regular"
|
||||
name="crow"
|
||||
style="--primary-color: dodgerblue; --secondary-color: gold; --secondary-opacity: 1.0;"
|
||||
></wa-icon>
|
||||
<wa-icon
|
||||
family="duotone"
|
||||
variant="regular"
|
||||
name="campfire"
|
||||
style="--primary-color: sienna; --secondary-color: red; --secondary-opacity: 1.0;"
|
||||
></wa-icon>
|
||||
<wa-icon
|
||||
family="duotone"
|
||||
variant="regular"
|
||||
name="birthday-cake"
|
||||
style="--primary-color: pink; --secondary-color: palevioletred; --secondary-opacity: 1.0;"
|
||||
></wa-icon>
|
||||
<wa-icon
|
||||
family="duotone"
|
||||
variant="regular"
|
||||
name="ear"
|
||||
style="--primary-color: sandybrown; --secondary-color: bisque; --secondary-opacity: 1.0;"
|
||||
></wa-icon>
|
||||
<wa-icon
|
||||
family="duotone"
|
||||
variant="regular"
|
||||
name="corn"
|
||||
style="--primary-color: mediumseagreen; --secondary-color: gold; --secondary-opacity: 1.0;"
|
||||
></wa-icon>
|
||||
<wa-icon
|
||||
family="duotone"
|
||||
variant="regular"
|
||||
name="cookie-bite"
|
||||
style="--primary-color: saddlebrown; --secondary-color: burlywood; --secondary-opacity: 1.0;"
|
||||
></wa-icon>
|
||||
</div>
|
||||
|
||||
<div class="wa-cluster" style="font-size: 1.5em;">
|
||||
<wa-icon
|
||||
family="duotone"
|
||||
variant="light"
|
||||
name="crow"
|
||||
style="--primary-color: dodgerblue; --secondary-color: gold; --secondary-opacity: 1.0;"
|
||||
></wa-icon>
|
||||
<wa-icon
|
||||
family="duotone"
|
||||
variant="light"
|
||||
name="campfire"
|
||||
style="--primary-color: sienna; --secondary-color: red; --secondary-opacity: 1.0;"
|
||||
></wa-icon>
|
||||
<wa-icon
|
||||
family="duotone"
|
||||
variant="light"
|
||||
name="birthday-cake"
|
||||
style="--primary-color: pink; --secondary-color: palevioletred; --secondary-opacity: 1.0;"
|
||||
></wa-icon>
|
||||
<wa-icon
|
||||
family="duotone"
|
||||
variant="light"
|
||||
name="ear"
|
||||
style="--primary-color: sandybrown; --secondary-color: bisque; --secondary-opacity: 1.0;"
|
||||
></wa-icon>
|
||||
<wa-icon
|
||||
family="duotone"
|
||||
variant="light"
|
||||
name="corn"
|
||||
style="--primary-color: mediumseagreen; --secondary-color: gold; --secondary-opacity: 1.0;"
|
||||
></wa-icon>
|
||||
<wa-icon
|
||||
family="duotone"
|
||||
variant="light"
|
||||
name="cookie-bite"
|
||||
style="--primary-color: saddlebrown; --secondary-color: burlywood; --secondary-opacity: 1.0;"
|
||||
></wa-icon>
|
||||
</div>
|
||||
|
||||
<div class="wa-cluster" style="font-size: 1.5em;">
|
||||
<wa-icon
|
||||
family="duotone"
|
||||
variant="thin"
|
||||
name="crow"
|
||||
style="--primary-color: dodgerblue; --secondary-color: gold; --secondary-opacity: 1.0;"
|
||||
></wa-icon>
|
||||
<wa-icon
|
||||
family="duotone"
|
||||
variant="thin"
|
||||
name="campfire"
|
||||
style="--primary-color: sienna; --secondary-color: red; --secondary-opacity: 1.0;"
|
||||
></wa-icon>
|
||||
<wa-icon
|
||||
family="duotone"
|
||||
variant="thin"
|
||||
name="birthday-cake"
|
||||
style="--primary-color: pink; --secondary-color: palevioletred; --secondary-opacity: 1.0;"
|
||||
></wa-icon>
|
||||
<wa-icon
|
||||
family="duotone"
|
||||
variant="thin"
|
||||
name="ear"
|
||||
style="--primary-color: sandybrown; --secondary-color: bisque; --secondary-opacity: 1.0;"
|
||||
></wa-icon>
|
||||
<wa-icon
|
||||
family="duotone"
|
||||
variant="thin"
|
||||
name="corn"
|
||||
style="--primary-color: mediumseagreen; --secondary-color: gold; --secondary-opacity: 1.0;"
|
||||
></wa-icon>
|
||||
<wa-icon
|
||||
family="duotone"
|
||||
variant="thin"
|
||||
name="cookie-bite"
|
||||
style="--primary-color: saddlebrown; --secondary-color: burlywood; --secondary-opacity: 1.0;"
|
||||
></wa-icon>
|
||||
</div>
|
||||
</div>
|
||||
```
|
||||
|
||||
:::info
|
||||
Duotone icons can be unlocked by [providing a valid Font Awesome kit code](/docs/#using-font-awesome-kit-codes).
|
||||
:::
|
||||
|
||||
### Swap Duotone Opacity
|
||||
|
||||
For duotone icons, you can swap the primary and secondary opacity values using the `swap-opacity` attribute. This is useful when you want to emphasize the secondary layer of the icon.
|
||||
|
||||
```html {.example}
|
||||
Normal duotone<br />
|
||||
<div class="wa-cluster" style="font-size: 1.5em;">
|
||||
<wa-icon family="duotone" name="home"></wa-icon>
|
||||
<wa-icon family="duotone" name="user"></wa-icon>
|
||||
<wa-icon family="duotone" name="envelope"></wa-icon>
|
||||
<wa-icon family="duotone" name="calendar"></wa-icon>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
|
||||
Swapped duotone<br />
|
||||
<div class="wa-cluster" style="font-size: 1.5em;">
|
||||
<wa-icon family="duotone" name="home" swap-opacity></wa-icon>
|
||||
<wa-icon family="duotone" name="user" swap-opacity></wa-icon>
|
||||
<wa-icon family="duotone" name="envelope" swap-opacity></wa-icon>
|
||||
<wa-icon family="duotone" name="calendar" swap-opacity></wa-icon>
|
||||
</div>
|
||||
```
|
||||
|
||||
### Font Awesome Pro+
|
||||
|
||||
If you're a [Font Awesome Pro+ customer](https://fontawesome.com/), you have access to even more premium icons! Just set the appropriate `family`, `variant`, and `name` on the icon.
|
||||
|
||||
```html {.example}
|
||||
<div class="wa-stack wa-gap-xl">
|
||||
<div class="wa-flank" style="--flank-size: 10ch;">
|
||||
<a href="https://fontawesome.com/icons/packs/notdog" target="_blank">Notdog</a>
|
||||
<div class="wa-cluster" style="font-size: 1.5em;">
|
||||
<wa-icon family="notdog" variant="solid" name="house"></wa-icon>
|
||||
<wa-icon
|
||||
family="notdog"
|
||||
variant="duo-solid"
|
||||
name="house"
|
||||
style="--secondary-color: skyblue; --secondary-opacity: 0.8;"
|
||||
></wa-icon>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="wa-flank" style="--flank-size: 10ch;">
|
||||
<a href="https://fontawesome.com/icons/packs/chisel" target="_blank">Chisel</a>
|
||||
<div class="wa-cluster" style="font-size: 1.5em;">
|
||||
<wa-icon family="chisel" variant="regular" name="house"></wa-icon>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="wa-flank" style="--flank-size: 10ch;">
|
||||
<a href="https://fontawesome.com/icons/packs/etch" target="_blank">Etch</a>
|
||||
<div class="wa-cluster" style="font-size: 1.5em;">
|
||||
<wa-icon family="etch" variant="solid" name="house"></wa-icon>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="wa-flank" style="--flank-size: 10ch;">
|
||||
<a href="https://fontawesome.com/icons/packs/jelly" target="_blank">Jelly</a>
|
||||
<div class="wa-cluster" style="font-size: 1.5em;">
|
||||
<wa-icon family="jelly" variant="regular" name="house"></wa-icon>
|
||||
<wa-icon
|
||||
family="jelly"
|
||||
variant="duo-regular"
|
||||
name="house"
|
||||
style="--secondary-color: skyblue; --secondary-opacity: 0.8;"
|
||||
></wa-icon>
|
||||
<wa-icon family="jelly" variant="fill-regular" name="house"></wa-icon>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="wa-flank" style="--flank-size: 10ch;">
|
||||
<a href="https://fontawesome.com/icons/packs/slab" target="_blank">Slab</a>
|
||||
<div class="wa-cluster" style="font-size: 1.5em;">
|
||||
<wa-icon family="slab" variant="regular" name="house"></wa-icon>
|
||||
<wa-icon family="slab" variant="press-regular" name="house"></wa-icon>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="wa-flank" style="--flank-size: 10ch;">
|
||||
<a href="https://fontawesome.com/icons/packs/thumbprint" target="_blank">Thumbprint</a>
|
||||
<div class="wa-cluster" style="font-size: 1.5em;">
|
||||
<wa-icon
|
||||
family="thumbprint"
|
||||
variant="light"
|
||||
name="house"
|
||||
style="--secondary-color: skyblue; --secondary-opacity: 0.8;"
|
||||
></wa-icon>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="wa-flank" style="--flank-size: 10ch;">
|
||||
<a href="https://fontawesome.com/icons/packs/whiteboard" target="_blank">Whiteboard</a>
|
||||
<div class="wa-cluster" style="font-size: 32px;">
|
||||
<wa-icon family="whiteboard" variant="semibold" name="house"></wa-icon>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
```
|
||||
|
||||
:::info
|
||||
Pro+ icons can be unlocked by [providing a valid Font Awesome kit code](/docs/#using-font-awesome-kit-codes).
|
||||
:::
|
||||
|
||||
### Custom Icons
|
||||
|
||||
Custom icons can be loaded individually with the `src` attribute. Only SVGs on a local or CORS-enabled endpoint are supported. If you're using more than one custom icon, it might make sense to register a [custom icon library](#icon-libraries).
|
||||
@@ -602,9 +287,7 @@ Icons in this library are licensed under the [MIT License](https://github.com/lu
|
||||
import { registerIconLibrary } from '/dist/webawesome.js';
|
||||
|
||||
registerIconLibrary('iconoir', {
|
||||
resolver: (name, family) => {
|
||||
return `https://cdn.jsdelivr.net/npm/iconoir@7.11.0/icons/regular/${name}.svg`;
|
||||
},
|
||||
resolver: name => `https://cdn.jsdelivr.net/gh/lucaburgio/iconoir@latest/icons/${name}.svg`,
|
||||
mutator: svg =>
|
||||
svg.querySelectorAll('path').forEach(path => {
|
||||
path.setAttribute('fill', 'none');
|
||||
@@ -614,7 +297,7 @@ Icons in this library are licensed under the [MIT License](https://github.com/lu
|
||||
</script>
|
||||
|
||||
<div style="font-size: 24px;">
|
||||
<wa-icon library="iconoir" name="check-circle"></wa-icon>
|
||||
<wa-icon library="iconoir" name="check-circled-outline"></wa-icon>
|
||||
<wa-icon library="iconoir" name="drawer"></wa-icon>
|
||||
<wa-icon library="iconoir" name="keyframes"></wa-icon>
|
||||
<wa-icon library="iconoir" name="headset-help"></wa-icon>
|
||||
|
||||
@@ -91,7 +91,7 @@ Use the `distance` attribute to control how far the popover appears from its anc
|
||||
|
||||
### Arrow Size
|
||||
|
||||
Use the `--arrow-size` custom property to change the size of the popover's arrow. To remove it, use the `without-arrow` attribute.
|
||||
Use the `--arrow-size` custom property to change the size of the popover's arrow. Set it to `0` to remove the arrow entirely.
|
||||
|
||||
```html {.example}
|
||||
<div style="display: flex; gap: 1rem; align-items: center;">
|
||||
@@ -99,7 +99,7 @@ Use the `--arrow-size` custom property to change the size of the popover's arrow
|
||||
<wa-popover for="popover__big-arrow" style="--arrow-size: 8px;">I have a big arrow</wa-popover>
|
||||
|
||||
<wa-button id="popover__no-arrow">No arrow</wa-button>
|
||||
<wa-popover for="popover__no-arrow" without-arrow>I don't have an arrow</wa-popover>
|
||||
<wa-popover for="popover__no-arrow" style="--arrow-size: 0;">I don't have an arrow</wa-popover>
|
||||
</div>
|
||||
```
|
||||
|
||||
|
||||
@@ -416,8 +416,6 @@ 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.
|
||||
@@ -469,7 +467,6 @@ 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
|
||||
|
||||
@@ -851,4 +848,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
|
||||
|
||||
@@ -21,10 +21,10 @@ Use the `label` attribute to label the progress bar and tell assistive devices h
|
||||
|
||||
### Custom Height
|
||||
|
||||
Use the `--track-height` custom property to set the progress bar's height.
|
||||
Use the `height` CSS property to set the progress bar's height.
|
||||
|
||||
```html {.example}
|
||||
<wa-progress-bar value="50" style="--track-height: 6px;"></wa-progress-bar>
|
||||
<wa-progress-bar value="50" style="height: 6px;"></wa-progress-bar>
|
||||
```
|
||||
|
||||
### Showing Values
|
||||
|
||||
@@ -7,7 +7,7 @@ category: Form Controls
|
||||
|
||||
```html {.example}
|
||||
<wa-select>
|
||||
<wa-option value="">Option 1</wa-option>
|
||||
<wa-option value="option-1">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.
|
||||
Use the `size` attribute to change a select's size. Note that size does not apply to listbox options.
|
||||
|
||||
```html {.example}
|
||||
<wa-select placeholder="Small" size="small">
|
||||
@@ -366,7 +366,6 @@ 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
|
||||
|
||||
@@ -7,8 +7,8 @@ category: Form Controls
|
||||
|
||||
```html {.example}
|
||||
<wa-slider
|
||||
label="Number of users"
|
||||
hint="Limit six per team"
|
||||
label="Number of cats"
|
||||
hint="Limit six per household"
|
||||
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" value="50"></wa-slider>
|
||||
<wa-slider label="Volume" hint="Controls the volume of the current song." min="0" max="100"></wa-slider>
|
||||
```
|
||||
|
||||
### Showing tooltips
|
||||
@@ -72,15 +72,7 @@ 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
|
||||
hint="Controls the speed of the thing you're currently doing."
|
||||
>
|
||||
<wa-slider label="Speed" name="speed" min="1" max="5" value="3" with-markers>
|
||||
<span slot="reference">Slow</span>
|
||||
<span slot="reference">Medium</span>
|
||||
<span slot="reference">Fast</span>
|
||||
@@ -257,8 +249,8 @@ By default, the filled indicator extends from the minimum value to the current p
|
||||
|
||||
```html {.example}
|
||||
<wa-slider
|
||||
label="User Friendliness"
|
||||
hint="Did you find our product easy to use?"
|
||||
label="Cat playfulness"
|
||||
hint="Energy level during playtime"
|
||||
name="value"
|
||||
value="0"
|
||||
min="-5"
|
||||
@@ -267,9 +259,8 @@ By default, the filled indicator extends from the minimum value to the current p
|
||||
with-markers
|
||||
with-tooltip
|
||||
>
|
||||
<span slot="reference">Easy</span>
|
||||
<span slot="reference">Moderate</span>
|
||||
<span slot="reference">Difficult</span>
|
||||
<span slot="reference">Lazy</span>
|
||||
<span slot="reference">Zoomies</span>
|
||||
</wa-slider>
|
||||
```
|
||||
|
||||
|
||||
@@ -23,38 +23,42 @@ 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="filled outlined">Filled + Outlined</wa-tag>
|
||||
<wa-tag variant="brand" appearance="filled">Filled</wa-tag>
|
||||
<wa-tag variant="brand" appearance="outlined">Outlined</wa-tag>
|
||||
|
||||
<wa-tag variant="brand" appearance="filled">Filled</wa-tag>
|
||||
<wa-tag variant="brand" appearance="outlined filled">Outlined Filled</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="filled outlined">Filled + Outlined</wa-tag>
|
||||
<wa-tag variant="success" appearance="filled">Filled</wa-tag>
|
||||
<wa-tag variant="success" appearance="outlined">Outlined</wa-tag>
|
||||
<wa-tag variant="success" appearance="filled">Filled</wa-tag>
|
||||
<wa-tag variant="success" appearance="outlined filled">Outlined Filled</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="filled outlined">Filled + Outlined</wa-tag>
|
||||
<wa-tag variant="neutral" appearance="filled">Filled</wa-tag>
|
||||
<wa-tag variant="neutral" appearance="outlined">Outlined</wa-tag>
|
||||
<wa-tag variant="neutral" appearance="filled">Filled</wa-tag>
|
||||
<wa-tag variant="neutral" appearance="outlined filled">Outlined Filled</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="filled outlined">Filled + Outlined</wa-tag>
|
||||
<wa-tag variant="warning" appearance="filled">Filled</wa-tag>
|
||||
<wa-tag variant="warning" appearance="outlined">Outlined</wa-tag>
|
||||
<wa-tag variant="warning" appearance="filled">Filled</wa-tag>
|
||||
<wa-tag variant="warning" appearance="outlined filled">Outlined Filled</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="filled outlined">Filled + Outlined</wa-tag>
|
||||
<wa-tag variant="danger" appearance="filled">Filled</wa-tag>
|
||||
<wa-tag variant="danger" appearance="outlined">Outlined</wa-tag>
|
||||
<wa-tag variant="danger" appearance="filled">Filled</wa-tag>
|
||||
<wa-tag variant="danger" appearance="outlined filled">Outlined Filled</wa-tag>
|
||||
</p>
|
||||
</div>
|
||||
```
|
||||
|
||||
@@ -113,11 +113,11 @@ Tooltips can be controller programmatically by setting the `trigger` attribute t
|
||||
|
||||
### Removing Arrows
|
||||
|
||||
You can control the size of tooltip arrows by overriding the `--wa-tooltip-arrow-size` design token. To remove the arrow, use the `without-arrow` attribute.
|
||||
You can control the size of tooltip arrows by overriding the `--wa-tooltip-arrow-size` design token. To remove them, set the value to `0` as shown below.
|
||||
|
||||
```html {.example}
|
||||
<wa-button id="no-arrow">No Arrow</wa-button>
|
||||
<wa-tooltip for="no-arrow" without-arrow>This is a tooltip with no arrow</wa-tooltip>
|
||||
<wa-tooltip for="no-arrow" style="--wa-tooltip-arrow-size: 0;">This is a tooltip with no arrow</wa-tooltip>
|
||||
```
|
||||
|
||||
To override it globally, set it in a root block in your stylesheet after the Web Awesome stylesheet is loaded.
|
||||
|
||||
@@ -6,7 +6,7 @@ category: Imagery
|
||||
---
|
||||
|
||||
```html {.example}
|
||||
<wa-zoomable-frame src="https://webawesome.com/" zoom="0.5"> </wa-zoomable-frame>
|
||||
<wa-zoomable-frame src="https://backers.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://webawesome.com/" zoom="0.5" zoom-levels="50% 0.75 100%"> </wa-zoomable-frame>
|
||||
<wa-zoomable-frame src="https://backers.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://webawesome.com/" without-controls zoom="0.5"> </wa-zoomable-frame>
|
||||
<wa-zoomable-frame src="https://backers.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://webawesome.com/" zoom="0.5" without-interaction> </wa-zoomable-frame>
|
||||
<wa-zoomable-frame src="https://backers.webawesome.com/" zoom="0.5" without-interaction> </wa-zoomable-frame>
|
||||
```
|
||||
|
||||
@@ -10,16 +10,17 @@ 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 add this snippet alongside th [installation code](/docs/#quick-start-autoloading-via-cdn) 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 replace the link to `default.css` in the [installation code](/docs/#quick-start-autoloading-via-cdn) with this snippet to use the *Awesome* theme:
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="{% cdnUrl 'styles/themes/awesome.css' %}" />
|
||||
```
|
||||
|
||||
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:
|
||||
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:
|
||||
|
||||
```css
|
||||
:root,
|
||||
:where(:root),
|
||||
:host,
|
||||
.wa-light,
|
||||
.wa-dark .wa-invert {
|
||||
--wa-color-brand-fill-quiet: var(--wa-color-purple-95);
|
||||
@@ -34,6 +35,10 @@ You can customize any theme just with CSS — no preprocessor required. All desi
|
||||
}
|
||||
```
|
||||
|
||||
:::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
|
||||
|
||||
@@ -4,12 +4,18 @@ description: Choose the installation method that works best for you.
|
||||
layout: page-outline
|
||||
---
|
||||
|
||||
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).
|
||||
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!
|
||||
|
||||
- [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)
|
||||
|
||||
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)
|
||||
|
||||
---
|
||||
|
||||
## Quick Start (Autoloading via CDN)
|
||||
@@ -17,14 +23,15 @@ Welcome to Web Awesome beta! [Learn more](https://webawesome.com/) about this pr
|
||||
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 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
|
||||
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
|
||||
|
||||
Now you can [start using Web Awesome!](/docs/usage)
|
||||
|
||||
@@ -32,7 +39,7 @@ Now you can [start using Web Awesome!](/docs/usage)
|
||||
|
||||
## Using Font Awesome Kit Codes
|
||||
|
||||
Font Awesome users can provide their kit code to unlock premium icon packs. You can provide yours by adding the `data-fa-kit-code` attribute to any element on the page, or by calling the `setKitCode()` method.
|
||||
Font Awesome users can set their kit code to unlock Font Awesome Pro icons. You can provide it by adding the `data-fa-kit-code` attribute to any element on the page, or by calling the `setKitCode()` method.
|
||||
|
||||
```html
|
||||
<!-- Option 1: the data-fa-kit-code attribute -->
|
||||
@@ -45,31 +52,15 @@ Font Awesome users can provide their kit code to unlock premium icon packs. You
|
||||
</script>
|
||||
```
|
||||
|
||||
:::info
|
||||
Not a Font Awesome user yet? [Learn more about premium icon packs](https://fontawesome.com/) and sign up for an account to unlock them!
|
||||
:::
|
||||
|
||||
---
|
||||
|
||||
{# This looks weird, but without it, markdownItAttrs flags the raw calls incorrectly. #}
|
||||
|
||||
<div>
|
||||
{%- raw -%}
|
||||
{% if currentUser.hasPro %}
|
||||
<div>
|
||||
{% include "server/pro-setup.njk" ignore missing %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endraw %}
|
||||
</div>
|
||||
|
||||
## Advanced Setup
|
||||
|
||||
The autoloader is the easiest way to use Web Awesome, but different projects (or your own preferences!) may require different installation methods.
|
||||
|
||||
### Cherry Picking from CDN
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
Here's an example that loads only the button component.
|
||||
|
||||
@@ -102,16 +93,16 @@ Web Awesome does not a provide a single import with all Web Awesome components.
|
||||
:::
|
||||
|
||||
```js
|
||||
// Option 1: import all Web Awesome styles
|
||||
import '@awesome.me/webawesome/dist/styles/webawesome.css';
|
||||
// import the Web Awesome base stylesheet
|
||||
import "@awesome.me/webawesome/dist/styles/webawesome.css"
|
||||
|
||||
// Option 2: import only the default theme
|
||||
import '@awesome.me/webawesome/dist/styles/themes/default.css';
|
||||
// import the default "theme"
|
||||
import "@awesome.me/webawesome/dist/styles/themes/default.css"
|
||||
|
||||
// <wa-button>
|
||||
import '@awesome.me/webawesome/dist/components/button/button.js';
|
||||
import "@awesome.me/webawesome/dist/components/button/button.js"
|
||||
// <wa-input>
|
||||
import '@awesome.me/webawesome/dist/components/input/input.js';
|
||||
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.
|
||||
@@ -120,7 +111,7 @@ Once they've been imported, you can use them in your HTML normally. Component im
|
||||
|
||||
Some components rely on assets (icons, images, etc.) and Web Awesome needs to know where they're located. For convenience, Web Awesome will try to auto-detect the correct location based on the script you've loaded it from. This assumes assets are colocated with `webawesome.loader.js` and will "just work" for most users.
|
||||
|
||||
==If you're using the CDN, you can skip this section.== However, if you're [cherry picking](#cherry-picking-from-cdn) or bundling Web Awesome, you'll need to set the base path. You can do this one of two ways.
|
||||
==If you're using the CDN, you can skip this section.== However, if you're [cherry picking](#cherry-picking) or bundling Web Awesome, you'll need to set the base path. You can do this one of two ways.
|
||||
|
||||
```html
|
||||
<!-- Option 1: the data-webawesome attribute -->
|
||||
@@ -153,63 +144,13 @@ Most of the magic behind assets is handled internally by Web Awesome, but if you
|
||||
</script>
|
||||
```
|
||||
|
||||
### The Difference Between `/dist` & `/dist-cdn`
|
||||
## The difference between `/dist` and `/dist-cdn`
|
||||
|
||||
If you have Web Awesome installed locally via npm, you'll notice the following directories in the project's root:
|
||||
If you have Web Awesome installed locally via NPM, you'll notice 2 directories. `/dist-cdn` and `/cdn`.
|
||||
|
||||
```
|
||||
dist/
|
||||
dist-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.
|
||||
|
||||
The `dist-cdn` files come with everything bundled together, so you can use them directly without a build tool. The dist files keep dependencies separate, which lets your bundler optimize and share code more efficiently.
|
||||
TLDR:
|
||||
|
||||
Use `dist-cdn` if you're loading directly in the browser or from a CDN. Use `dist` if you're using a bundler like Webpack or Vite.
|
||||
|
||||
## React Users
|
||||
|
||||
React 19+ [supports custom elements](https://react.dev/blog/2024/04/25/react-19#support-for-custom-elements), so you can import them and use them as you'd expect. Just make sure you've included your Web Awesome theme into your app first.
|
||||
|
||||
```jsx
|
||||
import '@awesome.me/webawesome/dist/components/button/button.js';
|
||||
|
||||
function App() {
|
||||
return <wa-button variant="brand">Button</wa-button>;
|
||||
}
|
||||
|
||||
export default App;
|
||||
```
|
||||
|
||||
If you're using TypeScript, you can add type safety using the types file located at:
|
||||
|
||||
```
|
||||
node_modules/@awesome.me/webawesome/dist/custom-elements-jsx.d.ts
|
||||
```
|
||||
|
||||
This gives you inline documentation, autocomplete, and type-safe validation for every component. You can add the types to your project by updating your `tsconfig.json` file as shown below.
|
||||
|
||||
```json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"types": ["node-modules/@awesome.me/webawesome/dist/custom-elements-jsx.d.ts"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Another way is to create a declaration file and extend JSX's `IntrinsicElements`:
|
||||
|
||||
```ts
|
||||
import type { CustomElements, CustomCssProperties } from '@awesome.me/webawesome/dist/custom-elements-jsx.d.ts';
|
||||
|
||||
declare module 'react' {
|
||||
namespace JSX {
|
||||
interface IntrinsicElements extends CustomElements {}
|
||||
}
|
||||
interface CSSProperties extends CustomCssProperties {}
|
||||
}
|
||||
```
|
||||
|
||||
:::details React 18 and below
|
||||
React 18 and below have [poor support](https://custom-elements-everywhere.com/#react) for custom elements. For legacy versions of React, we provide React wrappers for every component. You can find the import instructions by selecting the _React_ tab from the _Importing_ section of each
|
||||
component's documentation.
|
||||
:::
|
||||
- `@awesome.me/webawesome/dist-cdn` is for CDNs or people not using a bundler.
|
||||
- `@awesome.me/webawesome/dist` is for bundlers or importmaps.
|
||||
@@ -22,7 +22,43 @@ Through the magic of a mutation observer, changing the `lang` attribute will aut
|
||||
|
||||
## Available Translations
|
||||
|
||||
Web Awesome ships with [a number of translations](https://github.com/shoelace-style/webawesome/tree/next/packages/webawesome/src/translations). The default is English (US), which also serves as the fallback locale. As such, you do not need to import the English translation.
|
||||
Web Awesome ships with a number of translations. The default is English (US), which also serves as the fallback locale. As such, you do not need to import the English translation.
|
||||
|
||||
Available translations include:
|
||||
|
||||
<div style="columns: 3; gap: 1rem; margin-block-end: 1.5rem;">
|
||||
|
||||
- ar
|
||||
- cs
|
||||
- da
|
||||
- de-ch
|
||||
- de
|
||||
- en-gb
|
||||
- en
|
||||
- es
|
||||
- fa
|
||||
- fi
|
||||
- fr
|
||||
- he
|
||||
- hr
|
||||
- hu
|
||||
- id
|
||||
- it
|
||||
- ja
|
||||
- nb
|
||||
- nl
|
||||
- nn
|
||||
- pl
|
||||
- pt
|
||||
- ru
|
||||
- sl
|
||||
- sv
|
||||
- tr
|
||||
- uk
|
||||
- zh-cn
|
||||
- zh-tw
|
||||
|
||||
</div>
|
||||
|
||||
You can import translations using the following syntax, where `<code>` is replaced with any language code shown above.
|
||||
|
||||
|
||||
@@ -8,84 +8,6 @@ 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
|
||||
|
||||
### Bug Fixes and Improvements {data-no-outline}
|
||||
|
||||
- 🚨 BREAKING: Updated `<wa-icon>` to use Font Awesome 7 [pr:1222]
|
||||
- Added the `auto-width` attribute to automatically size icons, since FA7 is fixed-width by default now
|
||||
- Improved support for duotone icons in `<wa-icon>`, including custom colors, custom opacity, and opacity swapping
|
||||
- Removed the `fixed-width` attribute as it's now the default behavior
|
||||
- 🚨 BREAKING: Renamed the `icon-position` attribute to `icon-placement` in `<wa-details>` [discuss:1340]
|
||||
- 🚨 BREAKING: Removed the `size` attribute from `<wa-button-group>` as it only set the initial size and gets out of sync when buttons are updated (apply a `size` to each button instead)
|
||||
- Added the Hindi translation [pr:1307]
|
||||
- Added `--show-duration` and `--hide-duration` to `<wa-select>` [issue:1281]
|
||||
- Fixed incorrectly named exported tooltip parts in `<wa-slider>` [pr:1277]
|
||||
- Fixed a bug in `<wa-dropdown>` that caused menus to overflow the viewport instead of resizing [issue:1267]
|
||||
- Fixed a bug in `<wa-dropdown>` that prevented keyboard selection of items when nested in shadow roots [issue:1270]
|
||||
- Fixed a bug in `<wa-dropdown>` that prevented items passed in from slots from being detected [issue:1271]
|
||||
- Fixed a bug in JSX typings that prevented the types file from being exported [pr:1295]
|
||||
- Fixed a bug in JSX typings that generated the incorrect component imports [issue:1303]
|
||||
- Fixed a bug in `<wa-slider>` that prevented the thumb from receiving focus when clicking/tapping [issue:1312]
|
||||
- Fixed a bug in `<wa-scroller>` that caused the shadow to appear below relatively-positioned elements [issue:1326]
|
||||
- Fixed `<wa-button>` to have `static` positioning by default and `relative` positioning only when used with `<wa-badge>` [pr:1346]
|
||||
|
||||
## 3.0.0-beta.4
|
||||
|
||||
### New Features {data-no-outline}
|
||||
|
||||
- Added the `icon-position` attribute to `<wa-details>` [discuss:1099]
|
||||
- Added the `animating` custom state to `<wa-details>` [pr:1214]
|
||||
- Added `--wa-tooltip-border-color`, `--wa-tooltip-border-style`, and `--wa-tooltip-border-width` tokens [issue:1224]
|
||||
- Added the `without-arrow` attribute to `<wa-popover>` and `<wa-tooltip>` to hide arrows without artifacts
|
||||
- Added JSX types for use with React and others [pr:1256]
|
||||
- Added `<input type="file">` to native styles [pr:1279]
|
||||
|
||||
### Bug Fixes and Improvements {data-no-outline}
|
||||
|
||||
- Fixed a bug in `<wa-details>` that caused the content to overflow the container when animating [issue:1149]
|
||||
- Fixed a bug in `<wa-dialog>` and `<wa-drawer>` that prevented the header from showing when the label was missing [issue:1209]
|
||||
- Fixed a missing dependency required for React wrappers
|
||||
- Fixed missing `:hover` and `:active` styles on native buttons without an appearance modifier class
|
||||
|
||||
## 3.0.0-beta.3
|
||||
|
||||
### 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-color-picker>`, `<wa-checkbox>`, `<wa-input>`, `<wa-radio-group>`, `<wa-switch>`, and `<wa-textarea>` that prevented screen readers from announcing hints [issue:1186]
|
||||
- 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]
|
||||
- Improved accessibility of `<wa-animated-image>` so keyboard users can focus and toggle the animation [issue:1177]
|
||||
|
||||
## 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!
|
||||
@@ -106,8 +28,7 @@ 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.
|
||||
- `<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 `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>`
|
||||
@@ -152,7 +73,6 @@ 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>`
|
||||
@@ -176,9 +96,6 @@ 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>
|
||||
@@ -215,7 +132,7 @@ Many of these changes and improvements were the direct result of feedback from u
|
||||
|
||||
### Bug fixes {data-no-outline}
|
||||
|
||||
- Specifying inherited CSS properties on `<wa-tooltip>` now works as expected
|
||||
- Specifying inherited CSS properties on `<wa-tooltip>` now works as expected ([thanks Dennis!](https://github.com/shoelace-style/webawesome-alpha/discussions/203))
|
||||
- Fixed a bug in `<wa-select>` that made it hard to use with VueJS, Svelte, and many other frameworks
|
||||
- Fixed a bug in `<wa-select multiple>` that sometimes resulted in empty `<div>` elements being output
|
||||
- Fixed a bug where changing a `<wa-option>` label wouldn't update the display label in `<wa-select>`
|
||||
@@ -435,4 +352,4 @@ Many of these changes and improvements were the direct result of feedback from u
|
||||
|
||||
</details>
|
||||
|
||||
Did we miss something? [Let us know!](https://github.com/shoelace-style/webawesome/discussions)
|
||||
Did we miss something? [Let us know!](https://github.com/shoelace-style/webawesome-alpha/discussions)
|
||||
|
||||
@@ -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-content-spacing);">
|
||||
<wa-button variant="brand" href="https://github.com/shoelace-style/shoelace/discussions" target="_blank" style="margin-block-end: var(--wa-flow-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-content-spacing);">
|
||||
<wa-button variant="brand" href="https://discord.gg/mg8f26C" target="_blank" style="margin-block-end: var(--wa-flow-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-content-spacing);">
|
||||
<wa-button variant="brand" href="https://twitter.com/webawesomer" target="_blank" style="margin-block-end: var(--wa-flow-spacing);">
|
||||
<wa-icon name="twitter" family="brands" slot="start"></wa-icon>
|
||||
Follow on Twitter
|
||||
</wa-button>
|
||||
@@ -131,7 +131,7 @@ To link to a GitHub issue, PR, or discussion, use the following syntax.
|
||||
|
||||
### Frontmatter
|
||||
|
||||
There's a number of frontmatter properties for doing different things in the Web Awesome documentation.
|
||||
There's a number of frontmatter properties for doing different things in the Web Awesome documention.
|
||||
|
||||
For example, to only show a page in development, use the `unpublished: true` key / value pair.
|
||||
|
||||
@@ -252,16 +252,22 @@ This creates confusion because the part will be documented, but it won't work wh
|
||||
|
||||
### Emitting Events
|
||||
|
||||
Components must only emit events that start with `wa-` as a namespace. For compatibility with frameworks that utilize DOM templates, events must have lowercase, kebab-style names. For example, use `wa-event` instead of `waEvent`.
|
||||
Components must only emit events that start with `wa-` as a namespace. For compatibility with frameworks that utilize DOM templates, events must have lowercase, kebab-style names. For example, use `wa-change` instead of `waChange`.
|
||||
|
||||
This convention avoids the problem of browsers lowercasing attributes, causing some frameworks to be unable to listen to them. This problem isn't specific to one framework, but [Vue's documentation](https://vuejs.org/v2/guide/components-custom-events.html#Event-Names) provides a good explanation of the problem.
|
||||
|
||||
### Change Events
|
||||
|
||||
When change events are emitted by Web Awesome components, they should be named `wa-change` and they should only be emitted as a result of user input. Programmatic changes, such as setting `el.value = '…'` _should not_ result in a change event being emitted. This is consistent with how native form controls work.
|
||||
|
||||
### Data Attribute Invokers
|
||||
|
||||
Some components can be controlled using [data attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/data-*) that trigger specific behaviors. These controls must use the following convention:
|
||||
|
||||
```html
|
||||
<button data-component="action id">Button text</button>
|
||||
<button data-component="action id">
|
||||
Button text
|
||||
</button>
|
||||
```
|
||||
|
||||
The `data-component` portion corresponds to the component's name without the `wa-` prefix. For example, `data-dialog` must control a `<wa-dialog>` component.
|
||||
@@ -271,9 +277,13 @@ The `action` parameter is required and must be a concise, descriptive term indic
|
||||
The `id` parameter must point to the ID of the target component. The ID may be omitted if and only if the target component wraps the element with the `data-` attribute.
|
||||
|
||||
```html
|
||||
<wa-dialog id="my-dialog"> Dialog content </wa-dialog>
|
||||
<wa-dialog id="my-dialog">
|
||||
Dialog content
|
||||
</wa-dialog>
|
||||
|
||||
<button data-dialog="open my-dialog">Open dialog</button>
|
||||
<button data-dialog="open my-dialog">
|
||||
Open dialog
|
||||
</button>
|
||||
```
|
||||
|
||||
### CSS Custom Properties
|
||||
@@ -353,7 +363,7 @@ Form controls should support submission and validation through the following con
|
||||
|
||||
- Form Controls should extend from `WebAwesomeFormAssociatedElement`
|
||||
- All form controls must use `name`, `value`, and `disabled` properties in the same manner as `HTMLInputElement`
|
||||
- All form controls with the `disabled` property _NOT_ reflect the `disabled` attribute.
|
||||
- All form controls with the `disabled` property *NOT* reflect the `disabled` attribute.
|
||||
- All form controls must have an `invalid` property that reflects their validity
|
||||
- All form controls should mirror their native validation attributes such as `required`, `pattern`, `minlength`, `maxlength`, etc. when possible and use the `MirrorValidator`.
|
||||
- All form controls must be tested to work with the standard `<form>` element
|
||||
@@ -406,4 +416,4 @@ or for hydrated rendering only:
|
||||
|
||||
```bash
|
||||
SSR_ONLY="true" npm run test
|
||||
```
|
||||
```
|
||||
@@ -6,33 +6,26 @@ wide: true
|
||||
---
|
||||
|
||||
<style>
|
||||
#content {
|
||||
p {
|
||||
max-width: 90ch;
|
||||
p {
|
||||
max-width: 90ch;
|
||||
}
|
||||
tbody {
|
||||
& .wa-grid {
|
||||
--min-column-size: 5ch;
|
||||
}
|
||||
|
||||
tbody {
|
||||
& .wa-grid {
|
||||
--min-column-size: 5ch;
|
||||
}
|
||||
|
||||
& tr th:first-of-type {
|
||||
width: 20ch;
|
||||
}
|
||||
|
||||
& th {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
& tr:hover {
|
||||
background-color: color-mix(in oklch, var(--wa-color-fill-quiet), transparent 60%)
|
||||
}
|
||||
& tr th:first-of-type {
|
||||
width: 20ch;
|
||||
}
|
||||
|
||||
wa-divider {
|
||||
--width: var(--wa-border-width-m);
|
||||
--spacing: var(--wa-space-3xl);
|
||||
& th {
|
||||
vertical-align: middle;
|
||||
}
|
||||
& tr:hover {
|
||||
background-color: color-mix(in oklch, var(--wa-color-fill-quiet), transparent 60%)
|
||||
}
|
||||
}
|
||||
wa-divider {
|
||||
--width: var(--wa-border-width-m);
|
||||
--spacing: var(--wa-space-3xl);
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@@ -4,99 +4,96 @@ description: Themes galore
|
||||
layout: page
|
||||
---
|
||||
|
||||
<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-stack wa-gap-3xl">
|
||||
|
||||
<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 %}
|
||||
<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>
|
||||
|
||||
<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 %}
|
||||
<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
|
||||
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>
|
||||
{% 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, apply the following classes to the <code><html></code> element and import the theme's stylesheet.
|
||||
</p>
|
||||
<pre><code class="language-html"><html class="wa-theme-{{ theme.filename | stripExtension }} wa-palette-{{ theme.palette.filename | stripExtension }} wa-brand-{{ theme.colorBrand.color}}">
|
||||
...
|
||||
<link rel="stylesheet" href="{% cdnUrl %}styles/themes/{{ theme.filename }}" /></code></pre>
|
||||
{% 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>
|
||||
{% endfor %}
|
||||
</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><html class="wa-theme-{{ theme.filename | stripExtension }}"></code> and import the following stylesheet:
|
||||
</p>
|
||||
<pre><code class="language-html"><link rel="stylesheet" href="{% cdnUrl %}styles/themes/{{ theme.filename }}" /></code></pre>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="module">
|
||||
import { doViewTransition } from '/assets/scripts/view-transitions.js';
|
||||
@@ -109,25 +106,23 @@ layout: page
|
||||
const freeBadge = document.querySelector('[data-free-badge]');
|
||||
const proBadge = document.querySelector('[data-pro-badge]');
|
||||
|
||||
function updateFrames(selectedValue, title, description, isPro, palette, brand) {
|
||||
function updateFrames(selectedValue, title, description, isPro) {
|
||||
// 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-*, wa-palette-*, and wa-brand-* classes
|
||||
[...html.classList].forEach(className => {
|
||||
if (className.startsWith('wa-theme-') || className.startsWith('wa-palette-') || className.startsWith('wa-brand-')) {
|
||||
// Remove all existing wa-theme-* classes
|
||||
html.classList.forEach(className => {
|
||||
if (className.startsWith('wa-theme-')) {
|
||||
html.classList.remove(className);
|
||||
}
|
||||
});
|
||||
|
||||
// Add new theme, palette, and brand classes
|
||||
// Add new theme class if not default
|
||||
if (selectedValue !== 'default') {
|
||||
html.classList.add(`wa-theme-${selectedValue}`);
|
||||
html.classList.add(`wa-palette-${palette}`);
|
||||
html.classList.add(`wa-brand-${brand}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -155,10 +150,8 @@ 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, palette, brand);
|
||||
updateFrames('default', title, description, isPro);
|
||||
}
|
||||
|
||||
// Listen for radio changes
|
||||
@@ -166,11 +159,9 @@ 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, palette, brand);
|
||||
updateFrames(selectedRadio.value, title, description, isPro);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -180,11 +171,6 @@ layout: page
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
#theme-preview,
|
||||
#using-this-theme {
|
||||
margin-block-start: var(--wa-space-3xl);
|
||||
}
|
||||
|
||||
.title {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
title: Component Groups
|
||||
description: Style groups of components that share similar qualities with these Web Awesome custom properties.
|
||||
order: 9999
|
||||
layout: page-outline
|
||||
---
|
||||
|
||||
For components that share similar qualities, Web Awesome includes custom properties to change the appearance of these related components all at once.
|
||||
@@ -85,19 +84,16 @@ Panels consist of components with larger, contained surface areas like [callout]
|
||||
|
||||
## Tooltips
|
||||
|
||||
Tooltip styles are shared between the [tooltip](/docs/components/tooltip) component and the tooltips in [slider](/docs/components/slider) and [copy button](/docs/components/copy-button).
|
||||
Tooltip styles are shared between the [tooltip](/docs/components/tooltip) component and the tooltip implementation in [range](/docs/components/range).
|
||||
|
||||
| Custom Property | Default Value |
|
||||
| ------------------------------- | ------------------------------------ |
|
||||
| `--wa-tooltip-arrow-size` | `0.375rem` <small>(6px)</small> |
|
||||
| `--wa-tooltip-background-color` | `var(--wa-color-neutral-fill-loud)` |
|
||||
| `--wa-tooltip-border-color` | `var(--wa-tooltip-background-color)` |
|
||||
| `--wa-tooltip-border-style` | `var(--wa-border-style)` |
|
||||
| `--wa-tooltip-border-width` | `var(--wa-border-width-s)` |
|
||||
| `--wa-tooltip-border-radius` | `var(--wa-border-radius-s)` |
|
||||
| `--wa-tooltip-content-color` | `var(--wa-color-neutral-on-loud)` |
|
||||
| `--wa-tooltip-font-size` | `var(--wa-font-size-s)` |
|
||||
| `--wa-tooltip-line-height` | `var(--wa-line-height-normal)` |
|
||||
| Custom Property | Default Value |
|
||||
| ---------------------------- | ----------------------------------- |
|
||||
| `--wa-tooltip-arrow-size` | `0.375rem` <small>(6px)</small> |
|
||||
| `--wa-tooltip-background-color` | `var(--wa-color-neutral-fill-loud)` |
|
||||
| `--wa-tooltip-border-radius` | `var(--wa-border-radius-m)` |
|
||||
| `--wa-tooltip-content-color` | `var(--wa-color-neutral-on-loud)` |
|
||||
| `--wa-tooltip-font-size` | `var(--wa-font-size-s)` |
|
||||
| `--wa-tooltip-line-height` | `var(--wa-line-height-normal)` |
|
||||
|
||||
```html {.example}
|
||||
<wa-button id="bullseye-example" appearance="plain">
|
||||
|
||||
@@ -5,52 +5,27 @@ layout: page-outline
|
||||
tags: styleUtilities
|
||||
---
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
## Using native styles
|
||||
## Installation
|
||||
|
||||
To use all Web Awesome styles (including [utilities](/docs/utilities/)), include the following stylesheet in your project:
|
||||
To use all Web Awesome page styles (including [utilities](/docs/utilities/)), include the following stylesheet in your project:
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="{% cdnUrl 'styles/webawesome.css' %}" />
|
||||
```
|
||||
|
||||
Or, if you only want styles for native elements, include the default theme and native styles individually:
|
||||
Or, to _only_ include styles for native elements:
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="{% cdnUrl 'styles/themes/default.css' %}" />
|
||||
<link rel="stylesheet" href="{% cdnUrl 'styles/native.css' %}" />
|
||||
```
|
||||
|
||||
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.
|
||||
## Elements
|
||||
|
||||
### Headings
|
||||
|
||||
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.
|
||||
Semantic heading elements with proper hierarchy and styling.
|
||||
|
||||
```html {.example}
|
||||
<h1>Heading 1</h1>
|
||||
@@ -63,7 +38,7 @@ Create headings with `<h1>` through `<h6>`. Headings use tokens with the `-headi
|
||||
|
||||
### Paragraphs
|
||||
|
||||
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.
|
||||
Standard paragraph text with optimal spacing and readability.
|
||||
|
||||
```html {.example}
|
||||
<p>
|
||||
@@ -80,7 +55,7 @@ Create paragraphs with `<p>`. Paragraphs inherit the default text styles set on
|
||||
|
||||
### Blockquotes
|
||||
|
||||
Emphasize longer quotations with `<blockquote>`. Block quotes use your theme's serif font family and a leading border to stand out.
|
||||
Styled quotations that stand out from regular text.
|
||||
|
||||
```html {.example}
|
||||
<blockquote>
|
||||
@@ -92,51 +67,51 @@ Emphasize longer quotations with `<blockquote>`. Block quotes use your theme's s
|
||||
|
||||
### Lists
|
||||
|
||||
Create ordered and unordered lists with `<ol>` and `<ul>`, plus `<li>` for list items within.
|
||||
Organized content in bulleted or numbered format with proper nesting support.
|
||||
|
||||
```html {.example}
|
||||
<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>
|
||||
<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>
|
||||
|
||||
<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>
|
||||
<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>
|
||||
```
|
||||
|
||||
Use `<dl>` to create lists of terms (`<dt>`) and definitions (`<dd>`).
|
||||
### Description Lists
|
||||
|
||||
Term and definition pairs for glossaries and descriptions.
|
||||
|
||||
```html {.example}
|
||||
<dl>
|
||||
<dt>First term</dt>
|
||||
<dt>Definition 1</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>Second term</dt>
|
||||
<dt>Definition 2</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>Final term</dt>
|
||||
<dt>Definition 3</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.
|
||||
@@ -144,153 +119,13 @@ Use `<dl>` to create lists of terms (`<dt>`) and definitions (`<dd>`).
|
||||
</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><caption></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
|
||||
|
||||
Create disclosure widgets with `<details>` and `<summary>`. Details closely match the appearance of [`<wa-details>`](/docs/components/details/).
|
||||
Collapsible content sections with expand/collapse functionality.
|
||||
|
||||
```html {.example}
|
||||
<details>
|
||||
<summary>Summary</summary>
|
||||
<summary>Tincidunt nunc pulvinar</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.
|
||||
@@ -300,7 +135,7 @@ Create disclosure widgets with `<details>` and `<summary>`. Details closely matc
|
||||
|
||||
### Dialog
|
||||
|
||||
Create modal and non-modal dialog boxes with `<dialog>`. Dialogs closely match the appearance of [`<wa-dialog>`](/docs/components/dialog/).
|
||||
Modal dialog windows for alerts, confirmations, and overlays.
|
||||
|
||||
```html {.example}
|
||||
<dialog id="dialog-example">
|
||||
@@ -320,9 +155,55 @@ Create modal and non-modal dialog boxes with `<dialog>`. Dialogs closely match t
|
||||
</script>
|
||||
```
|
||||
|
||||
### Progress
|
||||
### Inline Text
|
||||
|
||||
Create progress indicators with `<progress>`. Progress indicators closely match the appearance of [`<wa-progress-bar>`](/docs/components/progress-bar/).
|
||||
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.
|
||||
|
||||

|
||||
|
||||
### Progress Bars
|
||||
|
||||
Visual indicators for task completion and loading states.
|
||||
|
||||
```html {.example}
|
||||
<progress value="40" max="100"></progress>
|
||||
@@ -330,43 +211,156 @@ Create progress indicators with `<progress>`. Progress indicators closely match
|
||||
<progress></progress>
|
||||
```
|
||||
|
||||
## Forms
|
||||
### Tables
|
||||
|
||||
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.
|
||||
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
|
||||
|
||||
### Buttons
|
||||
|
||||
Create buttons with `<button>` or `<input type="button | submit | reset">`. Buttons closely match the appearance of [`<wa-button>`](/docs/components/button/).
|
||||
Use the [variant utility classes](../utilities/color.md) to set the button's semantic variant.
|
||||
|
||||
```html {.example}
|
||||
<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-neutral"><wa-icon name="home"></wa-icon> 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>
|
||||
```
|
||||
|
||||
Add the `wa-accent`, `wa-filled`, `wa-outlined`, or `wa-plain` class to specify the button's visual appearance.
|
||||
Use the [appearance utility classes](/docs/utilities/appearance) to change the button's visual appearance:
|
||||
|
||||
```html {.example}
|
||||
<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>
|
||||
<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>
|
||||
```
|
||||
|
||||
Add the `wa-size-s`, `wa-size-m`, or `wa-size-l` class to specify the size of the button.
|
||||
Use the [size utility classes](../utilities/size.md) to change a button's size.
|
||||
|
||||
```html {.example}
|
||||
<button class="wa-size-s">Small</button>
|
||||
@@ -374,154 +368,131 @@ Add the `wa-size-s`, `wa-size-m`, or `wa-size-l` class to specify the size of th
|
||||
<button class="wa-size-l">Large</button>
|
||||
```
|
||||
|
||||
Add the `wa-pill` class to give buttons rounded edges.
|
||||
Use the `wa-pill` class to give buttons rounded edges.
|
||||
|
||||
```html {.example}
|
||||
<button class="wa-pill">Pill button</button>
|
||||
<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>
|
||||
```
|
||||
|
||||
When using `<wa-icon>` within a button, wrap adjacent label text in `<span>` or similar to automatically add margin between the icon and the label, just like the `start` and `end` slots of `<wa-button>`.
|
||||
### Checkboxes
|
||||
|
||||
Multi-select form controls with checked, indeterminate, and disabled states.
|
||||
|
||||
```html {.example}
|
||||
<button>
|
||||
<wa-icon name="plane-departure"></wa-icon>
|
||||
<span>Start Icon</span>
|
||||
</button>
|
||||
<button>
|
||||
<span>End Icon</span>
|
||||
<wa-icon name="plane-arrival"></wa-icon>
|
||||
</button>
|
||||
```
|
||||
|
||||
### Form controls
|
||||
|
||||
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}
|
||||
<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>File <input type="file" multiple /></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>
|
||||
<label><input type="checkbox" checked /> Checked</label><br />
|
||||
<label><input type="checkbox" class="indeterminate" /> Indeterminate</label><br />
|
||||
<label><input type="checkbox" disabled /> Disabled</label>
|
||||
|
||||
<script>
|
||||
document.querySelector('.indeterminate').indeterminate = true;
|
||||
</script>
|
||||
```
|
||||
|
||||
Add the `wa-size-s`, `wa-size-m`, or `wa-size-l` class to any form control or its parent `<label>` to specify its size.
|
||||
### 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.
|
||||
|
||||
```html {.example}
|
||||
<div class="wa-stack">
|
||||
<input type="text" placeholder="Small input" class="wa-size-s" />
|
||||
<div class="wa-cluster">
|
||||
<label class="wa-size-s"><input type="checkbox" checked /> Small checkbox</label>
|
||||
<label class="wa-size-s"><input type="radio" name="radio-small" value="1" checked /> Small radio</label>
|
||||
</div>
|
||||
<input type="text" placeholder="Medium input" class="wa-size-m" />
|
||||
<div class="wa-cluster">
|
||||
<label class="wa-size-m"><input type="checkbox" checked /> Medium checkbox</label>
|
||||
<label class="wa-size-m"><input type="radio" name="radio-medium" value="1" checked /> Medium radio</label>
|
||||
</div>
|
||||
<input type="text" placeholder="Large input" class="wa-size-l" />
|
||||
<div class="wa-cluster">
|
||||
<label class="wa-size-l"><input type="checkbox" checked /> Large checkbox</label>
|
||||
<label class="wa-size-l"><input type="radio" name="radio-large" value="1" checked /> Large radio</label>
|
||||
</div>
|
||||
<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>
|
||||
```
|
||||
|
||||
Add the `wa-filled` class to an input to give it a filled background.
|
||||
### Selects
|
||||
|
||||
Dropdown menus for choosing from a list of options.
|
||||
|
||||
```html {.example}
|
||||
<div class="wa-stack">
|
||||
<input type="text" placeholder="Filled input" class="wa-filled" />
|
||||
<select class="wa-filled">
|
||||
<option value="filled">Filled select</option>
|
||||
<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>
|
||||
</select>
|
||||
<textarea placeholder="Filled textarea" class="wa-filled"></textarea>
|
||||
</div>
|
||||
</label>
|
||||
```
|
||||
|
||||
Add the `wa-pill` class to an input or select to give it rounded edges.
|
||||
### Sliders
|
||||
|
||||
Range inputs for selecting numeric values within a specified range.
|
||||
|
||||
```html {.example}
|
||||
<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>
|
||||
<label>Select a value: <input type="range" /></label>
|
||||
```
|
||||
|
||||
Add any [button](#buttons) modifier class to `<input type="file">` to change the file selector button's color variant, appearance, size, and shape.
|
||||
### Text Fields
|
||||
|
||||
Various input types for collecting user text and data.
|
||||
|
||||
```html {.example}
|
||||
<input type="file" class="wa-filled wa-outlined wa-warning wa-size-s wa-pill" />
|
||||
<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>
|
||||
```
|
||||
|
||||
### Fieldsets
|
||||
|
||||
Group form controls together with `<fieldset>` and `<legend>`.
|
||||
|
||||
```html {.example}
|
||||
<fieldset class="wa-stack wa-align-items-start">
|
||||
<fieldset>
|
||||
<legend>Legend</legend>
|
||||
<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>
|
||||
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.
|
||||
</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>
|
||||
```
|
||||
|
||||
@@ -3,7 +3,7 @@ unlisted: true
|
||||
layout: false
|
||||
---
|
||||
<!doctype html>
|
||||
<html lang="en" class="wa-cloak" data-fa-kit-code="38c11e3f20">
|
||||
<html lang="en" class="wa-cloak" data-fa-kit-code="b10bfbde90">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
@@ -304,15 +304,15 @@ layout: false
|
||||
<wa-divider></wa-divider>
|
||||
<dl class="wa-stack">
|
||||
<div class="wa-flank wa-align-items-center">
|
||||
<dt><wa-icon name="user" label="Name"></wa-icon></dt>
|
||||
<dt><wa-icon name="user" label="Name" fixed-width></wa-icon></dt>
|
||||
<dd>Tom Bombadil</dd>
|
||||
</div>
|
||||
<div class="wa-flank wa-align-items-center">
|
||||
<dt><wa-icon name="calendar-days" label="Date"></wa-icon></dt>
|
||||
<dt><wa-icon name="calendar-days" label="Date" fixed-width></wa-icon></dt>
|
||||
<dd><wa-format-date date="2025-03-15"></wa-format-date></dd>
|
||||
</div>
|
||||
<div class="wa-flank wa-align-items-center">
|
||||
<dt><wa-icon name="coin-vertical"></wa-icon></dt>
|
||||
<dt><wa-icon name="coin-vertical" fixed-width></wa-icon></dt>
|
||||
<dd>Paid with copper pennies</dd>
|
||||
</div>
|
||||
</dl>
|
||||
@@ -344,19 +344,19 @@ layout: false
|
||||
<h4 class="wa-heading-s">What You Get</h4>
|
||||
<div class="wa-stack">
|
||||
<div class="wa-flank">
|
||||
<wa-icon name="user"></wa-icon>
|
||||
<wa-icon name="user" fixed-width></wa-icon>
|
||||
<span class="wa-caption-m">9 users</span>
|
||||
</div>
|
||||
<div class="wa-flank">
|
||||
<wa-icon name="ring"></wa-icon>
|
||||
<wa-icon name="ring" fixed-width></wa-icon>
|
||||
<span class="wa-caption-m">1 ring</span>
|
||||
</div>
|
||||
<div class="wa-flank">
|
||||
<wa-icon name="chess-rook"></wa-icon>
|
||||
<wa-icon name="chess-rook" fixed-width></wa-icon>
|
||||
<span class="wa-caption-m">API access to Isengard</span>
|
||||
</div>
|
||||
<div class="wa-flank">
|
||||
<wa-icon name="feather"></wa-icon>
|
||||
<wa-icon name="feather" fixed-width></wa-icon>
|
||||
<span class="wa-caption-m">Priority eagle support</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -616,8 +616,8 @@ layout: false
|
||||
}
|
||||
}
|
||||
|
||||
wa-progress-bar {
|
||||
--track-height: 0.5em;
|
||||
wa-progress-bar::part(base) {
|
||||
height: 0.5em;
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
|
||||
@@ -136,21 +136,35 @@ 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 {
|
||||
> wa-icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
margin-block-end: 1rem;
|
||||
& wa-icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: var(--wa-color-neutral-fill-loud);
|
||||
color: var(--wa-color-neutral-on-loud);
|
||||
background-color: var(--wa-brand-orange);
|
||||
color: white;
|
||||
border-radius: 0.25rem;
|
||||
aspect-ratio: 1;
|
||||
padding: 0.5em;
|
||||
|
||||
&.brand-orange {
|
||||
background-color: var(--wa-brand-orange);
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
& h3 {
|
||||
font-size: 1rem;
|
||||
@@ -210,8 +224,8 @@ layout: page
|
||||
text-align: left;
|
||||
white-space: wrap;
|
||||
}
|
||||
wa-button.tile::part(label) {
|
||||
width: 100%;
|
||||
wa-button.tile::part(end) {
|
||||
display: none;
|
||||
}
|
||||
wa-button.tile {
|
||||
width: 100%;
|
||||
@@ -271,27 +285,23 @@ layout: page
|
||||
<div class="beta-notice">
|
||||
<div>
|
||||
<wa-callout variant="brand">
|
||||
<div class="wa-stack">
|
||||
<div class="wa-cluster icon-heading">
|
||||
<wa-icon name="sparkles" variant="regular"></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 class="icon-heading">
|
||||
<wa-icon name="sparkles" variant="regular" fixed-width></wa-icon>
|
||||
<h3>Rise and shine, backers!</h3>
|
||||
</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 class="wa-stack">
|
||||
<div class="wa-split">
|
||||
<div class="wa-cluster icon-heading">
|
||||
<wa-icon name="pen-ruler" class="brand-orange"></wa-icon>
|
||||
<h3>Get started</h3>
|
||||
</div>
|
||||
<wa-icon name="arrow-right"></wa-icon>
|
||||
<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>
|
||||
<p>Check out our installation guide to start building with Web Awesome.</p>
|
||||
<wa-icon name="arrow-right" fixed-width></wa-icon>
|
||||
</div>
|
||||
<p>Check out our installation guide to start building with Web Awesome.</p>
|
||||
</wa-button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -300,30 +310,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 class="wa-stack">
|
||||
<div class="wa-cluster icon-heading">
|
||||
<wa-icon name="code" class="brand-orange"></wa-icon>
|
||||
<div>
|
||||
<div class="icon-heading">
|
||||
<wa-icon name="code" fixed-width></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 class="wa-stack">
|
||||
<div class="wa-cluster icon-heading">
|
||||
<wa-icon name="palette" class="brand-orange"></wa-icon>
|
||||
<div>
|
||||
<div class="icon-heading">
|
||||
<wa-icon name="palette" fixed-width></wa-icon>
|
||||
<h3>Fully customizable</h3>
|
||||
</div>
|
||||
<p>Show off your own style with components that consistently adapt to your theme.</p>
|
||||
</div>
|
||||
<div class="wa-stack">
|
||||
<div class="wa-cluster icon-heading">
|
||||
<wa-icon name="wheelchair-move" class="brand-orange"></wa-icon>
|
||||
<div>
|
||||
<div class="icon-heading">
|
||||
<wa-icon name="wheelchair-move" fixed-width></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 class="wa-stack">
|
||||
<div class="wa-cluster icon-heading">
|
||||
<wa-icon name="handshake-simple" class="brand-orange"></wa-icon>
|
||||
<div>
|
||||
<div class="icon-heading">
|
||||
<wa-icon name="handshake-simple" fixed-width></wa-icon>
|
||||
<h3>Proudly open source</h3>
|
||||
</div>
|
||||
<p>Use Web Awesome Free however you like. Always free, always open source.</p>
|
||||
@@ -338,84 +348,24 @@ layout: page
|
||||
<p>Whether you’re a developer, designer, or budding tech nerd, we want you a part of the conversation.</p>
|
||||
</div>
|
||||
<div>
|
||||
<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"></wa-icon>
|
||||
<h3>GitHub</h3>
|
||||
</div>
|
||||
<wa-icon name="arrow-up-right"></wa-icon>
|
||||
</div>
|
||||
<p>Get involved by opening issues, contributing to discussions, or creating PRs.</p>
|
||||
<div class="link-panel">
|
||||
<div class="icon-heading">
|
||||
<wa-icon name="envelope-open" fixed-width></wa-icon>
|
||||
<h3>Get in touch</h3>
|
||||
</div>
|
||||
</wa-button>
|
||||
<wa-button href="https://discord.gg/mg8f26C" 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"></wa-icon>
|
||||
<h3>Discord</h3>
|
||||
</div>
|
||||
<wa-icon name="arrow-up-right"></wa-icon>
|
||||
</div>
|
||||
<p>Share your work, ask questions, and explore ideas with other Web Awesome builders.</p>
|
||||
<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>
|
||||
</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"></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"></wa-icon>
|
||||
</div>
|
||||
</wa-button>
|
||||
<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>
|
||||
</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"></wa-icon>
|
||||
<h3>Bluesky</h3>
|
||||
</div>
|
||||
<wa-icon name="arrow-up-right"></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"></wa-icon>
|
||||
<h3>Twitter (X)</h3>
|
||||
</div>
|
||||
<wa-icon name="arrow-up-right"></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"></wa-icon>
|
||||
<h3>Threads</h3>
|
||||
</div>
|
||||
<wa-icon name="arrow-up-right"></wa-icon>
|
||||
</div>
|
||||
</wa-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<wa-divider></wa-divider>
|
||||
<wa-divider></wa-divider>
|
||||
|
||||
<footer>
|
||||
<div class="wa-crown">
|
||||
@@ -429,9 +379,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>
|
||||
@@ -442,4 +392,4 @@ layout: page
|
||||
© Fonticons, Inc.
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
@@ -4,7 +4,7 @@
|
||||
"access": "public"
|
||||
},
|
||||
"description": "A forward-thinking library of web components.",
|
||||
"version": "3.0.0-beta.4",
|
||||
"version": "3.0.0-beta.1",
|
||||
"homepage": "https://webawesome.com/",
|
||||
"author": "Web Awesome",
|
||||
"license": "MIT",
|
||||
@@ -19,11 +19,10 @@
|
||||
"import": "./dist/webawesome.js"
|
||||
},
|
||||
"./dist/custom-elements.json": "./dist/custom-elements.json",
|
||||
"./dist/custom-elements-jsx.d.ts": "./dist/custom-elements-jsx.d.ts",
|
||||
"./dist/webawesome.js": "./dist/webawesome.js",
|
||||
"./dist/webawesome.loader.js": "./dist/webawesome.loader.js",
|
||||
"./dist/styles": "./dist/styles",
|
||||
"./dist/styles/*": "./dist/styles/*",
|
||||
"./dist/themes": "./dist/themes",
|
||||
"./dist/themes/*": "./dist/themes/*",
|
||||
"./dist/components": "./dist/components",
|
||||
"./dist/components/*": "./dist/components/*",
|
||||
"./dist/react": "./dist/react/index.js",
|
||||
@@ -74,21 +73,17 @@
|
||||
"dependencies": {
|
||||
"@ctrl/tinycolor": "^4.1.0",
|
||||
"@floating-ui/dom": "^1.6.13",
|
||||
"@lit/react": "^1.0.8",
|
||||
"@shoelace-style/animations": "^1.2.0",
|
||||
"@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"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"@wc-toolkit/jsx-types": "^1.3.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,20 +4,19 @@ 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, extname, join, posix, relative } from 'node:path';
|
||||
import { dirname, join, relative } from 'node:path';
|
||||
import process from 'node:process';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import ora from 'ora';
|
||||
import copy from 'recursive-copy';
|
||||
import { SimulateWebAwesomeApp } from '../docs/_utils/simulate-webawesome-app.js';
|
||||
import { generateDocs } from './docs.js';
|
||||
import { getCdnDir, getDistDir, getDocsDir, getRootDir, getSiteDir } from './utils.js';
|
||||
import { getCdnDir, getDistDir, getDocsDir, getRootDir, getSiteDir, runScript } 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());
|
||||
@@ -26,16 +25,11 @@ let buildContexts = {
|
||||
unbundledContext: {},
|
||||
};
|
||||
|
||||
const debugPerf = process.env.DEBUG_PERFORMANCE === '1';
|
||||
|
||||
const isDeveloping = process.argv.includes('--develop');
|
||||
|
||||
/**
|
||||
* @typedef {Object} BuildOptions
|
||||
* @property {Array<string>} [watchedSrcDirectories]
|
||||
* @property {Array<string>} [watchedDocsDirectories]
|
||||
* @property {(eventName: "change" | "add" | "unlink", filePath: string) => unknown} [beforeWatchEvent]
|
||||
* @property {(eventName: "change" | "add" | "unlink", filePath: string) => unknown} [afterWatchEvent]
|
||||
* @property {(eventName: "change" | "add" | "unlink", filePath: string) => unknown} [onWatchEvent]
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -57,24 +51,17 @@ export async function build(options = {}) {
|
||||
const start = Date.now();
|
||||
|
||||
try {
|
||||
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();
|
||||
}
|
||||
}
|
||||
await cleanup();
|
||||
await generateManifest();
|
||||
await generateReactWrappers();
|
||||
await generateTypes();
|
||||
await generateStyles();
|
||||
|
||||
// copy everything to unbundled before we generate bundles.
|
||||
await copy(getCdnDir(), getDistDir(), { overwrite: true });
|
||||
|
||||
await generateBundle();
|
||||
await generateDocs({ spinner });
|
||||
await generateDocs();
|
||||
|
||||
const time = (Date.now() - start) / 1000 + 's';
|
||||
spinner.succeed(`The build is complete ${chalk.gray(`(finished in ${time})`)}`);
|
||||
@@ -121,11 +108,6 @@ export async function build(options = {}) {
|
||||
* Generates React wrappers for all components.
|
||||
*/
|
||||
function generateReactWrappers() {
|
||||
// Used by webawesome-app to make re-rendering not miserable with extra React file generation.
|
||||
if (process.env.SKIP_SLOW_STEPS === 'true') {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
spinner.start('Generating React wrappers');
|
||||
|
||||
try {
|
||||
@@ -160,11 +142,6 @@ export async function build(options = {}) {
|
||||
* Runs TypeScript to generate types.
|
||||
*/
|
||||
async function generateTypes() {
|
||||
// Used by webawesome-app to make re-rendering not miserable with extra TS compilations.
|
||||
if (process.env.SKIP_SLOW_STEPS === 'true') {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
spinner.start('Running the TypeScript compiler');
|
||||
|
||||
const cwd = process.cwd();
|
||||
@@ -209,11 +186,11 @@ export async function build(options = {}) {
|
||||
join(rootDir, 'src/webawesome.loader.ts'),
|
||||
join(rootDir, 'src/webawesome.ssr-loader.ts'),
|
||||
// Individual components
|
||||
...(await globby(posix.join(rootDir, 'src/components/**/!(*.(style|test)).ts'))),
|
||||
...(await globby(join(rootDir, 'src/components/**/!(*.(style|test)).ts'))),
|
||||
// Translations
|
||||
...(await globby(posix.join(rootDir, 'src/translations/**/*.ts'))),
|
||||
...(await globby(join(rootDir, 'src/translations/**/*.ts'))),
|
||||
// React wrappers
|
||||
...(await globby(posix.join(rootDir, 'src/react/**/*.ts'))),
|
||||
...(await globby(join(rootDir, 'src/react/**/*.ts'))),
|
||||
],
|
||||
outdir: getCdnDir(),
|
||||
chunkNames: 'chunks/[name].[hash]',
|
||||
@@ -281,6 +258,49 @@ 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();
|
||||
|
||||
@@ -318,46 +338,6 @@ 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
|
||||
@@ -386,25 +366,22 @@ export async function build(options = {}) {
|
||||
},
|
||||
);
|
||||
|
||||
const watchEvents = ['change', 'unlink', 'add'];
|
||||
// TODO: Should probably listen for all of these instead of just "change"
|
||||
const watchEvents = [
|
||||
'change',
|
||||
// "unlink",
|
||||
// "add"
|
||||
];
|
||||
// Rebuild and reload when source files change
|
||||
options.watchedSrcDirectories.forEach(dir => {
|
||||
const watcher = bs.watch(join(dir, '**', '!(*.test).*'), { ignoreInitial: true });
|
||||
const watcher = bs.watch(join(dir, '**', '!(*.test).*'));
|
||||
|
||||
watchEvents.forEach(evt => {
|
||||
watcher.on(evt, handleWatchEvent(evt));
|
||||
});
|
||||
function handleWatchEvent(evt) {
|
||||
return async filename => {
|
||||
const changedFile = relative(getRootDir(), filename);
|
||||
|
||||
if (evt === 'change') {
|
||||
spinner.info(`File modified ${chalk.gray(`(${changedFile})`)}`);
|
||||
} else if (evt === 'unlink') {
|
||||
spinner.info(`File deleted ${chalk.gray(`(${changedFile})`)}`);
|
||||
} else if (evt === 'add') {
|
||||
spinner.info(`File added ${chalk.gray(`(${changedFile})`)}`);
|
||||
}
|
||||
spinner.info(`File modified ${chalk.gray(`(${relative(getRootDir(), filename)})`)}`);
|
||||
|
||||
try {
|
||||
const isTestFile = filename.includes('.test.ts');
|
||||
@@ -417,9 +394,10 @@ export async function build(options = {}) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof options.beforeWatchEvent === 'function') {
|
||||
await options.beforeWatchEvent(evt, filename);
|
||||
if (typeof options.onWatchEvent === 'function') {
|
||||
await options.onWatchEvent(evt, filename);
|
||||
}
|
||||
await regenerateBundle();
|
||||
|
||||
// Copy stylesheets when CSS files change
|
||||
if (isCssStylesheet) {
|
||||
@@ -431,16 +409,8 @@ 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({ spinner });
|
||||
|
||||
if (typeof options.afterWatchEvent === 'function') {
|
||||
await options.afterWatchEvent(evt, filename);
|
||||
}
|
||||
await generateDocs();
|
||||
|
||||
reload();
|
||||
} catch (err) {
|
||||
@@ -456,7 +426,7 @@ export async function build(options = {}) {
|
||||
|
||||
// Rebuild the docs and reload when the docs change
|
||||
options.watchedDocsDirectories.forEach(dir => {
|
||||
const watcher = bs.watch(join(dir, '**', '*.*'), { ignoreInitial: true });
|
||||
const watcher = bs.watch(join(dir, '**', '*.*'));
|
||||
|
||||
watchEvents.forEach(evt => {
|
||||
watcher.on(evt, handleWatchEvent(evt));
|
||||
@@ -464,33 +434,11 @@ export async function build(options = {}) {
|
||||
|
||||
function handleWatchEvent(evt) {
|
||||
return async filename => {
|
||||
const changedFile = relative(getRootDir(), filename);
|
||||
|
||||
let message = '';
|
||||
if (evt === 'change') {
|
||||
message = chalk.blue(`File modified ${chalk.gray(`(${changedFile})`)}`);
|
||||
} else if (evt === 'unlink') {
|
||||
message = chalk.red(`File deleted ${chalk.gray(`(${changedFile})`)}`);
|
||||
} else if (evt === 'add') {
|
||||
message = chalk.green(`File added ${chalk.gray(`(${changedFile})`)}`);
|
||||
}
|
||||
|
||||
if (message) {
|
||||
if (spinner) {
|
||||
spinner.info(message);
|
||||
} else {
|
||||
console.log(message);
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof options.beforeWatchEvent === 'function') {
|
||||
await options.beforeWatchEvent(evt, filename);
|
||||
}
|
||||
await generateDocs({ spinner });
|
||||
|
||||
if (typeof options.afterWatchEvent === 'function') {
|
||||
await options.afterWatchEvent(evt, filename);
|
||||
spinner.info(`File modified ${chalk.gray(`(${relative(getRootDir(), filename)})`)}`);
|
||||
if (typeof options.onWatchEvent === 'function') {
|
||||
await options.onWatchEvent(evt, filename);
|
||||
}
|
||||
await generateDocs();
|
||||
reload();
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,268 +1,14 @@
|
||||
import Eleventy from '@11ty/eleventy';
|
||||
|
||||
import copy from 'recursive-copy';
|
||||
|
||||
import chalk from 'chalk';
|
||||
import { deleteAsync } from 'del';
|
||||
import { join } from 'path';
|
||||
import { getCdnDir, getDocsDir, getEleventyConfigPath, getSiteDir } from './utils.js';
|
||||
import { getDocsDir, getEleventyConfigPath, getSiteDir } from './utils.js';
|
||||
|
||||
let eleventyBuildResolver;
|
||||
let eleventyBuildPromise;
|
||||
const elev = new Eleventy(getDocsDir(), getSiteDir(), {
|
||||
quietMode: true,
|
||||
configPath: getEleventyConfigPath(),
|
||||
});
|
||||
|
||||
function queueBuild() {
|
||||
eleventyBuildPromise = new Promise(resolve => {
|
||||
eleventyBuildResolver = resolve;
|
||||
});
|
||||
}
|
||||
// Cleanup
|
||||
await deleteAsync(getSiteDir());
|
||||
|
||||
// 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');
|
||||
|
||||
/**
|
||||
* Used by the webawesome-app to skip doc generation since it will do its own.
|
||||
*/
|
||||
if (process.env.SKIP_ELEVENTY === 'true') {
|
||||
return;
|
||||
}
|
||||
|
||||
let eleventy = globalThis.eleventy;
|
||||
|
||||
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(`(${info.join('')})`);
|
||||
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'));
|
||||
}
|
||||
|
||||
if (spinner) {
|
||||
spinner.succeed(`Writing the docs ${output}`);
|
||||
} else {
|
||||
console.log(`Writing the docs ${output}`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn = originalWarn;
|
||||
|
||||
console.error('\n\n' + chalk.red(error) + '\n');
|
||||
|
||||
if (spinner) {
|
||||
spinner.fail(chalk.red(`Error while writing the docs.`));
|
||||
} else {
|
||||
console.error(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);
|
||||
// }
|
||||
}
|
||||
}
|
||||
// Write it
|
||||
await elev.write();
|
||||
|
||||
@@ -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.posix.relative(srcDir, component.path);
|
||||
const importPath = path.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-')) || [];
|
||||
|
||||
@@ -6,7 +6,7 @@ import styles from './{{ tagWithoutPrefix tag }}.css';
|
||||
|
||||
/**
|
||||
* @summary Short summary of the component's intended use.
|
||||
* @documentation https://webawesome.com/docs/components/{{ tagWithoutPrefix tag }}
|
||||
* @documentation https://backers.webawesome.com/docs/components/{{ tagWithoutPrefix tag }}
|
||||
* @status experimental
|
||||
* @since 3.0
|
||||
*
|
||||
|
||||
@@ -42,7 +42,7 @@ img[aria-hidden='true'] {
|
||||
}
|
||||
}
|
||||
|
||||
:where(:host([play]:not(:hover))) .control-box {
|
||||
:host([play]:not(:hover)) .control-box {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
@@ -50,16 +50,3 @@ img[aria-hidden='true'] {
|
||||
:host(:not([play])) slot[name='pause-icon'] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Show control box on keyboard focus */
|
||||
.animated-image {
|
||||
&:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
&:focus-visible .control-box {
|
||||
opacity: 1;
|
||||
outline: var(--wa-focus-ring);
|
||||
outline-offset: var(--wa-focus-ring-offset);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,13 +4,12 @@ import { WaErrorEvent } from '../../events/error.js';
|
||||
import { WaLoadEvent } from '../../events/load.js';
|
||||
import { watch } from '../../internal/watch.js';
|
||||
import WebAwesomeElement from '../../internal/webawesome-element.js';
|
||||
import { LocalizeController } from '../../utilities/localize.js';
|
||||
import '../icon/icon.js';
|
||||
import styles from './animated-image.css';
|
||||
|
||||
/**
|
||||
* @summary A component for displaying animated GIFs and WEBPs that play and pause on interaction.
|
||||
* @documentation https://webawesome.com/docs/components/animated-image
|
||||
* @documentation https://backers.webawesome.com/docs/components/animated-image
|
||||
* @status stable
|
||||
* @since 2.0
|
||||
*
|
||||
@@ -31,8 +30,6 @@ import styles from './animated-image.css';
|
||||
export default class WaAnimatedImage extends WebAwesomeElement {
|
||||
static css = styles;
|
||||
|
||||
private readonly localize = new LocalizeController(this);
|
||||
|
||||
@query('.animated') animatedImage: HTMLImageElement;
|
||||
|
||||
@state() frozenFrame: string;
|
||||
@@ -51,13 +48,6 @@ export default class WaAnimatedImage extends WebAwesomeElement {
|
||||
this.play = !this.play;
|
||||
}
|
||||
|
||||
private handleKeyDown(event: KeyboardEvent) {
|
||||
if (event.key === 'Enter' || event.key === ' ') {
|
||||
event.preventDefault();
|
||||
this.play = !this.play;
|
||||
}
|
||||
}
|
||||
|
||||
private handleLoad() {
|
||||
const canvas = document.createElement('canvas');
|
||||
const { width, height } = this.animatedImage;
|
||||
@@ -92,26 +82,15 @@ export default class WaAnimatedImage extends WebAwesomeElement {
|
||||
}
|
||||
|
||||
render() {
|
||||
const verb = this.localize.term(this.play ? 'pauseAnimation' : 'playAnimation');
|
||||
const label = `${verb} ${this.alt}`;
|
||||
|
||||
return html`
|
||||
<div
|
||||
class="animated-image"
|
||||
tabindex="0"
|
||||
role="button"
|
||||
aria-pressed=${this.play ? 'true' : 'false'}
|
||||
aria-label=${label}
|
||||
@click=${this.handleClick}
|
||||
@keydown=${this.handleKeyDown}
|
||||
>
|
||||
<div class="animated-image">
|
||||
<img
|
||||
class="animated"
|
||||
src=${this.src}
|
||||
alt=${this.alt}
|
||||
crossorigin="anonymous"
|
||||
aria-hidden=${this.play ? 'false' : 'true'}
|
||||
role="presentation"
|
||||
@click=${this.handleClick}
|
||||
@load=${this.handleLoad}
|
||||
@error=${this.handleError}
|
||||
/>
|
||||
@@ -123,10 +102,10 @@ export default class WaAnimatedImage extends WebAwesomeElement {
|
||||
src=${this.frozenFrame}
|
||||
alt=${this.alt}
|
||||
aria-hidden=${this.play ? 'true' : 'false'}
|
||||
role="presentation"
|
||||
@click=${this.handleClick}
|
||||
/>
|
||||
|
||||
<div part="control-box" class="control-box" aria-hidden="true">
|
||||
<div part="control-box" class="control-box">
|
||||
<slot name="play-icon">
|
||||
<wa-icon
|
||||
name="play"
|
||||
|
||||
@@ -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://webawesome.com/docs/components/animation
|
||||
* @documentation https://backers.webawesome.com/docs/components/animation
|
||||
* @status stable
|
||||
* @since 2.0
|
||||
*
|
||||
|
||||
@@ -8,7 +8,7 @@ import styles from './avatar.css';
|
||||
|
||||
/**
|
||||
* @summary Avatars are used to represent a person or object.
|
||||
* @documentation https://webawesome.com/docs/components/avatar
|
||||
* @documentation https://backers.webawesome.com/docs/components/avatar
|
||||
* @status stable
|
||||
* @since 2.0
|
||||
*
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
:host {
|
||||
--pulse-color: var(--wa-color-fill-loud, var(--wa-color-brand-fill-loud));
|
||||
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
@@ -21,31 +19,29 @@
|
||||
}
|
||||
|
||||
/* Appearance modifiers */
|
||||
:host([appearance~='outlined']) {
|
||||
--pulse-color: var(--wa-color-border-loud, var(--wa-color-brand-border-loud));
|
||||
:host([appearance~='plain']) {
|
||||
color: var(--wa-color-on-quiet, var(--wa-color-brand-on-quiet));
|
||||
background-color: transparent;
|
||||
border-color: transparent;
|
||||
}
|
||||
|
||||
:host([appearance~='outlined']) {
|
||||
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~='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~='outlined']) {
|
||||
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;
|
||||
@@ -58,6 +54,8 @@
|
||||
|
||||
/* Pulse attention */
|
||||
:host([attention='pulse']) {
|
||||
--pulse-color: var(--background-color);
|
||||
|
||||
animation: pulse 1.5s infinite;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import styles from './badge.css';
|
||||
|
||||
/**
|
||||
* @summary Badges are used to draw attention and display statuses or counts.
|
||||
* @documentation https://webawesome.com/docs/components/badge
|
||||
* @documentation https://backers.webawesome.com/docs/components/badge
|
||||
* @status stable
|
||||
* @since 2.0
|
||||
*
|
||||
@@ -14,8 +14,6 @@ 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 {
|
||||
@@ -30,8 +28,8 @@ export default class WaBadge extends WebAwesomeElement {
|
||||
/** Draws a pill-style badge with rounded edges. */
|
||||
@property({ type: Boolean, reflect: true }) pill = false;
|
||||
|
||||
/** Adds an animation to draw attention to the badge. */
|
||||
@property({ reflect: true }) attention: 'none' | 'pulse' | 'bounce' = 'none';
|
||||
/** Makes the badge pulsate to draw attention. */
|
||||
@property({ reflect: true }) attention: 'none' | 'pulse' = 'none';
|
||||
|
||||
render() {
|
||||
return html` <slot part="base" role="status"></slot>`;
|
||||
|
||||
@@ -7,7 +7,7 @@ import styles from './breadcrumb-item.css';
|
||||
|
||||
/**
|
||||
* @summary Breadcrumb Items are used inside breadcrumbs to represent different links.
|
||||
* @documentation https://webawesome.com/docs/components/breadcrumb-item
|
||||
* @documentation https://backers.webawesome.com/docs/components/breadcrumb-item
|
||||
* @status stable
|
||||
* @since 2.0
|
||||
*
|
||||
|
||||
@@ -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://webawesome.com/docs/components/breadcrumb
|
||||
* @documentation https://backers.webawesome.com/docs/components/breadcrumb
|
||||
* @status stable
|
||||
* @since 2.0
|
||||
*
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
z-index: 2 !important;
|
||||
}
|
||||
}
|
||||
:host([orientation='vertical']) .button-group {
|
||||
|
||||
:host([orientation='vertical']) {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,13 +3,14 @@ import { html } from 'lit';
|
||||
import { customElement, property, query, state } from 'lit/decorators.js';
|
||||
import { classMap } from 'lit/directives/class-map.js';
|
||||
import WebAwesomeElement from '../../internal/webawesome-element.js';
|
||||
import sizeStyles from '../../styles/utilities/size.css';
|
||||
import variantStyles from '../../styles/utilities/variants.css';
|
||||
import type WaButton from '../button/button.js';
|
||||
import styles from './button-group.css';
|
||||
|
||||
/**
|
||||
* @summary Button groups can be used to group related buttons into sections.
|
||||
* @documentation https://webawesome.com/docs/components/button-group
|
||||
* @documentation https://backers.webawesome.com/docs/components/button-group
|
||||
* @status stable
|
||||
* @since 2.0
|
||||
*
|
||||
@@ -19,7 +20,7 @@ import styles from './button-group.css';
|
||||
*/
|
||||
@customElement('wa-button-group')
|
||||
export default class WaButtonGroup extends WebAwesomeElement {
|
||||
static css = [variantStyles, styles];
|
||||
static css = [sizeStyles, variantStyles, styles];
|
||||
|
||||
@query('slot') defaultSlot: HTMLSlotElement;
|
||||
|
||||
@@ -35,6 +36,9 @@ export default class WaButtonGroup extends WebAwesomeElement {
|
||||
/** The button group's orientation. */
|
||||
@property({ reflect: true }) orientation: 'horizontal' | 'vertical' = 'horizontal';
|
||||
|
||||
/** The component's size. */
|
||||
@property({ reflect: true }) size: 'small' | 'medium' | 'large'; // unset by default to not override child elements
|
||||
|
||||
/** The button group's theme variant. Defaults to `neutral` if not within another element with a variant. */
|
||||
@property({ reflect: true }) variant: 'neutral' | 'brand' | 'success' | 'warning' | 'danger' = 'neutral';
|
||||
|
||||
@@ -81,6 +85,7 @@ export default class WaButtonGroup extends WebAwesomeElement {
|
||||
|
||||
if (button) {
|
||||
if ((button as WaButton).appearance === 'outlined') this.hasOutlined = true;
|
||||
if (this.size) button.setAttribute('size', this.size);
|
||||
button.classList.add('wa-button-group__button');
|
||||
button.classList.toggle('wa-button-group__horizontal', this.orientation === 'horizontal');
|
||||
button.classList.toggle('wa-button-group__vertical', this.orientation === 'vertical');
|
||||
@@ -96,10 +101,7 @@ 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}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
@layer wa-component {
|
||||
:host {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
:host(:has(wa-badge)) {
|
||||
position: relative;
|
||||
}
|
||||
}
|
||||
@@ -106,10 +103,10 @@
|
||||
var(--wa-color-mix-active)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
:host([appearance~='filled'][appearance~='outlined']) .button {
|
||||
border-color: var(--wa-color-border-normal, var(--wa-color-neutral-border-normal));
|
||||
&:host([appearance~='outlined']) .button {
|
||||
border-color: var(--wa-color-border-normal, var(--wa-color-neutral-border-normal));
|
||||
}
|
||||
}
|
||||
|
||||
:host([appearance~='accent']) {
|
||||
@@ -187,10 +184,6 @@
|
||||
}
|
||||
|
||||
.label {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.is-icon-button .label {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
@@ -316,22 +309,22 @@ slot[name='end']::slotted(*),
|
||||
}
|
||||
|
||||
/* Handle pill modifier for button groups */
|
||||
:host([pill].wa-button-group__horizontal.wa-button-group__button-first) .button {
|
||||
:host([pill]) .wa-button-group__horizontal.wa-button-group__button-first {
|
||||
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) .button {
|
||||
:host([pill]) .wa-button-group__horizontal.wa-button-group__button-last {
|
||||
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) .button {
|
||||
:host([pill]) .wa-button-group__vertical.wa-button-group__button-first {
|
||||
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) .button {
|
||||
:host([pill]) .wa-button-group__vertical.wa-button-group__button-last {
|
||||
border-end-start-radius: var(--wa-border-radius-pill);
|
||||
border-end-end-radius: var(--wa-border-radius-pill);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import styles from './button.css';
|
||||
|
||||
/**
|
||||
* @summary Buttons represent actions that are available to the user.
|
||||
* @documentation https://webawesome.com/docs/components/button
|
||||
* @documentation https://backers.webawesome.com/docs/components/button
|
||||
* @status stable
|
||||
* @since 2.0
|
||||
*
|
||||
|
||||
@@ -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~='filled'][appearance~='outlined']) {
|
||||
border-color: var(--wa-color-border-quiet, var(--wa-color-brand-border-quiet));
|
||||
&:host([appearance~='outlined']) {
|
||||
border-color: var(--wa-color-border-quiet, var(--wa-color-brand-border-quiet));
|
||||
}
|
||||
}
|
||||
|
||||
:host([appearance~='accent']) {
|
||||
|
||||
@@ -7,7 +7,7 @@ import styles from './callout.css';
|
||||
|
||||
/**
|
||||
* @summary Callouts are used to display important messages inline.
|
||||
* @documentation https://webawesome.com/docs/components/callout
|
||||
* @documentation https://backers.webawesome.com/docs/components/callout
|
||||
* @status stable
|
||||
* @since 2.0
|
||||
*
|
||||
@@ -22,11 +22,16 @@ 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';
|
||||
@property({ reflect: true }) variant: 'brand' | 'neutral' | 'success' | 'warning' | 'danger' | 'brand' = 'brand';
|
||||
|
||||
/** The callout's visual appearance. */
|
||||
@property({ reflect: true }) appearance: 'accent' | 'filled' | 'outlined' | 'plain' | 'outlined filled' =
|
||||
'outlined filled';
|
||||
@property({ reflect: true }) appearance:
|
||||
| 'accent'
|
||||
| 'filled'
|
||||
| 'outlined'
|
||||
| 'plain'
|
||||
| 'outlined filled'
|
||||
| 'outlined accent' = 'outlined filled';
|
||||
|
||||
/** The callout's size. */
|
||||
@property({ reflect: true }) size: 'small' | 'medium' | 'large' = 'medium';
|
||||
|
||||
@@ -30,10 +30,10 @@
|
||||
:host([appearance~='filled']) {
|
||||
background-color: var(--wa-color-neutral-fill-quiet);
|
||||
border-color: transparent;
|
||||
}
|
||||
|
||||
:host([appearance~='filled'][appearance~='outlined']) {
|
||||
border-color: var(--wa-color-neutral-border-quiet);
|
||||
&:host([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 !important;
|
||||
border-radius: 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import styles from './card.css';
|
||||
|
||||
/**
|
||||
* @summary Cards can be used to group related subjects in a container.
|
||||
* @documentation https://webawesome.com/docs/components/card
|
||||
* @documentation https://backers.webawesome.com/docs/components/card
|
||||
* @status stable
|
||||
* @since 2.0
|
||||
*
|
||||
|
||||
@@ -46,10 +46,6 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
[part~='label'] {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
/* Checked */
|
||||
[part~='control']:has(:checked, :indeterminate) {
|
||||
color: var(--checked-icon-color);
|
||||
|
||||
@@ -15,7 +15,7 @@ import styles from './checkbox.css';
|
||||
|
||||
/**
|
||||
* @summary Checkboxes allow the user to toggle an option on or off.
|
||||
* @documentation https://webawesome.com/docs/components/checkbox
|
||||
* @documentation https://backers.webawesome.com/docs/components/checkbox
|
||||
* @status stable
|
||||
* @since 2.0
|
||||
*
|
||||
@@ -234,14 +234,13 @@ export default class WaCheckbox extends WebAwesomeFormAssociatedElement {
|
||||
</label>
|
||||
|
||||
<slot
|
||||
id="hint"
|
||||
part="hint"
|
||||
name="hint"
|
||||
aria-hidden=${hasHint ? 'false' : 'true'}
|
||||
class="${classMap({ 'has-slotted': hasHint })}"
|
||||
id="hint"
|
||||
part="hint"
|
||||
>${this.hint}</slot
|
||||
>
|
||||
${this.hint}
|
||||
</slot>
|
||||
`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ declare const EyeDropper: EyeDropperConstructor;
|
||||
|
||||
/**
|
||||
* @summary Color pickers allow the user to select a color.
|
||||
* @documentation https://webawesome.com/docs/components/color-picker
|
||||
* @documentation https://backers.webawesome.com/docs/components/color-picker
|
||||
* @status stable
|
||||
* @since 2.0
|
||||
*
|
||||
@@ -490,7 +490,7 @@ export default class WaColorPicker extends WebAwesomeFormAssociatedElement {
|
||||
const target = event.target as HTMLInputElement;
|
||||
const oldValue = this.value;
|
||||
|
||||
// Prevent the `<wa-input>` element's `change` event from bubbling up
|
||||
// Prevent the `<wa-input>` element's `wa-change` event from bubbling up
|
||||
event.stopPropagation();
|
||||
|
||||
if (this.input.value) {
|
||||
@@ -1310,7 +1310,6 @@ export default class WaColorPicker extends WebAwesomeFormAssociatedElement {
|
||||
></button>
|
||||
|
||||
<slot
|
||||
id="hint"
|
||||
name="hint"
|
||||
part="hint"
|
||||
class=${classMap({
|
||||
|
||||
@@ -11,7 +11,7 @@ import styles from './comparison.css';
|
||||
|
||||
/**
|
||||
* @summary Compare visual differences between similar content with a sliding panel.
|
||||
* @documentation https://webawesome.com/docs/components/comparison
|
||||
* @documentation https://backers.webawesome.com/docs/components/comparison
|
||||
* @status stable
|
||||
* @since 2.0
|
||||
*
|
||||
|
||||
@@ -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://webawesome.com/docs/components/copy
|
||||
* @documentation https://backers.webawesome.com/docs/components/copy
|
||||
* @status experimental
|
||||
* @since 2.7
|
||||
*
|
||||
@@ -191,13 +191,13 @@ export default class WaCopyButton extends WebAwesomeElement {
|
||||
<!-- Render a visually hidden label to appease the accessibility checking gods -->
|
||||
<span class="wa-visually-hidden">${this.currentLabel}</span>
|
||||
<slot part="copy-icon" name="copy-icon">
|
||||
<wa-icon library="system" name="copy" variant="regular"></wa-icon>
|
||||
<wa-icon library="system" name="copy" variant="regular" fixed-width></wa-icon>
|
||||
</slot>
|
||||
<slot part="success-icon" name="success-icon" variant="solid" hidden>
|
||||
<wa-icon library="system" name="check"></wa-icon>
|
||||
<wa-icon library="system" name="check" fixed-width></wa-icon>
|
||||
</slot>
|
||||
<slot part="error-icon" name="error-icon" variant="solid" hidden>
|
||||
<wa-icon library="system" name="xmark"></wa-icon>
|
||||
<wa-icon library="system" name="xmark" fixed-width></wa-icon>
|
||||
</slot>
|
||||
<wa-tooltip
|
||||
class=${classMap({
|
||||
|
||||
@@ -49,26 +49,32 @@ 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~='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'][appearance~='outlined']) details {
|
||||
border-color: var(--wa-color-neutral-border-quiet);
|
||||
}
|
||||
|
||||
:host([appearance='plain']) details {
|
||||
:host([appearance='plain']) {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
@@ -81,7 +87,6 @@ details {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--spacing);
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
cursor: pointer;
|
||||
@@ -102,12 +107,6 @@ details {
|
||||
}
|
||||
}
|
||||
|
||||
/* 'Start' icon placement */
|
||||
:host([icon-placement='start']) summary {
|
||||
flex-direction: row-reverse;
|
||||
justify-content: start;
|
||||
}
|
||||
|
||||
[part~='icon'] {
|
||||
flex: 0 0 auto;
|
||||
display: flex;
|
||||
@@ -129,7 +128,8 @@ details {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.body.animating {
|
||||
/* Overflows get clipped during the closing animation if we don't wait until the close is gone. */
|
||||
:host(:not([open])) .body {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@@ -139,3 +139,10 @@ details {
|
||||
padding-inline: var(--spacing); /* Add horizontal padding */
|
||||
padding-block-end: var(--spacing); /* Add bottom padding */
|
||||
}
|
||||
|
||||
@keyframes show {
|
||||
from {
|
||||
}
|
||||
to {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,9 +196,8 @@ describe('<wa-details>', () => {
|
||||
await first.show();
|
||||
await second.show();
|
||||
|
||||
// height + 32 (padding probably?)
|
||||
expect(firstBody.clientHeight).to.equal(232);
|
||||
expect(secondBody.clientHeight).to.equal(432);
|
||||
expect(firstBody.clientHeight).to.equal(200);
|
||||
expect(secondBody.clientHeight).to.equal(400);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import type { PropertyValues } from 'lit';
|
||||
import { html } from 'lit';
|
||||
import { customElement, property, query, state } from 'lit/decorators.js';
|
||||
import { classMap } from 'lit/directives/class-map.js';
|
||||
import { customElement, property, query } from 'lit/decorators.js';
|
||||
import { WaAfterHideEvent } from '../../events/after-hide.js';
|
||||
import { WaAfterShowEvent } from '../../events/after-show.js';
|
||||
import { WaHideEvent } from '../../events/hide.js';
|
||||
@@ -16,7 +14,7 @@ import styles from './details.css';
|
||||
|
||||
/**
|
||||
* @summary Details show a brief summary and expand to show additional content.
|
||||
* @documentation https://webawesome.com/docs/components/details
|
||||
* @documentation https://backers.webawesome.com/docs/components/details
|
||||
* @status stable
|
||||
* @since 2.0
|
||||
*
|
||||
@@ -42,8 +40,6 @@ import styles from './details.css';
|
||||
* @cssproperty --spacing - The amount of space around and between the details' content. Expects a single value.
|
||||
* @cssproperty [--show-duration=200ms] - The show duration to use when applying built-in animation classes.
|
||||
* @cssproperty [--hide-duration=200ms] - The hide duration to use when applying built-in animation classes.
|
||||
*
|
||||
* @cssstate animating - Applied when the details is animating expand/collapse.
|
||||
*/
|
||||
@customElement('wa-details')
|
||||
export default class WaDetails extends WebAwesomeElement {
|
||||
@@ -57,8 +53,6 @@ export default class WaDetails extends WebAwesomeElement {
|
||||
@query('.body') body: HTMLElement;
|
||||
@query('.expand-icon-slot') expandIconSlot: HTMLSlotElement;
|
||||
|
||||
@state() isAnimating = false;
|
||||
|
||||
/**
|
||||
* Indicates whether or not the details is open. You can toggle this attribute to show and hide the details, or you
|
||||
* can use the `show()` and `hide()` methods and this attribute will reflect the details' open state.
|
||||
@@ -77,14 +71,6 @@ export default class WaDetails extends WebAwesomeElement {
|
||||
/** The element's visual appearance. */
|
||||
@property({ reflect: true }) appearance: 'filled' | 'outlined' | 'plain' = 'outlined';
|
||||
|
||||
/** The location of the expand/collapse icon. */
|
||||
@property({ attribute: 'icon-placement', reflect: true }) iconPlacement: 'start' | 'end' = 'end';
|
||||
|
||||
disconnectedCallback() {
|
||||
super.disconnectedCallback();
|
||||
this.detailsObserver?.disconnect();
|
||||
}
|
||||
|
||||
firstUpdated() {
|
||||
this.body.style.height = this.open ? 'auto' : '0';
|
||||
if (this.open) {
|
||||
@@ -105,10 +91,9 @@ export default class WaDetails extends WebAwesomeElement {
|
||||
this.detailsObserver.observe(this.details, { attributes: true });
|
||||
}
|
||||
|
||||
updated(changedProperties: PropertyValues<this>) {
|
||||
if (changedProperties.has('isAnimating')) {
|
||||
this.customStates.set('animating', this.isAnimating);
|
||||
}
|
||||
disconnectedCallback() {
|
||||
super.disconnectedCallback();
|
||||
this.detailsObserver?.disconnect();
|
||||
}
|
||||
|
||||
private handleSummaryClick(event: MouseEvent) {
|
||||
@@ -183,7 +168,6 @@ export default class WaDetails extends WebAwesomeElement {
|
||||
// Close other details with the same name
|
||||
this.closeOthersWithSameName();
|
||||
|
||||
this.isAnimating = true;
|
||||
const duration = parseDuration(getComputedStyle(this.body).getPropertyValue('--show-duration'));
|
||||
// We can't animate to 'auto', so use the scroll height for now
|
||||
await animate(
|
||||
@@ -198,7 +182,6 @@ export default class WaDetails extends WebAwesomeElement {
|
||||
},
|
||||
);
|
||||
this.body.style.height = 'auto';
|
||||
this.isAnimating = false;
|
||||
|
||||
this.dispatchEvent(new WaAfterShowEvent());
|
||||
} else {
|
||||
@@ -211,7 +194,6 @@ export default class WaDetails extends WebAwesomeElement {
|
||||
return;
|
||||
}
|
||||
|
||||
this.isAnimating = true;
|
||||
const duration = parseDuration(getComputedStyle(this.body).getPropertyValue('--hide-duration'));
|
||||
// We can't animate from 'auto', so use the scroll height for now
|
||||
await animate(
|
||||
@@ -223,7 +205,7 @@ export default class WaDetails extends WebAwesomeElement {
|
||||
{ duration, easing: 'linear' },
|
||||
);
|
||||
this.body.style.height = 'auto';
|
||||
this.isAnimating = false;
|
||||
|
||||
this.details.open = false;
|
||||
this.dispatchEvent(new WaAfterHideEvent());
|
||||
}
|
||||
@@ -268,22 +250,25 @@ export default class WaDetails extends WebAwesomeElement {
|
||||
|
||||
<span part="icon">
|
||||
<slot name="expand-icon">
|
||||
<wa-icon library="system" variant="solid" name=${isRtl ? 'chevron-left' : 'chevron-right'}></wa-icon>
|
||||
<wa-icon
|
||||
library="system"
|
||||
variant="solid"
|
||||
name=${isRtl ? 'chevron-left' : 'chevron-right'}
|
||||
fixed-width
|
||||
></wa-icon>
|
||||
</slot>
|
||||
<slot name="collapse-icon">
|
||||
<wa-icon library="system" variant="solid" name=${isRtl ? 'chevron-left' : 'chevron-right'}></wa-icon>
|
||||
<wa-icon
|
||||
library="system"
|
||||
variant="solid"
|
||||
name=${isRtl ? 'chevron-left' : 'chevron-right'}
|
||||
fixed-width
|
||||
></wa-icon>
|
||||
</slot>
|
||||
</span>
|
||||
</summary>
|
||||
|
||||
<div
|
||||
class=${classMap({
|
||||
body: true,
|
||||
animating: this.isAnimating,
|
||||
})}
|
||||
role="region"
|
||||
aria-labelledby="header"
|
||||
>
|
||||
<div class="body" role="region" aria-labelledby="header">
|
||||
<slot part="content" id="content" class="content"></slot>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
@@ -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://webawesome.com/docs/components/dialog
|
||||
* @documentation https://backers.webawesome.com/docs/components/dialog
|
||||
* @status stable
|
||||
* @since 2.0
|
||||
*
|
||||
@@ -205,7 +205,9 @@ export default class WaDialog extends WebAwesomeElement {
|
||||
}
|
||||
|
||||
render() {
|
||||
const hasHeader = !this.withoutHeader;
|
||||
const hasHeader =
|
||||
!this.withoutHeader &&
|
||||
(this.label.length > 0 || this.hasSlotController.test('label') || this.hasSlotController.test('header-actions'));
|
||||
const hasFooter = this.hasSlotController.test('footer');
|
||||
|
||||
return html`
|
||||
|
||||
@@ -5,7 +5,7 @@ import styles from './divider.css';
|
||||
|
||||
/**
|
||||
* @summary Dividers are used to visually separate or group elements.
|
||||
* @documentation https://webawesome.com/docs/components/divider
|
||||
* @documentation https://backers.webawesome.com/docs/components/divider
|
||||
* @status stable
|
||||
* @since 2.0
|
||||
*
|
||||
|
||||
@@ -17,7 +17,7 @@ import styles from './drawer.css';
|
||||
|
||||
/**
|
||||
* @summary Drawers slide in from a container to expose additional options and information.
|
||||
* @documentation https://webawesome.com/docs/components/drawer
|
||||
* @documentation https://backers.webawesome.com/docs/components/drawer
|
||||
* @status stable
|
||||
* @since 2.0
|
||||
*
|
||||
@@ -218,7 +218,9 @@ export default class WaDrawer extends WebAwesomeElement {
|
||||
}
|
||||
|
||||
render() {
|
||||
const hasHeader = !this.withoutHeader;
|
||||
const hasHeader =
|
||||
!this.withoutHeader &&
|
||||
(this.label.length > 0 || this.hasSlotController.test('label') || this.hasSlotController.test('header-actions'));
|
||||
const hasFooter = this.hasSlotController.test('footer');
|
||||
|
||||
return html`
|
||||
|
||||
@@ -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://webawesome.com/docs/components/dropdown-item
|
||||
* @documentation https://backers.webawesome.com/docs/components/dropdown-item
|
||||
* @status experimental
|
||||
* @since 3.0
|
||||
*
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
|
||||
#menu {
|
||||
display: flex;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
flex-direction: column;
|
||||
width: max-content;
|
||||
margin: 0;
|
||||
@@ -17,9 +20,6 @@
|
||||
color: var(--wa-color-text-normal);
|
||||
text-align: start;
|
||||
user-select: none;
|
||||
overflow: auto;
|
||||
max-width: var(--auto-size-available-width) !important;
|
||||
max-height: var(--auto-size-available-height) !important;
|
||||
|
||||
&.show {
|
||||
animation: show var(--show-duration) ease;
|
||||
|
||||
@@ -8,7 +8,6 @@ import { WaAfterShowEvent } from '../../events/after-show.js';
|
||||
import { WaHideEvent } from '../../events/hide.js';
|
||||
import { WaSelectEvent } from '../../events/select.js';
|
||||
import { WaShowEvent } from '../../events/show.js';
|
||||
import { activeElements } from '../../internal/active-elements.js';
|
||||
import { animateWithClass } from '../../internal/animate.js';
|
||||
import { uniqueId } from '../../internal/math.js';
|
||||
import WebAwesomeElement from '../../internal/webawesome-element.js';
|
||||
@@ -25,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://webawesome.com/docs/components/dropdown
|
||||
* @documentation https://backers.webawesome.com/docs/components/dropdown
|
||||
* @status stable
|
||||
* @since 2.0
|
||||
*
|
||||
@@ -124,30 +123,19 @@ export default class WaDropdown extends WebAwesomeElement {
|
||||
}
|
||||
}
|
||||
|
||||
/** Gets all dropdown items slotted in the menu. */
|
||||
/** Gets all <wa-dropdown-item> elements slotted in the menu that aren't disabled. */
|
||||
private getItems(includeDisabled = false): WaDropdownItem[] {
|
||||
const items = this.defaultSlot
|
||||
.assignedElements({ flatten: true })
|
||||
.filter(el => el.localName === 'wa-dropdown-item') as WaDropdownItem[];
|
||||
|
||||
const items = [...this.children].filter(
|
||||
el => el.localName === 'wa-dropdown-item' && !el.hasAttribute('slot'),
|
||||
) as WaDropdownItem[];
|
||||
return includeDisabled ? items : items.filter(item => !item.disabled);
|
||||
}
|
||||
|
||||
/** Gets all dropdown items in a specific submenu. */
|
||||
private getSubmenuItems(parentItem: WaDropdownItem, includeDisabled = false): WaDropdownItem[] {
|
||||
// Find the submenu slot within the parent item
|
||||
const submenuSlot =
|
||||
parentItem.shadowRoot?.querySelector<HTMLSlotElement>('slot[name="submenu"]') ||
|
||||
parentItem.querySelector<HTMLSlotElement>('slot[name="submenu"]');
|
||||
if (!submenuSlot) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// Get the items from the submenu slot
|
||||
const items = submenuSlot
|
||||
.assignedElements({ flatten: true })
|
||||
.filter(el => el.localName === 'wa-dropdown-item') as WaDropdownItem[];
|
||||
|
||||
const items = [...parentItem.children].filter(
|
||||
el => el.localName === 'wa-dropdown-item' && el.getAttribute('slot') === 'submenu',
|
||||
) as WaDropdownItem[];
|
||||
return includeDisabled ? items : items.filter(item => !item.disabled);
|
||||
}
|
||||
|
||||
@@ -289,7 +277,7 @@ export default class WaDropdown extends WebAwesomeElement {
|
||||
return;
|
||||
}
|
||||
|
||||
const activeElement = [...activeElements()].find(el => el.localName === 'wa-dropdown-item');
|
||||
const activeElement = document.activeElement as HTMLElement;
|
||||
const isFocusedOnItem = activeElement?.localName === 'wa-dropdown-item';
|
||||
const currentSubmenuItem = this.getCurrentSubmenuItem();
|
||||
const isInSubmenu = !!currentSubmenuItem;
|
||||
@@ -710,18 +698,7 @@ 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}
|
||||
flip
|
||||
flip-fallback-strategy="best-fit"
|
||||
shift
|
||||
shift-padding="10"
|
||||
auto-size="vertical"
|
||||
auto-size-padding="10"
|
||||
>
|
||||
<wa-popup placement=${this.placement} distance=${this.distance} skidding=${this.skidding} ?active=${active}>
|
||||
<slot
|
||||
name="trigger"
|
||||
slot="anchor"
|
||||
|
||||
@@ -4,7 +4,7 @@ import { LocalizeController } from '../../utilities/localize.js';
|
||||
|
||||
/**
|
||||
* @summary Formats a number as a human readable bytes value.
|
||||
* @documentation https://webawesome.com/docs/components/format-bytes
|
||||
* @documentation https://backers.webawesome.com/docs/components/format-bytes
|
||||
* @status stable
|
||||
* @since 2.0
|
||||
*/
|
||||
|
||||
@@ -5,7 +5,7 @@ import { LocalizeController } from '../../utilities/localize.js';
|
||||
|
||||
/**
|
||||
* @summary Formats a date/time using the specified locale and options.
|
||||
* @documentation https://webawesome.com/docs/components/format-date
|
||||
* @documentation https://backers.webawesome.com/docs/components/format-date
|
||||
* @status stable
|
||||
* @since 2.0
|
||||
*/
|
||||
|
||||
@@ -4,7 +4,7 @@ import { LocalizeController } from '../../utilities/localize.js';
|
||||
|
||||
/**
|
||||
* @summary Formats a number using the specified locale and options.
|
||||
* @documentation https://webawesome.com/docs/components/format-number
|
||||
* @documentation https://backers.webawesome.com/docs/components/format-number
|
||||
* @status stable
|
||||
* @since 2.0
|
||||
*/
|
||||
|
||||
@@ -4,38 +4,30 @@
|
||||
--secondary-color: currentColor;
|
||||
--secondary-opacity: 0.4;
|
||||
|
||||
box-sizing: content-box;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
vertical-align: -0.125em;
|
||||
}
|
||||
|
||||
/* Standard */
|
||||
:host(:not([auto-width])) {
|
||||
width: 1.25em;
|
||||
height: 1em;
|
||||
}
|
||||
|
||||
/* Auto-width */
|
||||
:host([auto-width]) {
|
||||
box-sizing: content-box !important;
|
||||
width: auto;
|
||||
height: 1em;
|
||||
}
|
||||
|
||||
svg {
|
||||
height: 1em;
|
||||
display: inline-block;
|
||||
width: auto;
|
||||
height: inherit;
|
||||
fill: currentColor;
|
||||
overflow: visible;
|
||||
|
||||
/* Duotone colors with path-specific opacity fallback */
|
||||
path[data-duotone-primary] {
|
||||
.fa-primary {
|
||||
color: var(--primary-color);
|
||||
opacity: var(--path-opacity, var(--primary-opacity));
|
||||
opacity: var(--primary-opacity);
|
||||
}
|
||||
|
||||
path[data-duotone-secondary] {
|
||||
.fa-secondary {
|
||||
color: var(--secondary-color);
|
||||
opacity: var(--path-opacity, var(--secondary-opacity));
|
||||
opacity: var(--secondary-opacity);
|
||||
}
|
||||
}
|
||||
|
||||
:host([fixed-width]) {
|
||||
width: 1em;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
@@ -133,6 +133,17 @@ describe('<wa-icon>', () => {
|
||||
});
|
||||
|
||||
describe('negative cases', () => {
|
||||
// using new library so we can test for malformed icons when registered
|
||||
it("svg not rendered with an icon that doesn't exist in the library", async () => {
|
||||
const el = await fixture<WaIcon>(html` <wa-icon library="test-library" name="does-not-exist"></wa-icon> `);
|
||||
|
||||
// Still renders svgs for empty icons.
|
||||
expect(el.shadowRoot?.querySelector('svg')).to.be.instanceof(SVGElement);
|
||||
|
||||
expect(el.getBoundingClientRect().height).to.equal(16);
|
||||
expect(el.getBoundingClientRect().width).to.equal(16);
|
||||
});
|
||||
|
||||
it('emits wa-error when the file cant be retrieved', async () => {
|
||||
const el = await fixture<WaIcon>(html` <wa-icon library="test-library"></wa-icon> `);
|
||||
const listener = oneEvent(el, 'wa-error') as Promise<WaErrorEvent>;
|
||||
|
||||
@@ -24,7 +24,7 @@ interface IconSource {
|
||||
|
||||
/**
|
||||
* @summary Icons are symbols that can be used to represent various options within an application.
|
||||
* @documentation https://webawesome.com/docs/components/icon
|
||||
* @documentation https://backers.webawesome.com/docs/components/icon
|
||||
* @status stable
|
||||
* @since 2.0
|
||||
*
|
||||
@@ -63,11 +63,8 @@ export default class WaIcon extends WebAwesomeElement {
|
||||
*/
|
||||
@property() variant: string;
|
||||
|
||||
/** Sets the width of the icon to match the cropped SVG viewBox. This operates like the Font `fa-width-auto` class. */
|
||||
@property({ attribute: 'auto-width', type: Boolean, reflect: true }) autoWidth: false;
|
||||
|
||||
/** Swaps the opacity of duotone icons. */
|
||||
@property({ attribute: 'swap-opacity', type: Boolean, reflect: true }) swapOpacity = false;
|
||||
/** Draws the icon in a fixed-width both. */
|
||||
@property({ attribute: 'fixed-width', type: Boolean, reflect: true }) fixedWidth: false;
|
||||
|
||||
/**
|
||||
* An external URL of an SVG file. Be sure you trust the content you are including, as it will be executed as code and
|
||||
@@ -106,7 +103,7 @@ export default class WaIcon extends WebAwesomeElement {
|
||||
|
||||
if (this.name && library) {
|
||||
return {
|
||||
url: library.resolver(this.name, family, this.variant, this.autoWidth),
|
||||
url: library.resolver(this.name, family, this.variant),
|
||||
fromLibrary: true,
|
||||
};
|
||||
}
|
||||
@@ -118,7 +115,7 @@ export default class WaIcon extends WebAwesomeElement {
|
||||
}
|
||||
|
||||
/** Given a URL, this function returns the resulting SVG element or an appropriate error symbol. */
|
||||
private resolveIcon = async (url: string, library?: IconLibrary): Promise<SVGResult> => {
|
||||
private async resolveIcon(url: string, library?: IconLibrary): Promise<SVGResult> {
|
||||
let fileData: Response;
|
||||
|
||||
if (library?.spriteSheet) {
|
||||
@@ -136,10 +133,10 @@ export default class WaIcon extends WebAwesomeElement {
|
||||
// to be passed to the library's mutator function.
|
||||
await this.updateComplete;
|
||||
|
||||
const svg = this.shadowRoot!.querySelector<SVGElement>("[part='svg']")!;
|
||||
const svg = this.shadowRoot!.querySelector("[part='svg']")!;
|
||||
|
||||
if (typeof library.mutator === 'function') {
|
||||
library.mutator(svg, this);
|
||||
library.mutator(svg as SVGElement);
|
||||
}
|
||||
|
||||
return this.svg;
|
||||
@@ -170,7 +167,7 @@ export default class WaIcon extends WebAwesomeElement {
|
||||
} catch {
|
||||
return CACHEABLE_ERROR;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@watch('label')
|
||||
handleLabelChange() {
|
||||
@@ -187,7 +184,7 @@ export default class WaIcon extends WebAwesomeElement {
|
||||
}
|
||||
}
|
||||
|
||||
@watch(['family', 'name', 'library', 'variant', 'src', 'autoWidth', 'swapOpacity'])
|
||||
@watch(['family', 'name', 'library', 'variant', 'src'])
|
||||
async setIcon() {
|
||||
const { url, fromLibrary } = this.getIconSource();
|
||||
const library = fromLibrary ? getIconLibrary(this.library) : undefined;
|
||||
@@ -227,7 +224,7 @@ export default class WaIcon extends WebAwesomeElement {
|
||||
break;
|
||||
default:
|
||||
this.svg = svg.cloneNode(true) as SVGElement;
|
||||
library?.mutator?.(this.svg, this);
|
||||
library?.mutator?.(this.svg);
|
||||
this.dispatchEvent(new WaLoadEvent());
|
||||
}
|
||||
}
|
||||
@@ -240,7 +237,7 @@ export default class WaIcon extends WebAwesomeElement {
|
||||
|
||||
const svg = this.shadowRoot?.querySelector('svg');
|
||||
if (svg) {
|
||||
library?.mutator?.(svg, this);
|
||||
library?.mutator?.(svg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user