Update binary fills flag name and add it to supported flags

This commit is contained in:
Belén Albeza 2025-05-29 09:50:12 +02:00
parent c0a98288d0
commit f33c1fb530
8 changed files with 12 additions and 11 deletions

View file

@ -127,7 +127,8 @@
:render-wasm-dpr :render-wasm-dpr
:hide-release-modal :hide-release-modal
:subscriptions :subscriptions
:subscriptions-old}) :subscriptions-old
:frontend-binary-fills})
(def all-flags (def all-flags
(set/union email login varia)) (set/union email login varia))

View file

@ -153,7 +153,7 @@ test("Create a RADIAL gradient", async ({ page }) => {
test("Gradient stops limit", async ({ page }) => { test("Gradient stops limit", async ({ page }) => {
const workspacePage = new WorkspacePage(page); const workspacePage = new WorkspacePage(page);
await workspacePage.mockConfigFlags(["enable-binary-fills"]); await workspacePage.mockConfigFlags(["enable-frontend-binary-fills"]);
await workspacePage.setupEmptyFile(page); await workspacePage.setupEmptyFile(page);
await workspacePage.mockRPC( await workspacePage.mockRPC(
"get-file-fragment?file-id=*&fragment-id=*", "get-file-fragment?file-id=*&fragment-id=*",

View file

@ -71,7 +71,7 @@ test.describe("Shape attributes", () => {
page, page,
}) => { }) => {
const workspace = new WorkspacePage(page); const workspace = new WorkspacePage(page);
await workspace.mockConfigFlags(["enable-binary-fills"]); await workspace.mockConfigFlags(["enable-frontend-binary-fills"]);
await workspace.setupEmptyFile(); await workspace.setupEmptyFile();
await workspace.mockRPC(/get\-file\?/, "design/get-file-fills-limit.json"); await workspace.mockRPC(/get\-file\?/, "design/get-file-fills-limit.json");

View file

@ -822,7 +822,7 @@
(update [_ state] (update [_ state]
(update state :colorpicker (update state :colorpicker
(fn [{:keys [stops editing-stop] :as state}] (fn [{:keys [stops editing-stop] :as state}]
(let [cap-stops? (or (features/active-feature? state "render-wasm/v1") (contains? cfg/flags :binary-fills)) (let [cap-stops? (or (features/active-feature? state "render-wasm/v1") (contains? cfg/flags :frontend-binary-fills))
can-add-stop? (or (not cap-stops?) (< (count stops) shp/MAX-GRADIENT-STOPS))] can-add-stop? (or (not cap-stops?) (< (count stops) shp/MAX-GRADIENT-STOPS))]
(if can-add-stop? (if can-add-stop?
(if (cc/uniform-spread? stops) (if (cc/uniform-spread? stops)
@ -868,7 +868,7 @@
(update state :colorpicker (update state :colorpicker
(fn [state] (fn [state]
(let [stops (:stops state) (let [stops (:stops state)
cap-stops? (or (features/active-feature? state "render-wasm/v1") (contains? cfg/flags :binary-fills)) cap-stops? (or (features/active-feature? state "render-wasm/v1") (contains? cfg/flags :frontend-binary-fills))
can-add-stop? (or (not cap-stops?) (< (count stops) shp/MAX-GRADIENT-STOPS))] can-add-stop? (or (not cap-stops?) (< (count stops) shp/MAX-GRADIENT-STOPS))]
(if can-add-stop? (let [new-stop (-> (cc/interpolate-gradient stops offset) (if can-add-stop? (let [new-stop (-> (cc/interpolate-gradient stops offset)
(split-color-components)) (split-color-components))
@ -889,7 +889,7 @@
(update state :colorpicker (update state :colorpicker
(fn [state] (fn [state]
(let [stop (or (:editing-stop state) 0) (let [stop (or (:editing-stop state) 0)
cap-stops? (or (features/active-feature? state "render-wasm/v1") (contains? cfg/flags :binary-fills)) cap-stops? (or (features/active-feature? state "render-wasm/v1") (contains? cfg/flags :frontend-binary-fills))
stops (mapv split-color-components (if cap-stops? (take shp/MAX-GRADIENT-STOPS stops) stops))] stops (mapv split-color-components (if cap-stops? (take shp/MAX-GRADIENT-STOPS stops) stops))]
(-> state (-> state
(assoc :current-color (get stops stop)) (assoc :current-color (get stops stop))

View file

@ -338,7 +338,7 @@
(fn [value] (fn [value]
(st/emit! (dc/update-colorpicker-gradient-opacity (/ value 100))))) (st/emit! (dc/update-colorpicker-gradient-opacity (/ value 100)))))
cap-stops? (or (features/use-feature "render-wasm/v1") (contains? cfg/flags :binary-fills)) cap-stops? (or (features/use-feature "render-wasm/v1") (contains? cfg/flags :frontend-binary-fills))
tabs tabs
#js [#js {:aria-label (tr "workspace.libraries.colors.rgba") #js [#js {:aria-label (tr "workspace.libraries.colors.rgba")

View file

@ -287,7 +287,7 @@
(fn [] (fn []
(when on-reverse-stops (when on-reverse-stops
(on-reverse-stops)))) (on-reverse-stops))))
cap-stops? (or (features/use-feature "render-wasm/v1") (contains? cfg/flags :binary-fills)) cap-stops? (or (features/use-feature "render-wasm/v1") (contains? cfg/flags :frontend-binary-fills))
add-stop-disabled? (when cap-stops? (>= (count stops) shp/MAX-GRADIENT-STOPS))] add-stop-disabled? (when cap-stops? (>= (count stops) shp/MAX-GRADIENT-STOPS))]
[:div {:class (stl/css :gradient-panel)} [:div {:class (stl/css :gradient-panel)}

View file

@ -56,7 +56,7 @@
values (d/without-nils values) values (d/without-nils values)
fills (:fills values) fills (:fills values)
has-fills? (or (= :multiple fills) (some? (seq fills))) has-fills? (or (= :multiple fills) (some? (seq fills)))
can-add-fills? (and (contains? cfg/flags :binary-fills) (not (= :multiple fills)) (< (count fills) shp/MAX-FILLS)) can-add-fills? (and (contains? cfg/flags :frontend-binary-fills) (not (= :multiple fills)) (< (count fills) shp/MAX-FILLS))
state* (mf/use-state has-fills?) state* (mf/use-state has-fills?)
open? (deref state*) open? (deref state*)

View file

@ -134,7 +134,7 @@
handler-state (mf/use-state {:display? false :offset 0 :hover nil}) handler-state (mf/use-state {:display? false :offset 0 :hover nil})
cap-stops? (or (features/use-feature "render-wasm/v1") (contains? cfg/flags :binary-fills)) cap-stops? (or (features/use-feature "render-wasm/v1") (contains? cfg/flags :frontend-binary-fills))
can-add-stop? (if cap-stops? (< (count stops) shp/MAX-GRADIENT-STOPS) true) can-add-stop? (if cap-stops? (< (count stops) shp/MAX-GRADIENT-STOPS) true)
endpoint-on-pointer-down endpoint-on-pointer-down
@ -525,7 +525,7 @@
shape (mf/deref shape-ref) shape (mf/deref shape-ref)
state (mf/deref refs/colorpicker) state (mf/deref refs/colorpicker)
gradient (:gradient state) gradient (:gradient state)
cap-stops? (or (features/use-feature "render-wasm/v1") (contains? cfg/flags :binary-fills)) cap-stops? (or (features/use-feature "render-wasm/v1") (contains? cfg/flags :frontend-binary-fills))
stops (if cap-stops? stops (if cap-stops?
(vec (take shp/MAX-GRADIENT-STOPS (:stops state))) (vec (take shp/MAX-GRADIENT-STOPS (:stops state)))
(:stops state)) (:stops state))