Skip to content

Commit a7a491e

Browse files
authored
Merge pull request uswds#228 from uswds/eg/224-framework-specific-guidance
Web components: Enhance framework integration and documentation
2 parents fbd6f75 + a5ff5d5 commit a7a491e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1056
-9
lines changed

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ build
33
dist
44
.changeset
55
*.d.ts
6+
CHANGELOG.md

config/custom-elements-manifest.config.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,36 @@
1+
import { customElementReactWrapperPlugin } from "custom-element-react-wrappers";
2+
import { customElementSolidJsPlugin } from "custom-element-solidjs-integration";
3+
import { customElementJsxPlugin } from "custom-element-jsx-integration";
4+
import { customElementVuejsPlugin } from "custom-element-vuejs-integration";
5+
import { customElementSveltePlugin } from "custom-element-svelte-integration";
6+
7+
const defaultOptions = {
8+
outdir: "./dist/types",
9+
modulePath: (_, tagName) => `../dist/components/${tagName}.js`,
10+
};
11+
112
export default {
13+
plugins: [
14+
customElementReactWrapperPlugin({
15+
outdir: "./dist/components/frameworks/react",
16+
modulePath: (_, tagName) => `../../${tagName}.js`,
17+
}),
18+
customElementSolidJsPlugin({
19+
...defaultOptions,
20+
fileName: "custom-element-solidjs.d.ts",
21+
}),
22+
customElementJsxPlugin({
23+
...defaultOptions,
24+
}),
25+
customElementVuejsPlugin({
26+
...defaultOptions,
27+
fileName: "custom-element-vuejs.d.ts",
28+
}),
29+
customElementSveltePlugin({
30+
...defaultOptions,
31+
fileName: "custom-element-svelte.d.ts",
32+
}),
33+
],
234
globs: ["./src/components/**/*.{js,ts}"],
335
exclude: [
436
"./src/components/**/*.spec.{js,ts}",

custom-elements.json

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,15 +192,17 @@
192192
"description": "The element's language.",
193193
"name": "lang",
194194
"default": "\"en\"",
195-
"fieldName": "lang"
195+
"fieldName": "lang",
196+
"propName": "lang"
196197
},
197198
{
198199
"type": {
199200
"text": "string"
200201
},
201202
"description": "The custom aria label users can override.",
202203
"name": "label",
203-
"fieldName": "label"
204+
"fieldName": "label",
205+
"propName": "label"
204206
},
205207
{
206208
"type": {
@@ -209,15 +211,17 @@
209211
"description": "The top level domain for the site.",
210212
"name": "tld",
211213
"default": "\"gov\"",
212-
"fieldName": "tld"
214+
"fieldName": "tld",
215+
"propName": "tld"
213216
},
214217
{
215218
"name": "isOpen",
216219
"type": {
217220
"text": "boolean"
218221
},
219222
"default": "false",
220-
"fieldName": "isOpen"
223+
"fieldName": "isOpen",
224+
"propName": "isopen"
221225
}
222226
],
223227
"superclass": {
@@ -326,7 +330,8 @@
326330
},
327331
"description": "The url for the link",
328332
"name": "href",
329-
"fieldName": "href"
333+
"fieldName": "href",
334+
"propName": "href"
330335
}
331336
],
332337
"superclass": {

examples/with-astro/.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# build output
2+
dist/
3+
# generated types
4+
.astro/
5+
6+
# dependencies
7+
node_modules/
8+
9+
# logs
10+
npm-debug.log*
11+
yarn-debug.log*
12+
yarn-error.log*
13+
pnpm-debug.log*
14+
15+
16+
# environment variables
17+
.env
18+
.env.production
19+
20+
# macOS-specific files
21+
.DS_Store
22+
23+
# jetbrains setting folder
24+
.idea/
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"recommendations": ["astro-build.astro-vscode"],
3+
"unwantedRecommendations": []
4+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"command": "./node_modules/.bin/astro dev",
6+
"name": "Development server",
7+
"request": "launch",
8+
"type": "node-terminal"
9+
}
10+
]
11+
}

examples/with-astro/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Astro
2+
3+
This is a bare-bones example to demonstrate how to use USWDS Elements in an Astro project.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// @ts-check
2+
import { defineConfig } from "astro/config";
3+
4+
// https://astro.build/config
5+
export default defineConfig({});

examples/with-astro/package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "with-astro",
3+
"type": "module",
4+
"version": "0.0.1",
5+
"scripts": {
6+
"dev": "astro dev",
7+
"build": "astro build",
8+
"preview": "astro preview",
9+
"astro": "astro"
10+
},
11+
"dependencies": {
12+
"@uswds/elements": "1.0.0-alpha.4",
13+
"astro": "^5.16.0"
14+
}
15+
}
Lines changed: 9 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)