mirror of
https://github.com/penpot/penpot.git
synced 2025-07-31 15:38:29 +02:00
commit
89c14b25ab
62 changed files with 1043 additions and 797 deletions
|
@ -831,9 +831,15 @@
|
|||
(ptk/reify ::set-file-thumbnail
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
(-> state
|
||||
(d/update-in-when [:dashboard-files file-id] assoc :thumbnail-uri thumbnail-uri)
|
||||
(d/update-in-when [:dashboard-recent-files file-id] assoc :thumbnail-uri thumbnail-uri)))))
|
||||
(letfn [(update-search-files [files]
|
||||
(->> files
|
||||
(mapv #(cond-> %
|
||||
(= file-id (:id %))
|
||||
(assoc :thumbnail-uri thumbnail-uri)))))]
|
||||
(-> state
|
||||
(d/update-in-when [:dashboard-files file-id] assoc :thumbnail-uri thumbnail-uri)
|
||||
(d/update-in-when [:dashboard-recent-files file-id] assoc :thumbnail-uri thumbnail-uri)
|
||||
(d/update-when :dashboard-search-result update-search-files))))))
|
||||
|
||||
;; --- EVENT: create-file
|
||||
|
||||
|
|
|
@ -66,16 +66,18 @@
|
|||
:fill color}])
|
||||
|
||||
(defn- calculate-dimensions
|
||||
[objects]
|
||||
(let [bounds (->> (ctst/get-root-objects objects)
|
||||
(map (partial gsb/get-object-bounds objects))
|
||||
(grc/join-rects))]
|
||||
[objects aspect-ratio]
|
||||
(let [bounds
|
||||
(->> (ctst/get-root-objects objects)
|
||||
(map (partial gsb/get-object-bounds objects))
|
||||
(grc/join-rects))]
|
||||
(-> bounds
|
||||
(update :x mth/finite 0)
|
||||
(update :y mth/finite 0)
|
||||
(update :width mth/finite 100000)
|
||||
(update :height mth/finite 100000)
|
||||
(grc/update-rect :position))))
|
||||
(grc/update-rect :position)
|
||||
(grc/fix-aspect-ratio aspect-ratio))))
|
||||
|
||||
(declare shape-wrapper-factory)
|
||||
|
||||
|
@ -194,11 +196,11 @@
|
|||
|
||||
(mf/defc page-svg
|
||||
{::mf/wrap [mf/memo]}
|
||||
[{:keys [data use-thumbnails embed include-metadata] :as props
|
||||
[{:keys [data use-thumbnails embed include-metadata aspect-ratio] :as props
|
||||
:or {embed false include-metadata false}}]
|
||||
(let [objects (:objects data)
|
||||
shapes (cfh/get-immediate-children objects)
|
||||
dim (calculate-dimensions objects)
|
||||
dim (calculate-dimensions objects aspect-ratio)
|
||||
vbox (format-viewbox dim)
|
||||
bgcolor (dm/get-in data [:options :background] default-color)
|
||||
|
||||
|
@ -253,11 +255,14 @@
|
|||
;; the viewer and inspector
|
||||
(mf/defc frame-svg
|
||||
{::mf/wrap [mf/memo]}
|
||||
[{:keys [objects frame zoom use-thumbnails] :or {zoom 1} :as props}]
|
||||
[{:keys [objects frame zoom use-thumbnails aspect-ratio background-color] :or {zoom 1} :as props}]
|
||||
(let [frame-id (:id frame)
|
||||
|
||||
bgcolor (d/nilv background-color default-color)
|
||||
include-metadata (mf/use-ctx export/include-metadata-ctx)
|
||||
|
||||
bounds (gsb/get-object-bounds objects frame)
|
||||
bounds (-> (gsb/get-object-bounds objects frame)
|
||||
(grc/fix-aspect-ratio aspect-ratio))
|
||||
|
||||
;; Bounds without shadows/blur will be the bounds of the thumbnail
|
||||
bounds2 (gsb/get-object-bounds objects (dissoc frame :shadow :blur))
|
||||
|
@ -305,6 +310,7 @@
|
|||
:xmlns "http://www.w3.org/2000/svg"
|
||||
:xmlnsXlink "http://www.w3.org/1999/xlink"
|
||||
:xmlns:penpot (when include-metadata "https://penpot.app/xmlns")
|
||||
:style {:background bgcolor}
|
||||
:fill "none"}
|
||||
[:& shape-wrapper {:shape frame}]]]))
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
height: 100%;
|
||||
padding: $s-32;
|
||||
width: 100%;
|
||||
overflow: auto;
|
||||
|
||||
&.no-illustration {
|
||||
display: flex;
|
||||
|
|
|
@ -17,11 +17,13 @@
|
|||
{::mf/wrap [mf/memo]
|
||||
::mf/wrap-props false}
|
||||
[{:keys [color on-click mini? area]}]
|
||||
(let [on-click (mf/use-fn
|
||||
(mf/deps color on-click)
|
||||
(fn [event]
|
||||
(when (fn? on-click)
|
||||
(^function on-click color event))))]
|
||||
(let [read-only? (nil? on-click)
|
||||
on-click
|
||||
(mf/use-fn
|
||||
(mf/deps color on-click)
|
||||
(fn [event]
|
||||
(when (fn? on-click)
|
||||
(^function on-click color event))))]
|
||||
|
||||
(if (uc/multiple? color)
|
||||
[:div {:on-click on-click :class (stl/css :color-bullet :multiple)}]
|
||||
|
@ -39,7 +41,9 @@
|
|||
:is-not-library-color (nil? id)
|
||||
:is-gradient (some? gradient)
|
||||
:is-transparent (and opacity (> 1 opacity))
|
||||
:grid-area area)
|
||||
:grid-area area
|
||||
:read-only read-only?)
|
||||
:data-readonly (str read-only?)
|
||||
:on-click on-click}
|
||||
|
||||
(cond
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
height: 100%;
|
||||
background-color: var(--color-bullet-background-color);
|
||||
}
|
||||
&:hover {
|
||||
&:hover:not(.read-only) {
|
||||
border: $s-2 solid var(--color-bullet-border-color-selected);
|
||||
}
|
||||
}
|
||||
|
@ -87,6 +87,7 @@
|
|||
@include inspectValue;
|
||||
color: var(--palette-text-color);
|
||||
height: $s-16;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.no-text {
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
&.checked {
|
||||
border: none;
|
||||
background-color: var(--radio-btn-background-color-selected);
|
||||
box-shadow: var(--radio-button-box-shadow);
|
||||
svg {
|
||||
stroke: var(--radio-btn-foreground-color-selected);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
height: 100%;
|
||||
min-height: $s-32;
|
||||
color: var(--title-foreground-color);
|
||||
overflow: hidden;
|
||||
}
|
||||
.title-only {
|
||||
margin-left: $s-8;
|
||||
|
@ -36,6 +37,7 @@
|
|||
padding: 0;
|
||||
color: var(--title-foreground-color);
|
||||
stroke: var(--title-foreground-color);
|
||||
overflow: hidden;
|
||||
.toggle-btn {
|
||||
@include buttonStyle;
|
||||
display: flex;
|
||||
|
@ -44,6 +46,7 @@
|
|||
padding: 0;
|
||||
color: var(--title-foreground-color);
|
||||
stroke: var(--title-foreground-color);
|
||||
overflow: hidden;
|
||||
.collapsabled-icon {
|
||||
@include flexCenter;
|
||||
height: $s-24;
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
(rx/map (fn [styles]
|
||||
(assoc result
|
||||
:styles styles
|
||||
:width 250))))))
|
||||
:width 252))))))
|
||||
(rx/mapcat thr/render)
|
||||
(rx/mapcat (partial persist-thumbnail file-id revn))))
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
@import "refactor/common-refactor.scss";
|
||||
|
||||
$thumbnail-default-width: $s-252; // Default width
|
||||
$thumbnail-aspect-ration: #{2 / 3}; // Ratio 2:3
|
||||
$thumbnail-default-height: $s-168; // Default width
|
||||
|
||||
.dashboard-grid {
|
||||
font-size: $fs-14;
|
||||
|
@ -44,10 +44,12 @@ $thumbnail-aspect-ration: #{2 / 3}; // Ratio 2:3
|
|||
}
|
||||
|
||||
.grid-item-th {
|
||||
border-radius: $br-4;
|
||||
border-radius: $br-8;
|
||||
text-align: initial;
|
||||
width: var(--th-width, #{$thumbnail-default-width});
|
||||
height: calc(var(--th-width, #{$thumbnail-default-width}) * #{$thumbnail-aspect-ration});
|
||||
height: var(--th-height, #{$thumbnail-default-height});
|
||||
background-size: cover;
|
||||
overflow: hidden;
|
||||
|
||||
img {
|
||||
object-fit: contain;
|
||||
|
@ -59,7 +61,7 @@ $thumbnail-aspect-ration: #{2 / 3}; // Ratio 2:3
|
|||
outline: $br-4 solid $da-primary;
|
||||
text-align: initial;
|
||||
width: calc(var(--th-width) + $s-12);
|
||||
height: calc(var(--th-width, #{$thumbnail-default-width}) * #{$thumbnail-aspect-ration});
|
||||
height: var(--th-height, #{$thumbnail-default-height});
|
||||
}
|
||||
|
||||
&.overlay {
|
||||
|
@ -131,10 +133,10 @@ $thumbnail-aspect-ration: #{2 / 3}; // Ratio 2:3
|
|||
.item-badge {
|
||||
background-color: $da-primary;
|
||||
border: none;
|
||||
border-radius: $br-4;
|
||||
border-radius: $br-6;
|
||||
position: absolute;
|
||||
top: $s-8;
|
||||
right: $s-8;
|
||||
top: $s-12;
|
||||
right: $s-12;
|
||||
height: $s-32;
|
||||
width: $s-32;
|
||||
display: flex;
|
||||
|
@ -258,17 +260,10 @@ $thumbnail-aspect-ration: #{2 / 3}; // Ratio 2:3
|
|||
.grid-item-th {
|
||||
border-radius: $br-4;
|
||||
cursor: pointer;
|
||||
|
||||
background-position: center;
|
||||
background-size: auto 80%;
|
||||
background-repeat: no-repeat;
|
||||
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
|
||||
background-color: var(--canvas-color);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: row;
|
||||
|
@ -283,8 +278,9 @@ $thumbnail-aspect-ration: #{2 / 3}; // Ratio 2:3
|
|||
width: 100%;
|
||||
}
|
||||
|
||||
svg#loader-pencil {
|
||||
fill: $db-cuaternary;
|
||||
:global(svg#loader-pencil) {
|
||||
stroke: $db-cuaternary;
|
||||
width: calc(var(--th-width, #{$thumbnail-default-width}) * 0.25);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
text-transform: uppercase;
|
||||
border: $s-2 solid transparent;
|
||||
width: var(--th-width, #{g.$thumbnail-default-width});
|
||||
height: calc(var(--th-width, #{g.$thumbnail-default-width}) * #{g.$thumbnail-aspect-ration});
|
||||
height: var(--th-height, #{g.$thumbnail-default-height});
|
||||
|
||||
svg {
|
||||
width: $s-32;
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
|
||||
.project {
|
||||
align-items: center;
|
||||
background: $df-primary;
|
||||
border-radius: $br-4;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
@ -87,8 +86,8 @@
|
|||
cursor: pointer;
|
||||
font-size: $fs-16;
|
||||
line-height: 0.8;
|
||||
font-weight: $fw700;
|
||||
color: $db-secondary;
|
||||
font-weight: $fw400;
|
||||
color: $df-primary;
|
||||
margin-right: $s-4;
|
||||
margin-right: $s-12;
|
||||
}
|
||||
|
@ -98,7 +97,7 @@
|
|||
font-size: $fs-14;
|
||||
line-height: 1.15;
|
||||
font-weight: $fw400;
|
||||
color: $db-primary;
|
||||
color: $df-secondary;
|
||||
@media (max-width: 760px) {
|
||||
display: none;
|
||||
}
|
||||
|
@ -109,6 +108,9 @@
|
|||
opacity: 1;
|
||||
margin-left: $s-32;
|
||||
|
||||
svg {
|
||||
fill: $df-primary;
|
||||
}
|
||||
.btn-small {
|
||||
height: $s-32;
|
||||
margin: 0 $s-8;
|
||||
|
@ -139,7 +141,7 @@
|
|||
|
||||
&.active {
|
||||
svg {
|
||||
fill: $db-tertiary;
|
||||
fill: $da-primary;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -188,28 +190,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
.dashboard-project-row .project {
|
||||
background-color: transparent;
|
||||
|
||||
h2 {
|
||||
color: $df-primary;
|
||||
font-weight: 400;
|
||||
}
|
||||
span,
|
||||
.info,
|
||||
.recent-files-row-title-info {
|
||||
color: $df-secondary;
|
||||
}
|
||||
.project-actions {
|
||||
svg {
|
||||
fill: $df-primary;
|
||||
}
|
||||
.pin-icon svg {
|
||||
fill: $df-secondary;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.team-hero {
|
||||
background-color: $db-tertiary;
|
||||
border-radius: $br-8;
|
||||
|
|
|
@ -335,7 +335,7 @@
|
|||
transform: rotate(45deg);
|
||||
|
||||
&:hover {
|
||||
fill: var(--warning-color);
|
||||
fill: $da-primary;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -420,7 +420,10 @@
|
|||
}
|
||||
|
||||
&:hover {
|
||||
background-color: $db-cuaternary;
|
||||
background-color: $db-secondary;
|
||||
span {
|
||||
color: $da-primary;
|
||||
}
|
||||
}
|
||||
|
||||
&.current {
|
||||
|
|
|
@ -367,13 +367,17 @@
|
|||
limit (mth/max 1 limit)
|
||||
|
||||
th-size (when width
|
||||
(- (/ (- width 32 (* (dec limit) 24)) limit) 12))]
|
||||
(mth/floor (- (/ (- width 32 (* (dec limit) 24)) limit) 12)))
|
||||
|
||||
;; Need an even value
|
||||
th-size (if (odd? (int th-size)) (- th-size 1) th-size)]
|
||||
|
||||
(mf/with-effect
|
||||
[th-size]
|
||||
(when th-size
|
||||
(let [node (mf/ref-val rowref)]
|
||||
(.setProperty (.-style node) "--th-width" (str th-size "px")))))
|
||||
(.setProperty (.-style node) "--th-width" (str th-size "px"))
|
||||
(.setProperty (.-style node) "--th-height" (str (mth/ceil (* th-size (/ 2 3))) "px")))))
|
||||
|
||||
(mf/with-effect []
|
||||
(let [node (mf/ref-val rowref)
|
||||
|
|
|
@ -24,62 +24,72 @@
|
|||
(set! last-resize-type type))
|
||||
|
||||
(defn use-resize-hook
|
||||
[key initial min-val max-val axis negate? resize-type]
|
||||
([key initial min-val max-val axis negate? resize-type]
|
||||
(use-resize-hook key initial min-val max-val axis negate? resize-type nil))
|
||||
|
||||
(let [current-file-id (mf/use-ctx ctx/current-file-id)
|
||||
size-state (mf/use-state (or (get-in @storage [::saved-resize current-file-id key]) initial))
|
||||
parent-ref (mf/use-ref nil)
|
||||
([key initial min-val max-val axis negate? resize-type on-change-size]
|
||||
(let [current-file-id (mf/use-ctx ctx/current-file-id)
|
||||
size-state (mf/use-state (or (get-in @storage [::saved-resize current-file-id key]) initial))
|
||||
parent-ref (mf/use-ref nil)
|
||||
|
||||
dragging-ref (mf/use-ref false)
|
||||
start-size-ref (mf/use-ref nil)
|
||||
start-ref (mf/use-ref nil)
|
||||
dragging-ref (mf/use-ref false)
|
||||
start-size-ref (mf/use-ref nil)
|
||||
start-ref (mf/use-ref nil)
|
||||
|
||||
on-pointer-down
|
||||
(mf/use-callback
|
||||
(mf/deps @size-state)
|
||||
(fn [event]
|
||||
(dom/capture-pointer event)
|
||||
(mf/set-ref-val! start-size-ref @size-state)
|
||||
(mf/set-ref-val! dragging-ref true)
|
||||
(mf/set-ref-val! start-ref (dom/get-client-position event))
|
||||
(set! last-resize-type resize-type)))
|
||||
on-pointer-down
|
||||
(mf/use-callback
|
||||
(mf/deps @size-state)
|
||||
(fn [event]
|
||||
(dom/capture-pointer event)
|
||||
(mf/set-ref-val! start-size-ref @size-state)
|
||||
(mf/set-ref-val! dragging-ref true)
|
||||
(mf/set-ref-val! start-ref (dom/get-client-position event))
|
||||
(set! last-resize-type resize-type)))
|
||||
|
||||
on-lost-pointer-capture
|
||||
(mf/use-callback
|
||||
(fn [event]
|
||||
(dom/release-pointer event)
|
||||
(mf/set-ref-val! start-size-ref nil)
|
||||
(mf/set-ref-val! dragging-ref false)
|
||||
(mf/set-ref-val! start-ref nil)
|
||||
(set! last-resize-type nil)))
|
||||
on-lost-pointer-capture
|
||||
(mf/use-callback
|
||||
(fn [event]
|
||||
(dom/release-pointer event)
|
||||
(mf/set-ref-val! start-size-ref nil)
|
||||
(mf/set-ref-val! dragging-ref false)
|
||||
(mf/set-ref-val! start-ref nil)
|
||||
(set! last-resize-type nil)))
|
||||
|
||||
on-pointer-move
|
||||
(mf/use-callback
|
||||
(mf/deps min-val max-val negate?)
|
||||
(fn [event]
|
||||
(when (mf/ref-val dragging-ref)
|
||||
(let [start (mf/ref-val start-ref)
|
||||
pos (dom/get-client-position event)
|
||||
delta (-> (gpt/to-vec start pos)
|
||||
(cond-> negate? gpt/negate)
|
||||
(get axis))
|
||||
start-size (mf/ref-val start-size-ref)
|
||||
new-size (-> (+ start-size delta) (max min-val) (min max-val))]
|
||||
(reset! size-state new-size)
|
||||
(swap! storage assoc-in [::saved-resize current-file-id key] new-size)))))
|
||||
on-pointer-move
|
||||
(mf/use-callback
|
||||
(mf/deps min-val max-val negate?)
|
||||
(fn [event]
|
||||
(when (mf/ref-val dragging-ref)
|
||||
(let [start (mf/ref-val start-ref)
|
||||
pos (dom/get-client-position event)
|
||||
delta (-> (gpt/to-vec start pos)
|
||||
(cond-> negate? gpt/negate)
|
||||
(get axis))
|
||||
start-size (mf/ref-val start-size-ref)
|
||||
new-size (-> (+ start-size delta) (max min-val) (min max-val))]
|
||||
(reset! size-state new-size)
|
||||
(swap! storage assoc-in [::saved-resize current-file-id key] new-size)
|
||||
(when on-change-size (on-change-size new-size))))))
|
||||
|
||||
set-size
|
||||
(mf/use-callback
|
||||
(fn [new-size]
|
||||
(let [new-size (mth/clamp new-size min-val max-val)]
|
||||
(reset! size-state new-size)
|
||||
(swap! storage assoc-in [::saved-resize current-file-id key] new-size))))]
|
||||
{:on-pointer-down on-pointer-down
|
||||
:on-lost-pointer-capture on-lost-pointer-capture
|
||||
:on-pointer-move on-pointer-move
|
||||
:parent-ref parent-ref
|
||||
:set-size set-size
|
||||
:size @size-state}))
|
||||
set-size
|
||||
(mf/use-callback
|
||||
(mf/deps on-change-size)
|
||||
(fn [new-size]
|
||||
(let [new-size (mth/clamp new-size min-val max-val)]
|
||||
(reset! size-state new-size)
|
||||
(swap! storage assoc-in [::saved-resize current-file-id key] new-size)
|
||||
(when on-change-size (on-change-size new-size)))))]
|
||||
|
||||
(mf/use-effect
|
||||
(fn []
|
||||
(when on-change-size (on-change-size @size-state))))
|
||||
|
||||
{:on-pointer-down on-pointer-down
|
||||
:on-lost-pointer-capture on-lost-pointer-capture
|
||||
:on-pointer-move on-pointer-move
|
||||
:parent-ref parent-ref
|
||||
:set-size set-size
|
||||
:size @size-state})))
|
||||
|
||||
(defn use-resize-observer
|
||||
[callback]
|
||||
|
|
|
@ -261,7 +261,10 @@
|
|||
:collapsabled-icon true
|
||||
:rotated collapsed-css?)}
|
||||
i/arrow-refactor]]
|
||||
[:span {:class (stl/css :code-lang)} "CSS"]
|
||||
|
||||
[:& select {:default-value style-type
|
||||
:class (stl/css :code-lang-select)
|
||||
:options [{:label "CSS" :value "css"}]}]
|
||||
|
||||
[:div {:class (stl/css :action-btns)}
|
||||
[:button {:class (stl/css :expand-button)
|
||||
|
|
|
@ -7,6 +7,12 @@
|
|||
@import "refactor/common-refactor.scss";
|
||||
|
||||
.element-options {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
padding-bottom: $s-16;
|
||||
|
||||
.attributes-block {
|
||||
.download-button {
|
||||
@extend .button-secondary;
|
||||
|
@ -17,46 +23,67 @@
|
|||
}
|
||||
}
|
||||
.code-block {
|
||||
@include codeTypography;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
padding: 0 $s-4 $s-8 0;
|
||||
.code-row-lang {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: $s-4;
|
||||
width: 100%;
|
||||
.code-lang {
|
||||
@include tabTitleTipography;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.action-btns {
|
||||
display: flex;
|
||||
gap: $s-4;
|
||||
flex: 1;
|
||||
justify-content: end;
|
||||
.expand-button {
|
||||
@extend .button-tertiary;
|
||||
height: $s-32;
|
||||
width: $s-28;
|
||||
svg {
|
||||
@extend .button-icon;
|
||||
stroke: var(--icon-foreground);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.code-lang-select {
|
||||
@include tabTitleTipography;
|
||||
width: $s-92;
|
||||
border: $s-1 solid transparent;
|
||||
background-color: transparent;
|
||||
color: var(--menu-foreground-color-disabled);
|
||||
}
|
||||
pre {
|
||||
border-radius: $br-8;
|
||||
padding: $s-16;
|
||||
max-height: var(--code-height);
|
||||
overflow: auto;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.code-row-display {
|
||||
margin-bottom: $s-8;
|
||||
// Overrides background setted in the theme
|
||||
:global(.hljs) {
|
||||
background: $db-tertiary;
|
||||
}
|
||||
}
|
||||
.code-row-lang {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: $s-4;
|
||||
width: 100%;
|
||||
}
|
||||
.code-lang {
|
||||
@include tabTitleTipography;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.action-btns {
|
||||
display: flex;
|
||||
gap: $s-4;
|
||||
flex: 1;
|
||||
justify-content: end;
|
||||
.expand-button {
|
||||
@extend .button-tertiary;
|
||||
height: $s-32;
|
||||
width: $s-28;
|
||||
svg {
|
||||
@extend .button-icon;
|
||||
stroke: var(--icon-foreground);
|
||||
}
|
||||
}
|
||||
}
|
||||
.code-lang-select {
|
||||
@include tabTitleTipography;
|
||||
width: $s-72;
|
||||
border: $s-1 solid transparent;
|
||||
background-color: transparent;
|
||||
color: var(--menu-foreground-color-disabled);
|
||||
}
|
||||
.code-row-display {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
padding-bottom: $s-8;
|
||||
}
|
||||
}
|
||||
|
||||
.toggle-btn {
|
||||
|
|
|
@ -61,7 +61,8 @@
|
|||
(mf/defc workspace-content
|
||||
{::mf/wrap-props false}
|
||||
[{:keys [file layout page-id wglobal]}]
|
||||
(let [selected (mf/deref refs/selected-shapes)
|
||||
(let [palete-size (mf/use-state nil)
|
||||
selected (mf/deref refs/selected-shapes)
|
||||
|
||||
{:keys [vport] :as wlocal} (mf/deref refs/workspace-local)
|
||||
{:keys [options-mode]} wglobal
|
||||
|
@ -78,11 +79,17 @@
|
|||
(when (and vport (not= size vport))
|
||||
(st/emit! (dw/update-viewport-size resize-type size)))))
|
||||
|
||||
on-resize-palette
|
||||
(mf/use-fn
|
||||
(fn [size]
|
||||
(reset! palete-size size)))
|
||||
|
||||
node-ref (use-resize-observer on-resize)]
|
||||
[:*
|
||||
(if new-css-system
|
||||
(when (not hide-ui?)
|
||||
[:& palette {:layout layout}])
|
||||
[:& palette {:layout layout
|
||||
:on-change-palette-size on-resize-palette}])
|
||||
[:*
|
||||
(when (and colorpalette? (not hide-ui?))
|
||||
[:& colorpalette])
|
||||
|
@ -107,7 +114,10 @@
|
|||
:wlocal wlocal
|
||||
:wglobal wglobal
|
||||
:selected selected
|
||||
:layout layout}]]]
|
||||
:layout layout
|
||||
:palete-size
|
||||
(when (and (or colorpalette? textpalette?) (not hide-ui?))
|
||||
@palete-size)}]]]
|
||||
|
||||
(when-not hide-ui?
|
||||
[:*
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
@include font-face("worksans", "WorkSans-Bold", bold);
|
||||
|
||||
// Space mono
|
||||
@include font-face("spacemono", "SpaceMono-Regular", normal);
|
||||
@include font-face("robotomono", "RobotoMono-Regular", normal);
|
||||
|
||||
:global(:root) {
|
||||
--s-4: 0.25rem;
|
||||
|
|
|
@ -93,7 +93,9 @@
|
|||
cursor: pointer;
|
||||
}
|
||||
.separator {
|
||||
height: $s-12;
|
||||
margin-top: $s-8;
|
||||
height: $s-4;
|
||||
border-top: 1px solid $db-secondary;
|
||||
}
|
||||
.shortcut {
|
||||
@extend .shortcut;
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
"paddingRight" "calc(var(--s-4) * 70)"}))
|
||||
|
||||
(mf/defc palette
|
||||
[{:keys [layout]}]
|
||||
[{:keys [layout on-change-palette-size]}]
|
||||
(let [color-palette? (:colorpalette layout)
|
||||
text-palette? (:textpalette layout)
|
||||
workspace-read-only? (mf/use-ctx ctx/workspace-read-only?)
|
||||
|
@ -57,10 +57,11 @@
|
|||
on-select (mf/use-fn #(reset! selected %))
|
||||
rulers? (mf/deref refs/rules?)
|
||||
{:keys [on-pointer-down on-lost-pointer-capture on-pointer-move parent-ref size]}
|
||||
(r/use-resize-hook :palette 72 54 80 :y true :bottom)
|
||||
(r/use-resize-hook :palette 72 54 80 :y true :bottom on-change-palette-size)
|
||||
|
||||
vport (mf/deref viewport)
|
||||
vport-width (:width vport)
|
||||
|
||||
on-resize
|
||||
(mf/use-callback
|
||||
(fn [_]
|
||||
|
@ -98,10 +99,11 @@
|
|||
|
||||
any-palette? (or color-palette? text-palette?)
|
||||
|
||||
size-classname (cond
|
||||
(<= size 64) (css :small-palette)
|
||||
(<= size 72) (css :mid-palette)
|
||||
(<= size 80) (css :big-palette))]
|
||||
size-classname
|
||||
(cond
|
||||
(<= size 64) (css :small-palette)
|
||||
(<= size 72) (css :mid-palette)
|
||||
(<= size 80) (css :big-palette))]
|
||||
|
||||
(mf/with-effect []
|
||||
(let [key1 (events/listen js/window "resize" on-resize)]
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
(:require-macros [app.main.style :as stl])
|
||||
(:require
|
||||
[app.common.data :as d]
|
||||
[app.common.data.macros :as dm]
|
||||
[app.config :as cfg]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.ui.context :as ctx]
|
||||
|
@ -49,15 +50,13 @@
|
|||
|
||||
(if new-css-system
|
||||
[:*
|
||||
(when (and (< 2 num-users) open?)
|
||||
(when (and (> num-users 2) open?)
|
||||
[:button
|
||||
{:id "users-close"
|
||||
:class (stl/css :active-users-opened)
|
||||
:on-click close-users-widget
|
||||
:on-blur close-users-widget}
|
||||
[:ul {:class (stl/css :active-users-list)}
|
||||
(when (< 2 num-users)
|
||||
[:li [:span {:class (stl/css :users-num)} num-users]])
|
||||
(for [session user-ids]
|
||||
[:& session-widget
|
||||
{:session session
|
||||
|
@ -69,7 +68,7 @@
|
|||
:on-click open-users-widget}
|
||||
|
||||
[:ul {:class (stl/css :active-users-list)}
|
||||
(when (< 2 num-users) [:span {:class (stl/css :users-num)} num-users])
|
||||
(when (> num-users 2) [:span {:class (stl/css :users-num)} (dm/str "+" (- num-users 2))])
|
||||
(for [[index session] (d/enumerate first-users)]
|
||||
[:& session-widget
|
||||
{:session session
|
||||
|
|
|
@ -203,6 +203,8 @@
|
|||
|
||||
[:& persistence-state-widget]
|
||||
|
||||
[:div {:class (stl/css :separator)}]
|
||||
|
||||
|
||||
[:div {:class (stl/css :zoom-section)}
|
||||
[:& zoom-widget-workspace
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
align-items: center;
|
||||
min-width: $s-256;
|
||||
padding: $s-8;
|
||||
gap: $s-2;
|
||||
gap: $s-8;
|
||||
background-color: var(--panel-background-color);
|
||||
.users-section {
|
||||
position: relative;
|
||||
|
@ -19,6 +19,9 @@
|
|||
max-width: $s-72;
|
||||
padding: $s-4 $s-6;
|
||||
}
|
||||
.separator {
|
||||
flex: 1;
|
||||
}
|
||||
.zoom-section {
|
||||
.zoom-widget {
|
||||
@include buttonStyle;
|
||||
|
@ -27,6 +30,7 @@
|
|||
justify-content: center;
|
||||
height: $s-28;
|
||||
max-width: $s-48;
|
||||
width: $s-48;
|
||||
border-radius: $br-8;
|
||||
.label {
|
||||
@include titleTipography;
|
||||
|
|
|
@ -88,8 +88,6 @@
|
|||
}
|
||||
.drop-space {
|
||||
height: $s-12;
|
||||
border-radius: $br-8;
|
||||
background-color: var(--assets-item-background-color);
|
||||
}
|
||||
.dragging {
|
||||
position: absolute;
|
||||
|
|
|
@ -95,7 +95,7 @@
|
|||
|
||||
on-component-click
|
||||
(mf/use-fn
|
||||
(mf/deps component-id)
|
||||
(mf/deps component-id on-asset-click)
|
||||
(fn [event]
|
||||
(dom/stop-propagation event)
|
||||
(on-asset-click component-id unselect-all event)))
|
||||
|
@ -141,7 +141,7 @@
|
|||
|
||||
on-context-menu
|
||||
(mf/use-fn
|
||||
(mf/deps component-id)
|
||||
(mf/deps on-context-menu component-id)
|
||||
(partial on-context-menu component-id))]
|
||||
|
||||
(if ^boolean new-css-system
|
||||
|
@ -449,6 +449,7 @@
|
|||
toggle-list-style (mf/use-ctx cmm/assets-toggle-list-style)
|
||||
|
||||
selected (:components selected)
|
||||
|
||||
selected-full (into #{} (filter #(contains? selected (:id %))) components)
|
||||
multi-components? (> (count selected) 1)
|
||||
multi-assets? (or (seq (:graphics selected))
|
||||
|
@ -519,6 +520,7 @@
|
|||
(mf/use-fn
|
||||
(mf/deps selected on-clear-selection read-only?)
|
||||
(fn [component-id event]
|
||||
(dom/stop-propagation event)
|
||||
(dom/prevent-default event)
|
||||
(let [pos (dom/get-client-position event)]
|
||||
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
.component-group {
|
||||
.drop-space {
|
||||
height: $s-12;
|
||||
border-radius: $br-8;
|
||||
background-color: var(--color-foreground-secondary);
|
||||
}
|
||||
.asset-grid {
|
||||
display: grid;
|
||||
|
@ -22,7 +20,7 @@
|
|||
@include flexCenter;
|
||||
position: relative;
|
||||
padding: $s-8;
|
||||
border: $s-2 solid transparent;
|
||||
border: $s-4 solid transparent;
|
||||
border-radius: $br-8;
|
||||
background-color: var(--color-foreground-secondary);
|
||||
overflow: hidden;
|
||||
|
@ -100,7 +98,7 @@
|
|||
}
|
||||
|
||||
&.selected {
|
||||
border: $s-1 solid var(--assets-item-border-color);
|
||||
border: $s-4 solid var(--assets-item-border-color);
|
||||
}
|
||||
}
|
||||
.grid-placeholder {
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
.graphics-group {
|
||||
.drop-space {
|
||||
height: $s-12;
|
||||
border-radius: $br-8;
|
||||
background-color: var(--color-foreground-secondary);
|
||||
}
|
||||
.asset-grid {
|
||||
display: grid;
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
padding: 0 0 0 $s-4;
|
||||
.drop-space {
|
||||
height: $s-12;
|
||||
border-radius: $br-8;
|
||||
background-color: var(--assets-item-background-color);
|
||||
}
|
||||
.grid-placeholder {
|
||||
height: $s-2;
|
||||
|
|
|
@ -180,108 +180,109 @@
|
|||
:on-click on-remove}
|
||||
i/remove-refactor]]]
|
||||
|
||||
[:& advanced-options {:class (stl/css :grid-advanced-options)
|
||||
:visible? open?
|
||||
:on-close toggle-advanced-options}
|
||||
;; square
|
||||
(when (= :square type)
|
||||
[:div {:class (stl/css :square-row)}
|
||||
[:div {:class (stl/css :advanced-row)}
|
||||
[:& color-row {:color (:color params)
|
||||
:title (tr "workspace.options.grid.params.color")
|
||||
:disable-gradient true
|
||||
:disable-image true
|
||||
:on-change handle-change-color
|
||||
:on-detach handle-detach-color}]
|
||||
[:button {:class (stl/css-case :show-more-options true
|
||||
:selected show-more-options?)
|
||||
:on-click toggle-more-options}
|
||||
i/menu-refactor]]
|
||||
(when show-more-options?
|
||||
[:div {:class (stl/css :second-row)}
|
||||
[:button {:class (stl/css-case :btn-options true
|
||||
:disabled is-default)
|
||||
:disabled is-default
|
||||
:on-click handle-use-default}
|
||||
[:span (tr "workspace.options.grid.params.use-default")]]
|
||||
[:button {:class (stl/css-case :btn-options true
|
||||
:disabled is-default)
|
||||
:disabled is-default
|
||||
:on-click handle-set-as-default}
|
||||
[:span (tr "workspace.options.grid.params.set-default")]]])])
|
||||
(when (:display grid)
|
||||
[:& advanced-options {:class (stl/css :grid-advanced-options)
|
||||
:visible? open?
|
||||
:on-close toggle-advanced-options}
|
||||
;; square
|
||||
(when (= :square type)
|
||||
[:div {:class (stl/css :square-row)}
|
||||
[:div {:class (stl/css :advanced-row)}
|
||||
[:& color-row {:color (:color params)
|
||||
:title (tr "workspace.options.grid.params.color")
|
||||
:disable-gradient true
|
||||
:disable-image true
|
||||
:on-change handle-change-color
|
||||
:on-detach handle-detach-color}]
|
||||
[:button {:class (stl/css-case :show-more-options true
|
||||
:selected show-more-options?)
|
||||
:on-click toggle-more-options}
|
||||
i/menu-refactor]]
|
||||
(when show-more-options?
|
||||
[:div {:class (stl/css :second-row)}
|
||||
[:button {:class (stl/css-case :btn-options true
|
||||
:disabled is-default)
|
||||
:disabled is-default
|
||||
:on-click handle-use-default}
|
||||
[:span (tr "workspace.options.grid.params.use-default")]]
|
||||
[:button {:class (stl/css-case :btn-options true
|
||||
:disabled is-default)
|
||||
:disabled is-default
|
||||
:on-click handle-set-as-default}
|
||||
[:span (tr "workspace.options.grid.params.set-default")]]])])
|
||||
|
||||
(when (or (= :column type) (= :row type))
|
||||
[:div {:class (stl/css :column-row)}
|
||||
[:div {:class (stl/css :advanced-row)}
|
||||
[:div {:class (stl/css :orientation-select-wrapper)}
|
||||
[:& select {:data-mousetrap-dont-stop true ;; makes mousetrap to not stop at this element
|
||||
:default-value (:type params)
|
||||
:class (stl/css :orientation-select)
|
||||
:options [{:value :stretch :label (tr "workspace.options.grid.params.type.stretch")}
|
||||
{:value :left :label (if (= type :row)
|
||||
(tr "workspace.options.grid.params.type.top")
|
||||
(tr "workspace.options.grid.params.type.left"))}
|
||||
{:value :center :label (tr "workspace.options.grid.params.type.center")}
|
||||
{:value :right :label (if (= type :row)
|
||||
(tr "workspace.options.grid.params.type.bottom")
|
||||
(tr "workspace.options.grid.params.type.right"))}]
|
||||
:on-change (handle-change :params :type)}]]
|
||||
(when (or (= :column type) (= :row type))
|
||||
[:div {:class (stl/css :column-row)}
|
||||
[:div {:class (stl/css :advanced-row)}
|
||||
[:div {:class (stl/css :orientation-select-wrapper)}
|
||||
[:& select {:data-mousetrap-dont-stop true ;; makes mousetrap to not stop at this element
|
||||
:default-value (:type params)
|
||||
:class (stl/css :orientation-select)
|
||||
:options [{:value :stretch :label (tr "workspace.options.grid.params.type.stretch")}
|
||||
{:value :left :label (if (= type :row)
|
||||
(tr "workspace.options.grid.params.type.top")
|
||||
(tr "workspace.options.grid.params.type.left"))}
|
||||
{:value :center :label (tr "workspace.options.grid.params.type.center")}
|
||||
{:value :right :label (if (= type :row)
|
||||
(tr "workspace.options.grid.params.type.bottom")
|
||||
(tr "workspace.options.grid.params.type.right"))}]
|
||||
:on-change (handle-change :params :type)}]]
|
||||
|
||||
[:div {:class (stl/css :color-wrapper)}
|
||||
[:& color-row {:color (:color params)
|
||||
:title (tr "workspace.options.grid.params.color")
|
||||
:disable-gradient true
|
||||
:disable-image true
|
||||
:on-change handle-change-color
|
||||
:on-detach handle-detach-color}]]]
|
||||
[:div {:class (stl/css :color-wrapper)}
|
||||
[:& color-row {:color (:color params)
|
||||
:title (tr "workspace.options.grid.params.color")
|
||||
:disable-gradient true
|
||||
:disable-image true
|
||||
:on-change handle-change-color
|
||||
:on-detach handle-detach-color}]]]
|
||||
|
||||
[:div {:class (stl/css :advanced-row)}
|
||||
[:div {:class (stl/css :height)
|
||||
:title (if (= :row type)
|
||||
(tr "workspace.options.grid.params.height")
|
||||
(tr "workspace.options.grid.params.width"))}
|
||||
[:span {:class (stl/css :icon-text)}
|
||||
(if (= :row type)
|
||||
"H"
|
||||
"W")]
|
||||
[:> numeric-input* {:placeholder "Auto"
|
||||
:on-change handle-change-item-length
|
||||
:nillable true
|
||||
:className (stl/css :numeric-input)
|
||||
:value (or (:item-length params) "")}]]
|
||||
[:div {:class (stl/css :advanced-row)}
|
||||
[:div {:class (stl/css :height)
|
||||
:title (if (= :row type)
|
||||
(tr "workspace.options.grid.params.height")
|
||||
(tr "workspace.options.grid.params.width"))}
|
||||
[:span {:class (stl/css :icon-text)}
|
||||
(if (= :row type)
|
||||
"H"
|
||||
"W")]
|
||||
[:> numeric-input* {:placeholder "Auto"
|
||||
:on-change handle-change-item-length
|
||||
:nillable true
|
||||
:className (stl/css :numeric-input)
|
||||
:value (or (:item-length params) "")}]]
|
||||
|
||||
[:div {:class (stl/css :gutter)
|
||||
:title (tr "workspace.options.grid.params.gutter")}
|
||||
[:span {:class (stl/css-case :icon true
|
||||
:rotated (= type :row))} i/gap-horizontal-refactor]
|
||||
[:> numeric-input* {:placeholder "0"
|
||||
:on-change (handle-change :params :gutter)
|
||||
:nillable true
|
||||
:className (stl/css :numeric-input)
|
||||
:value (or (:gutter params) 0)}]]
|
||||
[:div {:class (stl/css :gutter)
|
||||
:title (tr "workspace.options.grid.params.gutter")}
|
||||
[:span {:class (stl/css-case :icon true
|
||||
:rotated (= type :row))} i/gap-horizontal-refactor]
|
||||
[:> numeric-input* {:placeholder "0"
|
||||
:on-change (handle-change :params :gutter)
|
||||
:nillable true
|
||||
:className (stl/css :numeric-input)
|
||||
:value (or (:gutter params) 0)}]]
|
||||
|
||||
[:div {:class (stl/css :margin)
|
||||
:title (tr "workspace.options.grid.params.margin")}
|
||||
[:span {:class (stl/css-case :icon true
|
||||
:rotated (= type :column))} i/grid-margin-refactor]
|
||||
[:> numeric-input* {:placeholder "0"
|
||||
:on-change (handle-change :params :margin)
|
||||
:nillable true
|
||||
:className (stl/css :numeric-input)
|
||||
:value (or (:margin params) 0)}]]
|
||||
[:div {:class (stl/css :margin)
|
||||
:title (tr "workspace.options.grid.params.margin")}
|
||||
[:span {:class (stl/css-case :icon true
|
||||
:rotated (= type :column))} i/grid-margin-refactor]
|
||||
[:> numeric-input* {:placeholder "0"
|
||||
:on-change (handle-change :params :margin)
|
||||
:nillable true
|
||||
:className (stl/css :numeric-input)
|
||||
:value (or (:margin params) 0)}]]
|
||||
|
||||
[:button {:class (stl/css-case :show-more-options true
|
||||
:selected show-more-options?)
|
||||
:on-click toggle-more-options}
|
||||
i/menu-refactor]
|
||||
(when show-more-options?
|
||||
[:div {:class (stl/css :more-options)}
|
||||
[:button {:disabled is-default
|
||||
:class (stl/css :option-btn)
|
||||
:on-click handle-use-default} (tr "workspace.options.grid.params.use-default")]
|
||||
[:button {:disabled is-default
|
||||
:class (stl/css :option-btn)
|
||||
:on-click handle-set-as-default} (tr "workspace.options.grid.params.set-default")]])]])]]
|
||||
[:button {:class (stl/css-case :show-more-options true
|
||||
:selected show-more-options?)
|
||||
:on-click toggle-more-options}
|
||||
i/menu-refactor]
|
||||
(when show-more-options?
|
||||
[:div {:class (stl/css :more-options)}
|
||||
[:button {:disabled is-default
|
||||
:class (stl/css :option-btn)
|
||||
:on-click handle-use-default} (tr "workspace.options.grid.params.use-default")]
|
||||
[:button {:disabled is-default
|
||||
:class (stl/css :option-btn)
|
||||
:on-click handle-set-as-default} (tr "workspace.options.grid.params.set-default")]])]])])]
|
||||
|
||||
[:div.grid-option
|
||||
[:div.grid-option-main {:style {:display (when open? "none")}}
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
}
|
||||
|
||||
.help-content {
|
||||
padding: $s-20;
|
||||
.help-group {
|
||||
margin-bottom: $s-40;
|
||||
.interactions-help-icon {
|
||||
|
|
|
@ -1389,10 +1389,6 @@
|
|||
:class (stl/css-case :title-spacing-layout (not has-layout?))}
|
||||
(if (and (not multiple) (:layout values))
|
||||
[:div {:class (stl/css :title-actions)}
|
||||
[:button {:class (stl/css :remove-layout)
|
||||
:on-click on-remove-layout}
|
||||
i/remove-refactor]
|
||||
|
||||
(when ^boolean grid-enabled?
|
||||
[:*
|
||||
[:button {:class (stl/css :add-layout)
|
||||
|
@ -1402,7 +1398,11 @@
|
|||
[:& dropdown {:show show-layout-dropdown? :on-close handle-close-layout-options}
|
||||
[:div {:class (stl/css :layout-options)}
|
||||
[:button {:class (stl/css :layout-option) :on-click set-flex} "Flex layout"]
|
||||
[:button {:class (stl/css :layout-option) :on-click set-grid} "Grid layout"]]]])]
|
||||
[:button {:class (stl/css :layout-option) :on-click set-grid} "Grid layout"]]]])
|
||||
|
||||
[:button {:class (stl/css :remove-layout)
|
||||
:on-click on-remove-layout}
|
||||
i/remove-refactor]]
|
||||
|
||||
[:div {:class (stl/css :title-actions)}
|
||||
(if ^boolean grid-enabled?
|
||||
|
|
|
@ -50,11 +50,21 @@
|
|||
[:& layer-menu {:ids ids
|
||||
:type type
|
||||
:values layer-values}]
|
||||
|
||||
[:& measures-menu {:ids ids
|
||||
:type type
|
||||
:values measure-values
|
||||
:shape shape}]
|
||||
[:& layout-container-menu {:type type :ids [(:id shape)] :values layout-container-values :multiple false}]
|
||||
|
||||
(when (or (not ^boolean is-layout-child?) ^boolean is-layout-child-absolute?)
|
||||
[:& constraints-menu {:ids ids
|
||||
:values constraint-values}])
|
||||
|
||||
[:& layout-container-menu
|
||||
{:type type
|
||||
:ids [(:id shape)]
|
||||
:values layout-container-values
|
||||
:multiple false}]
|
||||
|
||||
(when (and (= (count ids) 1) is-layout-child? is-grid-parent?)
|
||||
[:& grid-cell/options
|
||||
|
@ -71,10 +81,6 @@
|
|||
:is-grid-parent? is-grid-parent?
|
||||
:shape shape}])
|
||||
|
||||
(when (or (not is-layout-child?) is-layout-child-absolute?)
|
||||
[:& constraints-menu {:ids ids
|
||||
:values constraint-values}])
|
||||
|
||||
[:& fill-menu {:ids ids
|
||||
:type type
|
||||
:values (select-keys shape fill-attrs)}]
|
||||
|
|
|
@ -52,11 +52,21 @@
|
|||
[:& layer-menu {:ids ids
|
||||
:type type
|
||||
:values layer-values}]
|
||||
|
||||
[:& measures-menu {:ids ids
|
||||
:type type
|
||||
:values measure-values
|
||||
:shape shape}]
|
||||
[:& layout-container-menu {:type type :ids [(:id shape)] :values layout-container-values :multiple false}]
|
||||
|
||||
(when (or (not ^boolean is-layout-child?) ^boolean is-layout-child-absolute?)
|
||||
[:& constraints-menu {:ids ids
|
||||
:values constraint-values}])
|
||||
|
||||
[:& layout-container-menu
|
||||
{:type type
|
||||
:ids [(:id shape)]
|
||||
:values layout-container-values
|
||||
:multiple false}]
|
||||
|
||||
(when (and (= (count ids) 1) is-layout-child? is-grid-parent?)
|
||||
[:& grid-cell/options
|
||||
|
@ -72,9 +82,6 @@
|
|||
:is-flex-parent? is-flex-parent?
|
||||
:is-grid-parent? is-grid-parent?
|
||||
:shape shape}])
|
||||
(when (or (not is-layout-child?) is-layout-child-absolute?)
|
||||
[:& constraints-menu {:ids ids
|
||||
:values constraint-values}])
|
||||
|
||||
[:& fill-menu {:ids ids
|
||||
:type type
|
||||
|
|
|
@ -62,11 +62,18 @@
|
|||
:values measure-values
|
||||
:type type
|
||||
:shape shape}]
|
||||
|
||||
[:& component-menu {:shapes [shape]}]
|
||||
(when (or (not is-layout-child?) is-layout-child-absolute?)
|
||||
|
||||
(when (or (not ^boolean is-layout-child?) ^boolean is-layout-child-absolute?)
|
||||
[:& constraints-menu {:ids ids
|
||||
:values constraint-values}])
|
||||
[:& layout-container-menu {:type type :ids [(:id shape)] :values layout-container-values :multiple false}]
|
||||
|
||||
[:& layout-container-menu
|
||||
{:type type
|
||||
:ids [(:id shape)]
|
||||
:values layout-container-values
|
||||
:multiple false}]
|
||||
|
||||
(when (and (= (count ids) 1) is-layout-child? is-grid-parent?)
|
||||
[:& grid-cell/options
|
||||
|
|
|
@ -74,7 +74,15 @@
|
|||
[:& layer-menu {:type type :ids layer-ids :values layer-values}]
|
||||
[:& measures-menu {:type type :ids measure-ids :values measure-values :shape shape}]
|
||||
[:& component-menu {:shapes [shape]}] ;;remove this in components-v2
|
||||
[:& layout-container-menu {:type type :ids [(:id shape)] :values layout-container-values :multiple false}]
|
||||
|
||||
(when (or (not ^boolean is-layout-child?) ^boolean is-layout-child-absolute?)
|
||||
[:& constraints-menu {:ids constraint-ids :values constraint-values}])
|
||||
|
||||
[:& layout-container-menu
|
||||
{:type type
|
||||
:ids [(:id shape)]
|
||||
:values layout-container-values
|
||||
:multiple false}]
|
||||
|
||||
(when (and (= (count ids) 1) is-layout-child? is-grid-parent?)
|
||||
[:& grid-cell/options
|
||||
|
@ -91,9 +99,6 @@
|
|||
:is-grid-parent? is-grid-parent?
|
||||
:values layout-item-values}])
|
||||
|
||||
(when (or (not is-layout-child?) is-layout-child-absolute?)
|
||||
[:& constraints-menu {:ids constraint-ids :values constraint-values}])
|
||||
|
||||
(when-not (empty? fill-ids)
|
||||
[:& fill-menu {:type type :ids fill-ids :values fill-values}])
|
||||
|
||||
|
|
|
@ -52,11 +52,21 @@
|
|||
[:& layer-menu {:ids ids
|
||||
:type type
|
||||
:values layer-values}]
|
||||
|
||||
[:& measures-menu {:ids ids
|
||||
:type type
|
||||
:values measure-values
|
||||
:shape shape}]
|
||||
[:& layout-container-menu {:type type :ids [(:id shape)] :values layout-container-values :multiple false}]
|
||||
|
||||
(when (or (not ^boolean is-layout-child?) ^boolean is-layout-child-absolute?)
|
||||
[:& constraints-menu {:ids ids
|
||||
:values constraint-values}])
|
||||
|
||||
[:& layout-container-menu
|
||||
{:type type
|
||||
:ids [(:id shape)]
|
||||
:values layout-container-values
|
||||
:multiple false}]
|
||||
|
||||
(when (and (= (count ids) 1) is-layout-child? is-grid-parent?)
|
||||
[:& grid-cell/options
|
||||
|
@ -73,12 +83,6 @@
|
|||
:is-grid-parent? is-grid-parent?
|
||||
:shape shape}])
|
||||
|
||||
(when (or (not is-layout-child?) is-layout-child-absolute?)
|
||||
[:& constraints-menu {:ids ids
|
||||
:values constraint-values}])
|
||||
|
||||
|
||||
|
||||
[:& fill-menu {:ids ids
|
||||
:type type
|
||||
:values fill-values}]
|
||||
|
|
|
@ -359,8 +359,14 @@
|
|||
(when-not (empty? components)
|
||||
[:& component-menu {:shapes components}])
|
||||
|
||||
[:& layout-container-menu {:type type :ids layout-container-ids :values layout-container-values :multiple true}]
|
||||
(when-not (or (empty? constraint-ids) ^boolean is-layout-child?)
|
||||
[:& constraints-menu {:ids constraint-ids :values constraint-values}])
|
||||
|
||||
[:& layout-container-menu
|
||||
{:type type
|
||||
:ids layout-container-ids
|
||||
:values layout-container-values
|
||||
:multiple true}]
|
||||
|
||||
(when (or is-layout-child? has-flex-layout-container?)
|
||||
[:& layout-item-menu
|
||||
|
@ -372,9 +378,6 @@
|
|||
:is-grid-parent? is-grid-parent?
|
||||
:values layout-item-values}])
|
||||
|
||||
(when-not (or (empty? constraint-ids) is-layout-child?)
|
||||
[:& constraints-menu {:ids constraint-ids :values constraint-values}])
|
||||
|
||||
(when-not (empty? text-ids)
|
||||
[:& ot/text-menu {:type type :ids text-ids :values text-values}])
|
||||
|
||||
|
|
|
@ -56,7 +56,16 @@
|
|||
:type type
|
||||
:values measure-values
|
||||
:shape shape}]
|
||||
[:& layout-container-menu {:type type :ids [(:id shape)] :values layout-container-values :multiple false}]
|
||||
|
||||
(when (or (not ^boolean is-layout-child?) ^boolean is-layout-child-absolute?)
|
||||
[:& constraints-menu {:ids ids
|
||||
:values constraint-values}])
|
||||
|
||||
[:& layout-container-menu
|
||||
{:type type
|
||||
:ids [(:id shape)]
|
||||
:values layout-container-values
|
||||
:multiple false}]
|
||||
|
||||
(when (and (= (count ids) 1) is-layout-child? is-grid-parent?)
|
||||
[:& grid-cell/options
|
||||
|
@ -72,9 +81,6 @@
|
|||
:is-flex-parent? is-flex-parent?
|
||||
:is-grid-parent? is-grid-parent?
|
||||
:shape shape}])
|
||||
(when (or (not is-layout-child?) is-layout-child-absolute?)
|
||||
[:& constraints-menu {:ids ids
|
||||
:values constraint-values}])
|
||||
|
||||
[:& fill-menu {:ids ids
|
||||
:type type
|
||||
|
|
|
@ -59,6 +59,11 @@
|
|||
:type type
|
||||
:values measure-values
|
||||
:shape shape}]
|
||||
|
||||
(when (or (not ^boolean is-layout-child?) ^boolean is-layout-child-absolute?)
|
||||
[:& constraints-menu {:ids ids
|
||||
:values constraint-values}])
|
||||
|
||||
[:& layout-container-menu
|
||||
{:type type
|
||||
:ids ids
|
||||
|
@ -80,13 +85,6 @@
|
|||
:is-grid-parent? is-grid-parent?
|
||||
:shape shape}])
|
||||
|
||||
(when (or (not ^boolean is-layout-child?)
|
||||
^boolean is-layout-child-absolute?)
|
||||
[:& constraints-menu {:ids ids
|
||||
:values constraint-values}])
|
||||
|
||||
|
||||
|
||||
[:& fill-menu {:ids ids
|
||||
:type type
|
||||
:values fill-values}]
|
||||
|
|
|
@ -128,12 +128,21 @@
|
|||
:type type
|
||||
:values measure-values
|
||||
:shape shape}]
|
||||
[:& layout-container-menu {:type type :ids [(:id shape)] :values layout-container-values :multiple false}]
|
||||
|
||||
(when (or (not ^boolean is-layout-child?) ^boolean is-layout-child-absolute?)
|
||||
[:& constraints-menu {:ids ids
|
||||
:values constraint-values}])
|
||||
|
||||
[:& layout-container-menu
|
||||
{:type type
|
||||
:ids [(:id shape)]
|
||||
:values layout-container-values
|
||||
:multiple false}]
|
||||
|
||||
(when (and (= (count ids) 1) is-layout-child? is-grid-parent?)
|
||||
[:& grid-cell/options
|
||||
{:shape (first parents)
|
||||
:cell (ctl/get-cell-by-shape-id (first parents) (first ids))}])
|
||||
[:& grid-cell/options
|
||||
{:shape (first parents)
|
||||
:cell (ctl/get-cell-by-shape-id (first parents) (first ids))}])
|
||||
|
||||
(when is-layout-child?
|
||||
[:& layout-item-menu
|
||||
|
@ -145,10 +154,6 @@
|
|||
:is-grid-parent? is-grid-parent?
|
||||
:shape shape}])
|
||||
|
||||
(when (or (not is-layout-child?) is-layout-child-absolute?)
|
||||
[:& constraints-menu {:ids ids
|
||||
:values constraint-values}])
|
||||
|
||||
[:& fill-menu {:ids ids
|
||||
:type type
|
||||
:values fill-values}]
|
||||
|
|
|
@ -91,12 +91,23 @@
|
|||
:type type
|
||||
:values (select-keys shape measure-attrs)
|
||||
:shape shape}]
|
||||
[:& layout-container-menu {:type type :ids [(:id shape)] :values layout-container-values :multiple false}]
|
||||
|
||||
(when (or (not ^boolean is-layout-child?) ^boolean is-layout-child-absolute?)
|
||||
[:& constraints-menu
|
||||
{:ids ids
|
||||
:values (select-keys shape constraint-attrs)}])
|
||||
|
||||
[:& layout-container-menu
|
||||
{:type type
|
||||
:ids [(:id shape)]
|
||||
:values layout-container-values
|
||||
:multiple false}]
|
||||
|
||||
(when (and (= (count ids) 1) is-layout-child? is-grid-parent?)
|
||||
[:& grid-cell/options
|
||||
{:shape (first parents)
|
||||
:cell (ctl/get-cell-by-shape-id (first parents) (first ids))}])
|
||||
|
||||
(when is-layout-child?
|
||||
[:& layout-item-menu
|
||||
{:ids ids
|
||||
|
@ -107,13 +118,6 @@
|
|||
:is-grid-parent? is-grid-parent?
|
||||
:shape shape}])
|
||||
|
||||
(when (or (not is-layout-child?) is-layout-child-absolute?)
|
||||
[:& constraints-menu
|
||||
{:ids ids
|
||||
:values (select-keys shape constraint-attrs)}])
|
||||
|
||||
|
||||
|
||||
[:& text-menu
|
||||
{:ids ids
|
||||
:type type
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
selected))
|
||||
|
||||
(mf/defc viewport
|
||||
[{:keys [selected wglobal wlocal layout file] :as props}]
|
||||
[{:keys [selected wglobal wlocal layout file palete-size] :as props}]
|
||||
(let [;; When adding data from workspace-local revisit `app.main.ui.workspace` to check
|
||||
;; that the new parameter is sent
|
||||
{:keys [edit-path
|
||||
|
@ -535,7 +535,8 @@
|
|||
[:& scroll-bars/viewport-scrollbars
|
||||
{:objects base-objects
|
||||
:zoom zoom
|
||||
:vbox vbox}]
|
||||
:vbox vbox
|
||||
:bottom-padding (when palete-size (+ palete-size 8))}]
|
||||
|
||||
(when-not hide-ui?
|
||||
[:& rules/rules
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
(mf/defc viewport-scrollbars
|
||||
{::mf/wrap [mf/memo]}
|
||||
[{:keys [objects zoom vbox]}]
|
||||
[{:keys [objects zoom vbox bottom-padding]}]
|
||||
|
||||
(let [v-scrolling? (mf/use-state false)
|
||||
h-scrolling? (mf/use-state false)
|
||||
|
@ -56,6 +56,11 @@
|
|||
(cfh/get-immediate-children)
|
||||
(gsh/shapes->rect)))
|
||||
|
||||
;; Padding for bottom palette
|
||||
vbox (cond-> vbox
|
||||
(some? bottom-padding)
|
||||
(update :height - (/ bottom-padding zoom)))
|
||||
|
||||
inv-zoom (/ 1 zoom)
|
||||
vbox-height (- (:height vbox) (* inv-zoom scroll-height))
|
||||
vbox-width (- (:width vbox) (* inv-zoom scroll-width))
|
||||
|
@ -65,6 +70,7 @@
|
|||
(max 0)
|
||||
(* vbox-height)
|
||||
(/ (:height base-objects-rect)))
|
||||
|
||||
;; left space hidden because of the scroll
|
||||
left-offset (-> (- vbox-x (:x base-objects-rect))
|
||||
(max 0)
|
||||
|
|
|
@ -35,9 +35,7 @@
|
|||
[:& i18n/tr-html {:tag-name "span"
|
||||
:label "workspace.top-bar.read-only"}]]
|
||||
[:button {:class (stl/css :done-btn)
|
||||
:on-click handle-close-view-mode} (tr "workspace.top-bar.read-only.done")]
|
||||
[:button {:class (stl/css :close-btn)
|
||||
:on-click handle-close-view-mode} i/close-refactor]]]
|
||||
:on-click handle-close-view-mode} (tr "workspace.top-bar.read-only.done")]]]
|
||||
|
||||
;; OLD
|
||||
[:div.viewport-actions
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
margin-left: -50%;
|
||||
padding: $s-8;
|
||||
pointer-events: initial;
|
||||
width: $s-512;
|
||||
width: $s-400;
|
||||
}
|
||||
|
||||
.viewport-actions-title {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
(ns app.worker.thumbnails
|
||||
(:require
|
||||
["react-dom/server" :as rds]
|
||||
[app.common.data.macros :as dm]
|
||||
[app.common.logging :as log]
|
||||
[app.common.uri :as u]
|
||||
[app.config :as cf]
|
||||
|
@ -62,16 +63,27 @@
|
|||
(binding [fonts/loaded-hints (l/atom #{})]
|
||||
(let [objects (:objects page)
|
||||
frame (some->> page :thumbnail-frame-id (get objects))
|
||||
background-color (dm/get-in page [:options :background])
|
||||
element (if frame
|
||||
(mf/element render/frame-svg #js {:objects objects :frame frame :use-thumbnails true})
|
||||
(mf/element render/page-svg #js {:data page :use-thumbnails true :embed true}))
|
||||
(mf/element render/frame-svg #js
|
||||
{:objects objects
|
||||
:frame frame
|
||||
:use-thumbnails true
|
||||
:background-color background-color
|
||||
:aspect-ratio (/ 2 3)})
|
||||
|
||||
(mf/element render/page-svg #js
|
||||
{:data page
|
||||
:use-thumbnails true
|
||||
:embed true
|
||||
:aspect-ratio (/ 2 3)}))
|
||||
data (rds/renderToStaticMarkup element)]
|
||||
{:data data
|
||||
:fonts @fonts/loaded-hints
|
||||
:file-id file-id
|
||||
:revn revn}))
|
||||
(catch :default cause
|
||||
(js/console.error "unexpected erorr on rendering thumbnail" cause)
|
||||
(js/console.error "unexpected error on rendering thumbnail" cause)
|
||||
nil)))
|
||||
|
||||
(defmethod impl/handler :thumbnails/generate-for-file
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue