Skip to content

Commit e2e225c

Browse files
committed
chore(starters): cleanup starter readme and templates
Signed-off-by: Cory Rylan <crylan@nvidia.com>
1 parent 054992e commit e2e225c

36 files changed

Lines changed: 559 additions & 432 deletions

File tree

AGENTS.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,3 +273,12 @@ When adding new technical terms, component names, or abbreviations that Vale fla
273273
- `projects/*/DEVELOPMENT.md` - When working within a specific project; lists all available pnpm scripts for that project
274274
- `/projects/internals/BUILD.md` - When modifying build configuration, Wireit scripts, or CI/CD pipeline
275275
- `/projects/internals/RELEASE.md` - When creating new projects or modifying release process; covers semantic release setup, CI artifacts, commit scopes, initial tags
276+
277+
## Cloud Agent Specific Instructions
278+
279+
These notes are for cloud agents running in the prebuilt VM (dependencies already installed by the startup update script). They capture non-obvious caveats, not full setup steps.
280+
281+
### Toolchain access
282+
283+
- **mise** manages the toolchain, and the VM image already includes it. `~/.local/bin` sits on `PATH` and `mise activate` runs from `~/.bashrc`, so `node` (26.4.0), `pnpm` (11.9.0), `go`, `vale`, and `git-lfs` resolve directly. If a fresh shell ever lacks them, prefix commands with `mise exec --` (for example, `mise exec -- pnpm ...`) or run `mise run <task>`.
284+
- Run all repo commands through mise to guarantee the pinned versions, exactly as the root `AGENTS.md` examples show.

projects/site/src/_11ty/layouts/common.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ export const renderDocsNav = data => /* html */ `
150150
<nve-tree-node ${data.page.url.includes('/docs/integrations/bundles/') ? 'highlighted selected' : ''}><a href="/docs/integrations/bundles/">Bundles</a></nve-tree-node>
151151
<nve-tree-node ${data.page.url.includes('/docs/integrations/cdn/') ? 'highlighted selected' : ''}><a href="/docs/integrations/cdn/">CDN</a></nve-tree-node>
152152
<nve-tree-node ${data.page.url.includes('/docs/integrations/custom-elements/') ? 'highlighted selected' : ''}><a href="/docs/integrations/custom-elements/">Custom Elements</a></nve-tree-node>
153+
<nve-tree-node ${data.page.url.includes('/docs/integrations/eleventy/') ? 'highlighted selected' : ''}><a href="/docs/integrations/eleventy/">Eleventy</a></nve-tree-node>
153154
<nve-tree-node ${data.page.url.includes('/docs/integrations/go/') ? 'highlighted selected' : ''}><a href="/docs/integrations/go/">Golang</a></nve-tree-node>
154155
<nve-tree-node ${data.page.url.includes('/docs/integrations/go-htmx/') ? 'highlighted selected' : ''}><a href="/docs/integrations/go-htmx/">HTMX + Go</a></nve-tree-node>
155156
<nve-tree-node ${data.page.url.includes('/docs/integrations/hugo/') ? 'highlighted selected' : ''}><a href="/docs/integrations/hugo/">Hugo</a></nve-tree-node>

projects/site/src/_11ty/shortcodes/svg-logo.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
---
2+
{
3+
title: 'Eleventy',
4+
description: 'Use NVIDIA Elements in Eleventy with Vite-bundled component definitions and styles, template markup, and optional Lit server-side rendering.',
5+
layout: 'docs.11ty.js'
6+
}
7+
---
8+
9+
# {{ title }}
10+
11+
{% integration 'eleventy' %}
12+
13+
{% installation 'eleventy' %}
14+
15+
Elements are standard Web Components, so Eleventy can emit their tags from any template language. For most sites, render the element markup at build time and register the components in the browser. Use Lit server-side rendering (SSR) only when component shadow DOM must be present in the generated HTML.
16+
17+
## Client-Side Rendering
18+
19+
The [Eleventy starter]({{ELEMENTS_REPO_BASE_URL}}/tree/main/projects/starters/eleventy) uses [Eleventy Plugin Vite](https://github.com/11ty/eleventy-plugin-vite) to bundle Elements styles and component definitions. This approach supports tree-shaking and keeps the Eleventy build environment separate from browser component registration.
20+
21+
Install the Vite integration in an existing Eleventy project:
22+
23+
```shell
24+
npm install --save-dev @11ty/eleventy-plugin-vite vite
25+
```
26+
27+
### Configure Eleventy and Vite
28+
29+
Register the Vite plugin and copy the browser entry files into Eleventy's output for Vite to process:
30+
31+
```javascript
32+
// eleventy.config.js
33+
import EleventyPluginVite from '@11ty/eleventy-plugin-vite';
34+
35+
export default function (eleventyConfig) {
36+
eleventyConfig.addPassthroughCopy('src/**/*.ts');
37+
eleventyConfig.addPassthroughCopy('src/**/*.css');
38+
39+
eleventyConfig.addPlugin(EleventyPluginVite, {
40+
viteOptions: {
41+
build: {
42+
target: 'esnext'
43+
}
44+
}
45+
});
46+
47+
return {
48+
dir: {
49+
input: 'src',
50+
output: 'dist',
51+
layouts: '_layouts'
52+
}
53+
};
54+
}
55+
```
56+
57+
If you deploy the site below the domain root, set the same base path in the Vite `base` option and the document's `<base>` element. Keeping those values aligned lets entry points and generated links resolve from the deployment path.
58+
59+
### Add Browser Entry Points
60+
61+
Create a TypeScript entry point for component registration. Import each `define.js` module that the site uses:
62+
63+
```typescript
64+
// src/_layouts/elements.ts
65+
import './elements.css';
66+
import '@nvidia-elements/core/alert/define.js';
67+
import '@nvidia-elements/core/button/define.js';
68+
```
69+
70+
Create a CSS entry point for the global theme, font, and utility styles:
71+
72+
```css
73+
/* src/_layouts/elements.css */
74+
@import '@nvidia-elements/themes/fonts/inter.css';
75+
@import '@nvidia-elements/themes/index.css';
76+
@import '@nvidia-elements/themes/dark.css';
77+
@import '@nvidia-elements/styles/layout.css';
78+
@import '@nvidia-elements/styles/typography.css';
79+
@import '@nvidia-elements/styles/view-transitions.css';
80+
```
81+
82+
Load the entry points from the shared Eleventy layout:
83+
84+
{% raw %}
85+
86+
```html
87+
<!doctype html>
88+
<html lang="en" nve-theme="dark" nve-transition="auto">
89+
<head>
90+
<meta charset="UTF-8" />
91+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
92+
<link rel="stylesheet" href="/_layouts/elements.css" />
93+
<script type="module" src="/_layouts/elements.ts"></script>
94+
</head>
95+
<body nve-text="body">
96+
{{ content | safe }}
97+
</body>
98+
</html>
99+
```
100+
101+
{% endraw %}
102+
103+
Keep `define.js` imports in the browser entry point. The Eleventy configuration runs in Node.js and should not register browser components unless you configure SSR.
104+
105+
### Use Elements in Templates
106+
107+
Write Elements markup in HTML, JavaScript, or Markdown templates:
108+
109+
```html
110+
<div nve-layout="column gap:md">
111+
<nve-alert status="success" closable>Site generated successfully.</nve-alert>
112+
<nve-button interaction="emphasis">
113+
<a href="/docs/">View documentation</a>
114+
</nve-button>
115+
</div>
116+
```
117+
118+
When configuring a custom Markdown library, enable inline HTML so Markdown pages can emit `nve-*` tags. The starter also extends the Markdown renderer to add `nve-text` and `nve-layout` attributes to generated headings, paragraphs, links, and lists.
119+
120+
## Server-Side Rendering
121+
122+
The [`@lit-labs/eleventy-plugin-lit`](https://github.com/lit/lit/tree/main/packages/labs/eleventy-plugin-lit) plugin can render Lit components into declarative shadow DOM during the Eleventy build. Lit SSR and the Eleventy plugin are experimental, so verify component compatibility before using this path in production. The [Eleventy SSR starter]({{ELEMENTS_REPO_BASE_URL}}/tree/main/projects/starters/eleventy-ssr) provides a working testbed.
123+
124+
Install the SSR plugin and client hydration support:
125+
126+
```shell
127+
npm install @lit-labs/eleventy-plugin-lit @lit-labs/ssr-client
128+
```
129+
130+
Register every component that Eleventy must render. Load the server-compatible icon module before components that can render icons:
131+
132+
```javascript
133+
// eleventy.config.js
134+
import litPlugin from '@lit-labs/eleventy-plugin-lit';
135+
136+
export default function (eleventyConfig) {
137+
eleventyConfig.addPlugin(litPlugin, {
138+
mode: 'worker',
139+
componentModules: [
140+
'node_modules/@nvidia-elements/core/dist/icon/server.js',
141+
'node_modules/@nvidia-elements/core/dist/alert/define.js'
142+
]
143+
});
144+
}
145+
```
146+
147+
For interactive components, load Lit hydration support before the client-side component definitions:
148+
149+
```typescript
150+
// src/_layouts/elements.ts
151+
import '@lit-labs/ssr-client/lit-element-hydrate-support.js';
152+
import '@nvidia-elements/core/alert/define.js';
153+
```
154+
155+
The server `componentModules` list and the browser `define.js` imports must include the same interactive components. Components that do not load in the browser remain static after Eleventy renders them.

projects/site/src/docs/integrations/index.11ty.js

Lines changed: 3 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,10 @@
1+
import { siteData } from '../../index.11tydata.js';
2+
13
export const data = {
24
title: 'Integrations',
35
layout: 'docs.11ty.js'
46
};
57

6-
const integrations = [
7-
{
8-
href: '/docs/integrations/angular/',
9-
icon: 'angular.svg',
10-
title: 'Angular',
11-
description: 'Use Elements with Angular templates and events.'
12-
},
13-
{
14-
href: '/docs/integrations/bundles/',
15-
icon: 'javascript.svg',
16-
title: 'Bundles',
17-
description: 'Load prebuilt Elements bundles in static pages.'
18-
},
19-
{
20-
href: '/docs/integrations/cdn/',
21-
nveIcon: 'globe-alt-stroke',
22-
title: 'CDN',
23-
description: 'Load Elements from CDN-hosted npm packages.'
24-
},
25-
{
26-
href: '/docs/integrations/custom-elements/',
27-
nveIcon: 'code',
28-
title: 'Custom Elements',
29-
description: 'Use Elements package metadata with Web Component tooling.'
30-
},
31-
{
32-
href: '/docs/integrations/go/',
33-
icon: 'go.svg',
34-
iconSize: '48',
35-
title: 'Golang',
36-
description: 'Use Elements with Go-backed web applications.'
37-
},
38-
{
39-
href: '/docs/integrations/go-htmx/',
40-
icon: 'htmx.svg',
41-
iconHeight: '32',
42-
iconWidth: '48',
43-
title: 'HTMX + Go',
44-
description: 'Use Elements with HTMX and Go template fragments.'
45-
},
46-
{
47-
href: '/docs/integrations/hugo/',
48-
icon: 'hugo.svg',
49-
iconSize: '28px',
50-
title: 'Hugo',
51-
description: 'Use Elements in Hugo static sites.'
52-
},
53-
{
54-
href: '/docs/integrations/importmaps/',
55-
icon: 'javascript.svg',
56-
title: 'Import Maps',
57-
description: 'Load Elements from browser-native import maps.'
58-
},
59-
{
60-
href: '/docs/integrations/lit/',
61-
icon: 'lit.svg',
62-
title: 'Lit',
63-
description: 'Use Elements alongside Lit components and SSR.'
64-
},
65-
{
66-
href: '/docs/integrations/lit-library/',
67-
icon: 'lit.svg',
68-
title: 'Lit Library',
69-
description: 'Build a distributable Custom Element library with Lit and Elements.'
70-
},
71-
{
72-
href: '/docs/integrations/mcp-apps/',
73-
nveIcon: 'connected-blocks',
74-
title: 'MCP Apps',
75-
description: 'Use Elements in iframe-based MCP UI hosts.'
76-
},
77-
{
78-
href: '/docs/integrations/nextjs/',
79-
icon: 'nextjs.svg',
80-
iconSize: '28px',
81-
title: 'NextJS',
82-
description: 'Use Elements with NextJS and React.'
83-
},
84-
{
85-
href: '/docs/integrations/nuxt/',
86-
icon: 'nuxt.svg',
87-
iconSize: '38px',
88-
title: 'Nuxt',
89-
description: 'Use Elements with Nuxt applications.'
90-
},
91-
{
92-
href: '/docs/integrations/preact/',
93-
icon: 'preact.svg',
94-
title: 'Preact',
95-
description: 'Use Elements with Preact JSX and custom events.'
96-
},
97-
{
98-
href: '/docs/integrations/react/',
99-
icon: 'react.svg',
100-
title: 'React',
101-
description: 'Use Elements with React and native custom events.'
102-
},
103-
{
104-
href: '/docs/integrations/solidjs/',
105-
icon: 'solidjs.svg',
106-
title: 'SolidJS',
107-
description: 'Use Elements with SolidJS and Vite.'
108-
},
109-
{
110-
href: '/docs/integrations/svelte/',
111-
icon: 'svelte.svg',
112-
title: 'Svelte',
113-
description: 'Use Elements with Svelte and Vite.'
114-
},
115-
{
116-
href: '/docs/integrations/typescript/',
117-
icon: 'typescript.svg',
118-
title: 'TypeScript',
119-
description: 'Use Elements with TypeScript and Vite.'
120-
},
121-
{
122-
href: '/docs/integrations/vue/',
123-
icon: 'vue.svg',
124-
title: 'Vue',
125-
description: 'Use Elements with Vue and Vite.'
126-
}
127-
];
128-
1298
const renderLogo = ({ icon, iconHeight, iconSize = '36px', iconWidth, nveIcon, title, color = 'gray-denim' }) => {
1309
if (icon) {
13110
return /* html */ `<nve-logo color="${color}" size="lg">
@@ -176,7 +55,7 @@ export function render(data) {
17655
<h2 nve-text="heading sm muted">Use NVIDIA Elements across frameworks, runtimes, and Web Component tooling.</h2>
17756
17857
<div class="integrations-page" nve-layout="grid gap:md span-items:12 &md|span-items:6 &lg|span-items:4">
179-
${integrations.map(renderIntegration).join('\n')}
58+
${Object.values(siteData.integrations).map(renderIntegration).join('\n')}
18059
</div>`,
18160
'md'
18261
);

projects/site/src/docs/integrations/nuxt.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
{
33
title: 'Nuxt',
4-
description: 'Use NVIDIA Elements in a Nuxt app: register the components, configure SSR, and bind to events in Vue single-file components.',
4+
description: 'Use NVIDIA Elements in a Nuxt app: register components, configure SSR, bind native form controls with v-model, and handle custom events.',
55
layout: 'docs.11ty.js'
66
}
77
---
@@ -96,6 +96,39 @@ Properties and events then work via the standard Vue template syntax.
9696
</nve-alert-group>
9797
```
9898

99+
## Form controls
100+
101+
Place `v-model` on the nested native `<input>`, not on the `nve-input`, `nve-range`, or `nve-switch` wrapper. The native control owns the value or checked state that Vue updates.
102+
103+
```typescript
104+
import { ref } from 'vue';
105+
import '@nvidia-elements/core/forms/define.js';
106+
import '@nvidia-elements/core/input/define.js';
107+
import '@nvidia-elements/core/range/define.js';
108+
import '@nvidia-elements/core/switch/define.js';
109+
110+
const name = ref('');
111+
const volume = ref(50);
112+
const notifications = ref(false);
113+
```
114+
115+
```html
116+
<nve-input>
117+
<label>Name</label>
118+
<input v-model="name" type="text" />
119+
</nve-input>
120+
121+
<nve-range>
122+
<label>Volume</label>
123+
<input v-model.number="volume" type="range" min="0" max="100" />
124+
</nve-range>
125+
126+
<nve-switch>
127+
<label>Notifications</label>
128+
<input v-model="notifications" type="checkbox" />
129+
</nve-switch>
130+
```
131+
99132
## Layouts
100133

101134
Use Elements within Nuxt layouts to create consistent page structures.

0 commit comments

Comments
 (0)