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

This commit is contained in:
Andrey Antukh 2026-06-04 19:01:54 +02:00
commit 9911ff7959
8 changed files with 90 additions and 60 deletions

View File

@ -171,3 +171,20 @@
(t/is (= candidate-2 (encode-j expected)))))
(t/deftest test-boolean
(let [decode-s (sm/decoder ::sm/boolean sm/string-transformer)]
(t/is (= true (decode-s "true")))
(t/is (= true (decode-s "True")))
(t/is (= true (decode-s "TrUe")))
(t/is (= true (decode-s "TRUE")))
(t/is (= false (decode-s "false")))
(t/is (= false (decode-s "False")))
(t/is (= false (decode-s "fAlSe")))
(t/is (= false (decode-s "FALSE")))
(t/is (= true (decode-s "T")))
(t/is (= false (decode-s "F")))
(t/is (= true (decode-s "t")))
(t/is (= false (decode-s "f")))
(t/is (= true (decode-s "1")))
(t/is (= false (decode-s "0")))))

View File

@ -109,6 +109,7 @@ services:
<< : [*penpot-flags, *penpot-http-body-size, *penpot-public-uri]
# Set to "true" on hosts where IPv6 is disabled at kernel boot level.
# PENPOT_DISABLE_IPV6_LISTEN: "true"
penpot-backend:
image: "penpotapp/backend:${PENPOT_VERSION:-2.15}"
restart: always
@ -161,7 +162,7 @@ services:
## based on real scenarios. If you want to help us, please leave it enabled. You can
## audit what data we send with the code available on github.
PENPOT_TELEMETRY_ENABLED: true
PENPOT_TELEMETRY_ENABLED: "true"
PENPOT_TELEMETRY_REFERER: compose
## Example SMTP/Email configuration. By default, emails are sent to the mailcatch
@ -175,8 +176,8 @@ services:
PENPOT_SMTP_PORT: 1025
PENPOT_SMTP_USERNAME:
PENPOT_SMTP_PASSWORD:
PENPOT_SMTP_TLS: false
PENPOT_SMTP_SSL: false
PENPOT_SMTP_TLS: "false"
PENPOT_SMTP_SSL: "false"
penpot-mcp:
image: "penpotapp/mcp:${PENPOT_VERSION:-2.15}"

View File

@ -1,5 +1,16 @@
#!/usr/bin/env bash
is_truthy() {
local value="${1,,}"
[[ "$value" == "true" || "$value" == "t" || "$value" == "1" ]]
}
is_falsy() {
local value="${1,,}"
[[ "$value" == "false" || "$value" == "f" || "$value" == "0" ]]
}
#########################################
## Air Gapped config
#########################################
@ -45,7 +56,7 @@ export PENPOT_EXPORTER_URI=${PENPOT_EXPORTER_URI:-http://penpot-exporter:6061}
export PENPOT_NITRATE_URI=${PENPOT_NITRATE_URI:-http://penpot-nitrate:3000}
export PENPOT_HTTP_SERVER_MAX_BODY_SIZE=${PENPOT_HTTP_SERVER_MAX_BODY_SIZE:-367001600} # Default to 350MiB
export PENPOT_IPV6_LISTEN_DIRECTIVE=${PENPOT_IPV6_LISTEN_DIRECTIVE:-"listen [::]:8080 default_server reuseport backlog=16384;"}
if [ "${PENPOT_DISABLE_IPV6_LISTEN}" = "true" ]; then
if is_truthy "${PENPOT_DISABLE_IPV6_LISTEN:-}"; then
export PENPOT_IPV6_LISTEN_DIRECTIVE=""
fi
envsubst "\$PENPOT_BACKEND_URI,\$PENPOT_EXPORTER_URI,\$PENPOT_NITRATE_URI,\$PENPOT_HTTP_SERVER_MAX_BODY_SIZE,\$PENPOT_IPV6_LISTEN_DIRECTIVE" \

View File

@ -1,27 +0,0 @@
server {
listen 8080 default_server;
server_name _;
charset utf-8;
etag off;
gzip on;
gzip_static on;
gzip_types text/plain text/css application/javascript application/json application/vnd.api+json application/xml application/x-javascript text/xml image/svg+xml;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_vary on;
error_log /dev/stderr;
access_log /dev/stdout;
root /var/www;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}

View File

@ -302,36 +302,38 @@
{:errors [(wte/error-with-value :error.style-dictionary/invalid-token-value-typography value)]}
:else
(let [converted (js->clj value :keywordize-keys true)
add-keyed-errors (fn [typography-map k errors]
(update typography-map :errors concat (map #(assoc % :typography-key k) errors)))
;; Separate line-height to process in an extra step
without-line-height (dissoc converted :line-height)
valid-typography (reduce
(fn [acc [k v]]
(let [{:keys [errors value]} (parse-atomic-typography-value k v)]
(if (seq errors)
(add-keyed-errors acc k errors)
(assoc-in acc [:value k] (or value v)))))
{:value {}}
without-line-height)
(let [converted (js->clj value :keywordize-keys true)]
(if-not (map? converted)
{:errors [(wte/error-with-value :error.style-dictionary/invalid-token-value-typography value)]}
(let [add-keyed-errors (fn [typography-map k errors]
(update typography-map :errors concat (map #(assoc % :typography-key k) errors)))
;; Separate line-height to process in an extra step
without-line-height (dissoc converted :line-height)
valid-typography (reduce
(fn [acc [k v]]
(let [{:keys [errors value]} (parse-atomic-typography-value k v)]
(if (seq errors)
(add-keyed-errors acc k errors)
(assoc-in acc [:value k] (or value v)))))
{:value {}}
without-line-height)
;; Calculate line-height based on the resolved font-size and add it back to the map
line-height (when-let [line-height (:line-height converted)]
(-> (parse-sd-token-typography-line-height
line-height
(get-in valid-typography [:value :font-size])
(get-in valid-typography [:errors :font-size]))))
valid-typography (cond
(:errors line-height)
(add-keyed-errors valid-typography :line-height (:errors line-height))
;; Calculate line-height based on the resolved font-size and add it back to the map
line-height (when-let [line-height (:line-height converted)]
(-> (parse-sd-token-typography-line-height
line-height
(get-in valid-typography [:value :font-size])
(get-in valid-typography [:errors :font-size]))))
valid-typography (cond
(:errors line-height)
(add-keyed-errors valid-typography :line-height (:errors line-height))
line-height
(assoc-in valid-typography [:value :line-height] line-height)
line-height
(assoc-in valid-typography [:value :line-height] line-height)
:else
valid-typography)]
valid-typography))))
:else
valid-typography)]
valid-typography))))))
(defn collect-typography-errors [token]
(group-by :typography-key (:errors token)))

View File

@ -63,7 +63,7 @@
;; Ensure it's always enabled whenever render-wasm/v1 is active.
(if (contains? features "render-wasm/v1")
(conj features "text-editor/v2")
(disj features "text-editor/v2"))))
(disj features "text-editor/v2" "text-editor-wasm/v1"))))
(defn get-enabled-features
"An explicit lookup of enabled features for the current team"

View File

@ -14,7 +14,8 @@
(defn dom->cljs
"Gets the editor content from a DOM structure"
[root]
(fd/create-root root))
(when (some? root)
(fd/create-root root)))
(defn cljs->dom
"Sets the editor content from a CLJS structure"

View File

@ -97,6 +97,31 @@
(-> errors first :error/code)))))
(done))))))))
;; Regression: a composite typography token whose value is a plain
;; array (e.g. ["Roboto"]) instead of a map must not crash with
;; "No protocol method IMap.-dissoc defined for type object".
;; It should return an invalid-token-value-typography error instead.
(t/deftest resolve-tokens-typography-array-value-test
(t/async
done
(t/testing "typography token with array value produces error instead of crashing"
(let [tokens (-> (ctob/make-tokens-lib)
(ctob/add-set (ctob/make-token-set :id (cthi/new-id! :core-set)
:name "core"))
(ctob/add-token (cthi/id :core-set)
(ctob/make-token {:name "typography.bad"
:value ["Roboto"]
:type :typography}))
(ctob/get-all-tokens-map))]
(-> (sd/resolve-tokens tokens)
(rx/sub!
(fn [resolved-tokens]
(t/is (contains? resolved-tokens "typography.bad"))
(t/is (nil? (get-in resolved-tokens ["typography.bad" :resolved-value])))
(t/is (= :error.style-dictionary/invalid-token-value-typography
(get-in resolved-tokens ["typography.bad" :errors 0 :error/code])))
(done))))))))
(t/deftest resolve-tokens-interactive-test
(t/async
done