Skip to content

feat: stealthis theming + copyDittoTheme#41

Merged
dskvr merged 11 commits into
mainfrom
enhance/stealthis-theme
Apr 9, 2026
Merged

feat: stealthis theming + copyDittoTheme#41
dskvr merged 11 commits into
mainfrom
enhance/stealthis-theme

Conversation

@dskvr
Copy link
Copy Markdown
Contributor

@dskvr dskvr commented Apr 8, 2026

Summary

  • Add accent, background, text, radius HTML attributes to <steal-this> for declarative theming via CSS custom properties
  • Migrate all hardcoded hex values in styles.css to var(--steal-this-*) with inline fallback defaults
  • Add copy-ditto-theme attribute: resolves naddr to kind 36767/16767 Ditto theme event, extracts colors/fonts/background per Ditto NIP spec
  • Add deploy-flow "Copy theme" step: shows resolved theme preview (color swatches, fonts, background), publishes kind 16767 active profile theme to user's write relays with overwrite warning
  • When only accent is set, modal surfaces (bg, inputs, borders) derive dark shades from accent via color-mix for cohesive theming

Closes #24

Test plan

  • Set accent="#e74c3c" — button AND modal should show red theme
  • Set background="#2d2d44" accent="#3498db" — modal surfaces reflect custom bg
  • Set radius="0" — sharp corners everywhere; radius="16px" — rounded
  • Set copy-ditto-theme="naddr1..." with a valid Ditto theme naddr — verify theme preview step appears after auth
  • Malformed naddr — no crash, deploy proceeds normally
  • "Copy theme" publishes kind 16767 event; "Skip" bypasses

dskvr and others added 9 commits April 8, 2026 23:55
- Replace all hardcoded hex colors with var(--steal-this-*) inline fallbacks
- Add accent, bg, input-bg, border, text, muted, dim, radius tokens
- Use color-mix() for hover states (accent-hover, trail-link hover)
- Keep semantic error/success/white colors hardcoded (#e74c3c, #c0392b, #2ecc71, #fff)
- Use calc() scale for border-radius variants (0.75x inputs, 0.5x inner elements)
- Add accent, background, text, radius to observedAttributes
- Add themeVars getter generating :host { --steal-this-* } CSS from attributes
- Derive input-bg and border from background via color-mix()
- Derive muted and dim from text via color-mix()
- Prepend themeVars block before STYLES in render() for shadow DOM inheritance
- Export DittoTheme interface: { accent?, background?, text?, radius? }
- Export fetchDittoTheme(naddr) that decodes naddr bech32, queries kind
  from naddr using naddr relay hints + BOOTSTRAP_RELAYS fallback
- Picks highest created_at event, parses JSON content for color fields
- Returns null on any failure (invalid naddr, no event, parse error)
- Add "copy-ditto-theme" to observedAttributes
- Add dittoThemePromise and _dittoTheme private fields
- Add dittoTheme public getter for Phase 23 access
- Start fetchDittoTheme() in constructor (parallel with manifestPromise)
  when copy-ditto-theme attribute is present
- Widget visual appearance is unaffected (themeVars unchanged)
Ditto theme events (kind 36767/16767) store colors in c tags
(["c", "#rrggbb", "primary"|"text"|"background"]), not in the
JSON content field. Also made DittoTheme fields required (primary,
background, text) and removed radius (not part of Ditto spec).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Parse all Ditto NIP theme tags: c (colors), f (fonts with body/title
roles), bg (background with imeta-style variadic format), and title.
Store the original event for tag passthrough. Add createActiveThemeEvent()
to build kind 16767 from resolved theme, and checkExistingTheme() to
detect if user already has an active profile theme.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add "ditto-theme" state to the widget state machine. After auth,
if a Ditto theme was resolved via copy-ditto-theme attribute, show
a preview step with color swatches, font info, and background info
from the Ditto NIP spec. User can "Copy theme" (publishes kind
16767 to write relays) or "Skip" to proceed to deploy form.
Checks for existing active theme and shows overwrite warning.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The :host { } block inside shadow.innerHTML was not reliably
inheriting CSS custom properties to modal children. Switch to
this.style.setProperty() on the host element directly — these
persist across shadow DOM innerHTML rewrites and inherit into
all shadow DOM children. Also call applyThemeVars() in constructor
and attributeChangedCallback for all theme attributes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When only accent is set (no explicit background attribute), derive
--steal-this-bg, --steal-this-input-bg, and --steal-this-border
from the accent color using color-mix with high black percentages.
This makes the entire modal feel cohesive with just a single accent
color attribute instead of only coloring the extension button.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dskvr dskvr requested a review from hzrd149 April 8, 2026 22:49
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 8, 2026

Bundle Size Report

Bundle Base PR Delta Status
relay 126.5 KB 126.5 KB +0.0 KB ✅ OK
blossom 64.3 KB 64.3 KB +0.0 KB ✅ OK
gateway 235.1 KB 235.1 KB +0.0 KB ✅ OK

Generated by CI — hard limit 1MB, warning at 750KB.

@dskvr
Copy link
Copy Markdown
Contributor Author

dskvr commented Apr 8, 2026

screenshot_2026-04-09_00-49-54 screenshot_2026-04-09_00-50-17

dskvr and others added 2 commits April 9, 2026 00:53
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Return null early if the decoded naddr kind is not 36767 (theme
definition) or 16767 (active profile theme).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@hzrd149 hzrd149 left a comment

Choose a reason for hiding this comment

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

Mostly style changes. looks good 👍

@dskvr dskvr merged commit d074ed5 into main Apr 9, 2026
6 checks passed
@dskvr dskvr deleted the enhance/stealthis-theme branch April 9, 2026 17:37
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.

[stealthis] add new "copyDittoTheme" attribute

2 participants