-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from liveview-native/next
Merge `next` into `main`
- Loading branch information
Showing
28 changed files
with
307 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
defmodule LiveViewNative.Assigns do | ||
defstruct [ | ||
:app_version, | ||
:app_build, | ||
:bundle_id, | ||
:format, | ||
:native, | ||
:os, | ||
:os_version, | ||
:target | ||
] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
defmodule LiveViewNative.Extensions.Stylesheets do | ||
@moduledoc false | ||
|
||
@doc """ | ||
This macro adds support for LiveView Native's stylesheet DSL which | ||
enables configuration of visual properties for native platforms | ||
(i.e. SwiftUI modifiers, Jetpack Compose themes, etc.) | ||
""" | ||
defmacro __using__(opts \\ []) do | ||
module = opts[:module] | ||
|
||
quote bind_quoted: [module: module] do | ||
def __compiled_stylesheet__ do | ||
class_tree_module = | ||
Module.safe_concat([LiveViewNative, Internal, ClassTree, unquote(module)]) | ||
|
||
class_tree = apply(class_tree_module, :class_tree, []) | ||
|
||
class_names = | ||
class_tree | ||
|> Map.values() | ||
|> List.flatten() | ||
|
||
__stylesheet_modules__() | ||
|> Enum.reduce(%{}, fn stylesheet_module, acc -> | ||
compiled_stylesheet = apply(stylesheet_module, :compile_ast, [class_names]) | ||
|
||
Map.merge(acc, compiled_stylesheet) | ||
end) | ||
|> inspect(limit: :infinity, charlists: :as_list, printable_limit: :infinity) | ||
end | ||
|
||
def __stylesheet_modules__, do: [] | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.