diff --git a/common/src/app/common/files/builder.cljc b/common/src/app/common/files/builder.cljc index 1ad590dbbb..aa8601bba3 100644 --- a/common/src/app/common/files/builder.cljc +++ b/common/src/app/common/files/builder.cljc @@ -117,7 +117,7 @@ (sm/decode-fn types.shape/schema:shape-attrs sm/json-transformer)) (def decode-library-color - (sm/decode-fn types.color/schema:color sm/json-transformer)) + (sm/decode-fn types.color/schema:library-color sm/json-transformer)) (def decode-library-typography (sm/decode-fn types.typography/schema:typography sm/json-transformer)) diff --git a/library/CHANGES.md b/library/CHANGES.md index ec170571f8..1e805c23b8 100644 --- a/library/CHANGES.md +++ b/library/CHANGES.md @@ -1,5 +1,10 @@ # CHANGELOG +## 1.0.6 + +- Fix unexpected issue on library color decoding + + ## 1.0.5 - Add progress reporting support diff --git a/library/deps.edn b/library/deps.edn index 69e7529bf3..0c59e66107 100644 --- a/library/deps.edn +++ b/library/deps.edn @@ -1,4 +1,4 @@ -{:paths ["src" "vendor" "resources" "test"] +{:paths ["src"] :deps {penpot/common {:local/root "../common"} diff --git a/library/package.json b/library/package.json index af63f42054..b58bfff5da 100644 --- a/library/package.json +++ b/library/package.json @@ -1,6 +1,6 @@ { "name": "@penpot/library", - "version": "1.0.5", + "version": "1.0.6", "license": "MPL-2.0", "author": "Kaleidos INC", "packageManager": "yarn@4.9.1+sha512.f95ce356460e05be48d66401c1ae64ef84d163dd689964962c6888a9810865e39097a5e9de748876c2e0bf89b232d583c33982773e9903ae7a76257270986538", diff --git a/library/test/builder.test.js b/library/test/builder.test.js index de94f5c3a0..fb99eac60b 100644 --- a/library/test/builder.test.js +++ b/library/test/builder.test.js @@ -75,3 +75,46 @@ test("create context with file and page", () => { assert.ok(rootShape, "root shape should exist"); assert.equal(rootShape.id, "00000000-0000-0000-0000-000000000000"); }); + +test("create context with color", () => { + const context = penpot.createBuildContext(); + + const fileId = context.addFile({name: "file 1"}); + const pageId = context.addPage({name: "page 1"}); + + const colorId = context.genId(); + + const params = { + color: '#000000', + gradient: undefined, + id: colorId, + image: undefined, + name: 'Black-8', + opacity: 0.800000011920929, + path: 'Remote', + }; + + context.addLibraryColor(params); + + const internalState = context.getInternalState(); + + const file = internalState.files[fileId]; + + assert.ok(file, "file should exist"); + + assert.ok(file.data); + assert.ok(file.data.pages); + + const colors = file.data.colors + + assert.ok(colors, "colors should exist"); + + const color = colors[colorId]; + + assert.ok(color, "color objects should exist"); + assert.equal(color.color, params.color); + assert.equal(color.id, colorId); + assert.equal(color.path, params.path); + assert.equal(color.opacity, params.opacity); + assert.equal(color.name, params.name); +});