porting shoelace docs to web awesome

This commit is contained in:
konnorrogers
2025-12-19 14:21:58 -05:00
parent 7e5f18ea97
commit 6daa9b93fa
13 changed files with 1305 additions and 32 deletions

618
package-lock.json generated
View File

@@ -13,13 +13,15 @@
],
"devDependencies": {
"@11ty/eleventy": "3.0.0",
"@custom-elements-manifest/analyzer": "^0.10.4",
"@custom-elements-manifest/analyzer": "^0.11.0",
"@lit-labs/eleventy-plugin-lit": "^1.0.3",
"@lit-labs/testing": "^0.2.5",
"@lit/react": "^1.0.8",
"@open-wc/testing": "^3.2.0",
"@types/mocha": "^10.0.10",
"@types/react": "^18.2.28",
"@wc-toolkit/cem-inheritance": "^1.2.2",
"@wc-toolkit/type-parser": "^1.2.0",
"@web/dev-server-esbuild": "^0.3.6",
"@web/test-runner": "^0.19.0",
"@web/test-runner-commands": "^0.9.0",
@@ -33,6 +35,7 @@
"comment-parser": "^1.4.1",
"cspell": "^6.18.1",
"custom-element-jet-brains-integration": "^1.6.2",
"custom-element-svelte-integration": "^1.2.0",
"custom-element-vs-code-integration": "^1.4.1",
"custom-element-vuejs-integration": "^1.3.3",
"del": "^7.1.0",
@@ -1195,12 +1198,13 @@
}
},
"node_modules/@custom-elements-manifest/analyzer": {
"version": "0.10.4",
"resolved": "https://registry.npmjs.org/@custom-elements-manifest/analyzer/-/analyzer-0.10.4.tgz",
"integrity": "sha512-hse8o20Jd82BwWank29/J9OC4PmSTwUoEmll3LEjDF3WLY/Lc8g3TUYSib/3GARCS8Q5myT2RPqEWfRa+6bkIg==",
"version": "0.11.0",
"resolved": "https://registry.npmjs.org/@custom-elements-manifest/analyzer/-/analyzer-0.11.0.tgz",
"integrity": "sha512-F2jQFk6igV5vrTZYDBLVr0GDQF3cTJ2VwwzPdsmkzUE+SHiYAQNKYebIq8qphZdJeTcZtVhvw336FQVZsMqh4A==",
"dev": true,
"license": "MIT",
"dependencies": {
"@custom-elements-manifest/find-dependencies": "^0.0.5",
"@custom-elements-manifest/find-dependencies": "^0.0.7",
"@github/catalyst": "^1.6.0",
"@web/config-loader": "0.1.3",
"chokidar": "3.5.2",
@@ -1313,19 +1317,49 @@
}
},
"node_modules/@custom-elements-manifest/find-dependencies": {
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/@custom-elements-manifest/find-dependencies/-/find-dependencies-0.0.5.tgz",
"integrity": "sha512-fKIMMZCDFSoL2ySUoz8knWgpV4jpb0lUXgLOvdZQMQFHxgxz1PqOJpUIypwvEVyKk3nEHRY4f10gNol02HjeCg==",
"version": "0.0.7",
"resolved": "https://registry.npmjs.org/@custom-elements-manifest/find-dependencies/-/find-dependencies-0.0.7.tgz",
"integrity": "sha512-icHEBPHcOXSrpDOFkQhvM7vljEbqrEReW251RBxSzDctXzYWIL0Hk2yMDINn3d6mZ4KSsqLZlaFiGFp/2nn9rA==",
"dev": true,
"license": "ISC",
"dependencies": {
"es-module-lexer": "^0.9.3"
"oxc-resolver": "^11.9.0",
"rs-module-lexer": "^2.5.1"
}
},
"node_modules/@custom-elements-manifest/find-dependencies/node_modules/es-module-lexer": {
"version": "0.9.3",
"resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz",
"integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==",
"dev": true
"node_modules/@emnapi/core": {
"version": "1.7.1",
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.7.1.tgz",
"integrity": "sha512-o1uhUASyo921r2XtHYOHy7gdkGLge8ghBEQHMWmyJFoXlpU58kIrhhN3w26lpQb6dspetweapMn2CSNwQ8I4wg==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"@emnapi/wasi-threads": "1.1.0",
"tslib": "^2.4.0"
}
},
"node_modules/@emnapi/runtime": {
"version": "1.7.1",
"resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.7.1.tgz",
"integrity": "sha512-PVtJr5CmLwYAU9PZDMITZoR5iAOShYREoR45EyyLrbntV50mdePTgUn4AmOw90Ifcj+x2kRjdzr1HP3RrNiHGA==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"tslib": "^2.4.0"
}
},
"node_modules/@emnapi/wasi-threads": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.1.0.tgz",
"integrity": "sha512-WI0DdZ8xFSbgMjR1sFsKABJ/C5OnRrjT06JXbZKexJGrDuPTzZdDYfFlsgcCXCyf+suG5QU2e/y1Wo2V/OapLQ==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"tslib": "^2.4.0"
}
},
"node_modules/@esbuild/aix-ppc64": {
"version": "0.23.1",
@@ -2098,6 +2132,19 @@
"integrity": "sha512-EWUguj2kd7ldmrF9F+vI5hUOralPd+sdsUnYbRy33vZTuZkduC1shE9TtEMEjAQwyfyMb4ole5KtjF8MsnQOlA==",
"dev": true
},
"node_modules/@napi-rs/wasm-runtime": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.0.tgz",
"integrity": "sha512-Fq6DJW+Bb5jaWE69/qOE0D1TUN9+6uWhCeZpdnSBk14pjLcCWR7Q8n49PTSPHazM37JqrsdpEthXy2xn6jWWiA==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"@emnapi/core": "^1.7.1",
"@emnapi/runtime": "^1.7.1",
"@tybys/wasm-util": "^0.10.1"
}
},
"node_modules/@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@@ -2184,6 +2231,289 @@
"lit-html": "^2.0.0 || ^3.0.0"
}
},
"node_modules/@oxc-resolver/binding-android-arm-eabi": {
"version": "11.16.0",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-android-arm-eabi/-/binding-android-arm-eabi-11.16.0.tgz",
"integrity": "sha512-/kFX4o8KISHCZzHRs8fBp/wZOPdkhYGquhMP2PQjc8ePAVbtaXXDPAFkjUKhz2jXNPS4jGA1wNW+8grhnJgstw==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
]
},
"node_modules/@oxc-resolver/binding-android-arm64": {
"version": "11.16.0",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-android-arm64/-/binding-android-arm64-11.16.0.tgz",
"integrity": "sha512-kPySx7j7mPxW4mRDrdbADyzJV2XrxVeMPDmNnFvTt0/LT1IA26Uk9hzWKQb4k4aeJY58bnRY1soYSawW5wAlKQ==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
]
},
"node_modules/@oxc-resolver/binding-darwin-arm64": {
"version": "11.16.0",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-darwin-arm64/-/binding-darwin-arm64-11.16.0.tgz",
"integrity": "sha512-eB00fkys5TX6oI3lY+1hgHl6dwfmrbhHTmInmJmfD6BysHpE+DUqSdQIRS2v5NI6+j+J9EWBmbW3hRtolr+MSg==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
]
},
"node_modules/@oxc-resolver/binding-darwin-x64": {
"version": "11.16.0",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-darwin-x64/-/binding-darwin-x64-11.16.0.tgz",
"integrity": "sha512-B/yMSxqe4MZfh/VoMax0qixl4XxG/sAQVlYtdVGNteBAYKfX/uw2mglkYsApk6D4qD6fVgJ21RwI50lV7oD0Qg==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
]
},
"node_modules/@oxc-resolver/binding-freebsd-x64": {
"version": "11.16.0",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-freebsd-x64/-/binding-freebsd-x64-11.16.0.tgz",
"integrity": "sha512-aKj+PNsSdn0owueMt/6TtR8QuLBNL/q2HgMdN8nRCDmoCBPvQlwB2s+AcW+UW1vyiok+9qiI5tVjihbKwQ+Khg==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"freebsd"
]
},
"node_modules/@oxc-resolver/binding-linux-arm-gnueabihf": {
"version": "11.16.0",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-11.16.0.tgz",
"integrity": "sha512-fxod0D0eMsIlGF98KRAwR3zjLCbpRoknDHjCHx22A9TmyQthGo7t66gwkRCj5g2LBbpaPZ+i6cYd2l9bRrx8+Q==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@oxc-resolver/binding-linux-arm-musleabihf": {
"version": "11.16.0",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-11.16.0.tgz",
"integrity": "sha512-5BoVnD0hpEID/13hnj0fCIojE26wfa9p4puCnm12/D5BhGlXA103n8iRaPZPLHS/prQGtrwMiFONiysD6vmIBA==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@oxc-resolver/binding-linux-arm64-gnu": {
"version": "11.16.0",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-11.16.0.tgz",
"integrity": "sha512-dMoKX6A8iuIdShbc4PB/+q6Tx8grgQxNAJQfIAmpaDTZp5NxfgzKrssPL0TCdu3RQMblF8yfXLYUFnOdPYZeRg==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@oxc-resolver/binding-linux-arm64-musl": {
"version": "11.16.0",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-arm64-musl/-/binding-linux-arm64-musl-11.16.0.tgz",
"integrity": "sha512-oLJsyqVHw53ZZPl3+wPiRNXTvavBFSInRYBB5MaNf+y42+b4XJfH7hVYyc67er0c26cQUCfx2KzqltSx7Jg9jg==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@oxc-resolver/binding-linux-ppc64-gnu": {
"version": "11.16.0",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-11.16.0.tgz",
"integrity": "sha512-qL7GsXwyytVTIh/o8cLftRYvzrpniD8pFf0jDW3VXlVsl1joCrb4GM26udGls7Zxe76nsZpPvQVB5eZ9xmHxIA==",
"cpu": [
"ppc64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@oxc-resolver/binding-linux-riscv64-gnu": {
"version": "11.16.0",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-11.16.0.tgz",
"integrity": "sha512-CFJEvagoakxPtIoKtRgPoGUqeXSgd63c3/T9hOXrgelOaMv6aEWFfjvc/4Lk5ppk2wv4KeK4IqOKBe8Faqv1Mw==",
"cpu": [
"riscv64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@oxc-resolver/binding-linux-riscv64-musl": {
"version": "11.16.0",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-11.16.0.tgz",
"integrity": "sha512-LVuE2tbZ7gjEjY1G8mjf7+pacj0/Rge9EoHxr8DY2gAxxy0qXe5Yh2Qxe3dwwFGObVNioqRH0IPkePmQ/KJK6w==",
"cpu": [
"riscv64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@oxc-resolver/binding-linux-s390x-gnu": {
"version": "11.16.0",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-11.16.0.tgz",
"integrity": "sha512-D4Zk48WN7sKsbyq4xD2F09U4S0sIkHXTW9A33BaqjfNXOD/jFXM5nTPahHx2RxBLo5ZEgS3kUW1U8V0oCBcPcg==",
"cpu": [
"s390x"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@oxc-resolver/binding-linux-x64-gnu": {
"version": "11.16.0",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-x64-gnu/-/binding-linux-x64-gnu-11.16.0.tgz",
"integrity": "sha512-WyqsQwz+x1lDe/rwf5pl/FiTiS4eEM7hEHn1OwjP+EThzXXBup9BeZE5QVB421QGm9n4SyJT1gJgI1LCRvqbaA==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@oxc-resolver/binding-linux-x64-musl": {
"version": "11.16.0",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-x64-musl/-/binding-linux-x64-musl-11.16.0.tgz",
"integrity": "sha512-5XCuIoviaMsiAAuaQL4HqnYj1BkADcbtdf2s6Ru4YHF3P/bt2p05hd4xVo85cFT1VXlGYL66XVfepsAGymJs0g==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@oxc-resolver/binding-openharmony-arm64": {
"version": "11.16.0",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-openharmony-arm64/-/binding-openharmony-arm64-11.16.0.tgz",
"integrity": "sha512-gn54HKxOhWTxZG8pNeBMmbRwHT4k/eIf0KxBII2oHUrSTinNTcqu6xn1etqt1Yezi9KzJzkTMS0cl5kTFmCHUQ==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openharmony"
]
},
"node_modules/@oxc-resolver/binding-wasm32-wasi": {
"version": "11.16.0",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-wasm32-wasi/-/binding-wasm32-wasi-11.16.0.tgz",
"integrity": "sha512-dUsUjffSI7nlt+TH9C4gGqmD/kNyx3Kghh8u+i8eZZAEFWDO+s51Yw3UADDa0BYrZDeaLjz8rgHWCE8lxpL2XQ==",
"cpu": [
"wasm32"
],
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"@napi-rs/wasm-runtime": "^1.1.0"
},
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/@oxc-resolver/binding-win32-arm64-msvc": {
"version": "11.16.0",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-11.16.0.tgz",
"integrity": "sha512-6EhsnwzA6iT752sU5tv/r+XI5cz6sWUPHJZu3brTW3m96j6yCZ8vnfeKAkFCzuDwZAXOkRLPW8WKrL0GXWfCUQ==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
]
},
"node_modules/@oxc-resolver/binding-win32-ia32-msvc": {
"version": "11.16.0",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-11.16.0.tgz",
"integrity": "sha512-YpUXuKrslGs4+In1gZhY25menhzyBbMct4RvWT9je6mYA5VCQ6aGAZf/ky5b+5sNPpR2UBNbCcYk5pP/6MowMw==",
"cpu": [
"ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
]
},
"node_modules/@oxc-resolver/binding-win32-x64-msvc": {
"version": "11.16.0",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-win32-x64-msvc/-/binding-win32-x64-msvc-11.16.0.tgz",
"integrity": "sha512-x3hU0m0c/+frUSFaw3r5Xmde5q/PdsAfznh+8lZloGK2/qfIze0jyQG0H5M6AgrUIQE1oNn8vdGXanza5+naMw==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
]
},
"node_modules/@parse5/tools": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/@parse5/tools/-/tools-0.3.0.tgz",
@@ -2643,6 +2973,17 @@
"integrity": "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==",
"dev": true
},
"node_modules/@tybys/wasm-util": {
"version": "0.10.1",
"resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.1.tgz",
"integrity": "sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"tslib": "^2.4.0"
}
},
"node_modules/@types/accepts": {
"version": "1.3.7",
"resolved": "https://registry.npmjs.org/@types/accepts/-/accepts-1.3.7.tgz",
@@ -3015,12 +3356,43 @@
"@types/node": "*"
}
},
"node_modules/@wc-toolkit/cem-inheritance": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@wc-toolkit/cem-inheritance/-/cem-inheritance-1.2.2.tgz",
"integrity": "sha512-Da7U9Zew9X8DhoITRemKhKOP8AFoZwuQTj164TCFUB50YJ/0LbukOhFunTzo19MHw22ohpnzAahbjofSmrKjBg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@wc-toolkit/jsdoc-tags": "^1.1.0"
}
},
"node_modules/@wc-toolkit/cem-validator": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@wc-toolkit/cem-validator/-/cem-validator-1.0.3.tgz",
"integrity": "sha512-teKgwoyUaIUmJQCnYVjaxOLo6wOSNN/cCRh3jeeF84rNDuzyygl+zHfwgU5H8Z02hSvgvCJjKX+r7un9A70svw==",
"dev": true,
"license": "MIT"
},
"node_modules/@wc-toolkit/jsdoc-tags": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@wc-toolkit/jsdoc-tags/-/jsdoc-tags-1.1.0.tgz",
"integrity": "sha512-7MHpQ3FtRNJBJONMChkfIWxOWy1rvDtwOJJ4ubeGJBUEj2hp8Xy/9G8GqqNvPGzp38haAfdMcmwx6rySu4AAqg==",
"dev": true,
"license": "MIT"
},
"node_modules/@wc-toolkit/jsx-types": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/@wc-toolkit/jsx-types/-/jsx-types-1.3.0.tgz",
"integrity": "sha512-2rcRyPNEAdesFlokSSFBuCjpPPrMySk4NqyVJsqCs/WczcAUnIGwjnJk2fd/SNmzSjxGFRIFLAhXOgFOHLPvxQ==",
"dev": true
},
"node_modules/@wc-toolkit/type-parser": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@wc-toolkit/type-parser/-/type-parser-1.2.0.tgz",
"integrity": "sha512-d1Vsf4bk3+fIzca14Mtg5h9rZxOATLv5V9r0KArgJYIc59HiegkyII9v4SnVw55hBVSD0j3O7RMuCAprU5572A==",
"dev": true,
"license": "MIT"
},
"node_modules/@web/browser-logs": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/@web/browser-logs/-/browser-logs-0.4.0.tgz",
@@ -4005,6 +4377,159 @@
"integrity": "sha512-ry84Vft6xtRBbd4M/ptRodbOLodV5AD15TYhyRghCRgIcJJKmYmJ2v2BaaWxygENwh6Uq3zTfGPmlckKT/GXsQ==",
"dev": true
},
"node_modules/@xn-sakina/rml-darwin-arm64": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/@xn-sakina/rml-darwin-arm64/-/rml-darwin-arm64-2.6.0.tgz",
"integrity": "sha512-RuFHj6ro6Q24gPqNQGvH4uxpsvbgqBBy+ZUK+jbMuMaw4wyti7F6klQWuikBJAxhWpmRbhAB/jrq0PC82qlh5A==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">=14"
}
},
"node_modules/@xn-sakina/rml-darwin-x64": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/@xn-sakina/rml-darwin-x64/-/rml-darwin-x64-2.6.0.tgz",
"integrity": "sha512-85bsP7viqtgw5nVYBdl8I4c2+q4sYFcBMTeFnTf4RqhUUwBLerP7D+XXnWwv3waO+aZ0Fe0ij9Fji3oTiREOCg==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">=14"
}
},
"node_modules/@xn-sakina/rml-linux-arm-gnueabihf": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/@xn-sakina/rml-linux-arm-gnueabihf/-/rml-linux-arm-gnueabihf-2.6.0.tgz",
"integrity": "sha512-ySI529TPraG1Mf/YiKhLLNGJ1js0Y3BnZRAihUpF4IlyFKmeL3slXEdvK2tVndyX2O21EYWv/DcSAmFMNOolfA==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=14"
}
},
"node_modules/@xn-sakina/rml-linux-arm64-gnu": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/@xn-sakina/rml-linux-arm64-gnu/-/rml-linux-arm64-gnu-2.6.0.tgz",
"integrity": "sha512-Ytzkmty4vVWAqe+mbu/ql5dqwUH49eVgPT38uJK78LTZRsdogxlQbuAoLKlb/N8CIXAE7BRoywz3lSEGToXylw==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=14"
}
},
"node_modules/@xn-sakina/rml-linux-arm64-musl": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/@xn-sakina/rml-linux-arm64-musl/-/rml-linux-arm64-musl-2.6.0.tgz",
"integrity": "sha512-DIBSDWlTmWk+r6Xp7mL9Cw8DdWNyJGg7YhOV1sSSRykdGs2TNtS3z0nbHRuUBMqrbtDk0IwqFSepLx12Bix/zw==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=14"
}
},
"node_modules/@xn-sakina/rml-linux-x64-gnu": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/@xn-sakina/rml-linux-x64-gnu/-/rml-linux-x64-gnu-2.6.0.tgz",
"integrity": "sha512-8Pks6hMicFGWYQmylKul7Gmn64pG4HkRL7skVWEPAF0LZHeI5yvV/EnQUnXXbxPp4Viy2H4420jl6BVS7Uetng==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=14"
}
},
"node_modules/@xn-sakina/rml-linux-x64-musl": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/@xn-sakina/rml-linux-x64-musl/-/rml-linux-x64-musl-2.6.0.tgz",
"integrity": "sha512-xHX/rNKcATVrJt2no0FdO6kqnV4P5cP/3MgHA0KwhD/YJmWa66JIfWtzrPv9n/s0beGSorLkh8PLt5lVLFGvlQ==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=14"
}
},
"node_modules/@xn-sakina/rml-win32-arm64-msvc": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/@xn-sakina/rml-win32-arm64-msvc/-/rml-win32-arm64-msvc-2.6.0.tgz",
"integrity": "sha512-aIOu5frDsxRp5naN6YjBtbCHS4K2WHIx2EClGclv3wGFrOn1oSROxpVOV/MODUuWITj/26pWbZ/tnbvva6ZV8A==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=14"
}
},
"node_modules/@xn-sakina/rml-win32-x64-msvc": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/@xn-sakina/rml-win32-x64-msvc/-/rml-win32-x64-msvc-2.6.0.tgz",
"integrity": "sha512-XXbzy2gLEs6PpHdM2IUC5QujOIjz6LpSQpJ+ow43gVc7BhagIF5YlMyTFZCbJehjK9yNgPCzdrzsukCjsH5kIA==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=14"
}
},
"node_modules/a-sync-waterfall": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/a-sync-waterfall/-/a-sync-waterfall-1.0.1.tgz",
@@ -5845,6 +6370,16 @@
"@prettier/sync": "^0.5.2"
}
},
"node_modules/custom-element-svelte-integration": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/custom-element-svelte-integration/-/custom-element-svelte-integration-1.2.0.tgz",
"integrity": "sha512-idA8o5oj8uDYPnq7zpkr03l5WHXC8X4adKJ399TtwdXmeYWKDP0VzPAVgJGj+LQaLoa2OCyHE+GMOaUS++dN1Q==",
"dev": true,
"license": "MIT",
"dependencies": {
"@prettier/sync": "^0.5.2"
}
},
"node_modules/custom-element-vs-code-integration": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/custom-element-vs-code-integration/-/custom-element-vs-code-integration-1.5.0.tgz",
@@ -10878,6 +11413,38 @@
"node": ">=0.10.0"
}
},
"node_modules/oxc-resolver": {
"version": "11.16.0",
"resolved": "https://registry.npmjs.org/oxc-resolver/-/oxc-resolver-11.16.0.tgz",
"integrity": "sha512-I4sHGa1fZUpTQ9ftS0E0cBYbBjNnIKXRSX/trFMIJDIJ4n21dCrLAZhnJS0TSfRIRqZNFyceNZr2kablfgNyTA==",
"dev": true,
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/Boshen"
},
"optionalDependencies": {
"@oxc-resolver/binding-android-arm-eabi": "11.16.0",
"@oxc-resolver/binding-android-arm64": "11.16.0",
"@oxc-resolver/binding-darwin-arm64": "11.16.0",
"@oxc-resolver/binding-darwin-x64": "11.16.0",
"@oxc-resolver/binding-freebsd-x64": "11.16.0",
"@oxc-resolver/binding-linux-arm-gnueabihf": "11.16.0",
"@oxc-resolver/binding-linux-arm-musleabihf": "11.16.0",
"@oxc-resolver/binding-linux-arm64-gnu": "11.16.0",
"@oxc-resolver/binding-linux-arm64-musl": "11.16.0",
"@oxc-resolver/binding-linux-ppc64-gnu": "11.16.0",
"@oxc-resolver/binding-linux-riscv64-gnu": "11.16.0",
"@oxc-resolver/binding-linux-riscv64-musl": "11.16.0",
"@oxc-resolver/binding-linux-s390x-gnu": "11.16.0",
"@oxc-resolver/binding-linux-x64-gnu": "11.16.0",
"@oxc-resolver/binding-linux-x64-musl": "11.16.0",
"@oxc-resolver/binding-openharmony-arm64": "11.16.0",
"@oxc-resolver/binding-wasm32-wasi": "11.16.0",
"@oxc-resolver/binding-win32-arm64-msvc": "11.16.0",
"@oxc-resolver/binding-win32-ia32-msvc": "11.16.0",
"@oxc-resolver/binding-win32-x64-msvc": "11.16.0"
}
},
"node_modules/p-cancelable": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.4.1.tgz",
@@ -12149,6 +12716,28 @@
"typescript": ">=3.4"
}
},
"node_modules/rs-module-lexer": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/rs-module-lexer/-/rs-module-lexer-2.6.0.tgz",
"integrity": "sha512-aT0lO0icZ3Hq0IWvo+ORgVc6BJDoKfaDBdRIDQkL2PtBnFQJ0DuvExiiWI4GxjEjH8Yyro++NPArHFaD8bvS9w==",
"dev": true,
"hasInstallScript": true,
"license": "MIT",
"engines": {
"node": ">=14"
},
"optionalDependencies": {
"@xn-sakina/rml-darwin-arm64": "2.6.0",
"@xn-sakina/rml-darwin-x64": "2.6.0",
"@xn-sakina/rml-linux-arm-gnueabihf": "2.6.0",
"@xn-sakina/rml-linux-arm64-gnu": "2.6.0",
"@xn-sakina/rml-linux-arm64-musl": "2.6.0",
"@xn-sakina/rml-linux-x64-gnu": "2.6.0",
"@xn-sakina/rml-linux-x64-musl": "2.6.0",
"@xn-sakina/rml-win32-arm64-msvc": "2.6.0",
"@xn-sakina/rml-win32-x64-msvc": "2.6.0"
}
},
"node_modules/run-async": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/run-async/-/run-async-3.0.0.tgz",
@@ -14037,6 +14626,7 @@
"qr-creator": "^1.0.0"
},
"devDependencies": {
"@wc-toolkit/cem-validator": "^1.0.3",
"@wc-toolkit/jsx-types": "^1.3.0",
"eleventy-plugin-git-commit-date": "^0.1.3",
"esbuild": "^0.25.11",

View File

@@ -13,20 +13,24 @@
"scripts": {
"check-updates": "npx npm-check-updates --interactive --format group",
"start": "cd packages/webawesome && npm run start",
"start:pro": "cd packages/webawesome-pro && npm run start"
"build": "cd packages/webawesome && npm run build",
"start:pro": "cd packages/webawesome-pro && npm run start",
"build:pro": "cd packages/webawesome-pro && npm run build"
},
"engines": {
"node": ">=14.17.0"
},
"devDependencies": {
"@11ty/eleventy": "3.0.0",
"@custom-elements-manifest/analyzer": "^0.10.4",
"@custom-elements-manifest/analyzer": "^0.11.0",
"@lit-labs/eleventy-plugin-lit": "^1.0.3",
"@lit-labs/testing": "^0.2.5",
"@lit/react": "^1.0.8",
"@open-wc/testing": "^3.2.0",
"@types/mocha": "^10.0.10",
"@types/react": "^18.2.28",
"@wc-toolkit/cem-inheritance": "^1.2.2",
"@wc-toolkit/type-parser": "^1.2.0",
"@web/dev-server-esbuild": "^0.3.6",
"@web/test-runner": "^0.19.0",
"@web/test-runner-commands": "^0.9.0",
@@ -40,6 +44,7 @@
"comment-parser": "^1.4.1",
"cspell": "^6.18.1",
"custom-element-jet-brains-integration": "^1.6.2",
"custom-element-svelte-integration": "^1.2.0",
"custom-element-vs-code-integration": "^1.4.1",
"custom-element-vuejs-integration": "^1.3.3",
"del": "^7.1.0",
@@ -85,4 +90,4 @@
"prettier --write"
]
}
}
}

View File

@@ -1,13 +1,17 @@
import { jsxTypesPlugin } from '@wc-toolkit/jsx-types';
import { customElementJetBrainsPlugin } from 'custom-element-jet-brains-integration';
import { customElementVsCodePlugin } from 'custom-element-vs-code-integration';
// import { customElementVuejsPlugin } from 'custom-element-vuejs-integration';
import { customElementVuejsPlugin } from 'custom-element-vuejs-integration';
import { parse } from 'comment-parser';
import fs from 'fs';
import * as path from 'node:path';
import { pascalCase } from 'pascal-case';
import * as url from 'url';
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
import { getTsProgram, typeParserPlugin } from "@wc-toolkit/type-parser";
import { cemValidatorPlugin } from "@wc-toolkit/cem-validator";
import { cemInheritancePlugin } from "@wc-toolkit/cem-inheritance";
import { customElementSveltePlugin } from "custom-element-svelte-integration";
const packageData = JSON.parse(fs.readFileSync(path.join(__dirname, 'package.json'), 'utf8'));
const { name, description, version, author, homepage, license } = packageData;
@@ -22,11 +26,23 @@ function replace(string, terms) {
}
export default {
globs: ['src/components/**/*.ts'],
// `src/components/**/*.ts` will ignore src/internal breaking inheritance chains.
globs: ['src/**/*.ts'],
exclude: ['**/*.styles.ts', '**/*.test.ts'],
litelement: true,
dependencies: true,
outdir,
// Give the plugin access to the TypeScript type checker
overrideModuleCreation({ts, globs}) {
const program = getTsProgram(ts, globs, "tsconfig.json");
return program
.getSourceFiles()
.filter((sf) => globs.find((glob) => sf.fileName.includes(glob)));
},
plugins: [
typeParserPlugin({
}),
// Append package data
{
name: 'wa-package-data',
@@ -35,6 +51,11 @@ export default {
},
},
cemInheritancePlugin({
fileName: "custom-elements.json",
outdir,
}),
// Parse custom jsDoc tags
{
name: 'wa-custom-tags',
@@ -115,7 +136,6 @@ export default {
}
},
},
{
name: 'wa-translate-module-paths',
packageLinkPhase({ customElementsManifest }) {
@@ -152,7 +172,6 @@ export default {
});
},
},
// Generate custom VS Code data
customElementVsCodePlugin({
outdir,
@@ -167,7 +186,7 @@ export default {
// Generate custom JetBrains data
customElementJetBrainsPlugin({
outdir: './dist-cdn',
outdir,
excludeCss: true,
packageJson: false,
referencesTemplate: (_, tag) => {
@@ -191,10 +210,17 @@ export default {
//
// TODO - figure out why this broke when events were updated
//
// customElementVuejsPlugin({
// outdir: './dist/types/vue',
// fileName: 'index.d.ts',
// componentTypePath: (_, tag) => `../../components/${tag.replace('wa-', '')}/${tag.replace('wa-', '')}.js`
// })
customElementVuejsPlugin({
outdir: './dist-cdn/types/vue',
fileName: 'index.d.ts',
componentTypePath: (_, tag) => `../../components/${tag.replace('wa-', '')}/${tag.replace('wa-', '')}.js`
}),
customElementSveltePlugin({
outdir: "./dist-cdn/types/svelte",
fileName: "index.d.ts"
}),
// cemValidatorPlugin({
// cemFileName: "./dist-cdn/custom-elements.json"
// }),
],
};

View File

@@ -11,6 +11,7 @@ export function getComponents() {
const manifest = JSON.parse(readFileSync(join(distDir, 'custom-elements.json'), 'utf-8'));
const components = [];
const sortByName = (a, b) => (a.name || "").localeCompare(b.name || "")
manifest.modules?.forEach(module => {
module.declarations?.forEach(declaration => {
if (declaration.customElement) {
@@ -18,7 +19,16 @@ export function getComponents() {
declaration.path = module.path.replace(/^src\//, 'dist/').replace(/\.ts$/, '.js');
// Remove private members and those that lack a description
const members = declaration.members?.filter(member => member.description && member.privacy !== 'private');
const slots = declaration.slots?.sort(sortByName)
const events = declaration.events?.sort(sortByName)
const cssProperties = declaration.cssProperties?.sort(sortByName)
const cssParts = declaration.cssParts?.sort(sortByName)
const cssStates = declaration.cssStates?.sort(sortByName)
const dependencies = declaration.dependencies?.sort((a, b) => a.localeCompare(b))
const members = declaration.members?.filter(member => member.description && member.privacy !== 'private')
?.sort(sortByName);
const methods = members?.filter(prop => prop.kind === 'method' && prop.privacy !== 'private');
const properties = members?.filter(prop => {
// Look for a corresponding attribute
@@ -28,9 +38,15 @@ export function getComponents() {
}
return prop.kind === 'field' && prop.privacy !== 'private';
});
})
components.push({
...declaration,
slots,
events,
cssProperties,
cssStates,
cssParts,
dependencies,
methods,
properties,
});

View File

@@ -0,0 +1,113 @@
---
title: Angular
description: Tips for using Web Awesome in your Angular app.
layout: page-outline
---
# Angular
Angular [plays nice](https://custom-elements-everywhere.com/#angular) with custom elements, so you can use Web Awesome in your Angular apps with ease.
## Installation
### Download the npm package
To add Web Awesome to your Angular app, install the package from npm.
```bash
npm install @shoelace-style/shoelace
```
### Update the Angular Configuration
Next, [include a theme](/getting-started/themes). In this example, we'll import the light theme.
Its also important to load the components by using a `<script>` tag into the index.html file. However, the Angular way to do it is by adding a script configurations into your angular.json file as follows:
```json
"architect": {
"build": {
...
"options": {
...
"styles": [
"src/styles.scss",
"@shoelace-style/shoelace/dist/themes/light.css"
],
"scripts": [
"@shoelace-style/shoelace/dist/shoelace.js"
]
...
```
### Setting up the base path
Next, set the [base path](/getting-started/installation#setting-the-base-path) for icons and other assets in the `main.ts`. In this example, we'll use the CDN as a base path.
```jsx
import { setBasePath } from '@shoelace-style/shoelace/%NPMDIR%/utilities/base-path';
setBasePath('https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@%VERSION%/%CDNDIR%/');
```
:::tip
If you'd rather not use the CDN for assets, you can create a build task that copies `node_modules/@shoelace-style/shoelace/%NPMDIR%/assets` into a public folder in your app. Then you can point the base path to that folder instead.
:::
## Configuration
Then make sure to apply the custom elements schema as shown below.
```js
import { BrowserModule } from '@angular/platform-browser';
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { AppComponent } from './app.component';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule],
providers: [],
bootstrap: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class AppModule {}
```
## Reference Web Awesome components in your Angular component code
```js
import { SlDrawer } from '@shoelace-style/shoelace';
@Component({
selector: 'app-drawer-example',
template: '<div id="page"><button (click)="showDrawer()">Show drawer</button><sl-drawer #drawer label="Drawer" class="drawer-focus" style="--size: 50vw"><p>Drawer content</p></sl-drawer></div>'
})
export class DrawerExampleComponent implements OnInit {
// use @ViewChild to get a reference to the #drawer element within component template
@ViewChild('drawer')
drawer?: ElementRef<SlDrawer>;
...
constructor(...) {
}
ngOnInit() {
}
...
showDrawer() {
// use nativeElement to access Web Awesome components
this.drawer?.nativeElement.show();
}
}
```
Now you can start using Web Awesome components in your app!
:::tip
Are you using Web Awesome with Angular? [Help us improve this page!](https://github.com/shoelace-style/shoelace/blob/next/docs/frameworks/angular.md)
:::

View File

@@ -0,0 +1,192 @@
---
title: React
description: Tips for using Web Awesome in your React app.
layout: page-outline
---
# React
Web Awesome offers a React version of every component to provide an idiomatic experience for React users. You can easily toggle between HTML and React examples throughout the documentation.
## Installation
To add Web Awesome to your React app, install the package from npm.
```bash
npm install @shoelace-style/shoelace
```
Next, [include a theme](/getting-started/themes) and set the [base path](/getting-started/installation#setting-the-base-path) for icons and other assets. In this example, we'll import the light theme and use the CDN as a base path.
```jsx
// App.jsx
import '@shoelace-style/shoelace/%NPMDIR%/themes/light.css';
import { setBasePath } from '@shoelace-style/shoelace/%NPMDIR%/utilities/base-path.js';
setBasePath('https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@%VERSION%/%CDNDIR%/');
```
:::tip
If you'd rather not use the CDN for assets, you can create a [build task](https://webpack.js.org/plugins/copy-webpack-plugin/) that copies `node_modules/@shoelace-style/shoelace/%NPMDIR%/assets` into your app's `public` directory. Then you can point the base path to that folder instead.
:::
Now you can start using components!
### Preact
Preact users facing type errors using components may benefit from setting "paths" in their tsconfig.json so that react types will instead resolve to preact/compat as described in [Preact's typescript documentation](https://preactjs.com/guide/v10/typescript/#typescript-preactcompat-configuration).
## Usage
### Importing Components
Every Web Awesome component is available to import as a React component. Note that we're importing the `<SlButton>` _React component_ instead of the `<sl-button>` _custom element_ in the example below.
```jsx
import SlButton from '@shoelace-style/shoelace/%NPMDIR%/react/button/index.js';
const MyComponent = () => <SlButton variant="primary">Click me</SlButton>;
export default MyComponent;
```
#### Notes about tree shaking
Previously, it was recommended to import from a single entrypoint like so:
```jsx
import { SlButton } from '@shoelace-style/shoelace/%NPMDIR%/react';
```
However, tree-shaking extra Web Awesome components proved to be a challenge. As a result, we now recommend cherry-picking components you want to use, rather than importing from a single entrypoint.
```diff
- import { SlButton } from '@shoelace-style/shoelace/%NPMDIR%/react';
+ import SlButton from '@shoelace-style/shoelace/%NPMDIR%/react/button/index.js';
```
You can find a copy + paste import for each component in the "importing" section of its documentation.
### Event Handling
Many Web Awesome components emit [custom events](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent). For example, the [input component](/components/input) emits the `sl-input` event when it receives input. In React, you can listen for the event using `onSlInput`.
Here's how you can bind the input's value to a state variable.
```jsx
import { useState } from 'react';
import SlInput from '@shoelace-style/shoelace/%NPMDIR%/react/input/index.js';
function MyComponent() {
const [value, setValue] = useState('');
return <SlInput value={value} onSlInput={event => setValue(event.target.value)} />;
}
export default MyComponent;
```
If you're using TypeScript, it's important to note that `event.target` will be a reference to the underlying custom element. You can use `(event.target as any).value` as a quick fix, or you can strongly type the event target as shown below.
```tsx
import { useState } from 'react';
import SlInput from '@shoelace-style/shoelace/%NPMDIR%/react/input/index.js';
import type SlInputElement from '@shoelace-style/shoelace/%NPMDIR%/components/input/input.js';
function MyComponent() {
const [value, setValue] = useState('');
return <SlInput value={value} onSlInput={event => setValue((event.target as SlInputElement).value)} />;
}
export default MyComponent;
```
You can also import the event type for use in your callbacks, shown below.
```tsx
import { useCallback, useState } from 'react';
import SlInput, { type SlInputEvent } from '@shoelace-style/shoelace/%NPMDIR%/react/input/index.js';
import type SlInputElement from '@shoelace-style/shoelace/%NPMDIR%/components/input/input.js';
function MyComponent() {
const [value, setValue] = useState('');
const onInput = useCallback((event: SlInputEvent) => {
setValue(event.detail);
}, []);
return <SlInput value={value} onSlInput={event => setValue((event.target as SlInputElement).value)} />;
}
export default MyComponent;
```
## Testing with Jest
Testing with web components can be challenging if your test environment runs in a Node environment (i.e. it doesn't run in a real browser). Fortunately, [Jest](https://jestjs.io/) has made a number of strides to support web components and provide additional browser APIs. However, it's still not a complete replication of a browser environment.
Here are some tips that will help smooth things over if you're having trouble with Jest + Web Awesome.
:::tip
If you're looking for a fast, modern testing alternative, consider [Web Test Runner](https://modern-web.dev/docs/test-runner/overview/).
:::
### Upgrade Jest
Jest underwent a major revamp and received support for web components in [version 26.5.0](https://github.com/facebook/jest/blob/main/CHANGELOG.md#2650) when it introduced [JSDOM 16.2.0](https://github.com/jsdom/jsdom/blob/master/Changelog.md#1620). This release also included a number of mocks for built-in browser functions such as `MutationObserver`, `document.createRange`, and others.
If you're using [Create React App](https://reactjs.org/docs/create-a-new-react-app.html#create-react-app), you can update `react-scripts` which will also update Jest.
```
npm install react-scripts@latest
```
### Mock Missing APIs
Some components use `window.matchMedia`, but this function isn't supported by JSDOM so you'll need to mock it yourself.
In `src/setupTests.js`, add the following.
```js
Object.defineProperty(window, 'matchMedia', {
writable: true,
value: jest.fn().mockImplementation(query => ({
matches: false,
media: query,
onchange: null,
addListener: jest.fn(), // deprecated
removeListener: jest.fn(), // deprecated
addEventListener: jest.fn(),
removeEventListener: jest.fn(),
dispatchEvent: jest.fn()
}))
});
```
For more details, refer to Jest's [manual mocking](https://jestjs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom) documentation.
### Transform ES Modules
ES Modules are a [well-supported browser standard](https://hacks.mozilla.org/2018/03/es-modules-a-cartoon-deep-dive/). This is how Web Awesome is distributed, but most React apps expect CommonJS. As a result, you'll probably run into the following error.
```
Error: Unable to import outside of a module
```
To fix this, add the following to your `package.json` which tells the transpiler to process Web Awesome modules.
```js
{
"jest": {
"transformIgnorePatterns": ["node_modules/(?!(@shoelace))"]
}
}
```
These instructions are for apps created via Create React App. If you're using Jest directly, you can add `transformIgnorePatterns` directly into `jest.config.js`.
For more details, refer to Jest's [`transformIgnorePatterns` customization](https://jestjs.io/docs/tutorial-react-native#transformignorepatterns-customization) documentation.
:::tip
Are you using Web Awesome with React? [Help us improve this page!](https://github.com/shoelace-style/shoelace/blob/next/docs/frameworks/react.md)
:::

View File

@@ -0,0 +1,96 @@
---
title: Svelte
description: Tips for using Web Awesome in your Svelte app.
layout: page-outline
---
# Svelte
Svelte [plays nice](https://custom-elements-everywhere.com/#svelte) with custom elements, so you can use Web Awesome in your Svelte apps with ease.
## Installation
To add Web Awesome to your Svelte app, install the package from npm.
```bash
npm install @shoelace-style/shoelace
```
Next, [include a theme](/getting-started/themes) and set the [base path](/getting-started/installation#setting-the-base-path) for icons and other assets. In this example, we'll import the light theme and use the CDN as a base path.
```jsx
// main.js or main.ts
import '@shoelace-style/shoelace/dist/themes/light.css';
import { setBasePath } from '@shoelace-style/shoelace/dist/utilities/base-path';
setBasePath('https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@%VERSION%/%CDNDIR%/');
```
:::tip
If you'd rather not use the CDN for assets, you can create a build task that copies `node_modules/@shoelace-style/shoelace/dist/assets` into a public folder in your app. Then you can point the base path to that folder instead.
:::
## Usage
### QR code generator example
```jsx
<h1>Live editing</h1>
<sl-input label="Message" value={message} oninput={event => message = event.target.value}></sl-input>
<sl-alert open>
<sl-icon slot="icon" name="info-circle"></sl-icon>
{message}
</sl-alert>
<script>
import '@shoelace-style/shoelace/dist/components/alert/alert.js'
import '@shoelace-style/shoelace/dist/components/input/input.js';
let message = $state('')
</script>
```
### Two-way Binding
One caveat is there's currently Svelte only supports `bind:value` directive in `<input>`, `<textarea>` and `<select>`, but you can still achieve two-way binding manually.
```jsx
// ❌ These do not work
<sl-input bind:value="name"></sl-input>
<sl-select bind:value="job">
<sl-option value="designer">Designer</sl-option>
<sl-option value="developer">Developer</sl-option>
</sl-select>
// ✅ These are a bit longer, but work
<sl-input value={name} oninput={event => name = event.target.value}></sl-input>
<sl-select value={job} onsl-input={event => job = event.target.value}>
<sl-option value="designer">Designer</sl-option>
<sl-option value="developer">Developer</sl-option>
</sl-select>
```
:::tip
Are you using Web Awesome with Svelte? [Help us improve this page!](https://github.com/shoelace-style/shoelace/blob/next/docs/frameworks/svelte.md)
:::
### Slots
Slots in Web Awesome/web components are functionally the same as basic slots in Svelte. Slots can be assigned to elements using the `slot` attribute followed by the name of the slot it is being assigned to.
Here is an example:
```jsx
<sl-drawer label="Drawer" placement="start" class="drawer-placement-start" bind:open={drawerIsOpen}>
This drawer slides in from the start.
<div slot="footer">
<sl-button variant="primary" onclick={() => (drawerIsOpen = false)}>
Close
</sl-button>
</div>
</sl-drawer>
```

View File

@@ -0,0 +1,107 @@
---
title: Vue (version 2)
description: Tips for using Web Awesome in your Vue 2 app.
layout: page-outline
---
# Vue (version 2)
Vue [plays nice](https://custom-elements-everywhere.com/#vue) with custom elements, so you can use Web Awesome in your Vue apps with ease.
:::tip
These instructions are for Vue 2. If you're using Vue 3 or above, please see the [Vue 3 instructions](/frameworks/vue).
:::
## Installation
To add Web Awesome to your Vue app, install the package from npm.
```bash
npm install @shoelace-style/shoelace
```
Next, [include a theme](/getting-started/themes) and set the [base path](/getting-started/installation#setting-the-base-path) for icons and other assets. In this example, we'll import the light theme and use the CDN as a base path.
```jsx
import '@shoelace-style/shoelace/%NPMDIR%/themes/light.css';
import { setBasePath } from '@shoelace-style/shoelace/%NPMDIR%/utilities/base-path';
setBasePath('https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@%VERSION%/%CDNDIR%/');
```
:::tip
If you'd rather not use the CDN for assets, you can create a build task that copies `node_modules/@shoelace-style/shoelace/dist/assets` into a public folder in your app. Then you can point the base path to that folder instead.
:::
## Configuration
You'll need to tell Vue to ignore Web Awesome components. This is pretty easy because they all start with `sl-`.
```js
import Vue from 'vue';
import App from './App.vue';
Vue.config.ignoredElements = [/sl-/];
const app = new Vue({
render: h => h(App)
});
app.$mount('#app');
```
Now you can start using Web Awesome components in your app!
## Usage
### Binding Complex Data
When binding complex data such as objects and arrays, use the `.prop` modifier to make Vue bind them as a property instead of an attribute.
```html
<sl-color-picker :swatches.prop="mySwatches" />
```
### Two-way Binding
One caveat is there's currently [no support for v-model on custom elements](https://github.com/vuejs/vue/issues/7830), but you can still achieve two-way binding manually.
```html
<!-- ❌ This doesn't work -->
<sl-input v-model="name"></sl-input>
<!-- ✅ This works, but it's a bit longer -->
<sl-input :value="name" @input="name = $event.target.value"></sl-input>
```
If that's too verbose for your liking, you can use a custom directive instead. [This utility](https://www.npmjs.com/package/@shoelace-style/vue-sl-model) adds a custom directive that will work just like `v-model` but for Web Awesome components. To install it, use this command.
```bash
npm install @shoelace-style/vue-sl-model@1
```
Next, import the directive and enable it like this.
```js
import Vue from 'vue';
import Web AwesomeModelDirective from '@shoelace-style/vue-sl-model';
import App from './App.vue';
Vue.use(Web AwesomeModelDirective);
Vue.config.ignoredElements = [/sl-/];
const app = new Vue({
render: h => h(App)
});
app.$mount('#app');
```
Now you can use the `v-sl-model` directive to keep your data in sync!
```html
<sl-input v-sl-model="name"></sl-input>
```
:::tip
gre you using Web Awesome with Vue? [Help us improve this page!](https://github.com/shoelace-style/shoelace/blob/next/docs/frameworks/vue-2.md)
:::

View File

@@ -0,0 +1,117 @@
---
title: Vue
description: Tips for using Web Awesome in your Vue 3 app.
layout: page-outline
---
# Vue
Vue [plays nice](https://custom-elements-everywhere.com/#vue) with custom elements, so you can use Web Awesome in your Vue apps with ease.
:::tip
These instructions are for Vue 3 and above. If you're using Vue 2, please see the [Vue 2 instructions](/frameworks/vue-2).
:::
## Installation
To add Web Awesome to your Vue app, install the package from npm.
```bash
npm install @awesome.me/webawesome
```
Next, [include a theme](/getting-started/themes) and set the [base path](/getting-started/installation#setting-the-base-path) for icons and other assets. In this example, we'll import the light theme and use the CDN as a base path.
```js
// main.js or main.ts
import '@awesome.me/webawesome/dist/themes/default.css';
```
## Configuration
If you haven't configured your Vue.js project to work with custom elements/web components, follow [the instructions here](https://vuejs.org/guide/extras/web-components.html#using-custom-elements-in-vue) based on your project type to ensure your project will not throw an error when it encounters a custom element.
Now you can start using Web Awesome components in your app!
## Types
Once you have configured your application for custom elements, you should be able to use Shoelace in your application without it causing any errors. Unfortunately, this doesn't register the custom elements to behave like components built using Vue. To provide autocomplete information and type safety for your components, you can import the Shoelace Vue types into your `tsconfig.json` to get better integration in your standard Vue and JSX templates.
```json
{
"compilerOptions": {
"types": ["@awesome.me/webawesome/dist/types/vue/index.d.ts"]
}
}
```
## Usage
### QR code generator example
```html
<template>
<div class="container">
<h1>QR code generator</h1>
<wa-input maxlength="255" clearable label="Value" v-model="qrCode"></wa-input>
<wa-qr-code :value="qrCode"></wa-qr-code>
</div>
</template>
<script setup>
import { ref } from 'vue';
import '@awesome.me/webawesome/dist/components/qr-code/qr-code.js';
import '@awesome.me/webawesome/dist/components/input/input.js';
const qrCode = ref();
</script>
<style>
.container {
max-width: 400px;
margin: 0 auto;
}
</style>
```
### Binding Complex Data
When binding complex data such as objects and arrays, use the `.prop` modifier to make Vue bind them as a property instead of an attribute.
```html
<wa-color-picker :swatches.prop="mySwatches" />
```
### Two-way Binding
One caveat is there's currently [no support for v-model on custom elements](https://github.com/vuejs/vue/issues/7830), but you can still achieve two-way binding manually.
```html
<!-- ❌ This doesn't work -->
<wa-input v-model="name"></wa-input>
<!-- ✅ This works, but it's a bit longer -->
<wa-input :value="name" @input="name = $event.target.value"></wa-input>
```
If that's too verbose for your liking, you can use a custom directive instead. [This utility](https://www.npmjs.com/package/@shoelace-style/vue-sl-model) adds a custom directive that will work just like `v-model` but for Web Awesome components.
### Slots
Slots in Web Awesome / web components are functionally the same as basic slots in Vue. Slots can be assigned to elements using the `slot` attribute followed by the name of the slot it is being assigned to.
Here is an example:
```html
<wa-drawer label="Drawer" placement="start" class="drawer-placement-start" :open="drawerIsOpen">
This drawer slides in from the start.
<div slot="footer">
<wa-button variant="primary" @click=" drawerIsOpen = false">Close</wa-button>
</div>
</wa-drawer>
```
:::tip
Are you using Web Awesome with Vue? [Help us improve this page!](https://github.com/shoelace-style/webawesome/blob/next/docs/frameworks/vue.md)
:::

View File

@@ -13,7 +13,11 @@ Components with the <wa-badge variant="warning">Experimental</wa-badge> badge sh
## Next
- Added types for Vue and Svelte generated by CEM [pr:]
- Fixed a bug in `<wa-combobox>` that prevented the listbox from opening when options were preselected [issue:1883]
- [Docs]: component APIs like slots, state, methods, etc, are now alphabetized [pr:]
- [Docs]: component APIs now properly check their inheritance chain [pr:]
- [Docs]: Included framework specific documentation for Svelte, Vue, and Angular. [pr:]
## 3.1.0
@@ -520,4 +524,4 @@ Many of these changes and improvements were the direct result of feedback from u
</details>
Did we miss something? [Let us know!](https://github.com/shoelace-style/webawesome/discussions)
Did we miss something? [Let us know!](https://github.com/shoelace-style/webawesome/discussions)

View File

@@ -8,7 +8,7 @@
"homepage": "https://webawesome.com/",
"author": "Web Awesome",
"license": "MIT",
"customElements": "dist/custom-elements.json",
"customElements": "dist-cdn/custom-elements.json",
"web-types": "./dist/web-types.json",
"type": "module",
"types": "dist/webawesome.d.ts",
@@ -35,7 +35,10 @@
"files": [
"README.md",
"dist",
"dist-cdn"
"dist-cdn",
"dist/custom-elements.json",
"./dist/custom-elements.json",
"custom-elements.json"
],
"keywords": [
"web components",
@@ -89,6 +92,7 @@
]
},
"devDependencies": {
"@wc-toolkit/cem-validator": "^1.0.3",
"@wc-toolkit/jsx-types": "^1.3.0",
"eleventy-plugin-git-commit-date": "^0.1.3",
"esbuild": "^0.25.11",

View File

@@ -22,6 +22,7 @@ const components = getAllComponents(metadata);
const index = [];
for await (const component of components) {
if (!component.tagName) { continue }
const tagWithoutPrefix = component.tagName.replace(/^wa-/, '');
const componentDir = path.join(reactDir, tagWithoutPrefix);
const componentFile = path.join(componentDir, 'index.ts');

View File

@@ -154,6 +154,8 @@ export default class WebAwesomeElement extends LitElement {
relayNativeEvent(event: Event, eventOptions?: EventInit) {
event.stopImmediatePropagation();
// This triggers an error in CEM, so we need to ignore it.
/** @internal */
this.dispatchEvent(
new (event.constructor as typeof Event)(event.type, {
...event,