0
Fork 0
mirror of https://github.com/penpot/penpot-export.git synced 2025-01-06 14:50:10 -05:00
Commit graph

47 commits

Author SHA1 Message Date
Roberto Redradix
f33dc7a9b8 feat(core): allow to export SCSS files 2023-09-07 16:59:03 +02:00
Roberto Redradix
c035375084 chore(demo): update assets and HTML 2023-09-07 16:58:39 +02:00
Roberto Redradix
9a39da7a65 refactor(core): delegate CSS tokenization and serialization to the outputter 2023-09-07 16:58:39 +02:00
Roberto Redradix
b76d4d57ef refactor(core): serialize each CSS variable at a time 2023-09-07 10:50:33 +02:00
Roberto Redradix
70c3d9a665 refactor(core): sort config types 2023-09-05 17:56:42 +02:00
Roberto Redradix
abe6e54f4a chore(demo): update with JSON outputs 2023-09-05 14:43:33 +02:00
Roberto Redradix
98597dbf4c feat!(core): allow to export JSON files
BREAKING CHANGE: CSS variables (color) are no longer lowercase. Since CSS custom property names are case sensitive, this would break existing consumers.
2023-09-05 14:40:00 +02:00
Roberto Redradix
1fd8a579de chore(core): remove unused type imports 2023-09-05 12:08:32 +02:00
Roberto Redradix
bef9cd65ef refactor(core): remove PenpotExportFile cumbersome abstraction 2023-09-05 12:03:54 +02:00
Roberto Redradix
924d5bec7b refactor(core): colocate schemas, types and validators 2023-09-04 18:49:12 +02:00
Roberto Redradix
f7b972e032 chore(core): disallow empty arrays in user config 2023-09-04 17:42:36 +02:00
Roberto Redradix
83ba6f93d5 refactor(core): validate user config in a more expressive way
zod unions are exclusive, so the UserConfig type couldn't be kept as a union either for having at least a colors, typographies or pages output.

This check has been moved to a runtime zod refine custom validation.
2023-09-04 17:42:34 +02:00
Roberto Redradix
bf6f6a723a test(core): add tests for CSS ident tokens 2023-09-04 13:41:32 +02:00
Roberto Redradix
e35186eae9 refactor!: split penpot-export into cli and core modules 2023-09-01 17:43:45 +02:00
Roberto Redradix
e13d644805 refactor!(cli): rename pentpot-css-export to penpot-export 2023-09-01 17:43:45 +02:00
Roberto Redradix
ec802a35d0 feat!(cli): output CSS colors with alpha channel 2023-09-01 17:43:45 +02:00
Roberto Redradix
41303b0a51 docs(demo): document environment variables 2023-09-01 17:43:45 +02:00
Roberto Redradix
7f43fc1d98 refactor(cli): extract adapters and a CSS outputter 2023-09-01 17:43:45 +02:00
Roberto Redradix
66f0b48fa4 refactor(cli): difference API and internal types
Take the opportunity to merge PentpotApiPage and PenpotApiObject into PenpotApiContainer to follow more closely the Penpot data model
2023-09-01 17:43:45 +02:00
Roberto Redradix
30494680a6 fix(cli): correctly validate undefined instance 2023-09-01 17:43:45 +02:00
Roberto Redradix
f53464baad chore(cli): remove residual console.log 2023-08-31 20:34:08 +02:00
Roberto Redradix
899a8b6572 docs: update configuration example 2023-08-31 20:28:14 +02:00
Roberto Redradix
6fbc1adace chore(cli): fix whitespace after emoji in logs
U+1F5BC FRAME WITH PICTURE requires appending a U+FE0F VARIATION SELECTOR-16 so that its emoji representation is forced. This causes terminal emulators to not reserve space for the next character. A hack consisting in using a U+00A0 NO-BREAK SPACE afterwards works, but copying the output and pasting it elsewhere will cause a double space.

Replacing U+1F5BC FRAME WITH PICTURE with another emoji that doesn't have a textual representation like U+1F3A8 ARTIST PALETTE solves this.
2023-08-31 20:23:27 +02:00
Roberto Redradix
d2540b3765 chore(cli): split validating user config from normalizing app config
Also, be more exhaustive with types and errors
2023-08-31 20:23:27 +02:00
Roberto Redradix
990260bf81 chore(cli): remove get-page call
Instead of making a new call to the Penpot API to retrieve page components, retrieve them from the Penpot file already downloaded.

Midway, it fixes some Penpot API types from arrays to records.
2023-08-31 20:23:27 +02:00
Roberto Redradix
ce380d99b7 feat(cli): redesign user config 2023-08-31 20:23:27 +02:00
Roberto Redradix
06b8da67fe feat(cli): support third-party Penpot instances 2023-08-30 13:34:40 +02:00
Roberto Redradix
3a61990e62 chore(demo): demonstrate colors CSS working in a web document 2023-08-29 18:14:02 +02:00
Roberto Redradix
e2812c99ea feat(cli): allow exporting colors CSS vars 2023-08-29 18:14:02 +02:00
Roberto Redradix
c5288352ab chore(demo): update typography demo and generated CSS 2023-08-29 17:23:04 +02:00
Roberto Redradix
ee2531f6c6 chore(cli)!: avoid non-obvious CSS class names clashing errors
As observed in fa873130, current classname PoC tranformation is prone to name clashing errors because it replaces everything not matching `/[a-zA-Z_-|0-9]/g` with underscores. However, as names from typography assets coming from Penpot can hold these values (and often they will, because designers consider emoji useful specially in asset names), the tranformation needed a more thorough algorhythm to avoid clashing errors.

This implementation follows the CSS specification and browser behaviours, which allow more than those characters in class names (including non-ASCII Unicode characters, and even escaped ASCII characters that CSS uses in its syntax), to output valid CSS class nameswith a minimum surface of clashing possibilities.

Since any transformation will decrease the entropy because CSS syntax is a subset of Unicode, there are inevitable clash zones, though. Those zones are reduced to two easily observable cases: duplicated names with explicit underscores instead of spaces, and duplicated names with surrounding whitespace; e.g. "My typography", "My_typography", " My typography" or "My typography " will clash if any pair of those ever happen together.

BREAKING CHANGE: class names generation is no longer case insensitive.
2023-08-29 17:23:04 +02:00
Roberto Redradix
d0e18709f1 chore(demo): demonstrate typography CSS working in a web document 2023-08-29 17:23:04 +02:00
Roberto Redradix
c201db2f2d chore(demo): generate typographies CSS 2023-08-29 17:23:04 +02:00
Roberto Redradix
61ec971192 chore(cli): temporarily avoid conflicting normalized typography names 2023-08-29 17:23:04 +02:00
Roberto Redradix
e19ea35b84 feat: allow exporting typographies CSS 2023-08-29 17:23:04 +02:00
Roberto Redradix
028e29f4c0 chore(cli): avoid creating a static array instance for base config
The `pages` property is overwritten at `validateAndNormalizePenpotExportConfig` to avoid an infinite loop. Remove that possibility altogether.
2023-08-22 17:50:00 +02:00
Roberto Redradix
218e01636f feat(cli): show a meaninfull error for Penpot API error responses 2023-08-22 17:11:54 +02:00
Roberto Redradix
1754228058 style(cli): format code base 2023-08-22 13:54:58 +02:00
Roberto Redradix
aa2b97c571 build(cli): set up code formatter 2023-08-22 13:54:53 +02:00
Roberto Redradix
712ae191e7 build(cli): use a valid license in package.json 2023-08-22 13:54:35 +02:00
Roberto Redradix
878d18dcb2 chore(demo): update Penpot file id 2023-08-22 13:54:25 +02:00
Roberto Redradix
1edea394de chore(demo): fix config type annonation 2023-08-22 13:54:09 +02:00
Roberto Redradix
e42be8ea53 build(workspace): fix demo npm script 2023-08-22 13:53:51 +02:00
Enrique Bernabeu
d8a4b33d2b Enhanced documentation 2023-08-21 08:43:42 +02:00
Enrique Bernabeu
efa9daee67 Add yarn workspaces link 2023-08-21 08:41:36 +02:00
Enrique Bernabeu
49dd395dc8 Moved types 2023-08-21 08:40:26 +02:00
Enrique Bernabeu
9eed1481ce Initial commit 2023-08-21 08:36:47 +02:00