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

Prepare SwiftUI parser for outputing stylesheet as a map #1458

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

NduatiK
Copy link
Contributor

@NduatiK NduatiK commented Sep 21, 2024

Prepare for liveview-native/live_view_native_stylesheet#86

Prepare ast for conversion to JSON

  • Remove variable related code since we are using EEx
  • Always return a list of modifiers (instead of the inner tuple for singletons)
  • Return annotations as a map instead of keyword list (since empty keywords are treated as lists)

@bcardarella
Copy link
Collaborator

I think there was a misunderstanding. We don't need the individual rules output changing at all. Infact I don't think we need any actual changes to how we're generating the stylesheet currently. Instead in live_view_native_stylesheet we simply need to convert the currently generated map to the json object. We can then use https://erlang.org/documentation/doc-15.0-rc3/lib/stdlib-6.0/doc/html/json.html#encode/2 to convert values like tuples that are not generically supported

- Remove variable related code since we are using EEx
- Always return a list of modifiers (instead of the inner tuple for singletons)
- Return annotations as a map instead of keyword list
@NduatiK NduatiK force-pushed the nk-change-stylesheet-output-to-map branch from 62b3807 to 655f086 Compare September 21, 2024 15:20
@NduatiK
Copy link
Contributor Author

NduatiK commented Sep 21, 2024

Aah, my bad I wasn't very clear when asking Question 2.

I've created a PR in the stylesheet repo liveview-native/live_view_native_stylesheet#87 and made a few related changes here.

The stylesheeet PR raises the question of whether we should use Jason or :json, the answer to which might require a few small tweaks to the AST to only output arrays.

@NduatiK NduatiK changed the title Change stylesheet output to a map Prepare SwiftUI parser for outputing stylesheet as a map Sep 23, 2024
@NduatiK NduatiK marked this pull request as draft September 23, 2024 07:09
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