Skip to content

Add CSSProp and CSSPropDefinition#42913

Closed
NickGerleman wants to merge 4 commits into
facebook:mainfrom
NickGerleman:export-D53518450
Closed

Add CSSProp and CSSPropDefinition#42913
NickGerleman wants to merge 4 commits into
facebook:mainfrom
NickGerleman:export-D53518450

Conversation

@NickGerleman

Copy link
Copy Markdown
Contributor

Summary:
This structures properties into a CSSProp enum (so that we can have a runtime-key per style prop), associated with a CSSPropDefinition structure which groups the supported types and keywords. This has some niceness of removing the macro bits, but more importantly, means we can query parse related information without a field of the value yet existing (need for sparse storage of CSS values). In the future, it will serve as where we define "initial" values, and likely, the processes for interpolation and inheritance.

We restructure CSSValueVariant to not always support keywords, as it may not be a valid possibility for computed values (which do not have CSS wide keywords). Computed values themselves may also reduce more keywords than the global ones (e.g. border width computed value absolutizes keywords).

We also flesh out more of the prop definitions, and parsing. All the properties here relay back to YogaStylableProps of today, but I intentionally filled out the prop definitions a bit more than we do anything with right now (will design higher level to ignore unknown props).

Changelog: [Internal]

Differential Revision: D53518450

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner labels Feb 7, 2024
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D53518450

@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D53518450

@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D53518450

NickGerleman and others added 4 commits February 13, 2024 17:02
Differential Revision: D53377527,

fbshipit-source-id: 9540b53c6feaf8f275b4754cc0da0df9f5bf6b6d
Summary:
This adds:
1. `CSSValue`: A union-y type, mapping to a collection of CSS data types. The aim here is to more closely model the data types after the CSS spec, to allow RN to store them correctly, while not taking up too much space. These types will form the foundation of Yoga prop storage (and probably some other props down the line), so compactness is a priority.
2. `parseCSSValue()`: This uses the previously added Tokenizer, along with parsing rules, to be able to parse a single component value, into a literal keyword, `<length>`, `<length-percentage>`, `<percent>`, or `<number>`. This will be wired to the props parsing infrastructure.

Changelog: [Internal]

Differential Revision: D53342595

fbshipit-source-id: 436078dfea7aafeae7e4a55c732aabb1d73220dc
Summary:
Adds support for parsing and storing the <ratio> CSS basic data type.

Changelog: [Internal]

Differential Revision: D53457930

fbshipit-source-id: b0f6e1203a5f3aa636a4c59d4ea6c69ef475606b
Summary:
Pull Request resolved: facebook#42913

This structures properties into a `CSSProp` enum (so that we can have a runtime-key per style prop), associated with a `CSSPropDefinition` structure which groups the supported types and keywords. This has some niceness of removing the macro bits, but more importantly, means we can query parse related information without a field of the value yet existing (need for sparse storage of CSS values). In the future, it will serve as where we define "initial" values, and likely, the processes for interpolation and inheritance.

We restructure `CSSValueVariant` to not always support keywords, as it may not be a valid possibility for computed values (which do not have CSS wide keywords). Computed values themselves may also reduce more keywords than the global ones (e.g. border width computed value absolutizes keywords).

We also flesh out more of the prop definitions, and parsing. All the properties here relay back to YogaStylableProps of today, but I intentionally filled out the prop definitions a bit more than we do anything with right now (will design higher level to ignore unknown props).

Changelog: [Internal]

Reviewed By: rozele

Differential Revision: D53518450

fbshipit-source-id: 4308795814632c5319acb5667298b5c1c22ef69b
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D53518450

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Feb 14, 2024
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request has been merged in c37fc74.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants