mirror of
https://github.com/penpot/penpot.git
synced 2025-06-01 04:41:40 +02:00
Merge pull request #5077 from penpot/ladybenko-8638-docker-rust
Set up devenv for Rust
This commit is contained in:
commit
2dea0b52ed
12 changed files with 518 additions and 1 deletions
|
@ -74,6 +74,7 @@
|
|||
[app.main.repo :as rp]
|
||||
[app.main.streams :as ms]
|
||||
[app.main.worker :as uw]
|
||||
[app.renderer-v2 :as renderer]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.globals :as ug]
|
||||
[app.util.http :as http]
|
||||
|
@ -352,6 +353,9 @@
|
|||
(dcm/retrieve-comment-threads file-id)
|
||||
(fetch-bundle project-id file-id))
|
||||
|
||||
(when (contains? cf/flags :renderer-v2)
|
||||
(rx/of (renderer/init)))
|
||||
|
||||
(->> stream
|
||||
(rx/filter dch/commit?)
|
||||
(rx/map deref)
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
(:require-macros [app.main.style :as stl])
|
||||
(:require
|
||||
[app.common.data.macros :as dm]
|
||||
[app.config :as cf]
|
||||
[app.main.data.modal :as modal]
|
||||
[app.main.data.notifications :as ntf]
|
||||
[app.main.data.persistence :as dps]
|
||||
|
@ -31,6 +32,7 @@
|
|||
[app.main.ui.workspace.sidebar.collapsable-button :refer [collapsed-button]]
|
||||
[app.main.ui.workspace.sidebar.history :refer [history-toolbox]]
|
||||
[app.main.ui.workspace.viewport :refer [viewport]]
|
||||
[app.renderer-v2 :as renderer]
|
||||
[app.util.debug :as dbg]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.globals :as globals]
|
||||
|
@ -198,6 +200,10 @@
|
|||
(ntf/hide)
|
||||
(dw/finalize-file project-id file-id))))
|
||||
|
||||
(mf/with-effect [file-ready?]
|
||||
(when (and file-ready? (contains? cf/flags :renderer-v2))
|
||||
(renderer/print-msg "hello from wasm fn!")))
|
||||
|
||||
[:& (mf/provider ctx/current-file-id) {:value file-id}
|
||||
[:& (mf/provider ctx/current-project-id) {:value project-id}
|
||||
[:& (mf/provider ctx/current-team-id) {:value team-id}
|
||||
|
@ -208,7 +214,6 @@
|
|||
:style {:background-color background-color
|
||||
:touch-action "none"}}
|
||||
[:& context-menu]
|
||||
|
||||
(if ^boolean file-ready?
|
||||
[:& workspace-page {:page-id page-id
|
||||
:file file
|
||||
|
|
38
frontend/src/app/renderer_v2.cljs
Normal file
38
frontend/src/app/renderer_v2.cljs
Normal file
|
@ -0,0 +1,38 @@
|
|||
;; This Source Code Form is subject to the terms of the Mozilla Public
|
||||
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
;;
|
||||
;; Copyright (c) KALEIDOS INC
|
||||
|
||||
(ns app.renderer-v2
|
||||
(:require
|
||||
[app.config :as cf]
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(defonce internal-module #js {})
|
||||
|
||||
(defn on-module-loaded
|
||||
[module']
|
||||
(let [init-fn (.-default ^js module')]
|
||||
(->> (rx/from (init-fn))
|
||||
(rx/map (constantly module')))))
|
||||
|
||||
(defn- on-module-initialized
|
||||
[module]
|
||||
(set! internal-module module))
|
||||
|
||||
(defn print-msg [msg]
|
||||
(let [print-fn (.-print internal-module)]
|
||||
(print-fn msg)))
|
||||
|
||||
(defn init
|
||||
[]
|
||||
(ptk/reify ::init
|
||||
ptk/WatchEvent
|
||||
(watch [_ _ _]
|
||||
(let [module-uri (assoc cf/public-uri :path "/js/renderer/renderer.js")]
|
||||
(->> (rx/from (js/dynamicImport (str module-uri)))
|
||||
(rx/mapcat on-module-loaded)
|
||||
(rx/tap on-module-initialized)
|
||||
(rx/ignore))))))
|
Loading…
Add table
Add a link
Reference in a new issue