Skip to content

Commit b774334

Browse files
fix flex-grow property handling
1 parent 39dac80 commit b774334

6 files changed

Lines changed: 18 additions & 8 deletions

File tree

externals/design-sdk

packages/builder-css-styles/tricks/trick-flex-sizing/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export function flexsizing({
3030
case MainAxisSize.max: {
3131
return {
3232
"align-self": "stretch",
33-
flex: 1, // This is a temporary solution, since stretch can be used on non-space-between parent, but still the item should stretch, we use flex 1 to do this.
3433
};
3534
}
3635
case MainAxisSize.min: {

packages/builder-web-core/widgets-native/flex/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ export class Flex extends MultiChildWidget implements CssMinHeightMixin {
9595
this.mainAxisSize = p.mainAxisSize;
9696
this.crossAxisAlignment = p.crossAxisAlignment;
9797
this.verticalDirection = p.verticalDirection;
98+
this.flexWrap = p.flexWrap; // cssonly
9899
//
99100

100101
//
@@ -107,7 +108,6 @@ export class Flex extends MultiChildWidget implements CssMinHeightMixin {
107108

108109
// css only
109110
this.overflow = p.overflow;
110-
this.flexWrap = p.flexWrap;
111111
}
112112

113113
jsxConfig(): StylableJSXElementConfig {
@@ -120,10 +120,10 @@ export class Flex extends MultiChildWidget implements CssMinHeightMixin {
120120
styleData(): CSSProperties {
121121
return {
122122
display: "flex",
123+
overflow: this.overflow,
123124
...css.justifyContent(this.mainAxisAlignment),
124125
"flex-direction": direction(this.direction),
125126
"align-items": this.crossAxisAlignment,
126-
overflow: this.overflow,
127127
flex: this.flex,
128128
"flex-wrap": this.flexWrap,
129129
gap: this.itemSpacing && css.px(this.itemSpacing),

packages/designto-token/support-flags/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ import { tokenize_flagged_wrap } from "./token-wrap";
1414
import { tokenize_flagged_wh_declaration } from "./token-wh";
1515
import { tokenize_flagged_fix_wh } from "./token-wh-fix";
1616

17-
export default function (node: ReflectSceneNode) {
17+
export default function handleWithFlags(node: ReflectSceneNode) {
1818
const flags = parse(node.name);
19-
return handle_with_flags(node, flags);
19+
return _handle_with_flags(node, flags);
2020
}
2121

22-
function handle_with_flags(node, flags: FlagsParseResult) {
22+
function _handle_with_flags(node, flags: FlagsParseResult) {
2323
// artwork
2424
const artwork_flag_alias =
2525
flags["artwork"] ||

packages/designto-token/token-graphics/vector.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function fromVector(vector: ReflectVectorNode) {
2525
// we are not sure when specifically this happens, but as reported, curvy lines does not contain a vector paths.
2626
// so we just return a image bake of it.
2727
process.env.NODE_ENV === "development" &&
28-
console.warn(
28+
console.info(
2929
`tried to get path data from vector, but none was provided. baking as a bitmap instead.`,
3030
vector
3131
);

packages/designto-token/token-layout/index.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,17 @@ function flex_or_stack_from_frame(
127127
};
128128

129129
if (frame.isAutoLayout) {
130+
// const __is_this_autolayout_frame_under_autolayout_parent =
131+
// frame.parent instanceof nodes.ReflectFrameNode &&
132+
// frame.parent.isAutoLayout;
133+
134+
/// > From the docs: https://www.figma.com/plugin-docs/api/properties/nodes-layoutalign
135+
/// Changing this property will cause the x, y, size, and relativeTransform properties on this node to change, if applicable (inside an auto-layout frame).
136+
/// - Setting "STRETCH" will make the node "stretch" to fill the width of the parent vertical auto - layout frame, or the height of the parent horizontal auto - layout frame excluding the frame's padding.
137+
/// - If the current node is an auto layout frame(e.g.an auto layout frame inside a parent auto layout frame) if you set layoutAlign to “STRETCH” you should set the corresponding axis – either primaryAxisSizingMode or counterAxisSizingMode – to be“FIXED”. This is because an auto - layout frame cannot simultaneously stretch to fill its parent and shrink to hug its children.
138+
/// - Setting "INHERIT" does not "stretch" the node.
139+
///
140+
130141
// TODO: inspect me. We're not 100% sure this is the correct behaviour.
131142
switch (frame.layoutMode) {
132143
case Axis.horizontal:

0 commit comments

Comments
 (0)