Skip to content

feat: export ThemeName and make themes public in Uniwind class#460

Merged
Brentlok merged 1 commit intomainfrom
feat/export-themes
Mar 17, 2026
Merged

feat: export ThemeName and make themes public in Uniwind class#460
Brentlok merged 1 commit intomainfrom
feat/export-themes

Conversation

@Brentlok
Copy link
Contributor

@Brentlok Brentlok commented Mar 17, 2026

#459

Summary by CodeRabbit

  • New Features
    • Added public access to theme configuration through a new getter method.
    • Exported ThemeName type to support TypeScript development and improve type safety.

@coderabbitai
Copy link

coderabbitai bot commented Mar 17, 2026

📝 Walkthrough

Walkthrough

This PR refactors theme type management in the Uniwind package by renaming the internal themes field to _themes, exposing it through a new public getter on UniwindConfigBuilder, updating corresponding type references, and exporting the ThemeName type from the main index for public consumption.

Changes

Cohort / File(s) Summary
Theme Type References
packages/uniwind/src/components/web/rnw.ts
Updated the UniwindWithThemes type alias to reference typeof Uniwind['_themes'] instead of typeof Uniwind['themes'], aligning with the internal field rename.
Config Theme Accessor
packages/uniwind/src/core/config/config.common.ts
Added a public getter themes to UniwindConfigBuilder that exposes the internal _themes array as Array<ThemeName>, converting internal field access to a controlled public interface.
Public Type Export
packages/uniwind/src/index.ts
Exported ThemeName type from ./core/types to make the theme name type available to consumers of the package.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • PR #256: Also involves changes to ThemeName type usage and theme-related type references in the config/common surface area.

Poem

🐰 Hopping through types with careful care,
Themes now hide where none can snare,
A public gate opens up so wide,
Where ThemeName dances with pride!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and clearly summarizes the main changes: exporting ThemeName type and making themes public in the Uniwind class, matching the changeset across three files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/export-themes
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Tip

You can customize the tone of the review comments and chat replies.

Configure the tone_instructions setting to customize the tone of the review comments and chat replies. For example, you can set the tone to Act like a strict teacher, Act like a pirate and more.

Copy link

@coderabbitai coderabbitai bot left a comment

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 the current code and only fix it if needed.

Inline comments:
In `@packages/uniwind/src/components/web/rnw.ts`:
- Line 7: The type declaration uses the protected internal member `_themes` via
`typeof Uniwind['_themes']`, which violates TypeScript access rules; change the
type to use the public `themes` property instead (referencing the `themes`
getter on `Uniwind`) so the component's `themes` prop/type is derived from the
public API rather than the protected `_themes` field; update any occurrences
referencing `typeof Uniwind['_themes']` to the type of `Uniwind['themes']` or
the exported/public `themes` type provided by the `Uniwind` class.

In `@packages/uniwind/src/core/config/config.common.ts`:
- Around line 33-35: The themes getter currently exposes the internal _themes
array by reference and callers also store arrays directly into _themes
elsewhere, making internal theme state externally mutable; update the getter
(themes) to return a shallow copy of this._themes (not the original reference)
and wherever code assigns caller-provided arrays to this._themes (the assignment
site that writes to _themes around the other block), replace direct assignment
with a shallow copy of the incoming array so external mutations cannot alias
internal state; use array spread or slice to copy consistently for both read and
write operations.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 50e45997-5327-4768-ad5d-4f8a52066663

📥 Commits

Reviewing files that changed from the base of the PR and between 70d8a86 and aa9356c.

📒 Files selected for processing (3)
  • packages/uniwind/src/components/web/rnw.ts
  • packages/uniwind/src/core/config/config.common.ts
  • packages/uniwind/src/index.ts

@Brentlok Brentlok merged commit 01e3993 into main Mar 17, 2026
2 checks passed
@Brentlok Brentlok deleted the feat/export-themes branch March 17, 2026 07:41
@github-actions
Copy link
Contributor

🚀 This pull request is included in v1.6.0. See Release v1.6.0 for release notes.

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.

1 participant