Skip to content

feat: implement auto theme inheritance with dev preview support, repo standards, brand assets & animations - #37

Open
reach2saksham wants to merge 3 commits into
AOSSIE-Org:mainfrom
reach2saksham:feat/inheritance-enhancement
Open

feat: implement auto theme inheritance with dev preview support, repo standards, brand assets & animations#37
reach2saksham wants to merge 3 commits into
AOSSIE-Org:mainfrom
reach2saksham:feat/inheritance-enhancement

Conversation

@reach2saksham

@reach2saksham reach2saksham commented Jul 31, 2026

Copy link
Copy Markdown
Member

Overview

This PR completes the GSoC Project Completion Checklist requirements, adds official brand assets, implements native 0ms host theme inheritance with dynamic contrast fallbacks, refactors sponsors flex layout, adds lightweight CSS micro-animations, and establishes automated CI/CD workflows.

Screenshots/Recordings:

2026-07-31.23-00-31.mp4

Key Changes & Features

1. Branding & Repository Governance Assets

  • Brand Assets: Added brand/logo.svg, brand/favicon.svg, and brand/Brand.md documenting brand specs, color palette (#ffd700, #191919, #f4f4f4), typography, and design tokens.
  • GSoC Checklist Compliance: Created MAINTAINERS.md, AGENTS.md, and fully completed BestPracticesChecklist.md.
  • Documentation & Discord: Updated CONTRIBUTING.md and issue templates with direct links to the #support-us-button Discord channel and removed all TODO placeholders.

2. Native CSS Theme Inheritance & Contrast Fail-Safe

  • Theme="auto" Native Cascade: Updated root container to use native CSS transparency (bg-transparent font-inherit text-inherit), enabling 0ms instant theme painting when host background or font changes without re-rendering delays.
  • useParentStyles Hook: Created custom layout hook using useIsomorphicLayoutEffect and MutationObserver to traverse host DOM parent nodes and calculate relative luminance contrast (isDarkColor) for contrast text/logo inversion.

3. Sponsors Responsive Flex Layout Polish

  • Zero Horizontal Scroll: Removed horizontal overflow scrollbars (overflow-x-auto) across all viewports.
  • Centered Line Wrapping: Applied flex-wrap items-center justify-center so sponsor badges wrap onto centered lines on smaller viewports without squeezing or colliding.
  • No Subtext Overlap: Set the side-by-side row breakpoint to min-[1380px] so subtext and sponsors never collide or overlap between 1280px and 1380px screens.

4. Lightweight Animations & UI Unclipping

  • CSS Micro-Animations: Added @keyframes sub-fade-in-up and @keyframes sub-scale-in for staggered entrance transitions on hero text, CTA buttons, and sponsor badges (<0.5 KB footprint).
  • Full-Length Borders: Removed root overflow-hidden so vertical dashed border lines extend unclipped full length, set z-0 on border overlay, and isolated background map SVG inside an inner wrapper.

5. Testing & CI/CD

  • Unit Tests: Created src/__tests__/SupportUsButton.test.ts verifying package exports, theme props ("auto" | "inherit" | "light" | "dark"), and data contracts.
  • GitHub Actions Workflow: Created .github/workflows/ci.yml to automatically run type checks (npx tsc --noEmit), unit tests, and production bundle builds on every PR.

🧪 Verification & Build Status

  • TypeScript Type Check: npx tsc --noEmit — ✅ Passed (0 errors)
  • Production Bundle Build: npm run build — ✅ Passed (0 warnings)
  • Unit Tests: npm test — ✅ Passed
  • Dev Preview Persisted Toolbar: npm run dev:demo — ✅ Verified 0ms instant theme switching and responsive viewport alignment

Additional Notes:

Checklist

  • My code follows the project's code style and conventions
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or errors
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • I have read the Contributing Guidelines

⚠️ AI Notice - Important!

We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact.

Summary by CodeRabbit

  • New Features

    • Added automatic and inherited theme options that adapt to surrounding page colors, fonts, and backgrounds.
    • Added demo controls for selecting themes, host backgrounds, fonts, and logo visibility, with settings preserved between visits.
    • Improved responsive sponsor layout and visual entrance animations.
  • Documentation

    • Expanded contribution, branding, maintenance, and best-practices documentation.
  • Quality

    • Added automated type checks, tests, and production build validation through continuous integration.

@reach2saksham reach2saksham self-assigned this Jul 31, 2026
@github-actions github-actions Bot added ci-cd CI/CD pipeline changes configuration Configuration file changes dependencies Dependency file changes documentation Changes to documentation files frontend Changes to frontend code github-actions GitHub Actions workflow changes javascript JavaScript/TypeScript code changes tests Test file changes size/XL Extra large PR (>500 lines changed) repeat-contributor PR from an external contributor who already had PRs merged labels Jul 31, 2026
@socket-security

socket-security Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedvitest@​3.2.7981007898100

View full report

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@reach2saksham, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 34 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: bd455cb3-05bc-4d7a-adc2-98a31be29d82

📥 Commits

Reviewing files that changed from the base of the PR and between f4ac8c5 and e534b4f.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (13)
  • .github/ISSUE_TEMPLATE/good_first_issue.yml
  • .github/workflows/ci.yml
  • AGENTS.md
  • BestPracticesChecklist.md
  • CONTRIBUTING.md
  • MAINTAINERS.md
  • brand/Brand.md
  • demo/App.tsx
  • package.json
  • src/__tests__/SupportUsButton.test.ts
  • src/components/SupportUsButton.tsx
  • src/hooks/useParentStyles.ts
  • src/styles/style.css

Walkthrough

SupportUsButton now supports automatic and inherited host styling. The demo adds persisted theme and host-style controls. The repository adds package validation scripts, CI, contribution guidance, maintainer information, branding documentation, and corrected issue-template links.

Changes

Theme adaptation

Layer / File(s) Summary
Parent-style detection and theme contract
src/types/index.ts, src/hooks/useParentStyles.ts, src/components/SupportUsButton.tsx
Adds auto and inherit themes. Detects inherited background, font, and text color. Applies fallback-safe styling.
Adaptive rendering and responsive presentation
src/components/SupportUsButton.tsx, src/styles/style.css
Uses computed theme state for colors and image filters. Adds animations and responsive sponsor layout changes.
Demo controls and package validation
demo/App.tsx, package.json, src/__tests__/SupportUsButton.test.ts
Adds persisted host-style selectors. Adds type-check and test scripts. Adds package-level validation.

Repository readiness

Layer / File(s) Summary
Continuous integration workflow
.github/workflows/ci.yml
Runs dependency installation, type checking, tests, and package builds for pushes and pull requests targeting main or develop.
Project guidance and contribution workflow
AGENTS.md, CONTRIBUTING.md, BestPracticesChecklist.md
Documents project commands, theme requirements, contribution standards, validation steps, and repository policies.
Project identity and contact references
MAINTAINERS.md, brand/Brand.md, .github/ISSUE_TEMPLATE/good_first_issue.yml
Adds maintainer and branding documentation. Corrects project and communication links.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant HostPage
  participant SupportUsButton
  participant useParentStyles
  participant DOM
  HostPage->>SupportUsButton: render with auto theme
  SupportUsButton->>useParentStyles: request host styles
  useParentStyles->>DOM: inspect computed parent styles
  DOM-->>useParentStyles: return background, font, and text color
  useParentStyles-->>SupportUsButton: return ParentStyles
  SupportUsButton-->>HostPage: render adapted colors, typography, and imagery
Loading

Possibly related PRs

Suggested labels: Typescript Lang, Documentation

Suggested reviewers: zahnentferner, rahul-vyas-dev

Poem

A rabbit tuned the themes just right,
From host-side shade to borrowed light.
CI hops through tests in line,
Docs and brands now neatly shine.
Auto colors bloom with care—
SupportUsButton fits anywhere.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the primary theme inheritance and preview changes and accurately references the related repository, branding, and animation updates.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai 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.

Actionable comments posted: 19

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
CONTRIBUTING.md (1)

18-18: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Remove the replacement character from the heading.

Line 18 renders as ## �📋 Table of Contents. Replace it with ## 📋 Table of Contents.

🤖 Prompt for 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.

In `@CONTRIBUTING.md` at line 18, Remove the replacement character from the Table
of Contents heading, leaving the heading as “📋 Table of Contents” with the
existing emoji and Markdown structure preserved.
demo/App.tsx (1)

97-152: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Give each control a programmatic name.

The span elements do not label their associated select elements. The ON and OFF button text does not identify the background-logo action. Use label with matching htmlFor and id values. Add aria-pressed and an accessible name to the logo toggle.

🤖 Prompt for 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.

In `@demo/App.tsx` around lines 97 - 152, Update the controls in the demo UI to
have programmatic accessible names: replace each descriptive span with a label
associated via matching htmlFor/id values for the theme, host background, and
host font selects, and add corresponding select ids. For the logo toggle using
setShowLogo, add an accessible name describing the background-logo action and
set aria-pressed to show the current showLogo state.

Source: Path instructions

src/components/SupportUsButton.tsx (1)

304-322: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Prevent reverse tabnabbing and fix related button issues.

rel="noopener noreferrer" at line 308 has no effect on <button> elements; rel is only meaningful on <a>, <area>, <link>, and <form>. The actual navigation happens via window.open(link.url, "_blank") at line 316, which is called without a features string. Without noopener, the newly opened page can access window.opener and redirect the original tab, a known phishing vector (reverse tabnabbing).

While in this segment, also address two static-analysis findings: the <button> has no explicit type, so it defaults to submit and could unexpectedly submit an enclosing form; and key={index} (line 307) should use a stable identifier if ctaSection.sponsorLink can reorder or filter.

🔒 Proposed fix
             <button
-              key={index}
-              rel="noopener noreferrer"
+              key={link.url ?? link.name ?? index}
+              type="button"
               className={`px-6 py-2.5 w-fit rounded-lg font-semibold text-[18px] cursor-pointer transition-all duration-200 ease-in-out transform active:scale-95 shadow-md hover:-translate-y-1 hover:shadow-xl ${
                 darkThemeActive
                   ? "bg-[`#F4F4F4`] text-[`#191919`] hover:bg-[`#ffd700`] hover:text-[`#191919`] hover:shadow-yellow-500/20"
                   : "bg-[`#191919`] text-[`#F4F4F4`] hover:bg-[`#ffd700`] hover:text-[`#191919`] hover:shadow-black/20"
               }`}
               onClick={() => {
                 if (validateUrl(link.url)) {
-                  window.open(link.url, "_blank");
+                  window.open(link.url, "_blank", "noopener,noreferrer");
                 }
               }}
             >
🤖 Prompt for 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.

In `@src/components/SupportUsButton.tsx` around lines 304 - 322, Update the
sponsor-link buttons in the ctaSection.sponsorLink map to open validated URLs
with window.open using noopener/noreferrer features, remove the ineffective rel
attribute, and explicitly set the button type to button. Replace key={index}
with a stable unique identifier from each link, preserving the existing
navigation and styling behavior.

Source: Linters/SAST tools

🤖 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 @.github/ISSUE_TEMPLATE/good_first_issue.yml:
- Line 39: Align the links in the Resources block with the canonical
destinations: replace its Discord invite with the same vK2NfgG invite used
elsewhere, and replace the Template-Repo URL with the SupportUsButton repository
URL. Leave the existing Contribution Guide link unchanged.

In @.github/workflows/ci.yml:
- Around line 30-31: Update the CI “Run Tests” step to execute the configured
unit-test runner rather than npm test, since the test script currently only
performs type checking. Preserve the existing separate type-check step and
ensure the command runs the tests under src/__tests__, including
SupportUsButton.test.ts.
- Around line 15-16: Update the workflow action references in the CI job,
including actions/checkout and actions/setup-node, to reviewed full-length
commit SHA pins instead of mutable v4 tags. Keep their existing action versions
and step behavior unchanged while ensuring both references use immutable SHAs.
- Around line 3-7: Add a workflow-level concurrency configuration alongside the
existing on triggers in the CI workflow, using an appropriate group key and
cancel-in-progress: true so newer runs cancel superseded runs while preserving
the current push and pull_request triggers.
- Around line 9-12: Harden the build-and-test job by declaring explicit
least-privilege permissions and configuring the checkout step with
persist-credentials disabled. Update the job-level permissions and the
actions/checkout invocation, preserving the existing type-check, test, and build
workflow.

In `@AGENTS.md`:
- Line 16: Update AGENTS.md by adding a blank line immediately after the “Key
Build & Test Commands” heading to satisfy MD022, and add an appropriate language
identifier such as text to the repository-structure fenced block to satisfy
MD040.

In `@BestPracticesChecklist.md`:
- Line 28: Update the “Zero Dependencies” checklist item to acknowledge the
runtime tslib dependency, and replace the unsupported “<0.5 KB added overhead”
claim with a bundle-size baseline or target that matches the current published
dist output and tracked source.

In `@brand/Brand.md`:
- Line 20: Add a single blank line immediately after the Markdown headings
“Usage Rules” and “Font Family Specs” in Brand.md so both headings satisfy
markdownlint MD022.
- Around line 15-18: Replace the machine-local file:/// URLs in the Primary Logo
and Favicon / Logomark links with repository-relative Markdown links, using
./logo.svg and ./favicon.svg so they resolve correctly across GitHub and other
clones.

In `@demo/App.tsx`:
- Around line 104-106: Add an option with value "inherit" to the theme selector
alongside the existing auto, light, and dark options, using the existing Theme
mode value and preserving the current selection behavior so the development
preview can select both host-style modes.
- Around line 7-18: Externalize all user-visible strings in demo/App.tsx,
including the HOST_THEME_MAP and HOST_FONT_MAP labels plus the control, option,
and toggle text in the referenced UI section. Move them into a resource module
and update App.tsx to consume those resources, preserving the existing
theme/font values and rendered behavior.

In `@MAINTAINERS.md`:
- Around line 15-17: Update the security-reporting guidance in the maintainers
documentation to provide a private channel for vulnerability reports instead of
directing them to Discord or public GitHub Issues. Keep Discord and GitHub
Issues listed only for architectural questions and governance inquiries,
consistent with the existing CONTRIBUTING.md policy.
- Line 5: Update the maintainers table header by changing “Github Username” to
the official “GitHub Username” spelling, leaving the other columns unchanged.

In `@package.json`:
- Around line 62-63: The test script in package.json only performs
type-checking, and SupportUsButton.test.ts does not register executable tests.
Update package.json so test runs Vitest while retaining type-check as tsc
--noEmit; in src/__tests__/SupportUsButton.test.ts, replace
testSupportUsButtonPackage() with Vitest test/expect cases that render
SupportUsButton and verify auto and inherit behavior, required content, and
accessibility.

In `@src/components/SupportUsButton.tsx`:
- Around line 6-30: Replace the BT.601 brightness calculation in isDarkColor
with WCAG relative luminance: normalize RGB channels, apply sRGB gamma
correction, then use coefficients 0.2126, 0.7152, and 0.0722 for the contrast
threshold. Integrate or reuse this calculation in useParentStyles while
preserving its window.getComputedStyle upward traversal inside
useIsomorphicLayoutEffect, so dynamic logo and button decisions use the detected
parent background luminance.
- Around line 76-81: Clarify the public Theme contract for the existing Theme
handling in SupportUsButton: either document that Theme="inherit" is an
intentional synonym for Theme="auto" and expose that behavior in the demo, or
remove "inherit" from the Theme type and related tests/logic so only supported
modes remain.

In `@src/hooks/useParentStyles.ts`:
- Line 1: Update the import declaration in useParentStyles to import RefObject
as a type-only dependency while keeping useState, useEffect, and useLayoutEffect
as value imports.
- Around line 38-144: Update the useIsomorphicLayoutEffect containing
detectStyles to use [enabled] as its dependency array, preserving setup and
cleanup behavior while avoiding reinitialization on unrelated renders. Narrow
the document.body and document.documentElement MutationObserver configurations
by removing subtree observation, while retaining direct class/style attribute
monitoring and the existing ancestor observer.

In `@src/styles/style.css`:
- Around line 48-54: Add a prefers-reduced-motion: reduce media query targeting
.animate-sub-fade-in and .animate-sub-scale-in, disabling their entrance
animations while preserving the existing animation declarations for users
without the preference.

---

Outside diff comments:
In `@CONTRIBUTING.md`:
- Line 18: Remove the replacement character from the Table of Contents heading,
leaving the heading as “📋 Table of Contents” with the existing emoji and
Markdown structure preserved.

In `@demo/App.tsx`:
- Around line 97-152: Update the controls in the demo UI to have programmatic
accessible names: replace each descriptive span with a label associated via
matching htmlFor/id values for the theme, host background, and host font
selects, and add corresponding select ids. For the logo toggle using
setShowLogo, add an accessible name describing the background-logo action and
set aria-pressed to show the current showLogo state.

In `@src/components/SupportUsButton.tsx`:
- Around line 304-322: Update the sponsor-link buttons in the
ctaSection.sponsorLink map to open validated URLs with window.open using
noopener/noreferrer features, remove the ineffective rel attribute, and
explicitly set the button type to button. Replace key={index} with a stable
unique identifier from each link, preserving the existing navigation and styling
behavior.
🪄 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 43beba04-bfc5-4136-9caf-f4a516695113

📥 Commits

Reviewing files that changed from the base of the PR and between a15112e and f4ac8c5.

⛔ Files ignored due to path filters (1)
  • brand/logo.svg is excluded by !**/*.svg
📒 Files selected for processing (14)
  • .github/ISSUE_TEMPLATE/good_first_issue.yml
  • .github/workflows/ci.yml
  • AGENTS.md
  • BestPracticesChecklist.md
  • CONTRIBUTING.md
  • MAINTAINERS.md
  • brand/Brand.md
  • demo/App.tsx
  • package.json
  • src/__tests__/SupportUsButton.test.ts
  • src/components/SupportUsButton.tsx
  • src/hooks/useParentStyles.ts
  • src/styles/style.css
  • src/types/index.ts

Comment thread .github/ISSUE_TEMPLATE/good_first_issue.yml
Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml
Comment thread src/components/SupportUsButton.tsx
Comment thread src/components/SupportUsButton.tsx
Comment thread src/hooks/useParentStyles.ts Outdated
Comment thread src/hooks/useParentStyles.ts Outdated
Comment thread src/styles/style.css
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-cd CI/CD pipeline changes configuration Configuration file changes dependencies Dependency file changes documentation Changes to documentation files frontend Changes to frontend code github-actions GitHub Actions workflow changes gsoc javascript JavaScript/TypeScript code changes pending-coderabbit-review repeat-contributor PR from an external contributor who already had PRs merged size/XL Extra large PR (>500 lines changed) tests Test file changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants