fix(tools): document inline SVG path rendering
Document the supported inline SVG path route in the render tool prompt. Keep coverage focused on separate open and closed stroked vector paths.
This commit is contained in:
parent
1f2f2468cc
commit
80cebe0767
|
|
@ -4,7 +4,7 @@ export const render = defineTool({
|
|||
name: 'render',
|
||||
mutates: true,
|
||||
description:
|
||||
'Render JSX to design nodes. Use replace_id to swap a skeleton placeholder with real content (keeps position in parent). Example: <Frame name="Card" w={320} h="hug" flex="col" gap={16} p={24} bg="#FFF" rounded={16}><Text size={18} weight="bold">Title</Text></Frame>',
|
||||
'Render JSX to design nodes. Supports inline SVG paths, including open stroked paths: <svg viewBox="0 0 24 24" size={24}><path d="M2 12 L22 12" stroke="#000" fill="none" /></svg>. Use replace_id to replace a placeholder while preserving its position.',
|
||||
params: {
|
||||
replace_id: {
|
||||
type: 'string',
|
||||
|
|
|
|||
|
|
@ -27,6 +27,20 @@ describe('jsx gaps', () => {
|
|||
expect(vector?.vectorNetwork).toBeTruthy()
|
||||
})
|
||||
|
||||
it('renders open and closed SVG paths as separate stroked vectors', async () => {
|
||||
const g = makeSceneGraph()
|
||||
await renderJSX(
|
||||
g,
|
||||
`<svg viewBox="0 0 24 24" size={24}><path d="M2 2 L22 2" stroke="#000" fill="none" /><path d="M2 6 H22 V22 H2 Z" stroke="#000" fill="none" /></svg>`
|
||||
)
|
||||
const vectors = [...g.nodes.values()].filter((node) => node.type === 'VECTOR')
|
||||
expect(vectors).toHaveLength(2)
|
||||
for (const vector of vectors) {
|
||||
expect(vector.vectorNetwork?.vertices.length).toBeGreaterThan(0)
|
||||
expect(vector.strokes.length).toBeGreaterThan(0)
|
||||
}
|
||||
})
|
||||
|
||||
it('instance overrides apply child text by name', async () => {
|
||||
const g = makeSceneGraph()
|
||||
await renderJSX(
|
||||
|
|
|
|||
Loading…
Reference in a new issue