Skip to content

chore(docs): add component preview to card list - #202

Open
coryrylan wants to merge 1 commit into
mainfrom
topic-docs-improvements
Open

chore(docs): add component preview to card list#202
coryrylan wants to merge 1 commit into
mainfrom
topic-docs-improvements

Conversation

@coryrylan

@coryrylan coryrylan commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator
  • add small inline preview of the component to the card
  • large components like monaco have small mock html/css inlined visuals
Screenshot 2026-07-31 at 11 20 01 AM

Summary by CodeRabbit

  • New Features

    • Component documentation now includes interactive preview cards with responsive layouts, nested examples, loading states, and error handling.
    • The documentation grid adapts more effectively across screen sizes.
  • Updates

    • Simplified the default gauge example to display a single 66% accent-status gauge.
    • Integrated Codeblock, Markdown, Markdown CSS, and Monaco pages into the Elements documentation navigation.
    • Clarified tooltip guidance and refreshed component descriptions.

@coryrylan
coryrylan requested a review from johnyanarella July 31, 2026 16:26
@coryrylan coryrylan self-assigned this Jul 31, 2026
Copilot AI review requested due to automatic review settings July 31, 2026 16:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Comment thread projects/site/src/docs/elements/index.11ty.js Fixed
Comment thread projects/site/src/docs/elements/index.11ty.js Fixed
Comment thread projects/site/src/docs/elements/index.11ty.js Fixed
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The documentation site now renders lazily loaded interactive component previews with sanitized templates, mocks, metadata, and responsive styling. Navigation consolidates Code, Monaco, and Markdown entries under Elements. Component descriptions and examples receive content updates.

Changes

Documentation previews and navigation

Layer / File(s) Summary
Preview catalog and templates
projects/site/src/docs/elements/index.11ty.js
The documentation generator adds sanitized templates, safe URL handling, component mocks, Monaco variants, and preview metadata.
Preview cards and lazy loading
projects/site/src/docs/elements/index.11ty.js
Preview cards lazy-load modules, initialize preview data, await updates, and report readiness or errors.
Preview card presentation
projects/site/src/docs/elements/index.11ty.js
Styles define preview cards, mocks, editors, panels, layouts, and responsive grid breakpoints.
Elements navigation consolidation
projects/site/src/_11ty/layouts/common.js
Code, Monaco, and Markdown entries move under the Elements navigation group.
Example and component description updates
projects/core/src/gauge/gauge.examples.ts, projects/markdown/src/markdown/markdown.examples.ts, projects/core/src/{dialog,drawer,notification,toast,tooltip}/*.ts
The default examples change their rendered content. Component descriptions remove external references and clarify tooltip restrictions.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant IntersectionObserver
  participant PreviewLoader
  participant ComponentModule
  IntersectionObserver->>PreviewLoader: observe preview card
  PreviewLoader->>ComponentModule: import required module
  PreviewLoader->>ComponentModule: initialize preview data
  ComponentModule-->>PreviewLoader: component update
  PreviewLoader-->>IntersectionObserver: mark preview ready or error
Loading

Possibly related PRs

Suggested reviewers: johnyanarella

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main documentation change: adding component previews to the card list.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch topic-docs-improvements

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

projects/core/src/dialog/dialog.ts

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.

projects/core/src/drawer/drawer.ts

ESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox.

projects/core/src/gauge/gauge.examples.ts

ESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox.

  • 6 others

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 9

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@projects/site/src/docs/elements/index.11ty.js`:
- Line 38: Update stripScripts to allow optional whitespace before the closing
angle bracket in </script> end tags, and repeatedly apply the replacement until
the template output no longer changes. Preserve the existing trimming behavior
and ensure residual or overlapping <script fragments are removed once the result
stabilizes.
- Around line 338-340: Update the generated script value in renderPreviewScript,
specifically the component tag and import entrypoint serialization around
component.imports.map, to escape the HTML-sensitive `</script` sequence after
JSON.stringify. Use a small shared helper for safe inline-script serialization
and apply it to both serialized values without changing the generated
module-loading behavior.
- Around line 431-443: Update the .component-preview[data-preview-ready]
.component-preview-content rule to reset the initial scale transform to full
size, and extend the .component-preview-content transition to include transform
alongside opacity.
- Around line 409-415: Add a .component-card-link:focus-visible rule that
applies a clear visible outline to the overlay link, ensuring keyboard focus
remains distinguishable while preserving the existing card-link positioning and
default non-focused appearance.
- Around line 54-57: Add a concise comment immediately above renderMonacoMock
documenting that tags containing “diff” return the two-pane Changes markup, tags
containing “problems” return the Problems list markup, and other tags return the
default pipeline.ts markup; keep the existing substring-based selection logic
unchanged.
- Around line 356-358: Guard the nve-sparkline lookup in the preview
initialization block with optional chaining before assigning its data, so a
missing element is skipped without throwing. Keep the existing sparkline data
and allow the remaining preview setup to continue normally.
- Line 324: Update the heading interpolation in the component rendering template
to pass component.title through the existing escapeHtml helper, matching the
escaping already used for the description and aria-label values.
- Around line 208-249: Add CSS rules in the <style> block for the
data-preview-size values produced by getPreviewSize, overriding
.component-preview’s fixed height so large previews (including nve-page and
nve-grid) are not clipped and wide previews receive their intended sizing. Keep
renderComponentCard’s data-preview-size attribute and the existing largePreviews
and widePreviews classifications intact.
- Around line 287-306: Collapse the chained maps in the component entry
construction into a single map. Within that map, call
getPreviewTemplate(component.tag) and construct each object once with
getPreviewImports(preview), preview, and getPreviewSize(component.tag), while
preserving the existing fields and final sortByTitle ordering.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 9487593d-b539-4fd9-87dd-5d7f81d41efa

📥 Commits

Reviewing files that changed from the base of the PR and between 651abf3 and 670501c.

📒 Files selected for processing (2)
  • projects/core/src/gauge/gauge.examples.ts
  • projects/site/src/docs/elements/index.11ty.js

Comment thread projects/site/src/docs/elements/index.11ty.js Outdated
Comment thread projects/site/src/docs/elements/index.11ty.js
Comment on lines +208 to +249
const largePreviews = new Set([
'nve-card',
'nve-grid',
'nve-markdown',
'nve-menu',
'nve-page',
'nve-panel',
'nve-tree'
]);

const widePreviews = new Set([
'nve-accordion',
'nve-alert',
'nve-breadcrumb',
'nve-button-group',
'nve-chat-message',
'nve-codeblock',
'nve-combobox',
'nve-control',
'nve-dropzone',
'nve-input',
'nve-input-group',
'nve-page-header',
'nve-pagination',
'nve-preferences-input',
'nve-progress-bar',
'nve-progressive-filter-chip',
'nve-radio',
'nve-search',
'nve-select',
'nve-skeleton',
'nve-sparkline',
'nve-star-rating',
'nve-steps',
'nve-tabs',
'nve-textarea',
'nve-time',
'nve-toolbar',
'nve-week'
]);

const getPreviewSize = tag => (largePreviews.has(tag) ? 'large' : widePreviews.has(tag) ? 'wide' : 'default');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

previewSize is computed and serialized, but no CSS consumes it.

getPreviewSize classifies each tag as large, wide, or default. renderComponentCard writes the result to data-preview-size at line 316. The <style> block at lines 398-626 contains no [data-preview-size] selector, so .component-preview keeps a fixed height: 180px for every card. Large previews such as nve-page (260px tall) and nve-grid are then clipped by overflow: hidden, and the two Sets are dead configuration.

Add rules for the two size variants, or remove largePreviews, widePreviews, getPreviewSize, and the data-preview-size attribute.

🎨 Proposed CSS rules for the size variants

Add inside the <style> block, after the .component-preview rule:

+  .component-preview[data-preview-size='wide'] {
+    height: 200px;
+  }
+
+  .component-preview[data-preview-size='large'] {
+    height: 280px;
+  }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@projects/site/src/docs/elements/index.11ty.js` around lines 208 - 249, Add
CSS rules in the <style> block for the data-preview-size values produced by
getPreviewSize, overriding .component-preview’s fixed height so large previews
(including nve-page and nve-grid) are not clipped and wide previews receive
their intended sizing. Keep renderComponentCard’s data-preview-size attribute
and the existing largePreviews and widePreviews classifications intact.

Comment thread projects/site/src/docs/elements/index.11ty.js Outdated
Comment thread projects/site/src/docs/elements/index.11ty.js Outdated
Comment thread projects/site/src/docs/elements/index.11ty.js Outdated
Comment thread projects/site/src/docs/elements/index.11ty.js
Comment thread projects/site/src/docs/elements/index.11ty.js
Comment on lines +431 to +443
.component-preview-content {
display: grid;
place-items: center;
width: 100%;
height: 100%;
opacity: 0;
transform: scale(0.82);
transition: opacity var(--nve-ref-animation-duration-150);
}

.component-preview[data-preview-ready] .component-preview-content {
opacity: 1;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

The scale(0.82) transform is never reset, so every preview stays shrunk.

Line 437 applies transform: scale(0.82). Line 438 transitions opacity only. The ready rule at lines 441-443 changes opacity alone. No rule removes the transform, so each preview renders permanently at 82% scale instead of animating to full size. Reset the transform in the ready state and include it in the transition.

🐛 Proposed fix
     opacity: 0;
     transform: scale(0.82);
-    transition: opacity var(--nve-ref-animation-duration-150);
+    transition:
+      opacity var(--nve-ref-animation-duration-150),
+      transform var(--nve-ref-animation-duration-150);
   }
 
   .component-preview[data-preview-ready] .component-preview-content {
     opacity: 1;
+    transform: scale(1);
   }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.component-preview-content {
display: grid;
place-items: center;
width: 100%;
height: 100%;
opacity: 0;
transform: scale(0.82);
transition: opacity var(--nve-ref-animation-duration-150);
}
.component-preview[data-preview-ready] .component-preview-content {
opacity: 1;
}
.component-preview-content {
display: grid;
place-items: center;
width: 100%;
height: 100%;
opacity: 0;
transform: scale(0.82);
transition:
opacity var(--nve-ref-animation-duration-150),
transform var(--nve-ref-animation-duration-150);
}
.component-preview[data-preview-ready] .component-preview-content {
opacity: 1;
transform: scale(1);
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@projects/site/src/docs/elements/index.11ty.js` around lines 431 - 443, Update
the .component-preview[data-preview-ready] .component-preview-content rule to
reset the initial scale transform to full size, and extend the
.component-preview-content transition to include transform alongside opacity.

Copilot AI review requested due to automatic review settings July 31, 2026 17:08
@coryrylan
coryrylan force-pushed the topic-docs-improvements branch from 670501c to d628c13 Compare July 31, 2026 17:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@projects/site/src/docs/elements/index.11ty.js`:
- Around line 359-380: Bound the custom element definition wait in the
preview-loading flow by adding a timeout or equivalent settled fallback around
customElements.whenDefined(name), so an unregistered nve-* tag cannot block
Promise.all indefinitely. Ensure timeout failures are handled by the existing
error path and preview.dataset.previewReady is always set, including when
definition waiting fails or times out.
- Around line 36-57: Remove the redundant `xlink:href` entry from
`previewUrlAttributes`; `sanitizePreviewNode` should continue handling
namespaced xlink attributes through the existing `href` name check and
`isSafePreviewUrl` validation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 55593e3b-d155-4e9b-9ee7-578fc3a54f37

📥 Commits

Reviewing files that changed from the base of the PR and between 670501c and d628c13.

📒 Files selected for processing (2)
  • projects/core/src/gauge/gauge.examples.ts
  • projects/site/src/docs/elements/index.11ty.js

Comment thread projects/site/src/docs/elements/index.11ty.js
Comment thread projects/site/src/docs/elements/index.11ty.js
- add small inline preview of the component to the card
- large components like monaco have small mock html/css inlined visuals

Signed-off-by: Cory Rylan <crylan@nvidia.com>
@coryrylan
coryrylan force-pushed the topic-docs-improvements branch from d628c13 to db101b8 Compare July 31, 2026 21:27
Copilot AI review requested due to automatic review settings July 31, 2026 21:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@projects/core/src/drawer/drawer.ts`:
- Line 21: Update the JSDoc description for the Drawer symbol to use
grammatically correct singular wording and a direct description of its purpose,
preserving the existing examples of notifications, navigation, and settings.

In `@projects/core/src/notification/notification.ts`:
- Line 23: Update the JSDoc `@description` for the notification symbol to use
“real-time” as the modifier for “updates” and simplify the sentence according to
the repository’s technical writing style, while preserving the meaning that
notifications communicate important messages or status without interrupting the
user’s workflow.

In `@projects/core/src/tooltip/tooltip.ts`:
- Line 20: Update the JSDoc description for the tooltip component to state its
behavior directly with grammatically parallel wording, covering that it appears
on hover, focus, or tap and cannot contain interactive elements. Keep the change
limited to the description text and follow the repository’s technical writing
style.

In `@projects/site/src/docs/elements/index.11ty.js`:
- Around line 387-407: Update the preview sizing around
.component-preview-content and its corresponding styles near the additional
occurrence so .preview-page and .preview-editor mocks fit entirely within their
.component-preview containers, including narrow single-column and two-column
spans. Increase the dedicated container height or apply sufficient scaling based
on each mock’s dimensions, while preserving the existing centered layout and
avoiding clipping.
- Around line 339-356: The IntersectionObserver lifecycle and fallback loading
need adjustment in the preview initialization flow. Update the observer callback
around observer.unobserve and loadPreview so it disconnects once all preview
targets have been handled, and change the fallback branch to schedule preview
loads in chunks rather than invoking loadPreview for every preview in one task;
preserve loading every preview when IntersectionObserver is unavailable.
- Around line 315-320: Bound the custom-element readiness wait in the preview
initialization flow around customElementNames and Promise.all so unregistered
nve-* elements cannot keep the preview pending indefinitely. Add a finite
timeout that rejects or otherwise releases the wait, while preserving immediate
completion for elements resolved by customElements.whenDefined(name).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 26e58148-e8c8-4338-b5d1-2a4129b4545f

📥 Commits

Reviewing files that changed from the base of the PR and between d628c13 and db101b8.

📒 Files selected for processing (9)
  • projects/core/src/dialog/dialog.ts
  • projects/core/src/drawer/drawer.ts
  • projects/core/src/gauge/gauge.examples.ts
  • projects/core/src/notification/notification.ts
  • projects/core/src/toast/toast.ts
  • projects/core/src/tooltip/tooltip.ts
  • projects/markdown/src/markdown/markdown.examples.ts
  • projects/site/src/_11ty/layouts/common.js
  • projects/site/src/docs/elements/index.11ty.js

/**
* @element nve-drawer
* @description Drawer are to display content that is out of context of the rest of the page (notifications, navigation, settings). Or use [Panel](./docs/elements/panel/) inline as its content couples with or closely relates to the content on the page (details, extra actions/options). [MDN Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API)
* @description Drawer are to display content that is out of context of the rest of the page (notifications, navigation, settings).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Fix the drawer description grammar.

Drawer are is incorrect. Use a singular subject and a direct description.

As per coding guidelines, TypeScript JSDoc comments are linted by Vale and should follow the repository's technical writing style.

Proposed wording
- * `@description` Drawer are to display content that is out of context of the rest of the page (notifications, navigation, settings).
+ * `@description` A drawer displays content separate from the rest of the page, such as notifications, navigation, or settings.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
* @description Drawer are to display content that is out of context of the rest of the page (notifications, navigation, settings).
* `@description` A drawer displays content separate from the rest of the page, such as notifications, navigation, or settings.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@projects/core/src/drawer/drawer.ts` at line 21, Update the JSDoc description
for the Drawer symbol to use grammatically correct singular wording and a direct
description of its purpose, preserving the existing examples of notifications,
navigation, and settings.

Source: Coding guidelines

/**
* @element nve-notification
* @description Displays real time updates without interrupting the user's workflow to communicate an important message or status. [MDN Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API)
* @description Displays real time updates without interrupting the user's workflow to communicate an important message or status.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Clarify and hyphenate the notification description.

Use real-time when it modifies updates. The current sentence is also more complex than necessary.

As per coding guidelines, TypeScript JSDoc comments are linted by Vale and should follow the repository's technical writing style.

Proposed wording
- * `@description` Displays real time updates without interrupting the user's workflow to communicate an important message or status.
+ * `@description` Displays important messages or status updates without interrupting the user's workflow.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@projects/core/src/notification/notification.ts` at line 23, Update the JSDoc
`@description` for the notification symbol to use “real-time” as the modifier for
“updates” and simplify the sentence according to the repository’s technical
writing style, while preserving the meaning that notifications communicate
important messages or status without interrupting the user’s workflow.

Source: Coding guidelines

/**
* @element nve-tooltip
* @description A contextual popup that displays a plaintext description. Tooltips are [triggered](https://w3c.github.io/aria/#tooltip) by hovering, focusing, or tapping an element and cannot have interactive elements within them. [MDN Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API)
* @description A contextual popup that displays a plaintext description. Trigger tooltips by hovering, focusing, or tapping an element and cannot have interactive elements within them.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Fix the tooltip description grammar.

The sentence joins an imperative with a separate subject. State the tooltip behavior directly.

As per coding guidelines, TypeScript JSDoc comments are linted by Vale and should follow the repository's technical writing style.

Proposed wording
- * `@description` A contextual popup that displays a plaintext description. Trigger tooltips by hovering, focusing, or tapping an element and cannot have interactive elements within them.
+ * `@description` A contextual popup that displays a plain-text description. Tooltips are triggered by hovering over, focusing on, or tapping an element and cannot contain interactive elements.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
* @description A contextual popup that displays a plaintext description. Trigger tooltips by hovering, focusing, or tapping an element and cannot have interactive elements within them.
* `@description` A contextual popup that displays a plain-text description. Tooltips are triggered by hovering over, focusing on, or tapping an element and cannot contain interactive elements.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@projects/core/src/tooltip/tooltip.ts` at line 20, Update the JSDoc
description for the tooltip component to state its behavior directly with
grammatically parallel wording, covering that it appears on hover, focus, or tap
and cannot contain interactive elements. Keep the change limited to the
description text and follow the repository’s technical writing style.

Source: Coding guidelines

Comment on lines +315 to +320
const customElementNames = new Set(
[...preview.querySelectorAll('*')]
.map(element => element.localName)
.filter(name => name.startsWith('nve-'))
);
await Promise.all([...customElementNames].map(name => customElements.whenDefined(name)));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Find the docs page entrypoint imports and every registered custom element name.
set -uo pipefail

fd -t f 'docs.ts' projects/site/src --exec rg -n '^\s*import' {} \;
fd -t f -e ts -e js . projects/site/src --exec rg -ln 'customElements\.define|`@customElement`' {} \;

Repository: NVIDIA/elements

Length of output: 1451


🏁 Script executed:

#!/bin/bash
set -u

printf '%s\n' '--- target file context ---'
sed -n '270,355p' projects/site/src/docs/elements/index.11ty.js

printf '%s\n' '--- docs.ts candidates and imports ---'
fd -t f -i 'docs.ts' projects/site/src --exec sh -c 'echo "### $1"; sed -n "1,180p" "$1"' sh {}

printf '%s\n' '--- package and site entrypoint references ---'
rg -n --glob 'package.json' --glob '*.11ty.js' --glob '*.js' --glob '*.ts' \
  'docs\.ts|index\.11ty|component-preview|componentPreview|customElements\.whenDefined|customElements\.define|`@customElement`' \
  projects/site package.json 2>/dev/null | head -300

Repository: NVIDIA/elements

Length of output: 15920


🏁 Script executed:

#!/bin/bash
set -u

printf '%s\n' '--- docs layout and generated script inclusion ---'
sed -n '1,120p' projects/site/src/_11ty/layouts/docs.11ty.js
sed -n '1,90p' projects/site/src/_11ty/layouts/docs.ts
sed -n '330,430p' projects/site/src/docs/elements/index.11ty.js

printf '%s\n' '--- preview generation and component metadata ---'
sed -n '1,275p' projects/site/src/docs/elements/index.11ty.js
rg -n --glob '*.js' --glob '*.ts' --glob '*.json' \
  'component\.tag|tag:\s*['"'"'"]nve-|elements.*entry|custom-elements|`@nvidia-elements`|register' \
  projects/site package.json

printf '%s\n' '--- relevant site/build configuration ---'
rg -n --glob 'package.json' --glob '*.js' --glob '*.ts' --glob '*.json' \
  'docs\.11ty|layouts/docs|rollup|vite|entry|bundle|components' \
  projects/site package.json | head -300

Repository: NVIDIA/elements

Length of output: 50371


🏁 Script executed:

#!/bin/bash
set -u

printf '%s\n' '--- Eleventy component entrypoint selection ---'
sed -n '45,145p' projects/site/eleventy.config.js

printf '%s\n' '--- base head and component scripts ---'
rg -n -A35 -B10 'function renderBaseHead|const renderBaseHead|renderBaseHead|entrypoints|componentModules|define\.js|bundles/index' \
  projects/site/src/_11ty/layouts/common.js projects/site/eleventy.config.js

printf '%s\n' '--- component names and package metadata sources ---'
rg -n --glob '*.json' --glob '*.js' --glob '*.ts' \
  '"name":\s*"nve-|customElements|custom-elements|metadata.*entrypoint|entrypoint.*define' \
  packages projects 2>/dev/null | head -400

printf '%s\n' '--- exact preview tag universe ---'
python3 - <<'PY'
from pathlib import Path
import re
p = Path('projects/site/src/docs/elements/index.11ty.js').read_text()
for m in re.finditer(r"'(nve-[^']+)'", p):
    print(m.group(1))
PY

Repository: NVIDIA/elements

Length of output: 50372


🏁 Script executed:

#!/bin/bash
set -u
LOG=/tmp/coderabbit-shell-logs/shell-output-T0lemJ

printf '%s\n' '--- concise entrypoint configuration ---'
sed -n '1,115p' "$LOG"

printf '%s\n' '--- concise base-head matches ---'
rg -n -A25 -B8 'renderBaseHead|componentModules|entrypoints|bundles/index|define\.js' "$LOG" | head -240

printf '%s\n' '--- exact preview tags ---'
rg -n '^nve-' "$LOG" | tail -100

Repository: NVIDIA/elements

Length of output: 22955


🏁 Script executed:

#!/bin/bash
set -u

printf '%s\n' '--- base head body ---'
sed -n '17,115p' projects/site/src/_11ty/layouts/common.js

printf '%s\n' '--- page runtime imports ---'
rg -n '^import|^void import|customElements\.whenDefined' \
  projects/site/src/_11ty/layouts/docs.ts projects/site/src/_internal/canvas/canvas.ts \
  projects/site/src/_internal/search/search.ts

printf '%s\n' '--- metadata shape and registered entrypoint coverage ---'
python3 - <<'PY'
import json
from pathlib import Path

path = Path('projects/internals/metadata/static/projects.json')
data = json.loads(path.read_text())
print(type(data).__name__)
if isinstance(data, dict):
    print('top-level keys:', sorted(data.keys()))
    projects = data.get('projects', data.get('data', []))
else:
    projects = data
print('project count:', len(projects) if isinstance(projects, list) else 'not-list')

for project in projects if isinstance(projects, list) else []:
    if project.get('name') == '`@nvidia-elements/core`':
        print('core keys:', sorted(project.keys()))
        elements = project.get('elements', project.get('manifest', {}).get('elements', []))
        print('core element count:', len(elements) if isinstance(elements, list) else 'not-list')
        for element in elements if isinstance(elements, list) else []:
            name = element.get('name') or element.get('tag') or element.get('customElement')
            meta = element.get('manifest', {}).get('metadata', element.get('metadata', {}))
            entry = meta.get('entrypoint') if isinstance(meta, dict) else None
            if name and name.startswith('nve-'):
                print(f'{name}\t{entry}')
PY

printf '%s\n' '--- standalone promise behavior probe ---'
node - <<'JS'
const pending = new Promise(() => {});
const timeout = new Promise(resolve => setTimeout(() => resolve('timeout'), 5));
Promise.race([pending, timeout]).then(value => console.log(value));
setTimeout(() => console.log('underlying promise remains pending:', true), 10);
JS

Repository: NVIDIA/elements

Length of output: 8597


🏁 Script executed:

#!/bin/bash
set -u

python3 - <<'PY'
from pathlib import Path
import re

runtime = '\n'.join(Path(p).read_text() for p in [
    'projects/site/src/_11ty/layouts/docs.ts',
    'projects/site/src/_internal/canvas/canvas.ts',
    'projects/site/src/_internal/search/search.ts',
])
imports = set(re.findall(r"`@nvidia-elements/`[^'\" ]+/([^/'\" ]+)/define\.js", runtime))
runtime_tags = sorted(set(re.findall(r"`@nvidia-elements/`[^'\" ]+/([^/'\" ]+)/define\.js", runtime)))
print('runtime define entrypoints:', runtime_tags)

preview_source = Path('projects/site/src/docs/elements/index.11ty.js').read_text()
preview_tags = sorted(set(re.findall(r"'(nve-[a-z0-9-]+)'", preview_source)))
print('literal preview override tags:', preview_tags)
print('preview tags with no matching runtime entrypoint name:', [
    tag for tag in preview_tags
    if tag.removeprefix('nve-') not in imports
])

print('docs browser module imports:')
for line in Path('projects/site/src/_11ty/layouts/docs.11ty.js').read_text().splitlines():
    if 'import ' in line and '<script' not in line:
        print(line.strip())
PY

node - <<'JS'
const definitions = new Map([['nve-progress-ring', Promise.resolve()]]);
const customElements = {
  whenDefined(name) {
    return definitions.get(name) ?? new Promise(() => {});
  }
};
const names = ['nve-grid', 'nve-progress-ring'];
const wait = Promise.all(names.map(name => customElements.whenDefined(name)));
const result = await Promise.race([
  wait.then(() => 'all-defined'),
  new Promise(resolve => setTimeout(() => resolve('timeout'), 5))
]);
console.log({ result });
JS

Repository: NVIDIA/elements

Length of output: 1619


Bound the customElements.whenDefined wait.

The docs browser entrypoint does not register preview elements such as nve-grid or nve-tree. If a preview contains an unregistered nve-* element, Promise.all(...) remains pending, so the preview never becomes ready. Enforce a timeout without retaining an unbounded wait.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@projects/site/src/docs/elements/index.11ty.js` around lines 315 - 320, Bound
the custom-element readiness wait in the preview initialization flow around
customElementNames and Promise.all so unregistered nve-* elements cannot keep
the preview pending indefinitely. Add a finite timeout that rejects or otherwise
releases the wait, while preserving immediate completion for elements resolved
by customElements.whenDefined(name).

Comment on lines +339 to +356
const previews = document.querySelectorAll('[data-component-preview]');

if ('IntersectionObserver' in globalThis) {
const observer = new IntersectionObserver(
entries => {
entries.forEach(entry => {
if (!entry.isIntersecting) return;
observer.unobserve(entry.target);
void loadPreview(entry.target);
});
},
{ rootMargin: '300px 0px' }
);

previews.forEach(preview => observer.observe(preview));
} else {
previews.forEach(preview => void loadPreview(preview));
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value

The observer is never disconnected, and the fallback branch loads every preview at once.

Line 353 observes every card. Line 346 unobserves each entry after it intersects, so the observer stays alive with zero targets for the page lifetime. That is acceptable, but a disconnect() after the last target keeps the intent explicit.

The fallback at line 355 starts loadPreview for every card in the same task. Each call queries the whole subtree twice and awaits two animation frames. On a page with the full component catalog this creates one long task. Consider chunking the fallback, or accept it because IntersectionObserver is available in every supported browser.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@projects/site/src/docs/elements/index.11ty.js` around lines 339 - 356, The
IntersectionObserver lifecycle and fallback loading need adjustment in the
preview initialization flow. Update the observer callback around
observer.unobserve and loadPreview so it disconnects once all preview targets
have been handled, and change the fallback branch to schedule preview loads in
chunks rather than invoking loadPreview for every preview in one task; preserve
loading every preview when IntersectionObserver is unavailable.

Comment on lines +387 to +407
.component-preview {
position: relative;
display: grid;
place-items: center;
height: 180px;
overflow: hidden;
border-bottom: var(--nve-ref-border-width-sm) solid var(--nve-ref-border-color-muted);
background: color-mix(
in oklab,
var(--nve-sys-layer-container-accent-background) 70%,
transparent
);
}

.component-preview-content {
display: grid;
place-items: center;
width: 100%;
height: 100%;
transform: scale(0.85);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

.preview-page is clipped by the fixed 180px preview container.

.component-preview sets height: 180px and overflow: hidden. .preview-page is 260px tall and 560px wide. .component-preview-content scales by 0.85, so the page mock still needs about 221px of height and 476px of width. The nve-page card therefore shows a cropped mock. .preview-editor at 430px wide has the same problem in the narrow single-column and two-column grid spans defined at line 599.

Scale the oversized mocks to fit, or give them a dedicated container height.

🎨 Proposed fix
   .preview-page {
     width: 560px;
     height: 260px;
     overflow: hidden;
     background: var(--nve-sys-layer-canvas-background);
+    transform: scale(0.62);
   }

Also applies to: 463-468

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@projects/site/src/docs/elements/index.11ty.js` around lines 387 - 407, Update
the preview sizing around .component-preview-content and its corresponding
styles near the additional occurrence so .preview-page and .preview-editor mocks
fit entirely within their .component-preview containers, including narrow
single-column and two-column spans. Increase the dedicated container height or
apply sufficient scaling based on each mock’s dimensions, while preserving the
existing centered layout and avoiding clipping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants