feat(ui): group overloaded functions into tabs - #1047
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
You can view the changes from here: vercel-preview |
|
It's an interesting idea, but I think it makes searching harder, e.g. if I want to search for |
|
Oddly enough, I'm fine with the showing of multiple overloads in our current state, and consumers can reformat their docs how they like. Thanks for this demo, however :-)! |
|
Hmm, fair enough! Thanks for your time 🤍 |
|
I actually have a different opinion and was thinking of this differently. Instead of the simple 1, 2 on the Overload headers which makes distinction hard, I feel that it could look like Code Tabs; So it becomes pretty apparent that there are more versions of this method. What it means is that the main method signature is always the same (the initial tiny snippet box under the header) and only the attributes and descriptions/etc are under "codetabs" I still feel that this would be much simpler.
Well I do feel our web generator could have a default stance on overloads, as it is already an opinionated style. |
That much I agree. I think that anchorinhg can be solved with the tab being switched to the right one based on the click... For pure command+f/ctrl+f searches, I'm unsure of either, we could either think a bit more about this or keep the current status quo. My goal was to make overloads simpler to identify / consume less vertical space and be better organized. |
|
I initially thought about using the signatures/parameters as the tab titles, but I hit two major edge cases:
That's why I retreated to indexes, and to make clear that tabs are for overloads, I've placed a header before the component itself (above indexes) contains "Overloads". After Aviv's comment, I searched about it and found that the web standard solution is using |
Could you show an example of what you're thinking? Are you referring to header sections?
Im unsure I got what you're saying. Im saying that the initial signature box should be shared across overloads and the only tabbed pieces are the attributes/descriptions/examples
So this is not tabbed, but the below gets tabbed
And the tabbing design could be that the whole thing gets surrounded by the same box/tabbing header we use for code tabs, but instead of the content being code, it is the actual content of that overload (the attributes table, description, example, code boxes...) and the title of each tab is "Overload #1", "Overload #2" |
That header "Overloads" tells the developers that they r overloads: you can review the "After" image in description of that PR as well.
Overloads siganture not always the same to do that 👀, For example: lol(option, callback)
lol(index, option, callback) |
Fair, but since we show a typescript-representable version of a type, shouldn't then we also render it in a way that renders overloads? Like instead of one line, you could argue it has two lines then with the two overloads? Just trying to think out loud of ways to represent this. You could maybe throw the problem at Claude to deep search how other docs do overloads and see different examples? |
|
I actually saw that design before in mdn, lemme search... |
|
WIP, with new PR 👀 Or I should do it in this PR?! |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1047 +/- ##
==========================================
+ Coverage 89.67% 89.76% +0.09%
==========================================
Files 205 205
Lines 19208 19447 +239
Branches 1795 1818 +23
==========================================
+ Hits 17224 17456 +232
- Misses 1976 1981 +5
- Partials 8 10 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
| File | Main | PR | Change |
|---|---|---|---|
orama-db.json |
9.18 MB | 9.18 MB | +1.15 KB (+0.0%) |
Performance estimate (single CI run)
- Generation time: 20.2% slower (8.32 s → 10.00 s)
- Peak memory: 0.2% higher (1.80 GB → 1.81 GB)
web Generator
Output size: 59 files changed · net -5.39 KB
File size details
| File | Main | PR | Change |
|---|---|---|---|
assets/style-COMcP7VA.css |
— | 137.52 KB | +137.52 KB |
assets/style-DSrWCPe1.css |
136.96 KB | — | -136.96 KB (-100.0%) |
all.html |
32.02 MB | 31.96 MB | -59.47 KB (-0.2%) |
buffer.html |
1.72 MB | 1.71 MB | -8.13 KB (-0.5%) |
crypto.html |
1.88 MB | 1.89 MB | +7.54 KB (+0.4%) |
zlib.html |
946.60 KB | 953.34 KB | +6.74 KB (+0.7%) |
net.html |
631.23 KB | 625.81 KB | -5.43 KB (-0.9%) |
http2.html |
1.25 MB | 1.25 MB | +4.14 KB (+0.3%) |
v8.html |
545.84 KB | 549.70 KB | +3.86 KB (+0.7%) |
test.html |
1.35 MB | 1.35 MB | +3.83 KB (+0.3%) |
perf_hooks.html |
744.46 KB | 748.07 KB | +3.61 KB (+0.5%) |
webstreams.html |
535.22 KB | 538.76 KB | +3.54 KB (+0.7%) |
fs.html |
2.18 MB | 2.17 MB | -3.50 KB (-0.2%) |
util.html |
1.16 MB | 1.16 MB | -3.38 KB (-0.3%) |
https.html |
240.37 KB | 237.06 KB | -3.31 KB (-1.4%) |
events.html |
833.42 KB | 836.56 KB | +3.14 KB (+0.4%) |
dns.html |
421.73 KB | 424.50 KB | +2.77 KB (+0.7%) |
stream_iter.html |
725.56 KB | 728.24 KB | +2.68 KB (+0.4%) |
sqlite.html |
475.16 KB | 477.74 KB | +2.57 KB (+0.5%) |
process.html |
1.14 MB | 1.14 MB | +2.22 KB (+0.2%) |
worker_threads.html |
633.41 KB | 635.49 KB | +2.09 KB (+0.3%) |
diagnostics_channel.html |
520.01 KB | 521.76 KB | +1.75 KB (+0.3%) |
webcrypto.html |
628.87 KB | 630.60 KB | +1.73 KB (+0.3%) |
readline.html |
363.52 KB | 365.23 KB | +1.70 KB (+0.5%) |
vm.html |
633.36 KB | 634.94 KB | +1.58 KB (+0.2%) |
inspector.html |
213.74 KB | 215.26 KB | +1.52 KB (+0.7%) |
quic.html |
911.82 KB | 913.32 KB | +1.50 KB (+0.2%) |
assert.html |
650.66 KB | 652.14 KB | +1.48 KB (+0.2%) |
ffi.html |
181.70 KB | 183.10 KB | +1.40 KB (+0.8%) |
timers.html |
182.69 KB | 183.94 KB | +1.24 KB (+0.7%) |
stream.html |
1.22 MB | 1.22 MB | +1.23 KB (+0.1%) |
module.html |
510.80 KB | 511.90 KB | +1.10 KB (+0.2%) |
child_process.html |
672.72 KB | 673.80 KB | +1.08 KB (+0.2%) |
dgram.html |
299.69 KB | 300.77 KB | +1.08 KB (+0.4%) |
async_context.html |
318.07 KB | 319.12 KB | +1.05 KB (+0.3%) |
globals.html |
280.35 KB | 281.24 KB | +911.00 B (+0.3%) |
os.html |
164.72 KB | 165.60 KB | +900.00 B (+0.5%) |
http.html |
1.10 MB | 1.10 MB | +844.00 B (+0.1%) |
tty.html |
107.04 KB | 107.84 KB | +819.00 B (+0.7%) |
tls.html |
523.70 KB | 524.38 KB | +697.00 B (+0.1%) |
path.html |
177.04 KB | 177.66 KB | +630.00 B (+0.3%) |
async_hooks.html |
283.47 KB | 284.06 KB | +604.00 B (+0.2%) |
console.html |
185.00 KB | 184.42 KB | -586.00 B (-0.3%) |
dtls.html |
176.56 KB | 177.13 KB | +579.00 B (+0.3%) |
cluster.html |
302.58 KB | 303.13 KB | +566.00 B (+0.2%) |
errors.html |
518.73 KB | 519.22 KB | +502.00 B (+0.1%) |
domain.html |
126.37 KB | 126.81 KB | +443.00 B (+0.3%) |
repl.html |
302.83 KB | 303.21 KB | +396.00 B (+0.1%) |
querystring.html |
66.82 KB | 67.16 KB | +346.00 B (+0.5%) |
punycode.html |
64.69 KB | 65.00 KB | +324.00 B (+0.5%) |
single-executable-applications.html |
132.65 KB | 132.92 KB | +280.00 B (+0.2%) |
vfs.html |
90.09 KB | 90.36 KB | +277.00 B (+0.3%) |
wasi.html |
80.17 KB | 80.43 KB | +266.00 B (+0.3%) |
url.html |
512.33 KB | 512.08 KB | -263.00 B (-0.1%) |
tracing.html |
125.91 KB | 126.13 KB | +220.00 B (+0.2%) |
modules.html |
227.31 KB | 227.52 KB | +216.00 B (+0.1%) |
string_decoder.html |
66.07 KB | 66.24 KB | +178.00 B (+0.3%) |
permissions.html |
75.00 KB | 75.13 KB | +123.00 B (+0.2%) |
esm.html |
186.95 KB | 187.01 KB | +60.00 B (+0.0%) |
Performance estimate (single CI run)
- Generation time: 3.0% faster (87.03 s → 84.38 s)
- Peak memory: 15.3% higher (4.74 GB → 5.46 GB)
|
I updated the result image in PR description, PTAL :) |
|
@moshams272 could you actually use Code Tabs? The idea is that each one of these Overload #1, Overload #2 are actual tabs, and the content itself is surrounded as a box
Imagine this, but instead of code inside it is the actual contents of that overload (so description, attribute box, examples, etc...) Can you do that? It will make the UX much better IMO, please rebase PR too! |
|
Also the signature box, shouldn't have inline comment of |
I made it for readability, as it's easy to know which overload tab I need to open instead counting the signature by myself to reach the attributes that I need, WDUT :) |
I'll see if that's applicable. |
5388813 to
2f142ae
Compare
| padding-bottom: calc(var(--spacing) * 2); | ||
| } | ||
|
|
||
| @media (min-width: 48rem) { |
There was a problem hiding this comment.
Out of curiosity, are these all the gap overrides we have? I believe that there were gap settings for mobile, tablet, ... [...] (different sizes)
There was a problem hiding this comment.
yeah, but I saw that enough for gap & padding. I actually need to remove gap from @madia 😅
There was a problem hiding this comment.
What I meant is are these all the @media tags we need? Or do we need more?
There was a problem hiding this comment.
No I think that's good.
There was a problem hiding this comment.
So you're confirming there is no other @media tag needed here? No other breakpoint for other screen sizes?
There was a problem hiding this comment.
Yeah, I confirm that no @media tag is needed.





Description
This PR introduces a new tabbed UI for overloaded functions. This implementation is a direct result of the discussions in #1038. It updates the MDX AST to group overloads into
CodeTabscomponent and remove duplicate signatures.Note: Using AI to write JSDocs & traverse some errors ;)
Validation
Add tests, and there are visual results:
Before:
After:
Related Issues
None
Check List
node --run testand all tests passed.node --run format:check&node --run lint.