You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore(docs): update agent documentation and component creation guidelines
- Revised descriptions in AGENTS.md for clarity and consistency.
- Updated component creation guidelines to reflect the use of ButtonFormControlMixin instead of BaseButton.
- Enhanced metadata handling in various files, including eslint configurations and internal documentation.
- Added tests for new eslint rules regarding primitive properties and inheritance.
Signed-off-by: Cory Rylan <[email protected]>
Copy file name to clipboardExpand all lines: .agents/skills/component-creation/SKILL.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
name: component-creation
3
-
description: Guide for creating new Elements components with all required files, base classes, metadata patterns, and test boilerplate. Use this skill whenever the user wants to create, scaffold, or set up a new component from scratch, needs to understand the required 10-file structure, asks about base classes (LitElement vs BaseButton), define.ts vs index.ts patterns, static metadata, component registration, or sub-component parent relationships. Also trigger when the user mentions creating test boilerplate for all 5 test types.
3
+
description: Guide for creating new Elements components with all required files, base classes, metadata patterns, and test boilerplate. Use this skill whenever the user wants to create, scaffold, or set up a new component from scratch, needs to understand the required 10-file structure, asks about base classes and mixins (LitElement vs ButtonFormControlMixin), define.ts vs index.ts patterns, static metadata, component registration, or sub-component parent relationships. Also trigger when the user mentions creating test boilerplate for all 5 test types.
4
4
---
5
5
6
6
# Component Creation
@@ -12,7 +12,7 @@ You MUST review the component creation guideline before creating or modifying co
12
12
- Creating a new component from scratch
13
13
- Understanding the required file structure for components
14
14
- Setting up test boilerplate for all 5 test types
15
-
- Choosing the appropriate base class (BaseButton vs LitElement)
15
+
- Choosing the appropriate base class or mixin (ButtonFormControlMixin vs LitElement)
16
16
- Understanding component metadata and registration patterns
17
17
- Setting up JSDoc comments for components
18
18
@@ -22,8 +22,8 @@ Read the [component creation guide](projects/site/src/docs/internal/guidelines/c
22
22
23
23
## Workflow
24
24
25
-
1.**Gather requirements**:confirm the component name (kebab-case), purpose, and which base class to use (`LitElement`for most components, `BaseButton` for button-like interactive components).
26
-
2.**Study a reference**:read the closest reference component listed below to understand the pattern in practice.
25
+
1.**Gather requirements**:confirm the component name (kebab-case), purpose, and whether to use `LitElement`directly or apply `ButtonFormControlMixin` for button-like interactive components.
26
+
2.**Study a reference**:read the closest reference component listed below to understand the pattern in practice.
27
27
3.**Create the 10 required files** in `projects/core/src/<component-name>/`:
28
28
-`component-name.ts`:component class with metadata, JSDoc, and render method
29
29
-`component-name.css`:styles using CSS custom properties
@@ -35,10 +35,10 @@ Read the [component creation guide](projects/site/src/docs/internal/guidelines/c
-`define.ts`:registration using `define()` helper with `HTMLElementTagNameMap`
37
37
-`index.ts`:side-effect-free export
38
-
4.**Update bundle**:add`import '@nvidia-elements/core/<component-name>/define.js'` to `projects/core/src/bundle.ts` in alphabetical order so the component is registered in the bundle.
39
-
5.**Verify**:confirm all files follow the templates in the component creation guide, run `pnpm run lint` and `pnpm run test` from the elements project.
38
+
4.**Update bundle**:add `import '@nvidia-elements/core/<component-name>/define.js'` to `projects/core/src/bundle.ts` in alphabetical order so the bundle registers the component.
39
+
5.**Verify**:confirm all files follow the templates in the component creation guide, run `pnpm run lint` and `pnpm run test` from the elements project.
@@ -128,7 +135,7 @@ Each component in `/projects/core/src/` follows this structure:
128
135
129
136
```
130
137
component-name/
131
-
├── component-name.ts # Main component class (extends BaseButton, BaseElement, etc.)
138
+
├── component-name.ts # Main component class (extends LitElement or applies a forms mixin)
132
139
├── component-name.css # Component styles
133
140
├── component-name.examples.ts # Example templates for documentation
134
141
├── component-name.test.ts # Unit tests
@@ -140,9 +147,9 @@ component-name/
140
147
└── define.ts # Registers component to customElementsRegistry
141
148
```
142
149
143
-
Components typically extend Lit's `LitElement` directly. Shared behavior is provided via base classes (e.g., `BaseButton`) and reactive controllers (keynav, state management, i18n) from `@nvidia-elements/core/internal`. Components use Lit decorators for properties, CSS custom properties for theming, and follow ARIA Authoring Practices Guide patterns.
150
+
Components typically extend Lit's `LitElement` directly. Import forms mixins from `@nvidia-elements/forms/mixins`; reactive controllers and utilities remain under `@nvidia-elements/core/internal` for shared behavior such as keynav, state management, and i18n. Components use Lit decorators for properties, CSS custom properties for theming, and follow ARIA Authoring Practices Guide patterns.
144
151
145
-
When adding a new component, also add its `define.js` import and `export *` to `projects/elements/src/bundle.ts` (alphabetical order). This file is the entry point for the CDN bundle. A `lint:bundle` script validates completeness in CI.
152
+
When adding a new core component, also add its `define.js` import and `export *` to `projects/core/src/bundle.ts` (alphabetical order). This file is the entry point for the core CDN bundle. The `no-missing-bundle-registration` lint rule validates completeness in CI.
146
153
147
154
### Component Definition
148
155
@@ -181,18 +188,18 @@ declare global {
181
188
-**Vite** - Build tool for compiling TypeScript and bundling
182
189
-**Semantic Release** - Automated versioning and publishing based on conventional commits
183
190
184
-
Dependencies between projects are defined in Wireit configurations in each `package.json`. The build system intelligently rebuilds only what changed.
191
+
Wireit configurations in each `package.json` define dependencies between projects. The build system intelligently rebuilds only what changed.
**Important:**The subject line (first line after `type(scope):`) must be entirely lowercase. Avoid starting with proper nouns or using uppercase letters (e.g., use "add feature" not "Add feature", "update api" not "Update API").
226
+
**Important:**the subject line (first line after `type(scope):`) must be entirely lowercase. Avoid starting with proper nouns or using uppercase letters. For example, use "add feature," not "Add feature," and "update api," not "Update API."
Copy file name to clipboardExpand all lines: projects/internals/eslint/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,7 +56,7 @@ Applied to `src/**/*.ts`, `src/**/*.tsx`, test files, and `*.examples.ts`.
56
56
-**`require-composed-events`**. Any `CustomEvent` dispatched with `bubbles: true` must also set `composed: true`. Shadow DOM boundary crossing stays opt-in.
57
57
-**`reserved-property-names`**. Disallows `@property` / `@state` / `@event` names that collide with `HTMLElement` prototype keys, ARIA attributes, or native event handlers (case-insensitive).
58
58
-**`reserved-event-names`**. Disallows custom event names that collide with native HTMLElement events (`click`, `change`, `load`, …).
59
-
-**`primitive-property`**. Public `@property` members must use primitive types. The rule rejects `Array` and `Object` except for the `data`, `i18n`, and `stepSizes` conventions.
59
+
-**`primitive-property`**. Public `@property` members must use primitive types. The rule rejects `Array` and `Object` except for the `commandForElement`, `data`, `i18n`, and `stepSizes` conventions.
60
60
-**`stateless-property`**. The rule disallows `this.<publicProperty> = ...` assignments so public API stays read-only inside the component. `hidden` and `value` can still mutate for standard-element parity.
0 commit comments