Repository navigation
feat(shaders): dashedBorder prop, default registration and DOM renderer fallback - #103
Open
lorenzopantano wants to merge 1 commit into
Open
lorenzopantano wants to merge 1 commit into
lorenzopantano wants to merge 1 commit into
Conversation
…er fallback @solidtv/renderer 2.0.9 ships a built-in DashedBorder shader. Wire it into Solid like the other default shaders: - defaultShaderDashedBorder / registerDefaultShaderDashedBorder, registered by registerDefaultShaders as 'dashedBorder' - a `dashedBorder` prop (raw shader accessor), typed in Effects and the DOM renderer's shader props - DOM renderer: CSS gradients in the node's border layer, so dash, gap, width, color and radius come from the props there too: a dashed strip per straight side and, with a radius, a quarter ring per corner (drawn as one dash). -webkit- syntax first for older WebKit. The renderer peer range moves to ^2.0.9, the first version with DashedBorder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pecoram
approved these changes
Dec 1, 2026
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
@solidtv/renderer2.0.9 ships a built-inDashedBordershader, but Solid doesn't expose it yet. This PR wires it in the same way as the other default shaders:defaultShaderDashedBorderandregisterDefaultShaderDashedBorder.registerDefaultShadersregisters it as'dashedBorder'.dashedBorderprop, using the raw shader accessor likelinearGradient/radialGradient. It's typed inEffectsand in the DOM renderer's shader props.dash,gap,width,color,radius).DOM renderer
CSS
border-style: dashedlets the browser pick the dash and gap lengths, so it looks nothing like the shader. Instead,dashedBorderStyle()builds CSS gradients and puts them in the node's existingdivBorderlayer. That layer sits above the fill and below the children, so the node keeps its size and its children don't move.repeating-linear-gradientstrip per side,widththick. Dash and gap are stretched so a whole number of them fits.radius: a quarter ring per corner (radial-gradient), drawn as one dash. The straight part between two corners runs gap, dash, …, dash, gap.gap <= 0draws a solid border, anddash <= 0draws nothing, same as the shader.-webkit-syntax first.Known difference from WebGL: a rounded corner is always one solid dash, while the shader keeps dashing around the curve. With a large radius, the corner dash is longer than
dash.Renderer peer range
The peer range moves from
^2.0.7to^2.0.9, becauseDashedBorderfirst ships in 2.0.9. The lockfile is pinned to 2.0.9 on purpose. 2.0.10 and later add a requiredtruncatedfield toNodeTextLoadedPayload, which breakstscindomRenderer.ts(the textloadedpayload). That break is unrelated to this change and would need its own fix.Tests
tests/dashedBorder.test.tsxwith 9 tests: the shader type and props, the DOM layer, restyle on update, and the gradient geometry with and without a radius.tests/publicApi.test.tsandtests/contract-types.tsxare updated for the new exports.pnpm testpasses (789), as dopnpm run tscandpnpm run lint:prettier.🤖 Generated with Claude Code