diff --git a/packages/webawesome/docs/_includes/base.njk b/packages/webawesome/docs/_includes/base.njk index 92c788150..01998a3bc 100644 --- a/packages/webawesome/docs/_includes/base.njk +++ b/packages/webawesome/docs/_includes/base.njk @@ -1,5 +1,5 @@ - +
{% include 'head.njk' %} diff --git a/packages/webawesome/docs/_layouts/blank.njk b/packages/webawesome/docs/_layouts/blank.njk index 92431ff44..426960cc2 100644 --- a/packages/webawesome/docs/_layouts/blank.njk +++ b/packages/webawesome/docs/_layouts/blank.njk @@ -1,5 +1,5 @@ - + {% include 'head.njk' %} {% block head %}{% endblock %} diff --git a/packages/webawesome/docs/_layouts/component.njk b/packages/webawesome/docs/_layouts/component.njk index 038afecc6..89b42436c 100644 --- a/packages/webawesome/docs/_layouts/component.njk +++ b/packages/webawesome/docs/_layouts/component.njk @@ -261,7 +261,7 @@ {# Importing #}- The autoloader is the recommended way to import components. If you prefer to do it manually, use one of the following code snippets. + Autoloading components via projects is the recommended way to import components. If you prefer to do it manually, use one of the following code snippets.
@@ -273,10 +273,8 @@- To manually import this component from the CDN, use the following code. + Let your project code do the work! Sign up for free to use a project with your very own CDN — it's the fastest and easiest way to use Web Awesome.
- -import '{% cdnUrl componentPath %}';
diff --git a/packages/webawesome/docs/assets/scripts/code-examples.js b/packages/webawesome/docs/assets/scripts/code-examples.js index 04f21dc85..93c653021 100644 --- a/packages/webawesome/docs/assets/scripts/code-examples.js +++ b/packages/webawesome/docs/assets/scripts/code-examples.js @@ -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 = - `\n` + - `\n\n` + + `\n` + + `\n\n` + `${code.textContent}`; const css = 'html > body {\n padding: 2rem !important;\n}'; const js = ''; diff --git a/packages/webawesome/docs/assets/scripts/search.js b/packages/webawesome/docs/assets/scripts/search.js index a461d0f99..77969844b 100644 --- a/packages/webawesome/docs/assets/scripts/search.js +++ b/packages/webawesome/docs/assets/scripts/search.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); diff --git a/packages/webawesome/docs/docs/color-palettes.njk b/packages/webawesome/docs/docs/color-palettes.njk index 840ce738a..0525f8380 100644 --- a/packages/webawesome/docs/docs/color-palettes.njk +++ b/packages/webawesome/docs/docs/color-palettes.njk @@ -66,14 +66,50 @@ layout: page
- To import this palette, set <html class="wa-palette-{{ palette.name | lower }}"> and import the following stylesheet:
-
<link rel="stylesheet" href="{% cdnUrl %}styles/color/palettes/{{ palette.filename }}" />
-
+ In your project's
+ In your project's
Save your palette and watch it come to life anywhere you're using your project.
++ To use this theme, import the theme's stylesheet: +
+import '@awesome.me/webawesome/dist/styles/themes/{{ palette.filename }}';
+
+ Then apply the following class to the <html> element:
+
<html class="wa-palette-{{ palette.name | lower }}">
+ + To use this theme, import the theme's stylesheet: +
+<link rel="stylesheet" href="/dist/styles/themes/{{ palette.filename }}" />
+
+ Then apply the following class to the <html> element:
+
<html class="wa-palette-{{ palette.name | lower }}">
+
+ To use a pre-built theme {%- if currentUser.hasPro -%} or build your own{%- endif -%},
+ {%- if not session.isLoggedIn -%}
+ sign up or log in to create a project.
+ {%- else -%}
+ head over to your teams and open up the project you'd like to use.
+ {%- endif -%}
+ In your project's
<head> of each page on your site.` is replaced with any language code shown above.
```js
-import '{% cdnUrl "translations/.js" %}';
+import '/dist/translations/.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/.js" %}');
+import('/translations/.js');
```
### Translation Resolution
diff --git a/packages/webawesome/docs/docs/themes.njk b/packages/webawesome/docs/docs/themes.njk
index 54f012862..289e2104c 100644
--- a/packages/webawesome/docs/docs/themes.njk
+++ b/packages/webawesome/docs/docs/themes.njk
@@ -86,16 +86,50 @@ to create a project with any one of these themes.
Using This Theme
+
{% for theme in themer.themes %}
-
-
- To import this theme, apply the following classes to the <html> element and import the theme's stylesheet.
-
-<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 }}" />
-
+
+
+ Projects
+ npm
+ Self-Hosted
+
+
+ For Pro Projects:
+
+ In your project's Settings, Edit Your Theme to open the Theme Builder. Select {{ theme.filename | stripExtension | capitalize }} as your Starting Theme.
+
+ For Free Projects:
+
+ In your project's Settings, set your Theme to {{ theme.filename | stripExtension | capitalize }} and your Color Palette to {{ theme.palette.filename | stripExtension | capitalize }}.
+
+ Save your theme and watch it come to life anywhere you're using your project.
+
+
+
+
+ To use this theme, import the theme's stylesheet:
+
+ import '@awesome.me/webawesome/dist/styles/themes/{{ theme.filename }}';
+
+ Then apply the following classes to the <html> element:
+
+ <html class="wa-theme-{{ theme.filename | stripExtension }} wa-palette-{{ theme.palette.filename | stripExtension }} wa-brand-{{ theme.colorBrand.color}}">
+
+
+
+
+ To use this theme, import the theme's stylesheet:
+
+ <link rel="stylesheet" href="/dist/styles/themes/{{ theme.filename }}" />
+
+ Then apply the following classes to the <html> element:
+
+ <html class="wa-theme-{{ theme.filename | stripExtension }} wa-palette-{{ theme.palette.filename | stripExtension }} wa-brand-{{ theme.colorBrand.color}}">
+
+
+
{% endfor %}
diff --git a/packages/webawesome/docs/docs/usage.md b/packages/webawesome/docs/docs/usage.md
index b21fcc455..5091881a7 100644
--- a/packages/webawesome/docs/docs/usage.md
+++ b/packages/webawesome/docs/docs/usage.md
@@ -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
{
diff --git a/packages/webawesome/docs/docs/utilities/index.njk b/packages/webawesome/docs/docs/utilities/index.njk
index 0ff7e2ee2..abbc7aa26 100644
--- a/packages/webawesome/docs/docs/utilities/index.njk
+++ b/packages/webawesome/docs/docs/utilities/index.njk
@@ -52,13 +52,13 @@ layout: docs
To use all Web Awesome page styles (including [native styles](/docs/utilities/native/)), include the following stylesheet in your project:
```html
-
+
```
Or, to _only_ include utilities:
```html
-
+
```
{% endmarkdown %}
diff --git a/packages/webawesome/docs/docs/utilities/native.md b/packages/webawesome/docs/docs/utilities/native.md
index 00d825c44..4f80edcac 100644
--- a/packages/webawesome/docs/docs/utilities/native.md
+++ b/packages/webawesome/docs/docs/utilities/native.md
@@ -12,14 +12,14 @@ Native styles use design tokens to spruce up native HTML elements so that they m
To use all Web Awesome styles (including [utilities](/docs/utilities/)), include the following stylesheet in your project:
```html
-
+
```
Or, if you only want styles for native elements, include the default theme and native styles individually:
```html
-
-
+
+
```
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 +30,18 @@ Native styles set default space between many block-level HTML elements using the
```html {.example}
Curabitur odio ligula
-Fusce mollis quam lorem, et gravida arcu laoreet ut. Pellentesque et malesuada mi. Morbi faucibus nisl nec nulla porta, ac scelerisque elit finibus.
-The Road goes ever on and on
-Out from the door where it began.
-Donec varius, ipsum sit amet lobortis tristique, quam arcu pellentesque turpis, non porta lacus arcu non arcu. Morbi luctus at nisl sit amet faucibus.
+
+ Fusce mollis quam lorem, et gravida arcu laoreet ut. Pellentesque et malesuada mi. Morbi faucibus nisl nec nulla
+ porta, ac scelerisque elit finibus.
+
+
+ The Road goes ever on and on
+ Out from the door where it began.
+
+
+ Donec varius, ipsum sit amet lobortis tristique, quam arcu pellentesque turpis, non porta lacus arcu non arcu. Morbi
+ luctus at nisl sit amet faucibus.
+
- Aenean imperdiet
@@ -191,8 +199,8 @@ Use any inline text element like ``, ``, ``, ``, and others
Add responsive media with `
`, `