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