-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
React: Auto calculate imports, support barrel files, auto detect. components and other small tweaks #32912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
React: Auto calculate imports, support barrel files, auto detect. components and other small tweaks #32912
Changes from 16 commits
a5f4646
17a3089
9331bf7
2b072ba
835417c
8ba3b0b
8d40e43
ce25a2f
7e9a30a
acf5925
2a05fc4
3de6fad
80b0ad2
08bdc82
8151722
50be8d7
70e8504
7ab7295
d9cc661
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -40,7 +40,7 @@ export function renderManifestComponentsPage(manifest: ComponentsManifest) { | |||||||||||||||||||
| entries.map(([, it]) => it).filter((it) => it.error), | ||||||||||||||||||||
| (manifest) => manifest.error?.name ?? 'Error' | ||||||||||||||||||||
| ) | ||||||||||||||||||||
| ); | ||||||||||||||||||||
| ).sort(([, a], [, b]) => b.length - a.length); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| const errorGroupsHTML = errorGroups | ||||||||||||||||||||
| .map(([error, grouped]) => { | ||||||||||||||||||||
|
|
@@ -517,15 +517,23 @@ export function renderManifestComponentsPage(manifest: ComponentsManifest) { | |||||||||||||||||||
| .card > .tg-err:checked ~ .panels .panel-err { | ||||||||||||||||||||
| display: grid; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| .card > .tg-warn:checked ~ .panels .panel-warn { | ||||||||||||||||||||
| display: grid; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| .card > .tg-stories:checked ~ .panels .panel-stories { | ||||||||||||||||||||
| display: grid; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
Comment on lines
+520
to
527
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove or complete empty CSS rule blocks. These CSS rule blocks appear to be incomplete or placeholder code. They should either be removed or completed with the intended styles. -
- .card > .tg-warn:checked ~ .panels .panel-warn {
- display: grid;
- }
-
- .card > .tg-stories:checked ~ .panels .panel-stories {
- display: grid;
- }📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
|
|
||||||||||||||||||||
| /* Add vertical spacing around panels only when any panel is visible */ | ||||||||||||||||||||
| .card > .tg-err:checked ~ .panels, | ||||||||||||||||||||
| .card > .tg-warn:checked ~ .panels, | ||||||||||||||||||||
| .card > .tg-stories:checked ~ .panels, | ||||||||||||||||||||
| .card > .tg-props:checked ~ .panels { | ||||||||||||||||||||
| margin: 10px 0; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| /* Optional: a subtle 1px ring on the active badge, using :has() if available */ | ||||||||||||||||||||
| @supports selector(.card:has(.tg-err:checked)) { | ||||||||||||||||||||
| .card:has(.tg-err:checked) label[for$='-err'], | ||||||||||||||||||||
|
|
@@ -536,6 +544,25 @@ export function renderManifestComponentsPage(manifest: ComponentsManifest) { | |||||||||||||||||||
| border-color: currentColor; | ||||||||||||||||||||
| } | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| /* Wrap long lines in code blocks at ~120 characters */ | ||||||||||||||||||||
| pre, code { | ||||||||||||||||||||
| font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; | ||||||||||||||||||||
| } | ||||||||||||||||||||
| pre { | ||||||||||||||||||||
| white-space: pre-wrap; | ||||||||||||||||||||
| overflow-wrap: anywhere; | ||||||||||||||||||||
| word-break: break-word; | ||||||||||||||||||||
| overflow-x: auto; /* fallback for extremely long tokens */ | ||||||||||||||||||||
| margin: 8px 0 0; | ||||||||||||||||||||
| } | ||||||||||||||||||||
| pre > code { | ||||||||||||||||||||
| display: block; | ||||||||||||||||||||
| white-space: inherit; | ||||||||||||||||||||
| overflow-wrap: inherit; | ||||||||||||||||||||
| word-break: inherit; | ||||||||||||||||||||
| inline-size: min(100%, 120ch); | ||||||||||||||||||||
| } | ||||||||||||||||||||
| </style> | ||||||||||||||||||||
| </head> | ||||||||||||||||||||
| <body> | ||||||||||||||||||||
|
|
@@ -747,19 +774,36 @@ function renderComponentCard(key: string, c: ComponentManifest, id: string) { | |||||||||||||||||||
| <span class="ex-name">${esc(ex.name)}</span> | ||||||||||||||||||||
| <span class="badge err">story error</span> | ||||||||||||||||||||
| </div> | ||||||||||||||||||||
| ${ex?.summary ? `<div>${esc(ex.summary)}</div>` : ''} | ||||||||||||||||||||
| ${ex?.description ? `<div class=\"hint\">${esc(ex.description)}</div>` : ''} | ||||||||||||||||||||
| ${ex?.snippet ? `<pre><code>${esc(ex.snippet)}</code></pre>` : ''} | ||||||||||||||||||||
| ${ex?.error?.message ? `<pre><code>${esc(ex.error.message)}</code></pre>` : ''} | ||||||||||||||||||||
| </div>` | ||||||||||||||||||||
| ) | ||||||||||||||||||||
| .join('')} | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
||||||||||||||||||||
| ${ | ||||||||||||||||||||
| c.import | ||||||||||||||||||||
| ? `<div class="note ok"> | ||||||||||||||||||||
| <div class="row"> | ||||||||||||||||||||
| <span class="ex-name">Imports</span> | ||||||||||||||||||||
| </div> | ||||||||||||||||||||
| <pre><code>${c.import}</code></pre> | ||||||||||||||||||||
| </div>` | ||||||||||||||||||||
| : '' | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
Comment on lines
+784
to
+795
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Escape import content to prevent XSS. The import string Apply the ${
c.import
? `<div class="note ok">
<div class="row">
<span class="ex-name">Imports</span>
</div>
- <pre><code>${c.import}</code></pre>
+ <pre><code>${esc(c.import)}</code></pre>
</div>`
: ''
}
🤖 Prompt for AI Agents |
||||||||||||||||||||
|
|
||||||||||||||||||||
| ${okStories | ||||||||||||||||||||
| .map( | ||||||||||||||||||||
| (ex, k) => ` | ||||||||||||||||||||
| (ex) => ` | ||||||||||||||||||||
| <div class="note ok"> | ||||||||||||||||||||
| <div class="row"> | ||||||||||||||||||||
| <span class="ex-name">${esc(ex.name)}</span> | ||||||||||||||||||||
| <span class="badge ok">story ok</span> | ||||||||||||||||||||
| </div> | ||||||||||||||||||||
| ${ex?.summary ? `<div>${esc(ex.summary)}</div>` : ''} | ||||||||||||||||||||
| ${ex?.description ? `<div class=\"hint\">${esc(ex.description)}</div>` : ''} | ||||||||||||||||||||
| ${ex?.snippet ? `<pre><code>${esc(ex.snippet)}</code></pre>` : ''} | ||||||||||||||||||||
| </div>` | ||||||||||||||||||||
| ) | ||||||||||||||||||||
|
|
||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.