Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support moar properties #509

Merged
merged 35 commits into from
Feb 5, 2025
Merged

Conversation

zakybilfagih
Copy link
Collaborator

@zakybilfagih zakybilfagih commented Aug 21, 2024

  • CSS Grid Layout Module Level 3
  • mask-position: bottom 10px right
  • Cleanup properties with <position>

  • Parser.property_perspective
  • Parser.property_grid_template
  • Parser.property_translate
  • Parser.property_rotate
  • Parser.property_scale
  • Parser.property_transition
  • Parser.property_grid_template_columns
  • Parser.property_grid_template_rows
  • Parser.property_grid_template_areas
  • Parser.property_grid_auto_columns
  • Parser.property_grid_auto_rows
  • Parser.property_grid_auto_flow
  • Parser.property_grid
  • Parser.property_grid_row_start
  • Parser.property_grid_column_start
  • Parser.property_grid_row_end
  • Parser.property_grid_column_end
  • Parser.property_grid_row
  • Parser.property_grid_column
  • Parser.property_grid_area

Copy link

vercel bot commented Aug 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
styled-ppx ⬜️ Ignored (Inspect) Visit Preview Feb 4, 2025 4:44pm

@zakybilfagih zakybilfagih requested a review from davesnx August 21, 2024 17:26
@zakybilfagih zakybilfagih marked this pull request as ready for review August 24, 2024 07:14
@davesnx davesnx force-pushed the main branch 3 times, most recently from 8b0272d to d27fb86 Compare November 26, 2024 14:44
Copy link
Owner

@davesnx davesnx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing PR @zakybilfagih.

Left a few comments worth taking a look, but the rest looks very nice

packages/ppx/test/css-support/fonts-module.t/run.t Outdated Show resolved Hide resolved
Comment on lines +110 to +115
//let unsupportedValue = (parser, property) =>
// transform_with_variable(
// parser,
// (~loc as _, _) => raise(Unsupported_feature),
// (~loc, arg) => [[%expr [%e property(~loc)]([%e arg])]],
// );
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WHAAAAT

Hero

packages/ppx/src/Property_to_runtime.re Outdated Show resolved Hide resolved
packages/ppx/src/Property_to_runtime.re Outdated Show resolved Hide resolved
packages/ppx/src/Property_to_runtime.re Outdated Show resolved Hide resolved
packages/ppx/test/css-support/transforms-module.t/run.t Outdated Show resolved Hide resolved
packages/runtime/native/shared/Css_types.ml Outdated Show resolved Hide resolved
packages/runtime/native/shared/Css_types.ml Outdated Show resolved Hide resolved
Comment on lines +19 to +23
(CSS.textDecoration2
~line:(CSS.Types.TextDecorationLine.Value.make ~lineThrough:true ())
())
"-webkit-text-decoration: line-through auto solid currentColor; \
text-decoration: line-through auto solid currentColor;")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, add another test for this one

@zakybilfagih zakybilfagih requested a review from davesnx February 3, 2025 10:54
@@ -2652,16 +2667,24 @@ let text_decoration_thickness =
);

let text_decoration =
monomorphic(
polymorphic(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need poly here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, this should be mono

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, turns out it's a lot simpler using poly since we're generating the shorthand

packages/ppx/src/Property_to_runtime.re Outdated Show resolved Hide resolved
packages/ppx/src/Property_to_runtime.re Outdated Show resolved Hide resolved
packages/ppx/src/Property_to_runtime.re Outdated Show resolved Hide resolved
);

let render_single_animation =
let render_single_animation = (~loc) =>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's a sexy function indeed

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hell yea

Comment on lines 5949 to 5950
| Error(`Invalid_value(_))
| exception (Invalid_value(_)) => Error(`Invalid_value(value))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In terms of behaviour, does this change anything?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the Error(`Invalid_value(_)) pattern to handle the error from render_to_expr, I think we forgot to handle this when refactoring this line

| exception (Invalid_value(v)) => Error(`Invalid_value(v))

The exception Invalid_value pattern is redundant though, since we transformed it already on render_to_expr.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As for the Invalid_value payload, I think I removed it at that time because it's a bit ugly lol, just pushed a commit to make it nicer.

| `webkitFlex
| `webkitInlineBox
| `webkitInlineFlex ]
but an expression was expected of type Css_types.Display.t
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue with aliasing everything is that the error is less clear (since not all polyvariants) are rendered. WDYT?

Do you think is worth it?

Copy link
Collaborator Author

@zakybilfagih zakybilfagih Feb 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is because the explicit type annotation on the toString method, I think maybe remove it for some properties with flat or simple polyvariant? The only problem, I think, is that it can get pretty long, esp if there is Length.t and Calc.t

@zakybilfagih zakybilfagih requested a review from davesnx February 4, 2025 16:45
@davesnx davesnx merged commit 6f487f7 into davesnx:main Feb 5, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants