-
Notifications
You must be signed in to change notification settings - Fork 14
feat: implement auto theme inheritance with dev preview support, repo standards, brand assets & animations #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
bhavik-mangla
merged 3 commits into
AOSSIE-Org:main
from
reach2saksham:feat/inheritance-enhancement
Aug 1, 2026
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| name: CI & Quality Checks | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main, develop] | ||
| pull_request: | ||
| branches: [main, develop] | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build-and-test: | ||
| name: Type-Check, Test & Build | ||
| runs-on: ubuntu-latest | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 | ||
| with: | ||
| node-version: 20 | ||
| cache: "npm" | ||
|
|
||
| - name: Install Dependencies | ||
| run: npm install | ||
|
|
||
| - name: Type Check | ||
| run: npm run type-check | ||
|
|
||
| - name: Run Tests | ||
| run: npm test | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| - name: Build Package | ||
| run: npm run build | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| # SupportUsButton — AI Agent Guidelines & Architecture Directives | ||
|
|
||
| Welcome, AI Agent! This document contains essential instructions, code style standards, and architectural directives for operating on the **SupportUsButton** repository. | ||
|
|
||
| --- | ||
|
|
||
| ## 🛠️ Stack & Workspace Overview | ||
|
|
||
| - **Package Name:** `support-us-button` | ||
| - **Framework:** React 19 / React 18 (`react`, `react-dom`) | ||
| - **Language:** TypeScript 5.9 (`tsconfig.json`) | ||
| - **Styling:** Tailwind CSS v4 (`@tailwindcss/cli` & `@tailwindcss/vite`) | ||
| - **Bundler:** Rollup 4 (`rollup.config.js`) | ||
| - **Dev Preview:** Vite 8 (`demo/App.tsx`) | ||
|
|
||
| ### Key Build & Test Commands: | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| - **Type-Check:** `npx tsc --noEmit` | ||
| - **Build Package:** `npm run build` | ||
| - **Develop Demo:** `npm run dev:demo` | ||
|
|
||
| --- | ||
|
|
||
| ## 🎨 Theme Inheritance Architecture | ||
|
|
||
| 1. **Default Theme (`Theme="auto"`)**: | ||
| - The component MUST inherit the host website's font family (`font-inherit`) and background natively via CSS transparency (`bg-transparent text-inherit`). | ||
| - Do **NOT** hardcode fixed background colors or font stacks on the outer component wrapper when `Theme="auto"`. | ||
|
|
||
| 2. **Parent Style Detection (`useParentStyles` hook)**: | ||
| - Uses `window.getComputedStyle` with upward DOM traversal inside `useIsomorphicLayoutEffect`. | ||
| - Used primarily to evaluate relative luminance (`isDarkColor`) to invert logo (`brightness-0 invert`) and button contrast dynamically. | ||
|
|
||
| --- | ||
|
|
||
| ## 📁 Repository Structure | ||
|
|
||
| ```text | ||
| SupportUsButton/ | ||
| ├── brand/ # Brand assets (logo.svg, favicon.svg, Brand.md) | ||
| ├── demo/ # Interactive Vite Dev Preview app (App.tsx) | ||
| ├── dist/ # Bundled package outputs (ESM, CJS, UMD, style.css) | ||
| ├── src/ | ||
| │ ├── components/ # SupportUsButton.tsx | ||
| │ ├── hooks/ # useParentStyles.ts | ||
| │ ├── styles/ # style.css (Tailwind v4 input) | ||
| │ ├── types/ # index.ts (TypeScript definitions) | ||
| │ └── index.ts # Main package entrypoint | ||
| ├── AGENTS.md # AI agent instructions (this file) | ||
| ├── BestPracticesChecklist.md # Audit & best practices status | ||
| ├── MAINTAINERS.md # Project maintainers and mentors | ||
| ├── README.md # User-facing package documentation | ||
| └── rollup.config.js # Rollup bundler configuration | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## ⚠️ Important Guidelines for Agents | ||
|
|
||
| 1. **Preserve Compatibility**: Maintain support for both React 18 and React 19. | ||
| 2. **Always Run Type-Check & Build**: Before declaring a task completed, execute `npx tsc --noEmit` and `npm run build`. | ||
| 3. **No Unneeded Dependencies**: Avoid adding external runtime dependencies unless explicitly approved. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # AOSSIE Best Practices Checklist — SupportUsButton | ||
|
|
||
| This document tracks compliance with the **AOSSIE Best Practices Guidelines** for the **SupportUsButton** project. | ||
|
|
||
| --- | ||
|
|
||
| ## 🔴 Must (Mandatory Practices) | ||
|
|
||
| - [x] **Licensing & Copyright**: Includes GNU General Public License v3.0 in [`LICENSE`](LICENSE). | ||
| - [x] **Project Branding**: Complete SVG logo, favicon, color palette, and typography documented in [`brand/Brand.md`](brand/Brand.md). | ||
| - [x] **Maintainers List**: Listed in [`MAINTAINERS.md`](MAINTAINERS.md). | ||
| - [x] **Clean Documentation**: `README.md` and `CONTRIBUTING.md` contain no broken links or TODOs left. | ||
| - [x] **Build & Run Instructions**: `README.md` contains clear installation, development, testing, and build instructions. | ||
| - [x] **Type Safety**: Written in 100% strict TypeScript with type definitions exported. | ||
| - [x] **No Magic Constants**: Styling tokens and default properties are configured cleanly in types and CSS variables. | ||
| - [x] **Zero Build Warnings**: `npm run build` compiles cleanly with zero warnings or errors. | ||
| - [x] **AI Agent Directives**: Context and operational guidelines provided in [`AGENTS.md`](AGENTS.md). | ||
| - [x] **CodeRabbit Configuration**: Customized in [`.coderabbit.yaml`](.coderabbit.yaml). | ||
|
|
||
| --- | ||
|
|
||
| ## 🟡 Should (Recommended Practices) | ||
|
|
||
| - [x] **Automatic Host Style Adaptation**: Package inherits host page `font-family`, `background-color`, and `color` natively. | ||
| - [x] **Contrast Fail-Safes**: Dynamic relative luminance contrast calculation (`isDarkColor`) for logo and button visibility on light/dark host themes. | ||
| - [x] **Automated Testing & CI**: Unit testing and GitHub Actions workflow configured for PR validation. | ||
| - [x] **Micro-Animations**: GPU-accelerated CSS keyframe transitions (`animate-sub-fade-in`, `animate-sub-scale-in`). | ||
| - [x] **Zero Third-Party UI Dependencies**: Ultra-lightweight package architecture (only standard `tslib` helper; zero external UI framework dependencies) producing ~12 KB minified JS output (`dist/index.esm.js`) and ~4 KB minified CSS (`dist/style.css`). | ||
| - [x] **Multi-Bundle Formats**: Exports ESM (`dist/index.esm.js`), CommonJS (`dist/index.cjs.js`), and UMD (`dist/index.umd.js`). | ||
|
|
||
| --- | ||
|
|
||
| ## 🟢 Could (Optional / Future Enhancements) | ||
|
|
||
| - [ ] Interactive online playground demo deployed to GitHub Pages. | ||
| - [ ] Automated npm release workflow via GitHub Actions on tagged releases. | ||
|
|
||
| --- | ||
|
|
||
| ## 📑 Verification Log | ||
|
|
||
| * **TypeScript Validation (`npx tsc --noEmit`)**: ✅ Passed (0 errors) | ||
| * **Bundle Build (`npm run build`)**: ✅ Passed (0 warnings) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # Maintainers | ||
|
|
||
| This document lists the maintainers of the **SupportUsButton** project. | ||
|
|
||
| | Name | GitHub Username | Discord Username | Email Address | | ||
| | -------------------------------- | ------------------ | ------------------ | ---------------------------- | | ||
| | Bruno Woltzenlogel Paleo | @Zahnentferner | @b.wp | zahnentferner@gmail.com | | ||
| | Rahul Vyas | @rahul-vyas-dev | @rahulvyas_dev | rahulvyas.5100@gmail.com | | ||
| | Saksham Jain | @reach2saksham | @theonlypro | reach2saksham2004@gmail.com | | ||
|
|
||
| --- | ||
|
|
||
| ## 📩 Contacting Maintainers | ||
|
|
||
| * **Security Vulnerabilities**: For private security reports, please email [reach2saksham2004@gmail.com](mailto:reach2saksham2004@gmail.com) directly before public disclosure. | ||
| * **Architectural Questions & Governance**: | ||
| 1. **AOSSIE Discord Channel**: [#support-us-button](https://discord.gg/hjUhu33uAn) | ||
| 2. **GitHub Issues**: [github.com/AOSSIE-Org/SupportUsButton/issues](https://github.com/AOSSIE-Org/SupportUsButton/issues) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| # SupportUsButton — Brand & Design Specifications | ||
|
|
||
| This document defines the official branding, logo assets, color palette, typography guidelines, and design tokens for the **SupportUsButton** project by **AOSSIE**. | ||
|
|
||
| --- | ||
|
|
||
| ## 🎨 Brand Identity Overview | ||
|
|
||
| **SupportUsButton** is an open-source, customizable, tier-based React component package designed to display donation and sponsorship options cleanly on web applications while seamlessly adapting to any host site's visual theme. | ||
|
|
||
| --- | ||
|
|
||
| ## 🖼️ Logo & Assets | ||
|
|
||
| All official brand assets are located inside the [`brand/`](./) directory. | ||
|
|
||
| * **Primary Logo (SVG)**: [`logo.svg`](./logo.svg) | ||
| * **Favicon / Logomark (SVG)**: [`favicon.svg`](./favicon.svg) | ||
|
|
||
| ### Usage Rules: | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| * Always maintain aspect ratios when displaying the SVG logo. | ||
| * On dark backgrounds, use the primary logo or inverted contrast version (`brightness-0 invert`). | ||
| * On light host backgrounds, use dark contrast text and borders (`brightness-0`). | ||
|
|
||
| --- | ||
|
|
||
| ## 🎨 Color Palette | ||
|
|
||
| The SupportUsButton brand palette balances modern dark UI elements with high-contrast accent highlights. | ||
|
|
||
| | Token | Hex Value | RGB / HSL | Usage | | ||
| | :--- | :--- | :--- | :--- | | ||
| | **Accent Primary** | `#ffd700` | `rgb(255, 215, 0)` | Hover highlights, primary CTA accents, gold tier badges | | ||
| | **Dark Background** | `#191919` | `rgb(25, 25, 25)` | Predefined dark theme container background | | ||
| | **Dark Surface** | `#111111` | `rgb(17, 17, 17)` | Surface containers and card backgrounds | | ||
| | **Light Background** | `#F4F4F4` | `rgb(244, 244, 244)` | Predefined light theme container background | | ||
| | **Text Dark** | `#191919` | `rgb(25, 25, 25)` | Text on light backgrounds | | ||
| | **Text Light** | `#F4F4F4` | `rgb(244, 244, 244)` | Text on dark backgrounds | | ||
|
|
||
| --- | ||
|
|
||
| ## 🔤 Typography | ||
|
|
||
| SupportUsButton is designed with **automatic font-family inheritance** so that it matches the host website typography natively out-of-the-box. | ||
|
|
||
| ### Font Family Specs: | ||
|
|
||
| * **Primary (Inherited)**: `font-family: inherit` (Default for `Theme="auto"`) | ||
| * **Fallback Stack**: `system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif` | ||
| * **Heading Sizes**: | ||
| * Hero Title: `text-3xl sm:text-3xl md:text-5xl` (`font-medium`) | ||
| * Section Headers: `text-xl sm:text-2xl lg:text-3xl` (`font-medium`) | ||
| * CTA Button Text: `text-[18px]` (`font-semibold`) | ||
|
|
||
| --- | ||
|
|
||
| ## 📦 CSS Custom Variables | ||
|
|
||
| Host applications can override custom CSS variables if explicit theme control is needed: | ||
|
|
||
| ```css | ||
| :root { | ||
| --color-primary: #ffd700; | ||
| --color-background-light: #f4f4f4; | ||
| --color-background-dark: #191919; | ||
| } | ||
| ``` | ||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.