diff --git a/common/src/app/common/features.cljc b/common/src/app/common/features.cljc index a5097a29a7..216c5fc64f 100644 --- a/common/src/app/common/features.cljc +++ b/common/src/app/common/features.cljc @@ -57,6 +57,7 @@ "text-editor/v2" "text-editor-wasm/v1" "render-wasm/v1" + "wasm-export/v1" "variants/v1"}) ;; A set of features enabled by default @@ -82,7 +83,8 @@ "text-editor/v2" "text-editor-wasm/v1" "tokens/numeric-input" - "render-wasm/v1"}) + "render-wasm/v1" + "wasm-export/v1"}) ;; Features that are mainly backend only or there are a proper ;; fallback when frontend reports no support for it @@ -132,6 +134,7 @@ :feature-text-editor-v2-html-paste "text-editor/v2-html-paste" :feature-text-editor-wasm "text-editor-wasm/v1" :feature-render-wasm "render-wasm/v1" + :feature-wasm-export "wasm-export/v1" :feature-variants "variants/v1" :feature-token-input "tokens/numeric-input" nil)) diff --git a/frontend/src/app/main/data/exports/assets.cljs b/frontend/src/app/main/data/exports/assets.cljs index b1ced71ad6..9a22fe25b9 100644 --- a/frontend/src/app/main/data/exports/assets.cljs +++ b/frontend/src/app/main/data/exports/assets.cljs @@ -8,7 +8,6 @@ (:require [app.common.time :as ct] [app.common.uuid :as uuid] - [app.config :as cf] [app.main.data.event :as ev] [app.main.data.exports.wasm :as wasm.exports] [app.main.data.helpers :as dsh] @@ -183,11 +182,11 @@ (def ^:private wasm-export-types #{:jpeg :webp :png :pdf}) (defn- wasm-export-enabled? - "WASM export is available: the flag is set AND render-wasm is active for the - current file. When render-wasm is inactive its shape tree isn't loaded, so a - client-side WASM render would crash." + "WASM export is available when the `wasm-export/v1` feature is active AND + render-wasm is active for the current file. When render-wasm is inactive its + shape tree isn't loaded, so a client-side WASM render would crash." [state] - (and (contains? cf/flags :wasm-export) + (and (features/active-feature? state "wasm-export/v1") (features/active-feature? state "render-wasm/v1"))) (defn- use-wasm-export? diff --git a/frontend/src/app/main/data/workspace/clipboard.cljs b/frontend/src/app/main/data/workspace/clipboard.cljs index 21346c879c..ac803897d7 100644 --- a/frontend/src/app/main/data/workspace/clipboard.cljs +++ b/frontend/src/app/main/data/workspace/clipboard.cljs @@ -1201,7 +1201,7 @@ ;; Call exporter to get image URI, then fetch blob and resolve the deferred. (->> (if (and (features/active-feature? state "render-wasm/v1") - (contains? cf/flags :wasm-export)) + (features/active-feature? state "wasm-export/v1")) (rx/of {:uri (wasm.exports/export-image-uri export)}) (rp/cmd! :export {:exports [export] diff --git a/frontend/src/app/plugins/shape.cljs b/frontend/src/app/plugins/shape.cljs index 88177b39ab..1b0a9fa965 100644 --- a/frontend/src/app/plugins/shape.cljs +++ b/frontend/src/app/plugins/shape.cljs @@ -33,7 +33,6 @@ [app.common.types.shape.shadow :as ctss] [app.common.types.text :as txt] [app.common.uuid :as uuid] - [app.config :as cf] [app.main.data.exports.assets :as de] [app.main.data.exports.wasm :as wasm.exports] [app.main.data.persistence :as dwp] @@ -50,6 +49,7 @@ [app.main.data.workspace.texts :as dwt] [app.main.data.workspace.tokens.application :as dwta] [app.main.data.workspace.variants :as dwv] + [app.main.features :as features] [app.main.repo :as rp] [app.main.store :as st] [app.plugins.exports :as exports] @@ -1532,7 +1532,7 @@ (u/not-valid plugin-id :export value) :else - (if (and (contains? cf/flags :wasm-export) + (if (and (features/active-feature? @st/state "wasm-export/v1") (contains? #{:jpeg :webp :png} (:type value :png))) ;; New export with wasm (let [uri (wasm.exports/export-image-uri diff --git a/render-wasm/docs/rendering_architecture.md b/render-wasm/docs/rendering_architecture.md index 709c882900..12812af022 100644 --- a/render-wasm/docs/rendering_architecture.md +++ b/render-wasm/docs/rendering_architecture.md @@ -80,7 +80,10 @@ flowchart TB The client-side WASM export — rendering in the browser through the vector path (`render_shape_pdf` / `render_shape_pixels`) — is wired **only for single exports** (`request-simple-export` in `frontend/.../exports/assets.cljs`), and -only when render-wasm is active and the `:wasm-export` flag is set. +only when render-wasm is active and the `wasm-export/v1` feature is enabled +(instance-wide through the `enable-feature-wasm-export` flag, or per team +through the team `features` column). The exporter service keeps its own +`:wasm-export` flag to decide whether it can serve the headless WASM path. **Multiple/batch export** (`request-multiple-export`) always runs **server-side** via the `:export-shapes` command; it merely passes an `:is-wasm` hint so the