mirror of
https://github.com/penpot/penpot.git
synced 2025-07-18 00:17:11 +02:00
Merge pull request #6626 from penpot/niwinz-develop-fixes-4
🐛 Several bugfixes
This commit is contained in:
commit
2e0fd6ec1b
3 changed files with 19 additions and 8 deletions
|
@ -1255,8 +1255,11 @@ Will return a value that matches this schema:
|
||||||
{:type ::tokens-lib
|
{:type ::tokens-lib
|
||||||
:pred valid-tokens-lib?
|
:pred valid-tokens-lib?
|
||||||
:type-properties
|
:type-properties
|
||||||
{:encode/json export-dtcg-json
|
;; NOTE: we can't assign statically at eval time the value of a
|
||||||
:decode/json parse-multi-set-dtcg-json}}))
|
;; function that is declared but not defined; so we need to pass
|
||||||
|
;; an anonymous function and delegate the resolution to runtime
|
||||||
|
{:encode/json #(export-dtcg-json %)
|
||||||
|
:decode/json #(parse-multi-set-dtcg-json %)}}))
|
||||||
|
|
||||||
(defn duplicate-set [set-name lib & {:keys [suffix]}]
|
(defn duplicate-set [set-name lib & {:keys [suffix]}]
|
||||||
(let [sets (get-sets lib)
|
(let [sets (get-sets lib)
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
[app.plugins.register :as plugins.register]
|
[app.plugins.register :as plugins.register]
|
||||||
[app.util.i18n :as i18n :refer [tr]]
|
[app.util.i18n :as i18n :refer [tr]]
|
||||||
[app.util.storage :as storage]
|
[app.util.storage :as storage]
|
||||||
|
[app.util.theme :as theme]
|
||||||
[beicon.v2.core :as rx]
|
[beicon.v2.core :as rx]
|
||||||
[potok.v2.core :as ptk]))
|
[potok.v2.core :as ptk]))
|
||||||
|
|
||||||
|
@ -160,11 +161,12 @@
|
||||||
(update [_ state]
|
(update [_ state]
|
||||||
(update-in state [:profile :theme]
|
(update-in state [:profile :theme]
|
||||||
(fn [current]
|
(fn [current]
|
||||||
(case current
|
(let [current (if (= current "system")
|
||||||
"dark" "light"
|
(theme/get-system-theme)
|
||||||
"light" "system"
|
current)]
|
||||||
"system" "dark"
|
(case current
|
||||||
"default"))))
|
"dark" "light"
|
||||||
|
"light" "dark")))))
|
||||||
|
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [it state _]
|
(watch [it state _]
|
||||||
|
|
|
@ -16,6 +16,12 @@
|
||||||
|
|
||||||
(def ^:const default "dark")
|
(def ^:const default "dark")
|
||||||
|
|
||||||
|
(defn get-system-theme
|
||||||
|
[]
|
||||||
|
(if ^boolean (.-matches color-scheme-media-query)
|
||||||
|
"dark"
|
||||||
|
"light"))
|
||||||
|
|
||||||
(defn- set-color-scheme
|
(defn- set-color-scheme
|
||||||
[^string color]
|
[^string color]
|
||||||
|
|
||||||
|
@ -26,7 +32,7 @@
|
||||||
|
|
||||||
(defn use-initialize
|
(defn use-initialize
|
||||||
[{profile-theme :theme}]
|
[{profile-theme :theme}]
|
||||||
(let [system-theme* (mf/use-state #(if (.-matches color-scheme-media-query) "dark" "light"))
|
(let [system-theme* (mf/use-state get-system-theme)
|
||||||
system-theme (deref system-theme*)]
|
system-theme (deref system-theme*)]
|
||||||
|
|
||||||
(mf/with-effect []
|
(mf/with-effect []
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue