Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit introduces functions to create blocks more conveniently. The functions `text()` and `image()` can be used to create blocks that contain text or images. The functions `columns()` and `rows()` can be used to create blocks that contain other blocks. Using these functions enables better suggestions in the editor. Since they return objects with a specific type, less type annotations are required in the code. For example, the following line of code ```ts const block: Block = { rows: [ { text: 'Hello World!', { fontWeight: 'bold' } }, { image: 'liberty.jpg', height: 55, imageAlign: 'left' }, ], margin: { x: 75, y: 10 }, }; ``` can now be replaced with: ```ts const block = rows( [ text('Hello World!', { fontWeight: 'bold' }), image('liberty.jpg', { height: 55, imageAlign: 'left' }), ], { margin: { x: 75, y: 10 } }, ); ```
- Loading branch information