Skip to content

feat(widget): add typed theme token overrides - #521

Merged
anurag629 merged 2 commits into
codercops:devfrom
Sreehita-here:feat/theme-tokens
Oct 31, 2026
Merged

anurag629 merged 2 commits into
codercops:devfrom
Sreehita-here:feat/theme-tokens

Conversation

@Sreehita-here

@Sreehita-here Sreehita-here commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

What does this change?

Adds typed CSS token overrides to the widget theme, so sites can customize colors, text, and sizes through JavaScript or update(). Includes documentation, regression tests, and a minor changeset.

Closes #500

How I tested this

  • pnpm test:coverage — passed: 2,131 tests passed, 65 skipped. Widget tests and type tests also pass.
  • pnpm docs:check — passed.
  • pnpm api and pnpm api:check — passed after fixing Windows path handling in the snapshot script.
  • pnpm size — passed; loader is 4.76 kB gzipped, below the 5 kB limit.
  • Direct lint on widget files reported no errors, with warnings. The root pnpm lint command could not be verified cleanly on Windows because of path and wildcard issues.

AI assistance

Copilot helped implement and review the changes. Codex helped fix minor bugs, I reviewed and ran the checks and tests.

Checklist

  • WidgetTokens is exported, and TypeScript rejects unsupported token names.
  • Tokens are applied to the host after existing theme options, so they take precedence.
  • Unknown token names, empty values, and undefined values are ignored.
  • Tokens apply across modes, and update() preserves and changes token overrides.
  • Tests cover token application, precedence, ignored values, type errors, and updates.
  • Theming docs list every token with its purpose and light/dark defaults; the README and ThemeConfig example include tokens.
  • A minor changeset was added for @chatcops/widget.
  • API snapshots were regenerated and checked.
  • pnpm docs:check, pnpm test:coverage, and pnpm size pass. Loader size: 4.76 kB of 5 kB.
  • pnpm lint passes cleanly. The full command has Windows path/wildcard issues; direct widget lint reports no errors but has warnings.

@anurag629 anurag629 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @Sreehita-here. With dev merged in: build, typecheck, lint (38, the same as dev, so the Windows trouble was only the command), api:check for every package (so the snapshot script fix holds on macOS and Linux too), docs:check, coverage and all 85 e2e tests pass. The loader is 4.8 of 5 kB. The token table matches launcher.css. The only gap is surface-raised, which #505 added after you branched, and I'll add it with a follow-up.

@anurag629
anurag629 merged commit e3975f3 into codercops:dev Oct 31, 2026
@anurag629 anurag629 added the hacktoberfest-accepted PR counts for Hacktoberfest label Oct 31, 2026
@anurag629

Copy link
Copy Markdown
Member

Merged, thanks @Sreehita-here.

@anurag629

Copy link
Copy Markdown
Member

@Sreehita-here here's the next one: 526, a docs guide for indexing a site and moving from the Text/FAQ sources. Comment there and I'll assign it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hacktoberfest-accepted PR counts for Hacktoberfest

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Widget: theme.tokens to set any color or size token, and the full token table in the docs

2 participants