From a4e6aa05884a194030861cc3f6a497a2dddd5609 Mon Sep 17 00:00:00 2001 From: Xaviju Date: Fri, 28 Nov 2025 10:19:02 +0100 Subject: [PATCH 1/3] :lipstick: Limit inspect layer info message to avoid overflow (#7847) --- frontend/src/app/main/ui/inspect/right_sidebar.scss | 3 +-- frontend/translations/en.po | 2 +- frontend/translations/lv.po | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/main/ui/inspect/right_sidebar.scss b/frontend/src/app/main/ui/inspect/right_sidebar.scss index 74cc399982..84ec4ec31b 100644 --- a/frontend/src/app/main/ui/inspect/right_sidebar.scss +++ b/frontend/src/app/main/ui/inspect/right_sidebar.scss @@ -124,8 +124,7 @@ .inspect-tab-switcher-label { @include use-typography("body-medium"); color: var(--color-foreground-primary); - flex: 0; - min-inline-size: fit-content; + flex: 0 1 40%; } .inspect-tab-switcher-controls { diff --git a/frontend/translations/en.po b/frontend/translations/en.po index d2fd9da755..0a5c4a727f 100644 --- a/frontend/translations/en.po +++ b/frontend/translations/en.po @@ -1853,7 +1853,7 @@ msgstr "Select a shape, board or group to inspect their properties and code" #: src/app/main/ui/inspect/right_sidebar.cljs:166 msgid "inspect.layer-info" -msgstr "Select inspect tab" +msgstr "Layer info" #: src/app/main/ui/inspect/right_sidebar.cljs:137 msgid "inspect.multiple-selected" diff --git a/frontend/translations/lv.po b/frontend/translations/lv.po index 767c631f97..ebe6191634 100644 --- a/frontend/translations/lv.po +++ b/frontend/translations/lv.po @@ -1819,7 +1819,7 @@ msgstr "Jāatlasa apveids, plātne vai kopa, lai apskatītu to īpašības un ko #: src/app/main/ui/inspect/right_sidebar.cljs:166 msgid "inspect.layer-info" -msgstr "Atlasīt izpētīšanas cilni" +msgstr "Slāņa informācija" #: src/app/main/ui/inspect/right_sidebar.cljs:137 msgid "inspect.multiple-selected" From 2c3becb408702abde1fccddae6c87df252b0c8c6 Mon Sep 17 00:00:00 2001 From: Alonso Torres Date: Fri, 28 Nov 2025 13:41:27 +0100 Subject: [PATCH 2/3] :bug: Fix problem with plugins content attribute (#7835) --- CHANGES.md | 1 + common/src/app/common/types/path.cljc | 1 + common/src/app/common/types/path/impl.cljc | 3 ++ frontend/src/app/plugins/parser.cljs | 7 ++++ frontend/src/app/plugins/shape.cljs | 41 ++++++++++++++++++---- 5 files changed, 46 insertions(+), 7 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 9c2ed4c55a..6ec0c6ada6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -87,6 +87,7 @@ example. It's still usable as before, we just removed the example. - Fix problem with plugins generating code for pages different than current one [Taiga #12312](https://tree.taiga.io/project/penpot/issue/12312) - Fix input confirmation behavior is not uniform [Taiga #12294](https://tree.taiga.io/project/penpot/issue/12294) - Fix copy/pasting application/transit+json [Taiga #12721](https://tree.taiga.io/project/penpot/issue/12721) +- Fix problem with plugins content attribute [Plugins #209](https://github.com/penpot/penpot-plugins/issues/209) ## 2.11.1 diff --git a/common/src/app/common/types/path.cljc b/common/src/app/common/types/path.cljc index c33d80095b..7007d08cb2 100644 --- a/common/src/app/common/types/path.cljc +++ b/common/src/app/common/types/path.cljc @@ -267,3 +267,4 @@ (-> (stp/convert-to-path shape objects) (update :content impl/path-data)))) +(dm/export impl/decode-segments) diff --git a/common/src/app/common/types/path/impl.cljc b/common/src/app/common/types/path/impl.cljc index def765f17f..8b2ed4a315 100644 --- a/common/src/app/common/types/path/impl.cljc +++ b/common/src/app/common/types/path/impl.cljc @@ -565,6 +565,9 @@ (def check-content (sm/check-fn schema:content)) +(def decode-segments + (sm/lazy-decoder schema:segments sm/json-transformer)) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; CONSTRUCTORS & PREDICATES ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/frontend/src/app/plugins/parser.cljs b/frontend/src/app/plugins/parser.cljs index 0033246e49..5d4148662d 100644 --- a/frontend/src/app/plugins/parser.cljs +++ b/frontend/src/app/plugins/parser.cljs @@ -7,6 +7,8 @@ (ns app.plugins.parser (:require [app.common.data :as d] + [app.common.json :as json] + [app.common.types.path :as path] [app.common.uuid :as uuid] [app.util.object :as obj] [cuerdas.core :as str])) @@ -514,3 +516,8 @@ (case axis "horizontal" :y "vertical" :x)) + +(defn parse-commands + [commands] + (-> (json/->clj commands) + (path/decode-segments))) diff --git a/frontend/src/app/plugins/shape.cljs b/frontend/src/app/plugins/shape.cljs index 6c3e60a32d..b047954397 100644 --- a/frontend/src/app/plugins/shape.cljs +++ b/frontend/src/app/plugins/shape.cljs @@ -1034,8 +1034,8 @@ (fn [] (let [shape (u/locate-shape file-id page-id id)] (cond - (not (cfh/path-shape? shape)) - (u/display-not-valid :makeMask (:type shape)) + (and (not (cfh/path-shape? shape)) (not (cfh/bool-shape? shape))) + (u/display-not-valid :toD (:type shape)) :else (.toString (:content shape))))) @@ -1488,13 +1488,37 @@ (cond-> (or (cfh/path-shape? data) (cfh/bool-shape? data)) (crc/add-properties! - {:name "content" + {:name "commands" + :get #(-> % u/proxy->shape :content format/format-path-content) + :set + (fn [_ value] + (let [segments (parser/parse-commands value)] + (cond + (not (r/check-permission plugin-id "content:write")) + (u/display-not-valid :content "Plugin doesn't have 'content:write' permission") + + (not (sm/validate path/schema:segments segments)) + (u/display-not-valid :content segments) + + :else + (let [selrect (path/calc-selrect segments) + content (path/from-plain segments) + points (grc/rect->points selrect)] + (st/emit! (dwsh/update-shapes + [id] + (fn [shape] + (-> shape + (assoc :content content) + (assoc :selrect selrect) + (assoc :points points)))))))))} + {:name "d" :get #(-> % u/proxy->shape :content str) :set (fn [_ value] - (let [segments (if (string? value) - (svg.path/parse value) - value)] + (let [segments + (if (string? value) + (svg.path/parse value) + value)] (cond (not (r/check-permission plugin-id "content:write")) (u/display-not-valid :content "Plugin doesn't have 'content:write' permission") @@ -1514,4 +1538,7 @@ (-> shape (assoc :content content) (assoc :selrect selrect) - (assoc :points points)))))))))})))))) + (assoc :points points)))))))))} + {:name "content" + :get #(.-d %) + :set (fn [self value] (set! (.-d self) value))})))))) From e7029f2182713564f95f628f342fd58018f015fc Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Fri, 28 Nov 2025 12:17:36 +0100 Subject: [PATCH 3/3] :sparkles: Make automatic workflows not dependent on yarn --- .github/workflows/tests.yml | 61 ++++++-------------------------- common/scripts/test | 7 ++++ frontend/scripts/test | 9 +++++ frontend/scripts/test-components | 13 +++++++ frontend/scripts/test-e2e | 8 +++++ library/scripts/test | 9 +++++ package.json | 10 ++---- scripts/fmt | 13 +++++++ scripts/lint | 19 ++++++++++ 9 files changed, 91 insertions(+), 58 deletions(-) create mode 100755 common/scripts/test create mode 100755 frontend/scripts/test create mode 100755 frontend/scripts/test-components create mode 100755 frontend/scripts/test-e2e create mode 100755 library/scripts/test create mode 100755 scripts/fmt create mode 100755 scripts/lint diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a67d4a5449..ff73a8e2cb 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,7 +20,7 @@ concurrency: jobs: lint: - name: "Code Linter" + name: "Linter" runs-on: ubuntu-24.04 container: penpotapp/devenv:latest @@ -30,10 +30,7 @@ jobs: - name: Check clojure code format run: | - corepack enable; - corepack install; - yarn install - yarn run fmt:clj:check + ./scripts/lint test-common: name: "Common Tests" @@ -52,10 +49,7 @@ jobs: - name: Run tests on NODE working-directory: ./common run: | - corepack enable; - corepack install; - yarn install; - yarn run test; + ./scripts/test test-frontend: name: "Frontend Tests" @@ -69,25 +63,12 @@ jobs: - name: Unit Tests working-directory: ./frontend run: | - corepack enable; - corepack install; - yarn install; - yarn run test; + ./scripts/test - name: Component Tests working-directory: ./frontend run: | - yarn run playwright install chromium --with-deps; - yarn run build:storybook - - npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \ - "npx http-server storybook-static --port 6006 --silent" \ - "npx wait-on tcp:6006 && yarn test:storybook" - - - name: Check SCSS Format - working-directory: ./frontend - run: | - yarn run lint:scss; + ./scripts/test-components test-render-wasm: name: "Render WASM Tests" @@ -164,11 +145,7 @@ jobs: - name: Run tests working-directory: ./library run: | - corepack enable; - corepack install; - yarn install; - yarn run build:bundle; - yarn run test; + ./scripts/test build-integration: name: "Build Integration Bundle" @@ -219,11 +196,7 @@ jobs: - name: Run Tests working-directory: ./frontend run: | - corepack enable; - corepack install; - yarn install; - yarn run playwright install chromium --with-deps; - yarn run test:e2e -x --workers=2 --reporter=list --shard="1/4"; + ./scripts/test-e2e --shard="1/4"; - name: Upload test result uses: actions/upload-artifact@v4 @@ -253,11 +226,7 @@ jobs: - name: Run Tests working-directory: ./frontend run: | - corepack enable; - corepack install; - yarn install; - yarn run playwright install chromium --with-deps; - yarn run test:e2e -x --workers=2 --reporter=list --shard "2/4"; + ./scripts/test-e2e --shard="2/4"; - name: Upload test result uses: actions/upload-artifact@v4 @@ -287,11 +256,7 @@ jobs: - name: Run Tests working-directory: ./frontend run: | - corepack enable; - corepack install; - yarn install; - yarn run playwright install chromium --with-deps; - yarn run test:e2e -x --workers=2 --reporter=list --shard "3/4"; + ./scripts/test-e2e --shard="3/4"; - name: Upload test result uses: actions/upload-artifact@v4 @@ -303,7 +268,7 @@ jobs: retention-days: 3 test-integration-4: - name: "Integration Tests 3/4" + name: "Integration Tests 4/4" runs-on: ubuntu-24.04 container: penpotapp/devenv:latest needs: build-integration @@ -321,11 +286,7 @@ jobs: - name: Run Tests working-directory: ./frontend run: | - corepack enable; - corepack install; - yarn install; - yarn run playwright install chromium --with-deps; - yarn run test:e2e -x --workers=2 --reporter=list --shard "4/4"; + ./scripts/test-e2e --shard="4/4"; - name: Upload test result uses: actions/upload-artifact@v4 diff --git a/common/scripts/test b/common/scripts/test new file mode 100755 index 0000000000..5e8f839416 --- /dev/null +++ b/common/scripts/test @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +set -ex +corepack enable; +corepack install; +yarn install; +yarn run test; diff --git a/frontend/scripts/test b/frontend/scripts/test new file mode 100755 index 0000000000..f935f08ddd --- /dev/null +++ b/frontend/scripts/test @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -ex +corepack enable; +corepack install; +yarn install; + +yarn run lint:scss; +yarn run test; diff --git a/frontend/scripts/test-components b/frontend/scripts/test-components new file mode 100755 index 0000000000..69978a4953 --- /dev/null +++ b/frontend/scripts/test-components @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +set -ex +corepack enable; +corepack install; +yarn install; + +yarn run playwright install chromium --with-deps; +yarn run build:storybook + +exec npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \ + "npx http-server storybook-static --port 6006 --silent" \ + "npx wait-on tcp:6006 && yarn test:storybook" diff --git a/frontend/scripts/test-e2e b/frontend/scripts/test-e2e new file mode 100755 index 0000000000..8accfcced5 --- /dev/null +++ b/frontend/scripts/test-e2e @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -ex +corepack enable; +corepack install; +yarn install; +yarn run playwright install chromium --with-deps; +yarn run test:e2e -x --workers=2 --reporter=list "$@"; diff --git a/library/scripts/test b/library/scripts/test new file mode 100755 index 0000000000..45bfa16c1c --- /dev/null +++ b/library/scripts/test @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -ex +corepack enable; +corepack install; +yarn install; + +yarn run build:bundle; +yarn run test; diff --git a/package.json b/package.json index e8faefb259..f6a6717e32 100644 --- a/package.json +++ b/package.json @@ -11,14 +11,8 @@ }, "type": "module", "scripts": { - "fmt:clj:check": "cljfmt check --parallel=true common/src/ common/test/ frontend/src/ frontend/test/ backend/src/ backend/test/ exporter/src/ library/src", - "fmt:clj": "cljfmt fix --parallel=true common/src/ common/test/ frontend/src/ frontend/test/ backend/src/ backend/test/ exporter/src/ library/src", - "lint:clj:common": "clj-kondo --parallel=true --lint common/src", - "lint:clj:frontend": "clj-kondo --parallel=true --lint frontend/src", - "lint:clj:backend": "clj-kondo --parallel=true --lint backend/src", - "lint:clj:exporter": "clj-kondo --parallel=true --lint exporter/src", - "lint:clj:library": "clj-kondo --parallel=true --lint library/src", - "lint:clj": "yarn run lint:clj:common && yarn run lint:clj:frontend && yarn run lint:clj:backend && yarn run lint:clj:exporter && yarn run lint:clj:library" + "lint": "./scripts/lint", + "fmt": "./scripts/fmt" }, "devDependencies": { "@types/node": "^20.12.7" diff --git a/scripts/fmt b/scripts/fmt new file mode 100755 index 0000000000..16040b77a5 --- /dev/null +++ b/scripts/fmt @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +set -ex + +cljfmt --parallel=true \ + common/src/ \ + common/test/ \ + frontend/src/ \ + frontend/test/ \ + backend/src/ \ + backend/test/ \ + exporter/src/ \ + library/src; diff --git a/scripts/lint b/scripts/lint new file mode 100755 index 0000000000..d17e6d3c86 --- /dev/null +++ b/scripts/lint @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -ex + +cljfmt check --parallel=true \ + common/src/ \ + common/test/ \ + frontend/src/ \ + frontend/test/ \ + backend/src/ \ + backend/test/ \ + exporter/src/ \ + library/src; + +clj-kondo --parallel=true --lint common/src; +clj-kondo --parallel=true --lint frontend/src; +clj-kondo --parallel=true --lint backend/src; +clj-kondo --parallel=true --lint exporter/src/; +clj-kondo --parallel=true --lint library/src;