Compare commits
5 Commits
data-actio
...
components
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d85842c766 | ||
|
|
8e3a525b4e | ||
|
|
068f9314e6 | ||
|
|
c6a9405c19 | ||
|
|
4ae21c9537 |
10
.eslintignore
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
.cache
|
||||||
|
docs/dist
|
||||||
|
docs/search.json
|
||||||
|
docs/**/*.min.js
|
||||||
|
dist
|
||||||
|
examples
|
||||||
|
node_modules
|
||||||
|
src/react
|
||||||
|
scripts
|
||||||
|
|
||||||
213
.eslintrc.cjs
Normal file
@@ -0,0 +1,213 @@
|
|||||||
|
/* eslint-env node */
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
plugins: [
|
||||||
|
'@typescript-eslint',
|
||||||
|
'wc',
|
||||||
|
'lit',
|
||||||
|
'lit-a11y',
|
||||||
|
'chai-expect',
|
||||||
|
'chai-friendly',
|
||||||
|
'import',
|
||||||
|
'sort-imports-es6-autofix'
|
||||||
|
],
|
||||||
|
extends: [
|
||||||
|
'eslint:recommended',
|
||||||
|
'plugin:wc/recommended',
|
||||||
|
'plugin:wc/best-practice',
|
||||||
|
'plugin:lit/recommended',
|
||||||
|
'plugin:lit-a11y/recommended'
|
||||||
|
],
|
||||||
|
env: {
|
||||||
|
es2021: true,
|
||||||
|
browser: true
|
||||||
|
},
|
||||||
|
parserOptions: {
|
||||||
|
sourceType: 'module'
|
||||||
|
},
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
extends: [
|
||||||
|
'plugin:@typescript-eslint/eslint-recommended',
|
||||||
|
'plugin:@typescript-eslint/recommended',
|
||||||
|
'plugin:@typescript-eslint/recommended-requiring-type-checking'
|
||||||
|
],
|
||||||
|
parser: '@typescript-eslint/parser',
|
||||||
|
parserOptions: {
|
||||||
|
sourceType: 'module',
|
||||||
|
project: './tsconfig.json',
|
||||||
|
tsconfigRootDir: __dirname
|
||||||
|
},
|
||||||
|
files: ['*.ts'],
|
||||||
|
rules: {
|
||||||
|
'default-param-last': 'off',
|
||||||
|
'@typescript-eslint/default-param-last': 'error',
|
||||||
|
'no-console': 'warn',
|
||||||
|
'no-empty-function': 'off',
|
||||||
|
'@typescript-eslint/no-empty-function': 'warn',
|
||||||
|
'no-implied-eval': 'off',
|
||||||
|
'no-invalid-this': 'off',
|
||||||
|
'no-shadow': 'off',
|
||||||
|
'no-throw-literal': 'off',
|
||||||
|
'no-unused-expressions': 'off',
|
||||||
|
'lit-a11y/no-autofocus': 'off',
|
||||||
|
'@typescript-eslint/no-implied-eval': 'error',
|
||||||
|
'@typescript-eslint/no-invalid-this': 'error',
|
||||||
|
'@typescript-eslint/no-throw-literal': 'error',
|
||||||
|
'@typescript-eslint/no-shadow': 'error',
|
||||||
|
'@typescript-eslint/prefer-regexp-exec': 'off',
|
||||||
|
'@typescript-eslint/no-unused-expressions': 'error',
|
||||||
|
'@typescript-eslint/unbound-method': 'off',
|
||||||
|
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||||
|
'@typescript-eslint/no-floating-promises': 'off',
|
||||||
|
'@typescript-eslint/no-misused-promises': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
checksVoidReturn: false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@typescript-eslint/consistent-type-assertions': [
|
||||||
|
'warn',
|
||||||
|
{
|
||||||
|
assertionStyle: 'as',
|
||||||
|
objectLiteralTypeAssertions: 'never'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@typescript-eslint/consistent-type-imports': 'warn',
|
||||||
|
'@typescript-eslint/no-base-to-string': 'error',
|
||||||
|
'@typescript-eslint/no-confusing-non-null-assertion': 'error',
|
||||||
|
'@typescript-eslint/no-invalid-void-type': 'error',
|
||||||
|
'@typescript-eslint/no-require-imports': 'error',
|
||||||
|
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'warn',
|
||||||
|
'@typescript-eslint/no-unnecessary-condition': 'off',
|
||||||
|
'@typescript-eslint/no-unnecessary-qualifier': 'warn',
|
||||||
|
'@typescript-eslint/non-nullable-type-assertion-style': 'warn',
|
||||||
|
'@typescript-eslint/prefer-for-of': 'warn',
|
||||||
|
'@typescript-eslint/prefer-optional-chain': 'warn',
|
||||||
|
'@typescript-eslint/prefer-ts-expect-error': 'warn',
|
||||||
|
'@typescript-eslint/prefer-return-this-type': 'error',
|
||||||
|
'@typescript-eslint/prefer-string-starts-ends-with': 'warn',
|
||||||
|
'@typescript-eslint/require-array-sort-compare': 'error',
|
||||||
|
'@typescript-eslint/unified-signatures': 'warn',
|
||||||
|
'@typescript-eslint/array-type': 'warn',
|
||||||
|
'@typescript-eslint/consistent-type-definitions': ['warn', 'interface'],
|
||||||
|
'@typescript-eslint/member-delimiter-style': 'warn',
|
||||||
|
'@typescript-eslint/method-signature-style': 'warn',
|
||||||
|
'@typescript-eslint/no-extraneous-class': 'error',
|
||||||
|
'@typescript-eslint/no-redundant-type-constituents': 'off',
|
||||||
|
'@typescript-eslint/parameter-properties': 'error',
|
||||||
|
'@typescript-eslint/strict-boolean-expressions': 'off'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ['**/*.cjs'],
|
||||||
|
env: {
|
||||||
|
node: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
extends: ['plugin:chai-expect/recommended', 'plugin:chai-friendly/recommended'],
|
||||||
|
files: ['*.test.ts'],
|
||||||
|
rules: {
|
||||||
|
'@typescript-eslint/no-unsafe-call': 'off',
|
||||||
|
'@typescript-eslint/no-unused-expressions': 'off'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
rules: {
|
||||||
|
'no-template-curly-in-string': 'error',
|
||||||
|
'array-callback-return': 'error',
|
||||||
|
'comma-dangle': 'off',
|
||||||
|
'consistent-return': 'error',
|
||||||
|
curly: 'off',
|
||||||
|
'default-param-last': 'error',
|
||||||
|
eqeqeq: 'error',
|
||||||
|
'lit-a11y/click-events-have-key-events': 'off',
|
||||||
|
'no-constructor-return': 'error',
|
||||||
|
'no-empty-function': 'warn',
|
||||||
|
'no-eval': 'error',
|
||||||
|
'no-extend-native': 'error',
|
||||||
|
'no-extra-bind': 'error',
|
||||||
|
'no-floating-decimal': 'error',
|
||||||
|
'no-implicit-coercion': 'off',
|
||||||
|
'no-implicit-globals': 'error',
|
||||||
|
'no-implied-eval': 'error',
|
||||||
|
'no-invalid-this': 'error',
|
||||||
|
'no-labels': 'error',
|
||||||
|
'no-lone-blocks': 'error',
|
||||||
|
'no-new': 'error',
|
||||||
|
'no-new-func': 'error',
|
||||||
|
'no-new-wrappers': 'error',
|
||||||
|
'no-octal-escape': 'error',
|
||||||
|
'no-proto': 'error',
|
||||||
|
'no-return-assign': 'warn',
|
||||||
|
'no-script-url': 'error',
|
||||||
|
'no-self-compare': 'warn',
|
||||||
|
'no-sequences': 'warn',
|
||||||
|
'no-throw-literal': 'error',
|
||||||
|
'no-unmodified-loop-condition': 'error',
|
||||||
|
'no-unused-expressions': 'warn',
|
||||||
|
'no-useless-call': 'error',
|
||||||
|
'no-useless-concat': 'error',
|
||||||
|
'no-useless-return': 'warn',
|
||||||
|
'prefer-promise-reject-errors': 'error',
|
||||||
|
radix: 'off',
|
||||||
|
'require-await': 'error',
|
||||||
|
'wrap-iife': ['warn', 'inside'],
|
||||||
|
'no-shadow': 'error',
|
||||||
|
'no-array-constructor': 'error',
|
||||||
|
'no-bitwise': 'error',
|
||||||
|
'no-multi-assign': 'warn',
|
||||||
|
'no-new-object': 'error',
|
||||||
|
'no-useless-computed-key': 'warn',
|
||||||
|
'no-useless-rename': 'warn',
|
||||||
|
'no-var': 'error',
|
||||||
|
'prefer-const': 'warn',
|
||||||
|
'prefer-numeric-literals': 'warn',
|
||||||
|
'prefer-object-spread': 'warn',
|
||||||
|
'prefer-rest-params': 'warn',
|
||||||
|
'prefer-spread': 'warn',
|
||||||
|
'prefer-template': 'off',
|
||||||
|
'no-else-return': 'off',
|
||||||
|
'func-names': ['warn', 'never'],
|
||||||
|
'one-var': ['warn', 'never'],
|
||||||
|
'operator-assignment': 'warn',
|
||||||
|
'prefer-arrow-callback': 'warn',
|
||||||
|
'no-restricted-imports': [
|
||||||
|
'warn',
|
||||||
|
{
|
||||||
|
paths: [
|
||||||
|
{
|
||||||
|
name: '.',
|
||||||
|
message: 'Usage of local index imports is not allowed.'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: './index',
|
||||||
|
message: 'Import from the source file instead.'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'import/extensions': [
|
||||||
|
'error',
|
||||||
|
'always',
|
||||||
|
{
|
||||||
|
ignorePackages: true,
|
||||||
|
pattern: {
|
||||||
|
js: 'always',
|
||||||
|
ts: 'never'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'import/no-duplicates': 'warn',
|
||||||
|
'sort-imports-es6-autofix/sort-imports-es6': [
|
||||||
|
2,
|
||||||
|
{
|
||||||
|
ignoreCase: true,
|
||||||
|
ignoreMemberSort: false,
|
||||||
|
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single']
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'wc/guard-super-call': 'off'
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -1,16 +1,14 @@
|
|||||||
# # This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
# # This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
||||||
# # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
# # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
||||||
|
|
||||||
name: Client Tests
|
name: Node.js CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
|
||||||
push:
|
push:
|
||||||
branches: [next]
|
branches: [next]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [next]
|
branches: [next]
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
client_test:
|
client_test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -31,18 +29,42 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
- name: Lint
|
- name: Lint
|
||||||
run: npm run prettier
|
run: npm run prettier && npm run lint
|
||||||
working-directory: ./packages/webawesome
|
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: npm run build
|
run: npm run build
|
||||||
working-directory: ./packages/webawesome
|
|
||||||
|
|
||||||
- name: Install Playwright
|
- name: Install Playwright
|
||||||
run: npx playwright install --with-deps
|
run: npx playwright install --with-deps
|
||||||
working-directory: ./packages/webawesome
|
|
||||||
|
|
||||||
- name: Run CSR tests
|
- name: Run CSR tests
|
||||||
# FAIL_FAST to fail on first failing test.
|
# FAIL_FAST to fail on first failing test.
|
||||||
run: FAIL_FAST="true" CSR_ONLY="true" npm run test
|
run: FAIL_FAST="true" CSR_ONLY="true" npm run test
|
||||||
working-directory: ./packages/webawesome
|
ssr_test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node-version: [20.x]
|
||||||
|
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node-version }}
|
||||||
|
cache: 'npm'
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
|
# Just lint here too. Save some GH Action minutes and not need to use "depends_on" or anything.
|
||||||
|
- name: Lint
|
||||||
|
run: npm run prettier && npm run lint
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
|
- name: Install Playwright
|
||||||
|
run: npx playwright install --with-deps
|
||||||
|
|
||||||
|
- name: Run SSR tests
|
||||||
|
# FAIL_FAST to fail on first failing test.
|
||||||
|
run: FAIL_FAST="true" SSR_ONLY="true" npm run test
|
||||||
|
|
||||||
42
.github/workflows/ssr_tests.yml
vendored
@@ -1,42 +0,0 @@
|
|||||||
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
|
||||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
|
||||||
|
|
||||||
name: SSR Tests
|
|
||||||
|
|
||||||
on:
|
|
||||||
# push:
|
|
||||||
# branches: [next]
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
ssr_test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
node-version: [20.x]
|
|
||||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: ${{ matrix.node-version }}
|
|
||||||
cache: 'npm'
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: npm run build
|
|
||||||
working-directory: ./packages/webawesome
|
|
||||||
|
|
||||||
- name: Install Playwright
|
|
||||||
run: npx playwright install --with-deps
|
|
||||||
working-directory: ./packages/webawesome
|
|
||||||
|
|
||||||
- name: Run SSR tests
|
|
||||||
# FAIL_FAST to fail on first failing test.
|
|
||||||
run: FAIL_FAST="true" SSR_ONLY="true" npm run test
|
|
||||||
working-directory: ./packages/webawesome
|
|
||||||
|
|
||||||
10
.gitignore
vendored
@@ -1,12 +1,12 @@
|
|||||||
_site
|
_site
|
||||||
.cache
|
.cache
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
package.json
|
||||||
|
package-lock.json
|
||||||
dist/
|
dist/
|
||||||
dist-cdn/
|
dist-cdn/
|
||||||
|
docs/public/pagefind
|
||||||
node_modules
|
node_modules
|
||||||
packages/**/*/src/react
|
src/react
|
||||||
|
.astro
|
||||||
cdn/
|
cdn/
|
||||||
yarn.lock
|
|
||||||
_bundle_
|
|
||||||
/packages/webawesome-pro
|
|
||||||
/packages/webawesome-app
|
|
||||||
|
|||||||
@@ -1,23 +1,15 @@
|
|||||||
# Files are relative to .prettierignore at the root of this monorepo.
|
|
||||||
# <https://github.com/prettier/prettier-vscode/issues/1252>
|
|
||||||
|
|
||||||
*.hbs
|
*.hbs
|
||||||
*.md
|
*.md
|
||||||
!packages/webawesome/docs/docs/patterns/**/*.md
|
.cache
|
||||||
docs/docs/patterns/blog-news/post-list.md
|
|
||||||
**/*/.cache
|
|
||||||
.github
|
.github
|
||||||
cspell.json
|
cspell.json
|
||||||
packages/**/*/dist
|
dist
|
||||||
packages/**/*/dist-cdn
|
docs/search.json
|
||||||
packages/**/*/docs/search.json
|
src/components/icon/icons
|
||||||
packages/**/*/src/components/icon/icons
|
src/react/index.ts
|
||||||
packages/**/*/src/react/index.ts
|
|
||||||
**/*/package.json
|
|
||||||
**/*/package-lock.json
|
|
||||||
**/*/tsconfig.json
|
|
||||||
**/*/tsconfig.prod.json
|
|
||||||
node_modules
|
node_modules
|
||||||
|
package.json
|
||||||
packages/**/*/_site
|
package-lock.json
|
||||||
packages/webawesome/docs/assets/scripts/prism-downloaded.js
|
tsconfig.json
|
||||||
|
cdn
|
||||||
|
_site
|
||||||
|
|||||||
1
.vscode/extensions.json
vendored
@@ -3,6 +3,7 @@
|
|||||||
"dbaeumer.vscode-eslint",
|
"dbaeumer.vscode-eslint",
|
||||||
"esbenp.prettier-vscode",
|
"esbenp.prettier-vscode",
|
||||||
"bierner.lit-html",
|
"bierner.lit-html",
|
||||||
|
"bashmish.es6-string-css",
|
||||||
"streetsidesoftware.code-spell-checker"
|
"streetsidesoftware.code-spell-checker"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
1
.vscode/settings.json
vendored
@@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
"editor.formatOnSave": true,
|
"editor.formatOnSave": true,
|
||||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||||
"prettier.enable": true,
|
|
||||||
"editor.codeActionsOnSave": {
|
"editor.codeActionsOnSave": {
|
||||||
"source.fixAll.eslint": "explicit"
|
"source.fixAll.eslint": "explicit"
|
||||||
},
|
},
|
||||||
|
|||||||
41
README.md
@@ -31,30 +31,6 @@ If that's not what you're trying to do, the [documentation website](https://weba
|
|||||||
|
|
||||||
Components are built with [LitElement](https://lit-element.polymer-project.org/), a custom elements base class that provides an intuitive API and reactive data binding. The build is a custom script with bundling powered by [esbuild](https://esbuild.github.io/).
|
Components are built with [LitElement](https://lit-element.polymer-project.org/), a custom elements base class that provides an intuitive API and reactive data binding. The build is a custom script with bundling powered by [esbuild](https://esbuild.github.io/).
|
||||||
|
|
||||||
### Understanding the Web Awesome monorepo
|
|
||||||
|
|
||||||
Web Awesome uses [NPM workspaces](https://docs.npmjs.com/cli/v11/using-npm/workspaces) for its monorepo structure and is fairly minimal in what it provides.
|
|
||||||
|
|
||||||
By using a NPM workspaces and a monorepo structure, we can get consistent builds, shared configurations, and reduced duplication across repositories which reduces regressions and forces consistency across `webawesome`, `webawesome-pro`, and `webawesome-app`.
|
|
||||||
|
|
||||||
Generally, if you plan to only work with the free version of `webawesome` it is easiest to go to `packages/webawesome` and run all commands from there.
|
|
||||||
|
|
||||||
### Where do NPM dependencies go?
|
|
||||||
|
|
||||||
Any dependencies intended to be used across all packages (IE: `prettier`, `eslint`) that are _NOT_ used at runtime should be in the root `devDependencies` of `package.json`.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm install -D -w prettier
|
|
||||||
```
|
|
||||||
|
|
||||||
Any dependencies that will be used at runtime by a package should be part of the specific package's `"dependencies"` such as `lit`. This is required because if that dependency is not in the `packages/*/package.json`, it will not be installed when used via NPM.
|
|
||||||
|
|
||||||
Individual packages are also free to install devDependencies as needed as long as they are specific to that package only.
|
|
||||||
|
|
||||||
To do install a package specific to a package, change your working directory to that package's root
|
|
||||||
|
|
||||||
IE: `cd packages/webawesome && npm install <package-name>`
|
|
||||||
|
|
||||||
### Forking the Repo
|
### Forking the Repo
|
||||||
|
|
||||||
Start by [forking the repo](https://github.com/shoelace-style/webawesome/fork) on GitHub, then clone it locally and install dependencies.
|
Start by [forking the repo](https://github.com/shoelace-style/webawesome/fork) on GitHub, then clone it locally and install dependencies.
|
||||||
@@ -67,10 +43,9 @@ npm install
|
|||||||
|
|
||||||
### Developing
|
### Developing
|
||||||
|
|
||||||
Once you've cloned the repo, run the following command from the respective directory within `packages/*`
|
Once you've cloned the repo, run the following command.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd packages/webawesome
|
|
||||||
npm start
|
npm start
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -81,35 +56,23 @@ This will spin up the dev server. After the initial build, a browser will open a
|
|||||||
To generate a production build, run the following command.
|
To generate a production build, run the following command.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd packages/webawesome
|
|
||||||
npm run build
|
npm run build
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also run `npm run build:serve` to start an [`http-server`](https://www.npmjs.com/package/http-server) instance on `http://localhost:4000` after the build completes, so you can preview the production build.
|
|
||||||
|
|
||||||
### Creating New Components
|
### Creating New Components
|
||||||
|
|
||||||
To scaffold a new component, run the following command, replacing `wa-tag-name` with the desired tag name.
|
To scaffold a new component, run the following command, replacing `wa-tag-name` with the desired tag name.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd packages/webawesome
|
|
||||||
npm run create wa-tag-name
|
npm run create wa-tag-name
|
||||||
```
|
```
|
||||||
|
|
||||||
This will generate a source file, a stylesheet, and a docs page for you. When you start the dev server, you'll find the new component in the "Components" section of the sidebar.
|
This will generate a source file, a stylesheet, and a docs page for you. When you start the dev server, you'll find the new component in the "Components" section of the sidebar.
|
||||||
|
|
||||||
### Adding additional packages
|
|
||||||
|
|
||||||
Right now the only additional packages are in private repositories.
|
|
||||||
|
|
||||||
To add additional packages from other repositories, run: `git clone <url> packages/<package-name>` to clone your repo into `packages/`.
|
|
||||||
|
|
||||||
Make sure to run `npm install` at the root of the monorepo after adding your package!
|
|
||||||
|
|
||||||
### Contributing
|
### Contributing
|
||||||
|
|
||||||
Web Awesome is an open source project and contributions are encouraged! If you're interesting in contributing, please review the [contribution guidelines](CONTRIBUTING.md) first.
|
Web Awesome is an open source project and contributions are encouraged! If you're interesting in contributing, please review the [contribution guidelines](CONTRIBUTING.md) first.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Web Awesome is available under the terms of the MIT license.
|
Web Awesome is available under the terms of the MIT license.
|
||||||
|
|||||||
22
cspell.json
@@ -15,19 +15,16 @@
|
|||||||
"autoloading",
|
"autoloading",
|
||||||
"autoplay",
|
"autoplay",
|
||||||
"bezier",
|
"bezier",
|
||||||
"Blockquotes",
|
|
||||||
"boxicons",
|
"boxicons",
|
||||||
"CACHEABLE",
|
"CACHEABLE",
|
||||||
"callout",
|
"callout",
|
||||||
"callouts",
|
"callouts",
|
||||||
"canvastext",
|
|
||||||
"chatbubble",
|
"chatbubble",
|
||||||
"checkmark",
|
"checkmark",
|
||||||
"Clippy",
|
"Clippy",
|
||||||
"codebases",
|
"codebases",
|
||||||
"codepen",
|
"codepen",
|
||||||
"colocated",
|
"colocated",
|
||||||
"colorjs",
|
|
||||||
"colour",
|
"colour",
|
||||||
"combobox",
|
"combobox",
|
||||||
"Commonmark",
|
"Commonmark",
|
||||||
@@ -42,15 +39,12 @@
|
|||||||
"crutchcorn",
|
"crutchcorn",
|
||||||
"csspart",
|
"csspart",
|
||||||
"cssproperty",
|
"cssproperty",
|
||||||
"cssstate",
|
|
||||||
"datetime",
|
"datetime",
|
||||||
"describedby",
|
"describedby",
|
||||||
"Docsify",
|
"Docsify",
|
||||||
"dogfood",
|
"dogfood",
|
||||||
"dropdowns",
|
"dropdowns",
|
||||||
"easings",
|
"easings",
|
||||||
"ecommerce",
|
|
||||||
"endfor",
|
|
||||||
"endraw",
|
"endraw",
|
||||||
"endregion",
|
"endregion",
|
||||||
"enterkeyhint",
|
"enterkeyhint",
|
||||||
@@ -61,8 +55,6 @@
|
|||||||
"exportmaps",
|
"exportmaps",
|
||||||
"exportparts",
|
"exportparts",
|
||||||
"fieldsets",
|
"fieldsets",
|
||||||
"focusin",
|
|
||||||
"focusout",
|
|
||||||
"fontawesome",
|
"fontawesome",
|
||||||
"formaction",
|
"formaction",
|
||||||
"formdata",
|
"formdata",
|
||||||
@@ -72,7 +64,6 @@
|
|||||||
"formtarget",
|
"formtarget",
|
||||||
"FOUC",
|
"FOUC",
|
||||||
"FOUCE",
|
"FOUCE",
|
||||||
"Frontmatter",
|
|
||||||
"fullscreen",
|
"fullscreen",
|
||||||
"gestern",
|
"gestern",
|
||||||
"giga",
|
"giga",
|
||||||
@@ -92,8 +83,6 @@
|
|||||||
"jsfiddle",
|
"jsfiddle",
|
||||||
"keydown",
|
"keydown",
|
||||||
"keyframes",
|
"keyframes",
|
||||||
"keymaker",
|
|
||||||
"Konnor",
|
|
||||||
"Kool",
|
"Kool",
|
||||||
"labelledby",
|
"labelledby",
|
||||||
"Laravel",
|
"Laravel",
|
||||||
@@ -111,7 +100,6 @@
|
|||||||
"metaframeworks",
|
"metaframeworks",
|
||||||
"middlewares",
|
"middlewares",
|
||||||
"minlength",
|
"minlength",
|
||||||
"minmax",
|
|
||||||
"monospace",
|
"monospace",
|
||||||
"mousedown",
|
"mousedown",
|
||||||
"mousemove",
|
"mousemove",
|
||||||
@@ -120,7 +108,6 @@
|
|||||||
"multiselectable",
|
"multiselectable",
|
||||||
"nextjs",
|
"nextjs",
|
||||||
"nocheck",
|
"nocheck",
|
||||||
"noindex",
|
|
||||||
"noopener",
|
"noopener",
|
||||||
"noreferrer",
|
"noreferrer",
|
||||||
"novalidate",
|
"novalidate",
|
||||||
@@ -133,8 +120,6 @@
|
|||||||
"peta",
|
"peta",
|
||||||
"petabit",
|
"petabit",
|
||||||
"Preact",
|
"Preact",
|
||||||
"preconnect",
|
|
||||||
"prerendered",
|
|
||||||
"prismjs",
|
"prismjs",
|
||||||
"progressbar",
|
"progressbar",
|
||||||
"radiogroup",
|
"radiogroup",
|
||||||
@@ -155,7 +140,6 @@
|
|||||||
"scrollbars",
|
"scrollbars",
|
||||||
"scrollend",
|
"scrollend",
|
||||||
"scroller",
|
"scroller",
|
||||||
"Scrollers",
|
|
||||||
"Segoe",
|
"Segoe",
|
||||||
"semibold",
|
"semibold",
|
||||||
"shadowrootmode",
|
"shadowrootmode",
|
||||||
@@ -166,19 +150,16 @@
|
|||||||
"smartquotes",
|
"smartquotes",
|
||||||
"spacebar",
|
"spacebar",
|
||||||
"stylesheet",
|
"stylesheet",
|
||||||
"svgs",
|
|
||||||
"Tabbable",
|
"Tabbable",
|
||||||
"tabindex",
|
"tabindex",
|
||||||
"tabler",
|
"tabler",
|
||||||
"tablist",
|
"tablist",
|
||||||
"tabpanel",
|
"tabpanel",
|
||||||
"tbody",
|
|
||||||
"templating",
|
"templating",
|
||||||
"tera",
|
"tera",
|
||||||
"testid",
|
"testid",
|
||||||
"textareas",
|
"textareas",
|
||||||
"textfield",
|
"textfield",
|
||||||
"thead",
|
|
||||||
"Themer",
|
"Themer",
|
||||||
"tinycolor",
|
"tinycolor",
|
||||||
"transitionend",
|
"transitionend",
|
||||||
@@ -202,8 +183,7 @@
|
|||||||
"webawesomer",
|
"webawesomer",
|
||||||
"WEBP",
|
"WEBP",
|
||||||
"Webpacker",
|
"Webpacker",
|
||||||
"xmark",
|
"xmark"
|
||||||
"zoomable"
|
|
||||||
],
|
],
|
||||||
"ignorePaths": [
|
"ignorePaths": [
|
||||||
"package.json",
|
"package.json",
|
||||||
|
|||||||
@@ -2,13 +2,10 @@ import { customElementJetBrainsPlugin } from 'custom-element-jet-brains-integrat
|
|||||||
import { customElementVsCodePlugin } from 'custom-element-vs-code-integration';
|
import { customElementVsCodePlugin } from 'custom-element-vs-code-integration';
|
||||||
// import { customElementVuejsPlugin } from 'custom-element-vuejs-integration';
|
// import { customElementVuejsPlugin } from 'custom-element-vuejs-integration';
|
||||||
import { parse } from 'comment-parser';
|
import { parse } from 'comment-parser';
|
||||||
import fs from 'fs';
|
|
||||||
import * as path from 'node:path';
|
|
||||||
import { pascalCase } from 'pascal-case';
|
import { pascalCase } from 'pascal-case';
|
||||||
import * as url from 'url';
|
import fs from 'fs';
|
||||||
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
|
|
||||||
|
|
||||||
const packageData = JSON.parse(fs.readFileSync(path.join(__dirname, 'package.json'), 'utf8'));
|
const packageData = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
|
||||||
const { name, description, version, author, homepage, license } = packageData;
|
const { name, description, version, author, homepage, license } = packageData;
|
||||||
const outdir = 'dist-cdn';
|
const outdir = 'dist-cdn';
|
||||||
|
|
||||||
@@ -31,7 +28,7 @@ export default {
|
|||||||
name: 'wa-package-data',
|
name: 'wa-package-data',
|
||||||
packageLinkPhase({ customElementsManifest }) {
|
packageLinkPhase({ customElementsManifest }) {
|
||||||
customElementsManifest.package = { name, description, version, author, homepage, license };
|
customElementsManifest.package = { name, description, version, author, homepage, license };
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// Parse custom jsDoc tags
|
// Parse custom jsDoc tags
|
||||||
@@ -86,13 +83,13 @@ export default {
|
|||||||
classDoc[t.tag].push({
|
classDoc[t.tag].push({
|
||||||
name: t.name,
|
name: t.name,
|
||||||
description: t.description,
|
description: t.description,
|
||||||
type: t.type || undefined,
|
type: t.type || undefined
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -112,7 +109,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -130,7 +127,7 @@ export default {
|
|||||||
//
|
//
|
||||||
const terms = [
|
const terms = [
|
||||||
{ from: /^src\//, to: '' }, // Strip the src/ prefix
|
{ from: /^src\//, to: '' }, // Strip the src/ prefix
|
||||||
{ from: /\.(t|j)sx?$/, to: '.js' }, // Convert .ts to .js
|
{ from: /\.(t|j)sx?$/, to: '.js' } // Convert .ts to .js
|
||||||
];
|
];
|
||||||
|
|
||||||
mod.path = replace(mod.path, terms);
|
mod.path = replace(mod.path, terms);
|
||||||
@@ -149,7 +146,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// Generate custom VS Code data
|
// Generate custom VS Code data
|
||||||
@@ -159,9 +156,9 @@ export default {
|
|||||||
referencesTemplate: (_, tag) => [
|
referencesTemplate: (_, tag) => [
|
||||||
{
|
{
|
||||||
name: 'Documentation',
|
name: 'Documentation',
|
||||||
url: `https://webawesome.com/docs/components/${tag.replace('wa-', '')}`,
|
url: `https://webawesome.com/docs/components/${tag.replace('wa-', '')}`
|
||||||
},
|
}
|
||||||
],
|
]
|
||||||
}),
|
}),
|
||||||
|
|
||||||
customElementJetBrainsPlugin({
|
customElementJetBrainsPlugin({
|
||||||
@@ -171,10 +168,10 @@ export default {
|
|||||||
referencesTemplate: (_, tag) => {
|
referencesTemplate: (_, tag) => {
|
||||||
return {
|
return {
|
||||||
name: 'Documentation',
|
name: 'Documentation',
|
||||||
url: `https://webawesome.com/docs/components/${tag.replace('wa-', '')}`,
|
url: `https://webawesome.com/docs/components/${tag.replace('wa-', '')}`
|
||||||
};
|
};
|
||||||
},
|
}
|
||||||
}),
|
})
|
||||||
|
|
||||||
//
|
//
|
||||||
// TODO - figure out why this broke when events were updated
|
// TODO - figure out why this broke when events were updated
|
||||||
@@ -184,5 +181,5 @@ export default {
|
|||||||
// fileName: 'index.d.ts',
|
// fileName: 'index.d.ts',
|
||||||
// componentTypePath: (_, tag) => `../../components/${tag.replace('wa-', '')}/${tag.replace('wa-', '')}.js`
|
// componentTypePath: (_, tag) => `../../components/${tag.replace('wa-', '')}/${tag.replace('wa-', '')}.js`
|
||||||
// })
|
// })
|
||||||
],
|
]
|
||||||
};
|
};
|
||||||
142
docs/.eleventy.js
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
import { parse } from 'path';
|
||||||
|
import { markdown } from './_utils/markdown.js';
|
||||||
|
import { anchorHeadingsPlugin } from './_utils/anchor-headings.js';
|
||||||
|
import { codeExamplesPlugin } from './_utils/code-examples.js';
|
||||||
|
import { copyCodePlugin } from './_utils/copy-code.js';
|
||||||
|
import { currentLink } from './_utils/current-link.js';
|
||||||
|
import { highlightCodePlugin } from './_utils/highlight-code.js';
|
||||||
|
import { formatCodePlugin } from './_utils/format-code.js';
|
||||||
|
import { replaceTextPlugin } from './_utils/replace-text.js';
|
||||||
|
import { searchPlugin } from './_utils/search.js';
|
||||||
|
import { readFile } from 'fs/promises';
|
||||||
|
import { outlinePlugin } from './_utils/outline.js';
|
||||||
|
import componentList from './_data/componentList.js';
|
||||||
|
import litPlugin from '@lit-labs/eleventy-plugin-lit';
|
||||||
|
|
||||||
|
import process from 'process';
|
||||||
|
|
||||||
|
const packageData = JSON.parse(await readFile('./package.json', 'utf-8'));
|
||||||
|
const isAlpha = process.argv.includes('--alpha');
|
||||||
|
const isDeveloping = process.argv.includes('--develop');
|
||||||
|
|
||||||
|
export default function (eleventyConfig) {
|
||||||
|
// NOTE - alpha setting removes certain pages
|
||||||
|
if (isAlpha) {
|
||||||
|
eleventyConfig.ignores.add('**/components/page.md');
|
||||||
|
eleventyConfig.ignores.add('**/experimental/**');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add template data
|
||||||
|
eleventyConfig.addGlobalData('package', packageData);
|
||||||
|
|
||||||
|
// Template filters - {{ content | filter }}
|
||||||
|
eleventyConfig.addFilter('inlineMarkdown', content => markdown.renderInline(content || ''));
|
||||||
|
eleventyConfig.addFilter('markdown', content => markdown.render(content || ''));
|
||||||
|
eleventyConfig.addFilter('stripExtension', string => parse(string).name);
|
||||||
|
eleventyConfig.addFilter('stripPrefix', content => content.replace(/^wa-/, ''));
|
||||||
|
eleventyConfig.addFilter('trimPipes', content => {
|
||||||
|
// Trims whitespace and pipes from the start and end of a string. Useful for CEM types, which can be pipe-delimited.
|
||||||
|
// With Prettier 3, this means a leading pipe will exist be present when the line wraps.
|
||||||
|
return typeof content === 'string' ? content.replace(/^(\s|\|)/g, '').replace(/(\s|\|)$/g, '') : content;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Shortcodes - {% shortCode arg1, arg2 %}
|
||||||
|
eleventyConfig.addShortcode('cdnUrl', location => {
|
||||||
|
return `https://early.webawesome.com/webawesome@${packageData.version}/dist/` + location.replace(/^\//, '');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Helpers
|
||||||
|
|
||||||
|
// Use our own markdown instance
|
||||||
|
eleventyConfig.setLibrary('md', markdown);
|
||||||
|
|
||||||
|
// Add anchors to headings
|
||||||
|
eleventyConfig.addPlugin(anchorHeadingsPlugin({ container: '#content' }));
|
||||||
|
|
||||||
|
// Add an outline to the page
|
||||||
|
eleventyConfig.addPlugin(
|
||||||
|
outlinePlugin({
|
||||||
|
container: '#content',
|
||||||
|
target: '.outline-links',
|
||||||
|
selector: 'h2, h3',
|
||||||
|
ifEmpty: doc => {
|
||||||
|
doc.querySelector('#outline')?.remove();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
// Add current link classes
|
||||||
|
eleventyConfig.addPlugin(currentLink());
|
||||||
|
|
||||||
|
// Add code examples for `<code class="example">` blocks
|
||||||
|
eleventyConfig.addPlugin(codeExamplesPlugin());
|
||||||
|
|
||||||
|
// Highlight code blocks with Prism
|
||||||
|
eleventyConfig.addPlugin(highlightCodePlugin());
|
||||||
|
|
||||||
|
// Add copy code buttons to code blocks
|
||||||
|
eleventyConfig.addPlugin(copyCodePlugin());
|
||||||
|
|
||||||
|
// Various text replacements
|
||||||
|
eleventyConfig.addPlugin(
|
||||||
|
replaceTextPlugin([
|
||||||
|
// Replace [issue:1234] with a link to the issue on GitHub
|
||||||
|
{
|
||||||
|
replace: /\[pr:([0-9]+)\]/gs,
|
||||||
|
replaceWith: '<a href="https://github.com/shoelace-style/webawesome/pull/$1">#$1</a>'
|
||||||
|
},
|
||||||
|
// Replace [pr:1234] with a link to the pull request on GitHub
|
||||||
|
{
|
||||||
|
replace: /\[issue:([0-9]+)\]/gs,
|
||||||
|
replaceWith: '<a href="https://github.com/shoelace-style/webawesome/issues/$1">#$1</a>'
|
||||||
|
},
|
||||||
|
// Replace [discuss:1234] with a link to the discussion on GitHub
|
||||||
|
{
|
||||||
|
replace: /\[discuss:([0-9]+)\]/gs,
|
||||||
|
replaceWith: '<a href="https://github.com/shoelace-style/webawesome/discussions/$1">#$1</a>'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
);
|
||||||
|
|
||||||
|
const omittedModules = [];
|
||||||
|
|
||||||
|
// problematic components:
|
||||||
|
// animation (breaks on navigation + ssr with Turbo)
|
||||||
|
// mutation-observer (why SSR this?)
|
||||||
|
// resize-observer (why SSR this?)
|
||||||
|
// tooltip (why SSR this?)
|
||||||
|
const componentModules = componentList
|
||||||
|
// .filter(component => !omittedModules.includes(component.tagName.split(/wa-/)[1]))
|
||||||
|
.map(component => {
|
||||||
|
const name = component.tagName.split(/wa-/)[1];
|
||||||
|
return `./dist/components/${name}/${name}.js`;
|
||||||
|
});
|
||||||
|
|
||||||
|
eleventyConfig.addPlugin(litPlugin, {
|
||||||
|
mode: 'worker',
|
||||||
|
componentModules
|
||||||
|
});
|
||||||
|
|
||||||
|
// Build the search index
|
||||||
|
eleventyConfig.addPlugin(
|
||||||
|
searchPlugin({
|
||||||
|
filename: '',
|
||||||
|
selectorsToIgnore: ['code.example'],
|
||||||
|
getContent: doc => doc.querySelector('#content')?.textContent ?? ''
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
// Production-only plugins
|
||||||
|
if (!isDeveloping) {
|
||||||
|
// Run Prettier on each file (prod only because it can be slow)
|
||||||
|
eleventyConfig.addPlugin(formatCodePlugin());
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
dir: {
|
||||||
|
includes: '_includes',
|
||||||
|
layouts: '_layouts'
|
||||||
|
},
|
||||||
|
templateFormats: ['njk', 'md']
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,16 +1,13 @@
|
|||||||
/**
|
/**
|
||||||
* @module components Fetches components from custom-elements.json and exposes them in a saner format.
|
* @module components Fetches components from custom-elements.json and exposes them in a saner format.
|
||||||
*/
|
*/
|
||||||
import { readFileSync } from 'fs';
|
import { dirname, resolve } from 'path';
|
||||||
import { dirname, join, resolve } from 'path';
|
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
|
import { readFileSync } from 'fs';
|
||||||
|
|
||||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||||
const customElementsJSON = process.env.DIST_DIR
|
|
||||||
? join(process.env.DIST_DIR, 'custom-elements.json')
|
|
||||||
: resolve(__dirname, '../../dist/custom-elements.json');
|
|
||||||
|
|
||||||
const manifest = JSON.parse(readFileSync(customElementsJSON), 'utf-8');
|
const manifest = JSON.parse(readFileSync(resolve(__dirname, '../../dist/custom-elements.json'), 'utf-8'));
|
||||||
|
|
||||||
const components = manifest.modules.flatMap(module => {
|
const components = manifest.modules.flatMap(module => {
|
||||||
return module.declarations
|
return module.declarations
|
||||||
@@ -39,7 +36,7 @@ const components = manifest.modules.flatMap(module => {
|
|||||||
slug: declaration.tagName.replace(/^wa-/, ''),
|
slug: declaration.tagName.replace(/^wa-/, ''),
|
||||||
methods,
|
methods,
|
||||||
attributes,
|
attributes,
|
||||||
properties,
|
properties
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
43
docs/_data/componentsBy.js
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
import components from './components.js';
|
||||||
|
|
||||||
|
const by = {
|
||||||
|
attribute: {},
|
||||||
|
slot: {},
|
||||||
|
event: {},
|
||||||
|
method: {},
|
||||||
|
cssPart: {},
|
||||||
|
cssProperty: {}
|
||||||
|
};
|
||||||
|
|
||||||
|
function getAll(component, type) {
|
||||||
|
let prop = type + 's';
|
||||||
|
if (type === 'cssProperty') {
|
||||||
|
prop = 'cssProperties';
|
||||||
|
}
|
||||||
|
|
||||||
|
return component[prop] ?? [];
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const componentName in components) {
|
||||||
|
const component = components[componentName];
|
||||||
|
|
||||||
|
for (const type of ['attribute', 'slot', 'event', 'method', 'cssPart', 'cssProperty']) {
|
||||||
|
for (const item of getAll(component, type)) {
|
||||||
|
by[type][item.name] ??= [];
|
||||||
|
by[type][item.name].push(component);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sort by descending number of components
|
||||||
|
const sortByLengthDesc = (a, b) => b[1].length - a[1].length;
|
||||||
|
|
||||||
|
for (const key in by) {
|
||||||
|
by[key] = sortObject(by[key], sortByLengthDesc);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default by;
|
||||||
|
|
||||||
|
function sortObject(obj, sorter) {
|
||||||
|
return Object.fromEntries(Object.entries(obj).sort(sorter));
|
||||||
|
}
|
||||||
98
docs/_includes/base-wide.njk
Normal file
178
docs/_includes/base.njk
Normal file
@@ -0,0 +1,178 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en" data-fa-kit-code="b10bfbde90" data-cdn-url="{% cdnUrl %}">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="description" content="{{ description }}">
|
||||||
|
<meta name="theme-color" content="#f36944">
|
||||||
|
{% if noindex %}<meta name="robots" content="noindex">{% endif %}
|
||||||
|
|
||||||
|
<title>{{ title }}</title>
|
||||||
|
|
||||||
|
<link rel="icon" href="/assets/images/webawesome-logo.svg" />
|
||||||
|
<link rel="apple-touch-icon" href="/assets/images/app-icon.png">
|
||||||
|
|
||||||
|
{# Scripts #}
|
||||||
|
{# Hydration stuff #}
|
||||||
|
<script src="/assets/scripts/hydration-errors.js"></script>
|
||||||
|
<link rel="stylesheet" href="/assets/styles/hydration-errors.css">
|
||||||
|
<link rel="preconnect" href="https://cdn.jsdelivr.net">
|
||||||
|
<script type="module" src="https://cdn.jsdelivr.net/npm/@hotwired/turbo@8.0.4/+esm"></script>
|
||||||
|
|
||||||
|
<script type="module" src="/assets/scripts/code-examples.js"></script>
|
||||||
|
<script type="module" src="/assets/scripts/color-scheme.js"></script>
|
||||||
|
<script type="module" src="/assets/scripts/copy-code.js"></script>
|
||||||
|
<script type="module" src="/assets/scripts/preset-theme.js"></script>
|
||||||
|
<script type="module" src="/assets/scripts/scroll.js"></script>
|
||||||
|
<script type="module" src="/assets/scripts/turbo.js"></script>
|
||||||
|
<script type="module" src="/assets/scripts/search.js"></script>
|
||||||
|
<script type="module" src="/assets/scripts/outline.js"></script>
|
||||||
|
<script defer data-domain="backers.webawesome.com" src="https://plausible.io/js/script.js"></script>
|
||||||
|
|
||||||
|
{# Web Awesome #}
|
||||||
|
<script type="module" src="/dist/webawesome.ssr-loader.js"></script>
|
||||||
|
<link rel="stylesheet" id="theme-stylesheet" />
|
||||||
|
<link rel="stylesheet" href="/dist/themes/applied.css" />
|
||||||
|
<link id="color-stylesheet" rel="stylesheet" href="/dist/themes/layout.css" />
|
||||||
|
<link id="color-stylesheet" rel="stylesheet" href="/dist/themes/utilities.css" />
|
||||||
|
<link rel="stylesheet" href="/dist/themes/forms.css" />
|
||||||
|
|
||||||
|
{# Docs styles #}
|
||||||
|
<link rel="stylesheet" href="/assets/styles/docs.css" />
|
||||||
|
|
||||||
|
{# Set the theme to prevent flashing #}
|
||||||
|
<script>
|
||||||
|
function getColorScheme() {
|
||||||
|
return localStorage.getItem('colorScheme') || 'auto';
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPresetTheme () {
|
||||||
|
return localStorage.getItem('presetTheme') || 'default';
|
||||||
|
}
|
||||||
|
|
||||||
|
function isDark() {
|
||||||
|
const colorScheme = getColorScheme()
|
||||||
|
if (colorScheme === 'auto') {
|
||||||
|
return window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||||
|
}
|
||||||
|
return colorScheme === 'dark';
|
||||||
|
}
|
||||||
|
|
||||||
|
const stylesheet = document.getElementById("theme-stylesheet")
|
||||||
|
let preset = getPresetTheme()
|
||||||
|
|
||||||
|
stylesheet.href = `/dist/themes/${preset}.css`
|
||||||
|
|
||||||
|
document.documentElement.classList.toggle(
|
||||||
|
`wa-theme-${preset}-dark`,
|
||||||
|
isDark()
|
||||||
|
);
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body class="layout-{{ layout | stripExtension }}">
|
||||||
|
<!-- use view="desktop" as default to reduce layout jank on desktop site. -->
|
||||||
|
<wa-page view="desktop">
|
||||||
|
<header slot="header">
|
||||||
|
{# Logo #}
|
||||||
|
<div id="docs-branding">
|
||||||
|
{# Nav toggle #}
|
||||||
|
<wa-button appearance="text" data-toggle-nav>
|
||||||
|
<wa-icon name="bars" label="Toggle navigation"></wa-icon>
|
||||||
|
</wa-button>
|
||||||
|
<a href="/" aria-label="Web Awesome">
|
||||||
|
<span class="only-desktop">{% include "logo.njk" %}</span>
|
||||||
|
<span class="only-mobile">{% include "logo-simple.njk" %}</span>
|
||||||
|
</a>
|
||||||
|
<small id="version-number" class="only-desktop">{{ package.version }}</small>
|
||||||
|
<wa-badge variant="warning" class="only-desktop">Alpha</wa-badge>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="docs-toolbar">
|
||||||
|
{# Preset theme selector #}
|
||||||
|
<wa-dropdown id="preset-theme-selector">
|
||||||
|
<wa-button slot="trigger" appearance="tinted" size="small" pill caret>
|
||||||
|
<wa-icon slot="prefix" name="paintbrush" variant="regular"></wa-icon>
|
||||||
|
<span id="preset-theme-selector__text" class="only-desktop">Default</span>
|
||||||
|
</wa-button>
|
||||||
|
<wa-menu>
|
||||||
|
<wa-menu-item type="checkbox" value="default">Default</wa-menu-item>
|
||||||
|
<wa-menu-item type="checkbox" value="classic">Classic</wa-menu-item>
|
||||||
|
<wa-menu-item type="checkbox" value="fa">Font Awesome</wa-menu-item>
|
||||||
|
|
||||||
|
<wa-menu-item type="checkbox" value="active">Active</wa-menu-item>
|
||||||
|
<wa-menu-item type="checkbox" value="brutalist">Brutalism</wa-menu-item>
|
||||||
|
<wa-menu-item type="checkbox" value="glassy">Glassy</wa-menu-item>
|
||||||
|
<wa-menu-item type="checkbox" value="migration">Migration</wa-menu-item>
|
||||||
|
<wa-menu-item type="checkbox" value="playful">Playful</wa-menu-item>
|
||||||
|
<wa-menu-item type="checkbox" value="premium">Premium</wa-menu-item>
|
||||||
|
</wa-menu>
|
||||||
|
</wa-dropdown>
|
||||||
|
{# Color scheme selector #}
|
||||||
|
<wa-dropdown id="color-scheme-selector">
|
||||||
|
<wa-button slot="trigger" appearance="tinted" size="small" pill caret title="Press \ to toggle">
|
||||||
|
<wa-icon class="only-light" slot="prefix" name="sun" variant="regular"></wa-icon>
|
||||||
|
<wa-icon class="only-dark" slot="prefix" name="moon" variant="regular"></wa-icon>
|
||||||
|
<span class="only-light only-desktop">Light</span>
|
||||||
|
<span class="only-dark only-desktop">Dark</span>
|
||||||
|
</wa-button>
|
||||||
|
<wa-menu>
|
||||||
|
<wa-menu-item type="checkbox" value="light">Light</wa-menu-item>
|
||||||
|
<wa-menu-item type="checkbox" value="dark">Dark</wa-menu-item>
|
||||||
|
<wa-divider></wa-divider>
|
||||||
|
<wa-menu-item type="checkbox" value="auto">System</wa-menu-item>
|
||||||
|
</wa-menu>
|
||||||
|
</wa-dropdown>
|
||||||
|
|
||||||
|
{# Search #}
|
||||||
|
<wa-button id="search-trigger" appearance="outlined" size="small" data-search>
|
||||||
|
<wa-icon slot="prefix" name="magnifying-glass"></wa-icon>
|
||||||
|
Search
|
||||||
|
<kbd slot="suffix" class="only-desktop">/</kbd>
|
||||||
|
</wa-button>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
{# Sidebar #}
|
||||||
|
{% if hasSidebar %}
|
||||||
|
<aside slot="navigation" id="sidebar" class="docs-aside" data-remember-scroll>
|
||||||
|
<wa-icon-button id="sidebar-close-button" name="xmark" label="Close" data-drawer="close"></wa-icon-button>
|
||||||
|
<nav>
|
||||||
|
{% include "sidebar.njk" %}
|
||||||
|
</nav>
|
||||||
|
</aside>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{# Outline #}
|
||||||
|
{% if hasOutline %}
|
||||||
|
<aside slot="aside" id="outline" class="docs-aside">
|
||||||
|
<nav id="outline-standard" class="outline-links">
|
||||||
|
<h2><a href="#content">{{ title }}</a></h2>
|
||||||
|
</nav>
|
||||||
|
</aside>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{# Main #}
|
||||||
|
<main id="content">
|
||||||
|
{# Expandable outline #}
|
||||||
|
<nav id="outline-expandable">
|
||||||
|
<details class="outline-links">
|
||||||
|
<summary>On this page</summary>
|
||||||
|
</details>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
{% block beforeContent %}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h1 class="title">{{ title }}</h1>
|
||||||
|
|
||||||
|
{{ content | safe }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block afterContent %}{% endblock %}
|
||||||
|
</main>
|
||||||
|
|
||||||
|
{% include 'search.njk' %}
|
||||||
|
</wa-page>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
Before Width: | Height: | Size: 742 B After Width: | Height: | Size: 742 B |
|
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 7.0 KiB |
@@ -1,4 +1,4 @@
|
|||||||
<wa-dialog id="site-search" without-header light-dismiss>
|
<wa-dialog id="site-search" no-header light-dismiss>
|
||||||
<div id="site-search-container">
|
<div id="site-search-container">
|
||||||
{# Header #}
|
{# Header #}
|
||||||
<header>
|
<header>
|
||||||
@@ -6,9 +6,9 @@
|
|||||||
<wa-input
|
<wa-input
|
||||||
id="site-search-input"
|
id="site-search-input"
|
||||||
type="search"
|
type="search"
|
||||||
appearance="filled"
|
filled
|
||||||
size="large"
|
size="large"
|
||||||
with-clear
|
clearable
|
||||||
placeholder="Search"
|
placeholder="Search"
|
||||||
autofocus
|
autofocus
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
293
docs/_includes/sidebar.njk
Normal file
@@ -0,0 +1,293 @@
|
|||||||
|
{# Getting started #}
|
||||||
|
<h2>Getting Started</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="/docs/installation">Installation</a></li>
|
||||||
|
<li><a href="/docs/usage">Usage</a></li>
|
||||||
|
<li><a href="/docs/themes">Themes</a></li>
|
||||||
|
<li><a href="/docs/customizing">Customizing</a></li>
|
||||||
|
<li><a href="/docs/form-controls">Form Controls</a></li>
|
||||||
|
<li><a href="/docs/localization">Localization</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
{# Resources #}
|
||||||
|
<h2>Resources</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://github.com/shoelace-style/webawesome-alpha/discussions" target="_blank">Help & Support</a></li>
|
||||||
|
<li><a href="/docs/resources/community">Community</a></li>
|
||||||
|
<li><a href="/docs/resources/accessibility">Accessibility</a></li>
|
||||||
|
<li><a href="/docs/resources/contributing">Contributing</a></li>
|
||||||
|
<li><a href="/docs/resources/changelog">Changelog</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
{# Components #}
|
||||||
|
<h2>Components</h2>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/">Components Overview</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/animated-image">Animated Image</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/animation">Animation</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/avatar">Avatar</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/badge">Badge</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/breadcrumb">Breadcrumb</a>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/breadcrumb-item">Breadcrumb Item</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/button">Button</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/button-group">Button Group</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/callout">Callout</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/card">Card</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/carousel">Carousel</a>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/carousel-item">Carousel Item</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/checkbox">Checkbox</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/color-picker">Color Picker</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/copy-button">Copy Button</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/details">Details</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/dialog">Dialog</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/divider">Divider</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/drawer">Drawer</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/dropdown">Dropdown</a>
|
||||||
|
</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>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/icon">Icon</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/icon-button">Icon Button</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/image-comparer">Image Comparer</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/include">Include</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/input">Input</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/menu">Menu</a>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/menu-item">Menu Item</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/menu-label">Menu Label</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/mutation-observer">Mutation Observer</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/popup">Popup</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/progress-bar">Progress Bar</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/progress-ring">Progress Ring</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/qr-code">QR Code</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/radio-group">Radio Group</a>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/radio">Radio</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/radio-button">Radio Button</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/range">Range</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/rating">Rating</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/relative-time">Relative Time</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/resize-observer">Resize Observer</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/select">Select</a>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/option">Option</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/skeleton">Skeleton</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/spinner">Spinner</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/split-panel">Split Panel</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/switch">Switch</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/tab-group">Tab Group</a>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/tab">Tab</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/tab-panel">Tab Panel</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/tag">Tag</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/textarea">Textarea</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/components/tooltip">Tooltip</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>
|
||||||
|
<a href="/docs/components/visually-hidden">Visually Hidden</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
{# Layout #}
|
||||||
|
<h2>Layout</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="/docs/layout">Layout Overview</a></li>
|
||||||
|
<li><a href="/docs/components/page">Page</a></li>
|
||||||
|
<li><a href="/docs/layout/cluster">Cluster</a></li>
|
||||||
|
<li><a href="/docs/layout/flank">Flank</a></li>
|
||||||
|
<li><a href="/docs/layout/frame">Frame</a></li>
|
||||||
|
<li><a href="/docs/layout/grid">Grid</a></li>
|
||||||
|
<li><a href="/docs/layout/split">Split</a></li>
|
||||||
|
<li><a href="/docs/layout/stack">Stack</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
{# Patterns #}
|
||||||
|
<h2>Patterns</h2>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/patterns/">Pattern Overview</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="/docs/patterns/app">Web App</a></li>
|
||||||
|
<li><a href="/docs/patterns/ecommerce">E-commerce</a>
|
||||||
|
<ul>
|
||||||
|
<li><a href="/docs/patterns/ecommerce-product-review">Product Reviews</a></li>
|
||||||
|
<li><a href="/docs/patterns/ecommerce-product-list">Product Lists</a></li>
|
||||||
|
<li><a href="/docs/patterns/ecommerce-category-preview">Category Previews</a></li>
|
||||||
|
<li><a href="/docs/patterns/ecommerce-shopping-cart">Shopping Carts</a></li>
|
||||||
|
<li><a href="/docs/patterns/ecommerce-category-filter">Category Filters</a></li>
|
||||||
|
<li><a href="/docs/patterns/ecommerce-product-detail">Product Detail</a></li>
|
||||||
|
<li><a href="/docs/patterns/ecommerce-order-summmary">Order Summaries</a></li>
|
||||||
|
<li><a href="/docs/patterns/ecommerce-order-history">Order History</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li><a href="/docs/patterns/blog">Blog</a></li>
|
||||||
|
<li><a href="/docs/patterns/news">News</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
{# Theming #}
|
||||||
|
<h2>Theming</h2>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/theming/">Theming Overview</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/theming/color">Color</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/theming/typography">Typography</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/theming/space">Space</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/theming/borders">Borders</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/theming/focus">Focus</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/theming/shadows">Shadows</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/theming/transitions">Transitions</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/docs/theming/component-groups">Component Groups</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
{# Style Utilities #}
|
||||||
|
<h2>Style Utilities</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="/docs/style-utilities/align-items">Align Items</a></li>
|
||||||
|
<li><a href="/docs/style-utilities/border-radius">Border Radius</a></li>
|
||||||
|
<li><a href="/docs/style-utilities/gap">Gap</a></li>
|
||||||
|
<li><a href="/docs/style-utilities/text">Text</a></li>
|
||||||
|
</ul>
|
||||||
|
Before Width: | Height: | Size: 936 B After Width: | Height: | Size: 936 B |
|
Before Width: | Height: | Size: 380 B After Width: | Height: | Size: 380 B |
|
Before Width: | Height: | Size: 754 B After Width: | Height: | Size: 754 B |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 742 B After Width: | Height: | Size: 742 B |
|
Before Width: | Height: | Size: 670 B After Width: | Height: | Size: 670 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 392 B After Width: | Height: | Size: 392 B |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 7.0 KiB |
|
Before Width: | Height: | Size: 420 B After Width: | Height: | Size: 420 B |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 518 B After Width: | Height: | Size: 518 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 524 B After Width: | Height: | Size: 524 B |
|
Before Width: | Height: | Size: 718 B After Width: | Height: | Size: 718 B |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 531 B After Width: | Height: | Size: 531 B |
|
Before Width: | Height: | Size: 300 B After Width: | Height: | Size: 300 B |
|
Before Width: | Height: | Size: 521 B After Width: | Height: | Size: 521 B |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 614 B After Width: | Height: | Size: 614 B |
|
Before Width: | Height: | Size: 337 B After Width: | Height: | Size: 337 B |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 883 B After Width: | Height: | Size: 883 B |
|
Before Width: | Height: | Size: 447 B After Width: | Height: | Size: 447 B |
|
Before Width: | Height: | Size: 388 B After Width: | Height: | Size: 388 B |
|
Before Width: | Height: | Size: 540 B After Width: | Height: | Size: 540 B |
|
Before Width: | Height: | Size: 443 B After Width: | Height: | Size: 443 B |
|
Before Width: | Height: | Size: 547 B After Width: | Height: | Size: 547 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 655 B After Width: | Height: | Size: 655 B |
|
Before Width: | Height: | Size: 596 B After Width: | Height: | Size: 596 B |
@@ -2,7 +2,7 @@
|
|||||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M48.8665 59.1993L33.7329 33H64C63.8352 38.2705 62.3694 43.4244 59.7264 48C57.0833 52.5756 53.3507 56.4213 48.8665 59.1993Z" fill="var(--wa-color-green-70)"/>
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M48.8665 59.1993L33.7329 33H64C63.8352 38.2705 62.3694 43.4244 59.7264 48C57.0833 52.5756 53.3507 56.4213 48.8665 59.1993Z" fill="var(--wa-color-green-70)"/>
|
||||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M32 64C26.714 64 21.5155 62.6919 16.8665 60.1993L32 34L47.1336 60.1993C42.4845 62.6919 37.286 64 32 64Z" fill="var(--wa-color-blue-60)"/>
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M32 64C26.714 64 21.5155 62.6919 16.8665 60.1993L32 34L47.1336 60.1993C42.4845 62.6919 37.286 64 32 64Z" fill="var(--wa-color-blue-60)"/>
|
||||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.27365 48C1.63063 43.4244 0.164839 38.2706 0 33L30.2671 33L15.1336 59.1993C10.6493 56.4213 6.91666 52.5756 4.27365 48Z" fill="var(--wa-color-indigo-60)"/>
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.27365 48C1.63063 43.4244 0.164839 38.2706 0 33L30.2671 33L15.1336 59.1993C10.6493 56.4213 6.91666 52.5756 4.27365 48Z" fill="var(--wa-color-indigo-60)"/>
|
||||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.27365 16C6.91667 11.4244 10.6493 7.57868 15.1336 4.80072L30.2671 31L0 31C0.16484 25.7295 1.63063 20.5756 4.27365 16Z" fill="var(--wa-color-purple-60)"/>
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.27365 16C6.91667 11.4244 10.6493 7.57868 15.1336 4.80072L30.2671 31L0 31C0.16484 25.7295 1.63063 20.5756 4.27365 16Z" fill="var(--wa-color-violet-60)"/>
|
||||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M32 30L16.8665 3.80072C21.5155 1.30813 26.714 0 32 0C37.286 0 42.4845 1.30813 47.1336 3.80072L32 30Z" fill="var(--wa-color-red-60)"/>
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M32 30L16.8665 3.80072C21.5155 1.30813 26.714 0 32 0C37.286 0 42.4845 1.30813 47.1336 3.80072L32 30Z" fill="var(--wa-color-red-60)"/>
|
||||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M33.7329 31L48.8665 4.80072C53.3507 7.57868 57.0833 11.4244 59.7264 16C62.3694 20.5756 63.8352 25.7294 64 31L33.7329 31Z" fill="var(--wa-color-yellow-80)"/>
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M33.7329 31L48.8665 4.80072C53.3507 7.57868 57.0833 11.4244 59.7264 16C62.3694 20.5756 63.8352 25.7294 64 31L33.7329 31Z" fill="var(--wa-color-yellow-80)"/>
|
||||||
</svg>
|
</svg>
|
||||||
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 502 B After Width: | Height: | Size: 502 B |
|
Before Width: | Height: | Size: 790 B After Width: | Height: | Size: 790 B |
|
Before Width: | Height: | Size: 697 B After Width: | Height: | Size: 697 B |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
@@ -1,14 +1,40 @@
|
|||||||
{% extends '../_layouts/block.njk' %}
|
{% set hasSidebar = true %}
|
||||||
|
{% set hasOutline = true %}
|
||||||
{% set component = components[page.fileSlug] %}
|
{% set component = components[page.fileSlug] %}
|
||||||
|
{% set description = component.summary %}
|
||||||
|
|
||||||
|
{% extends '../_includes/base.njk' %}
|
||||||
|
|
||||||
|
{# Component header #}
|
||||||
|
{% block beforeContent %}
|
||||||
|
<h1 class="title">{{ title }}</h1>
|
||||||
|
<div class="component-info">
|
||||||
|
<code class="component-tag"><{{ component.tagName }}></code>
|
||||||
|
<wa-badge variant="neutral">Since {{ component.since }}</wa-badge>
|
||||||
|
<wa-badge
|
||||||
|
{% if component.status == 'stable' %}variant="brand"{% endif %}
|
||||||
|
{% if component.status == 'experimental' %}variant="warning"{% endif %}
|
||||||
|
>
|
||||||
|
{{ component.status }}
|
||||||
|
</wa-badge>
|
||||||
|
</div>
|
||||||
|
<p class="component-summary">
|
||||||
|
{{ component.summary | inlineMarkdown | safe }}
|
||||||
|
</p>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{# Content #}
|
||||||
|
{% block content %}
|
||||||
|
{{ content | safe }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{# Component API #}
|
{# Component API #}
|
||||||
{% block afterContent %}
|
{% block afterContent %}
|
||||||
{# Slots #}
|
{# Slots #}
|
||||||
{% if component.slots.length %}
|
{% if component.slots.length %}
|
||||||
<h2>Slots</h2>
|
<h2>Slots</h2>
|
||||||
<p>Learn more about <a href="/docs/usage/#slots">using slots</a>.</p>
|
|
||||||
|
|
||||||
<wa-scroller>
|
<div class="table-scroll">
|
||||||
<table class="component-table">
|
<table class="component-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -31,30 +57,29 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</wa-scroller>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{# Properties #}
|
{# Properties #}
|
||||||
{% if component.properties.length %}
|
{% if component.properties.length %}
|
||||||
<h2>Attributes & Properties</h2>
|
<h2>Properties</h2>
|
||||||
<p>Learn more about <a href="/docs/usage/#attributes-and-properties">attributes and properties</a>.</p>
|
|
||||||
|
|
||||||
<wa-scroller>
|
<div class="table-scroll">
|
||||||
<table class="component-table">
|
<table class="component-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="table-name">Name</th>
|
<th class="table-name">Name</th>
|
||||||
<th class="table-description">Description</th>
|
<th class="table-description">Description</th>
|
||||||
<th class="table-reflect">Reflects</th>
|
<th class="table-reflects">Reflects</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for prop in component.properties %}
|
{% for prop in component.properties %}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="table-name">
|
<td class="table-name">
|
||||||
<code title="JS property">{{ prop.name }}</code><br>
|
<code>{{ prop.name }}</code><br>
|
||||||
{% if prop.attribute %}
|
{% if prop.attribute %}
|
||||||
<div><small><code title="HTML attribute">{{ prop.attribute }}</code></small></div>
|
<div><small><code>{{ prop.attribute }}</code></small></div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td class="table-description">
|
<td class="table-description">
|
||||||
@@ -66,7 +91,7 @@
|
|||||||
<div><small><strong>Default</strong> <code>{{ prop.default | inlineMarkdown | safe }}</code></small></div>
|
<div><small><strong>Default</strong> <code>{{ prop.default | inlineMarkdown | safe }}</code></small></div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td class="table-reflect">
|
<td class="table-checkmark">
|
||||||
{% if prop.reflects %}
|
{% if prop.reflects %}
|
||||||
<wa-icon name="check"></wa-icon>
|
<wa-icon name="check"></wa-icon>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -78,15 +103,13 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</wa-scroller>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{# Methods #}
|
{# Methods #}
|
||||||
{% if component.methods.length %}
|
{% if component.methods.length %}
|
||||||
<h2>Methods</h2>
|
<h2>Methods</h2>
|
||||||
<p>Learn more about <a href="/docs/usage/#methods">methods</a>.</p>
|
<div class="table-scroll">
|
||||||
|
|
||||||
<wa-scroller>
|
|
||||||
<table class="component-table">
|
<table class="component-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -113,15 +136,39 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</wa-scroller>
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{# States #}
|
||||||
|
{% if component.states.length %}
|
||||||
|
<h2>States</h2>
|
||||||
|
<div class="table-scroll">
|
||||||
|
<table class="component-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="table-name">Name</th>
|
||||||
|
<th class="table-description">Description</th>
|
||||||
|
<th class="table-selector">CSS selector</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for state in component.states %}
|
||||||
|
<tr>
|
||||||
|
<td class="table-name"><code>{{ state.name }}</code></td>
|
||||||
|
<td class="table-description">{{ state.description | inlineMarkdown | safe }}</td>
|
||||||
|
<td class="table-selector"><code>[data-state-{{ state.name }}]</code></td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{# Events #}
|
{# Events #}
|
||||||
{% if component.events.length %}
|
{% if component.events.length %}
|
||||||
<h2>Events</h2>
|
<h2>Events</h2>
|
||||||
<p>Learn more about <a href="/docs/usage/#events">events</a>.</p>
|
|
||||||
|
|
||||||
<wa-scroller>
|
<div class="table-scroll">
|
||||||
<table class="component-table">
|
<table class="component-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -140,15 +187,14 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</wa-scroller>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{# Custom Properties #}
|
{# Custom Properties #}
|
||||||
{% if component.cssProperties.length %}
|
{% if component.cssProperties.length %}
|
||||||
<h2>CSS custom properties</h2>
|
<h2>CSS custom properties</h2>
|
||||||
<p>Learn more about <a href="/docs/customizing/#custom-properties">CSS custom properties</a>.</p>
|
|
||||||
|
|
||||||
<wa-scroller>
|
<div class="table-scroll">
|
||||||
<table class="component-table">
|
<table class="component-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -172,42 +218,14 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</wa-scroller>
|
</div>
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{# Custom States #}
|
|
||||||
{% if component.cssStates.length %}
|
|
||||||
<h2>Custom States</h2>
|
|
||||||
<p>Learn more about <a href="/docs/customizing/#custom-states">custom states</a>.</p>
|
|
||||||
|
|
||||||
<wa-scroller>
|
|
||||||
<table class="component-table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th class="table-name">Name</th>
|
|
||||||
<th class="table-description">Description</th>
|
|
||||||
<th class="table-selector">CSS selector</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for state in component.cssStates %}
|
|
||||||
<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>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</wa-scroller>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{# CSS Parts #}
|
{# CSS Parts #}
|
||||||
{% if component.cssParts.length %}
|
{% if component.cssParts.length %}
|
||||||
<h2>CSS parts</h2>
|
<h2>CSS parts</h2>
|
||||||
<p>Learn more about <a href="/docs/customizing/#css-parts">CSS parts</a>.</p>
|
|
||||||
|
|
||||||
<wa-scroller>
|
<div class="table-scroll">
|
||||||
<table class="component-table">
|
<table class="component-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -224,14 +242,14 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</wa-scroller>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{# Dependencies #}
|
{# Dependencies #}
|
||||||
{% if component.dependencies.length %}
|
{% if component.dependencies.length %}
|
||||||
<h2>Dependencies</h2>
|
<h2>Dependencies</h2>
|
||||||
<p>
|
<p>
|
||||||
This component automatically imports the following elements. Sub-dependencies, if any exist, will also be included in this list.
|
This component automatically imports the following elements. Subdependencies, if any exist, will also be included in this list.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<ul class="dependency-list">
|
<ul class="dependency-list">
|
||||||
@@ -244,13 +262,13 @@
|
|||||||
{# Importing #}
|
{# Importing #}
|
||||||
<h2>Importing</h2>
|
<h2>Importing</h2>
|
||||||
<p>
|
<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.
|
The <a href="/docs/#autoloading">autoloader</a> is the recommended way to import components. If you prefer to do it manually, use one of the following code snippets.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<wa-tab-group label="How would you like to import this component?">
|
<wa-tab-group label="How would you like to import this component?">
|
||||||
<wa-tab panel="cdn">CDN</wa-tab>
|
<wa-tab slot="nav" panel="cdn">CDN</wa-tab>
|
||||||
<wa-tab panel="npm">npm</wa-tab>
|
<wa-tab slot="nav" panel="npm">npm</wa-tab>
|
||||||
<wa-tab panel="react">React</wa-tab>
|
<wa-tab slot="nav" panel="react">React</wa-tab>
|
||||||
<wa-tab-panel name="cdn">
|
<wa-tab-panel name="cdn">
|
||||||
<p>
|
<p>
|
||||||
To manually import this component from the CDN, use the following code.
|
To manually import this component from the CDN, use the following code.
|
||||||
@@ -270,18 +288,4 @@
|
|||||||
#}
|
#}
|
||||||
</wa-tab-panel>
|
</wa-tab-panel>
|
||||||
</wa-tab-group>
|
</wa-tab-group>
|
||||||
|
|
||||||
<wa-divider></wa-divider>
|
|
||||||
|
|
||||||
<div class="component-help">
|
|
||||||
<strong>Need a hand?</strong>
|
|
||||||
<wa-button size="small" appearance="filled" variant="neutral" href="https://github.com/shoelace-style/webawesome-alpha/issues" target="_blank">
|
|
||||||
<wa-icon slot="prefix" name="bug"></wa-icon>
|
|
||||||
Report a bug
|
|
||||||
</wa-button>
|
|
||||||
<wa-button size="small" appearance="filled" variant="neutral" href="https://github.com/shoelace-style/webawesome-alpha/discussions" target="_blank">
|
|
||||||
<wa-icon slot="prefix" name="message-question"></wa-icon>
|
|
||||||
Ask for help
|
|
||||||
</wa-button>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
4
docs/_layouts/page-wide.njk
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{% set hasSidebar = true %}
|
||||||
|
{% set hasOutline = true %}
|
||||||
|
|
||||||
|
{% extends "../_includes/base-wide.njk" %}
|
||||||
4
docs/_layouts/page.njk
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{% set hasSidebar = true %}
|
||||||
|
{% set hasOutline = true %}
|
||||||
|
|
||||||
|
{% extends "../_includes/base.njk" %}
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
import { parse } from 'node-html-parser';
|
import { parse } from 'node-html-parser';
|
||||||
import slugify from 'slugify';
|
|
||||||
import { v4 as uuid } from 'uuid';
|
import { v4 as uuid } from 'uuid';
|
||||||
|
import slugify from 'slugify';
|
||||||
|
|
||||||
function createId(text) {
|
function createId(text) {
|
||||||
let slug = slugify(String(text), {
|
let slug = slugify(String(text), {
|
||||||
remove: /[^\w|\s]/g,
|
remove: /[^\w|\s]/g,
|
||||||
lower: true,
|
lower: true
|
||||||
});
|
});
|
||||||
|
|
||||||
// ids must start with a letter
|
// ids must start with a letter
|
||||||
@@ -24,7 +24,7 @@ export function anchorHeadingsPlugin(options = {}) {
|
|||||||
container: 'body',
|
container: 'body',
|
||||||
headingSelector: 'h2, h3, h4, h5, h6',
|
headingSelector: 'h2, h3, h4, h5, h6',
|
||||||
anchorLabel: 'Jump to heading',
|
anchorLabel: 'Jump to heading',
|
||||||
...options,
|
...options
|
||||||
};
|
};
|
||||||
|
|
||||||
return function (eleventyConfig) {
|
return function (eleventyConfig) {
|
||||||
@@ -37,29 +37,24 @@ export function anchorHeadingsPlugin(options = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Look for headings
|
// Look for headings
|
||||||
let selector = `:is(${options.headingSelector}):not([data-no-anchor], [data-no-anchor] *)`;
|
container.querySelectorAll(options.headingSelector).forEach(heading => {
|
||||||
container.querySelectorAll(selector).forEach(heading => {
|
|
||||||
const hasAnchor = heading.querySelector('a');
|
const hasAnchor = heading.querySelector('a');
|
||||||
const existingId = heading.getAttribute('id');
|
|
||||||
const clone = parse(heading.outerHTML);
|
const clone = parse(heading.outerHTML);
|
||||||
|
|
||||||
// Create a clone of the heading so we can remove [data-no-anchor] elements from the text content
|
// Create a clone of the heading so we can remove [data-no-anchor] elements from the text content
|
||||||
clone.querySelectorAll('[data-no-anchor]').forEach(el => el.remove());
|
clone.querySelectorAll('[data-no-anchor]').forEach(el => el.remove());
|
||||||
|
|
||||||
if (hasAnchor) {
|
const slug = createId(clone.textContent ?? '') ?? uuid().slice(-12);
|
||||||
return;
|
let id = slug;
|
||||||
|
let suffix = 0;
|
||||||
|
|
||||||
|
// Make sure the slug is unique in the document
|
||||||
|
while (doc.getElementById(id) !== null) {
|
||||||
|
id = `${slug}-${++suffix}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
let id = existingId;
|
if (hasAnchor || !id) {
|
||||||
if (!id) {
|
return;
|
||||||
const slug = createId(clone.textContent ?? '') ?? uuid().slice(-12);
|
|
||||||
id = slug;
|
|
||||||
let suffix = 1;
|
|
||||||
|
|
||||||
// Make sure the slug is unique in the document
|
|
||||||
while (doc.getElementById(id) !== null) {
|
|
||||||
id = `${slug}-${++suffix}`;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the anchor
|
// Create the anchor
|
||||||
@@ -72,9 +67,7 @@ export function anchorHeadingsPlugin(options = {}) {
|
|||||||
anchor.querySelector('.wa-visually-hidden').textContent = options.anchorLabel;
|
anchor.querySelector('.wa-visually-hidden').textContent = options.anchorLabel;
|
||||||
|
|
||||||
// Update the heading
|
// Update the heading
|
||||||
if (!existingId) {
|
heading.setAttribute('id', id);
|
||||||
heading.setAttribute('id', id);
|
|
||||||
}
|
|
||||||
heading.classList.add('anchor-heading');
|
heading.classList.add('anchor-heading');
|
||||||
heading.appendChild(anchor);
|
heading.appendChild(anchor);
|
||||||
});
|
});
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
import { parse } from 'node-html-parser';
|
import { parse } from 'node-html-parser';
|
||||||
import { v4 as uuid } from 'uuid';
|
import { v4 as uuid } from 'uuid';
|
||||||
import { markdown } from '../_utils/markdown.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Eleventy plugin to turn `<code class="example">` blocks into live examples.
|
* Eleventy plugin to turn `<code class="example">` blocks into live examples.
|
||||||
@@ -8,7 +7,7 @@ import { markdown } from '../_utils/markdown.js';
|
|||||||
export function codeExamplesPlugin(options = {}) {
|
export function codeExamplesPlugin(options = {}) {
|
||||||
options = {
|
options = {
|
||||||
container: 'body',
|
container: 'body',
|
||||||
...options,
|
...options
|
||||||
};
|
};
|
||||||
|
|
||||||
return function (eleventyConfig) {
|
return function (eleventyConfig) {
|
||||||
@@ -25,7 +24,6 @@ export function codeExamplesPlugin(options = {}) {
|
|||||||
const pre = code.closest('pre');
|
const pre = code.closest('pre');
|
||||||
const hasButtons = !code.classList.contains('no-buttons');
|
const hasButtons = !code.classList.contains('no-buttons');
|
||||||
const isOpen = code.classList.contains('open') || !hasButtons;
|
const isOpen = code.classList.contains('open') || !hasButtons;
|
||||||
const isViewportDemo = code.classList.contains('viewport');
|
|
||||||
const noEdit = code.classList.contains('no-edit');
|
const noEdit = code.classList.contains('no-edit');
|
||||||
const id = `code-example-${uuid().slice(-12)}`;
|
const id = `code-example-${uuid().slice(-12)}`;
|
||||||
let preview = pre.textContent;
|
let preview = pre.textContent;
|
||||||
@@ -35,32 +33,10 @@ export function codeExamplesPlugin(options = {}) {
|
|||||||
root.querySelectorAll('script').forEach(script => script.setAttribute('type', 'module'));
|
root.querySelectorAll('script').forEach(script => script.setAttribute('type', 'module'));
|
||||||
preview = root.toString();
|
preview = root.toString();
|
||||||
|
|
||||||
const escapedHtml = markdown.utils.escapeHtml(`
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>Web Awesome Demo</title>
|
|
||||||
<link rel="stylesheet" href="https://early.webawesome.com/webawesome@[version]/dist/styles/themes/default.css" />
|
|
||||||
<link rel="stylesheet" href="https://early.webawesome.com/webawesome@[version]/dist/styles/webawesome.css" />
|
|
||||||
<script type="module" src="https://early.webawesome.com/webawesome@[version]/dist/webawesome.loader.js"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
${preview}
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
`);
|
|
||||||
|
|
||||||
const codeExample = parse(`
|
const codeExample = parse(`
|
||||||
<div class="code-example ${isOpen ? 'open' : ''} ${isViewportDemo ? 'is-viewport-demo' : ''}">
|
<div class="code-example ${isOpen ? 'open' : ''}">
|
||||||
<div class="code-example-preview">
|
<div class="code-example-preview">
|
||||||
|
${preview}
|
||||||
${isViewportDemo ? ` <wa-viewport-demo><iframe srcdoc="${escapedHtml}"></iframe></wa-viewport-demo>` : preview}
|
|
||||||
|
|
||||||
<div class="code-example-resizer" aria-hidden="true">
|
|
||||||
<wa-icon name="grip-lines-vertical"></wa-icon>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="code-example-source" id="${id}">
|
<div class="code-example-source" id="${id}">
|
||||||
${pre.outerHTML}
|
${pre.outerHTML}
|
||||||
32
docs/_utils/copy-code.js
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
import { parse } from 'node-html-parser';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Eleventy plugin to add copy buttons to code blocks.
|
||||||
|
*/
|
||||||
|
export function copyCodePlugin(options = {}) {
|
||||||
|
options = {
|
||||||
|
container: 'body',
|
||||||
|
...options
|
||||||
|
};
|
||||||
|
|
||||||
|
return function (eleventyConfig) {
|
||||||
|
eleventyConfig.addTransform('copy-code', content => {
|
||||||
|
const doc = parse(content, { blockTextElements: { code: true } });
|
||||||
|
const container = doc.querySelector(options.container);
|
||||||
|
|
||||||
|
if (!container) {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Look for code blocks
|
||||||
|
container.querySelectorAll('pre > code').forEach(code => {
|
||||||
|
const pre = code.closest('pre');
|
||||||
|
|
||||||
|
// Add a copy button (we set the copy data at runtime to reduce page bloat)
|
||||||
|
pre.innerHTML = `<wa-copy-button class="copy-button" hoist></wa-copy-button>` + pre.innerHTML;
|
||||||
|
});
|
||||||
|
|
||||||
|
return doc.toString();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -28,7 +28,7 @@ export function currentLink(options = {}) {
|
|||||||
options = {
|
options = {
|
||||||
container: 'body',
|
container: 'body',
|
||||||
className: 'current',
|
className: 'current',
|
||||||
...options,
|
...options
|
||||||
};
|
};
|
||||||
|
|
||||||
return function (eleventyConfig) {
|
return function (eleventyConfig) {
|
||||||
@@ -11,7 +11,7 @@ import defaultOptions from '../../prettier.config.js';
|
|||||||
export async function formatCode(string, options) {
|
export async function formatCode(string, options) {
|
||||||
return await format(string, {
|
return await format(string, {
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
...options,
|
...options
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ export async function formatCode(string, options) {
|
|||||||
export function formatCodePlugin(options = {}) {
|
export function formatCodePlugin(options = {}) {
|
||||||
options = {
|
options = {
|
||||||
parser: 'html',
|
parser: 'html',
|
||||||
...options,
|
...options
|
||||||
};
|
};
|
||||||
|
|
||||||
return function (eleventyConfig) {
|
return function (eleventyConfig) {
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
/* eslint sort-imports-es6-autofix/sort-imports-es6: 0 */
|
/* eslint sort-imports-es6-autofix/sort-imports-es6: 0 */
|
||||||
import { parse } from 'node-html-parser';
|
import { parse } from 'node-html-parser';
|
||||||
import Prism from 'prismjs';
|
import Prism from 'prismjs';
|
||||||
import PrismLoader from 'prismjs/components/index.js';
|
|
||||||
import 'prismjs/plugins/custom-class/prism-custom-class.js';
|
import 'prismjs/plugins/custom-class/prism-custom-class.js';
|
||||||
|
import PrismLoader from 'prismjs/components/index.js';
|
||||||
|
|
||||||
PrismLoader('diff');
|
PrismLoader('diff');
|
||||||
PrismLoader.silent = true;
|
PrismLoader.silent = true;
|
||||||
@@ -40,7 +40,7 @@ export function highlightCode(code, language = 'plain') {
|
|||||||
export function highlightCodePlugin(options = {}) {
|
export function highlightCodePlugin(options = {}) {
|
||||||
options = {
|
options = {
|
||||||
container: 'body',
|
container: 'body',
|
||||||
...options,
|
...options
|
||||||
};
|
};
|
||||||
|
|
||||||
return function (eleventyConfig) {
|
return function (eleventyConfig) {
|
||||||
@@ -14,7 +14,7 @@ export const markdown = MarkdownIt({
|
|||||||
breaks: false,
|
breaks: false,
|
||||||
langPrefix: 'language-',
|
langPrefix: 'language-',
|
||||||
linkify: false,
|
linkify: false,
|
||||||
typographer: false,
|
typographer: false
|
||||||
});
|
});
|
||||||
|
|
||||||
markdown.use(markdownItIns);
|
markdown.use(markdownItIns);
|
||||||
@@ -34,7 +34,7 @@ markdown.use(markdownItMark);
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
return '</div></div>\n';
|
return '</div></div>\n';
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ markdown.use(markdownItContainer, 'aside', {
|
|||||||
return `<aside>`;
|
return `<aside>`;
|
||||||
}
|
}
|
||||||
return '</aside>\n';
|
return '</aside>\n';
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
markdown.use(markdownItContainer, 'details', {
|
markdown.use(markdownItContainer, 'details', {
|
||||||
@@ -55,9 +55,9 @@ markdown.use(markdownItContainer, 'details', {
|
|||||||
return `<details>\n<summary><span>${markdown.utils.escapeHtml(m[1])}</span></summary>\n`;
|
return `<details>\n<summary><span>${markdown.utils.escapeHtml(m[1])}</span></summary>\n`;
|
||||||
}
|
}
|
||||||
return '</details>\n';
|
return '</details>\n';
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
markdown.use(markdownItAttrs, {
|
markdown.use(markdownItAttrs, {
|
||||||
allowedAttributes: [],
|
allowedAttributes: ['id', 'class', 'data']
|
||||||
});
|
});
|
||||||
@@ -15,7 +15,7 @@ export function outlinePlugin(options = {}) {
|
|||||||
target: '.outline',
|
target: '.outline',
|
||||||
selector: 'h2,h3',
|
selector: 'h2,h3',
|
||||||
ifEmpty: () => null,
|
ifEmpty: () => null,
|
||||||
...options,
|
...options
|
||||||
};
|
};
|
||||||
|
|
||||||
return function (eleventyConfig) {
|
return function (eleventyConfig) {
|
||||||
@@ -39,7 +39,7 @@ export function outlinePlugin(options = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create a clone of the heading so we can remove links and [data-no-outline] elements from the text content
|
// Create a clone of the heading so we can remove links and [data-no-outline] elements from the text content
|
||||||
clone.querySelectorAll('.wa-visually-hidden, [hidden], [aria-hidden="true"]').forEach(el => el.remove());
|
clone.querySelectorAll('a').forEach(a => a.remove());
|
||||||
clone.querySelectorAll('[data-no-outline]').forEach(el => el.remove());
|
clone.querySelectorAll('[data-no-outline]').forEach(el => el.remove());
|
||||||
|
|
||||||
// Generate the link
|
// Generate the link
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
/* eslint-disable no-invalid-this */
|
/* eslint-disable no-invalid-this */
|
||||||
import { mkdir, writeFile } from 'fs/promises';
|
|
||||||
import lunr from 'lunr';
|
|
||||||
import { parse } from 'node-html-parser';
|
|
||||||
import * as path from 'path';
|
|
||||||
import { dirname, join } from 'path';
|
import { dirname, join } from 'path';
|
||||||
|
import { mkdir, writeFile } from 'fs/promises';
|
||||||
|
import { parse } from 'node-html-parser';
|
||||||
|
import lunr from 'lunr';
|
||||||
|
|
||||||
function collapseWhitespace(string) {
|
function collapseWhitespace(string) {
|
||||||
return string.replace(/\s+/g, ' ');
|
return string.replace(/\s+/g, ' ');
|
||||||
@@ -20,35 +19,21 @@ export function searchPlugin(options = {}) {
|
|||||||
getDescription: doc => doc.querySelector('meta[name="description"]')?.getAttribute('content') ?? '',
|
getDescription: doc => doc.querySelector('meta[name="description"]')?.getAttribute('content') ?? '',
|
||||||
getHeadings: doc => [...doc.querySelectorAll('h1, h2, h3, h4, h5, h6')].map(heading => heading.textContent ?? ''),
|
getHeadings: doc => [...doc.querySelectorAll('h1, h2, h3, h4, h5, h6')].map(heading => heading.textContent ?? ''),
|
||||||
getContent: doc => doc.querySelector('body')?.textContent ?? '',
|
getContent: doc => doc.querySelector('body')?.textContent ?? '',
|
||||||
...options,
|
...options
|
||||||
};
|
};
|
||||||
|
|
||||||
return function (eleventyConfig) {
|
return function (eleventyConfig) {
|
||||||
const pagesToIndex = new Map();
|
const pagesToIndex = [];
|
||||||
|
|
||||||
eleventyConfig.addPreprocessor('exclude-unlisted-from-search', '*', function (data, content) {
|
|
||||||
if (data.unlisted) {
|
|
||||||
// no-op
|
|
||||||
} else {
|
|
||||||
pagesToIndex.set(data.page.inputPath, {});
|
|
||||||
}
|
|
||||||
|
|
||||||
return content;
|
|
||||||
});
|
|
||||||
|
|
||||||
eleventyConfig.addTransform('search', function (content) {
|
eleventyConfig.addTransform('search', function (content) {
|
||||||
if (!pagesToIndex.has(this.page.inputPath)) {
|
|
||||||
return content;
|
|
||||||
}
|
|
||||||
|
|
||||||
const doc = parse(content, {
|
const doc = parse(content, {
|
||||||
blockTextElements: {
|
blockTextElements: {
|
||||||
script: false,
|
script: false,
|
||||||
noscript: false,
|
noscript: false,
|
||||||
style: false,
|
style: false,
|
||||||
pre: false,
|
pre: false,
|
||||||
code: false,
|
code: false
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Remove content that shouldn't be searchable to reduce the index size
|
// Remove content that shouldn't be searchable to reduce the index size
|
||||||
@@ -56,20 +41,19 @@ export function searchPlugin(options = {}) {
|
|||||||
doc.querySelectorAll(selector).forEach(el => el.remove());
|
doc.querySelectorAll(selector).forEach(el => el.remove());
|
||||||
});
|
});
|
||||||
|
|
||||||
pagesToIndex.set(this.page.inputPath, {
|
pagesToIndex.push({
|
||||||
title: collapseWhitespace(options.getTitle(doc)),
|
title: collapseWhitespace(options.getTitle(doc)),
|
||||||
description: collapseWhitespace(options.getDescription(doc)),
|
description: collapseWhitespace(options.getDescription(doc)),
|
||||||
headings: options.getHeadings(doc).map(collapseWhitespace),
|
headings: options.getHeadings(doc).map(collapseWhitespace),
|
||||||
content: collapseWhitespace(options.getContent(doc)),
|
content: collapseWhitespace(options.getContent(doc)),
|
||||||
url: this.page.url === '/' ? '/' : this.page.url.replace(/\/$/, ''),
|
url: this.page.url === '/' ? '/' : this.page.url.replace(/\/$/, '')
|
||||||
});
|
});
|
||||||
|
|
||||||
return content;
|
return content;
|
||||||
});
|
});
|
||||||
|
|
||||||
eleventyConfig.on('eleventy.after', ({ directories }) => {
|
eleventyConfig.on('eleventy.after', ({ dir }) => {
|
||||||
const { output } = directories;
|
const outputFilename = join(dir.output, 'search.json');
|
||||||
const outputFilename = path.resolve(join(output, 'search.json'));
|
|
||||||
const map = [];
|
const map = [];
|
||||||
const searchIndex = lunr(async function () {
|
const searchIndex = lunr(async function () {
|
||||||
let index = 0;
|
let index = 0;
|
||||||
@@ -79,7 +63,7 @@ export function searchPlugin(options = {}) {
|
|||||||
this.field('h', { boost: 10 });
|
this.field('h', { boost: 10 });
|
||||||
this.field('c');
|
this.field('c');
|
||||||
|
|
||||||
for (const [_inputPath, page] of pagesToIndex) {
|
for (const page of pagesToIndex) {
|
||||||
this.add({ id: index, t: page.title, h: page.headings, c: page.content });
|
this.add({ id: index, t: page.title, h: page.headings, c: page.content });
|
||||||
map[index] = { title: page.title, description: page.description, url: page.url };
|
map[index] = { title: page.title, description: page.description, url: page.url };
|
||||||
index++;
|
index++;
|
||||||