Skip to content

💭 Dream window: gradient-style — import keeps px stripes, radial at-positions, multi-layer + Repeat off restores stops - #134

Merged
argyleink merged 6 commits into
mainfrom
dream/import-repeat-fixes
Nov 19, 2026
Merged

argyleink merged 6 commits into
mainfrom
dream/import-repeat-fixes

Conversation

@argyleink

Copy link
Copy Markdown
Owner

Problem

Follow-up to #133 (repeating gradients). An adversarial review after merge found real bugs on main, each pixel-diffed against Chrome rendering the original CSS:

  • Hand-written repeating stripes like repeating-linear-gradient(45deg, #000 0 10px, #fff 10px 20px) imported as a plain ramp: px/em/deg stop positions were dropped (diff 127/255).
  • repeating-radial-gradient(circle at 25% 25%, ...) imported blank: the at position's 25% was read as the circle size.
  • Radial/conic at x% y% positions were set under a named center, which wins in the output, so the position was lost.
  • Importing a multi-layer background applied each layer before adding it, overwriting the first layer (b, b instead of a, b).
  • Turning Repeat on auto-tiles stops to 25%; turning it back off kept the squeeze.
  • The new repeating conic preset was named "Sunburst", same as an existing preset.

Solution

  • parseGradient.ts: repeating gradients keep length/angle stop positions and length hints; the prelude/stop split uses a real leading-color check; radial size is read only from the part before at.
  • importGradient.ts: explicit at-positions go to the custom position (--) with % stripped.
  • GradientImportDialog.svelte: add the layer, await tick(), then apply.
  • GradientRepeat.svelte: Repeat off restores the pre-tile stops if they weren't edited in between.
  • Hints output through fmtPos so 4px hints round-trip. Preset renamed to "Sun Rays".

Impact

Pasting real-world repeating gradients (stripes, rays, offset radials) now gives back what you pasted. Verified in Chromium via the vite dev server: pixel diff vs original 0-0.26/255 for stripes, rays, offset radial/conic; real import dialog for multi-layer; Repeat on/off/undo/redo/URL reload; 390px + 1440px with reduced motion, no overflow, no page errors. vitest 52/52 (5 new tests fail on main), prettier + build pass.

Known leftover: a length hint (4px) shows blank in the stop editor's number field (it still outputs correctly); 45deg linear imports are handled separately in the next PR.

🤖 Generated with Claude Code

argyleink and others added 6 commits November 18, 2026 03:33
… from swallowing stops

A hand-written repeating-linear-gradient(45deg, #000 0 10px, #fff 10px 20px) imported as a
plain 0-100% ramp: length/angle positions were dropped, so the tile vanished. Repeating
gradients now keep them (normal gradients still auto-distribute, per the existing test).
The prelude scan tested whole segments as colors, so 'red 0%' never matched and every stop
fell into the prelude: radial size became the first stop's position (0% circle -> invalid
CSS, blank preview) and conic 'at 30% 40%' picked up a trailing comma. Length hints print
without a stray %.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
applyParsedToStores set the named position to 'center', which wins over x/y in the output,
and kept the % on x/y. Use the '--' custom sentinel and store unitless numbers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each extra layer was applied to the active layer before duplicating it, so 'a, b' imported
as 'b, b'. Add the layer first, wait a tick for the store->layer sync guard, then fill it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On -> off left the stops squeezed into 0-25%, so the plain gradient ended a quarter of the
way across. Restore the pre-tile stops unless they were edited in between.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…reset already exists)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@netlify

netlify Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for hd-gradients ready!

Name Link
🔨 Latest commit 49a36b6
🔍 Latest deploy log https://app.netlify.com/projects/hd-gradients/deploys/6afd8f728d103edf70d7a877
😎 Deploy Preview https://deploy-preview-134--hd-gradients.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

argyleink added a commit that referenced this pull request Nov 18, 2026
argyleink added a commit that referenced this pull request Nov 18, 2026
argyleink added a commit that referenced this pull request Nov 18, 2026
@argyleink

Copy link
Copy Markdown
Owner Author

Screenshots

pr134-before-1440.png

pr134-after-1440.png

pr134-before-390.png

pr134-after-390.png

argyleink added a commit that referenced this pull request Nov 18, 2026
@argyleink
argyleink merged commit 1d82880 into main Nov 19, 2026
5 checks passed
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.

1 participant