Skip to content

Commit

Permalink
Add justify-self support (#453)
Browse files Browse the repository at this point in the history
Co-authored-by: Rusty Key <rusty.key@ahrefs.com>
  • Loading branch information
rusty-key and Rusty Key committed Mar 17, 2024
1 parent 230212c commit cb2bf08
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 17 deletions.
21 changes: 20 additions & 1 deletion packages/ppx/src/declarations_to_emotion.re
Original file line number Diff line number Diff line change
Expand Up @@ -3308,6 +3308,26 @@ let justify_items =
},
);

let justify_self =
monomorphic(
Parser.property_justify_self,
(~loc) => [%expr CssJs.justifySelf],
(~loc, value) => {
switch (value) {
| `Auto => [%expr `auto]
| `Normal => [%expr `normal]
| `Stretch => [%expr `stretch]
| `Static(None, position) =>
[%expr [%e render_self_position_left_right(~loc, position)]]
| `Static(Some(`Safe), position) =>
[%expr `safe([%e render_self_position_left_right(~loc, position)])]
| `Static(Some(`Unsafe), position) =>
[%expr `unsafe([%e render_self_position_left_right(~loc, position)])]
| `Baseline_position(pos, ()) => render_baseline_position(~loc, pos)
}
},
);

let align_items =
monomorphic(
Parser.property_align_items,
Expand Down Expand Up @@ -4059,7 +4079,6 @@ let font_language_override =
unsupportedProperty(Parser.property_hyphenate_limit_zone); */
let ime_mode = unsupportedProperty(Parser.property_ime_mode);
let isolation = unsupportedProperty(Parser.property_isolation);
let justify_self = unsupportedProperty(Parser.property_justify_self);
/* let layout_grid = unsupportedProperty(Parser.property_layout_grid); */
/* let layout_grid_char = unsupportedProperty(Parser.property_layout_grid_char); */
/* let layout_grid_line = unsupportedProperty(Parser.property_layout_grid_line); */
Expand Down
32 changes: 16 additions & 16 deletions packages/ppx/test/css-support/css-support.expected.re
Original file line number Diff line number Diff line change
Expand Up @@ -1469,22 +1469,22 @@ CssJs.alignContent(`flexStart);
CssJs.alignContent(`flexEnd);
CssJs.alignContent(`unsafe(`start));
CssJs.alignContent(`safe(`start));
CssJs.unsafe({js|justifySelf|js}, {js|auto|js});
CssJs.unsafe({js|justifySelf|js}, {js|normal|js});
CssJs.unsafe({js|justifySelf|js}, {js|stretch|js});
CssJs.unsafe({js|justifySelf|js}, {js|baseline|js});
CssJs.unsafe({js|justifySelf|js}, {js|first baseline|js});
CssJs.unsafe({js|justifySelf|js}, {js|last baseline|js});
CssJs.unsafe({js|justifySelf|js}, {js|center|js});
CssJs.unsafe({js|justifySelf|js}, {js|start|js});
CssJs.unsafe({js|justifySelf|js}, {js|end|js});
CssJs.unsafe({js|justifySelf|js}, {js|self-start|js});
CssJs.unsafe({js|justifySelf|js}, {js|self-end|js});
CssJs.unsafe({js|justifySelf|js}, {js|unsafe start|js});
CssJs.unsafe({js|justifySelf|js}, {js|safe start|js});
CssJs.unsafe({js|justifySelf|js}, {js|left|js});
CssJs.unsafe({js|justifySelf|js}, {js|right|js});
CssJs.unsafe({js|justifySelf|js}, {js|safe right|js});
CssJs.justifySelf(`auto);
CssJs.justifySelf(`normal);
CssJs.justifySelf(`stretch);
CssJs.justifySelf(`baseline);
CssJs.justifySelf(`firstBaseline);
CssJs.justifySelf(`lastBaseline);
CssJs.justifySelf(`center);
CssJs.justifySelf(`start);
CssJs.justifySelf(`end_);
CssJs.justifySelf(`selfStart);
CssJs.justifySelf(`selfEnd);
CssJs.justifySelf(`unsafe(`start));
CssJs.justifySelf(`safe(`start));
CssJs.justifySelf(`left);
CssJs.justifySelf(`right);
CssJs.justifySelf(`safe(`right));
CssJs.justifyItems(`normal);
CssJs.justifyItems(`stretch);
CssJs.justifyItems(`baseline);
Expand Down

0 comments on commit cb2bf08

Please sign in to comment.