mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-15 13:39:14 +00:00
Compare commits
37 Commits
include-er
...
lm/theming
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c3ddc303cc | ||
|
|
b57225d5b0 | ||
|
|
c29e4cadf5 | ||
|
|
e5cf6e8757 | ||
|
|
69ea84b490 | ||
|
|
f83707a9e4 | ||
|
|
3451255454 | ||
|
|
20628a98eb | ||
|
|
05bb1f3630 | ||
|
|
b2a2d0b9fd | ||
|
|
3d4b3ada27 | ||
|
|
0bead172fe | ||
|
|
9ca3e6f39c | ||
|
|
e2c7286ccc | ||
|
|
46812e08c5 | ||
|
|
0f601df74a | ||
|
|
eb2410ff88 | ||
|
|
479fff4b61 | ||
|
|
9c7b341889 | ||
|
|
d09973b571 | ||
|
|
a03da137e3 | ||
|
|
d8b0447151 | ||
|
|
6f0bd4e872 | ||
|
|
55973a7eff | ||
|
|
e9aa72cc87 | ||
|
|
9716ecec41 | ||
|
|
776b980ce5 | ||
|
|
02f58d3c8b | ||
|
|
fba18efad6 | ||
|
|
4a7f9dfe00 | ||
|
|
1fbde40bab | ||
|
|
14bd0459df | ||
|
|
e4a4d2eb18 | ||
|
|
a465f0348f | ||
|
|
5e1eba1751 | ||
|
|
00f79f3749 | ||
|
|
788804774f |
4
.github/ISSUE_TEMPLATE/config.yml
vendored
4
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,7 +1,7 @@
|
||||
contact_links:
|
||||
- name: Feature Requests
|
||||
url: https://github.com/shoelace-style/shoelace/discussions/categories/ideas
|
||||
url: https://github.com/shoelace-style/webawesome/discussions/categories/ideas-suggestions
|
||||
about: All requests for new features should go here.
|
||||
- name: Help & Support
|
||||
url: https://github.com/shoelace-style/shoelace/discussions/categories/help
|
||||
url: https://github.com/shoelace-style/webawesome/discussions/categories/ask-for-help
|
||||
about: Please don't create issues for personal help requests. Instead, ask your question on the discussion forum.
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
3.0.0-beta.5
|
||||
3.0.0-beta.6
|
||||
3.0.0
|
||||
|
||||
2
package-lock.json
generated
2
package-lock.json
generated
@@ -14013,7 +14013,7 @@
|
||||
},
|
||||
"packages/webawesome": {
|
||||
"name": "@awesome.me/webawesome",
|
||||
"version": "3.0.0-beta.6",
|
||||
"version": "3.0.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@ctrl/tinycolor": "4.1.0",
|
||||
|
||||
@@ -102,6 +102,31 @@ export default async function (eleventyConfig) {
|
||||
image: 'https://webawesome.com/assets/images/open-graph/default.png',
|
||||
};
|
||||
|
||||
// Title composition/stripping config - single source of truth
|
||||
const SITE_NAME = siteMetadata.name;
|
||||
const SITE_TITLE_SEPARATORS = ['|'];
|
||||
|
||||
// Helper to escape user-provided strings for safe use inside RegExp sources
|
||||
const escapeRegExp = string => (string + '').replace(/[.*+?^${}()|[\\]\\]/g, '\\$&');
|
||||
|
||||
// Precompute a reusable regex to strip a trailing site name suffix from titles, e.g. " | Web Awesome"
|
||||
// Supports configured separators and flexible whitespace. This keeps search titles clean and improves Lunr scoring
|
||||
const siteNameEscapedForRegex = escapeRegExp(SITE_NAME);
|
||||
const separatorsEscaped = SITE_TITLE_SEPARATORS.map(s => escapeRegExp(s)).join('');
|
||||
const siteTitleSuffixPattern = new RegExp(`\\s*[${separatorsEscaped}]\\s*${siteNameEscapedForRegex}$`);
|
||||
|
||||
// Helper to remove the site suffix from a page title. Keep this in sync with how page titles
|
||||
// are composed (see eleventyComputed.pageTitle) so search indexing stays consistent
|
||||
const stripSiteTitleSuffix = title => (title || '').replace(siteTitleSuffixPattern, '');
|
||||
|
||||
// Helper to compose a full page title with site suffix when appropriate
|
||||
// Uses the same separator set as the stripping logic for consistency
|
||||
const composePageTitle = baseTitle => {
|
||||
const title = baseTitle || SITE_NAME;
|
||||
const preferredSeparator = SITE_TITLE_SEPARATORS[0] || '|';
|
||||
return title !== SITE_NAME ? `${title} ${preferredSeparator} ${SITE_NAME}` : title;
|
||||
};
|
||||
|
||||
eleventyConfig.addGlobalData('siteMetadata', siteMetadata);
|
||||
|
||||
// Template filters - {{ content | filter }}
|
||||
@@ -182,8 +207,10 @@ export default async function (eleventyConfig) {
|
||||
// Attach lastUpdatedISO to page data so templates can use {{ lastUpdatedISO }} directly
|
||||
eleventyConfig.addGlobalData('eleventyComputed', {
|
||||
lastUpdatedISO: data => getLastModifiedISO(data.page?.inputPath, data.lastUpdated),
|
||||
// Open Graph metadata with smart defaults
|
||||
ogTitle: data => data.ogTitle || data.title,
|
||||
// Page title with smart + default site name formatting
|
||||
pageTitle: data => composePageTitle(data.title),
|
||||
// Open Graph title with smart + default site name formatting
|
||||
ogTitle: data => composePageTitle(data.ogTitle || data.title),
|
||||
ogDescription: data => data.ogDescription || data.description,
|
||||
ogImage: data => data.ogImage || siteMetadata.image,
|
||||
ogUrl: data => {
|
||||
@@ -346,6 +373,11 @@ export default async function (eleventyConfig) {
|
||||
searchPlugin({
|
||||
filename: '',
|
||||
selectorsToIgnore: ['code.example'],
|
||||
// Use <title> but strip a trailing site name suffix for cleaner search results
|
||||
getTitle: doc => {
|
||||
const raw = doc.querySelector('title')?.textContent ?? '';
|
||||
return stripSiteTitleSuffix(raw);
|
||||
},
|
||||
getContent: doc => doc.querySelector('#content')?.textContent ?? '',
|
||||
}),
|
||||
);
|
||||
|
||||
19
packages/webawesome/docs/_includes/_banner-wa-launch.njk
Normal file
19
packages/webawesome/docs/_includes/_banner-wa-launch.njk
Normal file
@@ -0,0 +1,19 @@
|
||||
{% raw %}
|
||||
{%- if not currentUser.hasPro -%}
|
||||
<div slot="banner" class="banner-wa-launch wa-dark">
|
||||
<div class="banner-content wa-split">
|
||||
<div class="wa-cluster wa-gap-s">
|
||||
<wa-icon name="badge-percent" class="banner-icon"></wa-icon>
|
||||
<p class="wa-body-s">
|
||||
<strong style="margin-inline-end: var(--wa-space-2xs)">Web Awesome is here!</strong>
|
||||
Celebrate with <span class="appearance-underlined variant-drawn">20% off</span> on a Web Awesome Pro plan… <span class="appearance-underlined variant-drawn">for life</span>!
|
||||
</p>
|
||||
</div>
|
||||
<wa-button appearance="outlined" variant="brand" size="small" href="/purchase" class="brand-font">
|
||||
<wa-icon slot="start" variant="regular" name="rocket-launch"></wa-icon>
|
||||
Get Pro + Save 20%
|
||||
</wa-button>
|
||||
</div>
|
||||
</div>
|
||||
{%- endif -%}
|
||||
{% endraw %}
|
||||
@@ -1,5 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" data-fa-kit-code="38c11e3f20" data-cdn-url="{% cdnUrl %}" class="wa-cloak">
|
||||
{% if hasAnchors == undefined %}{% set hasAnchors = true %}{% endif %}
|
||||
{% if hasBanner == undefined %}{% set hasBanner = true %}{% endif %}
|
||||
{% if hasGeneratedTitle == undefined %}{% set hasGeneratedTitle = true %}{% endif %}
|
||||
<html lang="en" data-fa-kit-code="38c11e3f20" data-version="{{ package.version }}" class="wa-cloak"{% if hasAnchors == false %} data-no-anchor{% endif %}>
|
||||
<head>
|
||||
{% include 'head.njk' %}
|
||||
<meta name="theme-color" content="#f36944">
|
||||
@@ -27,7 +30,8 @@
|
||||
</script>
|
||||
</head>
|
||||
<body class="layout-{{ layout | stripExtension }} page-{{ pageClass or page.fileSlug or 'home' }}{{ ' page-wide' if wide }}">
|
||||
{% set defaultWaPageAttributes = defaultWaPageAttributes or { view: 'desktop', 'disable-navigation-toggle': true, 'mobile-breakpoint': 1180 } %}
|
||||
|
||||
{% set defaultWaPageAttributes = defaultWaPageAttributes or { view: 'desktop', 'disable-navigation-toggle': true, 'mobile-breakpoint': 1180, 'disable-sticky': 'banner' } %}
|
||||
{% set waPageAttributes = waPageAttributes or {} %}
|
||||
{% set mergedWaPageAttributes = defaultWaPageAttributes | merge(waPageAttributes) %}
|
||||
<wa-page
|
||||
@@ -37,6 +41,13 @@
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
>
|
||||
{% block pageBanner %}
|
||||
{% if hasBanner %}
|
||||
{#- WA Launch Banner -#}
|
||||
{% include "_banner-wa-launch.njk" ignore missing %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block pageHeader %}
|
||||
<header slot="header" class="wa-split">
|
||||
{# Nav toggle #}
|
||||
@@ -109,7 +120,9 @@
|
||||
<div id="flashes">{% server "flashes" %}</div>
|
||||
|
||||
{% block header %}
|
||||
<h1 class="title">{{ title }}</h1>
|
||||
{% if hasGeneratedTitle %}
|
||||
<h1 class="title">{{ title }}</h1>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block beforeContent %}{% endblock %}
|
||||
|
||||
7
packages/webawesome/docs/_includes/free-badge.njk
Normal file
7
packages/webawesome/docs/_includes/free-badge.njk
Normal file
@@ -0,0 +1,7 @@
|
||||
{% macro freeBadge(params) %}
|
||||
{% set description = params.description or "This feature is available in the free version of Web Awesome" %}
|
||||
{% set badgeId = params.id or ("free-badge-" + ("" | uniqueId(8))) %}
|
||||
<wa-badge appearance="filled" variant="neutral" pill class="free" id="{{ badgeId }}" data-free-badge>Free</wa-badge>
|
||||
<wa-tooltip for="{{ badgeId }}">{{ description }}</wa-tooltip>
|
||||
{% endmacro %}
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
<meta name="description" content="{{ description }}">
|
||||
{% if noindex or unlisted %}<meta name="robots" content="noindex">{% endif %}
|
||||
|
||||
<title>{{ title }} | {{ siteMetadata.name }}</title>
|
||||
<title>{{ pageTitle }}</title>
|
||||
|
||||
{# Skip OG tags for unlisted/noindex pages to prevent social sharing #}
|
||||
{% if not (noindex or unlisted) %}
|
||||
<meta property="og:type" content="{{ ogType }}" />
|
||||
<meta property="og:url" content="{{ ogUrl }}" />
|
||||
<meta property="og:title" content="{{ ogTitle }} | {{ siteMetadata.name }}" />
|
||||
<meta property="og:title" content="{{ ogTitle }}" />
|
||||
<meta property="og:description" content="{{ ogDescription }}" />
|
||||
<meta property="og:image" content="{{ ogImage }}" />
|
||||
<meta property="og:site_name" content="{{ siteMetadata.name }}" />
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{% macro proBadge(params) %}
|
||||
{% set description = params.description or "This requires access to Web Awesome Pro" %}
|
||||
{% set badgeId = params.id or ("pro-badge-" + ("" | uniqueId(8))) %}
|
||||
<wa-badge appearance="accent" pill class="pro" id="{{ badgeId }}">Pro</wa-badge>
|
||||
<wa-badge appearance="accent" pill class="pro" id="{{ badgeId }}" data-pro-badge>Pro</wa-badge>
|
||||
<wa-tooltip for="{{ badgeId }}">{{ description }}</wa-tooltip>
|
||||
{% endmacro %}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<li><a href="/docs/resources/contributing">Contributing</a></li>
|
||||
<li><a href="/docs/resources/changelog">Changelog</a></li>
|
||||
<li><a href="/docs/resources/visual-tests">Visual Tests</a></li>
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
@@ -101,6 +101,7 @@
|
||||
<li><a href="/docs/components/dropdown-item">Dropdown Item</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><span class="is-planned wa-split">File Input <a href="https://github.com/shoelace-style/webawesome/issues/1240" target="_blank">{{ plannedBadge("A Web Awesome Kickstarter stretch goal!") }}</a></span></li>
|
||||
<li><a href="/docs/components/format-bytes/">Format Bytes</a></li>
|
||||
<li><a href="/docs/components/format-date/">Format Date</a></li>
|
||||
<li><a href="/docs/components/format-number/">Format Number</a></li>
|
||||
@@ -109,6 +110,7 @@
|
||||
<li><a href="/docs/components/input/">Input</a></li>
|
||||
<li><a href="/docs/components/intersection-observer">Intersection Observer</a></li>
|
||||
<li><a href="/docs/components/mutation-observer/">Mutation Observer</a></li>
|
||||
<li><span class="is-planned wa-split">Number Input <a href="https://github.com/shoelace-style/webawesome/issues/1688" target="_blank">{{ plannedBadge("A Web Awesome Kickstarter stretch goal!") }}</a></span></li>
|
||||
<li><a href="/docs/components/popover/">Popover</a></li>
|
||||
<li><a href="/docs/components/popup/">Popup</a></li>
|
||||
<li><a href="/docs/components/progress-bar/">Progress Bar</a></li>
|
||||
@@ -144,9 +146,15 @@
|
||||
</li>
|
||||
<li><a href="/docs/components/tag/">Tag</a></li>
|
||||
<li><a href="/docs/components/textarea/">Textarea</a></li>
|
||||
<li><span class="is-planned wa-split">Toast <a href="https://github.com/shoelace-style/webawesome/issues/105" target="_blank">{{ plannedBadge("A Web Awesome Kickstarter stretch goal!") }}</a></span></li>
|
||||
<li><a href="/docs/components/tooltip/">Tooltip</a></li>
|
||||
<li><a href="/docs/components/tree/">Tree</a></li>
|
||||
<li><a href="/docs/components/tree-item/">Tree Item</a></li>
|
||||
<li>
|
||||
<a href="/docs/components/tree/">Tree</a>
|
||||
<ul>
|
||||
<li><a href="/docs/components/tree-item/">Tree Item</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><span class="is-planned wa-split">Video <a href="https://github.com/shoelace-style/webawesome/issues/985" target="_blank">{{ plannedBadge("A Web Awesome Kickstarter stretch goal!") }}</a></span></li>
|
||||
<li><a href="/docs/components/zoomable-frame">Zoomable Frame</a></li>
|
||||
{# PLOP_NEW_COMPONENT_PLACEHOLDER #}
|
||||
</ul>
|
||||
@@ -365,9 +373,6 @@
|
||||
<li>
|
||||
<a href="/docs/patterns/layouts/ecommerce/">Ecommerce</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/docs/patterns/layouts/app/">App</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/docs/patterns/layouts/blog/">Blog</a>
|
||||
</li>
|
||||
|
||||
195
packages/webawesome/docs/_includes/theming/color-palettes.njk
Normal file
195
packages/webawesome/docs/_includes/theming/color-palettes.njk
Normal file
@@ -0,0 +1,195 @@
|
||||
{% for palette in themer.palettes %}
|
||||
<link rel="stylesheet" href="/dist/styles/color/palettes/{{palette.filename}}" />
|
||||
{% endfor %}
|
||||
|
||||
<div id="color-palettes" class="wa-stack wa-gap-xl">
|
||||
<wa-radio-group id="palette-picker" value="default" class="radio-cards">
|
||||
<span slot="label" class="wa-visually-hidden">Color Palette</span>
|
||||
<div class="wa-grid">
|
||||
{%- for palette in themer.palettes -%}
|
||||
{%- if not palette.isPro -%}
|
||||
<wa-radio value="{{ palette.name | lower }}">
|
||||
<div class="wa-stack wa-gap-xs">
|
||||
<span>{{ palette.name }}</span>
|
||||
<div class="wa-palette-{{ palette.name | lower }} palette-preview wa-grid wa-gap-3xs">
|
||||
<span class="preview-swatch"></span>
|
||||
<span class="preview-swatch"></span>
|
||||
<span class="preview-swatch"></span>
|
||||
<span class="preview-swatch"></span>
|
||||
<span class="preview-swatch"></span>
|
||||
<span class="preview-swatch"></span>
|
||||
<span class="preview-swatch"></span>
|
||||
<span class="preview-swatch"></span>
|
||||
<span class="preview-swatch"></span>
|
||||
<span class="preview-swatch"></span>
|
||||
</div>
|
||||
</div>
|
||||
</wa-radio>
|
||||
{%- else -%}
|
||||
{% raw %}{%- if currentUser.hasPro -%}{% endraw %}
|
||||
<wa-radio value="{{ palette.name | lower }}">
|
||||
<div class="wa-stack wa-gap-xs">
|
||||
<span>{{ palette.name }}</span>
|
||||
<div class="wa-palette-{{ palette.name | lower }} palette-preview wa-grid wa-gap-3xs">
|
||||
<span class="preview-swatch"></span>
|
||||
<span class="preview-swatch"></span>
|
||||
<span class="preview-swatch"></span>
|
||||
<span class="preview-swatch"></span>
|
||||
<span class="preview-swatch"></span>
|
||||
<span class="preview-swatch"></span>
|
||||
<span class="preview-swatch"></span>
|
||||
<span class="preview-swatch"></span>
|
||||
<span class="preview-swatch"></span>
|
||||
<span class="preview-swatch"></span>
|
||||
</div>
|
||||
</div>
|
||||
</wa-radio>
|
||||
{% raw %}{%- endif -%}{% endraw %}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
</div>
|
||||
</wa-radio-group>
|
||||
|
||||
<div id="palette" class="wa-stack wa-gap-xs">
|
||||
{%- for color in themer.colors -%}
|
||||
<div class="color-scale wa-flank wa-gap-xs">
|
||||
<div class="color-name">{{ color }}</div>
|
||||
<div class="color-swatches wa-grid wa-gap-2xs">
|
||||
{%- for tint in themer.tints -%}
|
||||
<wa-copy-button
|
||||
class="color-swatch"
|
||||
copy-label="{{ color }} {{ tint }}"
|
||||
value="var(--wa-color-{{ color }}-{{ tint }})"
|
||||
style="--color: var(--wa-color-{{ color }}-{{ tint }}); --tint: '{{ tint }}'"
|
||||
>
|
||||
<span class="wa-visually-hidden">--wa-color-{{ color }}-{{ tint }}</span>
|
||||
</wa-copy-button>
|
||||
{%- endfor -%}
|
||||
</div>
|
||||
</div>
|
||||
{%- endfor -%}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="module">
|
||||
const paletteContainer = document.getElementById('color-palettes');
|
||||
const palettePreviewPicker = document.getElementById('palette-picker');
|
||||
|
||||
// Set first radio as checked and add initial palette class
|
||||
const firstPaletteRadio = palettePreviewPicker.querySelector('wa-radio');
|
||||
if (firstPaletteRadio) {
|
||||
firstPaletteRadio.checked = true;
|
||||
paletteContainer.classList.add(`wa-palette-${firstPaletteRadio.value}`);
|
||||
}
|
||||
|
||||
// Listen for radio changes
|
||||
palettePreviewPicker.addEventListener('input', function(event) {
|
||||
const selectedValue = event.target.value;
|
||||
|
||||
// Update palette container class
|
||||
const existingThemeClasses = [...paletteContainer.classList].filter(className => className.startsWith('wa-palette-'));
|
||||
existingThemeClasses.forEach(className => paletteContainer.classList.remove(className));
|
||||
paletteContainer.classList.add(`wa-palette-${selectedValue}`);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
#color-palettes:has(+ *) {
|
||||
margin-block-end: var(--wa-content-spacing);
|
||||
}
|
||||
|
||||
wa-radio-group.radio-cards {
|
||||
&::part(form-control-input) {
|
||||
display: grid;
|
||||
}
|
||||
|
||||
> .wa-grid {
|
||||
--max-column-count: 3;
|
||||
--min-column-size: 12ch;
|
||||
|
||||
--_max-gap-count: calc(var(--max-column-count) - 1);
|
||||
--_gap-width-sum: calc(var(--_max-gap-count) * var(--wa-space-m));
|
||||
--_max-column-width: calc((100% - var(--_gap-width-sum)) / var(--max-column-count));
|
||||
|
||||
grid-template-columns: repeat(auto-fill, minmax(max(var(--min-column-size), var(--_max-column-width)), 1fr));
|
||||
}
|
||||
|
||||
wa-radio {
|
||||
display: block;
|
||||
inline-size: var(--popover-min-inline-size);
|
||||
background-color: var(--wa-form-control-background-color);
|
||||
border: var(--wa-form-control-border-width) var(--wa-form-control-border-style) var(--wa-color-neutral-border-quiet);
|
||||
border-radius: var(--wa-border-radius-m);
|
||||
padding: 0.75em;
|
||||
font-size: var(--wa-font-size-s);
|
||||
color: var(--wa-color-text-quiet);
|
||||
|
||||
&::part(control) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&::part(label) {
|
||||
font-weight: var(--wa-font-weight-bold);
|
||||
}
|
||||
|
||||
@media (hover: hover) {
|
||||
&:hover {
|
||||
border-color: var(--wa-color-neutral-border-normal);
|
||||
}
|
||||
}
|
||||
|
||||
&:state(checked) {
|
||||
border-color: var(--wa-color-neutral-border-loud);
|
||||
box-shadow: 0 0 0 0.0625rem var(--wa-color-neutral-border-loud);
|
||||
color: var(--wa-color-text-normal);
|
||||
}
|
||||
|
||||
&:focus-visible {
|
||||
outline: var(--wa-focus-ring);
|
||||
outline-offset: var(--wa-focus-ring-offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.palette-preview {
|
||||
--min-column-size: 0rem;
|
||||
}
|
||||
|
||||
.preview-swatch {
|
||||
aspect-ratio: 1 / 1;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
border-radius: var(--wa-border-radius-s);
|
||||
|
||||
&:nth-child(1) {
|
||||
background-color: var(--wa-color-red);
|
||||
}
|
||||
&:nth-child(2) {
|
||||
background-color: var(--wa-color-orange);
|
||||
}
|
||||
&:nth-child(3) {
|
||||
background-color: var(--wa-color-yellow);
|
||||
}
|
||||
&:nth-child(4) {
|
||||
background-color: var(--wa-color-green);
|
||||
}
|
||||
&:nth-child(5) {
|
||||
background-color: var(--wa-color-cyan);
|
||||
}
|
||||
&:nth-child(6) {
|
||||
background-color: var(--wa-color-blue);
|
||||
}
|
||||
&:nth-child(7) {
|
||||
background-color: var(--wa-color-indigo);
|
||||
}
|
||||
&:nth-child(8) {
|
||||
background-color: var(--wa-color-purple);
|
||||
}
|
||||
&:nth-child(9) {
|
||||
background-color: var(--wa-color-pink);
|
||||
}
|
||||
&:nth-child(10) {
|
||||
background-color: var(--wa-color-gray);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
302
packages/webawesome/docs/_includes/theming/instructions.njk
Normal file
302
packages/webawesome/docs/_includes/theming/instructions.njk
Normal file
@@ -0,0 +1,302 @@
|
||||
{% from "pro-badge.njk" import proBadge %}
|
||||
{% from "free-badge.njk" import freeBadge %}
|
||||
|
||||
<div id="using-themes">
|
||||
<fieldset class="theme-options wa-stack" style="margin-block-end: var(--wa-content-spacing);">
|
||||
<legend style="align-self: start;">Theme Options</legend>
|
||||
<wa-select id="pick-theme" label="Theme" value="default" size="small">
|
||||
<wa-badge slot="end" appearance="accent" pill class="pro pro-only-value">Pro</wa-badge>
|
||||
{%- for theme in themer.themes -%}
|
||||
{%- if not theme.isPro -%}
|
||||
<wa-option
|
||||
value="{{ theme.name | lower }}"
|
||||
data-palette="{{ theme.palette.filename | stripExtension}}"
|
||||
data-brand="{{ theme.colorBrand.color }}"
|
||||
>
|
||||
{{ theme.name | capitalize }}
|
||||
</wa-option>
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{% raw %}{% if currentUser.hasPro %}{% endraw %}
|
||||
{%- for theme in themer.themes -%}
|
||||
{% if loop.first %}<wa-divider></wa-divider>{% endif %}
|
||||
{%- if theme.isPro -%}
|
||||
<wa-option
|
||||
value="{{ theme.name | lower }}"
|
||||
data-palette="{{ theme.palette.filename | stripExtension}}"
|
||||
data-brand="{{ theme.colorBrand.color }}"
|
||||
{% if theme.isPro %}data-is-pro{% endif %}
|
||||
>
|
||||
{{ theme.name | capitalize }}
|
||||
</wa-option>
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{% raw %}{% endif %}{% endraw %}
|
||||
</wa-select>
|
||||
<wa-select id="pick-palette" label="Color Palette" value="default" size="small">
|
||||
<wa-badge slot="end" appearance="accent" pill class="pro pro-only-value">Pro</wa-badge>
|
||||
{%- for palette in themer.palettes -%}
|
||||
{%- if not palette.isPro -%}
|
||||
<wa-option
|
||||
value="{{ palette.name | lower }}"
|
||||
>
|
||||
{{ palette.name | capitalize }}
|
||||
</wa-option>
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{% raw %}{% if currentUser.hasPro %}{% endraw %}
|
||||
{%- for palette in themer.palettes -%}
|
||||
{% if loop.first %}<wa-divider></wa-divider>{% endif %}
|
||||
{%- if palette.isPro -%}
|
||||
<wa-option
|
||||
value="{{ palette.name | lower }}"
|
||||
{% if palette.isPro %}data-is-pro{% endif %}
|
||||
>
|
||||
{{ palette.name | capitalize }}
|
||||
</wa-option>
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{% raw %}{% endif %}{% endraw %}
|
||||
</wa-select>
|
||||
<div class="wa-grid">
|
||||
{%- set colorVariants = ['brand', 'neutral', 'success', 'warning', 'danger'] -%}
|
||||
{%- for colorVariant in colorVariants -%}
|
||||
<wa-select id="pick-{{ colorVariant }}" label="{{ colorVariant | capitalize }}" size="small">
|
||||
<wa-icon slot="start" name="square" class="selected-color"></wa-icon>
|
||||
{%- for color in themer.colors -%}
|
||||
<wa-option value="{{ color }}">
|
||||
{{ color | capitalize }}
|
||||
<wa-icon slot="start" name="square" style="--color: var(--wa-color-{{ color }}); color: var(--color);"></wa-icon>
|
||||
</wa-option>
|
||||
{%- endfor -%}
|
||||
</wa-select>
|
||||
{%- endfor -%}
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<wa-tab-group>
|
||||
<wa-tab panel="cdn"><wa-icon name="rocket-launch" variant="regular"></wa-icon> CDN</wa-tab>
|
||||
<wa-tab panel="npm"><wa-icon name="box-open" variant="regular"></wa-icon> npm</wa-tab>
|
||||
<wa-tab panel="self-hosted"><wa-icon name="arrow-down-to-line" variant="regular"></wa-icon> Self-Hosted</wa-tab>
|
||||
|
||||
<wa-tab-panel name="cdn">
|
||||
<div class="wa-stack wa-gap-xl">
|
||||
<wa-callout variant="neutral" size="small" id="pro-only-callout">
|
||||
<wa-icon name="info-circle" variant="regular"></wa-icon>
|
||||
This combination can only be used on teams with a Pro subscription.
|
||||
</wa-callout>
|
||||
<div id="free-instructions">
|
||||
<strong>For projects on <wa-badge appearance="filled" variant="neutral" pill class="free">Free</wa-badge> teams:</strong>
|
||||
<ol>
|
||||
<li>Head over to your project's <wa-icon name="gear" variant="regular"></wa-icon> <strong>Settings</strong>.</li>
|
||||
<li>For <strong>Theme</strong>, select <wa-icon name="paintbrush" variant="regular"></wa-icon> <strong class="theme-name"></strong>.</li>
|
||||
<li>For <strong>Color Palette</strong>, select <wa-icon name="swatchbook" variant="regular"></wa-icon> <strong class="palette-name"></strong>.</li>
|
||||
<li>Press <strong>Save Changes</strong> to update anywhere you're using your project.</li>
|
||||
<li class="custom-variants">In your own files, apply the following classes to the <code><html></code> element:<br />
|
||||
<pre><code class="variant-classes" class="language-html"></code></pre>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
<div id="pro-instructions">
|
||||
<strong>For projects on <wa-badge appearance="accent" pill class="pro">Pro</wa-badge> teams:</strong>
|
||||
<ol>
|
||||
<li>Head over to your project's <wa-icon name="gear" variant="regular"></wa-icon> <strong>Settings</strong>.</li>
|
||||
<li>Press <wa-icon name="paintbrush" variant="regular"></wa-icon> <strong>Edit Your Theme</strong> to open the Theme Builder.</li>
|
||||
<li>Open <strong>Theme</strong> and select <strong class="theme-name"></strong>.</li>
|
||||
<li>Open <strong>Colors</strong>. On the <strong>Basic</strong> tab, select <strong class="palette-name"></strong>. <span class="custom-variants">On the <strong>Advanced</strong> tab, select your preferred variant colors.</span></li>
|
||||
<li>Press <strong>Save Changes</strong> to update anywhere you're using your project.</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</wa-tab-panel>
|
||||
|
||||
<wa-tab-panel name="npm">
|
||||
<p>To use this theme, include the following stylesheet(s):</p>
|
||||
<pre><code id="stylesheet-imports" class="language-html"></code></pre>
|
||||
<p>Then, apply the following classes to the <code><html></code> element:</p>
|
||||
<pre><code class="html-classes" class="language-html"></code></pre>
|
||||
</wa-tab-panel>
|
||||
|
||||
<wa-tab-panel name="self-hosted">
|
||||
<p>To use this theme, include the following stylesheet(s):</p>
|
||||
<pre><code id="stylesheet-links" class="language-html"></code></pre>
|
||||
<p>Then, apply the following classes to the <code><html></code> element:</p>
|
||||
<pre><code class="html-classes" class="language-html"></code></pre>
|
||||
</wa-tab-panel>
|
||||
</wa-tab-group>
|
||||
|
||||
<script type="module">
|
||||
const themePicker = document.getElementById('pick-theme');
|
||||
const palettePicker = document.getElementById('pick-palette');
|
||||
const brandPicker = document.getElementById('pick-brand');
|
||||
const neutralPicker = document.getElementById('pick-neutral');
|
||||
const successPicker = document.getElementById('pick-success');
|
||||
const warningPicker = document.getElementById('pick-warning');
|
||||
const dangerPicker = document.getElementById('pick-danger');
|
||||
|
||||
const stylesheetLinks = document.getElementById('stylesheet-links');
|
||||
const stylesheetImports = document.getElementById('stylesheet-imports');
|
||||
const htmlClassList = document.querySelectorAll('.html-classes');
|
||||
const variantClassList = document.querySelectorAll('.variant-classes');
|
||||
const themeNames = document.querySelectorAll('.theme-name');
|
||||
const paletteNames = document.querySelectorAll('.palette-name');
|
||||
|
||||
// Default values for color variants
|
||||
const defaultColors = {
|
||||
brand: 'blue',
|
||||
neutral: 'gray',
|
||||
success: 'green',
|
||||
warning: 'yellow',
|
||||
danger: 'red'
|
||||
};
|
||||
|
||||
// Update dynamic instructions based on current picker values
|
||||
function updateInstructions() {
|
||||
const theme = themePicker.value;
|
||||
const palette = palettePicker.value;
|
||||
const brand = brandPicker.value;
|
||||
const neutral = neutralPicker.value;
|
||||
const success = successPicker.value;
|
||||
const warning = warningPicker.value;
|
||||
const danger = dangerPicker.value;
|
||||
|
||||
// Get the default palette for the selected theme
|
||||
const selectedThemeOption = themePicker.querySelector(`wa-option[value="${theme}"]`);
|
||||
const themeDefaultPalette = selectedThemeOption?.getAttribute('data-palette') || 'default';
|
||||
const proOnlyTheme = selectedThemeOption?.hasAttribute('data-is-pro') || false;
|
||||
const proOnlyPalette = palettePicker.querySelector(`wa-option[value="${palette}"]`)?.hasAttribute('data-is-pro') || false;
|
||||
|
||||
// Show/hide Pro-only callout
|
||||
const proOnlyCallout = document.getElementById('pro-only-callout');
|
||||
const freeInstructions = document.getElementById('free-instructions');
|
||||
if (proOnlyTheme || proOnlyPalette) {
|
||||
proOnlyCallout.style.display = '';
|
||||
freeInstructions.style.display = 'none';
|
||||
} else {
|
||||
proOnlyCallout.style.display = 'none';
|
||||
freeInstructions.style.display = '';
|
||||
}
|
||||
|
||||
// Show/hide Pro badge on selected Pro values
|
||||
document.querySelectorAll('.pro-only-value').forEach(badge => {
|
||||
if ((badge.parentElement.id === 'pick-theme' && proOnlyTheme) ||
|
||||
(badge.parentElement.id === 'pick-palette' && proOnlyPalette)) {
|
||||
badge.style.display = '';
|
||||
} else {
|
||||
badge.style.display = 'none';
|
||||
}
|
||||
});
|
||||
|
||||
// Build stylesheet links
|
||||
const links = [`<link rel="stylesheet" href="/dist/styles/themes/${theme}.css" />`];
|
||||
const imports = [`import '@awesome.me/webawesome/dist/styles/themes/${theme}.css';`];
|
||||
|
||||
// Only include palette link if it differs from theme's default
|
||||
if (palette !== themeDefaultPalette) {
|
||||
links.push(`<link rel="stylesheet" href="/dist/styles/color/palettes/${palette}.css" />`);
|
||||
imports.push(`import '@awesome.me/webawesome/dist/styles/color/palettes/${palette}.css';`);
|
||||
}
|
||||
|
||||
stylesheetLinks.textContent = links.join('\n');
|
||||
stylesheetImports.textContent = imports.join('\n');
|
||||
|
||||
// Build HTML classes
|
||||
const classes = [`wa-theme-${theme}`];
|
||||
const variantClasses = [];
|
||||
|
||||
// Only include palette class if it differs from theme's default
|
||||
if (palette !== themeDefaultPalette) {
|
||||
classes.push(`wa-palette-${palette}`);
|
||||
}
|
||||
|
||||
// Only include color classes if they differ from defaults
|
||||
if (brand !== defaultColors.brand) {
|
||||
[classes, variantClasses].forEach(classList => classList.push(`wa-brand-${brand}`));
|
||||
}
|
||||
if (neutral !== defaultColors.neutral) {
|
||||
[classes, variantClasses].forEach(classList => classList.push(`wa-neutral-${neutral}`));
|
||||
}
|
||||
if (success !== defaultColors.success) {
|
||||
[classes, variantClasses].forEach(classList => classList.push(`wa-success-${success}`));
|
||||
}
|
||||
if (warning !== defaultColors.warning) {
|
||||
[classes, variantClasses].forEach(classList => classList.push(`wa-warning-${warning}`));
|
||||
}
|
||||
if (danger !== defaultColors.danger) {
|
||||
[classes, variantClasses].forEach(classList => classList.push(`wa-danger-${danger}`));
|
||||
}
|
||||
|
||||
htmlClassList.forEach(instance => {
|
||||
instance.textContent = `class="${classes.join(' ')}"`;
|
||||
});
|
||||
|
||||
variantClassList.forEach(instance => {
|
||||
instance.textContent = `class="${variantClasses.join(' ')}"`;
|
||||
});
|
||||
|
||||
if (variantClasses.length === 0) {
|
||||
document.querySelectorAll('.custom-variants').forEach(el => el.style.display = 'none');
|
||||
} else {
|
||||
document.querySelectorAll('.custom-variants').forEach(el => el.style.display = '');
|
||||
}
|
||||
|
||||
// Update theme and palette names in CDN instructions
|
||||
themeNames.forEach(instance => {
|
||||
instance.textContent = theme;
|
||||
instance.style.textTransform = 'capitalize';
|
||||
});
|
||||
paletteNames.forEach(instance => {
|
||||
instance.textContent = palette;
|
||||
instance.style.textTransform = 'capitalize';
|
||||
});
|
||||
|
||||
// Match color picker icons to selected palette and color
|
||||
[brandPicker, neutralPicker, successPicker, warningPicker, dangerPicker].forEach(picker => {
|
||||
const color = picker.value;
|
||||
const selectedColorIcon = picker.querySelector('wa-icon.selected-color');
|
||||
const optionsColorIcons = picker.querySelectorAll('wa-option wa-icon[slot="start"]');
|
||||
|
||||
if (selectedColorIcon) {
|
||||
selectedColorIcon.style.setProperty('color', `var(--wa-color-${color})`);
|
||||
selectedColorIcon.classList.remove(...[...selectedColorIcon.classList].filter(className => className.startsWith('wa-palette-')));
|
||||
selectedColorIcon.classList.add(`wa-palette-${palette}`);
|
||||
}
|
||||
|
||||
|
||||
optionsColorIcons.forEach(icon => {
|
||||
icon.classList.remove(...[...icon.classList].filter(className => className.startsWith('wa-palette-')));
|
||||
icon.classList.add(`wa-palette-${palette}`);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Set palette and brand based on theme selection
|
||||
themePicker.addEventListener('input', function() {
|
||||
const selectedOption = themePicker.querySelector(`wa-option[value="${themePicker.value}"]`);
|
||||
const palette = selectedOption.getAttribute('data-palette');
|
||||
const brand = selectedOption.getAttribute('data-brand');
|
||||
|
||||
palettePicker.value = palette;
|
||||
brandPicker.value = brand;
|
||||
|
||||
updateInstructions();
|
||||
});
|
||||
|
||||
// Update instructions when any picker changes
|
||||
[palettePicker, brandPicker, neutralPicker, successPicker, warningPicker, dangerPicker].forEach(picker => {
|
||||
picker.addEventListener('input', updateInstructions);
|
||||
});
|
||||
|
||||
// Set initial values
|
||||
themePicker.value = 'default';
|
||||
palettePicker.value = 'default';
|
||||
brandPicker.value = 'blue';
|
||||
neutralPicker.value = 'gray';
|
||||
successPicker.value = 'green';
|
||||
warningPicker.value = 'yellow';
|
||||
dangerPicker.value = 'red';
|
||||
|
||||
// Initial update
|
||||
updateInstructions();
|
||||
</script>
|
||||
27
packages/webawesome/docs/_includes/theming/variants.njk
Normal file
27
packages/webawesome/docs/_includes/theming/variants.njk
Normal file
@@ -0,0 +1,27 @@
|
||||
{% set colorVariants = ["brand", "neutral", "success", "warning", "danger"] %}
|
||||
|
||||
<div id="color-variants" class="wa-stack wa-gap-xs">
|
||||
{%- for colorVariant in colorVariants -%}
|
||||
<div class="color-scale wa-flank wa-gap-xs">
|
||||
<div class="color-name">{{ colorVariant }}</div>
|
||||
<div class="color-swatches wa-grid wa-gap-2xs">
|
||||
{%- for tint in themer.tints -%}
|
||||
<wa-copy-button
|
||||
class="color-swatch"
|
||||
copy-label="{{ colorVariant }} {{ tint }}"
|
||||
value="var(--wa-color-{{ colorVariant }}-{{ tint }})"
|
||||
style="--color: var(--wa-color-{{ colorVariant }}-{{ tint }}); --tint: '{{ tint }}'"
|
||||
>
|
||||
<span class="wa-visually-hidden">--wa-color-{{ colorVariant }}-{{ tint }}</span>
|
||||
</wa-copy-button>
|
||||
{%- endfor -%}
|
||||
</div>
|
||||
</div>
|
||||
{%- endfor -%}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
#color-variants:has(+ *) {
|
||||
margin-block-end: var(--wa-content-spacing);
|
||||
}
|
||||
</style>
|
||||
@@ -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="38c11e3f20" data-version="{{ package.version }}">
|
||||
<head>
|
||||
{% include 'head.njk' %}
|
||||
{% block head %}{% endblock %}
|
||||
|
||||
@@ -211,7 +211,12 @@
|
||||
<tr>
|
||||
<td class="table-name"><code>{{ state.name }}</code></td>
|
||||
<td class="table-description">{{ state.description | inlineMarkdown | safe }}</td>
|
||||
<td class="table-selector"><code>:state({{ state.name }})</code></td>
|
||||
<td class="table-selector">
|
||||
<span class="wa-cluster wa-gap-3xs">
|
||||
<code>:state({{ state.name }})</code>
|
||||
<wa-copy-button value=":state({{ state.name }})"></wa-copy-button>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
@@ -230,6 +235,7 @@
|
||||
<tr>
|
||||
<th class="table-name">Name</th>
|
||||
<th class="table-description">Description</th>
|
||||
<th class="table-selector">CSS selector</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -237,6 +243,12 @@
|
||||
<tr>
|
||||
<td class="table-name"><code>{{ cssPart.name }}</code></td>
|
||||
<td class="table-description">{{ cssPart.description | inlineMarkdown | safe }}</td>
|
||||
<td class="table-selector">
|
||||
<span class="wa-cluster wa-gap-3xs">
|
||||
<code>::part({{ cssPart.name }})</code>
|
||||
<wa-copy-button value="::part({{ cssPart.name }})"></wa-copy-button>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
@@ -261,7 +273,7 @@
|
||||
{# Importing #}
|
||||
<h2>Importing</h2>
|
||||
<p>
|
||||
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.
|
||||
Autoloading components via <a href="/docs/#using-a-project">projects</a> is the recommended way to import components. If you prefer to do it manually, use one of the following code snippets.
|
||||
</p>
|
||||
|
||||
|
||||
@@ -273,10 +285,8 @@
|
||||
<wa-tab panel="react">React</wa-tab>
|
||||
<wa-tab-panel name="cdn">
|
||||
<p>
|
||||
To manually import this component from the CDN, use the following code.
|
||||
Let your project code do the work! <a href="/signup">Sign up for free</a> to use a project with your very own CDN — it's the fastest and easiest way to use Web Awesome.
|
||||
</p>
|
||||
|
||||
<pre><code class="language-js">import '{% cdnUrl componentPath %}';</code></pre>
|
||||
</wa-tab-panel>
|
||||
<wa-tab-panel name="npm">
|
||||
<p>
|
||||
|
||||
@@ -35,9 +35,23 @@ export function anchorHeadingsTransformer(options = {}) {
|
||||
return doc;
|
||||
}
|
||||
|
||||
// Look for headings
|
||||
let selector = `:is(${options.headingSelector}):not([data-no-anchor], [data-no-anchor] *)`;
|
||||
// Check if the document or container has data-no-anchor (view-level)
|
||||
const hasNoAnchorOnDocument = doc.querySelector('html')?.hasAttribute('data-no-anchor') || false;
|
||||
const hasNoAnchorOnContainer = container.closest('[data-no-anchor]') !== null;
|
||||
|
||||
// If view-level data-no-anchor is set, skip processing all headings
|
||||
if (hasNoAnchorOnDocument || hasNoAnchorOnContainer) {
|
||||
return doc;
|
||||
}
|
||||
|
||||
// Look for headings (selector excludes headings with data-no-anchor attribute)
|
||||
let selector = `:is(${options.headingSelector}):not([data-no-anchor])`;
|
||||
container.querySelectorAll(selector).forEach(heading => {
|
||||
// Skip if heading is a descendant of an element with data-no-anchor
|
||||
// (selector already excludes headings with the attribute directly)
|
||||
if (heading.closest('[data-no-anchor]') !== null) {
|
||||
return;
|
||||
}
|
||||
const hasAnchor = heading.querySelector('a');
|
||||
const existingId = heading.getAttribute('id');
|
||||
const clone = parse(heading.outerHTML);
|
||||
@@ -65,7 +79,7 @@ export function anchorHeadingsTransformer(options = {}) {
|
||||
const anchor = parse(`
|
||||
<a href="#${encodeURIComponent(id)}">
|
||||
<span class="wa-visually-hidden"></span>
|
||||
<span aria-hidden="true">#</span>
|
||||
<wa-icon variant="regular" name="hashtag" class="icon-shrink"></wa-icon>
|
||||
</a>
|
||||
`);
|
||||
anchor.querySelector('.wa-visually-hidden').textContent = options.anchorLabel;
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
const version = document.documentElement.getAttribute('data-version') || '';
|
||||
const CDN_URL = `https://cdn.jsdelivr.net/npm/@awesome.me/webawesome@${version}/dist-cdn/`;
|
||||
|
||||
//
|
||||
// Resizing previews
|
||||
//
|
||||
@@ -54,10 +57,9 @@ document.addEventListener('click', event => {
|
||||
if (pen) {
|
||||
const codeExample = pen.closest('.code-example');
|
||||
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="38c11e3f20" type="module" src="${CDN_URL}webawesome.loader.js"></script>\n` +
|
||||
`<link rel="stylesheet" href="${CDN_URL}styles/webawesome.css">\n\n` +
|
||||
`${code.textContent}`;
|
||||
const css = 'html > body {\n padding: 2rem !important;\n}';
|
||||
const js = '';
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// Search data
|
||||
const res = await Promise.all([import('https://cdn.jsdelivr.net/npm/lunr/+esm'), fetch('/search.json')]);
|
||||
const version = document.documentElement.getAttribute('data-version') || '';
|
||||
const res = await Promise.all([import('https://cdn.jsdelivr.net/npm/lunr/+esm'), fetch(`/search.json?v=${version}`)]);
|
||||
const lunr = res[0].default;
|
||||
const searchData = await res[1].json();
|
||||
const searchIndex = lunr.Index.load(searchData.searchIndex);
|
||||
|
||||
@@ -27,6 +27,43 @@ body.theme-transitioning {
|
||||
transition: opacity 200ms ease-out;
|
||||
}
|
||||
|
||||
/* banner */
|
||||
wa-page > [slot='banner'] {
|
||||
padding: var(--wa-space-0);
|
||||
|
||||
.banner-content {
|
||||
/* match docs header padding-inline by default */
|
||||
padding-inline: var(--wa-space-xl);
|
||||
padding-block: var(--wa-space-m);
|
||||
}
|
||||
|
||||
&.banner-wa-launch {
|
||||
/* custom brand colors carrried over from theme-site for the banner */
|
||||
--wa-color-brand-95: #fef0ec;
|
||||
--wa-color-brand-90: #fce0d8;
|
||||
--wa-color-brand-80: #f8bcac;
|
||||
--wa-color-brand-70: #fa9378;
|
||||
--wa-color-brand-60: #f46a45;
|
||||
--wa-color-brand-50: #cb4b27;
|
||||
--wa-color-brand-40: #9d371a;
|
||||
--wa-color-brand-30: #7c2a13;
|
||||
--wa-color-brand-20: #5d1d0b;
|
||||
--wa-color-brand-10: #3b0f05;
|
||||
--wa-color-brand-05: #270802;
|
||||
--wa-color-brand: var(--wa-color-brand-60);
|
||||
--wa-color-brand-on: var(--wa-color-brand-10);
|
||||
|
||||
.banner-icon {
|
||||
color: var(--wa-color-brand-fill-loud);
|
||||
font-size: var(--wa-font-size-xl);
|
||||
}
|
||||
|
||||
.appearance-underlined.variant-drawn {
|
||||
--underline-color: var(--wa-color-brand);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Header */
|
||||
wa-page::part(header) {
|
||||
background-color: var(--wa-color-surface-default);
|
||||
@@ -314,26 +351,6 @@ h1.title {
|
||||
}
|
||||
}
|
||||
|
||||
/* Anchor headings */
|
||||
.anchor-heading a {
|
||||
visibility: hidden;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
@media (hover: hover) {
|
||||
.anchor-heading:hover a {
|
||||
visibility: visible;
|
||||
padding: 0 0.125em;
|
||||
}
|
||||
}
|
||||
|
||||
@media print {
|
||||
/* Show URLs for printed links */
|
||||
a:not(.anchor-heading)[href]::after {
|
||||
content: ' (' attr(href) ')';
|
||||
}
|
||||
}
|
||||
|
||||
/* Callouts */
|
||||
.callout {
|
||||
display: flex;
|
||||
@@ -592,6 +609,68 @@ table.colors {
|
||||
--icon-color: var(--wa-color-success-fill-quiet);
|
||||
}
|
||||
|
||||
/* Theming */
|
||||
|
||||
.color-scale.wa-flank {
|
||||
--flank-size: 6ch;
|
||||
--content-percentage: 88%;
|
||||
--reserved-tint-space: calc(var(--wa-font-size-xs) + var(--wa-space-xs)); /* TODO: rename */
|
||||
margin-bottom: var(--reserved-tint-space);
|
||||
|
||||
.color-swatches.wa-grid {
|
||||
--min-column-size: 2.5rem;
|
||||
grid-row-gap: calc(var(--reserved-tint-space) + var(--wa-space-xs));
|
||||
}
|
||||
|
||||
.color-name {
|
||||
font-weight: var(--wa-font-weight-bold);
|
||||
text-transform: capitalize;
|
||||
font-size: var(--wa-font-size-s);
|
||||
color: var(--wa-color-text-normal);
|
||||
}
|
||||
|
||||
wa-copy-button.color-swatch {
|
||||
padding: 0;
|
||||
aspect-ratio: 1;
|
||||
position: relative;
|
||||
|
||||
&::before {
|
||||
content: var(--tint);
|
||||
position: absolute;
|
||||
bottom: calc(-1 * var(--reserved-tint-space));
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
font-size: var(--wa-font-size-xs);
|
||||
line-height: 1;
|
||||
color: var(--wa-color-text-quiet);
|
||||
text-align: center;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
&::part(button) {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
cursor: pointer;
|
||||
background-color: var(--color);
|
||||
border-radius: var(--wa-border-radius-s);
|
||||
transition: transform 0.1s ease, box-shadow 0.1s ease;
|
||||
}
|
||||
|
||||
&:hover::part(button) {
|
||||
transform: scale(1.075);
|
||||
box-shadow: var(--wa-shadow-s);
|
||||
z-index: 1;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
&::part(copy-icon),
|
||||
&::part(success-icon),
|
||||
&::part(error-icon) {
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Layout Examples */
|
||||
.layout-example-boundary {
|
||||
border: var(--wa-border-width-s) dashed var(--wa-color-neutral-border-normal);
|
||||
@@ -628,6 +707,10 @@ wa-scroller:has(.component-table) {
|
||||
min-width: var(--line-length-xs);
|
||||
}
|
||||
|
||||
.table-selector .wa-cluster {
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
|
||||
.table-reflect {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@@ -70,9 +70,8 @@
|
||||
/* #region shared UI */
|
||||
/* pro badge */
|
||||
wa-badge.pro {
|
||||
color: white;
|
||||
color: var(--wa-color-brand-on-loud);
|
||||
background-color: var(--wa-brand-orange);
|
||||
border-color: var(--wa-brand-orange);
|
||||
|
||||
+ wa-tooltip {
|
||||
font-size: var(--wa-font-size-xs);
|
||||
@@ -80,6 +79,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* free badge */
|
||||
wa-badge.free {
|
||||
+ wa-tooltip {
|
||||
font-size: var(--wa-font-size-xs);
|
||||
--max-width: unset;
|
||||
}
|
||||
}
|
||||
|
||||
/* planned badge */
|
||||
wa-badge.planned {
|
||||
background-color: var(--wa-color-neutral-fill-quiet);
|
||||
@@ -123,10 +130,54 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* anchor headings */
|
||||
.anchor-heading a {
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
text-decoration: none;
|
||||
transition: opacity var(--wa-transition-normal) var(--wa-transition-easing);
|
||||
}
|
||||
|
||||
@media (hover: hover) {
|
||||
.anchor-heading:hover a {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
padding: var(--wa-space-3xs);
|
||||
}
|
||||
}
|
||||
|
||||
@media print {
|
||||
/* show URLs for printed links */
|
||||
a:not(.anchor-heading)[href]::after {
|
||||
content: ' (' attr(href) ')';
|
||||
}
|
||||
}
|
||||
/* #endregion */
|
||||
|
||||
/* #region funsies + cosmetics */
|
||||
|
||||
/* decorative underline emphasis */
|
||||
.appearance-underlined.variant-drawn {
|
||||
--underline-color: currentColor;
|
||||
position: relative;
|
||||
text-decoration: none;
|
||||
padding-bottom: 0.4em;
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 0.4em;
|
||||
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 20'%3E%3Cpath d='M0,12 Q50,8 100,12' stroke='black' stroke-width='4' fill='none'/%3E%3C/svg%3E");
|
||||
mask-repeat: no-repeat;
|
||||
mask-size: 100% auto;
|
||||
mask-position: 0 100%;
|
||||
background-color: var(--underline-color);
|
||||
}
|
||||
}
|
||||
|
||||
/* grid background */
|
||||
.background-grid {
|
||||
--grid-spacing: var(--wa-space-2xl);
|
||||
|
||||
@@ -66,14 +66,71 @@ layout: page
|
||||
</div>
|
||||
|
||||
<h2>Using This Palette</h2>
|
||||
|
||||
<div id="import-code">
|
||||
{% for palette in themer.palettes %}
|
||||
<div class="palette-instructions" data-palette="{{ palette.name | lower }}" {% if not loop.first %}hidden{% endif %}>
|
||||
<p>
|
||||
To import this palette, set <code><html class="wa-palette-{{ palette.name | lower }}"></code> and import the following stylesheet:
|
||||
</p>
|
||||
<pre><code class="language-html"><link rel="stylesheet" href="{% cdnUrl %}styles/color/palettes/{{ palette.filename }}" /></code></pre>
|
||||
</div>
|
||||
<div class="palette-instructions" data-palette="{{ palette.name | lower }}" {% if not loop.first %}hidden{% endif %}>
|
||||
<wa-tab-group>
|
||||
<wa-tab panel="cdn"><wa-icon name="rocket-launch" variant="regular"></wa-icon> CDN</wa-tab>
|
||||
<wa-tab panel="npm"><wa-icon name="box-open" variant="regular"></wa-icon> npm</wa-tab>
|
||||
<wa-tab panel="self-hosted"><wa-icon name="arrow-down-to-line" variant="regular"></wa-icon> Self-Hosted</wa-tab>
|
||||
|
||||
<wa-tab-panel name="cdn">
|
||||
{% markdown %}
|
||||
{% if palette.isPro %}
|
||||
<wa-callout variant="neutral" size="small">
|
||||
<wa-icon name="info-circle" variant="regular"></wa-icon>
|
||||
This palette can only be used on teams with a Pro subscription.
|
||||
</wa-callout>
|
||||
<br />
|
||||
{% else %}
|
||||
**For projects on Free teams:**
|
||||
1. Head over to your project's <wa-icon name="gear" variant="regular"></wa-icon> **Settings**.
|
||||
2. Find **Color Palette**. Select <wa-icon name="swatchbook" variant="regular"></wa-icon> **{{ palette.name | capitalize }}**.
|
||||
3. Save your theme to immediately update anywhere you're using your project.
|
||||
{% endif %}
|
||||
|
||||
**For projects on Pro teams:**
|
||||
1. Head over to your project's <wa-icon name="gear" variant="regular"></wa-icon> **Settings**.
|
||||
2. Press <wa-icon name="paintbrush" variant="regular"></wa-icon> **Edit Your Theme** to open the Theme Builder.
|
||||
3. Open **Colors** and select **{{ palette.name | capitalize }}**.
|
||||
4. Save your theme to immediately update anywhere you're using your project.
|
||||
{% endmarkdown %}
|
||||
</wa-tab-panel>
|
||||
|
||||
<wa-tab-panel name="npm">
|
||||
{% markdown %}
|
||||
To use this theme, import the theme's stylesheet:
|
||||
|
||||
```js
|
||||
import '@awesome.me/webawesome/dist/styles/themes/{{ palette.filename }}';
|
||||
```
|
||||
|
||||
Then apply the following class to the `<html>` element:
|
||||
|
||||
```html
|
||||
<html class="wa-palette-{{ palette.name | lower }}">
|
||||
```
|
||||
{% endmarkdown %}
|
||||
</wa-tab-panel>
|
||||
|
||||
<wa-tab-panel name="self-hosted">
|
||||
{% markdown %}
|
||||
To use this theme, include the theme's stylesheet:
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="/dist/styles/themes/{{ palette.filename }}" />
|
||||
```
|
||||
|
||||
Then apply the following class to the `<html>` element:
|
||||
|
||||
```html
|
||||
<html class="wa-palette-{{ palette.name | lower }}">
|
||||
```
|
||||
{% endmarkdown %}
|
||||
</wa-tab-panel>
|
||||
</wa-tab-group>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
@@ -121,6 +178,7 @@ layout: page
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--wa-space-m);
|
||||
}
|
||||
|
||||
&::part(form-control-label) {
|
||||
@@ -133,7 +191,11 @@ layout: page
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
wa-radio {
|
||||
margin-inline: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.palette-card {
|
||||
|
||||
@@ -100,19 +100,20 @@ If using SSR, you need to also use the `with-media` attribute to add a media sec
|
||||
```html {.example}
|
||||
<div class="wa-grid">
|
||||
<wa-card class="card-media">
|
||||
<img
|
||||
slot="media"
|
||||
src="https://images.unsplash.com/photo-1547191783-94d5f8f6d8b1?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=400&q=80"
|
||||
alt="A kitten walks towards camera on top of pallet."
|
||||
/>
|
||||
This is a kitten, but not just any kitten. This kitten likes walking along pallets.
|
||||
<div slot="media" class="wa-frame:landscape">
|
||||
<img
|
||||
src="https://images.unsplash.com/photo-1547191783-94d5f8f6d8b1?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=400&q=80"
|
||||
alt="A kitten walks towards camera on top of pallet."
|
||||
/>
|
||||
</div>
|
||||
This card has an image of a kitten walking along a pallet.
|
||||
</wa-card>
|
||||
<wa-card class="card-media">
|
||||
<video slot="media" controls>
|
||||
<source src="https://uploads.webawesome.com/dog-with-glasses.mp4" />
|
||||
<p>Your browser doesn't support HTML video</p>
|
||||
</video>
|
||||
This is a kitten, but not just any kitten. This kitten likes walking along pallets.
|
||||
This card has a video of a dog wearing shades.
|
||||
</wa-card>
|
||||
</div>
|
||||
|
||||
@@ -153,10 +154,10 @@ Use the `appearance` attribute to change the card's visual appearance.
|
||||
### Orientation
|
||||
|
||||
Set the `orientation` attribute to `horizontal` to create a card with a horizontal, side-by-side layout. Make sure to set a width or maximum width for the media slot. Horizontal cards do not currently contain the header and footer slots.
|
||||
<wa-callout>
|
||||
<wa-icon slot="icon" name="circle-info" variant="regular"></wa-icon>
|
||||
|
||||
:::info
|
||||
The `actions` slot is only available for the horizontal orientation
|
||||
</wa-callout>
|
||||
:::
|
||||
|
||||
```html {.example}
|
||||
<div class="wa-grid">
|
||||
@@ -166,7 +167,7 @@ The `actions` slot is only available for the horizontal orientation
|
||||
src="https://images.unsplash.com/photo-1559209172-0ff8f6d49ff7?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=80"
|
||||
alt="A kitten sits patiently between a terracotta pot and decorative grasses."
|
||||
/>
|
||||
This is a kitten, but not just any kitten. This kitten likes walking along pallets.
|
||||
This card has a horizontal orientation with media, body, and actions arranged side-by-side.
|
||||
<wa-button slot="actions" variant="neutral" appearance="plain"
|
||||
><wa-icon name="ellipsis" label="actions"></wa-icon
|
||||
></wa-button>
|
||||
|
||||
@@ -19,7 +19,7 @@ The included content will be inserted into the `<wa-include>` element's default
|
||||
|
||||
When an include file loads successfully, the `wa-load` event will be emitted. You can listen for this event to add custom loading logic to your includes.
|
||||
|
||||
If the request fails, the `wa-error` event will be emitted. In this case, `event.detail.status` will contain the resulting HTTP status code of the request, e.g. 404 (not found).
|
||||
If the request fails, the `wa-include-error` event will be emitted. In this case, `event.detail.status` will contain the resulting HTTP status code of the request, e.g. 404 (not found).
|
||||
|
||||
```html
|
||||
<wa-include src="https://shoelace.style/assets/examples/include.html"></wa-include>
|
||||
@@ -33,7 +33,7 @@ If the request fails, the `wa-error` event will be emitted. In this case, `event
|
||||
}
|
||||
});
|
||||
|
||||
include.addEventListener('wa-error', event => {
|
||||
include.addEventListener('wa-include-error', event => {
|
||||
if (event.eventPhase === Event.AT_TARGET) {
|
||||
console.log('Error', event.detail.status);
|
||||
}
|
||||
|
||||
@@ -10,27 +10,32 @@ 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:
|
||||
{% raw %}
|
||||
<p>
|
||||
To use a pre-built theme {%- if currentUser.hasPro -%} or build your own{%- endif -%},
|
||||
{%- if not session.isLoggedIn -%}
|
||||
<a href="/signup">sign up</a> or <a href="/login">log in</a> to create a project.
|
||||
{%- else -%}
|
||||
head over to <a href="/teams">your teams</a> and open up the project you'd like to use.
|
||||
{%- endif -%}
|
||||
In your project's <wa-icon name="gear" variant="regular"></wa-icon> <strong>Settings</strong>,
|
||||
{%- if not currentUser.hasPro -%}
|
||||
select a <wa-icon name="paintbrush" variant="regular"></wa-icon> <strong>Theme</strong> and a <wa-icon name="swatchbook" variant="regular"></wa-icon> <strong>Color Palette</strong> to use, save your changes, and bask in the glory of your new theme.
|
||||
{%- else -%}
|
||||
<wa-icon name="paintbrush" variant="regular"></wa-icon> <strong>Edit Your Theme</strong> to open the Theme Builder and select a pre-built theme or customize your colors, fonts, icons, and more.
|
||||
{%- endif -%}
|
||||
</p>
|
||||
{% endraw %}
|
||||
|
||||
```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:
|
||||
For even more customizations, you can off-road and override 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 style any design token in your own stylesheet by scoping your styles to `:root` and the class for the relevant color scheme (if needed). Here's an example that uses tinted surface colors in light mode:
|
||||
|
||||
```css
|
||||
:root,
|
||||
.wa-light,
|
||||
.wa-dark .wa-invert {
|
||||
--wa-color-brand-fill-quiet: var(--wa-color-purple-95);
|
||||
--wa-color-brand-fill-normal: var(--wa-color-purple-90);
|
||||
--wa-color-brand-fill-loud: var(--wa-color-purple-50);
|
||||
--wa-color-brand-border-quiet: var(--wa-color-purple-90);
|
||||
--wa-color-brand-border-normal: var(--wa-color-purple-80);
|
||||
--wa-color-brand-border-loud: var(--wa-color-purple-60);
|
||||
--wa-color-brand-on-quiet: var(--wa-color-purple-40);
|
||||
--wa-color-brand-on-normal: var(--wa-color-purple-30);
|
||||
--wa-color-brand-on-loud: white;
|
||||
--wa-color-surface-raised: var(--wa-color-neutral-95);
|
||||
--wa-color-surface-default: var(--wa-color-neutral-90);
|
||||
--wa-color-surface-lowered: var(--wa-color-neutral-80);
|
||||
}
|
||||
```
|
||||
|
||||
@@ -155,4 +160,4 @@ For example, we can give `<input type="checkbox">` the same custom styles as `<w
|
||||
color: lavenderblush;
|
||||
}
|
||||
</style>
|
||||
```
|
||||
```
|
||||
|
||||
@@ -12,42 +12,27 @@ Welcome to Web Awesome! [Learn more](https://webawesome.com/) about this project
|
||||
|
||||
---
|
||||
|
||||
## Quick Start (Autoloading via CDN)
|
||||
## 🚀 Using a Project
|
||||
|
||||
To get everything included in Web Awesome, add the following code to the `<head>` of your site:
|
||||
A project gives you your own, personal CDN to use Web Awesome on your site. Each project uses a single line of code to install your preferred version, theme, Font Awesome kit...the works! And, when you update your project's settings, your project code pulls in all of the right stuff automatically — no need to update your own code or redeploy your site.
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="{% cdnUrl 'styles/webawesome.css' %}" />
|
||||
<script type="module" src="{% cdnUrl 'webawesome.loader.js' %}"></script>
|
||||
```
|
||||
One line of code from us. The entire Web Awesome library for you.
|
||||
|
||||
This snippet adds:
|
||||
To use a project:
|
||||
|
||||
- **Web Awesome styles**, a collection of stylesheets including essential default theme styles, optional [styles for native elements](/docs/utilities/native) and optional [utility classes](/docs/utilities)
|
||||
- **The autoloader**, a lightweight script watches the DOM for unregistered Web Awesome elements and lazy loads them for you — even if they're added dynamically
|
||||
|
||||
Now you can [start using Web Awesome!](/docs/usage)
|
||||
|
||||
---
|
||||
|
||||
## 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.
|
||||
|
||||
```html
|
||||
<!-- Option 1: the data-fa-kit-code attribute -->
|
||||
<script src="bundle.js" data-fa-kit-code="abc123"></script>
|
||||
|
||||
<!-- Option 2: the setKitCode() method -->
|
||||
<script type="module">
|
||||
import { setKitCode } from '{% cdnUrl 'webawesome.loader.js' %}';
|
||||
setKitCode('YOUR_KIT_CODE_HERE');
|
||||
</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!
|
||||
:::
|
||||
{% raw %}
|
||||
<ol>
|
||||
<li>
|
||||
{% if not session.isLoggedIn %}
|
||||
<a href="/signup">Sign up</a> or <a href="/login">log in</a> to create a project.
|
||||
{% else %}
|
||||
Head over to <a href="/teams">your favorite team</a> and open up the project you'd like to use.
|
||||
{% endif %}
|
||||
</li>
|
||||
<li>Copy and paste your unique project code into the <code><head></code> of each page on your site.</li>
|
||||
<li><a href="/docs/usage">Start using Web Awesome!</a></li>
|
||||
</ol>
|
||||
{% endraw %}
|
||||
|
||||
---
|
||||
|
||||
@@ -63,31 +48,9 @@ Not a Font Awesome user yet? [Learn more about premium icon packs](https://fonta
|
||||
{% endraw %}
|
||||
</div>
|
||||
|
||||
## Advanced Setup
|
||||
## 🛠️ 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.
|
||||
|
||||
Here's an example that loads only the button component.
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="{% cdnUrl 'styles/themes/default.css' %}" />
|
||||
|
||||
<script type="module">
|
||||
import '{% cdnUrl 'components/button/button.js' %}';
|
||||
|
||||
// <wa-button> is ready to use!
|
||||
</script>
|
||||
```
|
||||
|
||||
You can copy and paste the code to import a component from the "Importing" section of the component's documentation. Note that some components have dependencies that are automatically imported when you cherry pick. If a component has dependencies, they will be listed in the "Dependencies" section of its docs.
|
||||
|
||||
:::warning
|
||||
You will see files named `chunk.[hash].js` in the `chunks` directory. Never import these files directly, as they are generated and change from version to version.
|
||||
:::
|
||||
Projects are our favorite way to use Web Awesome, but different environments (or your own preferences!) may require different installation methods. If you're self-hosting Web Awesome or using npm, refer to the instructions in this section.
|
||||
|
||||
### Installing via npm
|
||||
|
||||
@@ -116,11 +79,48 @@ 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.
|
||||
|
||||
|
||||
### The Difference Between `/dist` & `/dist-cdn`
|
||||
|
||||
If you have Web Awesome installed locally via npm, you'll notice the following directories in the project's root:
|
||||
|
||||
```
|
||||
dist/
|
||||
dist-cdn/
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
### Referencing Necessary Styles
|
||||
|
||||
If you're self-hosting Web Awesome, you'll need to set up your pages to reference any necessary styles. You can do so by referencing `webawesome.css`, or you can pick and choose specific stylesheets you'd like to use.
|
||||
|
||||
```html
|
||||
<!-- Option 1: use all Web Awesome styles -->
|
||||
<link rel="stylesheet" href="/dist/styles/webawesome.css" />
|
||||
|
||||
|
||||
<!-- Option 2: pick and choose styles -->
|
||||
|
||||
<!-- theme (required) -->
|
||||
<link rel="stylesheet" href="/dist/styles/themes/default.css" />
|
||||
|
||||
<!-- native styles (optional) -->
|
||||
<link rel="stylesheet" href="/dist/styles/native.css" />
|
||||
|
||||
<!-- CSS utilities (optional) -->
|
||||
<link rel="stylesheet" href="/dist/styles/utilities.css" />
|
||||
```
|
||||
|
||||
If you choose to use a theme other than the default theme, be sure to add the corresponding class (e.g. `.wa-theme-awesome`) to your `<html>` element so that the class is applied.
|
||||
|
||||
### Setting the Base Path
|
||||
|
||||
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 a Web Awesome project, 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.
|
||||
|
||||
```html
|
||||
<!-- Option 1: the data-webawesome attribute -->
|
||||
@@ -153,18 +153,26 @@ Most of the magic behind assets is handled internally by Web Awesome, but if you
|
||||
</script>
|
||||
```
|
||||
|
||||
### The Difference Between `/dist` & `/dist-cdn`
|
||||
### Using Font Awesome Pro and Pro+
|
||||
|
||||
If you have Web Awesome installed locally via npm, you'll notice the following directories in the project's root:
|
||||
Font Awesome users can provide their kit code to unlock Pro and Pro+ icon packs. If you're using a project, simply add your Font Awesome Kit Code in your project's settings, and boom! Done.
|
||||
|
||||
```
|
||||
dist/
|
||||
dist-cdn/
|
||||
If you're using Web Awesome through other methods like npm, you can provide yours 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 -->
|
||||
<script src="bundle.js" data-fa-kit-code="abc123"></script>
|
||||
|
||||
<!-- Option 2: the setKitCode() method -->
|
||||
<script type="module">
|
||||
import { setKitCode } from '{% cdnUrl 'webawesome.loader.js' %}';
|
||||
setKitCode('YOUR_KIT_CODE_HERE');
|
||||
</script>
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
:::info
|
||||
Not a Font Awesome user yet? [Learn more about Font Awesome icon packs](https://fontawesome.com/) and sign up for an account to unlock them!
|
||||
:::
|
||||
|
||||
## React Users
|
||||
|
||||
|
||||
@@ -43,22 +43,56 @@ layout: docs
|
||||
|
||||
<wa-divider style="--spacing: var(--wa-space-3xl);"></wa-divider>
|
||||
|
||||
<div class="max-line-length">
|
||||
{% markdown %}
|
||||
## Installation
|
||||
## Using Layout Utilities
|
||||
|
||||
Layout components are included in Web Awesome's [autoloader](/docs/#quick-start-autoloading-via-cdn). You can also import them individually via [cherry picking](/docs/#cherry-picking).
|
||||
Layout utility classes are bundled with Web Awesome's [style utilities](/docs/utilities). By including style utilities in your project, you'll have access to layout utilities like `.wa-grid` and `.wa-stack`.
|
||||
{% endmarkdown %}
|
||||
|
||||
Layout utilities are bundled with all [style utilities](/docs/utilities). You can import all Web Awesome page styles (including [native styles](/docs/utilities/native/)) by including the following stylesheet in your project:
|
||||
<wa-tab-group>
|
||||
<wa-tab panel="cdn"><wa-icon name="rocket-launch" variant="regular"></wa-icon> CDN</wa-tab>
|
||||
<wa-tab panel="npm"><wa-icon name="box-open" variant="regular"></wa-icon> npm</wa-tab>
|
||||
<wa-tab panel="self-hosted"><wa-icon name="arrow-down-to-line" variant="regular"></wa-icon> Self-Hosted</wa-tab>
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="{% cdnUrl 'styles/webawesome.css' %}" />
|
||||
<wa-tab-panel name="cdn">
|
||||
{% markdown %}
|
||||
1. Head over to your project's <wa-icon name="gear" variant="regular"></wa-icon> **Settings**.
|
||||
2. Next to **Features**, select the **CSS utilities** checkbox.
|
||||
3. **Save Changes** to immediately update anywhere you're using your project.
|
||||
{% endmarkdown %}
|
||||
</wa-tab-panel>
|
||||
|
||||
<wa-tab-panel name="npm">
|
||||
{% markdown %}
|
||||
To use all Web Awesome styles (including [native styles](/docs/utilities/native/)), import the following stylesheet in your project:
|
||||
|
||||
```js
|
||||
import '@awesome.me/webawesome/dist/styles/webawesome.css';
|
||||
```
|
||||
|
||||
Or, you can choose to import _only_ the utilities:
|
||||
Or, if you only want CSS utility classes, import a theme and the utilities individually:
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="{% cdnUrl 'styles/utilities.css' %}" />
|
||||
```js
|
||||
import '@awesome.me/webawesome/dist/styles/themes/default.css';
|
||||
import '@awesome.me/webawesome/dist/styles/utilities.css';
|
||||
```
|
||||
{% endmarkdown %}
|
||||
</div>
|
||||
</wa-tab-panel>
|
||||
|
||||
<wa-tab-panel name="self-hosted">
|
||||
{% markdown %}
|
||||
To use all Web Awesome styles (including [native styles](/docs/utilities/native/)), include the following stylesheet in your project:
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="/dist/styles/webawesome.css" />
|
||||
```
|
||||
|
||||
Or, if you only want CSS utility classes, include a theme and the utilities individually:
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="/dist/styles/themes/default.css" />
|
||||
<link rel="stylesheet" href="/dist/styles/utilities.css" />
|
||||
```
|
||||
{% endmarkdown %}
|
||||
</wa-tab-panel>
|
||||
</wa-tab-group>
|
||||
|
||||
@@ -27,7 +27,7 @@ Web Awesome ships with [a number of translations](https://github.com/shoelace-st
|
||||
You can import translations using the following syntax, where `<code>` is replaced with any language code shown above.
|
||||
|
||||
```js
|
||||
import '{% cdnUrl "translations/<code>.js" %}';
|
||||
import '/dist/translations/<code>.js';
|
||||
```
|
||||
|
||||
You do not need to load translations up front. You can import them dynamically even after updating the `lang` attribute. Once a translation is registered, localized components will update automatically.
|
||||
@@ -37,7 +37,7 @@ You do not need to load translations up front. You can import them dynamically e
|
||||
document.documentElement.lang = 'de';
|
||||
|
||||
// Import the translation
|
||||
import('{% cdnUrl "translations/<code>.js" %}');
|
||||
import('/translations/<code>.js');
|
||||
```
|
||||
|
||||
### Translation Resolution
|
||||
|
||||
@@ -12,6 +12,10 @@ Components with the <wa-badge variant="warning">Experimental</wa-badge> badge sh
|
||||
|
||||
## Next
|
||||
|
||||
- Fixed a bug in `<wa-slider>` that caused some touch devices to end up with the incorrect value [issue:1703]
|
||||
|
||||
## 3.0.0
|
||||
|
||||
- 🚨 BREAKING: Changed `appearance="filled outlined"` to `appearance="filled-outlined"` in the following elements [issue:1127]
|
||||
- `<wa-badge>`
|
||||
- `<wa-button>`
|
||||
@@ -27,6 +31,7 @@ Components with the <wa-badge variant="warning">Experimental</wa-badge> badge sh
|
||||
- Added back the missing `form-control-label` part to `<wa-textarea>` for consistency with other form controls [pr:1533]
|
||||
- Added focus delegation to `<wa-button>` to ensure tabbing works properly when using `tabindex` [issue:1622]
|
||||
- Added [text utilities](/docs/utilities/text/) for longform text, form control text, font sizes, font weights, text color, and truncation [pr:1602]
|
||||
- Added version 1.0.0 of the [official Web Awesome Figma Design Kit](/docs/resources/figma)
|
||||
- Fixed a bug in `<wa-button>` where slotted badges weren't properly positioned in buttons with an `href` [issue:1377]
|
||||
- Fixed focus outline styles in `<wa-details>` and native `<details>` [issue:1456]
|
||||
- Fixed focus outline styles in `<wa-scroller>`, `<wa-dialog>`, and `<wa-drawer>` [issue:1484]
|
||||
@@ -40,6 +45,9 @@ Components with the <wa-badge variant="warning">Experimental</wa-badge> badge sh
|
||||
- Fixed a bug that caused the required `*` in form labels to have incorrect spacing in `<wa-checkbox>` and `<wa-switch>` [issue:1472]
|
||||
- Fixed a bug in `<wa-dialog>` and `<wa-drawer>` that caused the component to prematurely hide when certain child elements are used [pr:1636]
|
||||
- Fixed a bug in `<wa-popover>` and `<wa-tooltip>` that prevented dots and other valid ID characters from being used [issue:1648]
|
||||
- [Pro] Fixed a bug in `<wa-page>` that caused menu and aside content to reserve space for slots with `disable-sticky`
|
||||
- Fixed incorrect docs for the `wa-include-error` event which is dispatched by `<wa-include>` [issue:1663]
|
||||
- Fixed a bug in `<wa-card>` where slotted header and footer content wasn't properly aligned [pr:1435]
|
||||
- Improved autofill styles in `<wa-input>` so they span the entire width of the visual input [issue:1439]
|
||||
- Improved [text utilities](/docs/utilities/text/) so that each size modifier always exactly matches the applied font size [pr:1602]
|
||||
- Improved Native Styles to use the `--wa-font-weight-code` design token
|
||||
|
||||
@@ -11,7 +11,7 @@ layout: page
|
||||
<div class="wa-stack wa-gap-xl">
|
||||
<div class="wa-stack wa-align-items-start">
|
||||
<div class="wa-stack wa-gap-s">
|
||||
<h2 class="anchor-heading wa-cluster wa-gap-xs" data-no-anchor><wa-icon name="github" family="brands" style="font-size: 2ch;"></wa-icon>Github</h2>
|
||||
<h2 class="anchor-heading wa-cluster wa-gap-xs" data-no-anchor><wa-icon name="github" family="brands" style="font-size: 2ch;"></wa-icon>GitHub</h2>
|
||||
<span class="wa-heading-m">Feature requests & bugs</span>
|
||||
<p class="wa-caption-l">Notice a bug or have an idea? Open an issue on GitHub so we can triage, track, and ship fixes.</p>
|
||||
</div>
|
||||
|
||||
@@ -4,6 +4,9 @@ description: Style (and restyle) your website at will with any of Web Awesome's
|
||||
layout: page
|
||||
---
|
||||
|
||||
{% from "pro-badge.njk" import proBadge %}
|
||||
{% from "free-badge.njk" import freeBadge %}
|
||||
|
||||
<h1>{{ title }}</h1>
|
||||
|
||||
<p>Themes are collections of <a href="/docs/tokens">design tokens</a> that give a cohesive look and feel to the entire Web Awesome library. Style and restyle your website at will by loading any pre-built theme.</p>
|
||||
@@ -64,8 +67,9 @@ to create a project with any one of these themes.
|
||||
<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>
|
||||
{{ freeBadge({ id: "free-badge", description: "This theme is available in the free version of Web Awesome." }) }}
|
||||
{{ proBadge({ id: "pro-badge", description: "This theme requires access to Web Awesome Pro." }) }}
|
||||
|
||||
</div>
|
||||
<p data-theme-description>Description</p>
|
||||
</header>
|
||||
@@ -86,16 +90,70 @@ to create a project with any one of these themes.
|
||||
</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>
|
||||
</div>
|
||||
<div class="theme-instructions" data-theme="{{ theme.filename | stripExtension }}" {% if not loop.first %}hidden{% endif %}>
|
||||
<wa-tab-group>
|
||||
<wa-tab panel="cdn"><wa-icon name="rocket-launch" variant="regular"></wa-icon> CDN</wa-tab>
|
||||
<wa-tab panel="npm"><wa-icon name="box-open" variant="regular"></wa-icon> npm</wa-tab>
|
||||
<wa-tab panel="self-hosted"><wa-icon name="arrow-down-to-line" variant="regular"></wa-icon> Self-Hosted</wa-tab>
|
||||
|
||||
<wa-tab-panel name="cdn">
|
||||
{% markdown %}
|
||||
{% if theme.isPro %}
|
||||
<wa-callout variant="neutral" size="small">
|
||||
<wa-icon name="info-circle" variant="regular"></wa-icon>
|
||||
This theme can only be used on teams with a Pro subscription.
|
||||
</wa-callout>
|
||||
<br />
|
||||
{% else %}
|
||||
**For projects on Free teams:**
|
||||
1. Head over to your project's <wa-icon name="gear" variant="regular"></wa-icon> **Settings**.
|
||||
2. For your **Theme**, select <wa-icon name="paintbrush" variant="regular"></wa-icon> **{{ theme.filename | stripExtension | capitalize }}**.
|
||||
3. For your **Color Palette**, select <wa-icon name="swatchbook" variant="regular"></wa-icon> **{{ theme.palette.filename | stripExtension | capitalize }}**.
|
||||
4. Press **Save Changes** to immediately update anywhere you're using your project.
|
||||
{% endif %}
|
||||
|
||||
**For projects on Pro teams:**
|
||||
1. Head over to your project's <wa-icon name="gear" variant="regular"></wa-icon> **Settings**.
|
||||
2. Press <wa-icon name="paintbrush" variant="regular"></wa-icon> **Edit Your Theme** to open the Theme Builder.
|
||||
3. Open **Theme** and select **{{ theme.filename | stripExtension | capitalize }}**.
|
||||
4. Press **Save Theme** to immediately update anywhere you're using your project.
|
||||
{% endmarkdown %}
|
||||
</wa-tab-panel>
|
||||
|
||||
<wa-tab-panel name="npm">
|
||||
{% markdown %}
|
||||
To use this theme, import the theme's stylesheet:
|
||||
```js
|
||||
import '@awesome.me/webawesome/dist/styles/themes/{{ theme.filename }}';
|
||||
```
|
||||
|
||||
Then apply the following classes to the `<html>` element:
|
||||
|
||||
```html
|
||||
<html class="wa-theme-{{ theme.filename | stripExtension }} wa-palette-{{ theme.palette.filename | stripExtension }} wa-brand-{{ theme.colorBrand.color}}">
|
||||
```
|
||||
{% endmarkdown %}
|
||||
</wa-tab-panel>
|
||||
|
||||
<wa-tab-panel name="self-hosted">
|
||||
{% markdown %}
|
||||
To use this theme, include the theme's stylesheet:
|
||||
```html
|
||||
<link rel="stylesheet" href="/dist/styles/themes/{{ theme.filename }}" />
|
||||
```
|
||||
|
||||
Then apply the following classes to the `<html>` element:
|
||||
|
||||
```html
|
||||
<html class="wa-theme-{{ theme.filename | stripExtension }} wa-palette-{{ theme.palette.filename | stripExtension }} wa-brand-{{ theme.colorBrand.color}}">
|
||||
```
|
||||
{% endmarkdown %}
|
||||
</wa-tab-panel>
|
||||
</wa-tab-group>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
@@ -108,8 +166,12 @@ to create a project with any one of these themes.
|
||||
const beforeFrame = document.querySelector('wa-zoomable-frame[slot="before"]');
|
||||
const nameElement = document.querySelector('[data-theme-name]');
|
||||
const descriptionElement = document.querySelector('[data-theme-description]');
|
||||
const freeBadge = document.querySelector('[data-free-badge]');
|
||||
const proBadge = document.querySelector('[data-pro-badge]');
|
||||
const freeBadge = document.getElementById('free-badge');
|
||||
const proBadge = document.getElementById('pro-badge');
|
||||
|
||||
// Hide both badges initially
|
||||
if (freeBadge) freeBadge.hidden = true;
|
||||
if (proBadge) proBadge.hidden = true;
|
||||
|
||||
function updateFrames(selectedValue, title, description, isPro, palette, brand) {
|
||||
// Update theme classes on both frames
|
||||
@@ -225,14 +287,13 @@ to create a project with any one of these themes.
|
||||
}
|
||||
|
||||
#theme-viewer {
|
||||
margin-block-start: 2rem;
|
||||
|
||||
#theme-picker {
|
||||
|
||||
&::part(form-control-input) {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--wa-space-m);
|
||||
}
|
||||
|
||||
&::part(form-control-label) {
|
||||
@@ -246,6 +307,10 @@ to create a project with any one of these themes.
|
||||
white-space: nowrap;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
wa-radio {
|
||||
margin-inline: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.theme-card {
|
||||
|
||||
165
packages/webawesome/docs/docs/theming/index.md
Normal file
165
packages/webawesome/docs/docs/theming/index.md
Normal file
@@ -0,0 +1,165 @@
|
||||
---
|
||||
title: Theming
|
||||
description: TODO
|
||||
layout: page-outline
|
||||
---
|
||||
|
||||
Web Awesome themes apply a cohesive look and feel across the entire library. A theme is a collection of predefined CSS custom properties that cover a range of styles from colors to transitions. We call these CSS custom properties design tokens.
|
||||
|
||||
There are 11 handcrafted themes to choose from; 3 are free to use with an additional 9 available in Web Awesome Pro. You can also build your own manually with CSS or with our Pro Theme Builder.
|
||||
|
||||
## Key Concepts
|
||||
|
||||
Themes are made up of several layers of increasing specificity, each represented by a CSS class on the document.
|
||||
|
||||
### Color Palette
|
||||
`.wa-palette-{name}`
|
||||
|
||||
Color palettes give you a full spectrum of colors to use in your project. A color palette defines 10 hues — red, orange, yellow, green, cyan, blue, indigo, purple, pink, and gray — each with 11 tints. Tints are assigned numbers that correlate to their lightness.
|
||||
|
||||
There are 9 specially crafted color palettes; 3 are free to use with an additional 6 available in Web Awesome Pro.
|
||||
|
||||
{% include 'theming/color-palettes.njk' %}
|
||||
|
||||
Your color palette is determined by `class="wa-palette-{name}"` on the `<html>` element. If no class is specified, the default color palette for your chosen theme is used.
|
||||
|
||||
### Variants
|
||||
`.wa-{variant}-{hue}`
|
||||
|
||||
Variants convey a specific meaning through color. There are five variants:
|
||||
- **Brand** for product recognition
|
||||
- **Neutral** for generic and ordinary content
|
||||
- **Success** for validity or confirmation
|
||||
- **Warning** for caution or uncertainty
|
||||
- **Danger** for errors or risk
|
||||
|
||||
Brand and neutral are used by nearly every element, component, and pattern across the library. Success, warning, and danger are used selectively by components that could benefit from semantic reinforcement, such as buttons and callouts.
|
||||
|
||||
{% include 'theming/variants.njk' %}
|
||||
|
||||
Any hue from a color palette can be assigned to a variant. Each variant is determined by `class="wa-{variant}-{hue}"` on the `<html>` element. If no class is specified:
|
||||
- **Brand** defaults to <wa-icon name="square" style="color: var(--wa-color-blue);"></wa-icon> **blue**
|
||||
- **Neutral** defaults to <wa-icon name="square" style="color: var(--wa-color-gray);"></wa-icon> **gray**
|
||||
- **Success** defaults to <wa-icon name="square" style="color: var(--wa-color-green);"></wa-icon> **green**
|
||||
- **Warning** defaults to <wa-icon name="square" style="color: var(--wa-color-yellow);"></wa-icon> **yellow**
|
||||
- **Danger** defaults to <wa-icon name="square" style="color: var(--wa-color-red);"></wa-icon> **red**
|
||||
|
||||
### Theme Styles
|
||||
`.wa-theme-{name}`
|
||||
|
||||
Theme styles assign specific tints from your chosen variant colors — along with qualities like fonts, borders, space, and shadows — to design tokens that style elements and components. Themes may also contain custom CSS overrides to change the default look of components.
|
||||
|
||||
TODO: Add theme preview
|
||||
|
||||
Your theme is determined by `class="wa-theme-{name}"` on the `<html>` element. If no class is specified, the default theme is used.
|
||||
|
||||
### Light and Dark Mode
|
||||
`.wa-light` | `.wa-dark`
|
||||
|
||||
Every theme is designed to adapt to light and dark mode. Light mode styles are applied by default, but you can apply a specific color scheme to an entire page or just a section with `class="wa-light"` or `class="wa-dark"`.
|
||||
|
||||
```html {.example}
|
||||
<div class="wa-grid">
|
||||
|
||||
<wa-card class="wa-light">
|
||||
<div slot="header" class="wa-split">
|
||||
<h4 class="wa-heading-m">Light</h4>
|
||||
<wa-icon name="brightness"></wa-icon>
|
||||
</div>
|
||||
<div class="wa-stack">
|
||||
<wa-input label="# of Waffles" type="number" value="3"></wa-input>
|
||||
<wa-select label="Toppings" multiple value="jelly-beans">
|
||||
<wa-option value="whipped-cream">Whipped cream</wa-option>
|
||||
<wa-option value="hershey">Hershey's Kisses</wa-option>
|
||||
<wa-option value="jelly-beans">Jelly beans</wa-option>
|
||||
</wa-select>
|
||||
<wa-button appearance="filled" variant="brand">
|
||||
<wa-icon slot="start" name="waffle"></wa-icon>
|
||||
Make Waffles
|
||||
</wa-button>
|
||||
</div>
|
||||
</wa-card>
|
||||
|
||||
<wa-card class="wa-dark">
|
||||
<div slot="header" class="wa-split">
|
||||
<h4 class="wa-heading-m">Dark</h4>
|
||||
<wa-icon name="moon-stars"></wa-icon>
|
||||
</div>
|
||||
<div class="wa-stack">
|
||||
<wa-input label="# of Waffles" type="number" value="3"></wa-input>
|
||||
<wa-select label="Toppings" multiple value="jelly-beans">
|
||||
<wa-option value="whipped-cream">Whipped cream</wa-option>
|
||||
<wa-option value="hershey">Hershey's Kisses</wa-option>
|
||||
<wa-option value="jelly-beans">Jelly beans</wa-option>
|
||||
</wa-select>
|
||||
<wa-button appearance="filled" variant="brand">
|
||||
<wa-icon slot="start" name="waffle"></wa-icon>
|
||||
Make Waffles
|
||||
</wa-button>
|
||||
</div>
|
||||
</wa-card>
|
||||
|
||||
</div>
|
||||
```
|
||||
|
||||
#### Inverting the Color Scheme
|
||||
`.wa-invert`
|
||||
|
||||
You can force a section to behave like `.wa-dark` in light mode and like `.wa-light` in dark mode by using `class="wa-invert"`.
|
||||
|
||||
```html {.example}
|
||||
<p>This card will always use the opposite of the color scheme applied to the docs.</p>
|
||||
|
||||
<wa-card class="wa-invert">
|
||||
<div slot="header" class="wa-split">
|
||||
<h4 class="wa-heading-m">Invert</h4>
|
||||
<wa-icon name="swap"></wa-icon>
|
||||
</div>
|
||||
<div class="wa-flank:end wa-align-items-end">
|
||||
<wa-select label="Location" value="upside-down">
|
||||
<wa-option value="lab">Hawkins Lab</wa-option>
|
||||
<wa-option value="mall">Starcourt Mall</wa-option>
|
||||
<wa-option value="upside-down">The Upside Down</wa-option>
|
||||
</wa-select>
|
||||
<wa-button id="go-button" appearance="filled" variant="brand">
|
||||
<wa-icon label="Go" name="person-to-portal" family="duotone"></wa-icon>
|
||||
</wa-button>
|
||||
<wa-tooltip for="go-button">
|
||||
Go!
|
||||
</wa-tooltip>
|
||||
</div>
|
||||
</wa-card>
|
||||
```
|
||||
|
||||
#### Detecting Color Scheme Preference
|
||||
|
||||
While both light and dark mode styles are built-in to all themes, Web Awesome doesn't automatically detect the user's color scheme preference. We recommend doing this at the application level.
|
||||
|
||||
Follow these best practices for supporting both light and dark mode:
|
||||
- Check for [`prefers-color-scheme`](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@media/prefers-color-scheme) and use its value by default
|
||||
- Allow the user to override this setting in your app
|
||||
- Remember the user's preference and restore it on subsequent visits
|
||||
|
||||
Let's assume you store the user's color scheme preference for your app in a variable called `colorScheme` (values: `auto` | `light` | `dark`). You can use the following JS snippet to apply `class="wa-dark"` to the `<html>` element accordingly:
|
||||
|
||||
```js
|
||||
const systemDark = window.matchMedia('(prefers-color-scheme: dark)');
|
||||
const applyDark = function (event = systemDark) {
|
||||
const isDark = colorScheme === 'auto' ? event.matches : colorScheme === 'dark';
|
||||
document.documentElement.classList.toggle('wa-dark', isDark);
|
||||
};
|
||||
systemDark.addEventListener('change', applyDark);
|
||||
applyDark();
|
||||
```
|
||||
|
||||
## Using Themes
|
||||
|
||||
Use and update themes instantly via CDN with [Web Awesome projects](/teams). Or, assemble the pieces together using npm or in your self-hosted app.
|
||||
|
||||
Select your favorite options and follow the instructions for your preferred method.
|
||||
|
||||
{% include 'theming/instructions.njk' %}
|
||||
|
||||
## Creating Your Own
|
||||
|
||||
TODO
|
||||
@@ -40,6 +40,7 @@ await allDefined();
|
||||
|
||||
By default, `allDefined()` will wait for all `wa-` prefixed custom elements within the current `document` to be registered.
|
||||
You can customize this behavior by passing in options:
|
||||
|
||||
- `root` allows you to pass in a different element to search within, or a different document entirely (defaults to `document`).
|
||||
- `match` allows you to specify a custom function to determine which elements to wait for. This function should return `true` for elements you want to wait for and `false` for those you don't.
|
||||
- `additionalElements` allows you to wait for custom elements to be defined that may not be present in the DOM at the time `allDefined()` is called. This can be useful for elements that are loaded dynamically via JS.
|
||||
@@ -52,7 +53,7 @@ import { allDefined } from '/dist/webawesome.js';
|
||||
await allDefined({
|
||||
match: tagName => tagName.startsWith('wa-') || tagName === 'my-component',
|
||||
root: document.getElementById('sidebar'),
|
||||
additionalElements: ['wa-slider', 'other-slider']
|
||||
additionalElements: ['wa-slider', 'other-slider'],
|
||||
});
|
||||
```
|
||||
|
||||
@@ -194,12 +195,11 @@ Web Awesome ships with a file called `vscode.html-custom-data.json` that can be
|
||||
|
||||
If `settings.json` already exists, simply add the above line to the root of the object. Note that you may need to restart VS Code for the changes to take effect.
|
||||
|
||||
If you are using WebAwesome through the [CDN](/docs/#quick-start-autoloading-via-cdn) you can manually [download the file]({% cdnUrl 'vscode.html-custom-data.json' %}]({% cdnUrl 'vscode.html-custom-data.json' %}) instead.
|
||||
|
||||
### JetBrains IDEs
|
||||
If you are using a [JetBrains IDE](https://www.jetbrains.com/) and you are installing Web Awesome from NPM, the editor will automatically detect the web-types.json file from the package and you should immediately see component information in your editor.
|
||||
|
||||
If you are installing from the CDN, you can [download a local copy]({% cdnUrl 'web-types.json' %}) and add it to the root of your project. Be sure to add a reference to the web-types.json file in your package.json in order for your editor to properly detect it.
|
||||
If you are using a [JetBrains IDE](https://www.jetbrains.com/) and you are installing Web Awesome from NPM, the editor will automatically detect the `web-types.json` file from the package and you should immediately see component information in your editor.
|
||||
|
||||
Be sure to add a reference to the `web-types.json` file in your `package.json` in order for your editor to properly detect it.
|
||||
|
||||
```json
|
||||
{
|
||||
|
||||
@@ -84,7 +84,7 @@ Clusters are great for inline lists and aligning items of varying sizes.
|
||||
|
||||
## Align Items
|
||||
|
||||
By default, items are centered in the block direction of the `wa-cluster` container. You can add any of the following [`wa-align-items-*`](/docs/style-utilities/align-items) classes to an element with `wa-cluster` to specify how items are aligned in the block direction:
|
||||
By default, items are centered in the block direction of the `wa-cluster` container. You can add any of the following [`wa-align-items-*`](/docs/utilities/align-items) classes to an element with `wa-cluster` to specify how items are aligned in the block direction:
|
||||
|
||||
- `wa-align-items-start`
|
||||
- `wa-align-items-end`
|
||||
@@ -119,7 +119,7 @@ By default, items are centered in the block direction of the `wa-cluster` contai
|
||||
|
||||
## Gap
|
||||
|
||||
By default, the gap between cluster items uses `--wa-space-m` from your theme. You can add any of the following [`wa-gap-*`](/docs/style-utilities/gap) classes to an element with `wa-cluster` to specify the gap between items:
|
||||
By default, the gap between cluster items uses `--wa-space-m` from your theme. You can add any of the following [`wa-gap-*`](/docs/utilities/gap) classes to an element with `wa-cluster` to specify the gap between items:
|
||||
|
||||
- `wa-gap-0`
|
||||
- `wa-gap-3xs`
|
||||
|
||||
@@ -137,7 +137,7 @@ The main content fills the remaining inline space of the container. By default,
|
||||
|
||||
## Align Items
|
||||
|
||||
By default, items are centered in the block direction of the `wa-flank` container. You can add any of the following [`wa-align-items-*`](/docs/style-utilities/align-items) classes to an element with `wa-flank` to specify how items are aligned in the block direction:
|
||||
By default, items are centered in the block direction of the `wa-flank` container. You can add any of the following [`wa-align-items-*`](/docs/utilities/align-items) classes to an element with `wa-flank` to specify how items are aligned in the block direction:
|
||||
|
||||
- `wa-align-items-start`
|
||||
- `wa-align-items-end`
|
||||
@@ -168,7 +168,7 @@ By default, items are centered in the block direction of the `wa-flank` containe
|
||||
|
||||
## Gap
|
||||
|
||||
By default, the gap between flank items uses `--wa-space-m` from your theme. You can add any of the following [`wa-gap-*`](/docs/style-utilities/gap) classes to an element with `wa-flank` to specify the gap between items:
|
||||
By default, the gap between flank items uses `--wa-space-m` from your theme. You can add any of the following [`wa-gap-*`](/docs/utilities/gap) classes to an element with `wa-flank` to specify the gap between items:
|
||||
|
||||
- `wa-gap-0`
|
||||
- `wa-gap-3xs`
|
||||
|
||||
@@ -139,7 +139,7 @@ Frames have a square aspect ratio by default. You can append `:square` (1 / 1),
|
||||
|
||||
## Border Radius
|
||||
|
||||
Frames have a square border radius by default. You can add any of the following [`wa-border-radius-*`](/docs/style-utilities/border-radius) classes to an element with `wa-frame` to specify the border radius:
|
||||
Frames have a square border radius by default. You can add any of the following [`wa-border-radius-*`](/docs/utilities/border-radius) classes to an element with `wa-frame` to specify the border radius:
|
||||
|
||||
- `wa-border-radius-s`
|
||||
- `wa-border-radius-m`
|
||||
|
||||
@@ -169,7 +169,7 @@ By default, grid items will wrap when the grid's column size is less than `20ch`
|
||||
|
||||
## Gap
|
||||
|
||||
By default, the gap between grid items uses `--wa-space-m` from your theme. You can add any of the following [`wa-gap-*`](/docs/style-utilities/gap) classes to an element with `wa-grid` to specify the gap between items:
|
||||
By default, the gap between grid items uses `--wa-space-m` from your theme. You can add any of the following [`wa-gap-*`](/docs/utilities/gap) classes to an element with `wa-grid` to specify the gap between items:
|
||||
|
||||
- `wa-gap-0`
|
||||
- `wa-gap-3xs`
|
||||
|
||||
@@ -45,22 +45,54 @@ layout: docs
|
||||
|
||||
<wa-divider style="--spacing: var(--wa-space-3xl);"></wa-divider>
|
||||
|
||||
<div class="max-line-length">
|
||||
{% markdown %}
|
||||
## Installation
|
||||
|
||||
To use all Web Awesome page styles (including [native styles](/docs/utilities/native/)), include the following stylesheet in your project:
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="{% cdnUrl 'styles/webawesome.css' %}" />
|
||||
```
|
||||
|
||||
Or, to _only_ include utilities:
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="{% cdnUrl 'styles/utilities.css' %}" />
|
||||
```
|
||||
|
||||
## Using {{ title }}
|
||||
{% endmarkdown %}
|
||||
|
||||
</div>
|
||||
<wa-tab-group>
|
||||
<wa-tab panel="cdn"><wa-icon name="rocket-launch" variant="regular"></wa-icon> CDN</wa-tab>
|
||||
<wa-tab panel="npm"><wa-icon name="box-open" variant="regular"></wa-icon> npm</wa-tab>
|
||||
<wa-tab panel="self-hosted"><wa-icon name="arrow-down-to-line" variant="regular"></wa-icon> Self-Hosted</wa-tab>
|
||||
|
||||
<wa-tab-panel name="cdn">
|
||||
{% markdown %}
|
||||
1. Head over to your project's <wa-icon name="gear" variant="regular"></wa-icon> **Settings**.
|
||||
2. Next to **Features**, select the **CSS utilities** checkbox.
|
||||
3. **Save Changes** to immediately update anywhere you're using your project.
|
||||
{% endmarkdown %}
|
||||
</wa-tab-panel>
|
||||
|
||||
<wa-tab-panel name="npm">
|
||||
{% markdown %}
|
||||
To use all Web Awesome styles (including [native styles](/docs/utilities/native/)), import the following stylesheet in your project:
|
||||
|
||||
```js
|
||||
import '@awesome.me/webawesome/dist/styles/webawesome.css';
|
||||
```
|
||||
|
||||
Or, if you only want CSS utility classes, import a theme and the utilities individually:
|
||||
|
||||
```js
|
||||
import '@awesome.me/webawesome/dist/styles/themes/default.css';
|
||||
import '@awesome.me/webawesome/dist/styles/utilities.css';
|
||||
```
|
||||
{% endmarkdown %}
|
||||
</wa-tab-panel>
|
||||
|
||||
<wa-tab-panel name="self-hosted">
|
||||
{% markdown %}
|
||||
To use all Web Awesome styles (including [native styles](/docs/utilities/native/)), include the following stylesheet in your project:
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="/dist/styles/webawesome.css" />
|
||||
```
|
||||
|
||||
Or, if you only want CSS utility classes, include a theme and the utilities individually:
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="/dist/styles/themes/default.css" />
|
||||
<link rel="stylesheet" href="/dist/styles/utilities.css" />
|
||||
```
|
||||
{% endmarkdown %}
|
||||
</wa-tab-panel>
|
||||
</wa-tab-group>
|
||||
|
||||
@@ -9,18 +9,53 @@ Native styles use design tokens to spruce up native HTML elements so that they m
|
||||
|
||||
## Using native styles
|
||||
|
||||
<wa-tab-group>
|
||||
<wa-tab panel="cdn"><wa-icon name="rocket-launch" variant="regular"></wa-icon> CDN</wa-tab>
|
||||
<wa-tab panel="npm"><wa-icon name="box-open" variant="regular"></wa-icon> npm</wa-tab>
|
||||
<wa-tab panel="self-hosted"><wa-icon name="arrow-down-to-line" variant="regular"></wa-icon> Self-Hosted</wa-tab>
|
||||
|
||||
<wa-tab-panel name="cdn">
|
||||
{% markdown %}
|
||||
1. Head over to your project's <wa-icon name="gear" variant="regular"></wa-icon> **Settings**.
|
||||
2. Next to **Features**, select the **Native styles** checkbox.
|
||||
3. **Save Changes** to immediately update anywhere you're using your project.
|
||||
{% endmarkdown %}
|
||||
</wa-tab-panel>
|
||||
|
||||
<wa-tab-panel name="npm">
|
||||
{% markdown %}
|
||||
To use all Web Awesome styles (including [utilities](/docs/utilities/)), import the following stylesheet in your project:
|
||||
|
||||
```js
|
||||
import '@awesome.me/webawesome/dist/styles/webawesome.css';
|
||||
```
|
||||
|
||||
Or, if you only want styles for native elements, import a theme and native styles individually:
|
||||
|
||||
```js
|
||||
import '@awesome.me/webawesome/dist/styles/themes/default.css';
|
||||
import '@awesome.me/webawesome/dist/styles/native.css';
|
||||
```
|
||||
{% endmarkdown %}
|
||||
</wa-tab-panel>
|
||||
|
||||
<wa-tab-panel name="self-hosted">
|
||||
{% markdown %}
|
||||
To use all Web Awesome styles (including [utilities](/docs/utilities/)), include the following stylesheet in your project:
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="{% cdnUrl 'styles/webawesome.css' %}" />
|
||||
<link rel="stylesheet" href="/dist/styles/webawesome.css" />
|
||||
```
|
||||
|
||||
Or, if you only want styles for native elements, include the default theme and native styles individually:
|
||||
Or, if you only want styles for native elements, include a theme and native styles individually:
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="{% cdnUrl 'styles/themes/default.css' %}" />
|
||||
<link rel="stylesheet" href="{% cdnUrl 'styles/native.css' %}" />
|
||||
<link rel="stylesheet" href="/dist/styles/themes/default.css" />
|
||||
<link rel="stylesheet" href="/dist/styles/native.css" />
|
||||
```
|
||||
{% endmarkdown %}
|
||||
</wa-tab-panel>
|
||||
</wa-tab-group>
|
||||
|
||||
You can additionally include any pre-made [theme](/docs/themes/) or [color palette](/docs/color-palettes/) to change the look of native elements.
|
||||
|
||||
@@ -30,10 +65,18 @@ Native styles set default space between many block-level HTML elements using the
|
||||
|
||||
```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>
|
||||
<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>
|
||||
@@ -191,8 +234,8 @@ Use any inline text element like `<strong>`, `<em>`, `<a>`, `<kbd>`, and others
|
||||
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"
|
||||
<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"
|
||||
/>
|
||||
```
|
||||
@@ -204,7 +247,9 @@ Structure tabular data with `<table>` and related elements like `<caption>`, `<t
|
||||
```html {.example}
|
||||
<table>
|
||||
<caption>
|
||||
This <code><caption></code> describes the table
|
||||
This
|
||||
<code><caption></code>
|
||||
describes the table
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -347,7 +392,6 @@ Create buttons with `<button>` or `<input type="button | submit | reset">`. Butt
|
||||
|
||||
Add the `wa-brand`, `wa-neutral`, `wa-success`, `wa-warning`, or `wa-danger` class to specify the button's [color variant](/docs/utilities/color/).
|
||||
|
||||
|
||||
```html {.example}
|
||||
<button class="wa-neutral">Neutral</button>
|
||||
<button class="wa-brand">Brand</button>
|
||||
@@ -406,7 +450,8 @@ Create a variety of form controls with `<input type="">`, `<select>`, and `<text
|
||||
<label>Color <input type="color" value="#f36944" /></label>
|
||||
<label>File <input type="file" multiple /></label>
|
||||
<label>Range <input type="range" /></label>
|
||||
<label>Select
|
||||
<label
|
||||
>Select
|
||||
<select>
|
||||
<option value="option-1">Option 1</option>
|
||||
<option value="option-2">Option 2</option>
|
||||
@@ -432,6 +477,7 @@ Create a variety of form controls with `<input type="">`, `<select>`, and `<text
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
```html {.example}
|
||||
<div class="wa-stack">
|
||||
<input type="text" placeholder="Small input" class="wa-size-s" />
|
||||
@@ -510,7 +556,8 @@ Wrap form controls in a flex container to arrange them horizontally or verticall
|
||||
|
||||
<form class="wa-stack">
|
||||
<label>Number of pancakes <input type="number" value="5" /></label>
|
||||
<label>Syrup flavor
|
||||
<label
|
||||
>Syrup flavor
|
||||
<select>
|
||||
<option value="maple">Maple</option>
|
||||
<option value="strawberry">Strawberry</option>
|
||||
|
||||
@@ -106,7 +106,7 @@ Items can be split across a row or a column by appending `:row` or `:column` to
|
||||
|
||||
## Align Items
|
||||
|
||||
By default, items are centered on the cross axis of the `wa-split` container. You can add any of the following [`wa-align-items-*`](/docs/style-utilities/align-items) classes to an element with `wa-split` to specify how items are aligned:
|
||||
By default, items are centered on the cross axis of the `wa-split` container. You can add any of the following [`wa-align-items-*`](/docs/utilities/align-items) classes to an element with `wa-split` to specify how items are aligned:
|
||||
|
||||
- `wa-align-items-start`
|
||||
- `wa-align-items-end`
|
||||
@@ -139,7 +139,7 @@ These modifiers specify how items are aligned in the block direction for `wa-spl
|
||||
|
||||
## Gap
|
||||
|
||||
A split's gap determines how close items can be before they wrap. By default, the gap between split items uses `--wa-space-m` from your theme. You can add any of the following [`wa-gap-*`](/docs/style-utilities/gap) classes to an element with `wa-split` to specify the gap between items:
|
||||
A split's gap determines how close items can be before they wrap. By default, the gap between split items uses `--wa-space-m` from your theme. You can add any of the following [`wa-gap-*`](/docs/utilities/gap) classes to an element with `wa-split` to specify the gap between items:
|
||||
|
||||
- `wa-gap-0`
|
||||
- `wa-gap-3xs`
|
||||
|
||||
@@ -62,7 +62,7 @@ Stacks are well suited for forms, text, and ensuring consistent spacing between
|
||||
|
||||
## Align Items
|
||||
|
||||
By default, items stretch to fill the inline size of the `wa-stack` container. You can add any of the following [`wa-align-items-*`](/docs/style-utilities/align-items) classes to an element with `wa-stack` to specify how items are aligned in the inline direction:
|
||||
By default, items stretch to fill the inline size of the `wa-stack` container. You can add any of the following [`wa-align-items-*`](/docs/utilities/align-items) classes to an element with `wa-stack` to specify how items are aligned in the inline direction:
|
||||
|
||||
- `wa-align-items-start`
|
||||
- `wa-align-items-end`
|
||||
@@ -92,7 +92,7 @@ By default, items stretch to fill the inline size of the `wa-stack` container. Y
|
||||
|
||||
## Gap
|
||||
|
||||
By default, the gap between stack items uses `--wa-space-m` from your theme. You can add any of the following [`wa-gap-*`](/docs/style-utilities/gap) classes to an element with `wa-stack` to specify the gap between items:
|
||||
By default, the gap between stack items uses `--wa-space-m` from your theme. You can add any of the following [`wa-gap-*`](/docs/utilities/gap) classes to an element with `wa-stack` to specify the gap between items:
|
||||
|
||||
- `wa-gap-0`
|
||||
- `wa-gap-3xs`
|
||||
|
||||
@@ -238,22 +238,14 @@ layout: page
|
||||
{% if currentUser.hasPro %}
|
||||
<span class="wa-font-size-l" style="text-align: center; width: 100%;">Thanks for being a Web Awesome Pro subscriber!</span>
|
||||
{% else %}
|
||||
{% if App.flags.stripeEnabled %}
|
||||
<div class="wa-stack wa-gap-xs">
|
||||
<h3 class="wa-heading-m">Get More with Web Awesome Pro!</h3>
|
||||
<p>Unlock Pro-only themes, components, patterns, and great services like the Theme Builder.</p>
|
||||
</div>
|
||||
<wa-button class="wa-dark" size="small" href="/purchase">
|
||||
<wa-icon slot="start" name="rocket-launch"></wa-icon>
|
||||
Purchase Pro
|
||||
</wa-button>
|
||||
{% else %}
|
||||
<span><em>Psst!</em> You can pre-order Web Awesome Pro at a low, guaranteed-for-life price — but not for long. Get in while the gettin’s good.</span>
|
||||
<wa-button class="wa-dark" size="small" href="https://www.kickstarter.com/projects/fontawesome/web-awesome">
|
||||
<wa-icon slot="start" name="person-running"></wa-icon>
|
||||
Pre-order WA Pro
|
||||
</wa-button>
|
||||
{% endif %}
|
||||
<div class="wa-stack wa-gap-xs">
|
||||
<h3 class="wa-heading-m">Get More with Web Awesome Pro!</h3>
|
||||
<p>Unlock Pro-only themes, components, patterns, and great services like the Theme Builder.</p>
|
||||
</div>
|
||||
<wa-button class="wa-dark" size="small" href="/purchase">
|
||||
<wa-icon slot="start" name="rocket-launch"></wa-icon>
|
||||
Purchase Pro
|
||||
</wa-button>
|
||||
{% endif %}
|
||||
{% endraw %}
|
||||
</div>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"access": "public"
|
||||
},
|
||||
"description": "A forward-thinking library of web components.",
|
||||
"version": "3.0.0-beta.6",
|
||||
"version": "3.0.0",
|
||||
"homepage": "https://webawesome.com/",
|
||||
"author": "Web Awesome",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -3,7 +3,6 @@ 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 variantStyles from '../../styles/utilities/variants.css';
|
||||
import type WaButton from '../button/button.js';
|
||||
import styles from './button-group.css';
|
||||
|
||||
@@ -19,7 +18,7 @@ import styles from './button-group.css';
|
||||
*/
|
||||
@customElement('wa-button-group')
|
||||
export default class WaButtonGroup extends WebAwesomeElement {
|
||||
static css = [variantStyles, styles];
|
||||
static css = [styles];
|
||||
|
||||
@query('slot') defaultSlot: HTMLSlotElement;
|
||||
|
||||
@@ -35,9 +34,6 @@ export default class WaButtonGroup extends WebAwesomeElement {
|
||||
/** The button group's orientation. */
|
||||
@property({ reflect: true }) orientation: 'horizontal' | 'vertical' = 'horizontal';
|
||||
|
||||
/** 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';
|
||||
|
||||
updated(changedProperties: PropertyValues<this>) {
|
||||
super.updated(changedProperties);
|
||||
|
||||
|
||||
@@ -77,9 +77,7 @@
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
display: block;
|
||||
border-block-end-style: inherit;
|
||||
border-block-end-color: var(--wa-color-surface-border);
|
||||
border-block-end-width: var(--wa-panel-border-width);
|
||||
@@ -92,15 +90,20 @@
|
||||
}
|
||||
|
||||
.footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
display: block;
|
||||
border-block-start-style: inherit;
|
||||
border-block-start-color: var(--wa-color-surface-border);
|
||||
border-block-start-width: var(--wa-panel-border-width);
|
||||
padding: var(--spacing);
|
||||
}
|
||||
|
||||
/* Push slots to sides when the action slots renders */
|
||||
.has-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
:host(:not([with-header])) .header,
|
||||
:host(:not([with-footer])) .footer,
|
||||
:host(:not([with-media])) .media {
|
||||
@@ -115,7 +118,12 @@
|
||||
border-start-start-radius: var(--inner-border-radius);
|
||||
border-end-start-radius: var(--inner-border-radius);
|
||||
border-start-end-radius: 0;
|
||||
object-fit: cover;
|
||||
|
||||
&::slotted(*) {
|
||||
block-size: 100%;
|
||||
inline-size: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -69,15 +69,25 @@ export default class WaCard extends WebAwesomeElement {
|
||||
// Vertical Orientation
|
||||
return html`
|
||||
<slot name="media" part="media" class="media"></slot>
|
||||
<header part="header" class="header">
|
||||
<slot name="header"></slot>
|
||||
<slot name="header-actions"></slot>
|
||||
</header>
|
||||
|
||||
${this.hasSlotController.test('header-actions')
|
||||
? html` <header part="header" class="header has-actions">
|
||||
<slot name="header"></slot>
|
||||
<slot name="header-actions"></slot>
|
||||
</header>`
|
||||
: html` <header part="header" class="header">
|
||||
<slot name="header"></slot>
|
||||
</header>`}
|
||||
|
||||
<slot part="body" class="body"></slot>
|
||||
<footer part="footer" class="footer">
|
||||
<slot name="footer"></slot>
|
||||
<slot name="footer-actions"></slot>
|
||||
</footer>
|
||||
${this.hasSlotController.test('footer-actions')
|
||||
? html` <footer part="footer" class="footer has-actions">
|
||||
<slot name="footer"></slot>
|
||||
<slot name="footer-actions"></slot>
|
||||
</footer>`
|
||||
: html` <footer part="footer" class="footer">
|
||||
<slot name="footer"></slot>
|
||||
</footer>`}
|
||||
`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import { requestInclude } from './request.js';
|
||||
* @since 2.0
|
||||
*
|
||||
* @event wa-load - Emitted when the included file is loaded.
|
||||
* @event {{ status: number }} wa-error - Emitted when the included file fails to load due to an error.
|
||||
* @event {{ status: number }} wa-include-error - Emitted when the included file fails to load due to an error.
|
||||
*/
|
||||
@customElement('wa-include')
|
||||
export default class WaInclude extends WebAwesomeElement {
|
||||
|
||||
@@ -174,7 +174,7 @@
|
||||
}
|
||||
|
||||
:host([appearance='button']:state(checked):focus-visible) {
|
||||
outline: var(--wa-focus-ring-style) var(--wa-focus-ring-width) var(--wa-color-brand-border-loud);
|
||||
outline: var(--wa-focus-ring);
|
||||
outline-offset: var(--wa-focus-ring-offset);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ export type { WaExpandEvent } from './expand.js';
|
||||
export type { WaFinishEvent } from './finish.js';
|
||||
export type { WaHideEvent } from './hide.js';
|
||||
export type { WaHoverEvent } from './hover.js';
|
||||
export type { WaIncludeErrorEvent } from './include-error.js';
|
||||
export type { WaIntersectEvent } from './intersect.js';
|
||||
export type { WaInvalidEvent } from './invalid.js';
|
||||
export type { WaLazyChangeEvent } from './lazy-change.js';
|
||||
|
||||
@@ -84,8 +84,8 @@ export class DraggableElement {
|
||||
}
|
||||
|
||||
private handleDragStart = (event: PointerEvent | TouchEvent) => {
|
||||
const clientX = supportsTouch && 'touches' in event ? event.touches[0].clientX : (event as PointerEvent).clientX;
|
||||
const clientY = supportsTouch && 'touches' in event ? event.touches[0].clientY : (event as PointerEvent).clientY;
|
||||
const clientX = 'touches' in event ? event.touches[0].clientX : (event as PointerEvent).clientX;
|
||||
const clientY = 'touches' in event ? event.touches[0].clientY : (event as PointerEvent).clientY;
|
||||
|
||||
if (
|
||||
this.isDragging ||
|
||||
@@ -105,8 +105,8 @@ export class DraggableElement {
|
||||
};
|
||||
|
||||
private handleDragStop = (event: PointerEvent | TouchEvent) => {
|
||||
const clientX = supportsTouch && 'touches' in event ? event.touches[0].clientX : (event as PointerEvent).clientX;
|
||||
const clientY = supportsTouch && 'touches' in event ? event.touches[0].clientY : (event as PointerEvent).clientY;
|
||||
const clientX = 'touches' in event ? event.touches[0].clientX : (event as PointerEvent).clientX;
|
||||
const clientY = 'touches' in event ? event.touches[0].clientY : (event as PointerEvent).clientY;
|
||||
|
||||
this.isDragging = false;
|
||||
document.removeEventListener('pointerup', this.handleDragStop);
|
||||
@@ -117,8 +117,8 @@ export class DraggableElement {
|
||||
};
|
||||
|
||||
private handleDragMove = (event: PointerEvent | TouchEvent) => {
|
||||
const clientX = supportsTouch && 'touches' in event ? event.touches[0].clientX : (event as PointerEvent).clientX;
|
||||
const clientY = supportsTouch && 'touches' in event ? event.touches[0].clientY : (event as PointerEvent).clientY;
|
||||
const clientX = 'touches' in event ? event.touches[0].clientX : (event as PointerEvent).clientX;
|
||||
const clientY = 'touches' in event ? event.touches[0].clientY : (event as PointerEvent).clientY;
|
||||
|
||||
// Prevent text selection while dragging
|
||||
window.getSelection()?.removeAllRanges();
|
||||
|
||||
Reference in New Issue
Block a user