mirror of https://github.com/penpot/penpot.git
🎉 Activate variants for everyone
This commit is contained in:
parent
9f24e76c27
commit
307e06372b
|
|
@ -36,11 +36,6 @@
|
|||
"fdata/shape-data-type"
|
||||
nil
|
||||
|
||||
;; There is no migration needed, but we don't want to allow
|
||||
;; copy paste nor import of variant files into no-variant teams
|
||||
"variants/v1"
|
||||
nil
|
||||
|
||||
(ex/raise :type :internal
|
||||
:code :no-migration-defined
|
||||
:hint (str/ffmt "no migation for feature '%' on file importation" feature)
|
||||
|
|
|
|||
|
|
@ -64,7 +64,8 @@
|
|||
"layout/grid"
|
||||
"components/v2"
|
||||
"plugins/runtime"
|
||||
"design-tokens/v1"})
|
||||
"design-tokens/v1"
|
||||
"variants/v1"})
|
||||
|
||||
;; A set of features that should not be propagated to team on creating
|
||||
;; or modifying a file
|
||||
|
|
@ -95,7 +96,8 @@
|
|||
(-> #{"layout/grid"
|
||||
"design-tokens/v1"
|
||||
"fdata/shape-data-type"
|
||||
"fdata/path-data"}
|
||||
"fdata/path-data"
|
||||
"variants/v1"}
|
||||
(into frontend-only-features)
|
||||
(into backend-only-features)))
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
[app.main.data.workspace.shapes :as dwsh]
|
||||
[app.main.data.workspace.transforms :as dwt]
|
||||
[app.main.data.workspace.undo :as dwu]
|
||||
[app.main.features :as features]
|
||||
[app.util.dom :as dom]
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
|
@ -446,19 +445,16 @@
|
|||
|
||||
ptk/WatchEvent
|
||||
(watch [_ state _]
|
||||
(let [variants? (features/active-feature? state "variants/v1")
|
||||
objects (dsh/lookup-page-objects state)
|
||||
(let [objects (dsh/lookup-page-objects state)
|
||||
selected-ids (dsh/lookup-selected state)
|
||||
selected-shapes (map (d/getf objects) selected-ids)
|
||||
single? (= 1 (count selected-ids))
|
||||
first-shape (first selected-shapes)
|
||||
|
||||
transform-in-variant? (and variants?
|
||||
single?
|
||||
transform-in-variant? (and single?
|
||||
(not (ctc/is-variant? first-shape))
|
||||
(ctc/main-instance? first-shape))
|
||||
add-new-variant? (and variants?
|
||||
(every? ctc/is-variant? selected-shapes))
|
||||
add-new-variant? (every? ctc/is-variant? selected-shapes)
|
||||
undo-id (js/Symbol)]
|
||||
(cond
|
||||
transform-in-variant?
|
||||
|
|
@ -479,12 +475,10 @@
|
|||
(ptk/reify ::duplicate-or-add-variant
|
||||
ptk/WatchEvent
|
||||
(watch [_ state _]
|
||||
(let [variants? (features/active-feature? state "variants/v1")
|
||||
objects (dsh/lookup-page-objects state)
|
||||
(let [objects (dsh/lookup-page-objects state)
|
||||
selected-ids (dsh/lookup-selected state)
|
||||
selected-shapes (map (d/getf objects) selected-ids)
|
||||
add-new-variant? (and variants?
|
||||
(every? ctc/is-variant? selected-shapes))
|
||||
add-new-variant? (every? ctc/is-variant? selected-shapes)
|
||||
undo-id (js/Symbol)]
|
||||
(if add-new-variant?
|
||||
(rx/concat
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
[app.main.data.workspace.libraries :as dwl]
|
||||
[app.main.data.workspace.undo :as dwu]
|
||||
[app.main.data.workspace.variants :as dwv]
|
||||
[app.main.features :as features]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.render :refer [component-svg component-svg-thumbnail]]
|
||||
[app.main.store :as st]
|
||||
|
|
@ -382,8 +381,6 @@
|
|||
can-detach? (and (seq copies)
|
||||
(every? #(not (ctn/has-any-copy-parent? objects %)) copies))
|
||||
|
||||
variants? (features/use-feature "variants/v1")
|
||||
|
||||
same-variant? (ctv/same-variant? shapes)
|
||||
|
||||
is-restorable-variant?
|
||||
|
|
@ -401,8 +398,7 @@
|
|||
parent (get objects (:parent-id main))]
|
||||
(and (:deleted component) (ctk/is-variant? component) parent)))
|
||||
|
||||
restorable-variants? (and variants?
|
||||
(every? is-restorable-variant? restorable-copies))
|
||||
restorable-variants? (every? is-restorable-variant? restorable-copies)
|
||||
|
||||
do-detach-component
|
||||
#(st/emit! (dwl/detach-components (map :id copies)))
|
||||
|
|
@ -437,10 +433,9 @@
|
|||
#(st/emit! (dw/set-annotations-id-for-create id))
|
||||
|
||||
do-add-variant
|
||||
#(when variants?
|
||||
(if (ctk/is-variant? shape)
|
||||
(st/emit! (dwv/add-new-variant id))
|
||||
(st/emit! (dwv/transform-in-variant id))))
|
||||
#(if (ctk/is-variant? shape)
|
||||
(st/emit! (dwv/add-new-variant id))
|
||||
(st/emit! (dwv/transform-in-variant id)))
|
||||
|
||||
do-add-new-property
|
||||
#(st/emit! (dwv/add-new-property variant-id {:property-value "Value 1"
|
||||
|
|
@ -501,11 +496,11 @@
|
|||
(when can-update-main?
|
||||
{:title (tr "workspace.shape.menu.update-main")
|
||||
:action do-update-component})
|
||||
(when (and variants? (or (not multi) same-variant?) main-instance?)
|
||||
(when (and (or (not multi) same-variant?) main-instance?)
|
||||
{:title (tr "workspace.shape.menu.add-variant")
|
||||
:shortcut :create-component
|
||||
:action do-add-variant})
|
||||
(when (and variants? same-variant? main-instance? variant-id)
|
||||
(when (and same-variant? main-instance? variant-id)
|
||||
{:title (tr "workspace.shape.menu.add-variant-property")
|
||||
:action do-add-new-property})]]
|
||||
(filter (complement nil?) menu-entries)))
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
[app.common.uuid :as uuid]
|
||||
[app.main.data.workspace :as dw]
|
||||
[app.main.data.workspace.collapse :as dwc]
|
||||
[app.main.features :as features]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.store :as st]
|
||||
[app.main.ui.context :as ctx]
|
||||
|
|
@ -53,10 +52,8 @@
|
|||
parent-board? (and (cfh/frame-shape? item)
|
||||
(= uuid/zero (:parent-id item)))
|
||||
absolute? (ctl/item-absolute? item)
|
||||
|
||||
variants? (features/use-feature "variants/v1")
|
||||
is-variant? (when variants? (ctk/is-variant? item))
|
||||
is-variant-container? (when variants? (ctk/is-variant-container? item))
|
||||
is-variant? (ctk/is-variant? item)
|
||||
is-variant-container? (ctk/is-variant-container? item)
|
||||
variant-id (when is-variant? (:variant-id item))
|
||||
variant-name (when is-variant? (:variant-name item))
|
||||
variant-error (when is-variant? (:variant-error item))
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
[app.main.data.workspace.libraries :as dwl]
|
||||
[app.main.data.workspace.specialized-panel :as dwsp]
|
||||
[app.main.data.workspace.variants :as dwv]
|
||||
[app.main.features :as features]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.store :as st]
|
||||
[app.main.ui.components.dropdown :refer [dropdown]]
|
||||
|
|
@ -833,8 +832,7 @@
|
|||
libraries
|
||||
{:include-deleted? true})
|
||||
data (dm/get-in libraries [(:component-file shape) :data])
|
||||
variants? (features/use-feature "variants/v1")
|
||||
is-variant? (when variants? (ctk/is-variant? component))
|
||||
is-variant? (ctk/is-variant? component)
|
||||
|
||||
main-instance? (ctk/main-instance? shape)
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
[app.common.data.macros :as dm]
|
||||
[app.common.types.component :as ctk]
|
||||
[app.common.types.shape.layout :as ctl]
|
||||
[app.main.features :as features]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.ui.workspace.sidebar.options.menus.blur :refer [blur-menu]]
|
||||
[app.main.ui.workspace.sidebar.options.menus.color-selection :refer [color-selection-menu*]]
|
||||
|
|
@ -92,11 +91,8 @@
|
|||
is-layout-child-absolute?
|
||||
(ctl/item-absolute? shape)
|
||||
|
||||
variants?
|
||||
(features/use-feature "variants/v1")
|
||||
|
||||
is-variant?
|
||||
(when variants? (ctk/is-variant-container? shape))]
|
||||
(ctk/is-variant-container? shape)]
|
||||
|
||||
[:*
|
||||
[:> layer-menu* {:ids ids
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
[app.main.data.common :as dcm]
|
||||
[app.main.data.workspace :as dw]
|
||||
[app.main.data.workspace.interactions :as dwi]
|
||||
[app.main.features :as features]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.store :as st]
|
||||
[app.main.streams :as ms]
|
||||
|
|
@ -132,8 +131,7 @@
|
|||
(on-frame-leave (:id frame))))
|
||||
|
||||
main-instance? (ctk/main-instance? frame)
|
||||
variants? (features/use-feature "variants/v1")
|
||||
is-variant? (when variants? (:is-variant-container frame))
|
||||
is-variant? (:is-variant-container frame)
|
||||
|
||||
text-width (* (:width frame) zoom)
|
||||
show-icon? (and (or (:use-for-thumbnail frame) grid-edition? main-instance? is-variant?)
|
||||
|
|
|
|||
Loading…
Reference in New Issue