Merge remote-tracking branch 'origin/staging' into develop

This commit is contained in:
Andrey Antukh 2022-01-21 14:54:32 +01:00
commit 9a965dc693
8 changed files with 167 additions and 213 deletions

View file

@ -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 _ _]

View file

@ -14,7 +14,7 @@
(defn parse
[data]
(cond
(= data "%version%")
(str/starts-with? data "%")
{:full "develop"
:branch "develop"
:base "0.0.0"

View file

@ -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);
}

View file

@ -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)

View file

@ -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}]

View file

@ -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
[]

View file

@ -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"
@ -2109,6 +2109,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"
@ -2126,32 +2130,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"
@ -2363,10 +2363,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"
@ -2845,6 +2841,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"

View file

@ -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"
@ -2124,6 +2124,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"
@ -2141,32 +2145,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"
@ -2378,10 +2378,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"
@ -2858,6 +2854,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"