Compare commits

..

1 Commits

Author SHA1 Message Date
Andrey Antukh
5c4c066b82 Add better error report on wrong input on logging helpers 2026-02-18 17:12:50 +01:00
5 changed files with 22 additions and 31 deletions

View File

@@ -128,7 +128,9 @@
:warn "#f5871f"
:info "#4271ae"
:debug "#969896"
:trace "#8e908c"))
:trace "#8e908c"
(let [hint (str "invalid level provided to `level->color` function: " (pr-str level))]
(throw (ex-info hint {:level level})))))
(defn- level->name
[level]
@@ -137,7 +139,9 @@
:trace "TRC"
:info "INF"
:warn "WRN"
:error "ERR"))
:error "ERR"
(let [hint (str "invalid level provided to `level->name` function: " (pr-str level))]
(throw (ex-info hint {:level level})))))
(defn level->int
[level]
@@ -146,7 +150,9 @@
:debug 20
:info 30
:warn 40
:error 50))
:error 50
(let [hint (str "invalid level provided to `level->int` function: " (pr-str level))]
(throw (ex-info hint {:level level})))))
(defn build-message
[props]

View File

@@ -50,7 +50,6 @@ services:
- 4400:4400
- 4401:4401
- 4402:4402
- 4403:4403
# Plugins
- 4200:4200

View File

@@ -27,7 +27,6 @@
[app.main.data.workspace.media :as dwm]
[app.main.data.workspace.selection :as dws]
[app.main.data.workspace.wasm-text :as dwwt]
[app.main.features :as features]
[app.main.fonts :refer [fetch-font-css]]
[app.main.router :as rt]
[app.main.store :as st]
@@ -366,10 +365,8 @@
(cb/add-object shape))]
(st/emit! (ch/commit-changes changes)
(se/event plugin-id "create-shape" :type :text))
(when (features/active-feature? @st/state "render-wasm/v1")
(st/emit! (dwwt/resize-wasm-text-debounce (:id shape))))
(se/event plugin-id "create-shape" :type :text)
(dwwt/resize-wasm-text-debounce (:id shape)))
(shape/shape-proxy plugin-id (:id shape)))))

View File

@@ -1305,8 +1305,7 @@
tokens)))}
:applyToken
{:enumerable false
:schema [:tuple
{:schema [:tuple
[:fn token-proxy?]
[:maybe [:set [:and ::sm/keyword [:fn cto/token-attr?]]]]]
:fn (fn [token attrs]

View File

@@ -144,16 +144,14 @@
(st/emit! (dwtl/delete-token set-id id)))
:applyToShapes
{:enumerable false
:schema [:tuple
{:schema [:tuple
[:vector [:fn shape-proxy?]]
[:maybe [:set [:and ::sm/keyword [:fn cto/token-attr?]]]]]
:fn (fn [shapes attrs]
(apply-token-to-shapes file-id set-id id (map #(obj/get % "$id") shapes) attrs))}
:applyToSelected
{:enumerable false
:schema [:tuple [:maybe [:set [:and ::sm/keyword [:fn cto/token-attr?]]]]]
{:schema [:tuple [:maybe [:set [:and ::sm/keyword [:fn cto/token-attr?]]]]]
:fn (fn [attrs]
(let [selected (get-in @st/state [:workspace-local :selected])]
(apply-token-to-shapes file-id set-id id selected attrs)))}))
@@ -238,16 +236,14 @@
(apply array))))}
:getTokenById
{:enumerable false
:schema [:tuple ::sm/uuid]
{:schema [:tuple ::sm/uuid]
:fn (fn [token-id]
(let [token (u/locate-token file-id id token-id)]
(when (some? token)
(token-proxy plugin-id file-id id token-id))))}
:addToken
{:enumerable false
:schema (fn [args]
{:schema (fn [args]
[:tuple (-> (cfo/make-token-schema
(-> (u/locate-tokens-lib file-id) (ctob/get-tokens id))
(cto/dtcg-token-type->token-type (-> args (first) (get "type"))))
@@ -357,15 +353,13 @@
{:this true :get (fn [_])}
:addSet
{:enumerable false
:schema [:tuple [:fn token-set-proxy?]]
{:schema [:tuple [:fn token-set-proxy?]]
:fn (fn [token-set]
(let [theme (u/locate-token-theme file-id id)]
(st/emit! (dwtl/update-token-theme id (ctob/enable-set theme (obj/get token-set :name))))))}
:removeSet
{:enumerable false
:schema [:tuple [:fn token-set-proxy?]]
{:schema [:tuple [:fn token-set-proxy?]]
:fn (fn [token-set]
(let [theme (u/locate-token-theme file-id id)]
(st/emit! (dwtl/update-token-theme id (ctob/disable-set theme (obj/get token-set :name))))))}
@@ -412,8 +406,7 @@
(apply array (map #(token-set-proxy plugin-id file-id (ctob/get-id %)) sets))))}
:addTheme
{:enumerable false
:schema (fn [attrs]
{:schema (fn [attrs]
[:tuple (-> (sm/schema (cfo/make-token-theme-schema
(u/locate-tokens-lib file-id)
(or (obj/get attrs "group") "")
@@ -426,8 +419,7 @@
(token-theme-proxy plugin-id file-id (:id theme))))}
:addSet
{:enumerable false
:schema [:tuple (-> (sm/schema (cfo/make-token-set-schema
{:schema [:tuple (-> (sm/schema (cfo/make-token-set-schema
(u/locate-tokens-lib file-id)
nil))
(sm/dissoc-key :id))] ;; We don't allow plugins to set the id
@@ -439,16 +431,14 @@
(token-set-proxy plugin-id file-id (ctob/get-id set))))}
:getThemeById
{:enumerable false
:schema [:tuple ::sm/uuid]
{:schema [:tuple ::sm/uuid]
:fn (fn [theme-id]
(let [theme (u/locate-token-theme file-id theme-id)]
(when (some? theme)
(token-theme-proxy plugin-id file-id theme-id))))}
:getSetById
{:enumerable false
:schema [:tuple ::sm/uuid]
{:schema [:tuple ::sm/uuid]
:fn (fn [set-id]
(let [set (u/locate-token-set file-id set-id)]
(when (some? set)