Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin relaunch, initial setup, features and refactoring #52

Merged
merged 107 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
308fa93
Update packages and add linters (#1)
jordisala1991 Apr 8, 2024
6dbee90
draft
Cenadros Apr 8, 2024
a2cd095
fix package.json
Cenadros Apr 8, 2024
09e714a
Merge pull request #3 from Runroom/feature/figma-dynamica-load
Cenadros Apr 8, 2024
80ac20c
removed debug
Cenadros Apr 8, 2024
6067b0c
update export logic
Cenadros Apr 8, 2024
cedb9fc
Merge pull request #4 from Runroom/feature/refactor
Cenadros Apr 8, 2024
c2d16dd
updated structure
Cenadros Apr 8, 2024
9d1e0d2
Merge pull request #6 from Runroom/feature/converters
Cenadros Apr 8, 2024
939b9db
modify structure
jordisala1991 Apr 8, 2024
6c50cb4
ignore penpot.js
jordisala1991 Apr 8, 2024
f9531f8
Merge pull request #7 from Runroom/hotfix/structure
Cenadros Apr 9, 2024
3f0ca99
fonts msg
Cenadros Apr 9, 2024
77cfd0b
Merge pull request #8 from Runroom/hotfix/missing-fonts
Cenadros Apr 9, 2024
0d10f51
move component out of the ui (#10)
jordisala1991 Apr 9, 2024
bbaaeae
Move to function component (#11)
jordisala1991 Apr 9, 2024
7c9dd0b
remove eslint disable (#12)
jordisala1991 Apr 9, 2024
4b2e563
refactor
Cenadros Apr 9, 2024
9c2be58
minor fix
Cenadros Apr 9, 2024
ffcf040
Merge pull request #13 from Runroom/feature/code-refactor
Cenadros Apr 9, 2024
c58830b
Upgrade penpot library
jordisala1991 Apr 9, 2024
7196172
fix
jordisala1991 Apr 9, 2024
eb2315e
fix
jordisala1991 Apr 9, 2024
6dfe4dd
start adding options
jordisala1991 Apr 9, 2024
29fd527
wip
jordisala1991 Apr 10, 2024
df81ee5
lib updated
Cenadros Apr 10, 2024
890e7ff
shapes structure
Cenadros Apr 10, 2024
7e79137
shapes structure fix
Cenadros Apr 10, 2024
5ba81d3
add circle shape
jordisala1991 Apr 10, 2024
222dbaa
add rect
jordisala1991 Apr 10, 2024
8cd89b2
fix text
Cenadros Apr 10, 2024
d341eb3
fix
jordisala1991 Apr 10, 2024
741a3da
fix text
Cenadros Apr 10, 2024
2a246e4
add image
jordisala1991 Apr 10, 2024
93ba8ee
Merge branch 'hotfix/upgrade-penpot-library' of github.com:Runroom/pe…
jordisala1991 Apr 10, 2024
7383d87
add group
jordisala1991 Apr 10, 2024
3646113
add artboard shape
jordisala1991 Apr 10, 2024
37ba03a
add selrect
jordisala1991 Apr 10, 2024
5a00341
add point
jordisala1991 Apr 10, 2024
e36a702
fills & gradients
Cenadros Apr 10, 2024
645b036
add shape for uuid
jordisala1991 Apr 10, 2024
2529abd
added commented funcions
Cenadros Apr 10, 2024
8477f95
added commented funcions
Cenadros Apr 10, 2024
9c00a03
remove duplicated function
jordisala1991 Apr 10, 2024
4b438e3
keep adding types
jordisala1991 Apr 10, 2024
1fb1816
bool shape
Cenadros Apr 11, 2024
3852805
interactions
Cenadros Apr 11, 2024
cdf07cc
shadow
Cenadros Apr 11, 2024
94472a9
blur and fixes
Cenadros Apr 11, 2024
41c42ce
Merge pull request #14 from Runroom/hotfix/upgrade-penpot-library
Cenadros Apr 11, 2024
6c67200
Move logic from UI to Code (#15)
jordisala1991 Apr 12, 2024
ded8b1c
Add typescript aliases for imports (#16)
jordisala1991 Apr 12, 2024
5c58d53
replace webpack for esbuild (#17)
jordisala1991 Apr 12, 2024
c56fa92
Upgrade library
jordisala1991 Apr 12, 2024
f1e6f76
custom gradient
Cenadros Apr 15, 2024
b338027
custom gradient
Cenadros Apr 15, 2024
55f0f67
fixes
Cenadros Apr 15, 2024
3ec79da
fix
Cenadros Apr 15, 2024
79f44b1
remove webpack watch
Cenadros Apr 15, 2024
4203299
fix
Cenadros Apr 15, 2024
2744930
fixes
Cenadros Apr 15, 2024
6e54528
library update
Cenadros Apr 15, 2024
ed957ba
Merge pull request #19 from Runroom/feature/gradient
Cenadros Apr 15, 2024
5b65f5d
Merge branch 'dev' into feature/upgrade-penpot-2.0
Cenadros Apr 15, 2024
2487979
Merge pull request #18 from Runroom/feature/upgrade-penpot-2.0
Cenadros Apr 15, 2024
4724c97
update shapes to 2.0.0
Cenadros Apr 15, 2024
1b29448
improve types
jordisala1991 Apr 15, 2024
3738c3c
avoid eslint errors
jordisala1991 Apr 15, 2024
e6a8679
fix things related to types
jordisala1991 Apr 15, 2024
590a3f7
Implement partial transformers
jordisala1991 Apr 15, 2024
e3906b6
blend modes
Cenadros Apr 15, 2024
6f4c56b
merge
Cenadros Apr 15, 2024
2609710
add transformChildren
jordisala1991 Apr 15, 2024
4703ad9
Merge branch 'feature/rect-shape' of github.com:Runroom/penpot-export…
jordisala1991 Apr 15, 2024
57c1fd3
fix
Cenadros Apr 15, 2024
ce6c4f7
Merge branch 'feature/rect-shape' of github.com:Runroom/penpot-export…
Cenadros Apr 15, 2024
0bcfd7c
fix
Cenadros Apr 15, 2024
c56726b
opacity
Cenadros Apr 15, 2024
48a80a7
opacity
Cenadros Apr 15, 2024
2869673
circle
Cenadros Apr 15, 2024
6f58a62
minimal attributes
Cenadros Apr 15, 2024
27b453b
blend modes fix
Cenadros Apr 15, 2024
b8058dc
refactor blend
jordisala1991 Apr 15, 2024
01a4fa5
add block concept
jordisala1991 Apr 15, 2024
dbd0d7f
try to rotate
jordisala1991 Apr 15, 2024
440ce8f
fix rotation matrix
Cenadros Apr 16, 2024
eca913e
fix rotation matrix
Cenadros Apr 16, 2024
9df47e4
madness
jordisala1991 Apr 16, 2024
7f87c1e
removed rotations
Cenadros Apr 16, 2024
5e13a45
remove tood
jordisala1991 Apr 16, 2024
aec1c38
fix group and text
jordisala1991 Apr 16, 2024
cfbd196
Merge pull request #21 from Runroom/feature/rect-shape
Cenadros Apr 16, 2024
73ccf83
Vectors - Pen & pencil (#35)
jordisala1991 Apr 16, 2024
c9f8a0d
Vectors - Line & Arrow (#37)
Cenadros Apr 17, 2024
ebdf3ad
Frames & Sections (#38)
jordisala1991 Apr 17, 2024
e2b5b4a
Solid Fills (#39)
Cenadros Apr 17, 2024
7856722
Upgrade penpot.js to 2.0.2 (#40)
Cenadros Apr 17, 2024
244ea64
New SVG Path lib (#41)
Cenadros Apr 17, 2024
737e6e1
remove @figma types from ui (#42)
jordisala1991 Apr 17, 2024
798e50a
Execute pipelines on dev branch too (#43)
jordisala1991 Apr 17, 2024
c114bd0
Strokes (#44)
Cenadros Apr 18, 2024
3dc9559
Add plugin id (#47)
jordisala1991 Apr 18, 2024
08473b5
Update Types to 2.0.2 (#48)
Cenadros Apr 18, 2024
f469fc1
avoid error when unsupported nodes, fills or other kind of elements. …
jordisala1991 Apr 19, 2024
44d691e
fixed clip content in frames (#50)
Cenadros Apr 19, 2024
0be0730
added proportion lock to all current nodes that support it (#51)
Cenadros Apr 19, 2024
7a7ad6a
Add release management with changelog (#46)
jordisala1991 Apr 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
5 changes: 5 additions & 0 deletions .changeset/calm-eels-reflect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"penpot-exporter": minor
---

Initial plugin release
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
end_of_line = lf
indent_style = space
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true
indent_size = 2
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
dist
ui-src/lib/penpot.js
25 changes: 25 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module.exports = {
root: true,
parserOptions: {
parser: '@typescript-eslint/parser',
ecmaVersion: 'latest',
sourceType: 'module'
},
env: { browser: true, node: true },
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
'plugin:@figma/figma-plugins/recommended'
],
settings: {
react: {
version: 'detect'
}
},
rules: {
'@typescript-eslint/no-unused-vars': ['error', { ignoreRestSiblings: true }]
}
};
34 changes: 34 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI

on:
push:
branches: [main, dev]
pull_request:

jobs:
build:
name: Build ${{ matrix.node }}
runs-on: ubuntu-latest
strategy:
matrix:
node: ['20.x']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- uses: bahmutov/npm-install@v1
- run: npm run build
lint:
name: Lint ${{ matrix.node }}
runs-on: ubuntu-latest
strategy:
matrix:
node: ['20.x']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- uses: bahmutov/npm-install@v1
- run: npm run lint
31 changes: 31 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish and release

on:
push:
branches: [main]

permissions:
contents: write
issues: write
pull-requests: write

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
publish:
runs-on: ubuntu-latest
strategy:
matrix:
node: ['20.x']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- uses: bahmutov/npm-install@v1
- uses: changesets/action@v1
with:
title: Release
publish: npx changeset tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
node_modules
package-lock.json
dist
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.changeset
node_modules
dist
ui-src/lib/penpot.js
LICENSE
69 changes: 34 additions & 35 deletions DEV_GUIDE.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
# Developer guide

The plugin relies in [penpot.js](https://github.com/penpot/penpot-exporter-figma-plugin/blob/main/src/penpot.js)
library. It contains a subset of Penpot frontend app, transpiled into
javascript to be used from js code (this was easy since the frontend is written
in ClojureScript, that has direct translation to javascript).
The plugin relies in
[penpot.js](https://github.com/penpot/penpot-exporter-figma-plugin/blob/main/src/penpot.js) library.
It contains a subset of Penpot frontend app, transpiled into javascript to be used from js code
(this was easy since the frontend is written in ClojureScript, that has direct translation to
javascript).

Basically, it exports the `createFile` function and the `File` data type, that
represents a Penpot file as it resides in memory inside the frontend app. It
has function to create pages and their content, and also an `export` function
that generates and downloads a .zip archive with the Penpot file as svg
documents in Penpot annotated format, that you can import directly into Penpot.
Basically, it exports the `createFile` function and the `File` data type, that represents a Penpot
file as it resides in memory inside the frontend app. It has function to create pages and their
content, and also an `export` function that generates and downloads a .zip archive with the Penpot
file as svg documents in Penpot annotated format, that you can import directly into Penpot.

You can see the [source of the library at Penpot repo](https://github.com/penpot/penpot/tree/develop/frontend/src/app/libs).
You can see the
[source of the library at Penpot repo](https://github.com/penpot/penpot/tree/develop/frontend/src/app/libs).

To see a general description of the data types used in the functions you can
see [the data model](https://help.penpot.app/technical-guide/data-model/).
Their full specifications are in the [common types module](https://github.com/penpot/penpot/tree/develop/common/src/app/common/types).
To see a general description of the data types used in the functions you can see
[the data model](https://help.penpot.app/technical-guide/data-model/). Their full specifications are
in the
[common types module](https://github.com/penpot/penpot/tree/develop/common/src/app/common/types).

Those types are defined in [Clojure spec](https://clojure.org/guides/spec) format.
For those unfamiliar with the syntax, here is a small basic guide:
Those types are defined in [Clojure spec](https://clojure.org/guides/spec) format. For those
unfamiliar with the syntax, here is a small basic guide:

```clojure
(s/def ::name string?)
(s/def ::id uuid?)
```

A parameter or attribute called `name` is of type string, and `id` is an *uuid*
string (e.g. "000498f3-27fc-8000-8988-ca7d52f46843").
A parameter or attribute called `name` is of type string, and `id` is an _uuid_ string (e.g.
"000498f3-27fc-8000-8988-ca7d52f46843").

```clojure
(s/def ::stroke-alignment #{:center :inner :outer})
```

`stroke-alignment` is of an enumerated type, and the valid values are "center",
"inner" and "outer".
`stroke-alignment` is of an enumerated type, and the valid values are "center", "inner" and "outer".

```clojure
(ns app.common.types.shape
Expand All @@ -44,17 +45,17 @@ string (e.g. "000498f3-27fc-8000-8988-ca7d52f46843").
(s/def ::line-height ::us/safe-number)
```

`line-height` is of the type `safe-number`, defined in `app.common.spec`
namespace, that here is imported with the name `us` (a *safe number* is a
integer or floating point number, with a value not too big or small).
`line-height` is of the type `safe-number`, defined in `app.common.spec` namespace, that here is
imported with the name `us` (a _safe number_ is a integer or floating point number, with a value not
too big or small).

```clojure
(s/def ::page
(s/keys :req-un [::id ::name ::objects ::options]))
```

`page` is an object with four required arguments: `id`, `name`, `objects` and
`options`, whose types have to be defined above.
`page` is an object with four required arguments: `id`, `name`, `objects` and `options`, whose types
have to be defined above.

```clojure
(s/def ::column
Expand All @@ -66,8 +67,8 @@ integer or floating point number, with a value not too big or small).
::gutter]))
```

`column` has one required attribute `color` and five optional ones `size`,
`type`, `item-length`, `margin` and `gutter`.
`column` has one required attribute `color` and five optional ones `size`, `type`, `item-length`,
`margin` and `gutter`.

```clojure
(s/def ::children
Expand All @@ -76,8 +77,8 @@ integer or floating point number, with a value not too big or small).
:min-count 1))
```

`children` is a collection (implemented as a vector) of objects of type
`content`, and must have a minimun lenght of 1.
`children` is a collection (implemented as a vector) of objects of type `content`, and must have a
minimun lenght of 1.

```clojure
(defmulti animation-spec :animation-type)
Expand All @@ -102,11 +103,9 @@ integer or floating point number, with a value not too big or small).
(s/multi-spec animation-spec ::animation-type))
```

This is probably the most complex construct. `animation` is a multi schema
object. It has an attribute called `animation-type` and the rest of the fields
depend on its value. For example, if `animation-type` is "dissolve", the object
must also have a `duration` and an `easing` attribute.

Other constructs should be more or less auto explicative with this guide
and the clojure.spec manual linked above.
This is probably the most complex construct. `animation` is a multi schema object. It has an
attribute called `animation-type` and the rest of the fields depend on its value. For example, if
`animation-type` is "dissolve", the object must also have a `duration` and an `easing` attribute.

Other constructs should be more or less auto explicative with this guide and the clojure.spec manual
linked above.
Loading