Skip to content

feat: Add createKeplerTheme - #712

Merged
xpectro93 merged 3 commits into
mainfrom
feat_update_kepler_theme
Jun 16, 2026
Merged

xpectro93 merged 3 commits into
mainfrom
feat_update_kepler_theme

Conversation

@xpectro93

@xpectro93 xpectro93 commented Jun 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features
    • Theme customization: Added createKeplerTheme() with KeplerThemeOverrides, and exposed darkTheme for consistent theming.
    • Modal portal targeting: Added modalPortalTarget (supports rendering modals in the container or at document.body).
    • Enhanced public API: Exported KeplerModalPortalTarget, KeplerThemeOverrides, KeplerGLBasicProps, plus theme utilities for easier configuration.
  • Bug Fixes
    • Configured theming applied: The provider now uses the Kepler store theme when provided (fallback remains darkTheme).
  • Documentation
    • Updated the createKeplerSlice() customization example and notes to reflect the new options.

@xpectro93
xpectro93 marked this pull request as draft June 12, 2026 19:13
@coderabbitai

coderabbitai Bot commented Jun 12, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0990dd8a-08ea-4507-840b-363dd01ff1cc

📥 Commits

Reviewing files that changed from the base of the PR and between 4b3940a and e3ea5f0.

📒 Files selected for processing (2)
  • packages/kepler/README.md
  • packages/kepler/src/components/KeplerMapContainer.tsx
✅ Files skipped from review due to trivial changes (1)
  • packages/kepler/README.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/kepler/src/components/KeplerMapContainer.tsx

📝 Walkthrough

Walkthrough

The Kepler package gains two new configuration options: keplerTheme (a DefaultTheme) and modalPortalTarget ('body' | 'container'). These are threaded through CreateKeplerSliceOptions, KeplerSliceState, and createKeplerSlice. KeplerProvider resolves the active theme from the store, and KeplerMapContainer uses the portal target to select the DOM node for modal rendering. A createKeplerTheme utility and several related types are newly exported from the package index.

Changes

Theme Customization and Modal Portal Targeting

Layer / File(s) Summary
Slice contracts and theme utilities
packages/kepler/src/styles/theme.ts, packages/kepler/src/KeplerSlice.ts
KeplerThemeOverrides type and createKeplerTheme function added to theme.ts. CreateKeplerSliceOptions extended with optional keplerTheme and modalPortalTarget (defaulting to 'container'); KeplerSliceState['kepler'] stores both; createKeplerSlice initializes them from options.
Runtime theme and portal wiring
packages/kepler/src/components/KeplerProvider.tsx, packages/kepler/src/components/KeplerMapContainer.tsx
KeplerProvider reads keplerTheme from the store, computes resolvedTheme via useMemo (falling back to darkTheme), and passes it to ThemeProvider. KeplerMapContainer reads modalPortalTarget and selects document.body or the container node as modalPortalNode for modalContainerFields.
Public API re-exports
packages/kepler/src/index.ts
Adds KeplerModalPortalTarget, createKeplerTheme, darkTheme, KeplerThemeOverrides, and KeplerGLBasicProps to the package's top-level exports.
Updated README documentation
packages/kepler/README.md
Expanded createKeplerSlice() example showing basicKeplerProps.mapboxApiAccessToken, theme customization via createKeplerTheme, modalPortalTarget configuration, and descriptive notes for each option.

Sequence Diagram(s)

sequenceDiagram
  participant App
  participant createKeplerSlice
  participant KeplerProvider
  participant KeplerMapContainer
  participant StyledThemeProvider as ThemeProvider

  App->>createKeplerSlice: {keplerTheme, modalPortalTarget}
  createKeplerSlice->>createKeplerSlice: store keplerTheme and modalPortalTarget in initial state

  App->>KeplerProvider: render
  KeplerProvider->>createKeplerSlice: select state.kepler.keplerTheme
  KeplerProvider->>KeplerProvider: resolvedTheme = keplerTheme ?? darkTheme
  KeplerProvider->>StyledThemeProvider: resolvedTheme

  App->>KeplerMapContainer: render
  KeplerMapContainer->>createKeplerSlice: select state.kepler.modalPortalTarget
  KeplerMapContainer->>KeplerMapContainer: modalPortalNode = 'body' ? document.body : containerNode
  KeplerMapContainer->>KeplerMapContainer: modalContainerFields(modalPortalNode)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • sqlrooms/sqlrooms#419: Modifies the same createKeplerSlice/CreateKeplerSliceOptions interface and kepler state initialization path for theme-aware initial map state, directly overlapping with the keplerTheme integration point added here.

Suggested reviewers

  • ilyabo

Poem

🐇 Hop hop, the theme is mine to choose,
No more locked to darkTheme's hues!
Portals leap to body or container fair,
My modals land exactly where I dare.
With createKeplerTheme, I paint the night —
A bunny-crafted palette, gleaming bright! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main addition: a new createKeplerTheme function and theme customization capabilities are core to the changeset, along with related theme infrastructure.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat_update_kepler_theme

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2fafb15b8d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/kepler/src/styles/theme.ts Outdated
Comment thread packages/kepler/src/KeplerSlice.ts Outdated
@xpectro93
xpectro93 marked this pull request as ready for review June 15, 2026 19:12
@xpectro93
xpectro93 requested a review from ilyabo June 15, 2026 19:13

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4b3940a5aa

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/kepler/src/index.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/kepler/src/components/KeplerMapContainer.tsx`:
- Around line 158-163: The assignment of modalPortalNode dereferences
document.body without checking if the document global exists, which causes
failures in SSR and test environments. Guard the document.body access by
checking if typeof document is defined and not undefined before attempting to
access it; if document is unavailable, fall back to using containerNode
regardless of the modalPortalTarget value.

In `@packages/kepler/src/index.ts`:
- Line 81: The export statement at line 81 in packages/kepler/src/index.ts is
exposing darkTheme, which is a SQLRooms-specific preset theme, as a stable
top-level API export. This reduces the composability of the kepler package for
other consumers. Remove darkTheme from the export statement and keep only
createKeplerTheme exported. If related theme types or utilities need to be
exported, export only the generic, composable ones that are not app-specific.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ca940080-6d7f-49e1-99b3-eeba0dc34c94

📥 Commits

Reviewing files that changed from the base of the PR and between b790206 and 4b3940a.

📒 Files selected for processing (5)
  • packages/kepler/src/KeplerSlice.ts
  • packages/kepler/src/components/KeplerMapContainer.tsx
  • packages/kepler/src/components/KeplerProvider.tsx
  • packages/kepler/src/index.ts
  • packages/kepler/src/styles/theme.ts

Comment thread packages/kepler/src/components/KeplerMapContainer.tsx Outdated
Comment thread packages/kepler/src/index.ts
@xpectro93
xpectro93 merged commit 85e004f into main Jun 16, 2026
4 checks passed
@xpectro93
xpectro93 deleted the feat_update_kepler_theme branch June 16, 2026 16:28
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.

2 participants