Skip to content

Commit

Permalink
fix: render images on canvas (#4234)
Browse files Browse the repository at this point in the history
Fixes #4232

Broke it when serialized as unparsed without assets transform.
  • Loading branch information
TrySound authored Oct 6, 2024
1 parent 02c073c commit 9b81aa6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apps/builder/app/canvas/shared/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,16 @@ const getEphemeralProperty = (styleDecl: StyleDecl) => {
// wrap normal style value with var(--namespace, value) to support ephemeral styles updates
// between all token usages
const toVarValue = (styleDecl: StyleDecl): undefined | VarValue => {
const { value } = styleDecl;
return {
type: "var",
// var style value is relying on name without leading "--"
// escape complex selectors in state like ":hover"
// setProperty and removeProperty escape automatically
value: CSS.escape(getEphemeralProperty(styleDecl).slice(2)),
fallback: { type: "unparsed", value: toValue(value) },
fallback: {
type: "unparsed",
value: toValue(styleDecl.value, $transformValue.get()),
},
};
};

Expand Down

0 comments on commit 9b81aa6

Please sign in to comment.