[feat] Add @streamlit/component-v2-lib package#12626
Conversation
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) ✅ license/snyk check is complete. No issues have been found. (View Details) |
✅ PR preview is ready!
|
There was a problem hiding this comment.
Pull Request Overview
This PR bootstraps the @streamlit/component-v2-lib package, which provides TypeScript types and infrastructure for Streamlit Components v2 authors. This package establishes the foundation for the upcoming CCv2 (Custom Components v2) feature by defining type interfaces, theme properties, and packaging infrastructure.
- Adds a new TypeScript package with component type definitions and theme interfaces
- Integrates the package into the existing monorepo workspace structure
- Sets up build infrastructure and CI/CD processes for package distribution
Reviewed Changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/component-v2-lib/src/types.ts | Core TypeScript type definitions for component arguments, state, and function signatures |
| frontend/component-v2-lib/src/theme.ts | TypeScript interfaces for Streamlit theme properties and CSS custom properties |
| frontend/component-v2-lib/package.json | Package configuration with build scripts, dependencies, and npm publishing settings |
| frontend/component-v2-lib/vite.config.ts | Vite build configuration for library bundling and testing setup |
| frontend/package.json | Workspace configuration to include the new component-v2-lib package |
| .github/workflows/pr-preview.yml | CI workflow updates to build and distribute the npm package |
| scripts/check_license_headers.py | License header exclusion pattern for yarn cache directory |
| Makefile | Clean target updated to remove component-v2-lib build artifacts |
| NOTICES | License notice addition for the new package |
e038186 to
0dace65
Compare
0dace65 to
3622b24
Compare
3622b24 to
da1d262
Compare
|
|
||
| type ComponentCleanupFunction = () => void | ||
|
|
||
| export type ComponentResult = ComponentCleanupFunction | void |
There was a problem hiding this comment.
[question] Will ComponentResult always be used for cleanup, or will it also be possible for the component to return a result?
There was a problem hiding this comment.
It will always be used for (optional) cleanup.
There was a problem hiding this comment.
I find the name a bit misleading then, it's a [nit], but I wonder if there is a better name. I would suggest inlining this, but I see it's exported so that is likely why it has its own name to make it easier to keep consistent.
Maybe OptionalComponentCleanupFunction?
There was a problem hiding this comment.
Thanks for the feedback. I've updated the name of this and added more comprehensive JSDocs per our discussion throughout this PR.
da1d262 to
7610c89
Compare
7610c89 to
eb77520
Compare

Describe your changes
@streamlit/component-v2-libpackage, which will be used by CCv2 authors and internally by our frontend implementation.GitHub Issue Link (if applicable)
Testing Plan
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.