From 8e4338c1c91d40ea5412476df9eeaed116316caa Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 20 Jan 2022 14:47:28 +0100 Subject: [PATCH 1/5] :bug: Minor fix on version parsing impl. --- common/src/app/common/version.cljc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/app/common/version.cljc b/common/src/app/common/version.cljc index cb79885cf..348052c40 100644 --- a/common/src/app/common/version.cljc +++ b/common/src/app/common/version.cljc @@ -14,7 +14,7 @@ (defn parse [data] (cond - (= data "%version%") + (str/starts-with? data "%") {:full "develop" :branch "develop" :base "0.0.0" From ff4d3cfeac5acebb483f9fe59ad7002b2afb3a2d Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 20 Jan 2022 16:57:20 +0100 Subject: [PATCH 2/5] :bug: Fix issue on fressian blob encoding. --- backend/src/app/util/fressian.clj | 36 +++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/backend/src/app/util/fressian.clj b/backend/src/app/util/fressian.clj index 08a7b5cf7..d81c92db2 100644 --- a/backend/src/app/util/fressian.clj +++ b/backend/src/app/util/fressian.clj @@ -10,16 +10,18 @@ [app.common.geom.point :as gpt] [clojure.data.fressian :as fres]) (:import - clojure.lang.Ratio - org.fressian.handlers.WriteHandler - org.fressian.handlers.ReadHandler - org.fressian.Writer - org.fressian.Reader - org.fressian.StreamingWriter app.common.geom.matrix.Matrix app.common.geom.point.Point + clojure.lang.Ratio java.io.ByteArrayInputStream - java.io.ByteArrayOutputStream)) + java.io.ByteArrayOutputStream + java.time.Instant + java.time.OffsetDateTime + org.fressian.Reader + org.fressian.StreamingWriter + org.fressian.Writer + org.fressian.handlers.ReadHandler + org.fressian.handlers.WriteHandler)) ;; --- MISC @@ -92,6 +94,20 @@ (.-e ^Matrix o) (.-f ^Matrix o)))))} + Instant + {"java/instant" + (reify WriteHandler + (write [_ w ch] + (.writeTag w "java/instant" 1) + (.writeInt w (.toEpochMilli ^Instant ch))))} + + OffsetDateTime + {"java/instant" + (reify WriteHandler + (write [_ w ch] + (.writeTag w "java/instant" 1) + (.writeInt w (.toEpochMilli ^Instant (.toInstant ^OffsetDateTime ch)))))} + Ratio {"ratio" (reify WriteHandler @@ -181,6 +197,12 @@ (read [_ rdr _ _] (char (.readObject rdr)))) + "java/instant" + (reify ReadHandler + (read [_ rdr _ _] + (Instant/ofEpochMilli (.readInt rdr)))) + + "clj/ratio" (reify ReadHandler (read [_ rdr _ _] From 7385445aa8265f96a4393d20cacff724eb14c549 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Moya?= Date: Wed, 19 Jan 2022 11:50:18 +0100 Subject: [PATCH 3/5] :lipstick: Format translation files and remove unneeded script --- frontend/scripts/convert-to-po.js | 73 ------------------------------- frontend/translations/en.po | 46 +++++++++---------- frontend/translations/es.po | 46 +++++++++---------- 3 files changed, 46 insertions(+), 119 deletions(-) delete mode 100644 frontend/scripts/convert-to-po.js diff --git a/frontend/scripts/convert-to-po.js b/frontend/scripts/convert-to-po.js deleted file mode 100644 index ce94089c8..000000000 --- a/frontend/scripts/convert-to-po.js +++ /dev/null @@ -1,73 +0,0 @@ -const l = require("lodash"); -const fs = require("fs"); -const gt = require("gettext-parser"); - -function generateLang(data, lang) { - let output = {}; - - for (let key of Object.keys(data)) { - const trObj = data[key]; - const trRef = trObj["used-in"]; - - let content = trObj.translations[lang]; - let comments = {}; - - if (l.isNil(content)) { - continue; - } else { - let result = { - msgid: key, - comments: {} - } - - if (l.isArray(trRef)) { - result.comments.reference = trRef.join(", "); - } - - if (trObj.permanent) { - result.comments.flag = "permanent"; - } - - if (l.isArray(content)) { - result.msgid_plural = key; - result.msgstr = content; - } else if (l.isString(content)) { - result.msgstr = [content]; - } else { - throw new Error("unexpected"); - } - - output[key] = result; - } - } - - if (lang.includes("_")) { - const [a, b] = lang.split("_"); - lang = `${a}_${b.toUpperCase()}`; - } - - const poData = { - charset: "utf-8", - headers: { - "Language": lang, - "MIME-Version": "1.0", - "Content-Type": "text/plain; charset=UTF-8", - "Content-Transfer-Encoding": "8bit", - "Plural-Forms": "nplurals=2; plural=(n != 1);" - }, - "translations": { - "": output - } - } - const buff = gt.po.compile(poData, {sort: true}); - fs.writeFileSync(`./translations/${lang}.po`, buff); -} - -const content = fs.readFileSync("./resources/locales.json"); -const data = JSON.parse(content); -const langs = ["de"]; - -for (let lang of langs) { - generateLang(data, lang); -} - diff --git a/frontend/translations/en.po b/frontend/translations/en.po index 0778497b5..2def1cd26 100644 --- a/frontend/translations/en.po +++ b/frontend/translations/en.po @@ -925,6 +925,9 @@ msgstr "Code" msgid "handoff.tabs.code.selected.circle" msgstr "Circle" +msgid "handoff.tabs.code.selected.component" +msgstr "Component" + msgid "handoff.tabs.code.selected.curve" msgstr "Curve" @@ -937,9 +940,6 @@ msgstr "Group" msgid "handoff.tabs.code.selected.image" msgstr "Image" -msgid "handoff.tabs.code.selected.component" -msgstr "Component" - msgid "handoff.tabs.code.selected.mask" msgstr "Mask" @@ -2085,6 +2085,10 @@ msgstr "Show color palette" msgid "workspace.header.menu.show-rules" msgstr "Show rules" +#: src/app/main/ui/workspace/header.cljs +msgid "workspace.header.reset-zoom" +msgstr "Reset" + #: src/app/main/ui/workspace/header.cljs msgid "workspace.header.save-error" msgstr "Error on saving" @@ -2102,32 +2106,28 @@ msgid "workspace.header.unsaved" msgstr "Unsaved changes" #: src/app/main/ui/workspace/header.cljs -msgid "workspace.header.reset-zoom" -msgstr "Reset" - -#: src/app/main/ui/workspace/header.cljs -msgid "workspace.header.zoom-fit-all" -msgstr "Zoom to fil all" - -#: src/app/main/ui/workspace/header.cljs -msgid "workspace.header.zoom-selected" -msgstr "Zoom to selected" - -#: src/app/main/ui/workspace/header.cljs -msgid "workspace.header.zoom-fit" -msgstr "Fit - Scale down to fit" +msgid "workspace.header.viewer" +msgstr "View mode (%s)" #: src/app/main/ui/workspace/header.cljs msgid "workspace.header.zoom-fill" msgstr "Fill -Scale to fill" +#: src/app/main/ui/workspace/header.cljs +msgid "workspace.header.zoom-fit" +msgstr "Fit - Scale down to fit" + +#: src/app/main/ui/workspace/header.cljs +msgid "workspace.header.zoom-fit-all" +msgstr "Zoom to fil all" + #: src/app/main/ui/workspace/header.cljs msgid "workspace.header.zoom-full-screen" msgstr "Full screen" #: src/app/main/ui/workspace/header.cljs -msgid "workspace.header.viewer" -msgstr "View mode (%s)" +msgid "workspace.header.zoom-selected" +msgstr "Zoom to selected" #: src/app/main/ui/workspace/libraries.cljs msgid "workspace.libraries.add" @@ -2339,10 +2339,6 @@ msgstr "Exporting…" msgid "workspace.options.fill" msgstr "Fill" -#: src/app/main/ui/workspace/sidebar/options/menus/fill.cljs -msgid "workspace.options.show-fill-on-export" -msgstr "Show in exports" - #: src/app/main/ui/workspace/sidebar/options/menus/interactions.cljs msgid "workspace.options.flows.add-flow-start" msgstr "Add flow start" @@ -2821,6 +2817,10 @@ msgstr "Group shadow" msgid "workspace.options.shadow-options.title.multiple" msgstr "Selection shadows" +#: src/app/main/ui/workspace/sidebar/options/menus/fill.cljs +msgid "workspace.options.show-fill-on-export" +msgstr "Show in exports" + #: src/app/main/ui/workspace/sidebar/options/shapes/frame.cljs, src/app/main/ui/workspace/sidebar/options/menus/measures.cljs msgid "workspace.options.size" msgstr "Size" diff --git a/frontend/translations/es.po b/frontend/translations/es.po index 154b27447..56b3340a4 100644 --- a/frontend/translations/es.po +++ b/frontend/translations/es.po @@ -926,6 +926,9 @@ msgstr "Código" msgid "handoff.tabs.code.selected.circle" msgstr "Círculo" +msgid "handoff.tabs.code.selected.component" +msgstr "Componente" + msgid "handoff.tabs.code.selected.curve" msgstr "Curva" @@ -938,9 +941,6 @@ msgstr "Grupo" msgid "handoff.tabs.code.selected.image" msgstr "Imagen" -msgid "handoff.tabs.code.selected.component" -msgstr "Componente" - msgid "handoff.tabs.code.selected.mask" msgstr "Máscara" @@ -2100,6 +2100,10 @@ msgstr "Mostrar paleta de colores" msgid "workspace.header.menu.show-rules" msgstr "Mostrar reglas" +#: src/app/main/ui/workspace/header.cljs +msgid "workspace.header.reset-zoom" +msgstr "Restablecer" + #: src/app/main/ui/workspace/header.cljs msgid "workspace.header.save-error" msgstr "Error al guardar" @@ -2117,32 +2121,28 @@ msgid "workspace.header.unsaved" msgstr "Cambios sin guardar" #: src/app/main/ui/workspace/header.cljs -msgid "workspace.header.reset-zoom" -msgstr "Restablecer" - -#: src/app/main/ui/workspace/header.cljs -msgid "workspace.header.zoom-fit-all" -msgstr "Zoom abarcar todo" - -#: src/app/main/ui/workspace/header.cljs -msgid "workspace.header.zoom-selected" -msgstr "Zoom a selección" - -#: src/app/main/ui/workspace/header.cljs -msgid "workspace.header.zoom-fit" -msgstr "Escalar para ajustar" +msgid "workspace.header.viewer" +msgstr "Modo de visualización (%s)" #: src/app/main/ui/workspace/header.cljs msgid "workspace.header.zoom-fill" msgstr "Escalar para rellenar" +#: src/app/main/ui/workspace/header.cljs +msgid "workspace.header.zoom-fit" +msgstr "Escalar para ajustar" + +#: src/app/main/ui/workspace/header.cljs +msgid "workspace.header.zoom-fit-all" +msgstr "Zoom abarcar todo" + #: src/app/main/ui/workspace/header.cljs msgid "workspace.header.zoom-full-screen" msgstr "Pantalla completa" #: src/app/main/ui/workspace/header.cljs -msgid "workspace.header.viewer" -msgstr "Modo de visualización (%s)" +msgid "workspace.header.zoom-selected" +msgstr "Zoom a selección" #: src/app/main/ui/workspace/libraries.cljs msgid "workspace.libraries.add" @@ -2354,10 +2354,6 @@ msgstr "Exportando" msgid "workspace.options.fill" msgstr "Relleno" -#: src/app/main/ui/workspace/sidebar/options/menus/fill.cljs -msgid "workspace.options.show-fill-on-export" -msgstr "Mostrar al exportar" - #: src/app/main/ui/workspace/sidebar/options/menus/interactions.cljs msgid "workspace.options.flows.add-flow-start" msgstr "Añadir inicio de flujo" @@ -2834,6 +2830,10 @@ msgstr "Sombra del grupo" msgid "workspace.options.shadow-options.title.multiple" msgstr "Sombras de la seleccíón" +#: src/app/main/ui/workspace/sidebar/options/menus/fill.cljs +msgid "workspace.options.show-fill-on-export" +msgstr "Mostrar al exportar" + #: src/app/main/ui/workspace/sidebar/options/shapes/frame.cljs, src/app/main/ui/workspace/sidebar/options/menus/measures.cljs msgid "workspace.options.size" msgstr "Tamaño" From b4c23f3554cffa5e56a5d8eb6bdc00d869622cb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Moya?= Date: Fri, 21 Jan 2022 12:04:23 +0100 Subject: [PATCH 4/5] :bug: Display animations only for allowed actions --- .../sidebar/options/menus/interactions.cljs | 170 +++++++++--------- 1 file changed, 86 insertions(+), 84 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/interactions.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/interactions.cljs index 29988793e..f704ce715 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/interactions.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/interactions.cljs @@ -433,95 +433,97 @@ [:label {:for (str "background-" index)} (tr "workspace.options.interaction-background")]]]]) - ; Animation select - [:div.interactions-element.separator - [:span.element-set-subtitle.wide (tr "workspace.options.interaction-animation")] - [:select.input-select - {:value (str (-> interaction :animation :animation-type)) - :on-change change-animation-type} - [:option {:value ""} (tr "workspace.options.interaction-animation-none")] - (for [[value name] (animation-type-names interaction)] - [:option {:value (str value)} name])]] + (when (cti/has-animation? interaction) + [:* + ; Animation select + [:div.interactions-element.separator + [:span.element-set-subtitle.wide (tr "workspace.options.interaction-animation")] + [:select.input-select + {:value (str (-> interaction :animation :animation-type)) + :on-change change-animation-type} + [:option {:value ""} (tr "workspace.options.interaction-animation-none")] + (for [[value name] (animation-type-names interaction)] + [:option {:value (str value)} name])]] - ; Direction - (when (cti/has-way? interaction) - [:div.interactions-element.interactions-way-buttons - [:div.input-radio - [:input {:type "radio" - :id "way-in" - :checked (= :in way) - :name "animation-way" - :value ":in" - :on-change change-way}] - [:label {:for "way-in"} (tr "workspace.options.interaction-in")]] - [:div.input-radio - [:input {:type "radio" - :id "way-out" - :checked (= :out way) - :name "animation-way" - :value ":out" - :on-change change-way}] - [:label {:for "way-out"} (tr "workspace.options.interaction-out")]]]) + ; Direction + (when (cti/has-way? interaction) + [:div.interactions-element.interactions-way-buttons + [:div.input-radio + [:input {:type "radio" + :id "way-in" + :checked (= :in way) + :name "animation-way" + :value ":in" + :on-change change-way}] + [:label {:for "way-in"} (tr "workspace.options.interaction-in")]] + [:div.input-radio + [:input {:type "radio" + :id "way-out" + :checked (= :out way) + :name "animation-way" + :value ":out" + :on-change change-way}] + [:label {:for "way-out"} (tr "workspace.options.interaction-out")]]]) - ; Direction - (when (cti/has-direction? interaction) - [:div.interactions-element.interactions-direction-buttons - [:div.element-set-actions-button - {:class (dom/classnames :active (= direction :right)) - :on-click #(change-direction :right)} - i/animate-right] - [:div.element-set-actions-button - {:class (dom/classnames :active (= direction :down)) - :on-click #(change-direction :down)} - i/animate-down] - [:div.element-set-actions-button - {:class (dom/classnames :active (= direction :left)) - :on-click #(change-direction :left)} - i/animate-left] - [:div.element-set-actions-button - {:class (dom/classnames :active (= direction :up)) - :on-click #(change-direction :up)} - i/animate-up]]) + ; Direction + (when (cti/has-direction? interaction) + [:div.interactions-element.interactions-direction-buttons + [:div.element-set-actions-button + {:class (dom/classnames :active (= direction :right)) + :on-click #(change-direction :right)} + i/animate-right] + [:div.element-set-actions-button + {:class (dom/classnames :active (= direction :down)) + :on-click #(change-direction :down)} + i/animate-down] + [:div.element-set-actions-button + {:class (dom/classnames :active (= direction :left)) + :on-click #(change-direction :left)} + i/animate-left] + [:div.element-set-actions-button + {:class (dom/classnames :active (= direction :up)) + :on-click #(change-direction :up)} + i/animate-up]]) - ; Duration - (when (cti/has-duration? interaction) - [:div.interactions-element - [:span.element-set-subtitle.wide (tr "workspace.options.interaction-duration")] - [:div.input-element {:title (tr "workspace.options.interaction-ms")} - [:> numeric-input {:ref ext-duration-ref - :on-click (select-text ext-duration-ref) - :on-change change-duration - :value (-> interaction :animation :duration) - :title (tr "workspace.options.interaction-ms")}] - [:span.after (tr "workspace.options.interaction-ms")]]]) + ; Duration + (when (cti/has-duration? interaction) + [:div.interactions-element + [:span.element-set-subtitle.wide (tr "workspace.options.interaction-duration")] + [:div.input-element {:title (tr "workspace.options.interaction-ms")} + [:> numeric-input {:ref ext-duration-ref + :on-click (select-text ext-duration-ref) + :on-change change-duration + :value (-> interaction :animation :duration) + :title (tr "workspace.options.interaction-ms")}] + [:span.after (tr "workspace.options.interaction-ms")]]]) - ; Easing - (when (cti/has-easing? interaction) - [:div.interactions-element - [:span.element-set-subtitle.wide (tr "workspace.options.interaction-easing")] - [:select.input-select - {:value (str (-> interaction :animation :easing)) - :on-change change-easing} - (for [[value name] (easing-names)] - [:option {:value (str value)} name])] - [:div.interactions-easing-icon - (case (-> interaction :animation :easing) - :linear i/easing-linear - :ease i/easing-ease - :ease-in i/easing-ease-in - :ease-out i/easing-ease-out - :ease-in-out i/easing-ease-in-out)]]) + ; Easing + (when (cti/has-easing? interaction) + [:div.interactions-element + [:span.element-set-subtitle.wide (tr "workspace.options.interaction-easing")] + [:select.input-select + {:value (str (-> interaction :animation :easing)) + :on-change change-easing} + (for [[value name] (easing-names)] + [:option {:value (str value)} name])] + [:div.interactions-easing-icon + (case (-> interaction :animation :easing) + :linear i/easing-linear + :ease i/easing-ease + :ease-in i/easing-ease-in + :ease-out i/easing-ease-out + :ease-in-out i/easing-ease-in-out)]]) - ; Offset effect - (when (cti/has-offset-effect? interaction) - [:div.interactions-element - [:div.input-checkbox - [:input {:type "checkbox" - :id (str "offset-effect-" index) - :checked (-> interaction :animation :offset-effect) - :on-change change-offset-effect}] - [:label {:for (str "offset-effect-" index)} - (tr "workspace.options.interaction-offset-effect")]]])])]])) + ; Offset effect + (when (cti/has-offset-effect? interaction) + [:div.interactions-element + [:div.input-checkbox + [:input {:type "checkbox" + :id (str "offset-effect-" index) + :checked (-> interaction :animation :offset-effect) + :on-change change-offset-effect}] + [:label {:for (str "offset-effect-" index)} + (tr "workspace.options.interaction-offset-effect")]]])])])]])) (mf/defc interactions-menu [{:keys [shape] :as props}] From 5641132eb96a4f1380e70cf0a1aa12bbe2630688 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Moya?= Date: Fri, 21 Jan 2022 13:18:28 +0100 Subject: [PATCH 5/5] :sparkles: Reload viewer and reset starting frame from workspace --- frontend/src/app/main/ui/viewer.cljs | 3 ++- frontend/src/app/util/dom.cljs | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/main/ui/viewer.cljs b/frontend/src/app/main/ui/viewer.cljs index ea1fedd09..068162b05 100644 --- a/frontend/src/app/main/ui/viewer.cljs +++ b/frontend/src/app/main/ui/viewer.cljs @@ -242,7 +242,8 @@ (nil? frame) [:section.empty-state - [:span (tr "viewer.frame-not-found")]] + (when (some? index) + [:span (tr "viewer.frame-not-found")])] (some? frame) (if (= :handoff section) diff --git a/frontend/src/app/util/dom.cljs b/frontend/src/app/util/dom.cljs index 682a1963b..37e75d1a9 100644 --- a/frontend/src/app/util/dom.cljs +++ b/frontend/src/app/util/dom.cljs @@ -478,7 +478,9 @@ ([uri name] (open-new-window uri name "noopener,noreferrer")) ([uri name features] - (.open js/window (str uri) name features))) + (let [new-window (.open js/window (str uri) name features)] + (when (not= name "_blank") + (.reload (.-location new-window)))))) (defn browser-back []