* refactor: rename @open-pencil/codegen to @open-pencil/emit In design tools codegen means design-to-code, which is dom-css's job and Core's codegen tools'. The package builds and prints the syntax trees exporters emit, so name it for that. It has not been released yet. * fix: alias @open-pencil/emit to its source in Vite The rename missed the escaped regex, so Vite resolved the package through its built dist output.
1.4 KiB
1.4 KiB
Design JSX
OpenPencil's design JSX: the elements (Frame, Text, …) and the trees they build, paint and effect helpers, design variables, the prop schema and authoring reference, component transforms, the string renderer, and sceneNodeToJSX/selectionToJSX export.
Rules:
- Depend only on
@open-pencil/scene-graphand@open-pencil/emit. Engine work the renderer needs — icon lookup, SVG path conversion, vector node creation, and layout — comes in throughDesignJSXServices(src/services.ts). Core binds them inpackages/core/src/design-jsx/renderer.tsand exports the boundrenderJSXandrenderTreefrom@open-pencil/core/design-jsx. src/streaming/parses JSX as it streams in and projects the static subset into trees without evaluating expressions; Core'spackages/core/src/design-jsx/preview/stages and records those trees on the canvas.- JSX export (
src/export/) collects typed props inprops.tsand prints them with@open-pencil/emit's JSX builders; never build JSX from string fragments. src/reference/authoring.mdis the source of the shared authoring reference. Runbun run generate:authoring-referenceafter changing it or the schema; never edit the generated copies.- Tests that need icons, layout, or the bound renderer live in
packages/core/tests/design-jsx(existing ones still intests/engine/render/jsx); tests of trees, parsing, schema, and export live inpackages/design-jsx/tests.