Skip to content

Conversation

@olaf-k
Copy link
Member

@olaf-k olaf-k commented Nov 27, 2025

WIP don't be too fussy about the details at this point. you can have a look at the Slider doc page to see it in action.

tl;dr we display a demo (leveraging Demo/QdsDemo), find data-part in the resulting markup and highlight the matching elements + display their API.

Chakra uses a pure CSS solution (using outline) but overlays only add minimal extra code and, I believe, help identifying parts much better.

the most obvious optimization is to only have a single source of truth that would map components to their API rather than manually repeating ourselves. but before I continue iterating I'd like to get your feedback first!

Signed-off-by: Olaf Kappes <okappes@qti.qualcomm.com>
Signed-off-by: Olaf Kappes <okappes@qti.qualcomm.com>
Signed-off-by: Olaf Kappes <okappes@qti.qualcomm.com>
@olaf-k olaf-k requested a review from R-Bower as a code owner November 27, 2025 16:42
Signed-off-by: Olaf Kappes <okappes@qti.qualcomm.com>
Signed-off-by: Olaf Kappes <okappes@qti.qualcomm.com>
Signed-off-by: Olaf Kappes <okappes@qti.qualcomm.com>
Signed-off-by: Olaf Kappes <okappes@qti.qualcomm.com>
Comment on lines +145 to +146
return link ? (
<Link
Copy link
Member Author

Choose a reason for hiding this comment

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

I wasn't happy with the explorer displaying doc as was completely redundant with our existing API sections, so I just simplified it and just made it point to the relevant paragraphs instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll play with the UX and see how it does

Copy link
Member Author

Choose a reason for hiding this comment

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

image pretty basic: runs a demo and displays a list of parts. hovering highlights the part, clicking takes you to the API doc section.

})

setParts(discovered)
}, 100)
Copy link
Member Author

Choose a reason for hiding this comment

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

there's a tiny setTimeout to make sure the demo is ready but we could really simplify even further and just trust the doc author: if we have a list of parts (which we have as partLinks) then we could just use that, no discovery needed. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

the partLinks approach should work (accounting for the derived approach). This seems like overkill when we have that.

@olaf-k olaf-k requested a review from R-Bower December 16, 2025 17:19

useEffect(() => {
if (!mountedRef.current) {
if (!mountedRef.current || withoutUI) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

this is to reuse QdsDemo without the demo controls. I renamed the prop.

Comment on lines 284 to 296
partLinks={{
root: "#q-slider-root",
label: "#q-slider-label",
"value-text": "#q-slider-value-text",
control: "#q-slider-control",
track: "#q-slider-track",
range: "#q-slider-range",
thumb: "#q-slider-thumb",
"marker-group": "#q-slider-marker-group",
marker: "#q-slider-marker",
hint: "#q-slider-hint",
"error-text": "#q-slider-error-text",
}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we derive this? I think this is already taken care of by convention. Every part should correspond to the q-<component>-<part> directive. For outliers, we can provide overrides via this approach here.

Copy link
Member Author

@olaf-k olaf-k Dec 18, 2025

Choose a reason for hiding this comment

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

simplified the API again: we don't go through the markup to discover parts, we just read them from parts, which eliminates the need for excludeParts and the links are auto-generated based on that (override still possible)

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, this looks much cleaner

})

setParts(discovered)
}, 100)
Copy link
Contributor

Choose a reason for hiding this comment

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

the partLinks approach should work (accounting for the derived approach). This seems like overkill when we have that.

Comment on lines +145 to +146
return link ? (
<Link
Copy link
Contributor

Choose a reason for hiding this comment

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

I'll play with the UX and see how it does

Signed-off-by: Olaf Kappes <okappes@qti.qualcomm.com>
Signed-off-by: Olaf Kappes <okappes@qti.qualcomm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants