Merge pull request #3915 from penpot/alotor-fixes-ui

Fixes new UI
This commit is contained in:
Eva Marco 2023-12-15 16:28:51 +01:00 committed by GitHub
commit 89c14b25ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
62 changed files with 1043 additions and 797 deletions

View file

@ -9,6 +9,7 @@
[app.common.spec :as us] [app.common.spec :as us]
[app.db :as db] [app.db :as db]
[app.rpc :as-alias rpc] [app.rpc :as-alias rpc]
[app.rpc.commands.files :refer [resolve-public-uri]]
[app.rpc.doc :as-alias doc] [app.rpc.doc :as-alias doc]
[app.util.services :as sv] [app.util.services :as sv]
[clojure.spec.alpha :as s])) [clojure.spec.alpha :as s]))
@ -37,12 +38,15 @@
) )
select distinct select distinct
f.id, f.id,
f.revn,
f.project_id, f.project_id,
f.created_at, f.created_at,
f.modified_at, f.modified_at,
f.name, f.name,
f.is_shared f.is_shared,
ft.media_id
from file as f from file as f
left join file_thumbnail as ft on (ft.file_id = f.id and ft.revn = f.revn)
inner join projects as pr on (f.project_id = pr.id) inner join projects as pr on (f.project_id = pr.id)
where f.name ilike ('%' || ? || '%') where f.name ilike ('%' || ? || '%')
and (f.deleted_at is null or f.deleted_at > now()) and (f.deleted_at is null or f.deleted_at > now())
@ -50,10 +54,16 @@
(defn search-files (defn search-files
[conn profile-id team-id search-term] [conn profile-id team-id search-term]
(db/exec! conn [sql:search-files (->> (db/exec! conn [sql:search-files
profile-id team-id profile-id team-id
profile-id team-id profile-id team-id
search-term])) search-term])
(mapv (fn [row]
(if-let [media-id (:media-id row)]
(-> row
(dissoc :media-id)
(assoc :thumbnail-uri (resolve-public-uri media-id)))
(dissoc row :media-id))))))
(s/def ::team-id ::us/uuid) (s/def ::team-id ::us/uuid)
(s/def ::search-files ::us/string) (s/def ::search-files ::us/string)

View file

@ -353,3 +353,19 @@
(mth/max by1 y1) (mth/max by1 y1)
(mth/min bx2 x2) (mth/min bx2 x2)
(mth/min by2 y2))))) (mth/min by2 y2)))))
(defn fix-aspect-ratio
[bounds aspect-ratio]
(if aspect-ratio
(let [width (dm/get-prop bounds :width)
height (dm/get-prop bounds :height)
target-height (* width aspect-ratio)
target-width (* height (/ 1 aspect-ratio))]
(cond-> bounds
(> target-height height)
(-> (assoc :height target-height)
(update :y - (/ (- target-height height ) 2)))
(< target-height height)
(-> (assoc :width target-width)
(update :x - (/ (- target-width width ) 2)))))
bounds))

Binary file not shown.

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 273 KiB

After

Width:  |  Height:  |  Size: 279 KiB

Before After
Before After

View file

@ -4,7 +4,7 @@
// //
// Copyright (c) KALEIDOS INC // Copyright (c) KALEIDOS INC
@use "sass:color" as color; @use "sass:color";
:root { :root {
// DARK // DARK
@ -31,10 +31,12 @@
--light-gray-1: #fff; --light-gray-1: #fff;
--light-gray-2: #e8eaee; --light-gray-2: #e8eaee;
--light-gray-2-30: rgba(232, 234, 238, 0.3); --light-gray-2-30: rgba(232, 234, 238, 0.3);
--light-gray-2-80: rgba(232, 234, 238, 0.8);
--light-gray-3: #f3f4f6; --light-gray-3: #f3f4f6;
--light-gray-4: #eef0f2; --light-gray-4: #eef0f2;
--black: #000; --black: #000;
--off-black: #495e74; --off-black: #495e74;
--off-black-30: #{color.change(#495e74, $alpha: 0.3)};
--purple: #6911d4; --purple: #6911d4;
--purple-30: rgba(105, 17, 212, 0.2); --purple-30: rgba(105, 17, 212, 0.2);
--blue: #1345aa; --blue: #1345aa;

View file

@ -157,6 +157,8 @@
.btn-primary { .btn-primary {
@extend .button-primary; @extend .button-primary;
text-transform: uppercase; text-transform: uppercase;
font-size: $fs-14;
font-weight: $fw400;
} }
.btn-secondary { .btn-secondary {

View file

@ -179,7 +179,7 @@
--menu-shortcut-foreground-color: var(--color-foreground-secondary); --menu-shortcut-foreground-color: var(--color-foreground-secondary);
--menu-shortcut-foreground-color-selected: var(--color-foreground-primary); --menu-shortcut-foreground-color-selected: var(--color-foreground-primary);
--menu-shortcut-foreground-color-hover: var(--color-foreground-primary); --menu-shortcut-foreground-color-hover: var(--color-foreground-primary);
--menu-shadow-color: var(--color-background-subtle); --menu-shadow-color: var(--shadow-color);
--menu-background-color-disabled: var(--color-background-primary); --menu-background-color-disabled: var(--color-background-primary);
--menu-foreground-color-disabled: var(--color-foreground-secondary); --menu-foreground-color-disabled: var(--color-foreground-secondary);
--menu-border-color-disabled: var(--color-background-quaternary); --menu-border-color-disabled: var(--color-background-quaternary);

View file

@ -63,6 +63,13 @@
line-height: 1.2; line-height: 1.2;
} }
@mixin codeTypography {
font-family: "robotomono", monospace;
font-size: $fs-12;
font-weight: $fw400;
line-height: 1.2;
}
@mixin textEllipsis { @mixin textEllipsis {
max-width: 99%; max-width: 99%;
overflow: hidden; overflow: hidden;

View file

@ -21,6 +21,7 @@
--color-accent-primary-muted: var(--green-30); --color-accent-primary-muted: var(--green-30);
--color-accent-secondary: var(--lilac); --color-accent-secondary: var(--lilac);
--color-accent-tertiary: var(--strong-green); --color-accent-tertiary: var(--strong-green);
--overlay-color: rgba(0, 0, 0, 0.4); --overlay-color: rgba(0, 0, 0, 0.4);
--ok-color: var(--dark-ok-color); --ok-color: var(--dark-ok-color);
--warning-color: var(--dark-warning-color); --warning-color: var(--dark-warning-color);
@ -28,5 +29,8 @@
--error-color: var(--dark-error-color); --error-color: var(--dark-error-color);
--canvas-color: var(--color-canvas); --canvas-color: var(--color-canvas);
--shadow-color: var(--dark-gray-2-30);
--radio-button-box-shadow: 0 0 0 1px var(--dark-gray-2-30) inset;
@include meta.load-css("hljs-dark-theme"); @include meta.load-css("hljs-dark-theme");
} }

View file

@ -1,98 +1,124 @@
/** /*!
* Panda Syntax Theme for Highlight.js Theme: GitHub Dark Dimmed
* Based on: https://github.com/tinkertrain/panda-syntax-vscode Description: Dark dimmed theme as seen on github.com
* Author: Annmarie Switzer <https://github.com/annmarie-switzer> Author: github.com
Maintainer: @Hirse
Updated: 2021-05-15
Colors taken from GitHub's CSS
*/ */
.hljs { .hljs {
color: #e6e6e6; color: #adbac7;
background: #2a2c2d; background: #22272e;
}
.hljs-doctag,
.hljs-keyword,
.hljs-meta .hljs-keyword,
.hljs-template-tag,
.hljs-template-variable,
.hljs-type,
.hljs-variable.language_ {
/* prettylights-syntax-keyword */
color: #f47067;
}
.hljs-title,
.hljs-title.class_,
.hljs-title.class_.inherited__,
.hljs-title.function_ {
/* prettylights-syntax-entity */
color: #dcbdfb;
}
.hljs-attr,
.hljs-attribute,
.hljs-literal,
.hljs-meta,
.hljs-number,
.hljs-operator,
.hljs-variable,
.hljs-selector-attr,
.hljs-selector-class,
.hljs-selector-id {
/* prettylights-syntax-constant */
color: #6cb6ff;
}
.hljs-regexp,
.hljs-string,
.hljs-meta .hljs-string {
/* prettylights-syntax-string */
color: #96d0ff;
}
.hljs-built_in,
.hljs-symbol {
/* prettylights-syntax-variable */
color: #f69d50;
}
.hljs-comment,
.hljs-code,
.hljs-formula {
/* prettylights-syntax-comment */
color: #768390;
}
.hljs-name,
.hljs-quote,
.hljs-selector-tag,
.hljs-selector-pseudo {
/* prettylights-syntax-entity-tag */
color: #8ddb8c;
}
.hljs-subst {
/* prettylights-syntax-storage-modifier-import */
color: #adbac7;
}
.hljs-section {
/* prettylights-syntax-markup-heading */
color: #316dca;
font-weight: bold;
}
.hljs-bullet {
/* prettylights-syntax-markup-list */
color: #eac55f;
} }
.hljs-emphasis { .hljs-emphasis {
/* prettylights-syntax-markup-italic */
color: #adbac7;
font-style: italic; font-style: italic;
} }
.hljs-strong { .hljs-strong {
/* prettylights-syntax-markup-bold */
color: #adbac7;
font-weight: bold; font-weight: bold;
} }
.hljs-link { .hljs-addition {
text-decoration: underline; /* prettylights-syntax-markup-inserted */
color: #b4f1b4;
background-color: #1b4721;
} }
.hljs-comment,
.hljs-quote {
color: #bbbbbb;
font-style: italic;
}
.hljs-params {
color: #bbbbbb;
}
.hljs-punctuation,
.hljs-attr {
color: #e6e6e6;
}
.hljs-selector-tag,
.hljs-name,
.hljs-meta {
color: #ff4b82;
}
.hljs-operator,
.hljs-char.escape_ {
color: #b084eb;
}
.hljs-keyword,
.hljs-deletion { .hljs-deletion {
color: #ff75b5; /* prettylights-syntax-markup-deleted */
color: #ffd8d3;
background-color: #78191b;
} }
.hljs-regexp, .hljs-char.escape_,
.hljs-selector-pseudo,
.hljs-selector-attr,
.hljs-variable.language_ {
color: #ff9ac1;
}
.hljs-subst,
.hljs-property,
.hljs-code,
.hljs-formula,
.hljs-section,
.hljs-title.function_ {
color: #45a9f9;
}
.hljs-string,
.hljs-symbol,
.hljs-bullet,
.hljs-addition,
.hljs-selector-class,
.hljs-title.class_,
.hljs-title.class_.inherited__,
.hljs-meta .hljs-string {
color: #19f9d8;
}
.hljs-variable,
.hljs-template-variable,
.hljs-number,
.hljs-literal,
.hljs-type,
.hljs-link, .hljs-link,
.hljs-built_in, .hljs-params,
.hljs-title, .hljs-property,
.hljs-selector-id, .hljs-punctuation,
.hljs-tag, .hljs-tag {
.hljs-doctag, /* purposely ignored */
.hljs-attribute,
.hljs-template-tag,
.hljs-meta .hljs-keyword,
.hljs-punctuation {
color: #ffb86c;
} }

View file

@ -1,94 +1,126 @@
/** /*!
* Panda Syntax Theme for Highlight.js Theme: GitHub
* Based on: https://github.com/tinkertrain/panda-syntax-vscode Description: Light theme as seen on github.com
* Author: Annmarie Switzer <https://github.com/annmarie-switzer> Author: github.com
Maintainer: @Hirse
Updated: 2021-05-15
Outdated base version: https://github.com/primer/github-syntax-light
Current colors taken from GitHub's CSS
*/ */
.hljs { .hljs {
color: #2a2c2d; color: #24292e;
background: #e6e6e6; background: #ffffff;
}
.hljs-doctag,
.hljs-keyword,
.hljs-meta .hljs-keyword,
.hljs-template-tag,
.hljs-template-variable,
.hljs-type,
.hljs-variable.language_ {
/* prettylights-syntax-keyword */
color: #d73a49;
}
.hljs-title,
.hljs-title.class_,
.hljs-title.class_.inherited__,
.hljs-title.function_ {
/* prettylights-syntax-entity */
color: #6f42c1;
}
.hljs-attr,
.hljs-attribute,
.hljs-literal,
.hljs-meta,
.hljs-number,
.hljs-operator,
.hljs-variable,
.hljs-selector-attr,
.hljs-selector-class,
.hljs-selector-id {
/* prettylights-syntax-constant */
color: #005cc5;
}
.hljs-regexp,
.hljs-string,
.hljs-meta .hljs-string {
/* prettylights-syntax-string */
color: #032f62;
}
.hljs-built_in,
.hljs-symbol {
/* prettylights-syntax-variable */
color: #e36209;
}
.hljs-comment,
.hljs-code,
.hljs-formula {
/* prettylights-syntax-comment */
color: #6a737d;
}
.hljs-name,
.hljs-quote,
.hljs-selector-tag,
.hljs-selector-pseudo {
/* prettylights-syntax-entity-tag */
color: #22863a;
}
.hljs-subst {
/* prettylights-syntax-storage-modifier-import */
color: #24292e;
}
.hljs-section {
/* prettylights-syntax-markup-heading */
color: #005cc5;
font-weight: bold;
}
.hljs-bullet {
/* prettylights-syntax-markup-list */
color: #735c0f;
} }
.hljs-emphasis { .hljs-emphasis {
/* prettylights-syntax-markup-italic */
color: #24292e;
font-style: italic; font-style: italic;
} }
.hljs-strong { .hljs-strong {
/* prettylights-syntax-markup-bold */
color: #24292e;
font-weight: bold; font-weight: bold;
} }
.hljs-link { .hljs-addition {
text-decoration: underline; /* prettylights-syntax-markup-inserted */
color: #22863a;
background-color: #f0fff4;
} }
.hljs-comment,
.hljs-quote {
color: #676b79;
font-style: italic;
}
.hljs-params {
color: #676b79;
}
.hljs-punctuation,
.hljs-attr {
color: #2a2c2d;
}
.hljs-selector-tag,
.hljs-name,
.hljs-meta,
.hljs-operator,
.hljs-char.escape_ {
color: #c56200;
}
.hljs-keyword,
.hljs-deletion { .hljs-deletion {
color: #d92792; /* prettylights-syntax-markup-deleted */
color: #b31d28;
background-color: #ffeef0;
} }
.hljs-regexp, .hljs-char.escape_,
.hljs-selector-pseudo,
.hljs-selector-attr,
.hljs-variable.language_ {
color: #cc5e91;
}
.hljs-subst,
.hljs-property,
.hljs-code,
.hljs-formula,
.hljs-section,
.hljs-title.function_ {
color: #3787c7;
}
.hljs-string,
.hljs-symbol,
.hljs-bullet,
.hljs-addition,
.hljs-selector-class,
.hljs-title.class_,
.hljs-title.class_.inherited__,
.hljs-meta .hljs-string {
color: #0d7d6c;
}
.hljs-variable,
.hljs-template-variable,
.hljs-number,
.hljs-literal,
.hljs-type,
.hljs-link, .hljs-link,
.hljs-built_in, .hljs-params,
.hljs-title, .hljs-property,
.hljs-selector-id, .hljs-punctuation,
.hljs-tag, .hljs-tag {
.hljs-doctag, /* purposely ignored */
.hljs-attribute, color: #6a737d;
.hljs-template-tag,
.hljs-meta .hljs-keyword {
color: #7641bb;
} }

View file

@ -21,11 +21,16 @@
--color-accent-primary-muted: var(--purple-30); --color-accent-primary-muted: var(--purple-30);
--color-accent-secondary: var(--blue); --color-accent-secondary: var(--blue);
--color-accent-tertiary: var(--strong-purple); --color-accent-tertiary: var(--strong-purple);
--overlay-color: rgba(255, 255, 255, 0.4);
--ok-color: var(--light-ok-color); --ok-color: var(--light-ok-color);
--warning-color: var(--light-warning-color); --warning-color: var(--light-warning-color);
--pending-color: var(--light-pending-color); --pending-color: var(--light-pending-color);
--error-color: var(--light-error-color); --error-color: var(--light-error-color);
--canvas-color: var(--color-canvas); --canvas-color: var(--color-canvas);
--shadow-color: var(--off-black-30);
--radio-button-box-shadow: 0 0 0 1px var(--light-gray-2) inset;
@include meta.load-css("hljs-light-theme"); @include meta.load-css("hljs-light-theme");
} }

View file

@ -831,9 +831,15 @@
(ptk/reify ::set-file-thumbnail (ptk/reify ::set-file-thumbnail
ptk/UpdateEvent ptk/UpdateEvent
(update [_ state] (update [_ state]
(letfn [(update-search-files [files]
(->> files
(mapv #(cond-> %
(= file-id (:id %))
(assoc :thumbnail-uri thumbnail-uri)))))]
(-> state (-> state
(d/update-in-when [:dashboard-files file-id] assoc :thumbnail-uri thumbnail-uri) (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-in-when [:dashboard-recent-files file-id] assoc :thumbnail-uri thumbnail-uri)
(d/update-when :dashboard-search-result update-search-files))))))
;; --- EVENT: create-file ;; --- EVENT: create-file

View file

@ -66,8 +66,9 @@
:fill color}]) :fill color}])
(defn- calculate-dimensions (defn- calculate-dimensions
[objects] [objects aspect-ratio]
(let [bounds (->> (ctst/get-root-objects objects) (let [bounds
(->> (ctst/get-root-objects objects)
(map (partial gsb/get-object-bounds objects)) (map (partial gsb/get-object-bounds objects))
(grc/join-rects))] (grc/join-rects))]
(-> bounds (-> bounds
@ -75,7 +76,8 @@
(update :y mth/finite 0) (update :y mth/finite 0)
(update :width mth/finite 100000) (update :width mth/finite 100000)
(update :height 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) (declare shape-wrapper-factory)
@ -194,11 +196,11 @@
(mf/defc page-svg (mf/defc page-svg
{::mf/wrap [mf/memo]} {::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}}] :or {embed false include-metadata false}}]
(let [objects (:objects data) (let [objects (:objects data)
shapes (cfh/get-immediate-children objects) shapes (cfh/get-immediate-children objects)
dim (calculate-dimensions objects) dim (calculate-dimensions objects aspect-ratio)
vbox (format-viewbox dim) vbox (format-viewbox dim)
bgcolor (dm/get-in data [:options :background] default-color) bgcolor (dm/get-in data [:options :background] default-color)
@ -253,11 +255,14 @@
;; the viewer and inspector ;; the viewer and inspector
(mf/defc frame-svg (mf/defc frame-svg
{::mf/wrap [mf/memo]} {::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) (let [frame-id (:id frame)
bgcolor (d/nilv background-color default-color)
include-metadata (mf/use-ctx export/include-metadata-ctx) 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 ;; Bounds without shadows/blur will be the bounds of the thumbnail
bounds2 (gsb/get-object-bounds objects (dissoc frame :shadow :blur)) bounds2 (gsb/get-object-bounds objects (dissoc frame :shadow :blur))
@ -305,6 +310,7 @@
: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"
:xmlns:penpot (when include-metadata "https://penpot.app/xmlns") :xmlns:penpot (when include-metadata "https://penpot.app/xmlns")
:style {:background bgcolor}
:fill "none"} :fill "none"}
[:& shape-wrapper {:shape frame}]]])) [:& shape-wrapper {:shape frame}]]]))

View file

@ -15,6 +15,7 @@
height: 100%; height: 100%;
padding: $s-32; padding: $s-32;
width: 100%; width: 100%;
overflow: auto;
&.no-illustration { &.no-illustration {
display: flex; display: flex;

View file

@ -17,7 +17,9 @@
{::mf/wrap [mf/memo] {::mf/wrap [mf/memo]
::mf/wrap-props false} ::mf/wrap-props false}
[{:keys [color on-click mini? area]}] [{:keys [color on-click mini? area]}]
(let [on-click (mf/use-fn (let [read-only? (nil? on-click)
on-click
(mf/use-fn
(mf/deps color on-click) (mf/deps color on-click)
(fn [event] (fn [event]
(when (fn? on-click) (when (fn? on-click)
@ -39,7 +41,9 @@
:is-not-library-color (nil? id) :is-not-library-color (nil? id)
:is-gradient (some? gradient) :is-gradient (some? gradient)
:is-transparent (and opacity (> 1 opacity)) :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} :on-click on-click}
(cond (cond

View file

@ -64,7 +64,7 @@
height: 100%; height: 100%;
background-color: var(--color-bullet-background-color); background-color: var(--color-bullet-background-color);
} }
&:hover { &:hover:not(.read-only) {
border: $s-2 solid var(--color-bullet-border-color-selected); border: $s-2 solid var(--color-bullet-border-color-selected);
} }
} }
@ -87,6 +87,7 @@
@include inspectValue; @include inspectValue;
color: var(--palette-text-color); color: var(--palette-text-color);
height: $s-16; height: $s-16;
text-align: center;
} }
.no-text { .no-text {

View file

@ -40,6 +40,7 @@
&.checked { &.checked {
border: none; border: none;
background-color: var(--radio-btn-background-color-selected); background-color: var(--radio-btn-background-color-selected);
box-shadow: var(--radio-button-box-shadow);
svg { svg {
stroke: var(--radio-btn-foreground-color-selected); stroke: var(--radio-btn-foreground-color-selected);
} }

View file

@ -24,6 +24,7 @@
height: 100%; height: 100%;
min-height: $s-32; min-height: $s-32;
color: var(--title-foreground-color); color: var(--title-foreground-color);
overflow: hidden;
} }
.title-only { .title-only {
margin-left: $s-8; margin-left: $s-8;
@ -36,6 +37,7 @@
padding: 0; padding: 0;
color: var(--title-foreground-color); color: var(--title-foreground-color);
stroke: var(--title-foreground-color); stroke: var(--title-foreground-color);
overflow: hidden;
.toggle-btn { .toggle-btn {
@include buttonStyle; @include buttonStyle;
display: flex; display: flex;
@ -44,6 +46,7 @@
padding: 0; padding: 0;
color: var(--title-foreground-color); color: var(--title-foreground-color);
stroke: var(--title-foreground-color); stroke: var(--title-foreground-color);
overflow: hidden;
.collapsabled-icon { .collapsabled-icon {
@include flexCenter; @include flexCenter;
height: $s-24; height: $s-24;

View file

@ -61,7 +61,7 @@
(rx/map (fn [styles] (rx/map (fn [styles]
(assoc result (assoc result
:styles styles :styles styles
:width 250)))))) :width 252))))))
(rx/mapcat thr/render) (rx/mapcat thr/render)
(rx/mapcat (partial persist-thumbnail file-id revn)))) (rx/mapcat (partial persist-thumbnail file-id revn))))

View file

@ -7,7 +7,7 @@
@import "refactor/common-refactor.scss"; @import "refactor/common-refactor.scss";
$thumbnail-default-width: $s-252; // Default width $thumbnail-default-width: $s-252; // Default width
$thumbnail-aspect-ration: #{2 / 3}; // Ratio 2:3 $thumbnail-default-height: $s-168; // Default width
.dashboard-grid { .dashboard-grid {
font-size: $fs-14; font-size: $fs-14;
@ -44,10 +44,12 @@ $thumbnail-aspect-ration: #{2 / 3}; // Ratio 2:3
} }
.grid-item-th { .grid-item-th {
border-radius: $br-4; border-radius: $br-8;
text-align: initial; text-align: initial;
width: var(--th-width, #{$thumbnail-default-width}); 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 { img {
object-fit: contain; object-fit: contain;
@ -59,7 +61,7 @@ $thumbnail-aspect-ration: #{2 / 3}; // Ratio 2:3
outline: $br-4 solid $da-primary; outline: $br-4 solid $da-primary;
text-align: initial; text-align: initial;
width: calc(var(--th-width) + $s-12); 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 { &.overlay {
@ -131,10 +133,10 @@ $thumbnail-aspect-ration: #{2 / 3}; // Ratio 2:3
.item-badge { .item-badge {
background-color: $da-primary; background-color: $da-primary;
border: none; border: none;
border-radius: $br-4; border-radius: $br-6;
position: absolute; position: absolute;
top: $s-8; top: $s-12;
right: $s-8; right: $s-12;
height: $s-32; height: $s-32;
width: $s-32; width: $s-32;
display: flex; display: flex;
@ -258,17 +260,10 @@ $thumbnail-aspect-ration: #{2 / 3}; // Ratio 2:3
.grid-item-th { .grid-item-th {
border-radius: $br-4; border-radius: $br-4;
cursor: pointer; cursor: pointer;
background-position: center;
background-size: auto 80%;
background-repeat: no-repeat;
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
width: 100%; width: 100%;
background-color: var(--canvas-color);
display: flex; display: flex;
justify-content: center; justify-content: center;
flex-direction: row; flex-direction: row;
@ -283,8 +278,9 @@ $thumbnail-aspect-ration: #{2 / 3}; // Ratio 2:3
width: 100%; width: 100%;
} }
svg#loader-pencil { :global(svg#loader-pencil) {
fill: $db-cuaternary; stroke: $db-cuaternary;
width: calc(var(--th-width, #{$thumbnail-default-width}) * 0.25);
} }
} }

View file

@ -65,7 +65,7 @@
text-transform: uppercase; text-transform: uppercase;
border: $s-2 solid transparent; border: $s-2 solid transparent;
width: var(--th-width, #{g.$thumbnail-default-width}); 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 { svg {
width: $s-32; width: $s-32;

View file

@ -33,7 +33,6 @@
.project { .project {
align-items: center; align-items: center;
background: $df-primary;
border-radius: $br-4; border-radius: $br-4;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -87,8 +86,8 @@
cursor: pointer; cursor: pointer;
font-size: $fs-16; font-size: $fs-16;
line-height: 0.8; line-height: 0.8;
font-weight: $fw700; font-weight: $fw400;
color: $db-secondary; color: $df-primary;
margin-right: $s-4; margin-right: $s-4;
margin-right: $s-12; margin-right: $s-12;
} }
@ -98,7 +97,7 @@
font-size: $fs-14; font-size: $fs-14;
line-height: 1.15; line-height: 1.15;
font-weight: $fw400; font-weight: $fw400;
color: $db-primary; color: $df-secondary;
@media (max-width: 760px) { @media (max-width: 760px) {
display: none; display: none;
} }
@ -109,6 +108,9 @@
opacity: 1; opacity: 1;
margin-left: $s-32; margin-left: $s-32;
svg {
fill: $df-primary;
}
.btn-small { .btn-small {
height: $s-32; height: $s-32;
margin: 0 $s-8; margin: 0 $s-8;
@ -139,7 +141,7 @@
&.active { &.active {
svg { 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 { .team-hero {
background-color: $db-tertiary; background-color: $db-tertiary;
border-radius: $br-8; border-radius: $br-8;

View file

@ -335,7 +335,7 @@
transform: rotate(45deg); transform: rotate(45deg);
&:hover { &:hover {
fill: var(--warning-color); fill: $da-primary;
} }
} }
} }
@ -420,7 +420,10 @@
} }
&:hover { &:hover {
background-color: $db-cuaternary; background-color: $db-secondary;
span {
color: $da-primary;
}
} }
&.current { &.current {

View file

@ -367,13 +367,17 @@
limit (mth/max 1 limit) limit (mth/max 1 limit)
th-size (when width 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 (mf/with-effect
[th-size] [th-size]
(when th-size (when th-size
(let [node (mf/ref-val rowref)] (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 [] (mf/with-effect []
(let [node (mf/ref-val rowref) (let [node (mf/ref-val rowref)

View file

@ -24,8 +24,10 @@
(set! last-resize-type type)) (set! last-resize-type type))
(defn use-resize-hook (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))
([key initial min-val max-val axis negate? resize-type on-change-size]
(let [current-file-id (mf/use-ctx ctx/current-file-id) (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)) size-state (mf/use-state (or (get-in @storage [::saved-resize current-file-id key]) initial))
parent-ref (mf/use-ref nil) parent-ref (mf/use-ref nil)
@ -66,20 +68,28 @@
start-size (mf/ref-val start-size-ref) start-size (mf/ref-val start-size-ref)
new-size (-> (+ start-size delta) (max min-val) (min max-val))] new-size (-> (+ start-size delta) (max min-val) (min max-val))]
(reset! size-state new-size) (reset! size-state new-size)
(swap! storage assoc-in [::saved-resize current-file-id key] 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 set-size
(mf/use-callback (mf/use-callback
(mf/deps on-change-size)
(fn [new-size] (fn [new-size]
(let [new-size (mth/clamp new-size min-val max-val)] (let [new-size (mth/clamp new-size min-val max-val)]
(reset! size-state new-size) (reset! size-state new-size)
(swap! storage assoc-in [::saved-resize current-file-id key] 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-pointer-down on-pointer-down
:on-lost-pointer-capture on-lost-pointer-capture :on-lost-pointer-capture on-lost-pointer-capture
:on-pointer-move on-pointer-move :on-pointer-move on-pointer-move
:parent-ref parent-ref :parent-ref parent-ref
:set-size set-size :set-size set-size
:size @size-state})) :size @size-state})))
(defn use-resize-observer (defn use-resize-observer
[callback] [callback]

View file

@ -261,7 +261,10 @@
:collapsabled-icon true :collapsabled-icon true
:rotated collapsed-css?)} :rotated collapsed-css?)}
i/arrow-refactor]] 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)} [:div {:class (stl/css :action-btns)}
[:button {:class (stl/css :expand-button) [:button {:class (stl/css :expand-button)

View file

@ -7,6 +7,12 @@
@import "refactor/common-refactor.scss"; @import "refactor/common-refactor.scss";
.element-options { .element-options {
display: flex;
flex-direction: column;
height: 100%;
overflow: hidden;
padding-bottom: $s-16;
.attributes-block { .attributes-block {
.download-button { .download-button {
@extend .button-secondary; @extend .button-secondary;
@ -17,12 +23,34 @@
} }
} }
.code-block { .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; padding: 0 $s-4 $s-8 0;
pre {
border-radius: $br-8;
padding: $s-16;
max-height: var(--code-height);
overflow: auto;
height: 100%;
}
// Overrides background setted in the theme
:global(.hljs) {
background: $db-tertiary;
}
}
.code-row-lang { .code-row-lang {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
gap: $s-4; gap: $s-4;
width: 100%; width: 100%;
}
.code-lang { .code-lang {
@include tabTitleTipography; @include tabTitleTipography;
display: flex; display: flex;
@ -43,19 +71,18 @@
} }
} }
} }
.code-lang-select { .code-lang-select {
@include tabTitleTipography; @include tabTitleTipography;
width: $s-92; width: $s-72;
border: $s-1 solid transparent; border: $s-1 solid transparent;
background-color: transparent; background-color: transparent;
color: var(--menu-foreground-color-disabled); color: var(--menu-foreground-color-disabled);
} }
}
.code-row-display { .code-row-display {
margin-bottom: $s-8; flex: 1;
} min-height: 0;
overflow: hidden;
padding-bottom: $s-8;
} }
} }

View file

@ -61,7 +61,8 @@
(mf/defc workspace-content (mf/defc workspace-content
{::mf/wrap-props false} {::mf/wrap-props false}
[{:keys [file layout page-id wglobal]}] [{: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 [vport] :as wlocal} (mf/deref refs/workspace-local)
{:keys [options-mode]} wglobal {:keys [options-mode]} wglobal
@ -78,11 +79,17 @@
(when (and vport (not= size vport)) (when (and vport (not= size vport))
(st/emit! (dw/update-viewport-size resize-type size))))) (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)] node-ref (use-resize-observer on-resize)]
[:* [:*
(if new-css-system (if new-css-system
(when (not hide-ui?) (when (not hide-ui?)
[:& palette {:layout layout}]) [:& palette {:layout layout
:on-change-palette-size on-resize-palette}])
[:* [:*
(when (and colorpalette? (not hide-ui?)) (when (and colorpalette? (not hide-ui?))
[:& colorpalette]) [:& colorpalette])
@ -107,7 +114,10 @@
:wlocal wlocal :wlocal wlocal
:wglobal wglobal :wglobal wglobal
:selected selected :selected selected
:layout layout}]]] :layout layout
:palete-size
(when (and (or colorpalette? textpalette?) (not hide-ui?))
@palete-size)}]]]
(when-not hide-ui? (when-not hide-ui?
[:* [:*

View file

@ -12,7 +12,7 @@
@include font-face("worksans", "WorkSans-Bold", bold); @include font-face("worksans", "WorkSans-Bold", bold);
// Space mono // Space mono
@include font-face("spacemono", "SpaceMono-Regular", normal); @include font-face("robotomono", "RobotoMono-Regular", normal);
:global(:root) { :global(:root) {
--s-4: 0.25rem; --s-4: 0.25rem;

View file

@ -93,7 +93,9 @@
cursor: pointer; cursor: pointer;
} }
.separator { .separator {
height: $s-12; margin-top: $s-8;
height: $s-4;
border-top: 1px solid $db-secondary;
} }
.shortcut { .shortcut {
@extend .shortcut; @extend .shortcut;

View file

@ -46,7 +46,7 @@
"paddingRight" "calc(var(--s-4) * 70)"})) "paddingRight" "calc(var(--s-4) * 70)"}))
(mf/defc palette (mf/defc palette
[{:keys [layout]}] [{:keys [layout on-change-palette-size]}]
(let [color-palette? (:colorpalette layout) (let [color-palette? (:colorpalette layout)
text-palette? (:textpalette layout) text-palette? (:textpalette layout)
workspace-read-only? (mf/use-ctx ctx/workspace-read-only?) workspace-read-only? (mf/use-ctx ctx/workspace-read-only?)
@ -57,10 +57,11 @@
on-select (mf/use-fn #(reset! selected %)) on-select (mf/use-fn #(reset! selected %))
rulers? (mf/deref refs/rules?) rulers? (mf/deref refs/rules?)
{:keys [on-pointer-down on-lost-pointer-capture on-pointer-move parent-ref size]} {: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 (mf/deref viewport)
vport-width (:width vport) vport-width (:width vport)
on-resize on-resize
(mf/use-callback (mf/use-callback
(fn [_] (fn [_]
@ -98,7 +99,8 @@
any-palette? (or color-palette? text-palette?) any-palette? (or color-palette? text-palette?)
size-classname (cond size-classname
(cond
(<= size 64) (css :small-palette) (<= size 64) (css :small-palette)
(<= size 72) (css :mid-palette) (<= size 72) (css :mid-palette)
(<= size 80) (css :big-palette))] (<= size 80) (css :big-palette))]

View file

@ -8,6 +8,7 @@
(:require-macros [app.main.style :as stl]) (:require-macros [app.main.style :as stl])
(:require (:require
[app.common.data :as d] [app.common.data :as d]
[app.common.data.macros :as dm]
[app.config :as cfg] [app.config :as cfg]
[app.main.refs :as refs] [app.main.refs :as refs]
[app.main.ui.context :as ctx] [app.main.ui.context :as ctx]
@ -49,15 +50,13 @@
(if new-css-system (if new-css-system
[:* [:*
(when (and (< 2 num-users) open?) (when (and (> num-users 2) open?)
[:button [:button
{:id "users-close" {:id "users-close"
:class (stl/css :active-users-opened) :class (stl/css :active-users-opened)
:on-click close-users-widget :on-click close-users-widget
:on-blur close-users-widget} :on-blur close-users-widget}
[:ul {:class (stl/css :active-users-list)} [:ul {:class (stl/css :active-users-list)}
(when (< 2 num-users)
[:li [:span {:class (stl/css :users-num)} num-users]])
(for [session user-ids] (for [session user-ids]
[:& session-widget [:& session-widget
{:session session {:session session
@ -69,7 +68,7 @@
:on-click open-users-widget} :on-click open-users-widget}
[:ul {:class (stl/css :active-users-list)} [: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)] (for [[index session] (d/enumerate first-users)]
[:& session-widget [:& session-widget
{:session session {:session session

View file

@ -203,6 +203,8 @@
[:& persistence-state-widget] [:& persistence-state-widget]
[:div {:class (stl/css :separator)}]
[:div {:class (stl/css :zoom-section)} [:div {:class (stl/css :zoom-section)}
[:& zoom-widget-workspace [:& zoom-widget-workspace

View file

@ -11,7 +11,7 @@
align-items: center; align-items: center;
min-width: $s-256; min-width: $s-256;
padding: $s-8; padding: $s-8;
gap: $s-2; gap: $s-8;
background-color: var(--panel-background-color); background-color: var(--panel-background-color);
.users-section { .users-section {
position: relative; position: relative;
@ -19,6 +19,9 @@
max-width: $s-72; max-width: $s-72;
padding: $s-4 $s-6; padding: $s-4 $s-6;
} }
.separator {
flex: 1;
}
.zoom-section { .zoom-section {
.zoom-widget { .zoom-widget {
@include buttonStyle; @include buttonStyle;
@ -27,6 +30,7 @@
justify-content: center; justify-content: center;
height: $s-28; height: $s-28;
max-width: $s-48; max-width: $s-48;
width: $s-48;
border-radius: $br-8; border-radius: $br-8;
.label { .label {
@include titleTipography; @include titleTipography;

View file

@ -88,8 +88,6 @@
} }
.drop-space { .drop-space {
height: $s-12; height: $s-12;
border-radius: $br-8;
background-color: var(--assets-item-background-color);
} }
.dragging { .dragging {
position: absolute; position: absolute;

View file

@ -95,7 +95,7 @@
on-component-click on-component-click
(mf/use-fn (mf/use-fn
(mf/deps component-id) (mf/deps component-id on-asset-click)
(fn [event] (fn [event]
(dom/stop-propagation event) (dom/stop-propagation event)
(on-asset-click component-id unselect-all event))) (on-asset-click component-id unselect-all event)))
@ -141,7 +141,7 @@
on-context-menu on-context-menu
(mf/use-fn (mf/use-fn
(mf/deps component-id) (mf/deps on-context-menu component-id)
(partial on-context-menu component-id))] (partial on-context-menu component-id))]
(if ^boolean new-css-system (if ^boolean new-css-system
@ -449,6 +449,7 @@
toggle-list-style (mf/use-ctx cmm/assets-toggle-list-style) toggle-list-style (mf/use-ctx cmm/assets-toggle-list-style)
selected (:components selected) selected (:components selected)
selected-full (into #{} (filter #(contains? selected (:id %))) components) selected-full (into #{} (filter #(contains? selected (:id %))) components)
multi-components? (> (count selected) 1) multi-components? (> (count selected) 1)
multi-assets? (or (seq (:graphics selected)) multi-assets? (or (seq (:graphics selected))
@ -519,6 +520,7 @@
(mf/use-fn (mf/use-fn
(mf/deps selected on-clear-selection read-only?) (mf/deps selected on-clear-selection read-only?)
(fn [component-id event] (fn [component-id event]
(dom/stop-propagation event)
(dom/prevent-default event) (dom/prevent-default event)
(let [pos (dom/get-client-position event)] (let [pos (dom/get-client-position event)]

View file

@ -9,8 +9,6 @@
.component-group { .component-group {
.drop-space { .drop-space {
height: $s-12; height: $s-12;
border-radius: $br-8;
background-color: var(--color-foreground-secondary);
} }
.asset-grid { .asset-grid {
display: grid; display: grid;
@ -22,7 +20,7 @@
@include flexCenter; @include flexCenter;
position: relative; position: relative;
padding: $s-8; padding: $s-8;
border: $s-2 solid transparent; border: $s-4 solid transparent;
border-radius: $br-8; border-radius: $br-8;
background-color: var(--color-foreground-secondary); background-color: var(--color-foreground-secondary);
overflow: hidden; overflow: hidden;
@ -100,7 +98,7 @@
} }
&.selected { &.selected {
border: $s-1 solid var(--assets-item-border-color); border: $s-4 solid var(--assets-item-border-color);
} }
} }
.grid-placeholder { .grid-placeholder {

View file

@ -9,8 +9,6 @@
.graphics-group { .graphics-group {
.drop-space { .drop-space {
height: $s-12; height: $s-12;
border-radius: $br-8;
background-color: var(--color-foreground-secondary);
} }
.asset-grid { .asset-grid {
display: grid; display: grid;

View file

@ -22,8 +22,6 @@
padding: 0 0 0 $s-4; padding: 0 0 0 $s-4;
.drop-space { .drop-space {
height: $s-12; height: $s-12;
border-radius: $br-8;
background-color: var(--assets-item-background-color);
} }
.grid-placeholder { .grid-placeholder {
height: $s-2; height: $s-2;

View file

@ -180,6 +180,7 @@
:on-click on-remove} :on-click on-remove}
i/remove-refactor]]] i/remove-refactor]]]
(when (:display grid)
[:& advanced-options {:class (stl/css :grid-advanced-options) [:& advanced-options {:class (stl/css :grid-advanced-options)
:visible? open? :visible? open?
:on-close toggle-advanced-options} :on-close toggle-advanced-options}
@ -281,7 +282,7 @@
:on-click handle-use-default} (tr "workspace.options.grid.params.use-default")] :on-click handle-use-default} (tr "workspace.options.grid.params.use-default")]
[:button {:disabled is-default [:button {:disabled is-default
:class (stl/css :option-btn) :class (stl/css :option-btn)
:on-click handle-set-as-default} (tr "workspace.options.grid.params.set-default")]])]])]] :on-click handle-set-as-default} (tr "workspace.options.grid.params.set-default")]])]])])]
[:div.grid-option [:div.grid-option
[:div.grid-option-main {:style {:display (when open? "none")}} [:div.grid-option-main {:style {:display (when open? "none")}}

View file

@ -25,6 +25,7 @@
} }
.help-content { .help-content {
padding: $s-20;
.help-group { .help-group {
margin-bottom: $s-40; margin-bottom: $s-40;
.interactions-help-icon { .interactions-help-icon {

View file

@ -1389,10 +1389,6 @@
:class (stl/css-case :title-spacing-layout (not has-layout?))} :class (stl/css-case :title-spacing-layout (not has-layout?))}
(if (and (not multiple) (:layout values)) (if (and (not multiple) (:layout values))
[:div {:class (stl/css :title-actions)} [:div {:class (stl/css :title-actions)}
[:button {:class (stl/css :remove-layout)
:on-click on-remove-layout}
i/remove-refactor]
(when ^boolean grid-enabled? (when ^boolean grid-enabled?
[:* [:*
[:button {:class (stl/css :add-layout) [:button {:class (stl/css :add-layout)
@ -1402,7 +1398,11 @@
[:& dropdown {:show show-layout-dropdown? :on-close handle-close-layout-options} [:& dropdown {:show show-layout-dropdown? :on-close handle-close-layout-options}
[:div {:class (stl/css :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-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)} [:div {:class (stl/css :title-actions)}
(if ^boolean grid-enabled? (if ^boolean grid-enabled?

View file

@ -50,11 +50,21 @@
[:& layer-menu {:ids ids [:& layer-menu {:ids ids
:type type :type type
:values layer-values}] :values layer-values}]
[:& measures-menu {:ids ids [:& measures-menu {:ids ids
:type type :type type
:values measure-values :values measure-values
:shape shape}] :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?) (when (and (= (count ids) 1) is-layout-child? is-grid-parent?)
[:& grid-cell/options [:& grid-cell/options
@ -71,10 +81,6 @@
:is-grid-parent? is-grid-parent? :is-grid-parent? is-grid-parent?
:shape shape}]) :shape shape}])
(when (or (not is-layout-child?) is-layout-child-absolute?)
[:& constraints-menu {:ids ids
:values constraint-values}])
[:& fill-menu {:ids ids [:& fill-menu {:ids ids
:type type :type type
:values (select-keys shape fill-attrs)}] :values (select-keys shape fill-attrs)}]

View file

@ -52,11 +52,21 @@
[:& layer-menu {:ids ids [:& layer-menu {:ids ids
:type type :type type
:values layer-values}] :values layer-values}]
[:& measures-menu {:ids ids [:& measures-menu {:ids ids
:type type :type type
:values measure-values :values measure-values
:shape shape}] :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?) (when (and (= (count ids) 1) is-layout-child? is-grid-parent?)
[:& grid-cell/options [:& grid-cell/options
@ -72,9 +82,6 @@
:is-flex-parent? is-flex-parent? :is-flex-parent? is-flex-parent?
:is-grid-parent? is-grid-parent? :is-grid-parent? is-grid-parent?
:shape shape}]) :shape shape}])
(when (or (not is-layout-child?) is-layout-child-absolute?)
[:& constraints-menu {:ids ids
:values constraint-values}])
[:& fill-menu {:ids ids [:& fill-menu {:ids ids
:type type :type type

View file

@ -62,11 +62,18 @@
:values measure-values :values measure-values
:type type :type type
:shape shape}] :shape shape}]
[:& component-menu {:shapes [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 [:& constraints-menu {:ids ids
:values constraint-values}]) :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?) (when (and (= (count ids) 1) is-layout-child? is-grid-parent?)
[:& grid-cell/options [:& grid-cell/options

View file

@ -74,7 +74,15 @@
[:& layer-menu {:type type :ids layer-ids :values layer-values}] [:& layer-menu {:type type :ids layer-ids :values layer-values}]
[:& measures-menu {:type type :ids measure-ids :values measure-values :shape shape}] [:& measures-menu {:type type :ids measure-ids :values measure-values :shape shape}]
[:& component-menu {:shapes [shape]}] ;;remove this in components-v2 [:& 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?) (when (and (= (count ids) 1) is-layout-child? is-grid-parent?)
[:& grid-cell/options [:& grid-cell/options
@ -91,9 +99,6 @@
:is-grid-parent? is-grid-parent? :is-grid-parent? is-grid-parent?
:values layout-item-values}]) :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) (when-not (empty? fill-ids)
[:& fill-menu {:type type :ids fill-ids :values fill-values}]) [:& fill-menu {:type type :ids fill-ids :values fill-values}])

View file

@ -52,11 +52,21 @@
[:& layer-menu {:ids ids [:& layer-menu {:ids ids
:type type :type type
:values layer-values}] :values layer-values}]
[:& measures-menu {:ids ids [:& measures-menu {:ids ids
:type type :type type
:values measure-values :values measure-values
:shape shape}] :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?) (when (and (= (count ids) 1) is-layout-child? is-grid-parent?)
[:& grid-cell/options [:& grid-cell/options
@ -73,12 +83,6 @@
:is-grid-parent? is-grid-parent? :is-grid-parent? is-grid-parent?
:shape shape}]) :shape shape}])
(when (or (not is-layout-child?) is-layout-child-absolute?)
[:& constraints-menu {:ids ids
:values constraint-values}])
[:& fill-menu {:ids ids [:& fill-menu {:ids ids
:type type :type type
:values fill-values}] :values fill-values}]

View file

@ -359,8 +359,14 @@
(when-not (empty? components) (when-not (empty? components)
[:& component-menu {:shapes 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?) (when (or is-layout-child? has-flex-layout-container?)
[:& layout-item-menu [:& layout-item-menu
@ -372,9 +378,6 @@
:is-grid-parent? is-grid-parent? :is-grid-parent? is-grid-parent?
:values layout-item-values}]) :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) (when-not (empty? text-ids)
[:& ot/text-menu {:type type :ids text-ids :values text-values}]) [:& ot/text-menu {:type type :ids text-ids :values text-values}])

View file

@ -56,7 +56,16 @@
:type type :type type
:values measure-values :values measure-values
:shape shape}] :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?) (when (and (= (count ids) 1) is-layout-child? is-grid-parent?)
[:& grid-cell/options [:& grid-cell/options
@ -72,9 +81,6 @@
:is-flex-parent? is-flex-parent? :is-flex-parent? is-flex-parent?
:is-grid-parent? is-grid-parent? :is-grid-parent? is-grid-parent?
:shape shape}]) :shape shape}])
(when (or (not is-layout-child?) is-layout-child-absolute?)
[:& constraints-menu {:ids ids
:values constraint-values}])
[:& fill-menu {:ids ids [:& fill-menu {:ids ids
:type type :type type

View file

@ -59,6 +59,11 @@
:type type :type type
:values measure-values :values measure-values
:shape shape}] :shape shape}]
(when (or (not ^boolean is-layout-child?) ^boolean is-layout-child-absolute?)
[:& constraints-menu {:ids ids
:values constraint-values}])
[:& layout-container-menu [:& layout-container-menu
{:type type {:type type
:ids ids :ids ids
@ -80,13 +85,6 @@
:is-grid-parent? is-grid-parent? :is-grid-parent? is-grid-parent?
:shape shape}]) :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 [:& fill-menu {:ids ids
:type type :type type
:values fill-values}] :values fill-values}]

View file

@ -128,7 +128,16 @@
:type type :type type
:values measure-values :values measure-values
:shape shape}] :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?) (when (and (= (count ids) 1) is-layout-child? is-grid-parent?)
[:& grid-cell/options [:& grid-cell/options
@ -145,10 +154,6 @@
:is-grid-parent? is-grid-parent? :is-grid-parent? is-grid-parent?
:shape shape}]) :shape shape}])
(when (or (not is-layout-child?) is-layout-child-absolute?)
[:& constraints-menu {:ids ids
:values constraint-values}])
[:& fill-menu {:ids ids [:& fill-menu {:ids ids
:type type :type type
:values fill-values}] :values fill-values}]

View file

@ -91,12 +91,23 @@
:type type :type type
:values (select-keys shape measure-attrs) :values (select-keys shape measure-attrs)
:shape shape}] :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?) (when (and (= (count ids) 1) is-layout-child? is-grid-parent?)
[:& grid-cell/options [:& grid-cell/options
{:shape (first parents) {:shape (first parents)
:cell (ctl/get-cell-by-shape-id (first parents) (first ids))}]) :cell (ctl/get-cell-by-shape-id (first parents) (first ids))}])
(when is-layout-child? (when is-layout-child?
[:& layout-item-menu [:& layout-item-menu
{:ids ids {:ids ids
@ -107,13 +118,6 @@
:is-grid-parent? is-grid-parent? :is-grid-parent? is-grid-parent?
:shape shape}]) :shape shape}])
(when (or (not is-layout-child?) is-layout-child-absolute?)
[:& constraints-menu
{:ids ids
:values (select-keys shape constraint-attrs)}])
[:& text-menu [:& text-menu
{:ids ids {:ids ids
:type type :type type

View file

@ -69,7 +69,7 @@
selected)) selected))
(mf/defc viewport (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 (let [;; When adding data from workspace-local revisit `app.main.ui.workspace` to check
;; that the new parameter is sent ;; that the new parameter is sent
{:keys [edit-path {:keys [edit-path
@ -535,7 +535,8 @@
[:& scroll-bars/viewport-scrollbars [:& scroll-bars/viewport-scrollbars
{:objects base-objects {:objects base-objects
:zoom zoom :zoom zoom
:vbox vbox}] :vbox vbox
:bottom-padding (when palete-size (+ palete-size 8))}]
(when-not hide-ui? (when-not hide-ui?
[:& rules/rules [:& rules/rules

View file

@ -28,7 +28,7 @@
(mf/defc viewport-scrollbars (mf/defc viewport-scrollbars
{::mf/wrap [mf/memo]} {::mf/wrap [mf/memo]}
[{:keys [objects zoom vbox]}] [{:keys [objects zoom vbox bottom-padding]}]
(let [v-scrolling? (mf/use-state false) (let [v-scrolling? (mf/use-state false)
h-scrolling? (mf/use-state false) h-scrolling? (mf/use-state false)
@ -56,6 +56,11 @@
(cfh/get-immediate-children) (cfh/get-immediate-children)
(gsh/shapes->rect))) (gsh/shapes->rect)))
;; Padding for bottom palette
vbox (cond-> vbox
(some? bottom-padding)
(update :height - (/ bottom-padding zoom)))
inv-zoom (/ 1 zoom) inv-zoom (/ 1 zoom)
vbox-height (- (:height vbox) (* inv-zoom scroll-height)) vbox-height (- (:height vbox) (* inv-zoom scroll-height))
vbox-width (- (:width vbox) (* inv-zoom scroll-width)) vbox-width (- (:width vbox) (* inv-zoom scroll-width))
@ -65,6 +70,7 @@
(max 0) (max 0)
(* vbox-height) (* vbox-height)
(/ (:height base-objects-rect))) (/ (:height base-objects-rect)))
;; left space hidden because of the scroll ;; left space hidden because of the scroll
left-offset (-> (- vbox-x (:x base-objects-rect)) left-offset (-> (- vbox-x (:x base-objects-rect))
(max 0) (max 0)

View file

@ -35,9 +35,7 @@
[:& i18n/tr-html {:tag-name "span" [:& i18n/tr-html {:tag-name "span"
:label "workspace.top-bar.read-only"}]] :label "workspace.top-bar.read-only"}]]
[:button {:class (stl/css :done-btn) [:button {:class (stl/css :done-btn)
:on-click handle-close-view-mode} (tr "workspace.top-bar.read-only.done")] :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]]]
;; OLD ;; OLD
[:div.viewport-actions [:div.viewport-actions

View file

@ -22,7 +22,7 @@
margin-left: -50%; margin-left: -50%;
padding: $s-8; padding: $s-8;
pointer-events: initial; pointer-events: initial;
width: $s-512; width: $s-400;
} }
.viewport-actions-title { .viewport-actions-title {

View file

@ -7,6 +7,7 @@
(ns app.worker.thumbnails (ns app.worker.thumbnails
(:require (:require
["react-dom/server" :as rds] ["react-dom/server" :as rds]
[app.common.data.macros :as dm]
[app.common.logging :as log] [app.common.logging :as log]
[app.common.uri :as u] [app.common.uri :as u]
[app.config :as cf] [app.config :as cf]
@ -62,16 +63,27 @@
(binding [fonts/loaded-hints (l/atom #{})] (binding [fonts/loaded-hints (l/atom #{})]
(let [objects (:objects page) (let [objects (:objects page)
frame (some->> page :thumbnail-frame-id (get objects)) frame (some->> page :thumbnail-frame-id (get objects))
background-color (dm/get-in page [:options :background])
element (if frame element (if frame
(mf/element render/frame-svg #js {:objects objects :frame frame :use-thumbnails true}) (mf/element render/frame-svg #js
(mf/element render/page-svg #js {:data page :use-thumbnails true :embed true})) {: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 (rds/renderToStaticMarkup element)]
{:data data {:data data
:fonts @fonts/loaded-hints :fonts @fonts/loaded-hints
:file-id file-id :file-id file-id
:revn revn})) :revn revn}))
(catch :default cause (catch :default cause
(js/console.error "unexpected erorr on rendering thumbnail" cause) (js/console.error "unexpected error on rendering thumbnail" cause)
nil))) nil)))
(defmethod impl/handler :thumbnails/generate-for-file (defmethod impl/handler :thumbnails/generate-for-file