openpencil/tests/engine/tools
Danila Poyarkov 5ba5b4aad5
fix(figma-api): validate effects like Figma (#794)
* build(core): import Markdown with unplugin-raw

Core inlined ?raw imports with a hand-written Rolldown plugin that also turned plain .md imports into strings, which nothing in Core uses. unplugin-raw already does this for the Vue SDK and design-jsx; use it here too and drop the unused *.md module declaration.

* refactor(pen): use the scene-graph color parser

pen/src/color.ts duplicated parseColor from @open-pencil/scene-graph/color line for line. Import it instead, which also drops pen's direct culori dependency.

* fix(figma-api): validate effects like Figma

The effects setter stored whatever a script passed, so scripts that Figma rejects ran here and malformed effects reached rendering and .fig export. Validate against Figma's effect shapes with Valibot, recorded from live Figma: strict objects, required shadow fields, radius >= 0, RGBA channels within 0..1, and no shadow fields on blurs. The getter now returns Figma's shape so node.effects = node.effects keeps working.

Closes #786

* fix(figma-api): reject infinite numbers in effects

Figma rejects Infinity in every effect number ("Number must be finite"), but v.number() accepts it, so infinite radii, offsets, and spreads reached the scene graph.

* fix(figma-api): store PASS_THROUGH shadow blend as NORMAL

PASS_THROUGH is a layer blend mode. Live Figma accepts it on drop and inner shadows but reads NORMAL back, so do the same instead of storing it.
2026-09-30 21:18:20 +04:00
..
analyze/overlaps test(tools): create control-case node on the plain graph 2026-06-19 11:47:37 +10:00
calc fix(tools): evaluate calc expressions without expr-eval (#753) 2026-09-25 01:44:46 +04:00
modify chore: format codebase 2026-05-24 12:15:29 +03:00
stock-photo fix: protect unsaved documents and defer credential access (#713) 2026-09-17 15:25:15 +03:00
xpath test(engine): move root tests into domains 2026-05-16 12:30:27 +03:00
ai-adapter.test.ts refactor(tools): default interface exposure to inclusion 2026-09-15 17:12:31 +03:00
cli.test.ts fix(figma-api): validate effects like Figma (#794) 2026-09-30 21:18:20 +04:00
create.test.ts refactor(tools)!: centralize schemas and execution contracts 2026-09-15 10:55:27 +03:00
describe.test.ts fix(tools): judge describe text contrast by WCAG ratio (#758) 2026-09-30 11:32:34 +04:00
eval-wrap.test.ts refactor(tools): use acorn AST parser for eval wrapping 2026-05-11 12:15:38 +03:00
export-image.test.ts feat(ai): add isolated visual inspection 2026-08-13 21:15:44 +03:00
input.test.ts fix(tools): preserve atomic property state and validate inputs 2026-09-15 16:47:37 +03:00
library-components.test.ts feat: add Figma-style variants and component libraries (#512) 2026-08-14 19:31:41 +03:00
modify.test.ts chore(tests): guard modify tool assertions 2026-05-06 11:20:49 +03:00
read.test.ts ci: shard unit tests by owner and cut the quick suite from 100 s to 13 s (#715) 2026-09-17 10:18:16 +03:00
registry.test.ts refactor(tools): default interface exposure to inclusion 2026-09-15 17:12:31 +03:00
structure.test.ts chore(tests): remove targeted non-null assertions 2026-05-06 03:13:58 +03:00