mirror of
https://github.com/penpot/penpot.git
synced 2026-02-12 14:42:56 +00:00
Merge branch 'niwinz-staging-library-changes' into staging
This commit is contained in:
@@ -8,11 +8,11 @@
|
||||
"Internal implementation of file builder. Mainly used as base impl
|
||||
for penpot library"
|
||||
(:require
|
||||
;; [app.common.features :as cfeat]
|
||||
[app.common.data :as d]
|
||||
[app.common.data.macros :as dm]
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.files.changes :as ch]
|
||||
;; [app.common.features :as cfeat]
|
||||
[app.common.files.helpers :as cph]
|
||||
[app.common.files.migrations :as fmig]
|
||||
[app.common.geom.shapes :as gsh]
|
||||
@@ -26,6 +26,7 @@
|
||||
[app.common.types.path :as types.path]
|
||||
[app.common.types.shape :as types.shape]
|
||||
[app.common.types.typography :as types.typography]
|
||||
[app.common.types.variant :as types.variant]
|
||||
[app.common.uuid :as uuid]
|
||||
[cuerdas.core :as str]))
|
||||
|
||||
@@ -126,10 +127,12 @@
|
||||
[:map
|
||||
[:component-id ::sm/uuid]
|
||||
[:file-id {:optional true} ::sm/uuid]
|
||||
[:page-id {:optional true} ::sm/uuid]
|
||||
[:frame-id {:optional true} ::sm/uuid]
|
||||
[:name {:optional true} ::sm/text]
|
||||
[:path {:optional true} ::sm/text]
|
||||
[:frame-id {:optional true} ::sm/uuid]
|
||||
[:page-id {:optional true} ::sm/uuid]])
|
||||
[:variant-id {:optional true} ::sm/uuid]
|
||||
[:variant-properties {:optional true} [:vector types.variant/schema:variant-property]]])
|
||||
|
||||
(def ^:private check-add-component
|
||||
(sm/check-fn schema:add-component
|
||||
@@ -200,7 +203,8 @@
|
||||
"layout/grid"
|
||||
"components/v2"
|
||||
"plugins/runtime"
|
||||
"design-tokens/v1"})
|
||||
"design-tokens/v1"
|
||||
"variants/v1"})
|
||||
|
||||
;; WORKAROUND: the same as features
|
||||
(def available-migrations
|
||||
@@ -443,7 +447,7 @@
|
||||
|
||||
(defn add-component
|
||||
[state params]
|
||||
(let [{:keys [component-id file-id page-id frame-id name path]}
|
||||
(let [{:keys [component-id file-id page-id frame-id name path variant-id variant-properties]}
|
||||
(-> (check-add-component params)
|
||||
(update :component-id default-uuid))
|
||||
|
||||
@@ -463,7 +467,9 @@
|
||||
:name (or name "anonmous")
|
||||
:path path
|
||||
:main-instance-id frame-id
|
||||
:main-instance-page page-id})
|
||||
:main-instance-page page-id
|
||||
:variant-id variant-id
|
||||
:variant-properties variant-properties})
|
||||
|
||||
change2
|
||||
{:type :mod-obj
|
||||
|
||||
@@ -320,14 +320,18 @@
|
||||
[:shapes {:optional true} [:vector {:gen/max 3} ::sm/any]]
|
||||
[:path {:optional true} :string]
|
||||
[:main-instance-id ::sm/uuid]
|
||||
[:main-instance-page ::sm/uuid]]]
|
||||
[:main-instance-page ::sm/uuid]
|
||||
;; Only used by external processes (like Penpot SDK)
|
||||
[:variant-id {:optional true} ::sm/uuid]
|
||||
[:variant-properties {:optional true} [:vector ctv/schema:variant-property]]]]
|
||||
|
||||
[:mod-component
|
||||
[:map {:title "ModCompoenentChange"}
|
||||
[:type [:= :mod-component]]
|
||||
[:id ::sm/uuid]
|
||||
[:shapes {:optional true} [:vector {:gen/max 3} ::sm/any]]
|
||||
[:name {:optional true} :string]
|
||||
[:path {:optional true} :string]
|
||||
[:shapes {:optional true} [:vector {:gen/max 3} ::sm/any]]
|
||||
[:variant-id {:optional true} ::sm/uuid]
|
||||
[:variant-properties {:optional true} [:vector ctv/schema:variant-property]]]]
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
(defn add-component
|
||||
[fdata {:keys [id name path main-instance-id main-instance-page annotation variant-id variant-properties]}]
|
||||
(let [fdata (update fdata :components assoc id (touch {:id id :name name :path path}))]
|
||||
(let [fdata (update fdata :components assoc id (touch {:id id :name name :path path}))]
|
||||
(cond-> (update-in fdata [:components id] assoc :main-instance-id main-instance-id :main-instance-page main-instance-page)
|
||||
annotation (update-in [:components id] assoc :annotation annotation)
|
||||
variant-id (update-in [:components id] assoc :variant-id variant-id)
|
||||
@@ -83,9 +83,11 @@
|
||||
|
||||
(nil? variant-properties)
|
||||
(dissoc :variant-properties))
|
||||
|
||||
;; The set of properties that doesn't mark a component as touched
|
||||
diff (set/difference
|
||||
(ctk/diff-components component new-comp)
|
||||
#{:annotation :modified-at :variant-id :variant-properties})] ;; The set of properties that doesn't mark a component as touched
|
||||
#{:annotation :modified-at :variant-id :variant-properties})]
|
||||
|
||||
(if (empty? diff)
|
||||
new-comp
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 1.0.10
|
||||
|
||||
- Enable variant/v1 feature by default
|
||||
- Add variant attrs handling to addComponent method
|
||||
|
||||
|
||||
## 1.0.9
|
||||
|
||||
- Fix dependencies declaration on package.json
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
:dev
|
||||
{:extra-paths ["dev"]
|
||||
:extra-deps
|
||||
{thheller/shadow-cljs {:mvn/version "3.1.7"}
|
||||
{thheller/shadow-cljs {:mvn/version "3.2.1"}
|
||||
com.bhauman/rebel-readline {:mvn/version "RELEASE"}
|
||||
org.clojure/tools.namespace {:mvn/version "RELEASE"}
|
||||
criterium/criterium {:mvn/version "RELEASE"}}}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@penpot/library",
|
||||
"version": "1.0.9",
|
||||
"version": "1.0.10",
|
||||
"license": "MPL-2.0",
|
||||
"author": "Kaleidos INC",
|
||||
"packageManager": "yarn@4.9.1+sha512.f95ce356460e05be48d66401c1ae64ef84d163dd689964962c6888a9810865e39097a5e9de748876c2e0bf89b232d583c33982773e9903ae7a76257270986538",
|
||||
|
||||
Reference in New Issue
Block a user