Skip to content

Commit 06b39a5

Browse files
authored
feat: hide transforms section for inline elements (#5180)
Transforms don't work when display: inline is used. Here we hide transforms section just like "list item section" for non list tags. Related video https://www.youtube.com/watch?v=KjpQF3nYGoc https://github.com/user-attachments/assets/2f1c882f-c627-4e62-9e44-5284117d200a
1 parent a9c9573 commit 06b39a5

2 files changed

Lines changed: 21 additions & 5 deletions

File tree

apps/builder/app/builder/features/style-panel/sections/sections.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const sections = new Map<
3939
["filter", filter],
4040
["backdropFilters", backdropFilter],
4141
["transitions", transitions],
42-
["transfrom", transforms],
42+
["transforms", transforms],
4343
["outline", outline],
4444
["advanced", advanced],
4545
]);

apps/builder/app/builder/features/style-panel/style-panel.tsx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ import {
3434
} from "~/builder/shared/client-settings";
3535
import { sections } from "./sections";
3636
import { StyleSourcesSection } from "./style-source-section";
37-
import { $instanceTags, useParentComputedStyleDecl } from "./shared/model";
37+
import {
38+
$instanceTags,
39+
useComputedStyleDecl,
40+
useParentComputedStyleDecl,
41+
} from "./shared/model";
3842

3943
const $selectedInstanceTag = computed(
4044
[$selectedInstance, $instanceTags],
@@ -123,8 +127,10 @@ export const StylePanel = ({
123127
const { stylePanelMode } = useStore($settings);
124128
const selectedInstanceRenderState = useStore($selectedInstanceRenderState);
125129
const tag = useStore($selectedInstanceTag);
126-
const display = useParentComputedStyleDecl("display");
127-
const displayValue = toValue(display.computedValue);
130+
const display = toValue(useComputedStyleDecl("display").computedValue);
131+
const parentDisplay = toValue(
132+
useParentComputedStyleDecl("display").computedValue
133+
);
128134

129135
// If selected instance is not rendered on the canvas,
130136
// style panel will not work, because it needs the element in DOM in order to work.
@@ -147,7 +153,7 @@ export const StylePanel = ({
147153
continue;
148154
}
149155
// show flex child UI only when parent is flex or inline-flex
150-
if (category === "flexChild" && displayValue.includes("flex") === false) {
156+
if (category === "flexChild" && parentDisplay.includes("flex") === false) {
151157
continue;
152158
}
153159
// allow customizing list item type only for list and list item
@@ -159,6 +165,16 @@ export const StylePanel = ({
159165
) {
160166
continue;
161167
}
168+
// non-replaced inline boxes cannot be transformed
169+
// https://drafts.csswg.org/css-transforms-1/#css-values
170+
if (
171+
category === "transforms" &&
172+
(display === "inline" ||
173+
display === "table-column" ||
174+
display === "table-column-group")
175+
) {
176+
continue;
177+
}
162178
all.push(<Section key={category} />);
163179
}
164180

0 commit comments

Comments
 (0)