Compare commits

...

3 Commits

Author SHA1 Message Date
Andrey Antukh
a32450de30 ⬆️ Update shadow-cljs dependency on sdk 2025-10-06 10:28:24 +02:00
Andrey Antukh
b8f4a1b61b Allow pass variant related attrs on add-component change 2025-10-06 10:28:00 +02:00
Andrey Antukh
16ecc89ad1 Add variants/v1 feature to default features emited by sdk 2025-10-06 09:56:44 +02:00
4 changed files with 13 additions and 6 deletions

View File

@@ -200,7 +200,8 @@
"layout/grid"
"components/v2"
"plugins/runtime"
"design-tokens/v1"})
"design-tokens/v1"
"variants/v1"})
;; WORKAROUND: the same as features
(def available-migrations

View File

@@ -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]]]]

View File

@@ -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

View File

@@ -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"}}}