mirror of
https://github.com/penpot/penpot.git
synced 2026-04-25 11:18:36 +00:00
💄 Add format rule for code comments (#8211)
* 💄 Add format rule for code comments * ⬆️ Update linter and formatter on devenv
This commit is contained in:
parent
71a5ab9913
commit
0ab126748f
@ -45,6 +45,15 @@
|
|||||||
:potok/reify-type
|
:potok/reify-type
|
||||||
{:level :error}
|
{:level :error}
|
||||||
|
|
||||||
|
:redundant-primitive-coercion
|
||||||
|
{:level :off}
|
||||||
|
|
||||||
|
:unused-excluded-var
|
||||||
|
{:level :off}
|
||||||
|
|
||||||
|
:unresolved-excluded-var
|
||||||
|
{:level :off}
|
||||||
|
|
||||||
:missing-protocol-method
|
:missing-protocol-method
|
||||||
{:level :off}
|
{:level :off}
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,11 @@
|
|||||||
:remove-multiple-non-indenting-spaces? false
|
:remove-multiple-non-indenting-spaces? false
|
||||||
:remove-surrounding-whitespace? true
|
:remove-surrounding-whitespace? true
|
||||||
:remove-consecutive-blank-lines? false
|
:remove-consecutive-blank-lines? false
|
||||||
|
:indent-line-comments? true
|
||||||
|
:parallel? true
|
||||||
|
:align-form-columns? false
|
||||||
|
;; :align-map-columns? false
|
||||||
|
;; :align-single-column-lines? false
|
||||||
:extra-indents {rumext.v2/fnc [[:inner 0]]
|
:extra-indents {rumext.v2/fnc [[:inner 0]]
|
||||||
cljs.test/async [[:inner 0]]
|
cljs.test/async [[:inner 0]]
|
||||||
promesa.exec/thread [[:inner 0]]
|
promesa.exec/thread [[:inner 0]]
|
||||||
|
|||||||
@ -873,11 +873,8 @@
|
|||||||
(import-storage-objects cfg)
|
(import-storage-objects cfg)
|
||||||
|
|
||||||
(let [files (get manifest :files)
|
(let [files (get manifest :files)
|
||||||
result (reduce (fn [result {:keys [id] :as file}]
|
result (reduce (fn [result file]
|
||||||
(let [name' (get file :name)
|
(let [name' (get file :name)
|
||||||
name' (if (map? name)
|
|
||||||
(get name id)
|
|
||||||
name')
|
|
||||||
file (assoc file :name name')]
|
file (assoc file :name name')]
|
||||||
(conj result (import-file cfg file))))
|
(conj result (import-file cfg file))))
|
||||||
[]
|
[]
|
||||||
|
|||||||
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
(ns app.http.sse
|
(ns app.http.sse
|
||||||
"SSE (server sent events) helpers"
|
"SSE (server sent events) helpers"
|
||||||
(:refer-clojure :exclude [tap])
|
|
||||||
(:require
|
(:require
|
||||||
[app.common.data :as d]
|
[app.common.data :as d]
|
||||||
[app.common.logging :as l]
|
[app.common.logging :as l]
|
||||||
|
|||||||
@ -248,11 +248,11 @@
|
|||||||
|
|
||||||
invitations (into #{}
|
invitations (into #{}
|
||||||
(comp
|
(comp
|
||||||
;; We don't re-send invitations to
|
;; We don't re-send invitations to
|
||||||
;; already existing members
|
;; already existing members
|
||||||
(remove #(contains? team-members (:email %)))
|
(remove #(contains? team-members (:email %)))
|
||||||
;; We don't send invitations to
|
;; We don't send invitations to
|
||||||
;; join-requested members
|
;; join-requested members
|
||||||
(remove #(contains? join-requests (:email %)))
|
(remove #(contains? join-requests (:email %)))
|
||||||
(map (fn [{:keys [email role]}]
|
(map (fn [{:keys [email role]}]
|
||||||
(create-invitation cfg
|
(create-invitation cfg
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
"A generic asynchronous events notifications subsystem; used mainly
|
"A generic asynchronous events notifications subsystem; used mainly
|
||||||
for mark event points in functions and be able to attach listeners
|
for mark event points in functions and be able to attach listeners
|
||||||
to them. Mainly used in http.sse for progress reporting."
|
to them. Mainly used in http.sse for progress reporting."
|
||||||
(:refer-clojure :exclude [tap run!])
|
(:refer-clojure :exclude [run!])
|
||||||
(:require
|
(:require
|
||||||
[app.common.exceptions :as ex]
|
[app.common.exceptions :as ex]
|
||||||
[app.common.logging :as l]
|
[app.common.logging :as l]
|
||||||
|
|||||||
@ -841,7 +841,7 @@
|
|||||||
out (th/command! data)
|
out (th/command! data)
|
||||||
error (:error out)]
|
error (:error out)]
|
||||||
|
|
||||||
;; (th/print-result! out)
|
;; (th/print-result! out)
|
||||||
(t/is (th/ex-info? error))
|
(t/is (th/ex-info? error))
|
||||||
(t/is (th/ex-of-type? error :not-found))))
|
(t/is (th/ex-of-type? error :not-found))))
|
||||||
|
|
||||||
@ -863,7 +863,7 @@
|
|||||||
out (th/command! data)
|
out (th/command! data)
|
||||||
error (:error out)]
|
error (:error out)]
|
||||||
|
|
||||||
;; (th/print-result! out)
|
;; (th/print-result! out)
|
||||||
(t/is (th/ex-info? error))
|
(t/is (th/ex-info? error))
|
||||||
(t/is (th/ex-of-type? error :not-found))))
|
(t/is (th/ex-of-type? error :not-found))))
|
||||||
|
|
||||||
@ -1261,7 +1261,7 @@
|
|||||||
(t/is (= 1 (count rows)))
|
(t/is (= 1 (count rows)))
|
||||||
(t/is (every? #(some? (:data %)) rows)))
|
(t/is (every? #(some? (:data %)) rows)))
|
||||||
|
|
||||||
;; Mark the file ellegible again for GC
|
;; Mark the file ellegible again for GC
|
||||||
(th/db-update! :file
|
(th/db-update! :file
|
||||||
{:has-media-trimmed false}
|
{:has-media-trimmed false}
|
||||||
{:id (:id file)})
|
{:id (:id file)})
|
||||||
@ -1318,7 +1318,7 @@
|
|||||||
{:file-id (:id file)
|
{:file-id (:id file)
|
||||||
:type "fragment"}
|
:type "fragment"}
|
||||||
{:order-by [:created-at]})]
|
{:order-by [:created-at]})]
|
||||||
;; (pp/pprint rows)
|
;; (pp/pprint rows)
|
||||||
(t/is (= 2 (count rows)))
|
(t/is (= 2 (count rows)))
|
||||||
(t/is (nil? (:data row1)))
|
(t/is (nil? (:data row1)))
|
||||||
(t/is (= "storage" (:backend row1)))
|
(t/is (= "storage" (:backend row1)))
|
||||||
|
|||||||
@ -536,7 +536,7 @@
|
|||||||
:token rtoken}
|
:token rtoken}
|
||||||
|
|
||||||
{:keys [result error] :as out} (th/command! data)]
|
{:keys [result error] :as out} (th/command! data)]
|
||||||
;; (th/print-result! out)
|
;; (th/print-result! out)
|
||||||
(t/is (nil? error))
|
(t/is (nil? error))
|
||||||
(t/is (map? result))
|
(t/is (map? result))
|
||||||
(t/is (string? (:invitation-token result))))))
|
(t/is (string? (:invitation-token result))))))
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
:team-id (:id team)
|
:team-id (:id team)
|
||||||
:name "test project"}
|
:name "test project"}
|
||||||
out (th/command! data)]
|
out (th/command! data)]
|
||||||
;; (th/print-result! out)
|
;; (th/print-result! out)
|
||||||
|
|
||||||
(t/is (nil? (:error out)))
|
(t/is (nil? (:error out)))
|
||||||
(let [result (:result out)]
|
(let [result (:result out)]
|
||||||
@ -93,7 +93,7 @@
|
|||||||
:id project-id}
|
:id project-id}
|
||||||
out (th/command! data)]
|
out (th/command! data)]
|
||||||
|
|
||||||
;; (th/print-result! out)
|
;; (th/print-result! out)
|
||||||
(t/is (nil? (:error out)))
|
(t/is (nil? (:error out)))
|
||||||
(t/is (nil? (:result out))))
|
(t/is (nil? (:result out))))
|
||||||
|
|
||||||
|
|||||||
@ -1092,9 +1092,9 @@
|
|||||||
(if (number? num)
|
(if (number? num)
|
||||||
(try
|
(try
|
||||||
(let [num-str (mth/to-fixed num precision)
|
(let [num-str (mth/to-fixed num precision)
|
||||||
;; Remove all trailing zeros after the comma 100.00000
|
;; Remove all trailing zeros after the comma 100.00000
|
||||||
num-str (str/replace num-str trail-zeros-regex-1 "")]
|
num-str (str/replace num-str trail-zeros-regex-1 "")]
|
||||||
;; Remove trailing zeros after a decimal number: 0.001|00|
|
;; Remove trailing zeros after a decimal number: 0.001|00|
|
||||||
(if-let [m (re-find trail-zeros-regex-2 num-str)]
|
(if-let [m (re-find trail-zeros-regex-2 num-str)]
|
||||||
(str/replace num-str (first m) (second m))
|
(str/replace num-str (first m) (second m))
|
||||||
num-str))
|
num-str))
|
||||||
|
|||||||
@ -44,7 +44,7 @@
|
|||||||
[_ {:keys [shape page-id] :as error} file-data _]
|
[_ {:keys [shape page-id] :as error} file-data _]
|
||||||
(let [repair-shape
|
(let [repair-shape
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
; Set parent to root frame.
|
;; Set parent to root frame.
|
||||||
(log/debug :hint " -> set to " :parent-id uuid/zero)
|
(log/debug :hint " -> set to " :parent-id uuid/zero)
|
||||||
(assoc shape :parent-id uuid/zero))]
|
(assoc shape :parent-id uuid/zero))]
|
||||||
|
|
||||||
@ -57,7 +57,7 @@
|
|||||||
[_ {:keys [shape page-id] :as error} file-data _]
|
[_ {:keys [shape page-id] :as error} file-data _]
|
||||||
(let [repair-shape
|
(let [repair-shape
|
||||||
(fn [parent-shape]
|
(fn [parent-shape]
|
||||||
; Add shape to parent's children list
|
;; Add shape to parent's children list
|
||||||
(log/debug :hint " -> add children to" :parent-id (:id parent-shape))
|
(log/debug :hint " -> add children to" :parent-id (:id parent-shape))
|
||||||
(update parent-shape :shapes conj (:id shape)))]
|
(update parent-shape :shapes conj (:id shape)))]
|
||||||
|
|
||||||
@ -70,7 +70,7 @@
|
|||||||
[_ {:keys [shape page-id] :as error} file-data _]
|
[_ {:keys [shape page-id] :as error} file-data _]
|
||||||
(let [repair-shape
|
(let [repair-shape
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
; Remove duplicated
|
;; Remove duplicated
|
||||||
(log/debug :hint " -> remove duplicated children")
|
(log/debug :hint " -> remove duplicated children")
|
||||||
(update shape :shapes distinct))]
|
(update shape :shapes distinct))]
|
||||||
|
|
||||||
@ -102,7 +102,7 @@
|
|||||||
[_ {:keys [shape page-id] :as error} file-data _]
|
[_ {:keys [shape page-id] :as error} file-data _]
|
||||||
(let [repair-shape
|
(let [repair-shape
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
; Locate the first frame in parents and set frame-id to it.
|
;; Locate the first frame in parents and set frame-id to it.
|
||||||
(let [page (ctpl/get-page file-data page-id)
|
(let [page (ctpl/get-page file-data page-id)
|
||||||
frame (cfh/get-frame (:objects page) (:parent-id shape))
|
frame (cfh/get-frame (:objects page) (:parent-id shape))
|
||||||
frame-id (or (:id frame) uuid/zero)]
|
frame-id (or (:id frame) uuid/zero)]
|
||||||
@ -118,7 +118,7 @@
|
|||||||
[_ {:keys [shape page-id] :as error} file-data _]
|
[_ {:keys [shape page-id] :as error} file-data _]
|
||||||
(let [repair-shape
|
(let [repair-shape
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
; Locate the first frame in parents and set frame-id to it.
|
;; Locate the first frame in parents and set frame-id to it.
|
||||||
(let [page (ctpl/get-page file-data page-id)
|
(let [page (ctpl/get-page file-data page-id)
|
||||||
frame (cfh/get-frame (:objects page) (:parent-id shape))
|
frame (cfh/get-frame (:objects page) (:parent-id shape))
|
||||||
frame-id (or (:id frame) uuid/zero)]
|
frame-id (or (:id frame) uuid/zero)]
|
||||||
@ -134,7 +134,7 @@
|
|||||||
[_ {:keys [shape page-id] :as error} file-data _]
|
[_ {:keys [shape page-id] :as error} file-data _]
|
||||||
(let [repair-shape
|
(let [repair-shape
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
; Set the :shape as main instance root
|
;; Set the :shape as main instance root
|
||||||
(log/debug :hint " -> set :main-instance")
|
(log/debug :hint " -> set :main-instance")
|
||||||
(assoc shape :main-instance true))]
|
(assoc shape :main-instance true))]
|
||||||
|
|
||||||
@ -147,12 +147,13 @@
|
|||||||
[_ {:keys [shape page-id] :as error} file-data _]
|
[_ {:keys [shape page-id] :as error} file-data _]
|
||||||
(let [repair-shape
|
(let [repair-shape
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
; Set :component-file to local file
|
;; Set :component-file to local file
|
||||||
(log/debug :hint " -> set :component-file to local file")
|
(log/debug :hint " -> set :component-file to local file")
|
||||||
(assoc shape :component-file (:id file-data)))]
|
(assoc shape :component-file (:id file-data)))]
|
||||||
; There is no solution that may recover it with confidence
|
|
||||||
;; (log/warn :hint " -> CANNOT REPAIR THIS AUTOMATICALLY.")
|
;; There is no solution that may recover it with confidence
|
||||||
;; shape)]
|
;; (log/warn :hint " -> CANNOT REPAIR THIS AUTOMATICALLY.")
|
||||||
|
;; shape)]
|
||||||
|
|
||||||
(log/dbg :hint "repairing shape :component-main-external" :id (:id shape) :name (:name shape) :page-id page-id)
|
(log/dbg :hint "repairing shape :component-main-external" :id (:id shape) :name (:name shape) :page-id page-id)
|
||||||
(-> (pcb/empty-changes nil page-id)
|
(-> (pcb/empty-changes nil page-id)
|
||||||
@ -166,12 +167,12 @@
|
|||||||
|
|
||||||
repair-shape
|
repair-shape
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
; Detach the shape and convert it to non instance.
|
;; Detach the shape and convert it to non instance.
|
||||||
(log/debug :hint " -> detach shape" :shape-id (:id shape))
|
(log/debug :hint " -> detach shape" :shape-id (:id shape))
|
||||||
(ctk/detach-shape shape))]
|
(ctk/detach-shape shape))]
|
||||||
; There is no solution that may recover it with confidence
|
;; There is no solution that may recover it with confidence
|
||||||
;; (log/warn :hint " -> CANNOT REPAIR THIS AUTOMATICALLY.")
|
;; (log/warn :hint " -> CANNOT REPAIR THIS AUTOMATICALLY.")
|
||||||
;; shape)]
|
;; shape)]
|
||||||
|
|
||||||
(log/dbg :hint "repairing shape :component-not-found" :id (:id shape) :name (:name shape) :page-id page-id)
|
(log/dbg :hint "repairing shape :component-not-found" :id (:id shape) :name (:name shape) :page-id page-id)
|
||||||
(-> (pcb/empty-changes nil page-id)
|
(-> (pcb/empty-changes nil page-id)
|
||||||
@ -184,7 +185,7 @@
|
|||||||
|
|
||||||
repair-component
|
repair-component
|
||||||
(fn [component]
|
(fn [component]
|
||||||
; Assign main instance in the component to current shape
|
;; Assign main instance in the component to current shape
|
||||||
(log/debug :hint " -> assign main-instance-id" :component-id (:id component))
|
(log/debug :hint " -> assign main-instance-id" :component-id (:id component))
|
||||||
(assoc component :main-instance-id (:id shape)))
|
(assoc component :main-instance-id (:id shape)))
|
||||||
|
|
||||||
@ -207,7 +208,7 @@
|
|||||||
[_ {:keys [shape page-id] :as error} file-data _]
|
[_ {:keys [shape page-id] :as error} file-data _]
|
||||||
(let [repair-component
|
(let [repair-component
|
||||||
(fn [component]
|
(fn [component]
|
||||||
; Assign main instance in the component to current shape
|
;; Assign main instance in the component to current shape
|
||||||
(log/debug :hint " -> assign main-instance-page" :component-id (:id component))
|
(log/debug :hint " -> assign main-instance-page" :component-id (:id component))
|
||||||
(assoc component :main-instance-page page-id))]
|
(assoc component :main-instance-page page-id))]
|
||||||
(log/dbg :hint "repairing shape :invalid-main-instance-page" :id (:id shape) :name (:name shape) :page-id page-id)
|
(log/dbg :hint "repairing shape :invalid-main-instance-page" :id (:id shape) :name (:name shape) :page-id page-id)
|
||||||
@ -219,7 +220,7 @@
|
|||||||
[_ {:keys [shape page-id] :as error} file-data _]
|
[_ {:keys [shape page-id] :as error} file-data _]
|
||||||
(let [repair-shape
|
(let [repair-shape
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
; There is no solution that may recover it with confidence
|
;; There is no solution that may recover it with confidence
|
||||||
(log/warn :hint " -> CANNOT REPAIR THIS AUTOMATICALLY.")
|
(log/warn :hint " -> CANNOT REPAIR THIS AUTOMATICALLY.")
|
||||||
shape)]
|
shape)]
|
||||||
|
|
||||||
@ -232,7 +233,7 @@
|
|||||||
[_ {:keys [shape page-id] :as error} file-data _]
|
[_ {:keys [shape page-id] :as error} file-data _]
|
||||||
(let [repair-shape
|
(let [repair-shape
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
; Unset the :shape as main instance root
|
;; Unset the :shape as main instance root
|
||||||
(log/debug :hint " -> unset :main-instance")
|
(log/debug :hint " -> unset :main-instance")
|
||||||
(dissoc shape :main-instance))]
|
(dissoc shape :main-instance))]
|
||||||
|
|
||||||
@ -245,7 +246,7 @@
|
|||||||
[_ {:keys [shape page-id] :as error} file-data _]
|
[_ {:keys [shape page-id] :as error} file-data _]
|
||||||
(let [repair-shape
|
(let [repair-shape
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
; Convert the shape in a top copy root.
|
;; Convert the shape in a top copy root.
|
||||||
(log/debug :hint " -> set :component-root")
|
(log/debug :hint " -> set :component-root")
|
||||||
(assoc shape :component-root true))]
|
(assoc shape :component-root true))]
|
||||||
|
|
||||||
@ -258,7 +259,7 @@
|
|||||||
[_ {:keys [shape page-id] :as error} file-data _]
|
[_ {:keys [shape page-id] :as error} file-data _]
|
||||||
(let [repair-shape
|
(let [repair-shape
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
; Convert the shape in a nested copy root.
|
;; Convert the shape in a nested copy root.
|
||||||
(log/debug :hint " -> unset :component-root")
|
(log/debug :hint " -> unset :component-root")
|
||||||
(dissoc shape :component-root))]
|
(dissoc shape :component-root))]
|
||||||
|
|
||||||
@ -307,8 +308,8 @@
|
|||||||
(log/debug :hint " -> detach shape" :shape-id (:id shape))
|
(log/debug :hint " -> detach shape" :shape-id (:id shape))
|
||||||
(ctk/detach-shape shape))]
|
(ctk/detach-shape shape))]
|
||||||
|
|
||||||
; If the shape still refers to the remote component, try to find the corresponding near one
|
;; If the shape still refers to the remote component, try to find the corresponding near one
|
||||||
; and link to it. If not, detach the shape.
|
;; and link to it. If not, detach the shape.
|
||||||
(log/dbg :hint "repairing shape :ref-shape-not-found" :id (:id shape) :name (:name shape) :page-id page-id)
|
(log/dbg :hint "repairing shape :ref-shape-not-found" :id (:id shape) :name (:name shape) :page-id page-id)
|
||||||
(if (some? matching-shape)
|
(if (some? matching-shape)
|
||||||
(-> (pcb/empty-changes nil page-id)
|
(-> (pcb/empty-changes nil page-id)
|
||||||
@ -324,7 +325,7 @@
|
|||||||
[_ {:keys [shape page-id] :as error} file-data _]
|
[_ {:keys [shape page-id] :as error} file-data _]
|
||||||
(let [repair-shape
|
(let [repair-shape
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
; Convert shape in a normal copy, removing nested copy status
|
;; Convert shape in a normal copy, removing nested copy status
|
||||||
(log/debug :hint " -> unhead shape")
|
(log/debug :hint " -> unhead shape")
|
||||||
(ctk/unhead-shape shape))]
|
(ctk/unhead-shape shape))]
|
||||||
|
|
||||||
@ -337,7 +338,7 @@
|
|||||||
[_ {:keys [shape page-id args] :as error} file-data _]
|
[_ {:keys [shape page-id args] :as error} file-data _]
|
||||||
(let [repair-shape
|
(let [repair-shape
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
; Convert shape in a nested head, adding component info
|
;; Convert shape in a nested head, adding component info
|
||||||
(log/debug :hint " -> reroot shape")
|
(log/debug :hint " -> reroot shape")
|
||||||
(ctk/rehead-shape shape (:component-file args) (:component-id args)))]
|
(ctk/rehead-shape shape (:component-file args) (:component-id args)))]
|
||||||
|
|
||||||
@ -350,8 +351,9 @@
|
|||||||
[_ {:keys [shape args] :as error} file-data _]
|
[_ {:keys [shape args] :as error} file-data _]
|
||||||
(let [repair-component
|
(let [repair-component
|
||||||
(fn [component]
|
(fn [component]
|
||||||
(let [objects (:objects component) ;; we only have encounter this on deleted components,
|
(let [objects (:objects component)
|
||||||
;; so the relevant objects are inside the component
|
;; we only have encounter this on deleted components,
|
||||||
|
;; so the relevant objects are inside the component
|
||||||
to-detach (->> (:cycles-ids args)
|
to-detach (->> (:cycles-ids args)
|
||||||
(map #(get objects %))
|
(map #(get objects %))
|
||||||
(map #(ctn/get-head-shape objects %))
|
(map #(ctn/get-head-shape objects %))
|
||||||
@ -378,7 +380,7 @@
|
|||||||
[_ {:keys [shape page-id] :as error} file-data _]
|
[_ {:keys [shape page-id] :as error} file-data _]
|
||||||
(let [repair-shape
|
(let [repair-shape
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
; Remove shape-ref
|
;; Remove shape-ref
|
||||||
(log/debug :hint " -> unset :shape-ref")
|
(log/debug :hint " -> unset :shape-ref")
|
||||||
(dissoc shape :shape-ref))]
|
(dissoc shape :shape-ref))]
|
||||||
|
|
||||||
@ -391,7 +393,7 @@
|
|||||||
[_ {:keys [shape page-id] :as error} file-data _]
|
[_ {:keys [shape page-id] :as error} file-data _]
|
||||||
(let [repair-shape
|
(let [repair-shape
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
; Convert the shape in a nested main head.
|
;; Convert the shape in a nested main head.
|
||||||
(log/debug :hint " -> unset :component-root")
|
(log/debug :hint " -> unset :component-root")
|
||||||
(dissoc shape :component-root))]
|
(dissoc shape :component-root))]
|
||||||
|
|
||||||
@ -404,7 +406,7 @@
|
|||||||
[_ {:keys [shape page-id] :as error} file-data _]
|
[_ {:keys [shape page-id] :as error} file-data _]
|
||||||
(let [repair-shape
|
(let [repair-shape
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
; Convert the shape in a top main head.
|
;; Convert the shape in a top main head.
|
||||||
(log/debug :hint " -> set :component-root")
|
(log/debug :hint " -> set :component-root")
|
||||||
(assoc shape :component-root true))]
|
(assoc shape :component-root true))]
|
||||||
|
|
||||||
@ -418,7 +420,7 @@
|
|||||||
[_ {:keys [shape page-id] :as error} file-data _]
|
[_ {:keys [shape page-id] :as error} file-data _]
|
||||||
(let [repair-shape
|
(let [repair-shape
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
; Convert the shape in a nested copy head.
|
;; Convert the shape in a nested copy head.
|
||||||
(log/debug :hint " -> unset :component-root")
|
(log/debug :hint " -> unset :component-root")
|
||||||
(dissoc shape :component-root))]
|
(dissoc shape :component-root))]
|
||||||
|
|
||||||
@ -431,7 +433,7 @@
|
|||||||
[_ {:keys [shape page-id] :as error} file-data _]
|
[_ {:keys [shape page-id] :as error} file-data _]
|
||||||
(let [repair-shape
|
(let [repair-shape
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
; Convert the shape in a top copy root.
|
;; Convert the shape in a top copy root.
|
||||||
(log/debug :hint " -> set :component-root")
|
(log/debug :hint " -> set :component-root")
|
||||||
(assoc shape :component-root true))]
|
(assoc shape :component-root true))]
|
||||||
|
|
||||||
@ -444,7 +446,7 @@
|
|||||||
[_ {:keys [shape page-id] :as error} file-data _]
|
[_ {:keys [shape page-id] :as error} file-data _]
|
||||||
(let [repair-shape
|
(let [repair-shape
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
; Detach the shape and convert it to non instance.
|
;; Detach the shape and convert it to non instance.
|
||||||
(log/debug :hint " -> detach shape" :shape-id (:id shape))
|
(log/debug :hint " -> detach shape" :shape-id (:id shape))
|
||||||
(ctk/detach-shape shape))]
|
(ctk/detach-shape shape))]
|
||||||
|
|
||||||
@ -457,7 +459,7 @@
|
|||||||
[_ {:keys [shape page-id] :as error} file-data _]
|
[_ {:keys [shape page-id] :as error} file-data _]
|
||||||
(let [repair-shape
|
(let [repair-shape
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
; Detach the shape and convert it to non instance.
|
;; Detach the shape and convert it to non instance.
|
||||||
(log/debug :hint " -> detach shape" :shape-id (:id shape))
|
(log/debug :hint " -> detach shape" :shape-id (:id shape))
|
||||||
(ctk/detach-shape shape))]
|
(ctk/detach-shape shape))]
|
||||||
|
|
||||||
@ -470,7 +472,7 @@
|
|||||||
[_ {:keys [shape page-id] :as error} file-data _]
|
[_ {:keys [shape page-id] :as error} file-data _]
|
||||||
(let [repair-shape
|
(let [repair-shape
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
; There is no solution that may recover it with confidence
|
;; There is no solution that may recover it with confidence
|
||||||
(log/warn :hint " -> CANNOT REPAIR THIS AUTOMATICALLY.")
|
(log/warn :hint " -> CANNOT REPAIR THIS AUTOMATICALLY.")
|
||||||
shape)]
|
shape)]
|
||||||
|
|
||||||
@ -483,7 +485,7 @@
|
|||||||
[_ {:keys [shape page-id] :as error} file-data _]
|
[_ {:keys [shape page-id] :as error} file-data _]
|
||||||
(let [repair-shape
|
(let [repair-shape
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
; Convert the shape in a frame.
|
;; Convert the shape in a frame.
|
||||||
(log/debug :hint " -> set :type :frame")
|
(log/debug :hint " -> set :type :frame")
|
||||||
(assoc shape :type :frame
|
(assoc shape :type :frame
|
||||||
:fills []
|
:fills []
|
||||||
@ -502,7 +504,7 @@
|
|||||||
[_ {:keys [shape] :as error} file-data _]
|
[_ {:keys [shape] :as error} file-data _]
|
||||||
(let [repair-component
|
(let [repair-component
|
||||||
(fn [component]
|
(fn [component]
|
||||||
; Remove the objects key, or set it to {} if the component is deleted
|
;; Remove the objects key, or set it to {} if the component is deleted
|
||||||
(if (:deleted component)
|
(if (:deleted component)
|
||||||
(do
|
(do
|
||||||
(log/debug :hint " -> set :objects {}")
|
(log/debug :hint " -> set :objects {}")
|
||||||
|
|||||||
@ -430,8 +430,8 @@
|
|||||||
(assoc :frame-id frame-id)
|
(assoc :frame-id frame-id)
|
||||||
(assoc :svg-viewbox vbox)
|
(assoc :svg-viewbox vbox)
|
||||||
(assoc :svg-attrs props)
|
(assoc :svg-attrs props)
|
||||||
;; We need to ensure fills are empty on import process
|
;; We need to ensure fills are empty on import process
|
||||||
;; because setup-shape assings one by default.
|
;; because setup-shape assings one by default.
|
||||||
(assoc :fills [])
|
(assoc :fills [])
|
||||||
(merge radius-attrs)))))
|
(merge radius-attrs)))))
|
||||||
|
|
||||||
|
|||||||
@ -49,9 +49,9 @@
|
|||||||
(def log-container-ids #{})
|
(def log-container-ids #{})
|
||||||
|
|
||||||
(def updatable-attrs (->> (seq (keys ctk/sync-attrs))
|
(def updatable-attrs (->> (seq (keys ctk/sync-attrs))
|
||||||
;; We don't update the flex-child attrs
|
;; We don't update the flex-child attrs
|
||||||
(remove ctk/swap-keep-attrs)
|
(remove ctk/swap-keep-attrs)
|
||||||
;; We don't do automatic update of the `layout-grid-cells` property.
|
;; We don't do automatic update of the `layout-grid-cells` property.
|
||||||
(remove #(= :layout-grid-cells %))))
|
(remove #(= :layout-grid-cells %))))
|
||||||
|
|
||||||
(defn enabled-shape?
|
(defn enabled-shape?
|
||||||
@ -1898,10 +1898,10 @@
|
|||||||
(gsh/absolute-move shape new-pos)))
|
(gsh/absolute-move shape new-pos)))
|
||||||
|
|
||||||
(defn- switch-path-change-value
|
(defn- switch-path-change-value
|
||||||
[prev-shape ;; The shape before the switch
|
[prev-shape ; The shape before the switch
|
||||||
current-shape ;; The shape after the switch (a clean copy)
|
current-shape ; The shape after the switch (a clean copy)
|
||||||
ref-shape ;; The referenced shape on the main component
|
ref-shape ; The referenced shape on the main component
|
||||||
;; before the switch
|
; before the switch
|
||||||
attr]
|
attr]
|
||||||
(let [old-width (-> ref-shape :selrect :width)
|
(let [old-width (-> ref-shape :selrect :width)
|
||||||
new-width (-> prev-shape :selrect :width)
|
new-width (-> prev-shape :selrect :width)
|
||||||
@ -1918,10 +1918,9 @@
|
|||||||
|
|
||||||
|
|
||||||
(defn- switch-text-change-value
|
(defn- switch-text-change-value
|
||||||
[prev-content ;; The :content of the text before the switch
|
[prev-content ; The :content of the text before the switch
|
||||||
current-content ;; The :content of the text after the switch (a clean copy)
|
current-content ; The :content of the text after the switch (a clean copy)
|
||||||
ref-content touched] ;; The :content of the referenced text on the main component
|
ref-content touched] ; The :content of the referenced text on the main component before the switch
|
||||||
;; before the switch
|
|
||||||
(let [;; We need the differences between the contents on the main
|
(let [;; We need the differences between the contents on the main
|
||||||
;; components. current-content is the content of a clean copy,
|
;; components. current-content is the content of a clean copy,
|
||||||
;; so for all effects its the same as the content on its main
|
;; so for all effects its the same as the content on its main
|
||||||
@ -2845,8 +2844,8 @@
|
|||||||
duplicating-component?
|
duplicating-component?
|
||||||
true
|
true
|
||||||
(and remove-swap-slot?
|
(and remove-swap-slot?
|
||||||
;; only remove swap slot of children when the current shape
|
;; only remove swap slot of children when the current shape
|
||||||
;; is not a subinstance head nor a instance root
|
;; is not a subinstance head nor a instance root
|
||||||
(not subinstance-head?)
|
(not subinstance-head?)
|
||||||
(not instance-root?))
|
(not instance-root?))
|
||||||
variant-props))
|
variant-props))
|
||||||
@ -2902,7 +2901,7 @@
|
|||||||
variant-props)
|
variant-props)
|
||||||
changes))
|
changes))
|
||||||
|
|
||||||
;; We need to check the changes to get the ids-map
|
;; We need to check the changes to get the ids-map
|
||||||
ids-map
|
ids-map
|
||||||
(into {}
|
(into {}
|
||||||
(comp
|
(comp
|
||||||
|
|||||||
@ -138,12 +138,12 @@
|
|||||||
ids (cfh/clean-loops objects ids)
|
ids (cfh/clean-loops objects ids)
|
||||||
in-component-copy?
|
in-component-copy?
|
||||||
(fn [shape-id]
|
(fn [shape-id]
|
||||||
;; Look for shapes that are inside a component copy, but are
|
;; Look for shapes that are inside a component copy, but are
|
||||||
;; not the root. In this case, they must not be deleted,
|
;; not the root. In this case, they must not be deleted,
|
||||||
;; but hidden (to be able to recover them more easily).
|
;; but hidden (to be able to recover them more easily).
|
||||||
;; If we want to specifically allow altering the copies, this is
|
;; If we want to specifically allow altering the copies, this is
|
||||||
;; a special case, like a component swap, in which case we want
|
;; a special case, like a component swap, in which case we want
|
||||||
;; to delete the old shape
|
;; to delete the old shape
|
||||||
(let [shape (get objects shape-id)]
|
(let [shape (get objects shape-id)]
|
||||||
(and (ctn/has-any-copy-parent? objects shape)
|
(and (ctn/has-any-copy-parent? objects shape)
|
||||||
(not allow-altering-copies))))
|
(not allow-altering-copies))))
|
||||||
@ -168,9 +168,9 @@
|
|||||||
groups-to-unmask
|
groups-to-unmask
|
||||||
(when-not ignore-mask
|
(when-not ignore-mask
|
||||||
(reduce (fn [group-ids id]
|
(reduce (fn [group-ids id]
|
||||||
;; When the shape to delete is the mask of a masked group,
|
;; When the shape to delete is the mask of a masked group,
|
||||||
;; the mask condition must be removed, and it must be
|
;; the mask condition must be removed, and it must be
|
||||||
;; converted to a normal group.
|
;; converted to a normal group.
|
||||||
(let [obj (lookup id)
|
(let [obj (lookup id)
|
||||||
parent (lookup (:parent-id obj))]
|
parent (lookup (:parent-id obj))]
|
||||||
(if (and (:masked-group parent)
|
(if (and (:masked-group parent)
|
||||||
@ -183,8 +183,8 @@
|
|||||||
|
|
||||||
interacting-shapes
|
interacting-shapes
|
||||||
(filter (fn [shape]
|
(filter (fn [shape]
|
||||||
;; If any of the deleted shapes is the destination of
|
;; If any of the deleted shapes is the destination of
|
||||||
;; some interaction, this must be deleted, too.
|
;; some interaction, this must be deleted, too.
|
||||||
(let [interactions (:interactions shape)]
|
(let [interactions (:interactions shape)]
|
||||||
(some #(and (ctsi/has-destination %)
|
(some #(and (ctsi/has-destination %)
|
||||||
(contains? ids-to-delete (:destination %)))
|
(contains? ids-to-delete (:destination %)))
|
||||||
@ -207,7 +207,7 @@
|
|||||||
|
|
||||||
all-parents
|
all-parents
|
||||||
(reduce (fn [res id]
|
(reduce (fn [res id]
|
||||||
;; All parents of any deleted shape must be resized.
|
;; All parents of any deleted shape must be resized.
|
||||||
(into res (cfh/get-parent-ids objects id)))
|
(into res (cfh/get-parent-ids objects id)))
|
||||||
(d/ordered-set)
|
(d/ordered-set)
|
||||||
(concat ids-to-delete ids-to-hide))
|
(concat ids-to-delete ids-to-hide))
|
||||||
@ -239,10 +239,10 @@
|
|||||||
(recursive-find-empty-parents parents))))
|
(recursive-find-empty-parents parents))))
|
||||||
|
|
||||||
empty-parents
|
empty-parents
|
||||||
;; Any parent whose children are all deleted, must be deleted too.
|
;; Any parent whose children are all deleted, must be deleted too.
|
||||||
;; If we want to specifically allow altering the copies, this is a special case,
|
;; If we want to specifically allow altering the copies, this is a special case,
|
||||||
;; for example during a component swap. in this case we are replacing a shape by
|
;; for example during a component swap. in this case we are replacing a shape by
|
||||||
;; other one, so must not delete empty parents.
|
;; other one, so must not delete empty parents.
|
||||||
(if-not allow-altering-copies
|
(if-not allow-altering-copies
|
||||||
(into (d/ordered-set) (find-all-empty-parents #{}))
|
(into (d/ordered-set) (find-all-empty-parents #{}))
|
||||||
#{})
|
#{})
|
||||||
@ -274,8 +274,8 @@
|
|||||||
guides-to-delete)
|
guides-to-delete)
|
||||||
|
|
||||||
changes (reduce (fn [changes component-id]
|
changes (reduce (fn [changes component-id]
|
||||||
;; It's important to delete the component before the main instance, because we
|
;; It's important to delete the component before the main instance, because we
|
||||||
;; need to store the instance position if we want to restore it later.
|
;; need to store the instance position if we want to restore it later.
|
||||||
(pcb/delete-component changes component-id (:id page)))
|
(pcb/delete-component changes component-id (:id page)))
|
||||||
changes
|
changes
|
||||||
components-to-delete)
|
components-to-delete)
|
||||||
@ -327,7 +327,7 @@
|
|||||||
result #{}]
|
result #{}]
|
||||||
|
|
||||||
(if-not current-id
|
(if-not current-id
|
||||||
;; Base case, no next element
|
;; Base case, no next element
|
||||||
result
|
result
|
||||||
|
|
||||||
(let [group (get objects current-id)]
|
(let [group (get objects current-id)]
|
||||||
@ -335,14 +335,14 @@
|
|||||||
(not= current-id parent-id)
|
(not= current-id parent-id)
|
||||||
(empty? (remove removed-id? (:shapes group))))
|
(empty? (remove removed-id? (:shapes group))))
|
||||||
|
|
||||||
;; Adds group to the remove and check its parent
|
;; Adds group to the remove and check its parent
|
||||||
(let [to-check (concat to-check [(cfh/get-parent-id objects current-id)])]
|
(let [to-check (concat to-check [(cfh/get-parent-id objects current-id)])]
|
||||||
(recur (first to-check)
|
(recur (first to-check)
|
||||||
(rest to-check)
|
(rest to-check)
|
||||||
(conj removed-id? current-id)
|
(conj removed-id? current-id)
|
||||||
(conj result current-id)))
|
(conj result current-id)))
|
||||||
|
|
||||||
;; otherwise recur
|
;; otherwise recur
|
||||||
(recur (first to-check)
|
(recur (first to-check)
|
||||||
(rest to-check)
|
(rest to-check)
|
||||||
removed-id?
|
removed-id?
|
||||||
|
|||||||
@ -111,7 +111,7 @@
|
|||||||
"Check if any ancestor of a shape (between base-parent-id and shape) was swapped"
|
"Check if any ancestor of a shape (between base-parent-id and shape) was swapped"
|
||||||
[shape objects base-parent-id]
|
[shape objects base-parent-id]
|
||||||
(let [ancestors (->> (ctn/get-parent-heads objects shape)
|
(let [ancestors (->> (ctn/get-parent-heads objects shape)
|
||||||
;; Ignore ancestors ahead of base-parent
|
;; Ignore ancestors ahead of base-parent
|
||||||
(drop-while #(not= base-parent-id (:id %)))
|
(drop-while #(not= base-parent-id (:id %)))
|
||||||
seq)
|
seq)
|
||||||
num-ancestors (count ancestors)
|
num-ancestors (count ancestors)
|
||||||
|
|||||||
@ -222,7 +222,7 @@
|
|||||||
:else
|
:else
|
||||||
(cons [node-style (dm/str head-text "" (:text node))] (rest acc)))
|
(cons [node-style (dm/str head-text "" (:text node))] (rest acc)))
|
||||||
|
|
||||||
;; We add an end-of-line when finish a paragraph
|
;; We add an end-of-line when finish a paragraph
|
||||||
new-acc
|
new-acc
|
||||||
(if (= (:type node) "paragraph")
|
(if (= (:type node) "paragraph")
|
||||||
(let [[hs ht] (first new-acc)]
|
(let [[hs ht] (first new-acc)]
|
||||||
|
|||||||
@ -458,13 +458,13 @@
|
|||||||
(map #(cfh/components-nesting-loop? objects (:id %) (:id parent)))
|
(map #(cfh/components-nesting-loop? objects (:id %) (:id parent)))
|
||||||
(every? nil?)))]
|
(every? nil?)))]
|
||||||
(or
|
(or
|
||||||
;;We don't want to change the structure of component copies
|
;;We don't want to change the structure of component copies
|
||||||
(ctk/in-component-copy? parent)
|
(ctk/in-component-copy? parent)
|
||||||
(has-any-copy-parent? objects parent)
|
(has-any-copy-parent? objects parent)
|
||||||
;; If we are moving something containing a main instance the container can't be part of a component (neither main nor copy)
|
;; If we are moving something containing a main instance the container can't be part of a component (neither main nor copy)
|
||||||
(and selected-main-instance? parent-in-component?)
|
(and selected-main-instance? parent-in-component?)
|
||||||
;; Avoid placing a shape as a direct or indirect child of itself,
|
;; Avoid placing a shape as a direct or indirect child of itself,
|
||||||
;; or inside its main component if it's in a copy.
|
;; or inside its main component if it's in a copy.
|
||||||
comps-nesting-loop?)))
|
comps-nesting-loop?)))
|
||||||
|
|
||||||
(defn find-valid-parent-and-frame-ids
|
(defn find-valid-parent-and-frame-ids
|
||||||
|
|||||||
@ -775,9 +775,9 @@
|
|||||||
file-data (cond-> file-data
|
file-data (cond-> file-data
|
||||||
(d/not-empty? used-components)
|
(d/not-empty? used-components)
|
||||||
(absorb-components used-components library-data))
|
(absorb-components used-components library-data))
|
||||||
;; Note that absorbed components may also be using colors
|
;; Note that absorbed components may also be using colors
|
||||||
;; and typographies. This is the reason of doing this first
|
;; and typographies. This is the reason of doing this first
|
||||||
;; and accumulating file data for the next ones.
|
;; and accumulating file data for the next ones.
|
||||||
|
|
||||||
used-colors (find-asset-type-usages file-data library-data :color)
|
used-colors (find-asset-type-usages file-data library-data :color)
|
||||||
file-data (cond-> file-data
|
file-data (cond-> file-data
|
||||||
@ -1017,7 +1017,7 @@
|
|||||||
libs-to-show
|
libs-to-show
|
||||||
(-> libs-to-show
|
(-> libs-to-show
|
||||||
(add-component library-id component-id))))))
|
(add-component library-id component-id))))))
|
||||||
;; (find-used-components-cumulative page root)
|
;; (find-used-components-cumulative page root)
|
||||||
|
|
||||||
libs-to-show
|
libs-to-show
|
||||||
components))
|
components))
|
||||||
|
|||||||
@ -306,7 +306,7 @@
|
|||||||
|
|
||||||
(-write-to [_ heap offset]
|
(-write-to [_ heap offset]
|
||||||
(let [buffer' (.-buffer ^js/DataView dbuffer)
|
(let [buffer' (.-buffer ^js/DataView dbuffer)
|
||||||
;; Calculate byte size: 4 bytes header + (size * FILL-U8-SIZE)
|
;; Calculate byte size: 4 bytes header + (size * FILL-U8-SIZE)
|
||||||
byte-size (+ 4 (* size FILL-U8-SIZE))
|
byte-size (+ 4 (* size FILL-U8-SIZE))
|
||||||
;; Create Uint32Array with exact size needed (convert bytes to u32 elements)
|
;; Create Uint32Array with exact size needed (convert bytes to u32 elements)
|
||||||
u32-array (js/Uint32Array. buffer' 0 (/ byte-size 4))]
|
u32-array (js/Uint32Array. buffer' 0 (/ byte-size 4))]
|
||||||
|
|||||||
@ -13,14 +13,15 @@
|
|||||||
[app.common.schema :as sm]
|
[app.common.schema :as sm]
|
||||||
[app.common.schema.generators :as sg]))
|
[app.common.schema.generators :as sg]))
|
||||||
|
|
||||||
;; WARNING: options are not deleted when changing event or action type, so it can be
|
;; WARNING: options are not deleted when changing event or action
|
||||||
;; restored if the user changes it back later.
|
;; type, so it can be restored if the user changes it back later.
|
||||||
;;
|
;;
|
||||||
;; But that means that an interaction may have for example a delay or
|
;; But that means that an interaction may have for example a delay or
|
||||||
;; destination, even if its type does not require it (but a previous type did).
|
;; destination, even if its type does not require it (but a previous
|
||||||
|
;; type did).
|
||||||
;;
|
;;
|
||||||
;; So make sure to use has-delay/has-destination... functions, or similar,
|
;; So make sure to use has-delay/has-destination... functions, or
|
||||||
;; before reading them.
|
;; similar, before reading them.
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; SCHEMA
|
;; SCHEMA
|
||||||
@ -452,16 +453,15 @@
|
|||||||
(gpt/point 0 0)))
|
(gpt/point 0 0)))
|
||||||
|
|
||||||
(defn calc-overlay-position
|
(defn calc-overlay-position
|
||||||
[interaction ;; interaction data
|
[interaction ; interaction data
|
||||||
shape ;; Shape with the interaction
|
shape ; Shape with the interaction
|
||||||
objects ;; the objects tree
|
objects ; the objects tree
|
||||||
relative-to-shape ;; the interaction position is realtive to this
|
relative-to-shape ; the interaction position is realtive to this shape
|
||||||
;; sape
|
base-frame ; the base frame of the current interaction
|
||||||
base-frame ;; the base frame of the current interaction
|
dest-frame ; the frame to display with this interaction
|
||||||
dest-frame ;; the frame to display with this interaction
|
frame-offset] ; if this interaction starts in a frame opened
|
||||||
frame-offset] ;; if this interaction starts in a frame opened
|
; on another interaction, this is the position
|
||||||
;; on another interaction, this is the position
|
; of that frame
|
||||||
;; of that frame
|
|
||||||
(assert (check-interaction interaction))
|
(assert (check-interaction interaction))
|
||||||
(assert (has-overlay-opts interaction)
|
(assert (has-overlay-opts interaction)
|
||||||
"expected compatible interaction map")
|
"expected compatible interaction map")
|
||||||
|
|||||||
@ -382,9 +382,9 @@
|
|||||||
keep-ids? (:id shape)
|
keep-ids? (:id shape)
|
||||||
:else (uuid/next))
|
:else (uuid/next))
|
||||||
|
|
||||||
;; Assign the correct frame-id for the given parent. It's the parent-id (if parent is frame)
|
;; Assign the correct frame-id for the given parent. It's the parent-id (if parent is frame)
|
||||||
;; or the parent's frame-id otherwise. Only for the first cloned shapes. In recursive calls
|
;; or the parent's frame-id otherwise. Only for the first cloned shapes. In recursive calls
|
||||||
;; this is not needed.
|
;; this is not needed.
|
||||||
frame-id (cond
|
frame-id (cond
|
||||||
(and (nil? frame-id) (cfh/frame-shape? dest-objects parent-id))
|
(and (nil? frame-id) (cfh/frame-shape? dest-objects parent-id))
|
||||||
parent-id
|
parent-id
|
||||||
|
|||||||
@ -393,7 +393,7 @@
|
|||||||
:else
|
:else
|
||||||
(cons [node-style (dm/str head-text "" (:text node))] (rest acc)))
|
(cons [node-style (dm/str head-text "" (:text node))] (rest acc)))
|
||||||
|
|
||||||
;; We add an end-of-line when finish a paragraph
|
;; We add an end-of-line when finish a paragraph
|
||||||
new-acc
|
new-acc
|
||||||
(if (= (:type node) "paragraph")
|
(if (= (:type node) "paragraph")
|
||||||
(let [[hs ht] (first new-acc)]
|
(let [[hs ht] (first new-acc)]
|
||||||
|
|||||||
@ -693,7 +693,7 @@
|
|||||||
changes1 (cls/generate-update-shapes (pcb/empty-changes nil (:id page))
|
changes1 (cls/generate-update-shapes (pcb/empty-changes nil (:id page))
|
||||||
#{(:id main-child)}
|
#{(:id main-child)}
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
;; Update the attrs on all the content tree
|
;; Update the attrs on all the content tree
|
||||||
(-> shape
|
(-> shape
|
||||||
(assoc-in [:content :children 0 :children 0 :children 0 :font-size] "32")
|
(assoc-in [:content :children 0 :children 0 :children 0 :font-size] "32")
|
||||||
(assoc-in [:content :children 0 :children 0 :font-size] "32")
|
(assoc-in [:content :children 0 :children 0 :font-size] "32")
|
||||||
@ -851,7 +851,7 @@
|
|||||||
changes1 (cls/generate-update-shapes (pcb/empty-changes nil (:id page))
|
changes1 (cls/generate-update-shapes (pcb/empty-changes nil (:id page))
|
||||||
#{(:id main-child)}
|
#{(:id main-child)}
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
;; Update the attrs on all the content tree
|
;; Update the attrs on all the content tree
|
||||||
(-> shape
|
(-> shape
|
||||||
(assoc-in [:content :children 0 :children 0 :children 0 :font-size] "32")
|
(assoc-in [:content :children 0 :children 0 :children 0 :font-size] "32")
|
||||||
(assoc-in [:content :children 0 :children 0 :font-size] "32")
|
(assoc-in [:content :children 0 :children 0 :font-size] "32")
|
||||||
|
|||||||
@ -267,7 +267,7 @@
|
|||||||
page' (thf/current-page file')
|
page' (thf/current-page file')
|
||||||
objects' (:objects page')]
|
objects' (:objects page')]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
(thf/validate-file! file')
|
(thf/validate-file! file')
|
||||||
(t/is (= (count (:components data)) 2))
|
(t/is (= (count (:components data)) 2))
|
||||||
(t/is (= (count (:components data')) 4))
|
(t/is (= (count (:components data')) 4))
|
||||||
|
|||||||
@ -179,9 +179,9 @@ RUN set -eux; \
|
|||||||
|
|
||||||
FROM base AS setup-utils
|
FROM base AS setup-utils
|
||||||
|
|
||||||
ENV CLJKONDO_VERSION=2025.07.28 \
|
ENV CLJKONDO_VERSION=2026.01.19 \
|
||||||
BABASHKA_VERSION=1.12.208 \
|
BABASHKA_VERSION=1.12.208 \
|
||||||
CLJFMT_VERSION=0.13.1
|
CLJFMT_VERSION=0.15.6
|
||||||
|
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
ARCH="$(dpkg --print-architecture)"; \
|
ARCH="$(dpkg --print-architecture)"; \
|
||||||
@ -398,7 +398,6 @@ COPY files/Caddyfile /home/
|
|||||||
COPY files/selfsigned.crt /home/
|
COPY files/selfsigned.crt /home/
|
||||||
COPY files/selfsigned.key /home/
|
COPY files/selfsigned.key /home/
|
||||||
COPY files/start-tmux.sh /home/start-tmux.sh
|
COPY files/start-tmux.sh /home/start-tmux.sh
|
||||||
COPY files/start-tmux-back.sh /home/start-tmux-back.sh
|
|
||||||
COPY files/entrypoint.sh /home/entrypoint.sh
|
COPY files/entrypoint.sh /home/entrypoint.sh
|
||||||
COPY files/init.sh /home/init.sh
|
COPY files/init.sh /home/init.sh
|
||||||
|
|
||||||
|
|||||||
@ -81,7 +81,7 @@
|
|||||||
ptk/UpdateEvent
|
ptk/UpdateEvent
|
||||||
(update [_ state]
|
(update [_ state]
|
||||||
(reduce (fn [state {:keys [id] :as project}]
|
(reduce (fn [state {:keys [id] :as project}]
|
||||||
;; Replace completely instead of merge to ensure deleted-at is removed
|
;; Replace completely instead of merge to ensure deleted-at is removed
|
||||||
(assoc-in state [:projects id] project))
|
(assoc-in state [:projects id] project))
|
||||||
state
|
state
|
||||||
projects))))
|
projects))))
|
||||||
|
|||||||
@ -104,15 +104,15 @@
|
|||||||
variant (or (.getEnglishName ^js font "preferredSubfamily")
|
variant (or (.getEnglishName ^js font "preferredSubfamily")
|
||||||
(.getEnglishName ^js font "fontSubfamily"))
|
(.getEnglishName ^js font "fontSubfamily"))
|
||||||
|
|
||||||
;; Vertical metrics determine the baseline in a text and the space between lines of
|
;; Vertical metrics determine the baseline in a text and the space between lines of
|
||||||
;; text. For historical reasons, there are three pairs of ascender/descender
|
;; text. For historical reasons, there are three pairs of ascender/descender
|
||||||
;; values, known as hhea, OS/2 and uSWin metrics. Depending on the font, operating
|
;; values, known as hhea, OS/2 and uSWin metrics. Depending on the font, operating
|
||||||
;; system and application a different set will be used to render text on the
|
;; system and application a different set will be used to render text on the
|
||||||
;; screen. On Mac, Safari and Chrome use the hhea values to render text. Firefox
|
;; screen. On Mac, Safari and Chrome use the hhea values to render text. Firefox
|
||||||
;; will respect the useTypoMetrics setting and will use the OS/2 if it is set. If
|
;; will respect the useTypoMetrics setting and will use the OS/2 if it is set. If
|
||||||
;; the useTypoMetrics is not set, Firefox will also use metrics from the hhea
|
;; the useTypoMetrics is not set, Firefox will also use metrics from the hhea
|
||||||
;; table. On Windows, all browsers use the usWin metrics, but respect the
|
;; table. On Windows, all browsers use the usWin metrics, but respect the
|
||||||
;; useTypoMetrics setting and if set will use the OS/2 values.
|
;; useTypoMetrics setting and if set will use the OS/2 values.
|
||||||
|
|
||||||
hhea-ascender (abs (-> ^js font .-tables .-hhea .-ascender))
|
hhea-ascender (abs (-> ^js font .-tables .-hhea .-ascender))
|
||||||
hhea-descender (abs (-> ^js font .-tables .-hhea .-descender))
|
hhea-descender (abs (-> ^js font .-tables .-hhea .-descender))
|
||||||
|
|||||||
@ -156,8 +156,8 @@
|
|||||||
(defn- update-plugin-permissions-peek
|
(defn- update-plugin-permissions-peek
|
||||||
[{:keys [plugin-id url]}]
|
[{:keys [plugin-id url]}]
|
||||||
(when url
|
(when url
|
||||||
;; If the saved manifest has a URL we fetch the manifest to check
|
;; If the saved manifest has a URL we fetch the manifest to check
|
||||||
;; for updates
|
;; for updates
|
||||||
(->> (fetch-manifest url)
|
(->> (fetch-manifest url)
|
||||||
(rx/subs!
|
(rx/subs!
|
||||||
(fn [new-manifest]
|
(fn [new-manifest]
|
||||||
|
|||||||
@ -410,25 +410,25 @@
|
|||||||
(string? value)
|
(string? value)
|
||||||
{:errors [(wte/error-with-value :error.style-dictionary/invalid-token-value-shadow value)]}
|
{:errors [(wte/error-with-value :error.style-dictionary/invalid-token-value-shadow value)]}
|
||||||
|
|
||||||
;; Empty value
|
;; Empty value
|
||||||
(nil? value) {:errors [(wte/get-error-code :error.token/empty-input)]}
|
(nil? value) {:errors [(wte/get-error-code :error.token/empty-input)]}
|
||||||
|
|
||||||
;; Invalid value
|
;; Invalid value
|
||||||
(not (js/Array.isArray value)) {:errors [(wte/error-with-value :error.style-dictionary/invalid-token-value value)]}
|
(not (js/Array.isArray value)) {:errors [(wte/error-with-value :error.style-dictionary/invalid-token-value value)]}
|
||||||
|
|
||||||
;; Array of shadows
|
;; Array of shadows
|
||||||
:else
|
:else
|
||||||
(let [converted (js->clj value :keywordize-keys true)
|
(let [converted (js->clj value :keywordize-keys true)
|
||||||
;; Parse each shadow with its index
|
;; Parse each shadow with its index
|
||||||
parsed-shadows (map-indexed
|
parsed-shadows (map-indexed
|
||||||
(fn [idx shadow-map]
|
(fn [idx shadow-map]
|
||||||
(parse-single-shadow shadow-map idx))
|
(parse-single-shadow shadow-map idx))
|
||||||
converted)
|
converted)
|
||||||
|
|
||||||
;; Collect all errors from all shadows
|
;; Collect all errors from all shadows
|
||||||
all-errors (mapcat :errors parsed-shadows)
|
all-errors (mapcat :errors parsed-shadows)
|
||||||
|
|
||||||
;; Collect all values from shadows that have values
|
;; Collect all values from shadows that have values
|
||||||
all-values (into [] (keep :value parsed-shadows))]
|
all-values (into [] (keep :value parsed-shadows))]
|
||||||
|
|
||||||
(if (seq all-errors)
|
(if (seq all-errors)
|
||||||
|
|||||||
@ -1292,9 +1292,9 @@
|
|||||||
(rx/take 1 workspace-data-s)
|
(rx/take 1 workspace-data-s)
|
||||||
(rx/take 1 workspace-data-s)
|
(rx/take 1 workspace-data-s)
|
||||||
workspace-data-s)
|
workspace-data-s)
|
||||||
;; Need to get the file data before the change, so deleted shapes
|
;; Need to get the file data before the change, so deleted shapes
|
||||||
;; still exist, for example. We initialize the buffer with three
|
;; still exist, for example. We initialize the buffer with three
|
||||||
;; copies of the initial state
|
;; copies of the initial state
|
||||||
(rx/buffer 3 1))
|
(rx/buffer 3 1))
|
||||||
|
|
||||||
changes-s
|
changes-s
|
||||||
|
|||||||
@ -231,12 +231,12 @@
|
|||||||
:timeout nil
|
:timeout nil
|
||||||
:tag :media-loading}))
|
:tag :media-loading}))
|
||||||
(->> (if (seq uris)
|
(->> (if (seq uris)
|
||||||
;; Media objects is a list of URL's pointing to the path
|
;; Media objects is a list of URL's pointing to the path
|
||||||
(process-uris params)
|
(process-uris params)
|
||||||
;; Media objects are blob of data to be upload
|
;; Media objects are blob of data to be upload
|
||||||
(process-blobs params))
|
(process-blobs params))
|
||||||
|
|
||||||
;; Every stream has its own sideeffect. We need to ignore the result
|
;; Every stream has its own sideeffect. We need to ignore the result
|
||||||
(rx/ignore)
|
(rx/ignore)
|
||||||
(rx/catch #(handle-media-error % on-error))
|
(rx/catch #(handle-media-error % on-error))
|
||||||
(rx/finalize #(st/emit! (ntf/hide :tag :media-loading))))))))
|
(rx/finalize #(st/emit! (ntf/hide :tag :media-loading))))))))
|
||||||
|
|||||||
@ -793,8 +793,8 @@
|
|||||||
(-> options
|
(-> options
|
||||||
(assoc :reg-objects? true)
|
(assoc :reg-objects? true)
|
||||||
(assoc :ignore-tree ignore-tree)
|
(assoc :ignore-tree ignore-tree)
|
||||||
;; Attributes that can change in the transform. This
|
;; Attributes that can change in the transform. This
|
||||||
;; way we don't have to check all the attributes
|
;; way we don't have to check all the attributes
|
||||||
(assoc :attrs transform-attrs))
|
(assoc :attrs transform-attrs))
|
||||||
|
|
||||||
update-shape
|
update-shape
|
||||||
|
|||||||
@ -439,7 +439,7 @@
|
|||||||
add-new-variant? (and
|
add-new-variant? (and
|
||||||
;; The parent is a variant container
|
;; The parent is a variant container
|
||||||
(-> parent-id objects ctc/is-variant-container?)
|
(-> parent-id objects ctc/is-variant-container?)
|
||||||
;; Any of the shapes is a main instance
|
;; Any of the shapes is a main instance
|
||||||
(some (comp ctc/main-instance? objects) ids))
|
(some (comp ctc/main-instance? objects) ids))
|
||||||
|
|
||||||
undo-id (js/Symbol)]
|
undo-id (js/Symbol)]
|
||||||
|
|||||||
@ -143,7 +143,7 @@
|
|||||||
([value shape-ids attributes]
|
([value shape-ids attributes]
|
||||||
(update-stroke-color value shape-ids attributes nil))
|
(update-stroke-color value shape-ids attributes nil))
|
||||||
|
|
||||||
;; The attributes param is needed to have the same arity that other update functions
|
;; The attributes param is needed to have the same arity that other update functions
|
||||||
([value shape-ids _attributes page-id]
|
([value shape-ids _attributes page-id]
|
||||||
(when-let [color (value->color value)]
|
(when-let [color (value->color value)]
|
||||||
(dwsh/update-shapes shape-ids
|
(dwsh/update-shapes shape-ids
|
||||||
|
|||||||
@ -1121,15 +1121,15 @@
|
|||||||
:cell cell))
|
:cell cell))
|
||||||
|
|
||||||
add-component-to-variant? (and
|
add-component-to-variant? (and
|
||||||
;; Any of the shapes is a head
|
;; Any of the shapes is a head
|
||||||
(some (comp ctk/instance-head? objects) ids)
|
(some (comp ctk/instance-head? objects) ids)
|
||||||
;; Any ancestor of the destination parent is a variant
|
;; Any ancestor of the destination parent is a variant
|
||||||
(->> (cfh/get-parents-with-self objects frame-id)
|
(->> (cfh/get-parents-with-self objects frame-id)
|
||||||
(some ctk/is-variant?)))
|
(some ctk/is-variant?)))
|
||||||
add-new-variant? (and
|
add-new-variant? (and
|
||||||
;; The parent is a variant container
|
;; The parent is a variant container
|
||||||
(-> frame-id objects ctk/is-variant-container?)
|
(-> frame-id objects ctk/is-variant-container?)
|
||||||
;; Any of the shapes is a main instance
|
;; Any of the shapes is a main instance
|
||||||
(some (comp ctk/main-instance? objects) ids))]
|
(some (comp ctk/main-instance? objects) ids))]
|
||||||
|
|
||||||
(rx/concat
|
(rx/concat
|
||||||
|
|||||||
@ -447,8 +447,8 @@
|
|||||||
:stroke-opacity 1
|
:stroke-opacity 1
|
||||||
:stroke-width 2}
|
:stroke-width 2}
|
||||||
|
|
||||||
;; Move the position of the variant container so the main shape doesn't
|
;; Move the position of the variant container so the main shape doesn't
|
||||||
;; change its position
|
;; change its position
|
||||||
delta (or delta
|
delta (or delta
|
||||||
(if (ctsl/any-layout? parent)
|
(if (ctsl/any-layout? parent)
|
||||||
(gpt/point 0 0)
|
(gpt/point 0 0)
|
||||||
@ -456,8 +456,8 @@
|
|||||||
undo-id (js/Symbol)]
|
undo-id (js/Symbol)]
|
||||||
|
|
||||||
|
|
||||||
;;TODO Refactor all called methods in order to be able to
|
;;TODO Refactor all called methods in order to be able to
|
||||||
;;generate changes instead of call the events
|
;;generate changes instead of call the events
|
||||||
|
|
||||||
|
|
||||||
(rx/concat
|
(rx/concat
|
||||||
@ -467,7 +467,7 @@
|
|||||||
(when (not= name (:name main))
|
(when (not= name (:name main))
|
||||||
(dwl/rename-component component-id name))
|
(dwl/rename-component component-id name))
|
||||||
|
|
||||||
;; Create variant container
|
;; Create variant container
|
||||||
(dwsh/create-artboard-from-shapes [main-instance-id] variant-id nil nil nil delta flex?)
|
(dwsh/create-artboard-from-shapes [main-instance-id] variant-id nil nil nil delta flex?)
|
||||||
(cl/remove-all-fills variant-vec {:color clr/black :opacity 1})
|
(cl/remove-all-fills variant-vec {:color clr/black :opacity 1})
|
||||||
(when flex? (dwsl/create-layout-from-id variant-id :flex))
|
(when flex? (dwsl/create-layout-from-id variant-id :flex))
|
||||||
@ -476,12 +476,12 @@
|
|||||||
(cl/add-stroke variant-vec stroke-props)
|
(cl/add-stroke variant-vec stroke-props)
|
||||||
(set-variant-id component-id variant-id))
|
(set-variant-id component-id variant-id))
|
||||||
|
|
||||||
;; Add the necessary number of new properties, with default values
|
;; Add the necessary number of new properties, with default values
|
||||||
(rx/from
|
(rx/from
|
||||||
(repeatedly num-props
|
(repeatedly num-props
|
||||||
#(add-new-property variant-id {:fill-values? true})))
|
#(add-new-property variant-id {:fill-values? true})))
|
||||||
|
|
||||||
;; When the component has path, set the path items as properties values
|
;; When the component has path, set the path items as properties values
|
||||||
(when (> (count cpath) 1)
|
(when (> (count cpath) 1)
|
||||||
(rx/from
|
(rx/from
|
||||||
(map
|
(map
|
||||||
@ -634,7 +634,7 @@
|
|||||||
prefix (->> shapes
|
prefix (->> shapes
|
||||||
(mapv #(cpn/split-path (:name %)))
|
(mapv #(cpn/split-path (:name %)))
|
||||||
(common-prefix))
|
(common-prefix))
|
||||||
;; When the common parent is root, add a wrapper
|
;; When the common parent is root, add a wrapper
|
||||||
add-wrapper? (empty? prefix)
|
add-wrapper? (empty? prefix)
|
||||||
first-shape (first shapes)
|
first-shape (first shapes)
|
||||||
delta (gpt/point (- (:x rect) (:x first-shape) 30)
|
delta (gpt/point (- (:x rect) (:x first-shape) 30)
|
||||||
@ -667,10 +667,10 @@
|
|||||||
(dwt/update-dimensions [variant-id] :height (+ (:height rect) 60))
|
(dwt/update-dimensions [variant-id] :height (+ (:height rect) 60))
|
||||||
(ev/event {::ev/name "combine-as-variants" ::ev/origin trigger :number-of-combined (count ids)}))
|
(ev/event {::ev/name "combine-as-variants" ::ev/origin trigger :number-of-combined (count ids)}))
|
||||||
|
|
||||||
;; NOTE: we need to schedule a commit into a
|
;; NOTE: we need to schedule a commit into a
|
||||||
;; microtask for ensure that all the scheduled
|
;; microtask for ensure that all the scheduled
|
||||||
;; microtask of previous events execute before the
|
;; microtask of previous events execute before the
|
||||||
;; commit
|
;; commit
|
||||||
(->> (rx/of (dwu/commit-undo-transaction undo-id))
|
(->> (rx/of (dwu/commit-undo-transaction undo-id))
|
||||||
(rx/observe-on :async)))))))
|
(rx/observe-on :async)))))))
|
||||||
|
|
||||||
@ -705,7 +705,7 @@
|
|||||||
(let [libraries (dsh/lookup-libraries state)
|
(let [libraries (dsh/lookup-libraries state)
|
||||||
component-id (:component-id shape)
|
component-id (:component-id shape)
|
||||||
component (ctf/get-component libraries (:component-file shape) component-id :include-deleted? false)]
|
component (ctf/get-component libraries (:component-file shape) component-id :include-deleted? false)]
|
||||||
;; If the value is already val, do nothing
|
;; If the value is already val, do nothing
|
||||||
(when (not= val (dm/get-in component [:variant-properties pos :value]))
|
(when (not= val (dm/get-in component [:variant-properties pos :value]))
|
||||||
(let [current-page-objects (dsh/lookup-page-objects state)
|
(let [current-page-objects (dsh/lookup-page-objects state)
|
||||||
variant-id (:variant-id component)
|
variant-id (:variant-id component)
|
||||||
|
|||||||
@ -214,8 +214,8 @@
|
|||||||
([font-id variant-id]
|
([font-id variant-id]
|
||||||
(log/dbg :action "try-ensure-loaded!" :font-id font-id :variant-id variant-id)
|
(log/dbg :action "try-ensure-loaded!" :font-id font-id :variant-id variant-id)
|
||||||
(if-not (exists? js/window)
|
(if-not (exists? js/window)
|
||||||
;; If we are in the worker environment, we just mark it as loaded
|
;; If we are in the worker environment, we just mark it as loaded
|
||||||
;; without really loading it.
|
;; without really loading it.
|
||||||
(do
|
(do
|
||||||
(swap! loaded-hints conj {:font-id font-id :font-variant-id variant-id})
|
(swap! loaded-hints conj {:font-id font-id :font-variant-id variant-id})
|
||||||
(p/resolved font-id))
|
(p/resolved font-id))
|
||||||
|
|||||||
@ -133,7 +133,7 @@
|
|||||||
[{:keys [shape] :as props}]
|
[{:keys [shape] :as props}]
|
||||||
(let [childs (mapv #(get objects %) (:shapes shape))]
|
(let [childs (mapv #(get objects %) (:shapes shape))]
|
||||||
(if (and (map? (:content shape))
|
(if (and (map? (:content shape))
|
||||||
;; tspan shouldn't be contained in a group or have svg defs
|
;; tspan shouldn't be contained in a group or have svg defs
|
||||||
(not= :tspan (get-in shape [:content :tag]))
|
(not= :tspan (get-in shape [:content :tag]))
|
||||||
(or (= :svg (get-in shape [:content :tag]))
|
(or (= :svg (get-in shape [:content :tag]))
|
||||||
(contains? shape :svg-attrs)))
|
(contains? shape :svg-attrs)))
|
||||||
|
|||||||
@ -762,7 +762,7 @@
|
|||||||
h (:height viewport)
|
h (:height viewport)
|
||||||
|
|
||||||
comment-width 284 ;; TODO: this is the width set via CSS in an outer container…
|
comment-width 284 ;; TODO: this is the width set via CSS in an outer container…
|
||||||
;; We should probably do this in a different way.
|
;; We should probably do this in a different way.
|
||||||
|
|
||||||
orientation-left? (>= (+ base-x comment-width (:x bubble-margin)) w)
|
orientation-left? (>= (+ base-x comment-width (:x bubble-margin)) w)
|
||||||
orientation-top? (>= base-y (/ h 2))
|
orientation-top? (>= base-y (/ h 2))
|
||||||
|
|||||||
@ -198,7 +198,7 @@
|
|||||||
:valid (and touched? (not error))
|
:valid (and touched? (not error))
|
||||||
:invalid (and touched? error)
|
:invalid (and touched? error)
|
||||||
:disabled disabled)
|
:disabled disabled)
|
||||||
;; :empty (str/empty? value)
|
;; :empty (str/empty? value)
|
||||||
|
|
||||||
|
|
||||||
on-focus #(reset! focus? true)
|
on-focus #(reset! focus? true)
|
||||||
|
|||||||
@ -225,10 +225,10 @@
|
|||||||
(and
|
(and
|
||||||
(= subscription-type "unlimited")
|
(= subscription-type "unlimited")
|
||||||
(or
|
(or
|
||||||
;; common: seats < 25 and diff >= 4
|
;; common: seats < 25 and diff >= 4
|
||||||
(and (< seats 25)
|
(and (< seats 25)
|
||||||
(>= (- editors seats) 4))
|
(>= (- editors seats) 4))
|
||||||
;; special: reached 25+ editors, seats < 25 and there is overuse
|
;; special: reached 25+ editors, seats < 25 and there is overuse
|
||||||
(and (< seats 25)
|
(and (< seats 25)
|
||||||
(>= editors 25)
|
(>= editors 25)
|
||||||
(> editors seats)))))))
|
(> editors seats)))))))
|
||||||
|
|||||||
@ -135,8 +135,8 @@
|
|||||||
:version "1.1"
|
:version "1.1"
|
||||||
:xmlns "http://www.w3.org/2000/svg"
|
:xmlns "http://www.w3.org/2000/svg"
|
||||||
:xmlnsXlink "http://www.w3.org/1999/xlink"
|
:xmlnsXlink "http://www.w3.org/1999/xlink"
|
||||||
;; Fix Chromium bug about color of html texts
|
;; Fix Chromium bug about color of html texts
|
||||||
;; https://bugs.chromium.org/p/chromium/issues/detail?id=1244560#c5
|
;; https://bugs.chromium.org/p/chromium/issues/detail?id=1244560#c5
|
||||||
:style {:-webkit-print-color-adjust :exact}
|
:style {:-webkit-print-color-adjust :exact}
|
||||||
:fill "none"}
|
:fill "none"}
|
||||||
|
|
||||||
|
|||||||
@ -71,11 +71,11 @@
|
|||||||
start-size-ref (mf/use-ref nil)
|
start-size-ref (mf/use-ref nil)
|
||||||
start-ref (mf/use-ref nil)
|
start-ref (mf/use-ref nil)
|
||||||
|
|
||||||
;; Since Penpot is not responsive designed, this value will only refer to vertical axis.
|
;; Since Penpot is not responsive designed, this value will only refer to vertical axis.
|
||||||
window-height* (mf/use-state #(dom/get-window-height))
|
window-height* (mf/use-state #(dom/get-window-height))
|
||||||
window-height (deref window-height*)
|
window-height (deref window-height*)
|
||||||
|
|
||||||
;; In case max-val is a string, we need to parse it as a double.
|
;; In case max-val is a string, we need to parse it as a double.
|
||||||
max-val (mf/with-memo [max-val window-height]
|
max-val (mf/with-memo [max-val window-height]
|
||||||
(let [parsed-max-val (when (string? max-val) (d/parse-double max-val))]
|
(let [parsed-max-val (when (string? max-val) (d/parse-double max-val))]
|
||||||
(if parsed-max-val
|
(if parsed-max-val
|
||||||
|
|||||||
@ -82,7 +82,7 @@
|
|||||||
:style #js {"--bullet-size" "16px"}}
|
:style #js {"--bullet-size" "16px"}}
|
||||||
[:& cb/color-bullet {:color color
|
[:& cb/color-bullet {:color color
|
||||||
:mini true}]]
|
:mini true}]]
|
||||||
;; REMOVE this conditional when :inspect-styles flag is removed
|
;; REMOVE this conditional when :inspect-styles flag is removed
|
||||||
(if (contains? cf/flags :inspect-styles)
|
(if (contains? cf/flags :inspect-styles)
|
||||||
[:div {:class (stl/css :global/attr-label)} property]
|
[:div {:class (stl/css :global/attr-label)} property]
|
||||||
[:div {:class (stl/css :format-wrapper)}
|
[:div {:class (stl/css :format-wrapper)}
|
||||||
|
|||||||
@ -107,10 +107,10 @@
|
|||||||
(when (:text-decoration style)
|
(when (:text-decoration style)
|
||||||
[:div {:class (stl/css :text-row)}
|
[:div {:class (stl/css :text-row)}
|
||||||
[:div {:class (stl/css :global/attr-label)} "Text Decoration"]
|
[:div {:class (stl/css :global/attr-label)} "Text Decoration"]
|
||||||
;; Execution time translation strings:
|
;; Execution time translation strings:
|
||||||
;; (tr "inspect.attributes.typography.text-decoration.none")
|
;; (tr "inspect.attributes.typography.text-decoration.none")
|
||||||
;; (tr "inspect.attributes.typography.text-decoration.strikethrough")
|
;; (tr "inspect.attributes.typography.text-decoration.strikethrough")
|
||||||
;; (tr "inspect.attributes.typography.text-decoration.underline")
|
;; (tr "inspect.attributes.typography.text-decoration.underline")
|
||||||
[:div {:class (stl/css :global/attr-value)}
|
[:div {:class (stl/css :global/attr-value)}
|
||||||
[:> copy-button* {:data (copy-style-data style :text-decoration)}
|
[:> copy-button* {:data (copy-style-data style :text-decoration)}
|
||||||
[:div {:class (stl/css :button-children)}
|
[:div {:class (stl/css :button-children)}
|
||||||
@ -119,12 +119,12 @@
|
|||||||
(when (:text-transform style)
|
(when (:text-transform style)
|
||||||
[:div {:class (stl/css :text-row)}
|
[:div {:class (stl/css :text-row)}
|
||||||
[:div {:class (stl/css :global/attr-label)} "Text Transform"]
|
[:div {:class (stl/css :global/attr-label)} "Text Transform"]
|
||||||
;; Execution time translation strings:
|
;; Execution time translation strings:
|
||||||
;; (tr "inspect.attributes.typography.text-transform.lowercase")
|
;; (tr "inspect.attributes.typography.text-transform.lowercase")
|
||||||
;; (tr "inspect.attributes.typography.text-transform.none")
|
;; (tr "inspect.attributes.typography.text-transform.none")
|
||||||
;; (tr "inspect.attributes.typography.text-transform.capitalize")
|
;; (tr "inspect.attributes.typography.text-transform.capitalize")
|
||||||
;; (tr "inspect.attributes.typography.text-transform.uppercase")
|
;; (tr "inspect.attributes.typography.text-transform.uppercase")
|
||||||
;; (tr "inspect.attributes.typography.text-transform.unset")
|
;; (tr "inspect.attributes.typography.text-transform.unset")
|
||||||
[:div {:class (stl/css :global/attr-value)}
|
[:div {:class (stl/css :global/attr-value)}
|
||||||
[:> copy-button* {:data (copy-style-data style :text-transform)}
|
[:> copy-button* {:data (copy-style-data style :text-transform)}
|
||||||
[:div {:class (stl/css :button-children)}
|
[:div {:class (stl/css :button-children)}
|
||||||
|
|||||||
@ -141,14 +141,14 @@
|
|||||||
(for [panel panels]
|
(for [panel panels]
|
||||||
[:li {:key (d/name panel)}
|
[:li {:key (d/name panel)}
|
||||||
(case panel
|
(case panel
|
||||||
;; VARIANTS PANEL
|
;; VARIANTS PANEL
|
||||||
:variant
|
:variant
|
||||||
[:> style-box* {:panel :variant}
|
[:> style-box* {:panel :variant}
|
||||||
[:> variants-panel* {:component first-component
|
[:> variants-panel* {:component first-component
|
||||||
:objects objects
|
:objects objects
|
||||||
:shape first-shape
|
:shape first-shape
|
||||||
:data data}]]
|
:data data}]]
|
||||||
;; GEOMETRY PANEL
|
;; GEOMETRY PANEL
|
||||||
:geometry
|
:geometry
|
||||||
[:> style-box* {:panel :geometry
|
[:> style-box* {:panel :geometry
|
||||||
:shorthand (:geometry shorthands)}
|
:shorthand (:geometry shorthands)}
|
||||||
@ -156,7 +156,7 @@
|
|||||||
:objects objects
|
:objects objects
|
||||||
:resolved-tokens resolved-active-tokens
|
:resolved-tokens resolved-active-tokens
|
||||||
:on-geometry-shorthand set-shorthands}]]
|
:on-geometry-shorthand set-shorthands}]]
|
||||||
;; LAYOUT PANEL
|
;; LAYOUT PANEL
|
||||||
:layout
|
:layout
|
||||||
(let [layout-shapes (->> shapes (filter ctl/any-layout?))]
|
(let [layout-shapes (->> shapes (filter ctl/any-layout?))]
|
||||||
(when (seq layout-shapes)
|
(when (seq layout-shapes)
|
||||||
@ -166,7 +166,7 @@
|
|||||||
:objects objects
|
:objects objects
|
||||||
:resolved-tokens resolved-active-tokens
|
:resolved-tokens resolved-active-tokens
|
||||||
:on-layout-shorthand set-shorthands}]]))
|
:on-layout-shorthand set-shorthands}]]))
|
||||||
;; LAYOUT ELEMENT PANEL
|
;; LAYOUT ELEMENT PANEL
|
||||||
:layout-element
|
:layout-element
|
||||||
(let [shapes (->> shapes (filter #(ctl/any-layout-immediate-child? objects %)))
|
(let [shapes (->> shapes (filter #(ctl/any-layout-immediate-child? objects %)))
|
||||||
some-layout-prop? (->> shapes
|
some-layout-prop? (->> shapes
|
||||||
|
|||||||
@ -101,7 +101,7 @@
|
|||||||
:resolved-tokens resolved-tokens
|
:resolved-tokens resolved-tokens
|
||||||
:color-space color-space}]))
|
:color-space color-space}]))
|
||||||
|
|
||||||
;; Typography style
|
;; Typography style
|
||||||
(when (and (not composite-typography-token)
|
(when (and (not composite-typography-token)
|
||||||
(:typography-ref-id style))
|
(:typography-ref-id style))
|
||||||
[:> typography-name-block* {:style style}])
|
[:> typography-name-block* {:style style}])
|
||||||
|
|||||||
@ -61,7 +61,7 @@
|
|||||||
content
|
content
|
||||||
(when (some? links)
|
(when (some? links)
|
||||||
(for [[index link] (d/enumerate links)]
|
(for [[index link] (d/enumerate links)]
|
||||||
;; TODO Review this component
|
;; TODO Review this component
|
||||||
[:& lb/link-button {:class (stl/css :link)
|
[:& lb/link-button {:class (stl/css :link)
|
||||||
:on-click (:callback link)
|
:on-click (:callback link)
|
||||||
:value (:label link)
|
:value (:label link)
|
||||||
|
|||||||
@ -171,8 +171,8 @@
|
|||||||
:fillOpacity opacity}
|
:fillOpacity opacity}
|
||||||
[:path {:d "M 3 0 L 6 3 L 3 6 L 0 3 z"}]])
|
[:path {:d "M 3 0 L 6 3 L 3 6 L 0 3 z"}]])
|
||||||
|
|
||||||
;; If the user wants line caps but different in each end,
|
;; If the user wants line caps but different in each end,
|
||||||
;; simulate it with markers.
|
;; simulate it with markers.
|
||||||
(when (and (or (= cap-start :round)
|
(when (and (or (= cap-start :round)
|
||||||
(= cap-end :round))
|
(= cap-end :round))
|
||||||
(not= cap-start cap-end))
|
(not= cap-start cap-end))
|
||||||
|
|||||||
@ -100,14 +100,14 @@
|
|||||||
[:& filters/filters {:shape (dissoc shape :blur) :filter-id filter-id-shadows}]
|
[:& filters/filters {:shape (dissoc shape :blur) :filter-id filter-id-shadows}]
|
||||||
[:& filters/filters {:shape (assoc shape :shadow []) :filter-id filter-id-blur}]]
|
[:& filters/filters {:shape (assoc shape :shadow []) :filter-id filter-id-blur}]]
|
||||||
|
|
||||||
;; This need to be separated in two layers so the clip doesn't affect the shadow filters
|
;; This need to be separated in two layers so the clip doesn't affect the shadow filters
|
||||||
;; otherwise the shadow will be clipped and not visible
|
;; otherwise the shadow will be clipped and not visible
|
||||||
[:g.frame-container-shadows {:filter filter-str-shadows}
|
[:g.frame-container-shadows {:filter filter-str-shadows}
|
||||||
[:g {:clip-path (when-not ^boolean show-content? (frame-clip-url shape render-id))
|
[:g {:clip-path (when-not ^boolean show-content? (frame-clip-url shape render-id))
|
||||||
;; A frame sets back normal fill behavior (default
|
;; A frame sets back normal fill behavior (default
|
||||||
;; transparent). It may have been changed to default black
|
;; transparent). It may have been changed to default black
|
||||||
;; if a shape coming from an imported SVG file is
|
;; if a shape coming from an imported SVG file is
|
||||||
;; rendered. See main.ui.shapes.attrs/add-style-attrs.
|
;; rendered. See main.ui.shapes.attrs/add-style-attrs.
|
||||||
:fill "none"}
|
:fill "none"}
|
||||||
|
|
||||||
[:& shape-fills {:shape shape}
|
[:& shape-fills {:shape shape}
|
||||||
|
|||||||
@ -447,7 +447,7 @@
|
|||||||
(mf/use-effect
|
(mf/use-effect
|
||||||
(mf/deps nav-scroll)
|
(mf/deps nav-scroll)
|
||||||
(fn []
|
(fn []
|
||||||
;; Set scroll position after navigate
|
;; Set scroll position after navigate
|
||||||
(when (number? nav-scroll)
|
(when (number? nav-scroll)
|
||||||
(let [viewer-section (dom/get-element "viewer-section")]
|
(let [viewer-section (dom/get-element "viewer-section")]
|
||||||
(st/emit! (dv/reset-nav-scroll))
|
(st/emit! (dv/reset-nav-scroll))
|
||||||
@ -481,8 +481,8 @@
|
|||||||
:fit (st/emit! dv/zoom-to-fit)
|
:fit (st/emit! dv/zoom-to-fit)
|
||||||
:fill (st/emit! dv/zoom-to-fill)
|
:fill (st/emit! dv/zoom-to-fill)
|
||||||
nil)
|
nil)
|
||||||
;; Navigate animation needs to be started after navigation
|
;; Navigate animation needs to be started after navigation
|
||||||
;; is complete, and we have the next page index.
|
;; is complete, and we have the next page index.
|
||||||
(let [nav-animation (d/seek #(= (:kind %) :go-to-frame) (vals current-animations))]
|
(let [nav-animation (d/seek #(= (:kind %) :go-to-frame) (vals current-animations))]
|
||||||
(when nav-animation
|
(when nav-animation
|
||||||
(let [orig-viewport (mf/ref-val orig-viewport-ref)
|
(let [orig-viewport (mf/ref-val orig-viewport-ref)
|
||||||
@ -498,7 +498,7 @@
|
|||||||
(mf/use-effect
|
(mf/use-effect
|
||||||
(mf/deps current-animations)
|
(mf/deps current-animations)
|
||||||
(fn []
|
(fn []
|
||||||
;; Overlay animations may be started when needed.
|
;; Overlay animations may be started when needed.
|
||||||
(when current-animations
|
(when current-animations
|
||||||
(doseq [[overlay-frame-id animation-vals] current-animations]
|
(doseq [[overlay-frame-id animation-vals] current-animations]
|
||||||
(let [overlay-viewport (dom/get-element (str "overlay-" (str (:overlay-id animation-vals))))
|
(let [overlay-viewport (dom/get-element (str "overlay-" (str (:overlay-id animation-vals))))
|
||||||
|
|||||||
@ -47,7 +47,7 @@
|
|||||||
(defn- ignore-frame-shape
|
(defn- ignore-frame-shape
|
||||||
[shape objects manual?]
|
[shape objects manual?]
|
||||||
(let [shape (cond-> shape ;; When the the interaction is not manual and its origin is a frame,
|
(let [shape (cond-> shape ;; When the the interaction is not manual and its origin is a frame,
|
||||||
;; we need to ignore it on all the find-frame calculations
|
;; we need to ignore it on all the find-frame calculations
|
||||||
(and (:frame-id shape) (not manual?))
|
(and (:frame-id shape) (not manual?))
|
||||||
(assoc :type :rect))
|
(assoc :type :rect))
|
||||||
objects (assoc objects (:id shape) shape)]
|
objects (assoc objects (:id shape) shape)]
|
||||||
|
|||||||
@ -112,7 +112,7 @@
|
|||||||
{:class (stl/css :file-name)
|
{:class (stl/css :file-name)
|
||||||
:title file-name
|
:title file-name
|
||||||
:on-double-click start-editing-name}
|
:on-double-click start-editing-name}
|
||||||
;;-- Persistende state widget
|
;;-- Persistende state widget
|
||||||
[:div {:class (case persistence-status
|
[:div {:class (case persistence-status
|
||||||
:pending (stl/css :status-notification :pending-status)
|
:pending (stl/css :status-notification :pending-status)
|
||||||
:saving (stl/css :status-notification :saving-status)
|
:saving (stl/css :status-notification :saving-status)
|
||||||
|
|||||||
@ -191,7 +191,7 @@
|
|||||||
:key "frame-container"
|
:key "frame-container"
|
||||||
:opacity (when ^boolean hidden? 0)}
|
:opacity (when ^boolean hidden? 0)}
|
||||||
|
|
||||||
;; When there is no thumbnail, we generate a empty rect.
|
;; When there is no thumbnail, we generate a empty rect.
|
||||||
(when (and (not ^boolean content-visible?) (not @imposter-loaded))
|
(when (and (not ^boolean content-visible?) (not @imposter-loaded))
|
||||||
[:g.frame-placeholder
|
[:g.frame-placeholder
|
||||||
[:rect {:x x
|
[:rect {:x x
|
||||||
|
|||||||
@ -106,7 +106,7 @@
|
|||||||
:title (if is-local
|
:title (if is-local
|
||||||
(mf/html [:div {:class (stl/css :special-title)}
|
(mf/html [:div {:class (stl/css :special-title)}
|
||||||
(tr "workspace.assets.local-library")])
|
(tr "workspace.assets.local-library")])
|
||||||
;; Do we need to add shared info here?
|
;; Do we need to add shared info here?
|
||||||
(mf/html [:div {:class (stl/css :special-title)}
|
(mf/html [:div {:class (stl/css :special-title)}
|
||||||
file-name]))}
|
file-name]))}
|
||||||
(when-not ^boolean is-local
|
(when-not ^boolean is-local
|
||||||
|
|||||||
@ -67,7 +67,7 @@
|
|||||||
(let [data (into [] (remove nil?) (dwc/extract-all-colors shapes file-id libraries))
|
(let [data (into [] (remove nil?) (dwc/extract-all-colors shapes file-id libraries))
|
||||||
groups (d/group-by :attrs #(dissoc % :attrs) data)
|
groups (d/group-by :attrs #(dissoc % :attrs) data)
|
||||||
|
|
||||||
;; Unique color attribute maps
|
;; Unique color attribute maps
|
||||||
all-colors (distinct (mapv :attrs data))
|
all-colors (distinct (mapv :attrs data))
|
||||||
|
|
||||||
;; Split into: library colors, token colors, and plain colors
|
;; Split into: library colors, token colors, and plain colors
|
||||||
|
|||||||
@ -281,7 +281,7 @@
|
|||||||
:options stroke-style-options
|
:options stroke-style-options
|
||||||
:on-change on-style-change}]])]
|
:on-change on-style-change}]])]
|
||||||
|
|
||||||
;; Stroke Caps
|
;; Stroke Caps
|
||||||
(when show-caps
|
(when show-caps
|
||||||
[:div {:class (stl/css :stroke-caps-options)}
|
[:div {:class (stl/css :stroke-caps-options)}
|
||||||
[:& select {:default-value (:stroke-cap-start stroke)
|
[:& select {:default-value (:stroke-cap-start stroke)
|
||||||
|
|||||||
@ -211,7 +211,7 @@
|
|||||||
(let [;; StyleDictionary will always convert to hex/rgba, so we take the format from the value input field
|
(let [;; StyleDictionary will always convert to hex/rgba, so we take the format from the value input field
|
||||||
prev-input-color (some-> value
|
prev-input-color (some-> value
|
||||||
(tinycolor/valid-color))
|
(tinycolor/valid-color))
|
||||||
;; If the input is a reference we will take the format from the computed value
|
;; If the input is a reference we will take the format from the computed value
|
||||||
prev-computed-color (when-not prev-input-color
|
prev-computed-color (when-not prev-input-color
|
||||||
(some-> value (tinycolor/valid-color)))
|
(some-> value (tinycolor/valid-color)))
|
||||||
prev-format (some-> (or prev-input-color prev-computed-color)
|
prev-format (some-> (or prev-input-color prev-computed-color)
|
||||||
@ -380,7 +380,7 @@
|
|||||||
(let [;; StyleDictionary will always convert to hex/rgba, so we take the format from the value input field
|
(let [;; StyleDictionary will always convert to hex/rgba, so we take the format from the value input field
|
||||||
prev-input-color (some-> value
|
prev-input-color (some-> value
|
||||||
(tinycolor/valid-color))
|
(tinycolor/valid-color))
|
||||||
;; If the input is a reference we will take the format from the computed value
|
;; If the input is a reference we will take the format from the computed value
|
||||||
prev-computed-color (when-not prev-input-color
|
prev-computed-color (when-not prev-input-color
|
||||||
(some-> value (tinycolor/valid-color)))
|
(some-> value (tinycolor/valid-color)))
|
||||||
prev-format (some-> (or prev-input-color prev-computed-color)
|
prev-format (some-> (or prev-input-color prev-computed-color)
|
||||||
|
|||||||
@ -146,7 +146,7 @@
|
|||||||
:active-theme-tokens active-theme-tokens
|
:active-theme-tokens active-theme-tokens
|
||||||
:on-click on-token-pill-click
|
:on-click on-token-pill-click
|
||||||
:on-context-menu on-pill-context-menu}])
|
:on-context-menu on-pill-context-menu}])
|
||||||
;; Render segment folder
|
;; Render segment folder
|
||||||
[:ul {:class (stl/css :node-parent)
|
[:ul {:class (stl/css :node-parent)
|
||||||
:key (:path node)}
|
:key (:path node)}
|
||||||
[:> folder-node* {:node node
|
[:> folder-node* {:node node
|
||||||
|
|||||||
@ -245,7 +245,7 @@
|
|||||||
(dom/child? (dom/get-target event) (dom/query ".grid-layout-editor"))
|
(dom/child? (dom/get-target event) (dom/query ".grid-layout-editor"))
|
||||||
(dom/class? (dom/get-target event) "viewport-selrect"))
|
(dom/class? (dom/get-target event) "viewport-selrect"))
|
||||||
(let [position (dom/get-client-position event)]
|
(let [position (dom/get-client-position event)]
|
||||||
;; Delayed callback because we need to wait to the previous context menu to be closed
|
;; Delayed callback because we need to wait to the previous context menu to be closed
|
||||||
(ts/schedule
|
(ts/schedule
|
||||||
#(st/emit!
|
#(st/emit!
|
||||||
(if (and (not read-only?) (some? @hover))
|
(if (and (not read-only?) (some? @hover))
|
||||||
|
|||||||
@ -123,7 +123,7 @@
|
|||||||
:aria-label (tr "workspace.path.actions.draw-nodes" (sc/get-tooltip :draw-nodes))
|
:aria-label (tr "workspace.path.actions.draw-nodes" (sc/get-tooltip :draw-nodes))
|
||||||
:tooltip-placement "bottom"
|
:tooltip-placement "bottom"
|
||||||
:on-click on-select-draw-mode}]
|
:on-click on-select-draw-mode}]
|
||||||
;; Edit mode
|
;; Edit mode
|
||||||
[:> icon-button* {:variant "ghost"
|
[:> icon-button* {:variant "ghost"
|
||||||
:class (stl/css :topbar-btn)
|
:class (stl/css :topbar-btn)
|
||||||
:icon i/move
|
:icon i/move
|
||||||
|
|||||||
@ -200,7 +200,7 @@
|
|||||||
is-variant? [:use {:href "#icon-component"}])])
|
is-variant? [:use {:href "#icon-component"}])])
|
||||||
|
|
||||||
(if ^boolean edition?
|
(if ^boolean edition?
|
||||||
;; Case when edition? is true
|
;; Case when edition? is true
|
||||||
[:foreignObject {:x text-pos-x
|
[:foreignObject {:x text-pos-x
|
||||||
:y -15
|
:y -15
|
||||||
:width (max 0 (- text-width text-pos-x))
|
:width (max 0 (- text-width text-pos-x))
|
||||||
@ -217,7 +217,7 @@
|
|||||||
:ref ref
|
:ref ref
|
||||||
:default-value (:name frame)
|
:default-value (:name frame)
|
||||||
:on-blur accept-edit}]]
|
:on-blur accept-edit}]]
|
||||||
;; Case when edition? is false
|
;; Case when edition? is false
|
||||||
[:foreignObject {:x text-pos-x
|
[:foreignObject {:x text-pos-x
|
||||||
:y -11
|
:y -11
|
||||||
:width (max 0 (- text-width text-pos-x))
|
:width (max 0 (- text-width text-pos-x))
|
||||||
|
|||||||
@ -215,7 +215,7 @@
|
|||||||
:meroitic #"\uD802[\uDD80-\uDD9F]"
|
:meroitic #"\uD802[\uDD80-\uDD9F]"
|
||||||
;; Arrows, Mathematical Operators, Misc Technical, Geometric Shapes, Misc Symbols, Dingbats, Supplemental Arrows, etc.
|
;; Arrows, Mathematical Operators, Misc Technical, Geometric Shapes, Misc Symbols, Dingbats, Supplemental Arrows, etc.
|
||||||
:symbols #"[\u2190-\u21FF\u2200-\u22FF\u2300-\u23FF\u25A0-\u25FF\u2600-\u26FF\u2700-\u27BF\u2B00-\u2BFF]"
|
:symbols #"[\u2190-\u21FF\u2200-\u22FF\u2300-\u23FF\u25A0-\u25FF\u2600-\u26FF\u2700-\u27BF\u2B00-\u2BFF]"
|
||||||
;; Additional arrows, math, technical, geometric, and symbol blocks
|
;; Additional arrows, math, technical, geometric, and symbol blocks
|
||||||
:symbols-2 #"[\u2190-\u21FF\u2200-\u22FF\u2300-\u23FF\u25A0-\u25FF\u2600-\u26FF\u2700-\u27BF\u2B00-\u2BFF]"
|
:symbols-2 #"[\u2190-\u21FF\u2200-\u22FF\u2300-\u23FF\u25A0-\u25FF\u2600-\u26FF\u2700-\u27BF\u2B00-\u2BFF]"
|
||||||
:music #"[\u2669-\u267B]|\uD834[\uDD00-\uDD1F]"})
|
:music #"[\u2669-\u267B]|\uD834[\uDD00-\uDD1F]"})
|
||||||
|
|
||||||
|
|||||||
@ -108,7 +108,7 @@ void main() {
|
|||||||
(.bufferData ^js gl (.-ARRAY_BUFFER ^js gl) (js/Float32Array. positions) (.-STATIC_DRAW ^js gl))
|
(.bufferData ^js gl (.-ARRAY_BUFFER ^js gl) (js/Float32Array. positions) (.-STATIC_DRAW ^js gl))
|
||||||
(.enableVertexAttribArray ^js gl position-location)
|
(.enableVertexAttribArray ^js gl position-location)
|
||||||
(.vertexAttribPointer ^js gl position-location 2 (.-FLOAT ^js gl) false 0 0)
|
(.vertexAttribPointer ^js gl position-location 2 (.-FLOAT ^js gl) false 0 0)
|
||||||
;; Set up texcoord buffer
|
;; Set up texcoord buffer
|
||||||
(.bindBuffer ^js gl (.-ARRAY_BUFFER ^js gl) texcoord-buffer)
|
(.bindBuffer ^js gl (.-ARRAY_BUFFER ^js gl) texcoord-buffer)
|
||||||
(.bufferData ^js gl (.-ARRAY_BUFFER ^js gl) (js/Float32Array. texcoords) (.-STATIC_DRAW ^js gl))
|
(.bufferData ^js gl (.-ARRAY_BUFFER ^js gl) (js/Float32Array. texcoords) (.-STATIC_DRAW ^js gl))
|
||||||
(.enableVertexAttribArray ^js gl texcoord-location)
|
(.enableVertexAttribArray ^js gl texcoord-location)
|
||||||
|
|||||||
@ -258,8 +258,8 @@
|
|||||||
(let [values (unchecked-get wasm/serializers "font-style")
|
(let [values (unchecked-get wasm/serializers "font-style")
|
||||||
default (unchecked-get values "normal")]
|
default (unchecked-get values "normal")]
|
||||||
(case font-style
|
(case font-style
|
||||||
;; NOTE: normal == regular!
|
;; NOTE: normal == regular!
|
||||||
;; is it OK to keep those two values in our cljs model?
|
;; is it OK to keep those two values in our cljs model?
|
||||||
"normal" (unchecked-get values "normal")
|
"normal" (unchecked-get values "normal")
|
||||||
"regular" (unchecked-get values "normal")
|
"regular" (unchecked-get values "normal")
|
||||||
"italic" (unchecked-get values "italic")
|
"italic" (unchecked-get values "italic")
|
||||||
|
|||||||
@ -7,5 +7,5 @@
|
|||||||
[hex opacity]
|
[hex opacity]
|
||||||
(let [rgb (js/parseInt (subs hex 1) 16)
|
(let [rgb (js/parseInt (subs hex 1) 16)
|
||||||
a (mth/floor (* (or opacity 1) 0xff))]
|
a (mth/floor (* (or opacity 1) 0xff))]
|
||||||
;; rgba >>> 0 so we have an unsigned representation
|
;; rgba >>> 0 so we have an unsigned representation
|
||||||
(unsigned-bit-shift-right (bit-or (bit-shift-left a 24) rgb) 0)))
|
(unsigned-bit-shift-right (bit-or (bit-shift-left a 24) rgb) 0)))
|
||||||
@ -56,7 +56,7 @@
|
|||||||
is-input?
|
is-input?
|
||||||
(= (dom/get-tag-name target) "INPUT")]
|
(= (dom/get-tag-name target) "INPUT")]
|
||||||
|
|
||||||
;; ignore when pasting into an editable control
|
;; ignore when pasting into an editable control
|
||||||
(if-not (or content-editable? is-input?)
|
(if-not (or content-editable? is-input?)
|
||||||
(-> event
|
(-> event
|
||||||
(dom/event->browser-event)
|
(dom/event->browser-event)
|
||||||
|
|||||||
@ -44,9 +44,9 @@
|
|||||||
(js/console.log
|
(js/console.log
|
||||||
label
|
label
|
||||||
"[" (:name data) "]"
|
"[" (:name data) "]"
|
||||||
;; (if currentTarget
|
;; (if currentTarget
|
||||||
;; (str "<" (.-localName currentTarget) " " (.-textContent currentTarget) ">")
|
;; (str "<" (.-localName currentTarget) " " (.-textContent currentTarget) ">")
|
||||||
;; "null")
|
;; "null")
|
||||||
(if relatedTarget
|
(if relatedTarget
|
||||||
(str "<" (.-localName relatedTarget) " " (.-textContent relatedTarget) ">")
|
(str "<" (.-localName relatedTarget) " " (.-textContent relatedTarget) ">")
|
||||||
"null"))))
|
"null"))))
|
||||||
|
|||||||
@ -54,8 +54,8 @@
|
|||||||
(assoc acc key (get node key default-value)))) {} attrs)
|
(assoc acc key (get node key default-value)))) {} attrs)
|
||||||
fills
|
fills
|
||||||
(cond
|
(cond
|
||||||
;; DEPRECATED: still here for backward compatibility with
|
;; DEPRECATED: still here for backward compatibility with
|
||||||
;; old penpot files that still has a single color.
|
;; old penpot files that still has a single color.
|
||||||
(or (some? (:fill-color node))
|
(or (some? (:fill-color node))
|
||||||
(some? (:fill-opacity node))
|
(some? (:fill-opacity node))
|
||||||
(some? (:fill-color-gradient node)))
|
(some? (:fill-color-gradient node)))
|
||||||
|
|||||||
@ -100,7 +100,7 @@
|
|||||||
file (setup-file)
|
file (setup-file)
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
blue1 (cths/get-shape file :blue1)
|
blue1 (cths/get-shape file :blue1)
|
||||||
features #{"components/v2"}
|
features #{"components/v2"}
|
||||||
@ -121,12 +121,12 @@
|
|||||||
blue1' (cths/get-shape file' :blue1)
|
blue1' (cths/get-shape file' :blue1)
|
||||||
copied-blue1' (find-copied-shape blue1' page' uuid/zero)]
|
copied-blue1' (find-copied-shape blue1' page' uuid/zero)]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
|
|
||||||
;; blue1 has swap-id
|
;; blue1 has swap-id
|
||||||
(t/is (some? (ctk/get-swap-slot blue1')))
|
(t/is (some? (ctk/get-swap-slot blue1')))
|
||||||
|
|
||||||
;; copied-blue1 has not swap-id
|
;; copied-blue1 has not swap-id
|
||||||
(t/is (some? copied-blue1'))
|
(t/is (some? copied-blue1'))
|
||||||
(t/is (nil? (ctk/get-swap-slot copied-blue1')))))))))
|
(t/is (nil? (ctk/get-swap-slot copied-blue1')))))))))
|
||||||
|
|
||||||
@ -138,7 +138,7 @@
|
|||||||
file (setup-file)
|
file (setup-file)
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
b1 (cths/get-shape file :frame-b1)
|
b1 (cths/get-shape file :frame-b1)
|
||||||
blue1 (cths/get-shape file :blue1)
|
blue1 (cths/get-shape file :blue1)
|
||||||
@ -161,11 +161,11 @@
|
|||||||
blue1' (cths/get-shape file' :blue1)
|
blue1' (cths/get-shape file' :blue1)
|
||||||
copied-blue1' (find-copied-shape blue1' page' (:id b1'))]
|
copied-blue1' (find-copied-shape blue1' page' (:id b1'))]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
;; blue1 has swap-id
|
;; blue1 has swap-id
|
||||||
(t/is (some? (ctk/get-swap-slot blue1')))
|
(t/is (some? (ctk/get-swap-slot blue1')))
|
||||||
|
|
||||||
;; copied-blue1 has not swap-id
|
;; copied-blue1 has not swap-id
|
||||||
(t/is (some? copied-blue1'))
|
(t/is (some? copied-blue1'))
|
||||||
(t/is (nil? (ctk/get-swap-slot copied-blue1')))))))))
|
(t/is (nil? (ctk/get-swap-slot copied-blue1')))))))))
|
||||||
|
|
||||||
@ -176,7 +176,7 @@
|
|||||||
file (setup-file)
|
file (setup-file)
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
yellow (cths/get-shape file :frame-yellow)
|
yellow (cths/get-shape file :frame-yellow)
|
||||||
blue1 (cths/get-shape file :blue1)
|
blue1 (cths/get-shape file :blue1)
|
||||||
@ -199,11 +199,11 @@
|
|||||||
blue1' (cths/get-shape file' :blue1)
|
blue1' (cths/get-shape file' :blue1)
|
||||||
copied-blue1' (find-copied-shape blue1' page' (:id yellow'))]
|
copied-blue1' (find-copied-shape blue1' page' (:id yellow'))]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
;; blue1 has swap-id
|
;; blue1 has swap-id
|
||||||
(t/is (some? (ctk/get-swap-slot blue1')))
|
(t/is (some? (ctk/get-swap-slot blue1')))
|
||||||
|
|
||||||
;; copied-blue1 has not swap-id
|
;; copied-blue1 has not swap-id
|
||||||
(t/is (some? copied-blue1'))
|
(t/is (some? copied-blue1'))
|
||||||
(t/is (nil? (ctk/get-swap-slot copied-blue1')))))))))
|
(t/is (nil? (ctk/get-swap-slot copied-blue1')))))))))
|
||||||
|
|
||||||
@ -215,7 +215,7 @@
|
|||||||
file (setup-file)
|
file (setup-file)
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
b2 (cths/get-shape file :frame-b2)
|
b2 (cths/get-shape file :frame-b2)
|
||||||
blue1 (cths/get-shape file :blue1)
|
blue1 (cths/get-shape file :blue1)
|
||||||
@ -238,11 +238,11 @@
|
|||||||
blue1' (cths/get-shape file' :blue1)
|
blue1' (cths/get-shape file' :blue1)
|
||||||
copied-blue1' (find-copied-shape blue1' page' (:id b2'))]
|
copied-blue1' (find-copied-shape blue1' page' (:id b2'))]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
;; blue1 has swap-id
|
;; blue1 has swap-id
|
||||||
(t/is (some? (ctk/get-swap-slot blue1')))
|
(t/is (some? (ctk/get-swap-slot blue1')))
|
||||||
|
|
||||||
;; copied-blue1 has not swap-id
|
;; copied-blue1 has not swap-id
|
||||||
(t/is (some? copied-blue1'))
|
(t/is (some? copied-blue1'))
|
||||||
(t/is (nil? (ctk/get-swap-slot copied-blue1')))))))))
|
(t/is (nil? (ctk/get-swap-slot copied-blue1')))))))))
|
||||||
|
|
||||||
@ -254,7 +254,7 @@
|
|||||||
file (setup-file)
|
file (setup-file)
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
blue1 (cths/get-shape file :blue1)
|
blue1 (cths/get-shape file :blue1)
|
||||||
features #{"components/v2"}
|
features #{"components/v2"}
|
||||||
@ -276,8 +276,8 @@
|
|||||||
page' (cthf/current-page file')
|
page' (cthf/current-page file')
|
||||||
copied-blue1' (find-copied-shape blue1 page' uuid/zero)]
|
copied-blue1' (find-copied-shape blue1 page' uuid/zero)]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
;; copied-blue1 has not swap-id
|
;; copied-blue1 has not swap-id
|
||||||
(t/is (some? copied-blue1'))
|
(t/is (some? copied-blue1'))
|
||||||
(t/is (nil? (ctk/get-swap-slot copied-blue1')))))))))
|
(t/is (nil? (ctk/get-swap-slot copied-blue1')))))))))
|
||||||
|
|
||||||
@ -290,7 +290,7 @@
|
|||||||
file (setup-file)
|
file (setup-file)
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
yellow (cths/get-shape file :frame-yellow)
|
yellow (cths/get-shape file :frame-yellow)
|
||||||
blue1 (cths/get-shape file :blue1)
|
blue1 (cths/get-shape file :blue1)
|
||||||
@ -314,8 +314,8 @@
|
|||||||
yellow' (cths/get-shape file' :frame-yellow)
|
yellow' (cths/get-shape file' :frame-yellow)
|
||||||
copied-blue1' (find-copied-shape blue1 page' (:id yellow'))]
|
copied-blue1' (find-copied-shape blue1 page' (:id yellow'))]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
;; copied-blue1 has not swap-id
|
;; copied-blue1 has not swap-id
|
||||||
(t/is (some? copied-blue1'))
|
(t/is (some? copied-blue1'))
|
||||||
(t/is (nil? (ctk/get-swap-slot copied-blue1')))))))))
|
(t/is (nil? (ctk/get-swap-slot copied-blue1')))))))))
|
||||||
|
|
||||||
@ -327,7 +327,7 @@
|
|||||||
file (setup-file)
|
file (setup-file)
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
b2 (cths/get-shape file :frame-b2)
|
b2 (cths/get-shape file :frame-b2)
|
||||||
blue1 (cths/get-shape file :blue1)
|
blue1 (cths/get-shape file :blue1)
|
||||||
@ -351,8 +351,8 @@
|
|||||||
b2' (cths/get-shape file' :frame-b2)
|
b2' (cths/get-shape file' :frame-b2)
|
||||||
copied-blue1' (find-copied-shape blue1 page' (:id b2'))]
|
copied-blue1' (find-copied-shape blue1 page' (:id b2'))]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
;; copied-blue1 has not swap-id
|
;; copied-blue1 has not swap-id
|
||||||
(t/is (some? copied-blue1'))
|
(t/is (some? copied-blue1'))
|
||||||
(t/is (nil? (ctk/get-swap-slot copied-blue1')))))))))
|
(t/is (nil? (ctk/get-swap-slot copied-blue1')))))))))
|
||||||
|
|
||||||
@ -364,7 +364,7 @@
|
|||||||
file (setup-file-blue1-in-yellow)
|
file (setup-file-blue1-in-yellow)
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
yellow (cths/get-shape file :frame-yellow)
|
yellow (cths/get-shape file :frame-yellow)
|
||||||
features #{"components/v2"}
|
features #{"components/v2"}
|
||||||
@ -386,12 +386,12 @@
|
|||||||
blue1' (cths/get-shape file' :blue1)
|
blue1' (cths/get-shape file' :blue1)
|
||||||
copied-blue1' (find-copied-shape blue1' page' (:id copied-yellow'))]
|
copied-blue1' (find-copied-shape blue1' page' (:id copied-yellow'))]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
|
|
||||||
;; blue1 has swap-id
|
;; blue1 has swap-id
|
||||||
(t/is (some? (ctk/get-swap-slot blue1')))
|
(t/is (some? (ctk/get-swap-slot blue1')))
|
||||||
|
|
||||||
;; copied-blue1 has not swap-id
|
;; copied-blue1 has not swap-id
|
||||||
(t/is (some? copied-blue1'))
|
(t/is (some? copied-blue1'))
|
||||||
(t/is (nil? (ctk/get-swap-slot copied-blue1')))))))))
|
(t/is (nil? (ctk/get-swap-slot copied-blue1')))))))))
|
||||||
|
|
||||||
@ -402,7 +402,7 @@
|
|||||||
file (setup-file-blue1-in-yellow)
|
file (setup-file-blue1-in-yellow)
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
yellow (cths/get-shape file :frame-yellow)
|
yellow (cths/get-shape file :frame-yellow)
|
||||||
b1 (cths/get-shape file :frame-b1)
|
b1 (cths/get-shape file :frame-b1)
|
||||||
@ -426,12 +426,12 @@
|
|||||||
blue1' (cths/get-shape file' :blue1)
|
blue1' (cths/get-shape file' :blue1)
|
||||||
copied-blue1' (find-copied-shape blue1' page' (:id copied-yellow'))]
|
copied-blue1' (find-copied-shape blue1' page' (:id copied-yellow'))]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
|
|
||||||
;; blue1 has swap-id
|
;; blue1 has swap-id
|
||||||
(t/is (some? (ctk/get-swap-slot blue1')))
|
(t/is (some? (ctk/get-swap-slot blue1')))
|
||||||
|
|
||||||
;; copied-blue1 has not swap-id
|
;; copied-blue1 has not swap-id
|
||||||
(t/is (some? copied-blue1'))
|
(t/is (some? copied-blue1'))
|
||||||
(t/is (nil? (ctk/get-swap-slot copied-blue1')))))))))
|
(t/is (nil? (ctk/get-swap-slot copied-blue1')))))))))
|
||||||
|
|
||||||
@ -442,7 +442,7 @@
|
|||||||
file (setup-file-blue1-in-yellow)
|
file (setup-file-blue1-in-yellow)
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
yellow (cths/get-shape file :frame-yellow)
|
yellow (cths/get-shape file :frame-yellow)
|
||||||
b2 (cths/get-shape file :frame-b2)
|
b2 (cths/get-shape file :frame-b2)
|
||||||
@ -466,11 +466,11 @@
|
|||||||
blue1' (cths/get-shape file' :blue1)
|
blue1' (cths/get-shape file' :blue1)
|
||||||
copied-blue1' (find-copied-shape blue1' page' (:id copied-yellow'))]
|
copied-blue1' (find-copied-shape blue1' page' (:id copied-yellow'))]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
|
|
||||||
;; blue1 has swap-id
|
;; blue1 has swap-id
|
||||||
(t/is (some? (ctk/get-swap-slot blue1')))
|
(t/is (some? (ctk/get-swap-slot blue1')))
|
||||||
;; copied-blue1 has not swap-id
|
;; copied-blue1 has not swap-id
|
||||||
(t/is (some? copied-blue1'))
|
(t/is (some? copied-blue1'))
|
||||||
(t/is (nil? (ctk/get-swap-slot copied-blue1')))))))))
|
(t/is (nil? (ctk/get-swap-slot copied-blue1')))))))))
|
||||||
|
|
||||||
@ -482,7 +482,7 @@
|
|||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
blue1 (cths/get-shape file :blue1)
|
blue1 (cths/get-shape file :blue1)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
yellow (cths/get-shape file :frame-yellow)
|
yellow (cths/get-shape file :frame-yellow)
|
||||||
features #{"components/v2"}
|
features #{"components/v2"}
|
||||||
@ -505,8 +505,8 @@
|
|||||||
copied-yellow' (find-copied-shape yellow page' uuid/zero)
|
copied-yellow' (find-copied-shape yellow page' uuid/zero)
|
||||||
copied-blue1' (find-copied-shape blue1 page' (:id copied-yellow'))]
|
copied-blue1' (find-copied-shape blue1 page' (:id copied-yellow'))]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
;; copied-blue1 has not swap-id
|
;; copied-blue1 has not swap-id
|
||||||
(t/is (some? copied-blue1'))
|
(t/is (some? copied-blue1'))
|
||||||
(t/is (nil? (ctk/get-swap-slot copied-blue1')))))))))
|
(t/is (nil? (ctk/get-swap-slot copied-blue1')))))))))
|
||||||
|
|
||||||
@ -518,7 +518,7 @@
|
|||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
blue1 (cths/get-shape file :blue1)
|
blue1 (cths/get-shape file :blue1)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
yellow (cths/get-shape file :frame-yellow)
|
yellow (cths/get-shape file :frame-yellow)
|
||||||
b1 (cths/get-shape file :frame-b1)
|
b1 (cths/get-shape file :frame-b1)
|
||||||
@ -543,8 +543,8 @@
|
|||||||
copied-yellow' (find-copied-shape yellow page' (:id b1'))
|
copied-yellow' (find-copied-shape yellow page' (:id b1'))
|
||||||
copied-blue1' (find-copied-shape blue1 page' (:id copied-yellow'))]
|
copied-blue1' (find-copied-shape blue1 page' (:id copied-yellow'))]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
;; copied-blue1 has not swap-id
|
;; copied-blue1 has not swap-id
|
||||||
(t/is (some? copied-blue1'))
|
(t/is (some? copied-blue1'))
|
||||||
(t/is (nil? (ctk/get-swap-slot copied-blue1')))))))))
|
(t/is (nil? (ctk/get-swap-slot copied-blue1')))))))))
|
||||||
|
|
||||||
@ -556,7 +556,7 @@
|
|||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
blue1 (cths/get-shape file :blue1)
|
blue1 (cths/get-shape file :blue1)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
yellow (cths/get-shape file :frame-yellow)
|
yellow (cths/get-shape file :frame-yellow)
|
||||||
b2 (cths/get-shape file :frame-b2)
|
b2 (cths/get-shape file :frame-b2)
|
||||||
@ -581,8 +581,8 @@
|
|||||||
copied-yellow' (find-copied-shape yellow page' (:id b2'))
|
copied-yellow' (find-copied-shape yellow page' (:id b2'))
|
||||||
copied-blue1' (find-copied-shape blue1 page' (:id copied-yellow'))]
|
copied-blue1' (find-copied-shape blue1 page' (:id copied-yellow'))]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
;; copied-blue1 has not swap-id
|
;; copied-blue1 has not swap-id
|
||||||
(t/is (some? copied-blue1'))
|
(t/is (some? copied-blue1'))
|
||||||
(t/is (nil? (ctk/get-swap-slot copied-blue1')))))))))
|
(t/is (nil? (ctk/get-swap-slot copied-blue1')))))))))
|
||||||
|
|
||||||
@ -593,7 +593,7 @@
|
|||||||
file (setup-file)
|
file (setup-file)
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
green (cths/get-shape file :green-copy)
|
green (cths/get-shape file :green-copy)
|
||||||
features #{"components/v2"}
|
features #{"components/v2"}
|
||||||
@ -615,12 +615,12 @@
|
|||||||
copied-green' (find-copied-shape green page' uuid/zero)
|
copied-green' (find-copied-shape green page' uuid/zero)
|
||||||
copied-blue2' (find-copied-shape blue2' page' (:id copied-green'))]
|
copied-blue2' (find-copied-shape blue2' page' (:id copied-green'))]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
|
|
||||||
;; blue2 has swap-id
|
;; blue2 has swap-id
|
||||||
(t/is (some? (ctk/get-swap-slot blue2')))
|
(t/is (some? (ctk/get-swap-slot blue2')))
|
||||||
|
|
||||||
;; copied-blue2 also has swap-id
|
;; copied-blue2 also has swap-id
|
||||||
(t/is (some? copied-blue2'))
|
(t/is (some? copied-blue2'))
|
||||||
(t/is (some? (ctk/get-swap-slot copied-blue2')))))))))
|
(t/is (some? (ctk/get-swap-slot copied-blue2')))))))))
|
||||||
|
|
||||||
@ -631,7 +631,7 @@
|
|||||||
file (setup-file)
|
file (setup-file)
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
b1 (cths/get-shape file :frame-b1)
|
b1 (cths/get-shape file :frame-b1)
|
||||||
green (cths/get-shape file :green-copy)
|
green (cths/get-shape file :green-copy)
|
||||||
@ -655,12 +655,12 @@
|
|||||||
copied-green' (find-copied-shape green page' (:id b1'))
|
copied-green' (find-copied-shape green page' (:id b1'))
|
||||||
copied-blue2' (find-copied-shape blue2' page' (:id copied-green'))]
|
copied-blue2' (find-copied-shape blue2' page' (:id copied-green'))]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
|
|
||||||
;; blue1 has swap-id
|
;; blue1 has swap-id
|
||||||
(t/is (some? (ctk/get-swap-slot blue2')))
|
(t/is (some? (ctk/get-swap-slot blue2')))
|
||||||
|
|
||||||
;; copied-blue1 also has swap-id
|
;; copied-blue1 also has swap-id
|
||||||
(t/is (some? copied-blue2'))
|
(t/is (some? copied-blue2'))
|
||||||
(t/is (some? (ctk/get-swap-slot copied-blue2')))))))))
|
(t/is (some? (ctk/get-swap-slot copied-blue2')))))))))
|
||||||
|
|
||||||
@ -671,7 +671,7 @@
|
|||||||
file (setup-file)
|
file (setup-file)
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
b2 (cths/get-shape file :frame-b2)
|
b2 (cths/get-shape file :frame-b2)
|
||||||
green (cths/get-shape file :green-copy)
|
green (cths/get-shape file :green-copy)
|
||||||
@ -695,12 +695,12 @@
|
|||||||
copied-green' (find-copied-shape green page' (:id b2'))
|
copied-green' (find-copied-shape green page' (:id b2'))
|
||||||
copied-blue2' (find-copied-shape blue2' page' (:id copied-green'))]
|
copied-blue2' (find-copied-shape blue2' page' (:id copied-green'))]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
|
|
||||||
;; blue2 has swap-id
|
;; blue2 has swap-id
|
||||||
(t/is (some? (ctk/get-swap-slot blue2')))
|
(t/is (some? (ctk/get-swap-slot blue2')))
|
||||||
|
|
||||||
;; copied-blue1 also has swap-id
|
;; copied-blue1 also has swap-id
|
||||||
(t/is (some? copied-blue2'))
|
(t/is (some? copied-blue2'))
|
||||||
(t/is (some? (ctk/get-swap-slot copied-blue2')))))))))
|
(t/is (some? (ctk/get-swap-slot copied-blue2')))))))))
|
||||||
|
|
||||||
@ -712,7 +712,7 @@
|
|||||||
file (setup-file)
|
file (setup-file)
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
green (cths/get-shape file :green-copy)
|
green (cths/get-shape file :green-copy)
|
||||||
blue2 (cths/get-shape file :blue-copy-in-green-copy)
|
blue2 (cths/get-shape file :blue-copy-in-green-copy)
|
||||||
@ -736,8 +736,8 @@
|
|||||||
copied-green' (find-copied-shape green page' uuid/zero)
|
copied-green' (find-copied-shape green page' uuid/zero)
|
||||||
copied-blue1' (find-copied-shape blue2 page' (:id copied-green'))]
|
copied-blue1' (find-copied-shape blue2 page' (:id copied-green'))]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
;; copied-blue1 has swap-id
|
;; copied-blue1 has swap-id
|
||||||
(t/is (some? copied-blue1'))
|
(t/is (some? copied-blue1'))
|
||||||
(t/is (some? (ctk/get-swap-slot copied-blue1')))))))))
|
(t/is (some? (ctk/get-swap-slot copied-blue1')))))))))
|
||||||
|
|
||||||
@ -748,7 +748,7 @@
|
|||||||
file (setup-file)
|
file (setup-file)
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
b1 (cths/get-shape file :frame-b1)
|
b1 (cths/get-shape file :frame-b1)
|
||||||
green (cths/get-shape file :green-copy)
|
green (cths/get-shape file :green-copy)
|
||||||
@ -774,8 +774,8 @@
|
|||||||
copied-green' (find-copied-shape green page' (:id b1'))
|
copied-green' (find-copied-shape green page' (:id b1'))
|
||||||
copied-blue2' (find-copied-shape blue2 page' (:id copied-green'))]
|
copied-blue2' (find-copied-shape blue2 page' (:id copied-green'))]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
;; copied-blue1 has swap-id
|
;; copied-blue1 has swap-id
|
||||||
(t/is (some? copied-blue2'))
|
(t/is (some? copied-blue2'))
|
||||||
(t/is (some? (ctk/get-swap-slot copied-blue2')))))))))
|
(t/is (some? (ctk/get-swap-slot copied-blue2')))))))))
|
||||||
|
|
||||||
@ -786,7 +786,7 @@
|
|||||||
file (setup-file)
|
file (setup-file)
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
b2 (cths/get-shape file :frame-b2)
|
b2 (cths/get-shape file :frame-b2)
|
||||||
blue2 (cths/get-shape file :blue-copy-in-green-copy)
|
blue2 (cths/get-shape file :blue-copy-in-green-copy)
|
||||||
@ -812,8 +812,8 @@
|
|||||||
copied-green' (find-copied-shape green page' (:id b2'))
|
copied-green' (find-copied-shape green page' (:id b2'))
|
||||||
copied-blue2' (find-copied-shape blue2 page' (:id copied-green'))]
|
copied-blue2' (find-copied-shape blue2 page' (:id copied-green'))]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
;; copied-blue1 has swap-id
|
;; copied-blue1 has swap-id
|
||||||
(t/is (some? copied-blue2'))
|
(t/is (some? copied-blue2'))
|
||||||
(t/is (some? (ctk/get-swap-slot copied-blue2')))))))))
|
(t/is (some? (ctk/get-swap-slot copied-blue2')))))))))
|
||||||
|
|
||||||
@ -823,10 +823,10 @@
|
|||||||
(t/async
|
(t/async
|
||||||
done
|
done
|
||||||
(let [;; ==== Setup
|
(let [;; ==== Setup
|
||||||
;; {:frame-red} [:name frame-blue] # [Component :red]
|
;; {:frame-red} [:name frame-blue] # [Component :red]
|
||||||
;; {:frame-blue} [:name frame-blue] #[Component :blue]
|
;; {:frame-blue} [:name frame-blue] #[Component :blue]
|
||||||
;; {:frame-green} [:name frame-green] #[Component :green]
|
;; {:frame-green} [:name frame-green] #[Component :green]
|
||||||
;; :blue1 [:name frame-blue, :swap-slot-label :red-copy-green] @--> frame-blue
|
;; :blue1 [:name frame-blue, :swap-slot-label :red-copy-green] @--> frame-blue
|
||||||
|
|
||||||
file (-> (cthf/sample-file :file1)
|
file (-> (cthf/sample-file :file1)
|
||||||
(ctho/add-frame :frame-red :name "frame-blue")
|
(ctho/add-frame :frame-red :name "frame-blue")
|
||||||
@ -839,7 +839,7 @@
|
|||||||
(cthc/component-swap :red-copy-green :blue :blue1))
|
(cthc/component-swap :red-copy-green :blue :blue1))
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
green (cths/get-shape file :frame-green)
|
green (cths/get-shape file :frame-green)
|
||||||
features #{"components/v2"}
|
features #{"components/v2"}
|
||||||
@ -862,11 +862,11 @@
|
|||||||
copied-green' (find-copied-shape green' page' uuid/zero)
|
copied-green' (find-copied-shape green' page' uuid/zero)
|
||||||
copied-blue1' (find-copied-shape blue1' page' (:id copied-green'))]
|
copied-blue1' (find-copied-shape blue1' page' (:id copied-green'))]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
;; blue1 has swap-id
|
;; blue1 has swap-id
|
||||||
(t/is (some? (ctk/get-swap-slot blue1')))
|
(t/is (some? (ctk/get-swap-slot blue1')))
|
||||||
|
|
||||||
;; copied-blue1 has not swap-id
|
;; copied-blue1 has not swap-id
|
||||||
(t/is (some? copied-blue1'))
|
(t/is (some? copied-blue1'))
|
||||||
(t/is (nil? (ctk/get-swap-slot copied-blue1')))))))))
|
(t/is (nil? (ctk/get-swap-slot copied-blue1')))))))))
|
||||||
|
|
||||||
|
|||||||
@ -74,7 +74,7 @@
|
|||||||
file (setup-base-file)
|
file (setup-base-file)
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
events
|
events
|
||||||
[(dws/select-shape (cthi/id :frame1))
|
[(dws/select-shape (cthi/id :frame1))
|
||||||
(dwl/add-component)]]
|
(dwl/add-component)]]
|
||||||
@ -87,7 +87,7 @@
|
|||||||
frame1' (cths/get-shape file' :frame1)
|
frame1' (cths/get-shape file' :frame1)
|
||||||
tokens-frame1' (:applied-tokens frame1')]
|
tokens-frame1' (:applied-tokens frame1')]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
(t/is (= (count tokens-frame1') 4))
|
(t/is (= (count tokens-frame1') 4))
|
||||||
(t/is (= (get tokens-frame1' :r1) "test-token-1"))
|
(t/is (= (get tokens-frame1' :r1) "test-token-1"))
|
||||||
(t/is (= (get tokens-frame1' :r2) "test-token-1"))
|
(t/is (= (get tokens-frame1' :r2) "test-token-1"))
|
||||||
@ -105,7 +105,7 @@
|
|||||||
file (setup-file-with-main)
|
file (setup-file-with-main)
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
events
|
events
|
||||||
[(dwl/instantiate-component (:id file)
|
[(dwl/instantiate-component (:id file)
|
||||||
(cthi/id :component1)
|
(cthi/id :component1)
|
||||||
@ -119,7 +119,7 @@
|
|||||||
c-frame1' (dsh/lookup-shape new-state (first selected))
|
c-frame1' (dsh/lookup-shape new-state (first selected))
|
||||||
tokens-frame1' (:applied-tokens c-frame1')]
|
tokens-frame1' (:applied-tokens c-frame1')]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
(t/is (= (count tokens-frame1') 4))
|
(t/is (= (count tokens-frame1') 4))
|
||||||
(t/is (= (get tokens-frame1' :r1) "test-token-1"))
|
(t/is (= (get tokens-frame1' :r1) "test-token-1"))
|
||||||
(t/is (= (get tokens-frame1' :r2) "test-token-1"))
|
(t/is (= (get tokens-frame1' :r2) "test-token-1"))
|
||||||
@ -137,7 +137,7 @@
|
|||||||
file (setup-file-with-copy)
|
file (setup-file-with-copy)
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
events [(dwta/apply-token {:shape-ids [(cthi/id :frame1)]
|
events [(dwta/apply-token {:shape-ids [(cthi/id :frame1)]
|
||||||
:attributes #{:r1 :r2 :r3 :r4}
|
:attributes #{:r1 :r2 :r3 :r4}
|
||||||
:token (toht/get-token file "test-token-2")
|
:token (toht/get-token file "test-token-2")
|
||||||
@ -153,7 +153,7 @@
|
|||||||
c-frame1' (cths/get-shape file' :c-frame1)
|
c-frame1' (cths/get-shape file' :c-frame1)
|
||||||
tokens-frame1' (:applied-tokens c-frame1')]
|
tokens-frame1' (:applied-tokens c-frame1')]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
(t/is (= (count tokens-frame1') 4))
|
(t/is (= (count tokens-frame1') 4))
|
||||||
(t/is (= (get tokens-frame1' :r1) "test-token-2"))
|
(t/is (= (get tokens-frame1' :r1) "test-token-2"))
|
||||||
(t/is (= (get tokens-frame1' :r2) "test-token-2"))
|
(t/is (= (get tokens-frame1' :r2) "test-token-2"))
|
||||||
@ -174,7 +174,7 @@
|
|||||||
file (setup-file-with-copy)
|
file (setup-file-with-copy)
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
events [(dwta/unapply-token {:shape-ids [(cthi/id :frame1)]
|
events [(dwta/unapply-token {:shape-ids [(cthi/id :frame1)]
|
||||||
:attributes #{:r1 :r2 :r3 :r4}
|
:attributes #{:r1 :r2 :r3 :r4}
|
||||||
:token (toht/get-token file "test-token-1")})]
|
:token (toht/get-token file "test-token-1")})]
|
||||||
@ -189,7 +189,7 @@
|
|||||||
c-frame1' (cths/get-shape file' :c-frame1)
|
c-frame1' (cths/get-shape file' :c-frame1)
|
||||||
tokens-frame1' (:applied-tokens c-frame1')]
|
tokens-frame1' (:applied-tokens c-frame1')]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
(t/is (= (count tokens-frame1') 0))
|
(t/is (= (count tokens-frame1') 0))
|
||||||
(t/is (= (get c-frame1' :r1) 25))
|
(t/is (= (get c-frame1' :r1) 25))
|
||||||
(t/is (= (get c-frame1' :r2) 25))
|
(t/is (= (get c-frame1' :r2) 25))
|
||||||
@ -245,7 +245,7 @@
|
|||||||
file (setup-file-with-copy)
|
file (setup-file-with-copy)
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
events [(dwta/apply-token {:shape-ids [(cthi/id :c-frame1)]
|
events [(dwta/apply-token {:shape-ids [(cthi/id :c-frame1)]
|
||||||
:attributes #{:r1 :r2 :r3 :r4}
|
:attributes #{:r1 :r2 :r3 :r4}
|
||||||
:token (toht/get-token file "test-token-2")
|
:token (toht/get-token file "test-token-2")
|
||||||
@ -265,7 +265,7 @@
|
|||||||
c-frame1' (cths/get-shape file' :c-frame1)
|
c-frame1' (cths/get-shape file' :c-frame1)
|
||||||
tokens-frame1' (:applied-tokens c-frame1')]
|
tokens-frame1' (:applied-tokens c-frame1')]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
(t/is (= (count tokens-frame1') 4))
|
(t/is (= (count tokens-frame1') 4))
|
||||||
(t/is (= (get tokens-frame1' :r1) "test-token-2"))
|
(t/is (= (get tokens-frame1' :r1) "test-token-2"))
|
||||||
(t/is (= (get tokens-frame1' :r2) "test-token-2"))
|
(t/is (= (get tokens-frame1' :r2) "test-token-2"))
|
||||||
@ -286,7 +286,7 @@
|
|||||||
file (setup-file-with-copy)
|
file (setup-file-with-copy)
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
events [(dwta/unapply-token {:shape-ids [(cthi/id :c-frame1)]
|
events [(dwta/unapply-token {:shape-ids [(cthi/id :c-frame1)]
|
||||||
:attributes #{:r1 :r2 :r3 :r4}
|
:attributes #{:r1 :r2 :r3 :r4}
|
||||||
:token (toht/get-token file "test-token-1")})
|
:token (toht/get-token file "test-token-1")})
|
||||||
@ -305,7 +305,7 @@
|
|||||||
c-frame1' (cths/get-shape file' :c-frame1)
|
c-frame1' (cths/get-shape file' :c-frame1)
|
||||||
tokens-frame1' (:applied-tokens c-frame1')]
|
tokens-frame1' (:applied-tokens c-frame1')]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
(t/is (= (count tokens-frame1') 0))
|
(t/is (= (count tokens-frame1') 0))
|
||||||
(t/is (= (get c-frame1' :r1) 25))
|
(t/is (= (get c-frame1' :r1) 25))
|
||||||
(t/is (= (get c-frame1' :r2) 25))
|
(t/is (= (get c-frame1' :r2) 25))
|
||||||
@ -369,7 +369,7 @@
|
|||||||
(cthc/instantiate-component :component1 :c-frame1))
|
(cthc/instantiate-component :component1 :c-frame1))
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
events [(dwtl/set-selected-token-set-id (cthi/id :test-token-set))
|
events [(dwtl/set-selected-token-set-id (cthi/id :test-token-set))
|
||||||
(dwtl/update-token (cthi/id :token-radius)
|
(dwtl/update-token (cthi/id :token-radius)
|
||||||
{:name "token-radius"
|
{:name "token-radius"
|
||||||
|
|||||||
@ -162,17 +162,17 @@
|
|||||||
(let [;; ==== Setup
|
(let [;; ==== Setup
|
||||||
file (setup-file)
|
file (setup-file)
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
|
|
||||||
|
|
||||||
;; For each main and first level copy:
|
;; For each main and first level copy:
|
||||||
;; - Duplicate it two times with copy-paste.
|
;; - Duplicate it two times with copy-paste.
|
||||||
events
|
events
|
||||||
(concat
|
(concat
|
||||||
(duplicate-each-main-and-first-level-copy file)
|
(duplicate-each-main-and-first-level-copy file)
|
||||||
;; - Change color of Simple1
|
;; - Change color of Simple1
|
||||||
(set-color-bottom-shape :frame-simple-1 file {:color "#111111"})
|
(set-color-bottom-shape :frame-simple-1 file {:color "#111111"})
|
||||||
;; - Change color of the nearest main and check propagation to duplicated.
|
;; - Change color of the nearest main and check propagation to duplicated.
|
||||||
(set-color-bottom-shape :frame-composed-1 file {:color "#222222"}))]
|
(set-color-bottom-shape :frame-composed-1 file {:color "#222222"}))]
|
||||||
|
|
||||||
(ths/run-store
|
(ths/run-store
|
||||||
@ -188,17 +188,17 @@
|
|||||||
(let [;; ==== Setup
|
(let [;; ==== Setup
|
||||||
file (setup-file)
|
file (setup-file)
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
|
|
||||||
|
|
||||||
;; For each main and first level copy:
|
;; For each main and first level copy:
|
||||||
;; - Duplicate it two times with copy-paste.
|
;; - Duplicate it two times with copy-paste.
|
||||||
events
|
events
|
||||||
(concat
|
(concat
|
||||||
(duplicate-each-main-and-first-level-copy file)
|
(duplicate-each-main-and-first-level-copy file)
|
||||||
;; - Change color of Simple1
|
;; - Change color of Simple1
|
||||||
(set-color-bottom-shape :frame-simple-1 file {:color "#111111"})
|
(set-color-bottom-shape :frame-simple-1 file {:color "#111111"})
|
||||||
;; - Change color of the nearest main and check propagation to duplicated.
|
;; - Change color of the nearest main and check propagation to duplicated.
|
||||||
(set-color-bottom-shape :frame-composed-1 file {:color "#222222"})
|
(set-color-bottom-shape :frame-composed-1 file {:color "#222222"})
|
||||||
(set-color-bottom-shape :frame-composed-2 file {:color "#333333"}))]
|
(set-color-bottom-shape :frame-composed-2 file {:color "#333333"}))]
|
||||||
|
|
||||||
@ -216,17 +216,17 @@
|
|||||||
(let [;; ==== Setup
|
(let [;; ==== Setup
|
||||||
file (setup-file)
|
file (setup-file)
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
|
|
||||||
|
|
||||||
;; For each main and first level copy:
|
;; For each main and first level copy:
|
||||||
;; - Duplicate it two times with copy-paste.
|
;; - Duplicate it two times with copy-paste.
|
||||||
events
|
events
|
||||||
(concat
|
(concat
|
||||||
(duplicate-each-main-and-first-level-copy file)
|
(duplicate-each-main-and-first-level-copy file)
|
||||||
;; - Change color of Simple1
|
;; - Change color of Simple1
|
||||||
(set-color-bottom-shape :frame-simple-1 file {:color "#111111"})
|
(set-color-bottom-shape :frame-simple-1 file {:color "#111111"})
|
||||||
;; - Change color of the nearest main and check propagation to duplicated.
|
;; - Change color of the nearest main and check propagation to duplicated.
|
||||||
(set-color-bottom-shape :frame-composed-1 file {:color "#222222"})
|
(set-color-bottom-shape :frame-composed-1 file {:color "#222222"})
|
||||||
(set-color-bottom-shape :frame-composed-2 file {:color "#333333"})
|
(set-color-bottom-shape :frame-composed-2 file {:color "#333333"})
|
||||||
(set-color-bottom-shape :frame-composed-3 file {:color "#444444"}))]
|
(set-color-bottom-shape :frame-composed-3 file {:color "#444444"}))]
|
||||||
@ -251,14 +251,14 @@
|
|||||||
events
|
events
|
||||||
(concat
|
(concat
|
||||||
(duplicate-simple-nested-in-main-and-group file)
|
(duplicate-simple-nested-in-main-and-group file)
|
||||||
;; - Change color of Simple1
|
;; - Change color of Simple1
|
||||||
(set-color-bottom-shape :frame-simple-1 file {:color "#111111"}))]
|
(set-color-bottom-shape :frame-simple-1 file {:color "#111111"}))]
|
||||||
|
|
||||||
(ths/run-store
|
(ths/run-store
|
||||||
store done events
|
store done events
|
||||||
(fn [new-state]
|
(fn [new-state]
|
||||||
(let [file' (ths/get-file-from-state new-state)]
|
(let [file' (ths/get-file-from-state new-state)]
|
||||||
;; Check propagation to all copies.
|
;; Check propagation to all copies.
|
||||||
(t/is (= (count-shapes file' "rect-simple-1" "#111111") 28)))))))))
|
(t/is (= (count-shapes file' "rect-simple-1" "#111111") 28)))))))))
|
||||||
|
|
||||||
(t/deftest copy-nested-in-main-2
|
(t/deftest copy-nested-in-main-2
|
||||||
@ -275,14 +275,14 @@
|
|||||||
events
|
events
|
||||||
(concat
|
(concat
|
||||||
(duplicate-simple-nested-in-main-and-group file)
|
(duplicate-simple-nested-in-main-and-group file)
|
||||||
;; - Change color of the nearest main
|
;; - Change color of the nearest main
|
||||||
(set-color-bottom-shape :frame-composed-1 file {:color "#222222"}))]
|
(set-color-bottom-shape :frame-composed-1 file {:color "#222222"}))]
|
||||||
|
|
||||||
(ths/run-store
|
(ths/run-store
|
||||||
store done events
|
store done events
|
||||||
(fn [new-state]
|
(fn [new-state]
|
||||||
(let [file' (ths/get-file-from-state new-state)]
|
(let [file' (ths/get-file-from-state new-state)]
|
||||||
;; Check propagation to duplicated.
|
;; Check propagation to duplicated.
|
||||||
(t/is (= (count-shapes file' "rect-simple-1" "#222222") 9)))))))))
|
(t/is (= (count-shapes file' "rect-simple-1" "#222222") 9)))))))))
|
||||||
|
|
||||||
(t/deftest copy-nested-in-main-3
|
(t/deftest copy-nested-in-main-3
|
||||||
@ -299,14 +299,14 @@
|
|||||||
events
|
events
|
||||||
(concat
|
(concat
|
||||||
(duplicate-simple-nested-in-main-and-group file)
|
(duplicate-simple-nested-in-main-and-group file)
|
||||||
;; - Change color of the copy you duplicated from.
|
;; - Change color of the copy you duplicated from.
|
||||||
(set-color-bottom-shape :group-3 file {:color "#333333"}))]
|
(set-color-bottom-shape :group-3 file {:color "#333333"}))]
|
||||||
|
|
||||||
(ths/run-store
|
(ths/run-store
|
||||||
store done events
|
store done events
|
||||||
(fn [new-state]
|
(fn [new-state]
|
||||||
(let [file' (ths/get-file-from-state new-state)]
|
(let [file' (ths/get-file-from-state new-state)]
|
||||||
;; Check that it's NOT PROPAGATED.
|
;; Check that it's NOT PROPAGATED.
|
||||||
(t/is (= (count-shapes file' "rect-simple-1" "#333333") 2)))))))))
|
(t/is (= (count-shapes file' "rect-simple-1" "#333333") 2)))))))))
|
||||||
|
|
||||||
(t/deftest copy-nested-1
|
(t/deftest copy-nested-1
|
||||||
@ -324,14 +324,14 @@
|
|||||||
events
|
events
|
||||||
(concat
|
(concat
|
||||||
(duplicate-copy-nested-and-group-out-of-the-main file)
|
(duplicate-copy-nested-and-group-out-of-the-main file)
|
||||||
;; - Change color of Simple1
|
;; - Change color of Simple1
|
||||||
(set-color-bottom-shape :frame-simple-1 file {:color "#111111"}))]
|
(set-color-bottom-shape :frame-simple-1 file {:color "#111111"}))]
|
||||||
|
|
||||||
(ths/run-store
|
(ths/run-store
|
||||||
store done events
|
store done events
|
||||||
(fn [new-state]
|
(fn [new-state]
|
||||||
(let [file' (ths/get-file-from-state new-state)]
|
(let [file' (ths/get-file-from-state new-state)]
|
||||||
;; Check propagation to all copies.
|
;; Check propagation to all copies.
|
||||||
(t/is (= (count-shapes file' "rect-simple-1" "#111111") 20)))))))))
|
(t/is (= (count-shapes file' "rect-simple-1" "#111111") 20)))))))))
|
||||||
|
|
||||||
|
|
||||||
@ -350,9 +350,9 @@
|
|||||||
events
|
events
|
||||||
(concat
|
(concat
|
||||||
(duplicate-copy-nested-and-group-out-of-the-main file)
|
(duplicate-copy-nested-and-group-out-of-the-main file)
|
||||||
;; - Change color of Simple1
|
;; - Change color of Simple1
|
||||||
(set-color-bottom-shape :frame-simple-1 file {:color "#111111"})
|
(set-color-bottom-shape :frame-simple-1 file {:color "#111111"})
|
||||||
;; - Change color of the previous main
|
;; - Change color of the previous main
|
||||||
(set-color-bottom-shape :frame-composed-1 file {:color "#222222"})
|
(set-color-bottom-shape :frame-composed-1 file {:color "#222222"})
|
||||||
(set-color-bottom-shape :group-3 file {:color "#333333"}))]
|
(set-color-bottom-shape :group-3 file {:color "#333333"}))]
|
||||||
|
|
||||||
@ -360,7 +360,7 @@
|
|||||||
store done events
|
store done events
|
||||||
(fn [new-state]
|
(fn [new-state]
|
||||||
(let [file' (ths/get-file-from-state new-state)]
|
(let [file' (ths/get-file-from-state new-state)]
|
||||||
;; Check that it's NOT PROPAGATED.
|
;; Check that it's NOT PROPAGATED.
|
||||||
(t/is (= (count-shapes file' "rect-simple-1" "#111111") 11))
|
(t/is (= (count-shapes file' "rect-simple-1" "#111111") 11))
|
||||||
(t/is (= (count-shapes file' "rect-simple-1" "#222222") 7))
|
(t/is (= (count-shapes file' "rect-simple-1" "#222222") 7))
|
||||||
(t/is (= (count-shapes file' "rect-simple-1" "#333333") 2)))))))))
|
(t/is (= (count-shapes file' "rect-simple-1" "#333333") 2)))))))))
|
||||||
@ -380,9 +380,9 @@
|
|||||||
events
|
events
|
||||||
(concat
|
(concat
|
||||||
(duplicate-copy-nested-and-group-out-of-the-main file :target-page-label :page-2)
|
(duplicate-copy-nested-and-group-out-of-the-main file :target-page-label :page-2)
|
||||||
;; - Change color of Simple1
|
;; - Change color of Simple1
|
||||||
(set-color-bottom-shape :frame-simple-1 file {:color "#111111"})
|
(set-color-bottom-shape :frame-simple-1 file {:color "#111111"})
|
||||||
;; - Change color of the previous main
|
;; - Change color of the previous main
|
||||||
(set-color-bottom-shape :frame-composed-1 file {:color "#222222"})
|
(set-color-bottom-shape :frame-composed-1 file {:color "#222222"})
|
||||||
(set-color-bottom-shape :group-3 file {:color "#333333"}))]
|
(set-color-bottom-shape :group-3 file {:color "#333333"}))]
|
||||||
|
|
||||||
@ -391,7 +391,7 @@
|
|||||||
(fn [new-state]
|
(fn [new-state]
|
||||||
(let [file' (-> (ths/get-file-from-state new-state)
|
(let [file' (-> (ths/get-file-from-state new-state)
|
||||||
(cthf/switch-to-page :page-2))]
|
(cthf/switch-to-page :page-2))]
|
||||||
;; Check that it's NOT PROPAGATED.
|
;; Check that it's NOT PROPAGATED.
|
||||||
(t/is (= (count-shapes file' "rect-simple-1" "#111111") 10))
|
(t/is (= (count-shapes file' "rect-simple-1" "#111111") 10))
|
||||||
(t/is (= (count-shapes file' "rect-simple-1" "#222222") 4))
|
(t/is (= (count-shapes file' "rect-simple-1" "#222222") 4))
|
||||||
(t/is (= (count-shapes file' "rect-simple-1" "#333333") 0)))))))))
|
(t/is (= (count-shapes file' "rect-simple-1" "#333333") 0)))))))))
|
||||||
|
|||||||
@ -33,7 +33,7 @@
|
|||||||
:id (uuid/next)
|
:id (uuid/next)
|
||||||
:position 0}
|
:position 0}
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
events
|
events
|
||||||
[(dw/update-guides guide)
|
[(dw/update-guides guide)
|
||||||
(dw/update-position (:id frame1) {:x 100})]]
|
(dw/update-position (:id frame1) {:x 100})]]
|
||||||
|
|||||||
@ -76,7 +76,7 @@
|
|||||||
(ctho/add-frame :frame-blue {:name "frame-blue"}))
|
(ctho/add-frame :frame-blue {:name "frame-blue"}))
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
frame-red (cths/get-shape file :frame-red)
|
frame-red (cths/get-shape file :frame-red)
|
||||||
frame-blue (cths/get-shape file :frame-blue)
|
frame-blue (cths/get-shape file :frame-blue)
|
||||||
@ -99,7 +99,7 @@
|
|||||||
frame-blue' (cths/get-shape file' :frame-blue)
|
frame-blue' (cths/get-shape file' :frame-blue)
|
||||||
copied-blue1' (find-copied-shape frame-blue' page' (:id frame-red'))]
|
copied-blue1' (find-copied-shape frame-blue' page' (:id frame-red'))]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
(t/is (= (:parent-id copied-blue1') (:id frame-red')))))))))
|
(t/is (= (:parent-id copied-blue1') (:id frame-red')))))))))
|
||||||
|
|
||||||
(t/deftest copy-shape-to-component
|
(t/deftest copy-shape-to-component
|
||||||
@ -113,7 +113,7 @@
|
|||||||
(ctho/add-frame :frame-blue {:name "frame-blue"}))
|
(ctho/add-frame :frame-blue {:name "frame-blue"}))
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
frame-red (cths/get-shape file :frame-red)
|
frame-red (cths/get-shape file :frame-red)
|
||||||
frame-blue (cths/get-shape file :frame-blue)
|
frame-blue (cths/get-shape file :frame-blue)
|
||||||
@ -136,7 +136,7 @@
|
|||||||
frame-blue' (cths/get-shape file' :frame-blue)
|
frame-blue' (cths/get-shape file' :frame-blue)
|
||||||
copied-blue1' (find-copied-shape frame-blue' page' (:id frame-red'))]
|
copied-blue1' (find-copied-shape frame-blue' page' (:id frame-red'))]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
(t/is (= (:parent-id copied-blue1') (:id frame-red')))))))))
|
(t/is (= (:parent-id copied-blue1') (:id frame-red')))))))))
|
||||||
|
|
||||||
(t/deftest copy-component-to-frame
|
(t/deftest copy-component-to-frame
|
||||||
@ -150,7 +150,7 @@
|
|||||||
(cthc/make-component :blue :frame-blue))
|
(cthc/make-component :blue :frame-blue))
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
frame-red (cths/get-shape file :frame-red)
|
frame-red (cths/get-shape file :frame-red)
|
||||||
frame-blue (cths/get-shape file :frame-blue)
|
frame-blue (cths/get-shape file :frame-blue)
|
||||||
@ -173,7 +173,7 @@
|
|||||||
frame-blue' (cths/get-shape file' :frame-blue)
|
frame-blue' (cths/get-shape file' :frame-blue)
|
||||||
copied-blue1' (find-copied-shape frame-blue' page' (:id frame-red'))]
|
copied-blue1' (find-copied-shape frame-blue' page' (:id frame-red'))]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
(t/is (= (:parent-id copied-blue1') (:id frame-red')))))))))
|
(t/is (= (:parent-id copied-blue1') (:id frame-red')))))))))
|
||||||
|
|
||||||
(t/deftest copy-component-to-component
|
(t/deftest copy-component-to-component
|
||||||
@ -188,7 +188,7 @@
|
|||||||
(cthc/make-component :blue :frame-blue))
|
(cthc/make-component :blue :frame-blue))
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
frame-red (cths/get-shape file :frame-red)
|
frame-red (cths/get-shape file :frame-red)
|
||||||
frame-blue (cths/get-shape file :frame-blue)
|
frame-blue (cths/get-shape file :frame-blue)
|
||||||
@ -211,7 +211,7 @@
|
|||||||
frame-blue' (cths/get-shape file' :frame-blue)
|
frame-blue' (cths/get-shape file' :frame-blue)
|
||||||
copied-blue1' (find-copied-shape frame-blue' page' (:id frame-red'))]
|
copied-blue1' (find-copied-shape frame-blue' page' (:id frame-red'))]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
(t/is (not (ctk/main-instance? copied-blue1')))
|
(t/is (not (ctk/main-instance? copied-blue1')))
|
||||||
(t/is (= (:parent-id copied-blue1') (:id frame-red')))))))))
|
(t/is (= (:parent-id copied-blue1') (:id frame-red')))))))))
|
||||||
|
|
||||||
@ -228,7 +228,7 @@
|
|||||||
(cthc/make-component :blue :frame-blue))
|
(cthc/make-component :blue :frame-blue))
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
frame-red (cths/get-shape file :frame-red)
|
frame-red (cths/get-shape file :frame-red)
|
||||||
frame-blue (cths/get-shape file :frame-blue)
|
frame-blue (cths/get-shape file :frame-blue)
|
||||||
@ -254,7 +254,7 @@
|
|||||||
copied-blue1' (find-copied-shape frame-blue' page' (:id frame-red'))
|
copied-blue1' (find-copied-shape frame-blue' page' (:id frame-red'))
|
||||||
copied-blue2' (find-copied-shape frame-blue' page' uuid/zero true)]
|
copied-blue2' (find-copied-shape frame-blue' page' uuid/zero true)]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
(t/is (nil? copied-blue1'))
|
(t/is (nil? copied-blue1'))
|
||||||
(t/is (ctk/main-instance? copied-blue2'))
|
(t/is (ctk/main-instance? copied-blue2'))
|
||||||
(t/is (= (:parent-id copied-blue2') uuid/zero))))))))
|
(t/is (= (:parent-id copied-blue2') uuid/zero))))))))
|
||||||
@ -272,7 +272,7 @@
|
|||||||
|
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
root (cths/get-shape-by-id file uuid/zero)
|
root (cths/get-shape-by-id file uuid/zero)
|
||||||
frame-red (cths/get-shape file :frame-red)
|
frame-red (cths/get-shape file :frame-red)
|
||||||
@ -297,13 +297,13 @@
|
|||||||
root-children' (->> (:shapes root')
|
root-children' (->> (:shapes root')
|
||||||
(map #(cths/get-shape-by-id file' %)))]
|
(map #(cths/get-shape-by-id file' %)))]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
;; The main shape of the component have no children
|
;; The main shape of the component have no children
|
||||||
(t/is (= 0 (count (:shapes frame-red'))))
|
(t/is (= 0 (count (:shapes frame-red'))))
|
||||||
;; Root had two children, now have 3
|
;; Root had two children, now have 3
|
||||||
(t/is (= 2 (count (:shapes root))))
|
(t/is (= 2 (count (:shapes root))))
|
||||||
(t/is (= 3 (count (:shapes root'))))
|
(t/is (= 3 (count (:shapes root'))))
|
||||||
;; Two of the children of root are variant-containers
|
;; Two of the children of root are variant-containers
|
||||||
(t/is (= 2 (count (filter ctk/is-variant-container? root-children'))))))))))
|
(t/is (= 2 (count (filter ctk/is-variant-container? root-children'))))))))))
|
||||||
|
|
||||||
(t/deftest cut-paste-variant-container-into-component
|
(t/deftest cut-paste-variant-container-into-component
|
||||||
@ -319,7 +319,7 @@
|
|||||||
|
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
root (cths/get-shape-by-id file uuid/zero)
|
root (cths/get-shape-by-id file uuid/zero)
|
||||||
frame-red (cths/get-shape file :frame-red)
|
frame-red (cths/get-shape file :frame-red)
|
||||||
@ -346,13 +346,13 @@
|
|||||||
root-children' (->> (:shapes root')
|
root-children' (->> (:shapes root')
|
||||||
(map #(cths/get-shape-by-id file' %)))]
|
(map #(cths/get-shape-by-id file' %)))]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
;; The main shape of the component have no children
|
;; The main shape of the component have no children
|
||||||
(t/is (= 0 (count (:shapes frame-red'))))
|
(t/is (= 0 (count (:shapes frame-red'))))
|
||||||
;; Root had two children, now it still have two (because we have cutted one of them, and then created a new one)
|
;; Root had two children, now it still have two (because we have cutted one of them, and then created a new one)
|
||||||
(t/is (= 2 (count (:shapes root))))
|
(t/is (= 2 (count (:shapes root))))
|
||||||
(t/is (= 2 (count (:shapes root'))))
|
(t/is (= 2 (count (:shapes root'))))
|
||||||
;; One of the children of root is a variant-container
|
;; One of the children of root is a variant-container
|
||||||
(t/is (= 1 (count (filter ctk/is-variant-container? root-children'))))))))))
|
(t/is (= 1 (count (filter ctk/is-variant-container? root-children'))))))))))
|
||||||
|
|
||||||
(t/deftest copy-variant-into-different-variant-container
|
(t/deftest copy-variant-into-different-variant-container
|
||||||
@ -366,7 +366,7 @@
|
|||||||
|
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
m01 (cths/get-shape file :m01)
|
m01 (cths/get-shape file :m01)
|
||||||
v02 (cths/get-shape file :v02)
|
v02 (cths/get-shape file :v02)
|
||||||
@ -389,12 +389,12 @@
|
|||||||
v02' (cths/get-shape file' :v02)
|
v02' (cths/get-shape file' :v02)
|
||||||
components' (cthc/get-components file')]
|
components' (cthc/get-components file')]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
;; v02 had two children, now it have 3
|
;; v02 had two children, now it have 3
|
||||||
(t/is (= 2 (count (:shapes v02))))
|
(t/is (= 2 (count (:shapes v02))))
|
||||||
(t/is (= 3 (count (:shapes v02'))))
|
(t/is (= 3 (count (:shapes v02'))))
|
||||||
|
|
||||||
;;There was 4 components, now there are 5
|
;;There was 4 components, now there are 5
|
||||||
(t/is (= 4 (count components)))
|
(t/is (= 4 (count components)))
|
||||||
(t/is (= 5 (count components')))))))))
|
(t/is (= 5 (count components')))))))))
|
||||||
|
|
||||||
@ -409,7 +409,7 @@
|
|||||||
|
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
m01 (cths/get-shape file :m01)
|
m01 (cths/get-shape file :m01)
|
||||||
v02 (cths/get-shape file :v02)
|
v02 (cths/get-shape file :v02)
|
||||||
@ -434,16 +434,16 @@
|
|||||||
m03' (cths/get-shape file' :m03)
|
m03' (cths/get-shape file' :m03)
|
||||||
components' (cthc/get-components file')]
|
components' (cthc/get-components file')]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
;; v02 had two children, now it have still 2
|
;; v02 had two children, now it have still 2
|
||||||
(t/is (= 2 (count (:shapes v02))))
|
(t/is (= 2 (count (:shapes v02))))
|
||||||
(t/is (= 2 (count (:shapes v02'))))
|
(t/is (= 2 (count (:shapes v02'))))
|
||||||
|
|
||||||
;; m03 had no children, now it have 1
|
;; m03 had no children, now it have 1
|
||||||
(t/is (= 0 (count (:shapes m03))))
|
(t/is (= 0 (count (:shapes m03))))
|
||||||
(t/is (= 1 (count (:shapes m03'))))
|
(t/is (= 1 (count (:shapes m03'))))
|
||||||
|
|
||||||
;;There was 4 components, now there is still 4
|
;;There was 4 components, now there is still 4
|
||||||
(t/is (= 4 (count components)))
|
(t/is (= 4 (count components)))
|
||||||
(t/is (= 4 (count components')))))))))
|
(t/is (= 4 (count components')))))))))
|
||||||
|
|
||||||
@ -457,7 +457,7 @@
|
|||||||
|
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
m01 (cths/get-shape file :m01)
|
m01 (cths/get-shape file :m01)
|
||||||
v01 (cths/get-shape file :v01)
|
v01 (cths/get-shape file :v01)
|
||||||
@ -480,12 +480,12 @@
|
|||||||
v01' (cths/get-shape file' :v01)
|
v01' (cths/get-shape file' :v01)
|
||||||
components' (cthc/get-components file')]
|
components' (cthc/get-components file')]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
;; v01 had two children, now it have 3
|
;; v01 had two children, now it have 3
|
||||||
(t/is (= 2 (count (:shapes v01))))
|
(t/is (= 2 (count (:shapes v01))))
|
||||||
(t/is (= 3 (count (:shapes v01'))))
|
(t/is (= 3 (count (:shapes v01'))))
|
||||||
|
|
||||||
;;There was 2 components, now there are 3
|
;;There was 2 components, now there are 3
|
||||||
(t/is (= 2 (count components)))
|
(t/is (= 2 (count components)))
|
||||||
(t/is (= 3 (count components')))))))))
|
(t/is (= 3 (count components')))))))))
|
||||||
|
|
||||||
@ -499,7 +499,7 @@
|
|||||||
|
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
m01 (cths/get-shape file :m01)
|
m01 (cths/get-shape file :m01)
|
||||||
v01 (cths/get-shape file :v01)
|
v01 (cths/get-shape file :v01)
|
||||||
@ -522,12 +522,12 @@
|
|||||||
v01' (cths/get-shape file' :v01)
|
v01' (cths/get-shape file' :v01)
|
||||||
components' (cthc/get-components file')]
|
components' (cthc/get-components file')]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
;; v01 had two children, now it have 3
|
;; v01 had two children, now it have 3
|
||||||
(t/is (= 2 (count (:shapes v01))))
|
(t/is (= 2 (count (:shapes v01))))
|
||||||
(t/is (= 3 (count (:shapes v01'))))
|
(t/is (= 3 (count (:shapes v01'))))
|
||||||
|
|
||||||
;;There was 2 components, now there are 3
|
;;There was 2 components, now there are 3
|
||||||
(t/is (= 2 (count components)))
|
(t/is (= 2 (count components)))
|
||||||
(t/is (= 3 (count components')))))))))
|
(t/is (= 3 (count components')))))))))
|
||||||
|
|
||||||
@ -541,7 +541,7 @@
|
|||||||
|
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
m01 (cths/get-shape file :m01)
|
m01 (cths/get-shape file :m01)
|
||||||
m02 (cths/get-shape file :m02)
|
m02 (cths/get-shape file :m02)
|
||||||
@ -565,12 +565,12 @@
|
|||||||
v01' (cths/get-shape file' :v01)
|
v01' (cths/get-shape file' :v01)
|
||||||
components' (cthc/get-components file')]
|
components' (cthc/get-components file')]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
;; v01 had two children, now it have 3
|
;; v01 had two children, now it have 3
|
||||||
(t/is (= 2 (count (:shapes v01))))
|
(t/is (= 2 (count (:shapes v01))))
|
||||||
(t/is (= 3 (count (:shapes v01'))))
|
(t/is (= 3 (count (:shapes v01'))))
|
||||||
|
|
||||||
;;There was 2 components, now there are 3
|
;;There was 2 components, now there are 3
|
||||||
(t/is (= 2 (count components)))
|
(t/is (= 2 (count components)))
|
||||||
(t/is (= 3 (count components')))))))))
|
(t/is (= 3 (count components')))))))))
|
||||||
|
|
||||||
@ -586,7 +586,7 @@
|
|||||||
|
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
frame-red (cths/get-shape file :frame-red)
|
frame-red (cths/get-shape file :frame-red)
|
||||||
v01 (cths/get-shape file :v01)
|
v01 (cths/get-shape file :v01)
|
||||||
@ -609,12 +609,12 @@
|
|||||||
v01' (cths/get-shape file' :v01)
|
v01' (cths/get-shape file' :v01)
|
||||||
components' (cthc/get-components file')]
|
components' (cthc/get-components file')]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
;; v01 had two children, now it have 3
|
;; v01 had two children, now it have 3
|
||||||
(t/is (= 2 (count (:shapes v01))))
|
(t/is (= 2 (count (:shapes v01))))
|
||||||
(t/is (= 3 (count (:shapes v01'))))
|
(t/is (= 3 (count (:shapes v01'))))
|
||||||
|
|
||||||
;;There was 3 components, now there are 4
|
;;There was 3 components, now there are 4
|
||||||
(t/is (= 3 (count components)))
|
(t/is (= 3 (count components)))
|
||||||
(t/is (= 4 (count components')))))))))
|
(t/is (= 4 (count components')))))))))
|
||||||
|
|
||||||
@ -630,7 +630,7 @@
|
|||||||
|
|
||||||
store (ths/setup-store file)
|
store (ths/setup-store file)
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
page (cthf/current-page file)
|
page (cthf/current-page file)
|
||||||
frame-red (cths/get-shape file :frame-red)
|
frame-red (cths/get-shape file :frame-red)
|
||||||
v01 (cths/get-shape file :v01)
|
v01 (cths/get-shape file :v01)
|
||||||
@ -655,15 +655,15 @@
|
|||||||
m01' (cths/get-shape file' :m01)
|
m01' (cths/get-shape file' :m01)
|
||||||
components' (cthc/get-components file')]
|
components' (cthc/get-components file')]
|
||||||
|
|
||||||
;; ==== Check
|
;; ==== Check
|
||||||
;; v01 had two children, now it have still 2
|
;; v01 had two children, now it have still 2
|
||||||
(t/is (= 2 (count (:shapes v01))))
|
(t/is (= 2 (count (:shapes v01))))
|
||||||
(t/is (= 2 (count (:shapes v01'))))
|
(t/is (= 2 (count (:shapes v01'))))
|
||||||
|
|
||||||
;; m01 had no children, now it have 1
|
;; m01 had no children, now it have 1
|
||||||
(t/is (= 0 (count (:shapes m01))))
|
(t/is (= 0 (count (:shapes m01))))
|
||||||
(t/is (= 1 (count (:shapes m01'))))
|
(t/is (= 1 (count (:shapes m01'))))
|
||||||
|
|
||||||
;;There was 3 components, now there are still 3
|
;;There was 3 components, now there are still 3
|
||||||
(t/is (= 3 (count components)))
|
(t/is (= 3 (count components)))
|
||||||
(t/is (= 3 (count components')))))))))
|
(t/is (= 3 (count components')))))))))
|
||||||
@ -118,9 +118,9 @@
|
|||||||
:token (toht/get-token file "borderRadius.sm")
|
:token (toht/get-token file "borderRadius.sm")
|
||||||
:shape-ids [(:id rect-1)]
|
:shape-ids [(:id rect-1)]
|
||||||
:on-update-shape dwta/update-shape-radius-all})
|
:on-update-shape dwta/update-shape-radius-all})
|
||||||
;; Apply single `:r1` attribute to same shape
|
;; Apply single `:r1` attribute to same shape
|
||||||
;; while removing other attributes from the border-radius set
|
;; while removing other attributes from the border-radius set
|
||||||
;; but keep `:r4` for testing purposes
|
;; but keep `:r4` for testing purposes
|
||||||
(dwta/apply-token {:attributes #{:r1 :r2 :r3}
|
(dwta/apply-token {:attributes #{:r1 :r2 :r3}
|
||||||
:token (toht/get-token file "borderRadius.md")
|
:token (toht/get-token file "borderRadius.md")
|
||||||
:shape-ids [(:id rect-1)]
|
:shape-ids [(:id rect-1)]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user