diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..c1c61f959 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,7 @@ +## v0.2 + +### Breaking + +* removed modifiers and types +* migrated to `LiveViewNative.Stylesheet`` +* renamed `LiveViewNativeSwiftUi` to `LiveViewNative.SwiftUI` module namespace \ No newline at end of file diff --git a/lib/live_view_native_swift_ui/platform.ex b/lib/live_view_native/swiftui/platform.ex similarity index 90% rename from lib/live_view_native_swift_ui/platform.ex rename to lib/live_view_native/swiftui/platform.ex index 4834f0534..4bea6577f 100644 --- a/lib/live_view_native_swift_ui/platform.ex +++ b/lib/live_view_native/swiftui/platform.ex @@ -1,4 +1,4 @@ -defmodule LiveViewNativeSwiftUi.Platform do +defmodule LiveViewNative.SwiftUI.Platform do defstruct [ :app_name, :os_name, diff --git a/lib/live_view_native/swiftui/rules_parser.ex b/lib/live_view_native/swiftui/rules_parser.ex new file mode 100644 index 000000000..0a74432c3 --- /dev/null +++ b/lib/live_view_native/swiftui/rules_parser.ex @@ -0,0 +1,7 @@ +defmodule LiveViewNative.SwiftUI.RulesParser do + use LiveViewNative.Stylesheet.RulesParser, :mock + + def parse(rules) do + rules + end +end diff --git a/lib/live_view_native_swift_ui/utils.ex b/lib/live_view_native/swiftui/utils.ex similarity index 81% rename from lib/live_view_native_swift_ui/utils.ex rename to lib/live_view_native/swiftui/utils.ex index a94c94fb7..3559c3d8c 100644 --- a/lib/live_view_native_swift_ui/utils.ex +++ b/lib/live_view_native/swiftui/utils.ex @@ -1,4 +1,4 @@ -defmodule LiveViewNativeSwiftUi.Utils do +defmodule LiveViewNative.SwiftUI.Utils do def encode_key(key) when is_atom(key), do: encode_key("#{key}") def encode_key(key) when is_binary(key) do diff --git a/lib/live_view_native_swift_ui.ex b/lib/live_view_native_swift_ui.ex index 13379a813..825b1d801 100644 --- a/lib/live_view_native_swift_ui.ex +++ b/lib/live_view_native_swift_ui.ex @@ -1,4 +1,4 @@ -defmodule LiveViewNativeSwiftUi do +defmodule LiveViewNative.SwiftUI do use LiveViewNativePlatform def platforms, diff --git a/lib/live_view_native_swift_ui/modifiers.ex b/lib/live_view_native_swift_ui/modifiers.ex deleted file mode 100644 index 4546fb9ae..000000000 --- a/lib/live_view_native_swift_ui/modifiers.ex +++ /dev/null @@ -1,41 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers do - use LiveViewNativePlatform.Modifiers - - defimpl Jason.Encoder do - def encode(%{stack: stack}, opts) do - modifiers = - Enum.reduce(stack, [], fn %modifier_schema{} = modifier, acc -> - key = apply(modifier_schema, :modifier_name, []) - props = apply(modifier_schema, :to_map, [modifier]) - - case props do - %{} = props -> - modifier = - props - |> Enum.into(%{}) - |> Map.put(:type, key) - - acc ++ [modifier] - - _ -> - acc - end - end) - - case modifiers do - [] -> - nil - - modifiers -> - Jason.Encode.list(modifiers, opts) - end - end - end - - defimpl Phoenix.HTML.Safe do - def to_iodata(struct) do - Jason.encode!(struct) - |> Phoenix.HTML.Engine.html_escape() - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/animation/animation.ex b/lib/live_view_native_swift_ui/modifiers/animation/animation.ex deleted file mode 100644 index 716fb41a4..000000000 --- a/lib/live_view_native_swift_ui/modifiers/animation/animation.ex +++ /dev/null @@ -1,13 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Animation do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.Animation - - modifier_schema "animation" do - field :animation, Animation - field :value, :string - end - - def params(animation, [value: value]), do: [animation: animation, value: value] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/animation/content_transition.ex b/lib/live_view_native_swift_ui/modifiers/animation/content_transition.ex deleted file mode 100644 index 44b8c0963..000000000 --- a/lib/live_view_native_swift_ui/modifiers/animation/content_transition.ex +++ /dev/null @@ -1,18 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ContentTransition do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.ContentTransition - - modifier_schema "content_transition" do - field :transition, ContentTransition - end - - def params(params) do - with {:ok, _} <- ContentTransition.cast(params) do - [transition: params] - else - _ -> - params - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/animation/keyframe_animator.ex b/lib/live_view_native_swift_ui/modifiers/animation/keyframe_animator.ex deleted file mode 100644 index 3580e77bc..000000000 --- a/lib/live_view_native_swift_ui/modifiers/animation/keyframe_animator.ex +++ /dev/null @@ -1,13 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.KeyframeAnimator do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.{EncodedModifierStack, Keyframe, KeyframeProperties} - - modifier_schema "keyframe_animator" do - field :initial_value, :float - field :trigger, :string - field :keyframes, {:array, Keyframe} - field :modifiers, EncodedModifierStack - field :properties, KeyframeProperties - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/animation/matched_geometry_effect.ex b/lib/live_view_native_swift_ui/modifiers/animation/matched_geometry_effect.ex deleted file mode 100644 index a842bb51f..000000000 --- a/lib/live_view_native_swift_ui/modifiers/animation/matched_geometry_effect.ex +++ /dev/null @@ -1,23 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.MatchedGeometryEffect do - use LiveViewNativePlatform.Modifier - alias LiveViewNativeSwiftUi.Types.Namespace - alias LiveViewNativeSwiftUi.Types.UnitPoint - - modifier_schema "matched_geometry_effect" do - field :id, :string - field :namespace, Namespace - field :properties, Ecto.Enum, values: ~w(frame position size)a, default: :frame - field :anchor, UnitPoint - field :is_source, :boolean, default: true - end - - def params([id: id, in: namespace, properties: properties, anchor: anchor, is_source: is_source]), - do: [ - id: id, - namespace: namespace, - properties: properties, - anchor: anchor, - is_source: is_source - ] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/animation/transition.ex b/lib/live_view_native_swift_ui/modifiers/animation/transition.ex deleted file mode 100644 index d672c7906..000000000 --- a/lib/live_view_native_swift_ui/modifiers/animation/transition.ex +++ /dev/null @@ -1,18 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Transition do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.Transition - - modifier_schema "transition" do - field :transition, Transition - end - - def params(params) do - with {:ok, _} <- Transition.cast(params) do - [transition: params] - else - _ -> - params - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/button_border_shape.ex b/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/button_border_shape.ex deleted file mode 100644 index 57acd013e..000000000 --- a/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/button_border_shape.ex +++ /dev/null @@ -1,11 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ButtonBorderShape do - use LiveViewNativePlatform.Modifier - - modifier_schema "button_border_shape" do - field(:shape, Ecto.Enum, values: ~w(automatic capsule rounded_rectangle)a) - field(:radius, :float, default: nil) - end - - def params(shape) when is_atom(shape) and not is_boolean(shape) and not is_nil(shape), do: [shape: shape] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/button_style.ex b/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/button_style.ex deleted file mode 100644 index 75aab4e6a..000000000 --- a/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/button_style.ex +++ /dev/null @@ -1,16 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ButtonStyle do - use LiveViewNativePlatform.Modifier - - modifier_schema "button_style" do - field(:style, Ecto.Enum, values: ~w( - automatic - bordered - bordered_prominent - borderless - plain - )a) - end - - def params(style) when is_atom(style) and not is_boolean(style) and not is_nil(style), do: [style: style] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/control_size.ex b/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/control_size.ex deleted file mode 100644 index 6ebdc132e..000000000 --- a/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/control_size.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ControlSize do - use LiveViewNativePlatform.Modifier - - modifier_schema "control_size" do - field(:size, Ecto.Enum, values: ~w(mini small regular large)a) - end - - def params(size) when is_atom(size) and not is_boolean(size) and not is_nil(size), do: [size: size] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/date_picker_style.ex b/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/date_picker_style.ex deleted file mode 100644 index 6905a372d..000000000 --- a/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/date_picker_style.ex +++ /dev/null @@ -1,17 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.DatePickerStyle do - use LiveViewNativePlatform.Modifier - - modifier_schema "date_picker_style" do - field(:style, Ecto.Enum, values: ~w( - automatic - compact - graphical - wheel - field - stepper_field - )a) - end - - def params(style) when is_atom(style) and not is_boolean(style) and not is_nil(style), do: [style: style] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/default_wheel_picker_item_height.ex b/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/default_wheel_picker_item_height.ex deleted file mode 100644 index 0f0e59f7a..000000000 --- a/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/default_wheel_picker_item_height.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.DefaultWheelPickerItemHeight do - use LiveViewNativePlatform.Modifier - - modifier_schema "default_wheel_picker_item_height" do - field(:height, :float) - end - - def params(height) when is_number(height), do: [height: height] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/gauge_style.ex b/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/gauge_style.ex deleted file mode 100644 index b15731fc3..000000000 --- a/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/gauge_style.ex +++ /dev/null @@ -1,17 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.GaugeStyle do - use LiveViewNativePlatform.Modifier - - modifier_schema "gauge_style" do - field(:style, Ecto.Enum, values: ~w( - automatic - accessory_circular_capacity - accessory_linear_capacity - accessory_circular - linear_capacity - accessory_linear - )a) - end - - def params(style) when is_atom(style) and not is_boolean(style) and not is_nil(style), do: [style: style] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/horizontal_radio_group_layout.ex b/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/horizontal_radio_group_layout.ex deleted file mode 100644 index 3a11d025b..000000000 --- a/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/horizontal_radio_group_layout.ex +++ /dev/null @@ -1,6 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.HorizontalRadioGroupLayout do - use LiveViewNativePlatform.Modifier - - modifier_schema "horizontal_radio_group_layout" do - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/picker_style.ex b/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/picker_style.ex deleted file mode 100644 index 18638f4b0..000000000 --- a/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/picker_style.ex +++ /dev/null @@ -1,19 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.PickerStyle do - use LiveViewNativePlatform.Modifier - - modifier_schema "picker_style" do - field(:style, Ecto.Enum, values: ~w( - automatic - inline - menu - navigation_link - radio_group - segmented - wheel - palette - )a) - end - - def params(style) when is_atom(style) and not is_boolean(style) and not is_nil(style), do: [style: style] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/progress_view_style.ex b/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/progress_view_style.ex deleted file mode 100644 index e7a585ccf..000000000 --- a/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/progress_view_style.ex +++ /dev/null @@ -1,14 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ProgressViewStyle do - use LiveViewNativePlatform.Modifier - - modifier_schema "progress_view_style" do - field(:style, Ecto.Enum, values: ~w( - automatic - linear - circular - )a) - end - - def params(style) when is_atom(style) and not is_boolean(style) and not is_nil(style), do: [style: style] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/toggle_style.ex b/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/toggle_style.ex deleted file mode 100644 index aed065a83..000000000 --- a/lib/live_view_native_swift_ui/modifiers/controls_and_indicators/toggle_style.ex +++ /dev/null @@ -1,15 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ToggleStyle do - use LiveViewNativePlatform.Modifier - - modifier_schema "toggle_style" do - field(:style, Ecto.Enum, values: ~w( - automatic - button - switch - checkbox - )a) - end - - def params(style) when is_atom(style) and not is_boolean(style) and not is_nil(style), do: [style: style] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/documents/rename_action.ex b/lib/live_view_native_swift_ui/modifiers/documents/rename_action.ex deleted file mode 100644 index 1a4d249d3..000000000 --- a/lib/live_view_native_swift_ui/modifiers/documents/rename_action.ex +++ /dev/null @@ -1,18 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.RenameAction do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativePlatform.Modifier.Types.Event - - modifier_schema "rename_action" do - field :action, Event - end - - def params(params) do - with {:ok, _} <- Event.cast(params) do - [action: params] - else - _ -> - params - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/drag_and_drop/draggable.ex b/lib/live_view_native_swift_ui/modifiers/drag_and_drop/draggable.ex deleted file mode 100644 index bd5db456a..000000000 --- a/lib/live_view_native_swift_ui/modifiers/drag_and_drop/draggable.ex +++ /dev/null @@ -1,13 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Draggable do - alias LiveViewNativeSwiftUi.Types.KeyName - use LiveViewNativePlatform.Modifier - - modifier_schema "draggable" do - field :payload, :string - field :preview, KeyName - end - - def params(payload, [preview: preview]), do: [payload: payload, preview: preview] - def params(payload) when is_binary(payload), do: [payload: payload, preview: nil] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/drag_and_drop/drop_destination.ex b/lib/live_view_native_swift_ui/modifiers/drag_and_drop/drop_destination.ex deleted file mode 100644 index 691b31b9b..000000000 --- a/lib/live_view_native_swift_ui/modifiers/drag_and_drop/drop_destination.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.DropDestination do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativePlatform.Modifier.Types.Event - - modifier_schema "drop_destination" do - field :action, Event - field :is_targeted, Event - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/aspect_ratio.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/aspect_ratio.ex deleted file mode 100644 index e2d502533..000000000 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/aspect_ratio.ex +++ /dev/null @@ -1,11 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.AspectRatio do - use LiveViewNativePlatform.Modifier - - modifier_schema "aspect_ratio" do - field :aspect_ratio, {:array, :float}, default: [1.0, 1.0] - field :content_mode, Ecto.Enum, values: ~w(fill fit)a - end - - def params(aspect_ratio, params) when is_list(params) or is_map(params), do: [aspect_ratio: aspect_ratio, content_mode: params[:content_mode]] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/background_style.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/background_style.ex deleted file mode 100644 index 971fafd4e..000000000 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/background_style.ex +++ /dev/null @@ -1,18 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.BackgroundStyle do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.ShapeStyle - - modifier_schema "background_style" do - field :style, ShapeStyle - end - - def params(params) do - with {:ok, _} <- ShapeStyle.cast(params) do - [style: params] - else - _ -> - params - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/blend_mode.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/blend_mode.ex deleted file mode 100644 index 8a4ad9f32..000000000 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/blend_mode.ex +++ /dev/null @@ -1,33 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.BlendMode do - use LiveViewNativePlatform.Modifier - - modifier_schema "blend_mode" do - field(:blend_mode, Ecto.Enum, values: ~w( - normal - darken - multiply - color_burn - plus_darker - lighten - screen - color_dodge - plus_lighter - overlay - soft_light - hard_light - difference - exclusion - hue - saturation - color - luminosity - source_atop - destination_over - destination_out - )a) - end - - def params(blend_mode) when is_atom(blend_mode) and not is_boolean(blend_mode) and not is_nil(blend_mode), - do: [blend_mode: blend_mode] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/blur.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/blur.ex deleted file mode 100644 index a11016942..000000000 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/blur.ex +++ /dev/null @@ -1,8 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Blur do - use LiveViewNativePlatform.Modifier - - modifier_schema "blur" do - field :radius, :float - field :opaque, :boolean, default: false - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/border.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/border.ex deleted file mode 100644 index ce78cec1a..000000000 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/border.ex +++ /dev/null @@ -1,20 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Border do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.ShapeStyle - - modifier_schema "border" do - field :content, ShapeStyle - field :width, :float, default: 1.0 - end - - def params(content, [width: width]), do: [content: content, width: width] - def params(params) do - with {:ok, _} <- ShapeStyle.cast(params) do - [content: params, width: 1.0] - else - _ -> - params - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/brightness.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/brightness.ex deleted file mode 100644 index 5858eeb57..000000000 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/brightness.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Brightness do - use LiveViewNativePlatform.Modifier - - modifier_schema "brightness" do - field :amount, :float - end - - def params(amount) when is_number(amount), do: [amount: amount] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/clip_shape.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/clip_shape.ex deleted file mode 100644 index f75f017da..000000000 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/clip_shape.ex +++ /dev/null @@ -1,20 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ClipShape do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.{Shape, FillStyle} - - modifier_schema "clip_shape" do - field :shape, Shape - field :style, FillStyle - end - - def params(shape, [style: style]), do: [shape: shape, style: style] - def params(params) do - with {:ok, _} <- Shape.cast(params) do - [shape: params, style: nil] - else - _ -> - params - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/clipped.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/clipped.ex deleted file mode 100644 index e277c21dd..000000000 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/clipped.ex +++ /dev/null @@ -1,8 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Clipped do - use LiveViewNativePlatform.Modifier - - modifier_schema "clipped" do - field :antialiased, :boolean, default: false - end -end - diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/color_invert.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/color_invert.ex deleted file mode 100644 index 45d7883ce..000000000 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/color_invert.ex +++ /dev/null @@ -1,5 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ColorInvert do - use LiveViewNativePlatform.Modifier - - modifier_schema "color_invert" -end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/color_multiply.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/color_multiply.ex deleted file mode 100644 index ecc8eb29b..000000000 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/color_multiply.ex +++ /dev/null @@ -1,18 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ColorMultiply do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.Color - - modifier_schema "color_multiply" do - field :color, Color - end - - def params(params) do - with {:ok, _} <- Color.cast(params) do - [color: params] - else - _ -> - params - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/compositing_group.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/compositing_group.ex deleted file mode 100644 index bf25c6ef0..000000000 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/compositing_group.ex +++ /dev/null @@ -1,5 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.CompositingGroup do - use LiveViewNativePlatform.Modifier - - modifier_schema "compositing_group" -end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/contrast.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/contrast.ex deleted file mode 100644 index 5ef051555..000000000 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/contrast.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Contrast do - use LiveViewNativePlatform.Modifier - - modifier_schema "contrast" do - field :amount, :float - end - - def params(amount) when is_number(amount), do: [amount: amount] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/corner_radius.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/corner_radius.ex deleted file mode 100644 index 5a00f061c..000000000 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/corner_radius.ex +++ /dev/null @@ -1,12 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.CornerRadius do - use LiveViewNativePlatform.Modifier - - modifier_schema "corner_radius" do - field(:radius, :float) - field(:antialiased, :boolean, default: true) - end - - def params(radius, [antialiased: antialiased]), do: [radius: radius, antialiased: antialiased] - def params(radius) when is_number(radius), do: [radius: radius] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/drawing_group.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/drawing_group.ex deleted file mode 100644 index 9d4ff3643..000000000 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/drawing_group.ex +++ /dev/null @@ -1,8 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.DrawingGroup do - use LiveViewNativePlatform.Modifier - - modifier_schema "drawing_group" do - field :opaque, :boolean, default: false - field :color_mode, Ecto.Enum, values: ~w(extended_linear linear non_linear)a, default: :non_linear - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/foreground_color.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/foreground_color.ex deleted file mode 100644 index 226bcd691..000000000 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/foreground_color.ex +++ /dev/null @@ -1,13 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ForegroundColor do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.Color - - modifier_schema "foreground_color" do - field :color, Color - end - - def params(%Color{} = color), do: [color: color] - def params(params) when is_list(params) or is_map(params), do: params - def params(color), do: [color: color] -end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/foreground_style.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/foreground_style.ex deleted file mode 100644 index 21f79b763..000000000 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/foreground_style.ex +++ /dev/null @@ -1,17 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ForegroundStyle do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.ShapeStyle - - modifier_schema "foreground_style" do - field :primary, ShapeStyle - field :secondary, ShapeStyle - field :tertiary, ShapeStyle - end - - def params(%ShapeStyle{} = primary), do: [primary: primary] - def params(params) when is_list(params) or is_map(params), do: params - def params(primary), do: [primary: primary] - def params(primary, secondary), do: [primary: primary, secondary: secondary] - def params(primary, secondary, tertiary), do: [primary: primary, secondary: secondary, tertiary: tertiary] -end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/grayscale.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/grayscale.ex deleted file mode 100644 index 437face9f..000000000 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/grayscale.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Grayscale do - use LiveViewNativePlatform.Modifier - - modifier_schema "grayscale" do - field :amount, :float - end - - def params(amount) when is_number(amount), do: [amount: amount] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/hue_rotation.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/hue_rotation.ex deleted file mode 100644 index 3592dbc8f..000000000 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/hue_rotation.ex +++ /dev/null @@ -1,18 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.HueRotation do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.Angle - - modifier_schema "hue_rotation" do - field :angle, Angle - end - - def params(params) do - with {:ok, _} <- Angle.cast(params) do - [angle: params] - else - _ -> - params - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/luminance_to_alpha.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/luminance_to_alpha.ex deleted file mode 100644 index f22bdaf1d..000000000 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/luminance_to_alpha.ex +++ /dev/null @@ -1,5 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.LuminanceToAlpha do - use LiveViewNativePlatform.Modifier - - modifier_schema "luminance_to_alpha" -end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/mask.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/mask.ex deleted file mode 100644 index b58b87807..000000000 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/mask.ex +++ /dev/null @@ -1,22 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Mask do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.KeyName - - modifier_schema "mask" do - field :alignment, Ecto.Enum, values: ~w( - bottom - bottom_leading - bottom_trailing - center - leading - leading_last_text_baseline - top - top_leading - top_trailing - trailing - trailing_first_text_baseline - )a, default: :center - field :mask, KeyName - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/projection_effect.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/projection_effect.ex deleted file mode 100644 index 43efb6a58..000000000 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/projection_effect.ex +++ /dev/null @@ -1,18 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ProjectionEffect do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.ProjectionTransform - - modifier_schema "projection_effect" do - field :transform, ProjectionTransform - end - - def params(params) do - with {:ok, _} <- ProjectionTransform.cast(params) do - [transform: params] - else - _ -> - params - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/rotation_3d_effect.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/rotation_3d_effect.ex deleted file mode 100644 index 05eb83491..000000000 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/rotation_3d_effect.ex +++ /dev/null @@ -1,18 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Rotation3DEffect do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.Angle - alias LiveViewNativeSwiftUi.Types.Rotation3DEffectAxis - alias LiveViewNativeSwiftUi.Types.UnitPoint - - modifier_schema "rotation_3d_effect" do - field :angle, Angle - field :axis, Rotation3DEffectAxis - field :anchor, UnitPoint - field :anchor_z, :float, default: 0.0 - field :perspective, :float, default: 1.0 - end - - def params(angle, params) when is_list(params), do: [{:angle, angle} | params] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/rotation_effect.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/rotation_effect.ex deleted file mode 100644 index 15c14a853..000000000 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/rotation_effect.ex +++ /dev/null @@ -1,21 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.RotationEffect do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.Angle - alias LiveViewNativeSwiftUi.Types.UnitPoint - - modifier_schema "rotation_effect" do - field :angle, Angle - field :anchor, UnitPoint - end - - def params(angle, [anchor: anchor]), do: [angle: angle, anchor: anchor] - def params(params) do - with {:ok, _} <- Angle.cast(params) do - [angle: params, anchor: :center] - else - _ -> - params - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/saturation.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/saturation.ex deleted file mode 100644 index e57e53a12..000000000 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/saturation.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Saturation do - use LiveViewNativePlatform.Modifier - - modifier_schema "saturation" do - field :amount, :float - end - - def params(amount) when is_number(amount), do: [amount: amount] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/scale_effect.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/scale_effect.ex deleted file mode 100644 index 9f510bce5..000000000 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/scale_effect.ex +++ /dev/null @@ -1,12 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ScaleEffect do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.UnitPoint - - modifier_schema "scale_effect" do - field :x, :float - field :y, :float - field :scale, {:array, :float} - field :anchor, UnitPoint - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/scaled_to_fill.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/scaled_to_fill.ex deleted file mode 100644 index 5ca2b2ee4..000000000 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/scaled_to_fill.ex +++ /dev/null @@ -1,5 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ScaledToFill do - use LiveViewNativePlatform.Modifier - - modifier_schema "scaled_to_fill" -end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/scaled_to_fit.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/scaled_to_fit.ex deleted file mode 100644 index d832aa94c..000000000 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/scaled_to_fit.ex +++ /dev/null @@ -1,5 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ScaledToFit do - use LiveViewNativePlatform.Modifier - - modifier_schema "scaled_to_fit" -end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/shadow.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/shadow.ex deleted file mode 100644 index 86ac8bf6d..000000000 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/shadow.ex +++ /dev/null @@ -1,13 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Shadow do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.Color - - modifier_schema "shadow" do - field :color, Color - field :radius, :float - field :x, :float, default: 0.0 - field :y, :float, default: 0.0 - end -end - diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/tint.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/tint.ex deleted file mode 100644 index d57003e7b..000000000 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/tint.ex +++ /dev/null @@ -1,18 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Tint do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.Color - - modifier_schema "tint" do - field :color, Color - end - - def params(params) do - with {:ok, _} <- Color.cast(params) do - [color: params] - else - _ -> - params - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/transform_effect.ex b/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/transform_effect.ex deleted file mode 100644 index 6b1b46481..000000000 --- a/lib/live_view_native_swift_ui/modifiers/drawing_and_graphics/transform_effect.ex +++ /dev/null @@ -1,18 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.TransformEffect do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.AffineTransform - - modifier_schema "transform_effect" do - field :transform, AffineTransform - end - - def params(params) do - with {:ok, _} <- AffineTransform.cast(params) do - [transform: params] - else - _ -> - params - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/focus/focus_scope.ex b/lib/live_view_native_swift_ui/modifiers/focus/focus_scope.ex deleted file mode 100644 index 9e01c6fd5..000000000 --- a/lib/live_view_native_swift_ui/modifiers/focus/focus_scope.ex +++ /dev/null @@ -1,18 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.FocusScope do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.Namespace - - modifier_schema "focus_scope" do - field :namespace, Namespace - end - - def params(params) do - with {:ok, _} <- Namespace.cast(params) do - [namespace: params] - else - _ -> - params - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/focus/focus_section.ex b/lib/live_view_native_swift_ui/modifiers/focus/focus_section.ex deleted file mode 100644 index 403857d4f..000000000 --- a/lib/live_view_native_swift_ui/modifiers/focus/focus_section.ex +++ /dev/null @@ -1,5 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.FocusSection do - use LiveViewNativePlatform.Modifier - - modifier_schema "focus_section" -end diff --git a/lib/live_view_native_swift_ui/modifiers/focus/focusable.ex b/lib/live_view_native_swift_ui/modifiers/focus/focusable.ex deleted file mode 100644 index e49be4142..000000000 --- a/lib/live_view_native_swift_ui/modifiers/focus/focusable.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Focusable do - use LiveViewNativePlatform.Modifier - - modifier_schema "focusable" do - field :is_focusable, :boolean, default: true - end - - def params(is_focusable) when is_boolean(is_focusable), do: [is_focusable: is_focusable] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/focus/prefers_default_focus.ex b/lib/live_view_native_swift_ui/modifiers/focus/prefers_default_focus.ex deleted file mode 100644 index b798b0b50..000000000 --- a/lib/live_view_native_swift_ui/modifiers/focus/prefers_default_focus.ex +++ /dev/null @@ -1,14 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.PrefersDefaultFocus do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.Namespace - - modifier_schema "prefers_default_focus" do - field :prefers_default_focus, :boolean, default: true - field :namespace, Namespace - end - - def params(prefers_default_focus, [in: namespace]), do: [prefers_default_focus: prefers_default_focus, namespace: namespace] - def params([in: namespace]), do: [namespace: namespace] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/gestures/defers_system_gestures.ex b/lib/live_view_native_swift_ui/modifiers/gestures/defers_system_gestures.ex deleted file mode 100644 index dd1f697ab..000000000 --- a/lib/live_view_native_swift_ui/modifiers/gestures/defers_system_gestures.ex +++ /dev/null @@ -1,12 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.DefersSystemGestures do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.EdgeSet - - modifier_schema "defers_system_gestures" do - field :edges, EdgeSet - end - - def params([on: edges]), do: [edges: edges] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/gestures/gesture.ex b/lib/live_view_native_swift_ui/modifiers/gestures/gesture.ex deleted file mode 100644 index 0826e1689..000000000 --- a/lib/live_view_native_swift_ui/modifiers/gestures/gesture.ex +++ /dev/null @@ -1,16 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.OnTapGesture do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.Gesture - alias LiveViewNativePlatform.Modifier.Types.Event - - modifier_schema "gesture" do - field :gesture, Gesture - field :action, Event - field :priority, Ecto.Enum, values: ~w(low high simultaneous)a, default: :low - field :mask, Ecto.Enum, values: ~w(none gesture subviews all)a, default: :all - end - - def params(gesture, params), do: [{:gesture, gesture} | params] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/images/antialiased.ex b/lib/live_view_native_swift_ui/modifiers/images/antialiased.ex deleted file mode 100644 index a23556caf..000000000 --- a/lib/live_view_native_swift_ui/modifiers/images/antialiased.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Antialiased do - use LiveViewNativePlatform.Modifier - - modifier_schema "antialiased" do - field :is_active, :boolean, default: true - end - - def params(is_active) when is_boolean(is_active), do: [is_active: is_active] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/images/image_scale.ex b/lib/live_view_native_swift_ui/modifiers/images/image_scale.ex deleted file mode 100644 index 7dc2bf10c..000000000 --- a/lib/live_view_native_swift_ui/modifiers/images/image_scale.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ImageScale do - use LiveViewNativePlatform.Modifier - - modifier_schema "image_scale" do - field :scale, Ecto.Enum, values: ~w(small medium large)a - end - - def params(scale) when is_atom(scale) and not is_boolean(scale) and not is_nil(scale), do: [scale: scale] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/images/interpolation.ex b/lib/live_view_native_swift_ui/modifiers/images/interpolation.ex deleted file mode 100644 index ee20a9bef..000000000 --- a/lib/live_view_native_swift_ui/modifiers/images/interpolation.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Interpolation do - use LiveViewNativePlatform.Modifier - - modifier_schema "interpolation" do - field :interpolation, Ecto.Enum, values: ~w(low medium high none)a - end - - def params(interpolation) when is_atom(interpolation) and not is_boolean(interpolation) and not is_nil(interpolation), do: [interpolation: interpolation] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/images/rendering_mode.ex b/lib/live_view_native_swift_ui/modifiers/images/rendering_mode.ex deleted file mode 100644 index 2b1011611..000000000 --- a/lib/live_view_native_swift_ui/modifiers/images/rendering_mode.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.RenderingMode do - use LiveViewNativePlatform.Modifier - - modifier_schema "rendering_mode" do - field :mode, Ecto.Enum, values: ~w(original template)a - end - - def params(mode) when is_atom(mode) and not is_boolean(mode) and not is_nil(mode), do: [mode: mode] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/images/resizable.ex b/lib/live_view_native_swift_ui/modifiers/images/resizable.ex deleted file mode 100644 index abb112f70..000000000 --- a/lib/live_view_native_swift_ui/modifiers/images/resizable.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Resizable do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.EdgeInsets - - modifier_schema "resizable" do - field :cap_insets, EdgeInsets - field :resizing_mode, Ecto.Enum, values: ~w(stretch tile)a, default: :stretch - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/images/symbol_rendering_mode.ex b/lib/live_view_native_swift_ui/modifiers/images/symbol_rendering_mode.ex deleted file mode 100644 index 5b42fb2f3..000000000 --- a/lib/live_view_native_swift_ui/modifiers/images/symbol_rendering_mode.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.SymbolRenderingMode do - use LiveViewNativePlatform.Modifier - - modifier_schema "symbol_rendering_mode" do - field :mode, Ecto.Enum, values: ~w(hierarchical monochrome multicolor palette)a - end - - def params(mode) when is_atom(mode) and not is_boolean(mode) and not is_nil(mode), do: [mode: mode] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/images/symbol_variant.ex b/lib/live_view_native_swift_ui/modifiers/images/symbol_variant.ex deleted file mode 100644 index de5659ab8..000000000 --- a/lib/live_view_native_swift_ui/modifiers/images/symbol_variant.ex +++ /dev/null @@ -1,18 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.SymbolVariant do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.SymbolVariants - - modifier_schema "symbol_variant" do - field :variant, SymbolVariants - end - - def params(params) do - with {:ok, _} <- SymbolVariants.cast(params) do - [variant: params] - else - _ -> - params - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/input_events/allows_hit_testing.ex b/lib/live_view_native_swift_ui/modifiers/input_events/allows_hit_testing.ex deleted file mode 100644 index 72fa94fad..000000000 --- a/lib/live_view_native_swift_ui/modifiers/input_events/allows_hit_testing.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.AllowsHitTesting do - use LiveViewNativePlatform.Modifier - - modifier_schema "allows_hit_testing" do - field :enabled, :boolean - end - - def params(enabled) when is_boolean(enabled), do: [enabled: enabled] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/input_events/digital_crown_accessory.ex b/lib/live_view_native_swift_ui/modifiers/input_events/digital_crown_accessory.ex deleted file mode 100644 index 83911dd73..000000000 --- a/lib/live_view_native_swift_ui/modifiers/input_events/digital_crown_accessory.ex +++ /dev/null @@ -1,9 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.DigitalCrownAccessory do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.KeyName - - modifier_schema "digital_crown_accessory" do - field :content, KeyName - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/input_events/digital_crown_accessory_visibility.ex b/lib/live_view_native_swift_ui/modifiers/input_events/digital_crown_accessory_visibility.ex deleted file mode 100644 index b188a3503..000000000 --- a/lib/live_view_native_swift_ui/modifiers/input_events/digital_crown_accessory_visibility.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.DigitalCrownAccessoryVisibility do - use LiveViewNativePlatform.Modifier - - modifier_schema "digital_crown_accessory_visibility" do - field :visibility, Ecto.Enum, values: ~w(automatic visible hidden)a - end - - def params(visibility) when is_atom(visibility) and not is_boolean(visibility) and not is_nil(visibility), do: [visibility: visibility] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/input_events/hover_effect.ex b/lib/live_view_native_swift_ui/modifiers/input_events/hover_effect.ex deleted file mode 100644 index 21027a7fe..000000000 --- a/lib/live_view_native_swift_ui/modifiers/input_events/hover_effect.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.HoverEffect do - use LiveViewNativePlatform.Modifier - - modifier_schema "hover_effect" do - field :effect, Ecto.Enum, values: ~w(automatic highlight lift)a, default: :automatic - end - - def params(effect) when is_atom(effect) and not is_boolean(effect) and not is_nil(effect), do: [effect: effect] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/input_events/on_delete_command.ex b/lib/live_view_native_swift_ui/modifiers/input_events/on_delete_command.ex deleted file mode 100644 index e0ee7eb3f..000000000 --- a/lib/live_view_native_swift_ui/modifiers/input_events/on_delete_command.ex +++ /dev/null @@ -1,9 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.OnDeleteCommand do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativePlatform.Modifier.Types.Event - - modifier_schema "on_delete_command" do - field :perform, Event - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/input_events/on_hover.ex b/lib/live_view_native_swift_ui/modifiers/input_events/on_hover.ex deleted file mode 100644 index ee322249b..000000000 --- a/lib/live_view_native_swift_ui/modifiers/input_events/on_hover.ex +++ /dev/null @@ -1,9 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.OnHover do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativePlatform.Modifier.Types.Event - - modifier_schema "on_hover" do - field :perform, Event - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/input_events/on_move_command.ex b/lib/live_view_native_swift_ui/modifiers/input_events/on_move_command.ex deleted file mode 100644 index b6efe4db1..000000000 --- a/lib/live_view_native_swift_ui/modifiers/input_events/on_move_command.ex +++ /dev/null @@ -1,9 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.OnMoveCommand do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativePlatform.Modifier.Types.Event - - modifier_schema "on_move_command" do - field :action, Event - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/input_events/on_submit.ex b/lib/live_view_native_swift_ui/modifiers/input_events/on_submit.ex deleted file mode 100644 index dcbc4de16..000000000 --- a/lib/live_view_native_swift_ui/modifiers/input_events/on_submit.ex +++ /dev/null @@ -1,21 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.OnSubmit do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.SubmitTriggers - alias LiveViewNativePlatform.Modifier.Types.Event - - modifier_schema "on_submit" do - field :triggers, SubmitTriggers - field :action, Event - end - - def params([of: triggers], action), do: [triggers: triggers, action: action] - def params(params) do - with {:ok, _} <- Event.cast(params) do - [action: params] - else - _ -> - params - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/input_events/submit_scope.ex b/lib/live_view_native_swift_ui/modifiers/input_events/submit_scope.ex deleted file mode 100644 index ec8454f53..000000000 --- a/lib/live_view_native_swift_ui/modifiers/input_events/submit_scope.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.SubmitScope do - use LiveViewNativePlatform.Modifier - - modifier_schema "submit_scope" do - field :is_blocking, :boolean, default: true - end - - def params(is_blocking) when is_boolean(is_blocking), do: [is_blocking: is_blocking] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/layout_adjustments/coordinate_space.ex b/lib/live_view_native_swift_ui/modifiers/layout_adjustments/coordinate_space.ex deleted file mode 100644 index 5baeaa88a..000000000 --- a/lib/live_view_native_swift_ui/modifiers/layout_adjustments/coordinate_space.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.CoordinateSpace do - use LiveViewNativePlatform.Modifier - - modifier_schema "coordinate_space" do - field :name, :string - end - - def params(name) when is_binary(name), do: [name: name] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/layout_adjustments/fixed_size.ex b/lib/live_view_native_swift_ui/modifiers/layout_adjustments/fixed_size.ex deleted file mode 100644 index f8bd7afc9..000000000 --- a/lib/live_view_native_swift_ui/modifiers/layout_adjustments/fixed_size.ex +++ /dev/null @@ -1,8 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.FixedSize do - use LiveViewNativePlatform.Modifier - - modifier_schema "fixed_size" do - field :horizontal, :boolean - field :vertical, :boolean - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/layout_adjustments/frame.ex b/lib/live_view_native_swift_ui/modifiers/layout_adjustments/frame.ex deleted file mode 100644 index 933550b5a..000000000 --- a/lib/live_view_native_swift_ui/modifiers/layout_adjustments/frame.ex +++ /dev/null @@ -1,30 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Frame do - use LiveViewNativePlatform.Modifier - - modifier_schema "frame" do - field :width, :float - field :height, :float - - field :min_width, :float - field :ideal_width, :float - field :max_width, :float - - field :min_height, :float - field :ideal_height, :float - field :max_height, :float - - field :alignment, Ecto.Enum, values: ~w( - bottom - bottom_leading - bottom_trailing - center - leading - leading_last_text_baseline - top - top_leading - top_trailing - trailing - trailing_first_text_baseline - )a, default: :center - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/layout_adjustments/ignores_safe_area.ex b/lib/live_view_native_swift_ui/modifiers/layout_adjustments/ignores_safe_area.ex deleted file mode 100644 index a0cf42153..000000000 --- a/lib/live_view_native_swift_ui/modifiers/layout_adjustments/ignores_safe_area.ex +++ /dev/null @@ -1,13 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.IgnoresSafeArea do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.EdgeSet - - modifier_schema "ignores_safe_area" do - field :regions, Ecto.Enum, values: ~w(all container keyboard)a, default: :all - field :edges, EdgeSet - end - - def params(regions, [edges: edges]), do: [regions: regions, edges: edges] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/layout_adjustments/layout_priority.ex b/lib/live_view_native_swift_ui/modifiers/layout_adjustments/layout_priority.ex deleted file mode 100644 index 4066f1eb7..000000000 --- a/lib/live_view_native_swift_ui/modifiers/layout_adjustments/layout_priority.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.LayoutPriority do - use LiveViewNativePlatform.Modifier - - modifier_schema "layout_priority" do - field :value, :float - end - - def params(value) when is_number(value), do: [value: value] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/layout_adjustments/offset.ex b/lib/live_view_native_swift_ui/modifiers/layout_adjustments/offset.ex deleted file mode 100644 index 601876172..000000000 --- a/lib/live_view_native_swift_ui/modifiers/layout_adjustments/offset.ex +++ /dev/null @@ -1,8 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Offset do - use LiveViewNativePlatform.Modifier - - modifier_schema "offset" do - field :x, :float, default: 0.0 - field :y, :float, default: 0.0 - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/layout_adjustments/padding.ex b/lib/live_view_native_swift_ui/modifiers/layout_adjustments/padding.ex deleted file mode 100644 index e1d8b4d51..000000000 --- a/lib/live_view_native_swift_ui/modifiers/layout_adjustments/padding.ex +++ /dev/null @@ -1,24 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Padding do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.EdgeInsets - alias LiveViewNativeSwiftUi.Types.EdgeSet - - modifier_schema "padding" do - field :insets, EdgeInsets - field :edges, EdgeSet - field :length, :float - end - - def params(), do: [] - - def params(edges, length) when is_atom(edges) or is_list(edges), do: [edges: edges, length: length] - - def params(length) when is_number(length), do: [length: length] - def params(edges) when is_atom(edges) and not is_boolean(edges) and not is_nil(edges), do: [edges: edges] - def params([e | _] = edges) when is_atom(e) and not is_boolean(e) and not is_nil(e), do: [edges: edges] - def params([{k, v} | _] = insets) when is_atom(k) and not is_boolean(k) and not is_nil(k) and is_number(v), do: [insets: insets] - def params(insets) when is_map(insets), do: [insets: insets] - - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/layout_adjustments/position.ex b/lib/live_view_native_swift_ui/modifiers/layout_adjustments/position.ex deleted file mode 100644 index 97e469f4f..000000000 --- a/lib/live_view_native_swift_ui/modifiers/layout_adjustments/position.ex +++ /dev/null @@ -1,8 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Position do - use LiveViewNativePlatform.Modifier - - modifier_schema "position" do - field :x, :float, default: 0.0 - field :y, :float, default: 0.0 - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/layout_adjustments/safe_area_inset.ex b/lib/live_view_native_swift_ui/modifiers/layout_adjustments/safe_area_inset.ex deleted file mode 100644 index 07b605eab..000000000 --- a/lib/live_view_native_swift_ui/modifiers/layout_adjustments/safe_area_inset.ex +++ /dev/null @@ -1,12 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.SafeAreaInset do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.{KeyName, Edge} - - modifier_schema "safe_area_inset" do - field :edge, Edge - field :alignment, Ecto.Enum, values: ~w(leading trailing top bottom center)a, default: :center - field :spacing, :float - field :content, KeyName - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/layout_adjustments/scene_padding.ex b/lib/live_view_native_swift_ui/modifiers/layout_adjustments/scene_padding.ex deleted file mode 100644 index 2c16e1d92..000000000 --- a/lib/live_view_native_swift_ui/modifiers/layout_adjustments/scene_padding.ex +++ /dev/null @@ -1,14 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ScenePadding do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.EdgeSet - - modifier_schema "scene_padding" do - field :padding, Ecto.Enum, values: ~w(automatic minimum navigation_bar)a, default: :automatic - field :edges, EdgeSet - end - - def params(padding, [edges: edges]), do: [padding: padding, edges: edges] - def params(padding) when is_atom(padding) and not is_boolean(padding) and not is_nil(padding), do: [padding: padding] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/layout_fundamentals/background.ex b/lib/live_view_native_swift_ui/modifiers/layout_fundamentals/background.ex deleted file mode 100644 index c6a9075fb..000000000 --- a/lib/live_view_native_swift_ui/modifiers/layout_fundamentals/background.ex +++ /dev/null @@ -1,34 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Background do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.{KeyName, ShapeStyle, Shape, EdgeSet, FillStyle} - - modifier_schema "background" do - field :alignment, Ecto.Enum, values: ~w( - bottom - bottom_leading - bottom_trailing - center - leading - leading_last_text_baseline - top - top_leading - top_trailing - trailing - trailing_first_text_baseline - )a - field :content, KeyName - field :style, ShapeStyle - field :shape, Shape - field :ignores_safe_area_edges, EdgeSet - field :fill_style, FillStyle - end - - def params({type, _} = style, [in: shape, fill_style: fill_style]) when is_atom(type) and not is_boolean(type) and not is_nil(type), do: [style: style, shape: shape, fill_style: fill_style] - def params({type, _} = style, [in: shape]) when is_atom(type) and not is_boolean(type) and not is_nil(type), do: [style: style, shape: shape] - def params({type, _} = style, [ignores_safe_area_edges: edges]) when is_atom(type) and not is_boolean(type) and not is_nil(type), do: [style: style, ignores_safe_area_edges: edges] - def params([in: shape, fill_style: fill_style]), do: [shape: shape, fill_style: fill_style] - def params([in: shape]), do: [shape: shape] - def params({type, _} = style) when is_atom(type) and not is_boolean(type) and not is_nil(type), do: [style: style] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/layout_fundamentals/grid_cell_anchor.ex b/lib/live_view_native_swift_ui/modifiers/layout_fundamentals/grid_cell_anchor.ex deleted file mode 100644 index ca81d6091..000000000 --- a/lib/live_view_native_swift_ui/modifiers/layout_fundamentals/grid_cell_anchor.ex +++ /dev/null @@ -1,18 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.GridCellAnchor do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.UnitPoint - - modifier_schema "grid_cell_anchor" do - field :anchor, UnitPoint - end - - def params(params) do - with {:ok, _} <- UnitPoint.cast(params) do - [anchor: params] - else - _ -> - params - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/layout_fundamentals/grid_cell_columns.ex b/lib/live_view_native_swift_ui/modifiers/layout_fundamentals/grid_cell_columns.ex deleted file mode 100644 index bc43d2f5b..000000000 --- a/lib/live_view_native_swift_ui/modifiers/layout_fundamentals/grid_cell_columns.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.GridCellColumns do - use LiveViewNativePlatform.Modifier - - modifier_schema "grid_cell_columns" do - field :count, :integer - end - - def params(count) when is_number(count), do: [count: count] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/layout_fundamentals/grid_cell_unsized_axes.ex b/lib/live_view_native_swift_ui/modifiers/layout_fundamentals/grid_cell_unsized_axes.ex deleted file mode 100644 index 10b102ab5..000000000 --- a/lib/live_view_native_swift_ui/modifiers/layout_fundamentals/grid_cell_unsized_axes.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.GridCellUnsizedAxes do - use LiveViewNativePlatform.Modifier - - modifier_schema "grid_cell_unsized_axes" do - field :axes, Ecto.Enum, values: [:horizontal, :vertical, :all] - end - - def params(axes) when is_atom(axes) and not is_boolean(axes) and not is_nil(axes), do: [axes: axes] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/layout_fundamentals/grid_column_alignment.ex b/lib/live_view_native_swift_ui/modifiers/layout_fundamentals/grid_column_alignment.ex deleted file mode 100644 index badb63b32..000000000 --- a/lib/live_view_native_swift_ui/modifiers/layout_fundamentals/grid_column_alignment.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.GridColumnAlignment do - use LiveViewNativePlatform.Modifier - - modifier_schema "grid_column_alignment" do - field :guide, Ecto.Enum, values: [:leading, :center, :trailing] - end - - def params(guide) when is_atom(guide) and not is_boolean(guide) and not is_nil(guide), do: [guide: guide] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/layout_fundamentals/overlay.ex b/lib/live_view_native_swift_ui/modifiers/layout_fundamentals/overlay.ex deleted file mode 100644 index 4bbd10a0d..000000000 --- a/lib/live_view_native_swift_ui/modifiers/layout_fundamentals/overlay.ex +++ /dev/null @@ -1,32 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Overlay do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.{KeyName, ShapeStyle, Shape, EdgeSet, FillStyle} - - modifier_schema "overlay" do - field :alignment, Ecto.Enum, values: ~w( - bottom - bottom_leading - bottom_trailing - center - leading - leading_last_text_baseline - top - top_leading - top_trailing - trailing - trailing_first_text_baseline - )a - field :content, KeyName - field :style, ShapeStyle - field :shape, Shape - field :ignores_safe_area_edges, EdgeSet - field :fill_style, FillStyle - end - - def params({type, _} = style, [in: shape, fill_style: fill_style]) when is_atom(type) and not is_boolean(type) and not is_nil(type), do: [style: style, shape: shape, fill_style: fill_style] - def params({type, _} = style, [in: shape]) when is_atom(type) and not is_boolean(type) and not is_nil(type), do: [style: style, shape: shape] - def params({type, _} = style, [ignores_safe_area_edges: edges]) when is_atom(type) and not is_boolean(type) and not is_nil(type), do: [style: style, ignores_safe_area_edges: edges] - def params({type, _} = style) when is_atom(type) and not is_boolean(type) and not is_nil(type), do: [style: style] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/layout_fundamentals/z_index.ex b/lib/live_view_native_swift_ui/modifiers/layout_fundamentals/z_index.ex deleted file mode 100644 index 64db0d8a1..000000000 --- a/lib/live_view_native_swift_ui/modifiers/layout_fundamentals/z_index.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ZIndex do - use LiveViewNativePlatform.Modifier - - modifier_schema "z_index" do - field :value, :float - end - - def params(value) when is_number(value), do: [value: value] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/lists/badge.ex b/lib/live_view_native_swift_ui/modifiers/lists/badge.ex deleted file mode 100644 index 87931367b..000000000 --- a/lib/live_view_native_swift_ui/modifiers/lists/badge.ex +++ /dev/null @@ -1,22 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Badge do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.KeyName - - modifier_schema "badge" do - field :content, KeyName - field :label, :string - field :count, :integer - end - - def params(label) when is_binary(label), do: [label: label] - def params(count) when is_number(count), do: [count: count] - def params(params) do - with {:ok, _} <- KeyName.cast(params) do - [content: params] - else - _ -> - params - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/lists/delete_disabled.ex b/lib/live_view_native_swift_ui/modifiers/lists/delete_disabled.ex deleted file mode 100644 index e0b476e9e..000000000 --- a/lib/live_view_native_swift_ui/modifiers/lists/delete_disabled.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.DeleteDisabled do - use LiveViewNativePlatform.Modifier - - modifier_schema "delete_disabled" do - field :is_disabled, :boolean - end - - def params(is_disabled) when is_boolean(is_disabled), do: [is_disabled: is_disabled] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/lists/disclosure_group_style.ex b/lib/live_view_native_swift_ui/modifiers/lists/disclosure_group_style.ex deleted file mode 100644 index 55b13e48b..000000000 --- a/lib/live_view_native_swift_ui/modifiers/lists/disclosure_group_style.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.DisclosureGroupStyle do - use LiveViewNativePlatform.Modifier - - modifier_schema "disclosure_group_style" do - field :style, Ecto.Enum, values: ~w(automatic)a - end - - def params(style) when is_atom(style) and not is_boolean(style) and not is_nil(style), do: [style: style] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/lists/header_prominence.ex b/lib/live_view_native_swift_ui/modifiers/lists/header_prominence.ex deleted file mode 100644 index 21952870f..000000000 --- a/lib/live_view_native_swift_ui/modifiers/lists/header_prominence.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.HeaderProminence do - use LiveViewNativePlatform.Modifier - - modifier_schema "header_prominence" do - field :prominence, Ecto.Enum, values: ~w(increased standard)a - end - - def params(prominence) when is_atom(prominence) and not is_boolean(prominence) and not is_nil(prominence), do: [prominence: prominence] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/lists/list_item_tint.ex b/lib/live_view_native_swift_ui/modifiers/lists/list_item_tint.ex deleted file mode 100644 index de1c7e053..000000000 --- a/lib/live_view_native_swift_ui/modifiers/lists/list_item_tint.ex +++ /dev/null @@ -1,18 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ListItemTint do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.ListItemTint - - modifier_schema "list_item_tint" do - field :tint, ListItemTint - end - - def params(params) do - with {:ok, _} <- ListItemTint.cast(params) do - [tint: params] - else - _ -> - params - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/lists/list_row_background.ex b/lib/live_view_native_swift_ui/modifiers/lists/list_row_background.ex deleted file mode 100644 index 69a00e589..000000000 --- a/lib/live_view_native_swift_ui/modifiers/lists/list_row_background.ex +++ /dev/null @@ -1,18 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ListRowBackground do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.KeyName - - modifier_schema "list_row_background" do - field :content, KeyName - end - - def params(params) do - with {:ok, _} <- KeyName.cast(params) do - [content: params] - else - _ -> - params - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/lists/list_row_insets.ex b/lib/live_view_native_swift_ui/modifiers/lists/list_row_insets.ex deleted file mode 100644 index 310f053e0..000000000 --- a/lib/live_view_native_swift_ui/modifiers/lists/list_row_insets.ex +++ /dev/null @@ -1,18 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ListRowInsets do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.EdgeInsets - - modifier_schema "list_row_insets" do - field :insets, EdgeInsets - end - - def params(params) do - with {:ok, _} <- EdgeInsets.cast(params) do - [insets: params] - else - _ -> - params - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/lists/list_row_separator.ex b/lib/live_view_native_swift_ui/modifiers/lists/list_row_separator.ex deleted file mode 100644 index 467ddb29b..000000000 --- a/lib/live_view_native_swift_ui/modifiers/lists/list_row_separator.ex +++ /dev/null @@ -1,12 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ListRowSeparator do - use LiveViewNativePlatform.Modifier - - modifier_schema "list_row_separator" do - field :visibility, Ecto.Enum, values: ~w(automatic visible hidden)a - field :edges, Ecto.Enum, values: ~w(all bottom top)a, default: :all - end - - def params(visibility, [edges: edges]), do: [visibility: visibility, edges: edges] - def params(visibility) when is_atom(visibility) and not is_boolean(visibility) and not is_nil(visibility), do: [visibility: visibility] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/lists/list_row_separator_tint.ex b/lib/live_view_native_swift_ui/modifiers/lists/list_row_separator_tint.ex deleted file mode 100644 index 75bace833..000000000 --- a/lib/live_view_native_swift_ui/modifiers/lists/list_row_separator_tint.ex +++ /dev/null @@ -1,20 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ListRowSeparatorTint do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.Color - - modifier_schema "list_row_separator_tint" do - field :color, Color - field :edges, Ecto.Enum, values: ~w(all bottom top)a, default: :all - end - - def params(color, [edges: edges]), do: [color: color, edges: edges] - def params(params) do - with {:ok, _} <- Color.cast(params) do - [color: params] - else - _ -> - params - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/lists/list_section_separator.ex b/lib/live_view_native_swift_ui/modifiers/lists/list_section_separator.ex deleted file mode 100644 index 39bb90e74..000000000 --- a/lib/live_view_native_swift_ui/modifiers/lists/list_section_separator.ex +++ /dev/null @@ -1,12 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ListSectionSeparator do - use LiveViewNativePlatform.Modifier - - modifier_schema "list_section_separator" do - field :visibility, Ecto.Enum, values: ~w(automatic hidden visible)a - field :edges, Ecto.Enum, values: ~w(all bottom top)a, default: :all - end - - def params(visibility, [edges: edges]), do: [visibility: visibility, edges: edges] - def params(visibility) when is_atom(visibility) and not is_boolean(visibility) and not is_nil(visibility), do: [visibility: visibility] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/lists/list_section_separator_tint.ex b/lib/live_view_native_swift_ui/modifiers/lists/list_section_separator_tint.ex deleted file mode 100644 index b72902e8c..000000000 --- a/lib/live_view_native_swift_ui/modifiers/lists/list_section_separator_tint.ex +++ /dev/null @@ -1,20 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ListSectionSeparatorTint do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.Color - - modifier_schema "list_section_separator_tint" do - field :color, Color - field :edges, Ecto.Enum, values: ~w(all bottom top)a, default: :all - end - - def params(color, [edges: edges]), do: [color: color, edges: edges] - def params(params) do - with {:ok, _} <- Color.cast(params) do - [color: params] - else - _ -> - params - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/lists/list_style.ex b/lib/live_view_native_swift_ui/modifiers/lists/list_style.ex deleted file mode 100644 index 971e2471c..000000000 --- a/lib/live_view_native_swift_ui/modifiers/lists/list_style.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ListStyle do - use LiveViewNativePlatform.Modifier - - modifier_schema "list_style" do - field :style, Ecto.Enum, values: ~w(automatic bordered bordered_alternating carousel elliptical grouped inset inset_grouped inset_alternating plain sidebar)a - end - - def params(style) when is_atom(style) and not is_boolean(style) and not is_nil(style), do: [style: style] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/lists/move_disabled.ex b/lib/live_view_native_swift_ui/modifiers/lists/move_disabled.ex deleted file mode 100644 index 11e0ae37a..000000000 --- a/lib/live_view_native_swift_ui/modifiers/lists/move_disabled.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.MoveDisabled do - use LiveViewNativePlatform.Modifier - - modifier_schema "move_disabled" do - field :is_disabled, :boolean - end - - def params(is_disabled) when is_boolean(is_disabled), do: [is_disabled: is_disabled] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/lists/refreshable.ex b/lib/live_view_native_swift_ui/modifiers/lists/refreshable.ex deleted file mode 100644 index 98590e9e8..000000000 --- a/lib/live_view_native_swift_ui/modifiers/lists/refreshable.ex +++ /dev/null @@ -1,9 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Refreshable do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativePlatform.Modifier.Types.Event - - modifier_schema "refreshable" do - field :action, Event - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/lists/swipe_actions.ex b/lib/live_view_native_swift_ui/modifiers/lists/swipe_actions.ex deleted file mode 100644 index 34ff99599..000000000 --- a/lib/live_view_native_swift_ui/modifiers/lists/swipe_actions.ex +++ /dev/null @@ -1,11 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.SwipeActions do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.KeyName - - modifier_schema "swipe_actions" do - field :allows_full_swipe, :boolean, default: true - field :content, KeyName - field :edge, Ecto.Enum, values: ~w(leading trailing)a, default: :trailing - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/menus_and_commands/context_menu.ex b/lib/live_view_native_swift_ui/modifiers/menus_and_commands/context_menu.ex deleted file mode 100644 index 6becb69a7..000000000 --- a/lib/live_view_native_swift_ui/modifiers/menus_and_commands/context_menu.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ContextMenu do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.KeyName - - modifier_schema "context_menu" do - field(:menu_items, KeyName) - field(:preview, KeyName, default: nil) - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/menus_and_commands/menu_action_dismiss_behavior.ex b/lib/live_view_native_swift_ui/modifiers/menus_and_commands/menu_action_dismiss_behavior.ex deleted file mode 100644 index f786051d1..000000000 --- a/lib/live_view_native_swift_ui/modifiers/menus_and_commands/menu_action_dismiss_behavior.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.MenuActionDismissBehavior do - use LiveViewNativePlatform.Modifier - - modifier_schema "menu_action_dismiss_behavior" do - field(:behavior, Ecto.Enum, values: ~w(automatic enabled disabled)a) - end - - def params(behavior) when is_atom(behavior) and not is_boolean(behavior) and not is_nil(behavior), do: [behavior: behavior] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/menus_and_commands/menu_indicator_visibility.ex b/lib/live_view_native_swift_ui/modifiers/menus_and_commands/menu_indicator_visibility.ex deleted file mode 100644 index 3a3b9b8be..000000000 --- a/lib/live_view_native_swift_ui/modifiers/menus_and_commands/menu_indicator_visibility.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.MenuIndicatorVisibility do - use LiveViewNativePlatform.Modifier - - modifier_schema "menu_indicator" do - field(:visibility, Ecto.Enum, values: ~w(automatic hidden visible)a) - end - - def params(visibility) when is_atom(visibility) and not is_boolean(visibility) and not is_nil(visibility), do: [visibility: visibility] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/menus_and_commands/menu_order.ex b/lib/live_view_native_swift_ui/modifiers/menus_and_commands/menu_order.ex deleted file mode 100644 index e60b3fd21..000000000 --- a/lib/live_view_native_swift_ui/modifiers/menus_and_commands/menu_order.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.MenuOrder do - use LiveViewNativePlatform.Modifier - - modifier_schema "menu_order" do - field(:order, Ecto.Enum, values: ~w(automatic fixed priority)a) - end - - def params(order) when is_atom(order) and not is_boolean(order) and not is_nil(order), do: [order: order] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/menus_and_commands/menu_style.ex b/lib/live_view_native_swift_ui/modifiers/menus_and_commands/menu_style.ex deleted file mode 100644 index c149ba841..000000000 --- a/lib/live_view_native_swift_ui/modifiers/menus_and_commands/menu_style.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.MenuStyle do - use LiveViewNativePlatform.Modifier - - modifier_schema "menu_style" do - field(:style, Ecto.Enum, values: ~w(automatic button)a) - end - - def params(style) when is_atom(style) and not is_boolean(style) and not is_nil(style), do: [style: style] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/modal_presentations/alert.ex b/lib/live_view_native_swift_ui/modifiers/modal_presentations/alert.ex deleted file mode 100644 index 556e2104d..000000000 --- a/lib/live_view_native_swift_ui/modifiers/modal_presentations/alert.ex +++ /dev/null @@ -1,17 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Alert do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.{KeyName} - - modifier_schema "alert" do - field(:title, :string) - field(:actions, KeyName) - field(:message, KeyName, default: nil) - field(:is_presented, :boolean) - - change_event() - end - - def params(title, params) when is_binary(title) and is_list(params), do: [{:title, title} | params] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/modal_presentations/confirmation_dialog.ex b/lib/live_view_native_swift_ui/modifiers/modal_presentations/confirmation_dialog.ex deleted file mode 100644 index e5c4894ed..000000000 --- a/lib/live_view_native_swift_ui/modifiers/modal_presentations/confirmation_dialog.ex +++ /dev/null @@ -1,20 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ConfirmationDialog do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.{KeyName} - - modifier_schema "confirmation_dialog" do - field(:title, :string) - - field(:title_visibility, Ecto.Enum, values: ~w(automatic visible hidden)a, default: :automatic) - - field(:actions, KeyName) - field(:message, KeyName, default: nil) - field(:is_presented, :boolean) - - change_event() - end - - def params(title, params) when is_binary(title) and is_list(params), do: [{:title, title} | params] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/modal_presentations/full_screen_cover.ex b/lib/live_view_native_swift_ui/modifiers/modal_presentations/full_screen_cover.ex deleted file mode 100644 index 0fa89f8e6..000000000 --- a/lib/live_view_native_swift_ui/modifiers/modal_presentations/full_screen_cover.ex +++ /dev/null @@ -1,14 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.FullScreenCover do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.KeyName - alias LiveViewNativePlatform.Modifier.Types.Event - - modifier_schema "full_screen_cover" do - field(:is_presented, :boolean) - field(:on_dismiss, Event, default: nil) - field(:content, KeyName) - - change_event() - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/modal_presentations/interactive_dismiss_disabled.ex b/lib/live_view_native_swift_ui/modifiers/modal_presentations/interactive_dismiss_disabled.ex deleted file mode 100644 index 62e7555ed..000000000 --- a/lib/live_view_native_swift_ui/modifiers/modal_presentations/interactive_dismiss_disabled.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.InteractiveDismissDisabled do - use LiveViewNativePlatform.Modifier - - modifier_schema "interactive_dismiss_disabled" do - field(:disabled, :boolean, default: true) - end - - def params(disabled) when is_boolean(disabled), do: [disabled: disabled] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/modal_presentations/popover.ex b/lib/live_view_native_swift_ui/modifiers/modal_presentations/popover.ex deleted file mode 100644 index 1c476cc7b..000000000 --- a/lib/live_view_native_swift_ui/modifiers/modal_presentations/popover.ex +++ /dev/null @@ -1,14 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Popover do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.{PopoverAttachmentAnchor, Edge, KeyName} - - modifier_schema "popover" do - field :is_presented, :boolean - field :attachment_anchor, PopoverAttachmentAnchor - field :arrow_edge, Edge - field :content, KeyName - - change_event() - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_background.ex b/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_background.ex deleted file mode 100644 index ce416f0aa..000000000 --- a/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_background.ex +++ /dev/null @@ -1,31 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.PresentationBackground do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.{KeyName, ShapeStyle} - - modifier_schema "presentation_background" do - field(:style, ShapeStyle, default: nil) - - field(:alignment, Ecto.Enum, - values: ~w( - bottom - bottom_leading - bottom_trailing - center - leading - leading_last_text_baseline - top - top_leading - top_trailing - trailing - trailing_first_text_baseline - )a, - default: :center - ) - - field(:content, KeyName, default: nil) - end - - def params(style) when is_atom(style) and not is_boolean(style) and not is_nil(style), do: [style: style] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_background_interaction.ex b/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_background_interaction.ex deleted file mode 100644 index 3b468ccb4..000000000 --- a/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_background_interaction.ex +++ /dev/null @@ -1,14 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.PresentationBackgroundInteraction do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.PresentationDetent - - modifier_schema "presentation_background_interaction" do - field(:mode, Ecto.Enum, values: ~w(automatic disabled enabled)a) - field(:maximum_detent, PresentationDetent, default: nil) - end - - def params(mode) when is_atom(mode) and not is_boolean(mode) and not is_nil(mode), do: [mode: mode] - def params({:enabled = mode, [up_through: maximum_detent]}), do: [mode: mode, maximum_detent: maximum_detent] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_compact_adaptation.ex b/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_compact_adaptation.ex deleted file mode 100644 index 812c2b643..000000000 --- a/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_compact_adaptation.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.PresentationCompactAdaptation do - use LiveViewNativePlatform.Modifier - - @adaptations ~w(automatic none popover sheet full_screen_cover)a - - modifier_schema "presentation_compact_adaptation" do - field :horizontal, Ecto.Enum, values: @adaptations - field :vertical, Ecto.Enum, values: @adaptations - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_content_interaction.ex b/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_content_interaction.ex deleted file mode 100644 index 012a30112..000000000 --- a/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_content_interaction.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.PresentationContentInteraction do - use LiveViewNativePlatform.Modifier - - modifier_schema "presentation_content_interaction" do - field(:interaction, Ecto.Enum, values: ~w(automatic resizes scrolls)a) - end - - def params(interaction) when is_atom(interaction) and not is_boolean(interaction) and not is_nil(interaction), do: [interaction: interaction] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_corner_radius.ex b/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_corner_radius.ex deleted file mode 100644 index 5ae8d50a3..000000000 --- a/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_corner_radius.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.PresentationCornerRadius do - use LiveViewNativePlatform.Modifier - - modifier_schema "presentation_corner_radius" do - field(:radius, :float) - end - - def params(radius) when is_number(radius), do: [radius: radius] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_detents.ex b/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_detents.ex deleted file mode 100644 index 6c0fb6916..000000000 --- a/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_detents.ex +++ /dev/null @@ -1,23 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.PresentationDetents do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.{PresentationDetent} - - modifier_schema "presentation_detents" do - field :detents, {:array, PresentationDetent} - field :selection, :integer, default: nil - - change_event() - end - - def params(detents, [selection: selection]), do: [detents: detents, selection: selection] - def params([detent | _] = params) do - with {:ok, _} <- PresentationDetent.cast(detent) do - [detents: params] - else - _ -> - params - end - end - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_drag_indicator.ex b/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_drag_indicator.ex deleted file mode 100644 index 7f964876d..000000000 --- a/lib/live_view_native_swift_ui/modifiers/modal_presentations/presentation_drag_indicator.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.PresentationDragIndicator do - use LiveViewNativePlatform.Modifier - - modifier_schema "presentation_drag_indicator" do - field(:visibility, Ecto.Enum, values: ~w(automatic visible hidden)a) - end - - def params(visibility) when is_atom(visibility) and not is_boolean(visibility) and not is_nil(visibility), do: [visibility: visibility] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/modal_presentations/sheet.ex b/lib/live_view_native_swift_ui/modifiers/modal_presentations/sheet.ex deleted file mode 100644 index 961a6f088..000000000 --- a/lib/live_view_native_swift_ui/modifiers/modal_presentations/sheet.ex +++ /dev/null @@ -1,14 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Sheet do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.KeyName - alias LiveViewNativePlatform.Modifier.Types.Event - - modifier_schema "sheet" do - field(:is_presented, :boolean) - field(:on_dismiss, Event, default: nil) - field(:content, KeyName) - - change_event() - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/navigation/navigation_bar_back_button_hidden.ex b/lib/live_view_native_swift_ui/modifiers/navigation/navigation_bar_back_button_hidden.ex deleted file mode 100644 index 5ca1d5127..000000000 --- a/lib/live_view_native_swift_ui/modifiers/navigation/navigation_bar_back_button_hidden.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.NavigationBarBackButtonHidden do - use LiveViewNativePlatform.Modifier - - modifier_schema "navigation_bar_back_button_hidden" do - field :hides_back_button, :boolean, default: true - end - - def params(hides_back_button) when is_boolean(hides_back_button), do: [hides_back_button: hides_back_button] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/navigation/navigation_bar_title_display_mode.ex b/lib/live_view_native_swift_ui/modifiers/navigation/navigation_bar_title_display_mode.ex deleted file mode 100644 index 439040e3e..000000000 --- a/lib/live_view_native_swift_ui/modifiers/navigation/navigation_bar_title_display_mode.ex +++ /dev/null @@ -1,14 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.NavigationBarTitleDisplayMode do - use LiveViewNativePlatform.Modifier - - modifier_schema "navigation_bar_title_display_mode" do - field(:display_mode, Ecto.Enum, values: ~w( - automatic - inline - large - )a) - end - - def params(display_mode) when is_atom(display_mode) and not is_boolean(display_mode) and not is_nil(display_mode), do: [display_mode: display_mode] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/navigation/navigation_subtitle.ex b/lib/live_view_native_swift_ui/modifiers/navigation/navigation_subtitle.ex deleted file mode 100644 index 52a16a1f7..000000000 --- a/lib/live_view_native_swift_ui/modifiers/navigation/navigation_subtitle.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.NavigationSubtitle do - use LiveViewNativePlatform.Modifier - - modifier_schema "navigation_subtitle" do - field :subtitle, :string - end - - def params(subtitle) when is_binary(subtitle), do: [subtitle: subtitle] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/navigation/navigation_title.ex b/lib/live_view_native_swift_ui/modifiers/navigation/navigation_title.ex deleted file mode 100644 index fb4708f0b..000000000 --- a/lib/live_view_native_swift_ui/modifiers/navigation/navigation_title.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.NavigationTitle do - use LiveViewNativePlatform.Modifier - - modifier_schema "navigation_title" do - field :title, :string - end - - def params(title) when is_binary(title), do: [title: title] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/navigation/tab_item.ex b/lib/live_view_native_swift_ui/modifiers/navigation/tab_item.ex deleted file mode 100644 index b8f476188..000000000 --- a/lib/live_view_native_swift_ui/modifiers/navigation/tab_item.ex +++ /dev/null @@ -1,18 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.TabItem do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.KeyName - - modifier_schema "tab_item" do - field :label, KeyName - end - - def params(params) do - with {:ok, _} <- KeyName.cast(params) do - [label: params] - else - _ -> - params - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/navigation/tab_view_style.ex b/lib/live_view_native_swift_ui/modifiers/navigation/tab_view_style.ex deleted file mode 100644 index 559688901..000000000 --- a/lib/live_view_native_swift_ui/modifiers/navigation/tab_view_style.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.TabViewStyle do - use LiveViewNativePlatform.Modifier - - modifier_schema "tab_view_style" do - field :style, Ecto.Enum, values: ~w(automatic carousel page page_always page_never)a - end - - def params(style) when is_atom(style) and not is_boolean(style) and not is_nil(style), do: [style: style] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_bounce_behavior.ex b/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_bounce_behavior.ex deleted file mode 100644 index d3f53517b..000000000 --- a/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_bounce_behavior.ex +++ /dev/null @@ -1,12 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ScrollBounceBehavior do - use LiveViewNativePlatform.Modifier - - modifier_schema "scroll_bounce_behavior" do - field :behavior, Ecto.Enum, values: ~w(automatic always based_on_size)a - field :axes, Ecto.Enum, values: [:horizontal, :vertical, :all], default: :vertical - end - - def params(behavior, params) when is_list(params), do: [{:behavior, behavior} | params] - def params(behavior) when is_atom(behavior) and not is_boolean(behavior) and not is_nil(behavior), do: [behavior: behavior] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_content_background.ex b/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_content_background.ex deleted file mode 100644 index 1701fa6d5..000000000 --- a/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_content_background.ex +++ /dev/null @@ -1,9 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ScrollContentBackground do - use LiveViewNativePlatform.Modifier - - modifier_schema "scroll_content_background" do - field :visibility, Ecto.Enum, values: ~w(automatic visible hidden)a - end - - def params(visibility) when is_atom(visibility) and not is_boolean(visibility) and not is_nil(visibility), do: [visibility: visibility] -end diff --git a/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_disabled.ex b/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_disabled.ex deleted file mode 100644 index 027cd3503..000000000 --- a/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_disabled.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ScrollDisabled do - use LiveViewNativePlatform.Modifier - - modifier_schema "scroll_disabled" do - field :disabled, :boolean - end - - def params(disabled) when is_boolean(disabled), do: [disabled: disabled] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_dismisses_keyboard.ex b/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_dismisses_keyboard.ex deleted file mode 100644 index 2dcd78e43..000000000 --- a/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_dismisses_keyboard.ex +++ /dev/null @@ -1,15 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ScrollDismissesKeyboard do - use LiveViewNativePlatform.Modifier - - modifier_schema "scroll_dismisses_keyboard" do - field :mode, Ecto.Enum, values: ~w( - automatic - immediately - interactively - never - )a - end - - def params(mode) when is_atom(mode) and not is_boolean(mode) and not is_nil(mode), do: [mode: mode] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_indicators.ex b/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_indicators.ex deleted file mode 100644 index 0f53193a9..000000000 --- a/lib/live_view_native_swift_ui/modifiers/scroll_views/scroll_indicators.ex +++ /dev/null @@ -1,12 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ScrollIndicators do - use LiveViewNativePlatform.Modifier - - modifier_schema "scroll_indicators" do - field :visibility, Ecto.Enum, values: ~w(automatic hidden never visible)a - field :axes, Ecto.Enum, values: [:horizontal, :vertical, :all], default: :all - end - - def params(visibility, params) when is_list(params), do: [{:visibility, visibility} | params] - def params(visibility) when is_atom(visibility) and not is_boolean(visibility) and not is_nil(visibility), do: [visibility: visibility] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/search/find_disabled.ex b/lib/live_view_native_swift_ui/modifiers/search/find_disabled.ex deleted file mode 100644 index 428fa1b39..000000000 --- a/lib/live_view_native_swift_ui/modifiers/search/find_disabled.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.FindDisabled do - use LiveViewNativePlatform.Modifier - - modifier_schema "find_disabled" do - field :disabled, :boolean, default: true - end - - def params(disabled) when is_boolean(disabled), do: [disabled: disabled] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/search/find_navigator.ex b/lib/live_view_native_swift_ui/modifiers/search/find_navigator.ex deleted file mode 100644 index 0ff65569c..000000000 --- a/lib/live_view_native_swift_ui/modifiers/search/find_navigator.ex +++ /dev/null @@ -1,9 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.FindNavigator do - use LiveViewNativePlatform.Modifier - - modifier_schema "find_navigator" do - field :is_presented, :boolean - - change_event() - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/search/replace_disabled.ex b/lib/live_view_native_swift_ui/modifiers/search/replace_disabled.ex deleted file mode 100644 index c71943a27..000000000 --- a/lib/live_view_native_swift_ui/modifiers/search/replace_disabled.ex +++ /dev/null @@ -1,9 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ReplaceDisabled do - use LiveViewNativePlatform.Modifier - - modifier_schema "replace_disabled" do - field :disabled, :boolean, default: true - end - - def params(disabled) when is_boolean(disabled), do: [disabled: disabled] -end diff --git a/lib/live_view_native_swift_ui/modifiers/search/search_completion.ex b/lib/live_view_native_swift_ui/modifiers/search/search_completion.ex deleted file mode 100644 index 92c21f1b6..000000000 --- a/lib/live_view_native_swift_ui/modifiers/search/search_completion.ex +++ /dev/null @@ -1,12 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.SearchCompletion do - use LiveViewNativePlatform.Modifier - - modifier_schema "search_completion" do - field :completion, :string - field :token, :string - end - - def params(token) when is_atom(token) and not is_boolean(token) and not is_nil(token), do: [token: token] - def params(completion) when is_binary(completion), do: [completion: completion] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/search/search_scopes.ex b/lib/live_view_native_swift_ui/modifiers/search/search_scopes.ex deleted file mode 100644 index f75dbc07e..000000000 --- a/lib/live_view_native_swift_ui/modifiers/search/search_scopes.ex +++ /dev/null @@ -1,16 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.SearchScopes do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.KeyName - - modifier_schema "search_scopes" do - field :active, :string - field :activation, Ecto.Enum, values: ~w(automatic on_search_presentation on_text_entry)a - field :scopes, KeyName - - change_event() - end - - def params(active, params) when is_list(params), do: [{:active, active} | params] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/search/search_suggestions.ex b/lib/live_view_native_swift_ui/modifiers/search/search_suggestions.ex deleted file mode 100644 index d40d69ebc..000000000 --- a/lib/live_view_native_swift_ui/modifiers/search/search_suggestions.ex +++ /dev/null @@ -1,18 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.SearchSuggestions do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.KeyName - - modifier_schema "search_suggestions" do - field :suggestions, KeyName - end - - def params(params) do - with {:ok, _} <- KeyName.cast(params) do - [suggestions: params] - else - _ -> - params - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/search/searchable.ex b/lib/live_view_native_swift_ui/modifiers/search/searchable.ex deleted file mode 100644 index d9680a27b..000000000 --- a/lib/live_view_native_swift_ui/modifiers/search/searchable.ex +++ /dev/null @@ -1,14 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Searchable do - use LiveViewNativePlatform.Modifier - - modifier_schema "searchable" do - field :text, :string - field :tokens, {:array, :string}, default: [] - field :suggested_tokens, {:array, :string} - field :placement, Ecto.Enum, values: ~w(automatic navigation_bar_drawer navigation_bar_drawer_always sidebar toolbar)a - field :prompt, :string - field :dismiss, :boolean, default: true - - change_event() - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/shape/fill.ex b/lib/live_view_native_swift_ui/modifiers/shape/fill.ex deleted file mode 100644 index 67779d754..000000000 --- a/lib/live_view_native_swift_ui/modifiers/shape/fill.ex +++ /dev/null @@ -1,20 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Fill do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.{ShapeStyle, FillStyle} - - modifier_schema "fill" do - field :content, ShapeStyle - field :style, FillStyle - end - - def params(content, params) when is_list(params), do: [{:content, content} | params] - def params(params) do - with {:ok, _} <- ShapeStyle.cast(params) do - [content: params] - else - _ -> - params - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/shape/inset.ex b/lib/live_view_native_swift_ui/modifiers/shape/inset.ex deleted file mode 100644 index 5cea91db4..000000000 --- a/lib/live_view_native_swift_ui/modifiers/shape/inset.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Inset do - use LiveViewNativePlatform.Modifier - - modifier_schema "inset" do - field :amount, :float - end - - def params([by: amount]), do: [amount: amount] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/shape/offset_shape.ex b/lib/live_view_native_swift_ui/modifiers/shape/offset_shape.ex deleted file mode 100644 index 69a824d59..000000000 --- a/lib/live_view_native_swift_ui/modifiers/shape/offset_shape.ex +++ /dev/null @@ -1,8 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.OffsetShape do - use LiveViewNativePlatform.Modifier - - modifier_schema "offset_shape" do - field :x, :float, default: 0.0 - field :y, :float, default: 0.0 - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/shape/rotation.ex b/lib/live_view_native_swift_ui/modifiers/shape/rotation.ex deleted file mode 100644 index d54204575..000000000 --- a/lib/live_view_native_swift_ui/modifiers/shape/rotation.ex +++ /dev/null @@ -1,20 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Rotation do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.{Angle, UnitPoint} - - modifier_schema "rotation" do - field :angle, Angle - field :anchor, UnitPoint - end - - def params(angle, params) when is_list(params), do: [{:angle, angle} | params] - def params(params) do - with {:ok, _} <- Angle.cast(params) do - [angle: params] - else - _ -> - params - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/shape/size.ex b/lib/live_view_native_swift_ui/modifiers/shape/size.ex deleted file mode 100644 index cb3ae51c7..000000000 --- a/lib/live_view_native_swift_ui/modifiers/shape/size.ex +++ /dev/null @@ -1,8 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Size do - use LiveViewNativePlatform.Modifier - - modifier_schema "size" do - field :width, :float, default: 0.0 - field :height, :float, default: 0.0 - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/shape/stroke.ex b/lib/live_view_native_swift_ui/modifiers/shape/stroke.ex deleted file mode 100644 index 3a836d962..000000000 --- a/lib/live_view_native_swift_ui/modifiers/shape/stroke.ex +++ /dev/null @@ -1,20 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Stroke do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.{ShapeStyle, StrokeStyle} - - modifier_schema "stroke" do - field :content, ShapeStyle - field :style, StrokeStyle - end - - def params(content, params) when is_list(params), do: [{:content, content} | params] - def params(params) do - with {:ok, _} <- ShapeStyle.cast(params) do - [content: params] - else - _ -> - params - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/shape/stroke_border.ex b/lib/live_view_native_swift_ui/modifiers/shape/stroke_border.ex deleted file mode 100644 index 707b50ec2..000000000 --- a/lib/live_view_native_swift_ui/modifiers/shape/stroke_border.ex +++ /dev/null @@ -1,21 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.StrokeBorder do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.{ShapeStyle, StrokeStyle} - - modifier_schema "stroke_border" do - field :content, ShapeStyle - field :style, StrokeStyle - field :antialiased, :boolean, default: true - end - - def params(content, params) when is_list(params), do: [{:content, content} | params] - def params(params) do - with {:ok, _} <- ShapeStyle.cast(params) do - [content: params] - else - _ -> - params - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/shape/trim.ex b/lib/live_view_native_swift_ui/modifiers/shape/trim.ex deleted file mode 100644 index 1ae006236..000000000 --- a/lib/live_view_native_swift_ui/modifiers/shape/trim.ex +++ /dev/null @@ -1,11 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Trim do - use LiveViewNativePlatform.Modifier - - modifier_schema "trim" do - field :start_fraction, :float, default: 0.0 - field :end_fraction, :float, default: 1.0 - end - - def params([from: start_fraction, to: end_fraction]), do: [start_fraction: start_fraction, end_fraction: end_fraction] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/shapes/container_shape.ex b/lib/live_view_native_swift_ui/modifiers/shapes/container_shape.ex deleted file mode 100644 index fb853cdf7..000000000 --- a/lib/live_view_native_swift_ui/modifiers/shapes/container_shape.ex +++ /dev/null @@ -1,18 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ContainerShape do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.Shape - - modifier_schema "container_shape" do - field :shape, Shape - end - - def params(params) do - with {:ok, _} <- Shape.cast(params) do - [shape: params] - else - _ -> - params - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/tables/table_style.ex b/lib/live_view_native_swift_ui/modifiers/tables/table_style.ex deleted file mode 100644 index b632d9a71..000000000 --- a/lib/live_view_native_swift_ui/modifiers/tables/table_style.ex +++ /dev/null @@ -1,16 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.TableStyle do - use LiveViewNativePlatform.Modifier - - modifier_schema "table_style" do - field :style, Ecto.Enum, values: ~w( - automatic - inset - inset_alternates_row_backgrounds - bordered - bordered_alternates_row_backgrounds - )a - end - - def params(style) when is_atom(style) and not is_boolean(style) and not is_nil(style), do: [style: style] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/autocorrection_disabled.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/autocorrection_disabled.ex deleted file mode 100644 index cf8253c20..000000000 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/autocorrection_disabled.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.AutocorrectionDisabled do - use LiveViewNativePlatform.Modifier - - modifier_schema "autocorrection_disabled" do - field :disable, :boolean, default: true - end - - def params(disable) when is_boolean(disable), do: [disable: disable] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/baseline_offset.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/baseline_offset.ex deleted file mode 100644 index efe9bc4a7..000000000 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/baseline_offset.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.BaselineOffset do - use LiveViewNativePlatform.Modifier - - modifier_schema "baseline_offset" do - field :offset, :float - end - - def params(offset) when is_number(offset), do: [offset: offset] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/bold.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/bold.ex deleted file mode 100644 index c96c1a2bc..000000000 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/bold.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Bold do - use LiveViewNativePlatform.Modifier - - modifier_schema "bold" do - field :is_active, :boolean, default: true - end - - def params(is_active) when is_boolean(is_active), do: [is_active: is_active] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/dynamic_type_size.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/dynamic_type_size.ex deleted file mode 100644 index 02afb213b..000000000 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/dynamic_type_size.ex +++ /dev/null @@ -1,23 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.DynamicTypeSize do - use LiveViewNativePlatform.Modifier - - modifier_schema "dynamic_type_size" do - field :size, Ecto.Enum, values: ~w( - x_small - small - medium - large - x_large - xx_large - xxx_large - accessibility_1 - accessibility_2 - accessibility_3 - accessibility_4 - accessibility_5 - )a - end - - def params(size) when is_atom(size) and not is_boolean(size) and not is_nil(size), do: [size: size] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/flips_for_right_to_left_layout_direction.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/flips_for_right_to_left_layout_direction.ex deleted file mode 100644 index 8a250fcd0..000000000 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/flips_for_right_to_left_layout_direction.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.FlipsForRightToLeftLayoutDirection do - use LiveViewNativePlatform.Modifier - - modifier_schema "flips_for_right_to_left_layout_direction" do - field :enabled, :boolean - end - - def params(enabled) when is_boolean(enabled), do: [enabled: enabled] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/font.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/font.ex deleted file mode 100644 index 78e5b36a4..000000000 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/font.ex +++ /dev/null @@ -1,18 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Font do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.Font - - modifier_schema "font" do - field :font, Font - end - - def params(params) do - with {:ok, _} <- Font.cast(params) do - [font: params] - else - _ -> - params - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/font_design.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/font_design.ex deleted file mode 100644 index aedb6b337..000000000 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/font_design.ex +++ /dev/null @@ -1,15 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.FontDesign do - use LiveViewNativePlatform.Modifier - - modifier_schema "font_design" do - field :design, Ecto.Enum, values: ~w( - default - monospaced - rounded - serif - )a - end - - def params(design) when is_atom(design) and not is_boolean(design) and not is_nil(design), do: [design: design] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/font_weight.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/font_weight.ex deleted file mode 100644 index 1dcd2b093..000000000 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/font_weight.ex +++ /dev/null @@ -1,20 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.FontWeight do - use LiveViewNativePlatform.Modifier - - modifier_schema "font_weight" do - field :weight, Ecto.Enum, values: ~w( - black - bold - heavy - light - medium - regular - semibold - thin - ultra_light - )a - end - - def params(weight) when is_atom(weight) and not is_boolean(weight) and not is_nil(weight), do: [weight: weight] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/font_width.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/font_width.ex deleted file mode 100644 index 8ab005c63..000000000 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/font_width.ex +++ /dev/null @@ -1,18 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.FontWidth do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.FontWidth - - modifier_schema "font_width" do - field :width, FontWidth - end - - def params(params) do - with {:ok, _} <- FontWidth.cast(params) do - [width: params] - else - _ -> - params - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/italic.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/italic.ex deleted file mode 100644 index 66c353419..000000000 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/italic.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Italic do - use LiveViewNativePlatform.Modifier - - modifier_schema "italic" do - field :is_active, :boolean, default: true - end - - def params(is_active) when is_boolean(is_active), do: [is_active: is_active] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/kerning.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/kerning.ex deleted file mode 100644 index ce3779e23..000000000 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/kerning.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Kerning do - use LiveViewNativePlatform.Modifier - - modifier_schema "kerning" do - field(:kerning, :float) - end - - def params(kerning) when is_number(kerning), do: [kerning: kerning] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/keyboard_shortcut.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/keyboard_shortcut.ex deleted file mode 100644 index eb0147d35..000000000 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/keyboard_shortcut.ex +++ /dev/null @@ -1,21 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.KeyboardShortcut do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativePlatform.Modifier.Types.EventModifier - alias LiveViewNativeSwiftUi.Types.KeyEquivalent - - modifier_schema "keyboard_shortcut" do - field :key, KeyEquivalent - field :modifiers, EventModifier - end - - def params(key, params) when is_list(params), do: [{:key, key} | params] - def params(params) do - with {:ok, _} <- KeyEquivalent.cast(params) do - [key: params] - else - _ -> - params - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/keyboard_type.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/keyboard_type.ex deleted file mode 100644 index a9742f571..000000000 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/keyboard_type.ex +++ /dev/null @@ -1,22 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.KeyboardType do - use LiveViewNativePlatform.Modifier - - modifier_schema "keyboard_type" do - field :keyboard_type, Ecto.Enum, values: ~w( - default - ascii_capable - numbers_and_punctuation - url - number_pad - name_phone_pad - email_address - decimal_pad - twitter - web_search - ascii_capable_number_pad - )a - end - - def params(keyboard_type) when is_atom(keyboard_type) and not is_boolean(keyboard_type) and not is_nil(keyboard_type), do: [keyboard_type: keyboard_type] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/label_style.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/label_style.ex deleted file mode 100644 index f8dbc2dba..000000000 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/label_style.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.LabelStyle do - use LiveViewNativePlatform.Modifier - - modifier_schema "label_style" do - field :style, Ecto.Enum, values: ~w(automatic icon_only title_and_icon title_only)a - end - - def params(style) when is_atom(style) and not is_boolean(style) and not is_nil(style), do: [style: style] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/line_limit.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/line_limit.ex deleted file mode 100644 index 8139d3e8f..000000000 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/line_limit.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.LineLimit do - use LiveViewNativePlatform.Modifier - - modifier_schema "line_limit" do - field :number, :integer - end - - def params(number) when is_integer(number), do: [number: number] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/line_spacing.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/line_spacing.ex deleted file mode 100644 index b86966a72..000000000 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/line_spacing.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.LineSpacing do - use LiveViewNativePlatform.Modifier - - modifier_schema "line_spacing" do - field :line_spacing, :float - end - - def params(line_spacing) when is_number(line_spacing), do: [line_spacing: line_spacing] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/minimum_scale_factor.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/minimum_scale_factor.ex deleted file mode 100644 index 1a04496d4..000000000 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/minimum_scale_factor.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.MinimumScaleFactor do - use LiveViewNativePlatform.Modifier - - modifier_schema "minimum_scale_factor" do - field :factor, :float - end - - def params(factor) when is_number(factor), do: [factor: factor] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/monospaced.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/monospaced.ex deleted file mode 100644 index 0740ec5e9..000000000 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/monospaced.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Monospaced do - use LiveViewNativePlatform.Modifier - - modifier_schema "monospaced" do - field :is_active, :boolean, default: true - end - - def params(is_active) when is_boolean(is_active), do: [is_active: is_active] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/monospaced_digit.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/monospaced_digit.ex deleted file mode 100644 index ef5fea25b..000000000 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/monospaced_digit.ex +++ /dev/null @@ -1,7 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.MonospacedDigit do - use LiveViewNativePlatform.Modifier - - modifier_schema "monospaced_digit" - - def params, do: [] -end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/multiline_text_alignment.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/multiline_text_alignment.ex deleted file mode 100644 index cdc46bc33..000000000 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/multiline_text_alignment.ex +++ /dev/null @@ -1,17 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.MultilineTextAlignment do - use LiveViewNativePlatform.Modifier - - modifier_schema "multiline_text_alignment" do - field(:alignment, Ecto.Enum, values: ~w( - center - leading - trailing - )a) - end - - def params(alignment) - when is_atom(alignment) and not is_boolean(alignment) and not is_nil(alignment), - do: [alignment: alignment] - - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/privacy_sensitive.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/privacy_sensitive.ex deleted file mode 100644 index ab57cb2b4..000000000 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/privacy_sensitive.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.PrivacySensitive do - use LiveViewNativePlatform.Modifier - - modifier_schema "privacy_sensitive" do - field :sensitive, :boolean - end - - def params(sensitive) when is_boolean(sensitive), do: [sensitive: sensitive] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/strikethrough.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/strikethrough.ex deleted file mode 100644 index 681ff9e03..000000000 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/strikethrough.ex +++ /dev/null @@ -1,15 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Strikethrough do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.Color - - modifier_schema "strikethrough" do - field :is_active, :boolean, default: true - field :pattern, Ecto.Enum, values: ~w(dash dash_dot dash_dot_dot dot solid)a, default: :solid - field :color, Color - end - - def params(is_active, params) when is_list(params), do: [{:is_active, is_active} | params] - def params(is_active) when is_boolean(is_active), do: [is_active: is_active] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/submit_label.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/submit_label.ex deleted file mode 100644 index 56ad47fa0..000000000 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/submit_label.ex +++ /dev/null @@ -1,19 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.SubmitLabel do - use LiveViewNativePlatform.Modifier - - modifier_schema "submit_label" do - field(:submit_label, Ecto.Enum, values: ~w( - done - go - send - join - route - search - return - next - continue - )a) - end - - def params(submit_label) when is_atom(submit_label) and not is_boolean(submit_label) and not is_nil(submit_label), do: [submit_label: submit_label] -end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/text_case.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/text_case.ex deleted file mode 100644 index 12b570833..000000000 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/text_case.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.TextCase do - use LiveViewNativePlatform.Modifier - - modifier_schema "text_case" do - field :text_case, Ecto.Enum, values: ~w(lowercase uppercase)a - end - - def params(text_case) when is_atom(text_case) and not is_boolean(text_case) and not is_nil(text_case), do: [text_case: text_case] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/text_content_type.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/text_content_type.ex deleted file mode 100644 index 9788cd36e..000000000 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/text_content_type.ex +++ /dev/null @@ -1,41 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.TextContentType do - use LiveViewNativePlatform.Modifier - - modifier_schema "text_content_type" do - field(:text_content_type, Ecto.Enum, values: ~w( - url - name_prefix - name - name_suffix - given_name - middle_name - family_name - nickname - organization_name - job_title - location - full_street_address - street_address_line_1 - street_address_line_2 - address_city - address_city_and_state - address_state - postal_code - sublocality - country_name - username - password - new_password - one_time_code - email_address - telephone_number - credit_card_number - date_time - flight_number - shipment_tracking_number - )a) - end - - def params(text_content_type) when is_atom(text_content_type) and not is_boolean(text_content_type) and not is_nil(text_content_type), do: [text_content_type: text_content_type] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/text_field_style.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/text_field_style.ex deleted file mode 100644 index 0b8ef0ed5..000000000 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/text_field_style.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.TextFieldStyle do - use LiveViewNativePlatform.Modifier - - modifier_schema "text_field_style" do - field :style, Ecto.Enum, values: ~w(automatic plain rounded_border square_border)a - end - - def params(style) when is_atom(style) and not is_boolean(style) and not is_nil(style), do: [style: style] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/text_input_autocapitalization.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/text_input_autocapitalization.ex deleted file mode 100644 index 1b89b89fd..000000000 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/text_input_autocapitalization.ex +++ /dev/null @@ -1,15 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.TextInputAutocapitalization do - use LiveViewNativePlatform.Modifier - - modifier_schema "text_input_autocapitalization" do - field :autocapitalization, Ecto.Enum, values: ~w( - characters - sentences - words - never - )a - end - - def params(autocapitalization) when is_atom(autocapitalization) and not is_boolean(autocapitalization) and not is_nil(autocapitalization), do: [autocapitalization: autocapitalization] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/text_selection.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/text_selection.ex deleted file mode 100644 index eed48b377..000000000 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/text_selection.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.TextSelection do - use LiveViewNativePlatform.Modifier - - modifier_schema "text_selection" do - field :selectable, :boolean - end - - def params(selectable) when is_boolean(selectable), do: [selectable: selectable] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/tracking.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/tracking.ex deleted file mode 100644 index 94ad3bd9e..000000000 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/tracking.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Tracking do - use LiveViewNativePlatform.Modifier - - modifier_schema "tracking" do - field :tracking, :float - end - - def params(tracking) when is_number(tracking), do: [tracking: tracking] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/truncation_mode.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/truncation_mode.ex deleted file mode 100644 index aa79db3c2..000000000 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/truncation_mode.ex +++ /dev/null @@ -1,14 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.TruncationMode do - use LiveViewNativePlatform.Modifier - - modifier_schema "truncation_mode" do - field :mode, Ecto.Enum, values: ~w( - head - middle - tail - )a - end - - def params(mode) when is_atom(mode) and not is_boolean(mode) and not is_nil(mode), do: [mode: mode] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/underline.ex b/lib/live_view_native_swift_ui/modifiers/text_input_and_output/underline.ex deleted file mode 100644 index 93663e7d8..000000000 --- a/lib/live_view_native_swift_ui/modifiers/text_input_and_output/underline.ex +++ /dev/null @@ -1,14 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Underline do - use LiveViewNativePlatform.Modifier - alias LiveViewNativeSwiftUi.Types.Color - - modifier_schema "underline" do - field :is_active, :boolean, default: true - field :pattern, Ecto.Enum, values: ~w(dash dash_dot dash_dot_dot dot solid)a, default: :solid - field :color, Color - end - - def params(is_active, params) when is_list(params), do: [{:is_active, is_active} | params] - def params(is_active) when is_boolean(is_active), do: [is_active: is_active] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar.ex b/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar.ex deleted file mode 100644 index 627778450..000000000 --- a/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar.ex +++ /dev/null @@ -1,9 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Toolbar do - use LiveViewNativePlatform.Modifier - alias LiveViewNativeSwiftUi.Types.KeyName - - modifier_schema "toolbar" do - field :id, :string - field :content, KeyName - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar_background.ex b/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar_background.ex deleted file mode 100644 index 44274e37f..000000000 --- a/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar_background.ex +++ /dev/null @@ -1,15 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ToolbarBackground do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.ShapeStyle - - modifier_schema "toolbar_background" do - field :style, ShapeStyle - field :visibility, Ecto.Enum, values: ~w(automatic hidden visible)a - field :bars, Ecto.Enum, values: ~w(automatic bottom_bar navigation_bar tab_bar window_toolbar)a - end - - def params(visibility, params) when is_atom(visibility) and not is_boolean(visibility) and not is_nil(visibility) and is_list(params), do: [{:visibility, visibility} | params] - def params(style, params) when is_list(params), do: [{:style, style} | params] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar_color_scheme.ex b/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar_color_scheme.ex deleted file mode 100644 index 8f728fe06..000000000 --- a/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar_color_scheme.ex +++ /dev/null @@ -1,11 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ToolbarColorScheme do - use LiveViewNativePlatform.Modifier - - modifier_schema "toolbar_color_scheme" do - field :color_scheme, Ecto.Enum, values: ~w(dark light)a - field :bars, Ecto.Enum, values: ~w(automatic bottom_bar navigation_bar tab_bar window_toolbar)a - end - - def params(color_scheme, params) when is_list(params), do: [{:color_scheme, color_scheme} | params] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar_role.ex b/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar_role.ex deleted file mode 100644 index 733f06d21..000000000 --- a/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar_role.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ToolbarRole do - use LiveViewNativePlatform.Modifier - - modifier_schema "toolbar_role" do - field :role, Ecto.Enum, values: ~w(automatic browser editor navigation_stack)a - end - - def params(role) when is_atom(role) and not is_boolean(role) and not is_nil(role), do: [role: role] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar_title_menu.ex b/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar_title_menu.ex deleted file mode 100644 index 19d563f0b..000000000 --- a/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar_title_menu.ex +++ /dev/null @@ -1,9 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ToolbarTitleMenu do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.KeyName - - modifier_schema "toolbar_title_menu" do - field :content, KeyName - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar_visibility.ex b/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar_visibility.ex deleted file mode 100644 index 1cfab716e..000000000 --- a/lib/live_view_native_swift_ui/modifiers/toolbar/toolbar_visibility.ex +++ /dev/null @@ -1,11 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ToolbarVisibility do - use LiveViewNativePlatform.Modifier - - modifier_schema "toolbar_visibility" do - field :visibility, Ecto.Enum, values: ~w(automatic hidden visible)a - field :bars, Ecto.Enum, values: ~w(automatic bottom_bar navigation_bar tab_bar window_toolbar)a - end - - def params(visibility, params) when is_list(params), do: [{:visibility, visibility} | params] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/view_configuration/disabled.ex b/lib/live_view_native_swift_ui/modifiers/view_configuration/disabled.ex deleted file mode 100644 index 6f80f08de..000000000 --- a/lib/live_view_native_swift_ui/modifiers/view_configuration/disabled.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Disabled do - use LiveViewNativePlatform.Modifier - - modifier_schema "disabled" do - field :disabled, :boolean - end - - def params(disabled) when is_boolean(disabled), do: [disabled: disabled] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/view_configuration/help.ex b/lib/live_view_native_swift_ui/modifiers/view_configuration/help.ex deleted file mode 100644 index f1bf36a54..000000000 --- a/lib/live_view_native_swift_ui/modifiers/view_configuration/help.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Help do - use LiveViewNativePlatform.Modifier - - modifier_schema "help" do - field :text, :string - end - - def params(text) when is_binary(text), do: [text: text] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/view_configuration/hidden.ex b/lib/live_view_native_swift_ui/modifiers/view_configuration/hidden.ex deleted file mode 100644 index f3adad4ca..000000000 --- a/lib/live_view_native_swift_ui/modifiers/view_configuration/hidden.ex +++ /dev/null @@ -1,5 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Hidden do - use LiveViewNativePlatform.Modifier - - modifier_schema "hidden" -end diff --git a/lib/live_view_native_swift_ui/modifiers/view_configuration/labels_hidden.ex b/lib/live_view_native_swift_ui/modifiers/view_configuration/labels_hidden.ex deleted file mode 100644 index 584491f01..000000000 --- a/lib/live_view_native_swift_ui/modifiers/view_configuration/labels_hidden.ex +++ /dev/null @@ -1,5 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.LabelsHidden do - use LiveViewNativePlatform.Modifier - - modifier_schema "labels_hidden" -end diff --git a/lib/live_view_native_swift_ui/modifiers/view_configuration/opacity.ex b/lib/live_view_native_swift_ui/modifiers/view_configuration/opacity.ex deleted file mode 100644 index 0051e6c79..000000000 --- a/lib/live_view_native_swift_ui/modifiers/view_configuration/opacity.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Opacity do - use LiveViewNativePlatform.Modifier - - modifier_schema "opacity" do - field :opacity, :float - end - - def params(opacity) when is_number(opacity), do: [opacity: opacity] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/view_configuration/persistent_system_overlays.ex b/lib/live_view_native_swift_ui/modifiers/view_configuration/persistent_system_overlays.ex deleted file mode 100644 index e61fdee7e..000000000 --- a/lib/live_view_native_swift_ui/modifiers/view_configuration/persistent_system_overlays.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.PersistentSystemOverlays do - use LiveViewNativePlatform.Modifier - - modifier_schema "persistent_system_overlays" do - field :visibility, Ecto.Enum, values: ~w(automatic hidden visible)a - end - - def params(visibility) when is_atom(visibility) and not is_boolean(visibility) and not is_nil(visibility), do: [visibility: visibility] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/view_configuration/preferred_color_scheme.ex b/lib/live_view_native_swift_ui/modifiers/view_configuration/preferred_color_scheme.ex deleted file mode 100644 index 2d93c1996..000000000 --- a/lib/live_view_native_swift_ui/modifiers/view_configuration/preferred_color_scheme.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.PreferredColorScheme do - use LiveViewNativePlatform.Modifier - - modifier_schema "preferred_color_scheme" do - field :color_scheme, Ecto.Enum, values: ~w(light dark)a - end - - def params(color_scheme) when is_atom(color_scheme) and not is_boolean(color_scheme) and not is_nil(color_scheme), do: [color_scheme: color_scheme] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/view_configuration/redacted.ex b/lib/live_view_native_swift_ui/modifiers/view_configuration/redacted.ex deleted file mode 100644 index 349ef0295..000000000 --- a/lib/live_view_native_swift_ui/modifiers/view_configuration/redacted.ex +++ /dev/null @@ -1,7 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Redacted do - use LiveViewNativePlatform.Modifier - - modifier_schema "redacted" do - field :reason, Ecto.Enum, values: ~w(placeholder privacy)a - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/view_configuration/status_bar_hidden.ex b/lib/live_view_native_swift_ui/modifiers/view_configuration/status_bar_hidden.ex deleted file mode 100644 index 06976b73f..000000000 --- a/lib/live_view_native_swift_ui/modifiers/view_configuration/status_bar_hidden.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.StatusBarHidden do - use LiveViewNativePlatform.Modifier - - modifier_schema "status_bar_hidden" do - field :hidden, :boolean - end - - def params(hidden) when is_boolean(hidden), do: [hidden: hidden] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/view_configuration/unredacted.ex b/lib/live_view_native_swift_ui/modifiers/view_configuration/unredacted.ex deleted file mode 100644 index bf0deba98..000000000 --- a/lib/live_view_native_swift_ui/modifiers/view_configuration/unredacted.ex +++ /dev/null @@ -1,6 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.Unredacted do - use LiveViewNativePlatform.Modifier - - modifier_schema "unredacted" do - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/view_fundamentals/on_appear.ex b/lib/live_view_native_swift_ui/modifiers/view_fundamentals/on_appear.ex deleted file mode 100644 index 12319a59e..000000000 --- a/lib/live_view_native_swift_ui/modifiers/view_fundamentals/on_appear.ex +++ /dev/null @@ -1,9 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.OnAppear do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativePlatform.Modifier.Types.Event - - modifier_schema "on_appear" do - field :perform, Event - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/view_fundamentals/on_disappear.ex b/lib/live_view_native_swift_ui/modifiers/view_fundamentals/on_disappear.ex deleted file mode 100644 index 483d9fd3e..000000000 --- a/lib/live_view_native_swift_ui/modifiers/view_fundamentals/on_disappear.ex +++ /dev/null @@ -1,9 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.OnDisappear do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativePlatform.Modifier.Types.Event - - modifier_schema "on_disappear" do - field :perform, Event - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/view_groupings/control_group_style.ex b/lib/live_view_native_swift_ui/modifiers/view_groupings/control_group_style.ex deleted file mode 100644 index 7d1a3a154..000000000 --- a/lib/live_view_native_swift_ui/modifiers/view_groupings/control_group_style.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ControlGroupStyle do - use LiveViewNativePlatform.Modifier - - modifier_schema "control_group_style" do - field :style, Ecto.Enum, values: ~w(automatic compact_menu menu navigation)a - end - - def params(style) when is_atom(style) and not is_boolean(style) and not is_nil(style), do: [style: style] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/view_groupings/group_box_style.ex b/lib/live_view_native_swift_ui/modifiers/view_groupings/group_box_style.ex deleted file mode 100644 index 66ff57388..000000000 --- a/lib/live_view_native_swift_ui/modifiers/view_groupings/group_box_style.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.GroupBoxStyle do - use LiveViewNativePlatform.Modifier - - modifier_schema "group_box_style" do - field :style, Ecto.Enum, values: ~w(automatic)a - end - - def params(style) when is_atom(style) and not is_boolean(style) and not is_nil(style), do: [style: style] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/modifiers/view_styles/content_shape.ex b/lib/live_view_native_swift_ui/modifiers/view_styles/content_shape.ex deleted file mode 100644 index 490ab6a2b..000000000 --- a/lib/live_view_native_swift_ui/modifiers/view_styles/content_shape.ex +++ /dev/null @@ -1,26 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.ContentShape do - use LiveViewNativePlatform.Modifier - - alias LiveViewNativeSwiftUi.Types.{Shape, ContentShapeKind} - - modifier_schema "content_shape" do - field :kind, ContentShapeKind - field :shape, Shape - field :eo_fill, :boolean - end - - def params(kind, shape, params) when is_list(params), do: [{:shape, shape}, {:kind, kind} | params] - def params(params) do - with {:ok, _} <- ContentShapeKind.cast(params) do - [kind: params] - else - _ -> - with {:ok, _} <- Shape.cast(params) do - [shape: params] - else - _ -> - params - end - end - end -end diff --git a/lib/live_view_native_swift_ui/modifiers/view_styles/index_view_style.ex b/lib/live_view_native_swift_ui/modifiers/view_styles/index_view_style.ex deleted file mode 100644 index c84d04aca..000000000 --- a/lib/live_view_native_swift_ui/modifiers/view_styles/index_view_style.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Modifiers.IndexViewStyle do - use LiveViewNativePlatform.Modifier - - modifier_schema "index_view_style" do - field :style, Ecto.Enum, values: ~w(page page_always page_automatic page_interactive page_never)a - end - - def params(style) when is_atom(style) and not is_boolean(style) and not is_nil(style), do: [style: style] - def params(params), do: params -end diff --git a/lib/live_view_native_swift_ui/types/affine_transform.ex b/lib/live_view_native_swift_ui/types/affine_transform.ex deleted file mode 100644 index f28789e21..000000000 --- a/lib/live_view_native_swift_ui/types/affine_transform.ex +++ /dev/null @@ -1,101 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.AffineTransform do - use LiveViewNativePlatform.Modifier.Type - def type, do: :array - - alias LiveViewNativeSwiftUi.Types.Angle - - @identity [ - 1, 0, - 0, 1, - 0, 0 - ] - - def cast(:identity), do: cast(@identity) - - def cast({:translate, {x, y}}), do: cast([ - 1, 0, - 0, 1, - x, y - ]) - - def cast({:scale, {x, y}}), do: cast([ - x, 0, - 0, y, - 0, 0 - ]) - - def cast({:scale, factor}), do: cast({:scale, {factor, factor}}) - - def cast({:rotate, angle}) do - with {:ok, radians} <- Angle.cast(angle) do - cast([ - :math.cos(radians), :math.sin(radians), - -:math.sin(radians), :math.cos(radians), - 0, 0, - ]) - else - _ -> - :error - end - end - - def cast([ - m11, m12, - m21, m22, - tx, ty - ] = matrix) - when is_number(m11) and is_number(m12) - and is_number(m21) and is_number(m22) - and is_number(tx) and is_number(ty), - do: {:ok, matrix} - - def cast(transforms) when is_list(transforms), - do: Enum.reduce( - transforms, - {:ok, @identity}, - fn element, acc -> - with {:ok, acc} <- acc, - {:ok, element} <- cast(element) - do - {:ok, concat(element, acc)} - else - _ -> - :error - end - end - ) - - def cast(_), do: :error - - defp as_map([ - m11, m12, - m21, m22, - tx, ty - ]), do: %{ - m11: m11, m12: m12, - m21: m21, m22: m22, - tx: tx, ty: ty - } - - defp concat(a, b) do - # Implemented according to the swift-corelibs-foundation docs: - # [ a1, b1, 0 ] [ a2, b2, 0 ] - # A×B = [ c1, d1, 0 ] × [ c2, d2, 0 ] - # [ x1, y1, 1 ] [ x2, y2, 1 ] - # - # [ a1*a2+b1*c2+0*x2 a1*b2+b1*d2+0*y2 a1*0+b1*0+0*1 ] - # A×B = [ c1*a2+d1*c2+0*x2 c1*b2+d1*d2+0*y2 c1*0+d1*0+0*1 ] - # [ x1*a2+y1*c2+1*x2 x1*b2+y1*d2+1*y2 x1*0+y1*0+1*1 ] - # - # [ a1*a2+b1*c2 a1*b2+b1*d2 0 ] - # A×B = [ c1*a2+d1*c2 c1*b2+d1*d2 0 ] - # [ x1*a2+y1*c2+x2 x1*b2+y1*d2+y2 1 ] - a = as_map(a) - b = as_map(b) - [ - (a[:m11] * b[:m11]) + (a[:m12] * b[:m21]), (a[:m11] * b[:m12]) + (a[:m12] * b[:m22]), - (a[:m21] * b[:m11]) + (a[:m22] * b[:m21]), (a[:m21] * b[:m12]) + (a[:m22] * b[:m22]), - (a[:tx] * b[:m11]) + (a[:ty] * b[:m21]) + b[:tx], (a[:tx] * b[:m12]) + (a[:ty] * b[:m22]) + b[:ty], - ] - end -end diff --git a/lib/live_view_native_swift_ui/types/angle.ex b/lib/live_view_native_swift_ui/types/angle.ex deleted file mode 100644 index a0bd3c2bd..000000000 --- a/lib/live_view_native_swift_ui/types/angle.ex +++ /dev/null @@ -1,8 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.Angle do - use LiveViewNativePlatform.Modifier.Type - def type, do: :float - - def cast({:degrees, deg}), do: {:ok, deg * (:math.pi / 180)} - def cast({:radians, rad}), do: {:ok, rad} - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/animation/animation.ex b/lib/live_view_native_swift_ui/types/animation/animation.ex deleted file mode 100644 index d79bbae5f..000000000 --- a/lib/live_view_native_swift_ui/types/animation/animation.ex +++ /dev/null @@ -1,34 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.Animation do - @derive Jason.Encoder - defstruct [:type, :properties, :modifiers] - - use LiveViewNativePlatform.Modifier.Type - def type, do: :map - - alias LiveViewNativeSwiftUi.Types.Keyframe - - def cast(type) when is_atom(type), do: {:ok, %__MODULE__{ type: type, properties: %{}, modifiers: [] }} - def cast({:keyframe = type, properties}) when is_atom(type), do: cast({type, properties, []}) - def cast({:keyframe = type, properties, modifiers}) when is_atom(type) and is_list(modifiers) do - { - :ok, - %__MODULE__{ - type: type, - properties: Enum.into(properties, %{}) - |> Map.update(:keyframes, [], fn keyframes -> Enum.map(keyframes, fn k -> Keyframe.cast(k) |> elem(1) end) end), - modifiers: modifiers - } - } - end - def cast({type, [ {k, _} | _ ] = properties}) when is_atom(type) and is_atom(k) do - {:ok, %__MODULE__{ type: type, properties: Enum.into(properties, %{}), modifiers: [] }} - end - def cast({type, [ {k, _} | _ ] = properties, modifiers}) when is_atom(type) and is_atom(k) and is_list(modifiers) do - {:ok, %__MODULE__{ type: type, properties: Enum.into(properties, %{}), modifiers: Enum.map(modifiers, &cast_modifier/1) }} - end - - def cast(_), do: :error - - def cast_modifier({type, properties}) when is_list(properties), do: %{ type: type, properties: Enum.into(properties, %{}) } - def cast_modifier({type, properties}), do: %{ type: type, properties: properties } -end diff --git a/lib/live_view_native_swift_ui/types/animation/keyframe.ex b/lib/live_view_native_swift_ui/types/animation/keyframe.ex deleted file mode 100644 index 46275c94a..000000000 --- a/lib/live_view_native_swift_ui/types/animation/keyframe.ex +++ /dev/null @@ -1,20 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.Keyframe do - @derive Jason.Encoder - defstruct [:type, :value, :properties] - - use LiveViewNativePlatform.Modifier.Type - def type, do: :map - - def cast({:spring = type, value, properties}) when is_number(value) do - {:ok, %__MODULE__{ type: type, value: value, properties: Enum.into(properties, %{}) |> Map.replace_lazy(:spring, &cast_spring/1) }} - end - def cast({type, value, properties}) when is_atom(type) and is_number(value) do - {:ok, %__MODULE__{ type: type, value: value, properties: Enum.into(properties, %{}) }} - end - - def cast(_), do: :error - - defp cast_spring(type) when is_atom(type), do: %{ type: type } - defp cast_spring({type, properties}), do: Enum.into(properties, %{}) |> Map.put_new(:type, type) - defp cast_spring(properties), do: Enum.into(properties, %{}) -end diff --git a/lib/live_view_native_swift_ui/types/animation/keyframe_properties.ex b/lib/live_view_native_swift_ui/types/animation/keyframe_properties.ex deleted file mode 100644 index f698bb1cc..000000000 --- a/lib/live_view_native_swift_ui/types/animation/keyframe_properties.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.KeyframeProperties do - use LiveViewNativePlatform.Modifier.Type - def type, do: :map - - def cast(value) when is_list(value) or is_map(value) do - {:ok, Enum.into(value, %{})} - end - - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/content_shape_kind.ex b/lib/live_view_native_swift_ui/types/content_shape_kind.ex deleted file mode 100644 index 27a781199..000000000 --- a/lib/live_view_native_swift_ui/types/content_shape_kind.ex +++ /dev/null @@ -1,8 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.ContentShapeKind do - use LiveViewNativePlatform.Modifier.Type - def type, do: {:array, :string} - - def cast(value) when is_atom(value), do: {:ok, [Atom.to_string(value)]} - def cast(value) when is_list(value), do: {:ok, Enum.map(value, &Atom.to_string/1)} - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/content_transition.ex b/lib/live_view_native_swift_ui/types/content_transition.ex deleted file mode 100644 index 08e7dd48a..000000000 --- a/lib/live_view_native_swift_ui/types/content_transition.ex +++ /dev/null @@ -1,21 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.ContentTransition do - @derive Jason.Encoder - defstruct [:type, :properties] - - use LiveViewNativePlatform.Modifier.Type - def type, do: :map - - def cast(type) when is_atom(type), do: {:ok, %__MODULE__{ type: type, properties: nil }} - def cast({:symbol_effect = type, effect}), do: cast({type, effect, []}) - def cast({:symbol_effect = type, effect, options}) do - {:ok, %__MODULE__{ - type: type, - properties: %{ effect: effect, options: Enum.map(options, &LiveViewNativeSwiftUi.Types.Transition.cast_symbol_effect_option/1) } - }} - end - def cast({type, [ {k, _} | _ ] = properties}) when is_atom(type) and is_atom(k) do - {:ok, %__MODULE__{ type: type, properties: Enum.into(properties, %{}) }} - end - - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/edge.ex b/lib/live_view_native_swift_ui/types/edge.ex deleted file mode 100644 index 0aff1462e..000000000 --- a/lib/live_view_native_swift_ui/types/edge.ex +++ /dev/null @@ -1,9 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.Edge do - use LiveViewNativePlatform.Modifier.Type - def type, do: :string - - @values ~w(leading trailing top bottom)a - - def cast(value) when value in @values, do: {:ok, Atom.to_string(value)} - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/edge_insets.ex b/lib/live_view_native_swift_ui/types/edge_insets.ex deleted file mode 100644 index bfa307a0c..000000000 --- a/lib/live_view_native_swift_ui/types/edge_insets.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.EdgeInsets do - @derive Jason.Encoder - defstruct [:top, :leading, :bottom, :trailing] - - use LiveViewNativePlatform.Modifier.Type - def type, do: :map - - def cast(value) when is_map(value) or is_list(value), do: {:ok, struct(__MODULE__, value)} - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/edge_set.ex b/lib/live_view_native_swift_ui/types/edge_set.ex deleted file mode 100644 index a5c4c1c4e..000000000 --- a/lib/live_view_native_swift_ui/types/edge_set.ex +++ /dev/null @@ -1,8 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.EdgeSet do - use LiveViewNativePlatform.Modifier.Type - def type, do: {:array, :string} - - def cast(value) when is_atom(value), do: {:ok, [Atom.to_string(value)]} - def cast(value) when is_list(value), do: {:ok, Enum.map(value, &Atom.to_string/1)} - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/encoded_modifier_stack.ex b/lib/live_view_native_swift_ui/types/encoded_modifier_stack.ex deleted file mode 100644 index 2d6b169ad..000000000 --- a/lib/live_view_native_swift_ui/types/encoded_modifier_stack.ex +++ /dev/null @@ -1,9 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.EncodedModifierStack do - use LiveViewNativePlatform.Modifier.Type - def type, do: :string - - def cast(%LiveViewNativeSwiftUi.Modifiers{} = modifiers) do - {:ok, Jason.encode!(modifiers)} - end - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/event_modifier.ex b/lib/live_view_native_swift_ui/types/event_modifier.ex deleted file mode 100644 index d27c31def..000000000 --- a/lib/live_view_native_swift_ui/types/event_modifier.ex +++ /dev/null @@ -1,8 +0,0 @@ -defmodule LiveViewNativePlatform.Modifier.Types.EventModifier do - use LiveViewNativePlatform.Modifier.Type - def type, do: {:array, :string} - - def cast(value) when is_atom(value), do: {:ok, [Atom.to_string(value)]} - def cast(value) when is_list(value), do: {:ok, Enum.map(value, &Atom.to_string/1)} - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/fill_style.ex b/lib/live_view_native_swift_ui/types/fill_style.ex deleted file mode 100644 index 18a6be962..000000000 --- a/lib/live_view_native_swift_ui/types/fill_style.ex +++ /dev/null @@ -1,14 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.FillStyle do - @derive Jason.Encoder - defstruct [eo_fill: false, antialiased: true] - - use LiveViewNativePlatform.Modifier.Type - def type, do: :map - - def cast(nil), do: {:ok, nil} - def cast(value) when is_map(value) or is_list(value) do - {:ok, struct(__MODULE__, value)} - end - - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/font.ex b/lib/live_view_native_swift_ui/types/font.ex deleted file mode 100644 index 8be39fe17..000000000 --- a/lib/live_view_native_swift_ui/types/font.ex +++ /dev/null @@ -1,30 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.Font do - @derive Jason.Encoder - defstruct [:type, :properties, :modifiers] - - use LiveViewNativePlatform.Modifier.Type - def type, do: :map - - def cast({:system, style}) when is_atom(style), do: cast({:system, style, [], []}) - def cast({:system, style, properties}) when is_atom(style), do: cast({:system, style, properties, []}) - def cast({:system, style, properties, modifiers}) when is_atom(style) do - {:ok, %__MODULE__{ type: :system, properties: Enum.into(Keyword.merge([style: style], properties), %{}), modifiers: Enum.map(modifiers, &cast_modifier/1) }} - end - def cast({:system, [{:size, _} | _] = properties}), do: cast({:system, properties, []}) - def cast({:system, [{:size, _} | _] = properties, modifiers}) do - {:ok, %__MODULE__{ type: :system, properties: Enum.into(properties, %{}), modifiers: Enum.map(modifiers, &cast_modifier/1) }} - end - - def cast({:custom, name, [fixed_size: fixed_size]}), do: cast({:custom, name, [fixed_size: fixed_size], []}) - def cast({:custom, name, [fixed_size: fixed_size], modifiers}), do: {:ok, %__MODULE__{ type: :custom, properties: %{ name: name, fixed_size: fixed_size }, modifiers: Enum.map(modifiers, &cast_modifier/1) }} - def cast({:custom, name, [size: size, relative_to: style]}), do: cast({:custom, name, [size: size, relative_to: style], []}) - def cast({:custom, name, [size: size, relative_to: style], modifiers}), do: {:ok, %__MODULE__{ type: :custom, properties: %{ name: name, size: size, style: style }, modifiers: Enum.map(modifiers, &cast_modifier/1) }} - def cast({:custom, name, [size: size]}), do: cast({:custom, name, [size: size], []}) - def cast({:custom, name, [size: size], modifiers}), do: {:ok, %__MODULE__{ type: :custom, properties: %{ name: name, size: size }, modifiers: Enum.map(modifiers, &cast_modifier/1) }} - - def cast(_), do: :error - - def cast_modifier(type) when is_atom(type), do: %{ type: type, properties: %{} } - def cast_modifier({type, properties}) when is_list(properties), do: %{ type: type, properties: Enum.into(properties, %{}) } - def cast_modifier({type, properties}), do: %{ type: type, properties: properties } -end diff --git a/lib/live_view_native_swift_ui/types/font_width.ex b/lib/live_view_native_swift_ui/types/font_width.ex deleted file mode 100644 index 7ff395802..000000000 --- a/lib/live_view_native_swift_ui/types/font_width.ex +++ /dev/null @@ -1,11 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.FontWidth do - @derive Jason.Encoder - defstruct [:name, :value] - - use LiveViewNativePlatform.Modifier.Type - def type, do: :map - - def cast(name) when is_atom(name), do: {:ok, %__MODULE__{ name: name }} - def cast(value) when is_number(value), do: {:ok, %__MODULE__{ value: value }} - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/gesture.ex b/lib/live_view_native_swift_ui/types/gesture.ex deleted file mode 100644 index ea83de80b..000000000 --- a/lib/live_view_native_swift_ui/types/gesture.ex +++ /dev/null @@ -1,17 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.Gesture do - @derive Jason.Encoder - defstruct [:type, :properties] - - use LiveViewNativePlatform.Modifier.Type - def type, do: :map - - def cast({type, sequence}) when is_list(sequence) and type in [:sequential, :simultaneous, :exclusive] do - {:ok, %__MODULE__{ type: type, properties: %{ :gestures => Enum.map(sequence, fn g -> elem(cast(g), 1) end) } }} - end - def cast(type) when is_atom(type), do: {:ok, %__MODULE__{ type: type, properties: %{} }} - def cast({type, [{k, _} | _] = properties}) when is_atom(type) and is_list(properties) and is_atom(k) do - {:ok, %__MODULE__{ type: type, properties: Enum.into(properties, %{}) }} - end - - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/grid_item.ex b/lib/live_view_native_swift_ui/types/grid_item.ex deleted file mode 100644 index f9b2f641e..000000000 --- a/lib/live_view_native_swift_ui/types/grid_item.ex +++ /dev/null @@ -1,31 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.GridItem do - @derive Jason.Encoder - defstruct [:fixed, :flexible, :adaptive, :spacing, :alignment] - - def fixed( - size, - spacing \\ nil, - alignment \\ nil - ), do: %__MODULE__{ fixed: size, spacing: spacing, alignment: alignment } - def flexible( - minimum \\ 10, - maximum \\ Float.max_finite(), - spacing \\ nil, - alignment \\ nil - ), do: %__MODULE__{ flexible: %{ :minimum => minimum, :maximum => maximum}, spacing: spacing, alignment: alignment } - def adaptive( - minimum, - maximum \\ Float.max_finite(), - spacing \\ nil, - alignment \\ nil - ), do: %__MODULE__{ adaptive: %{ :minimum => minimum, :maximum => maximum}, spacing: spacing, alignment: alignment } - - defimpl Phoenix.HTML.Safe do - def to_iodata(data) do - data - |> Map.from_struct() - |> Jason.encode!() - |> Phoenix.HTML.Engine.html_escape() - end - end -end diff --git a/lib/live_view_native_swift_ui/types/key_equivalent.ex b/lib/live_view_native_swift_ui/types/key_equivalent.ex deleted file mode 100644 index 93dd2e516..000000000 --- a/lib/live_view_native_swift_ui/types/key_equivalent.ex +++ /dev/null @@ -1,26 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.KeyEquivalent do - use LiveViewNativePlatform.Modifier.Type - def type, do: :string - - @keys [ - :up_arrow, - :down_arrow, - :left_arrow, - :right_arrow, - :clear, - :delete, - :end, - :escape, - :home, - :page_up, - :page_down, - :return, - :space, - :tab - ] - - def cast(value) when is_atom(value) and value in @keys, do: {:ok, Atom.to_string(value)} - def cast(value) when is_binary(value) and byte_size(value) == 1, do: {:ok, value} - def cast(value) when is_list(value) and length(value) == 1, do: {:ok, to_string(value)} - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/key_name.ex b/lib/live_view_native_swift_ui/types/key_name.ex deleted file mode 100644 index b474fab0c..000000000 --- a/lib/live_view_native_swift_ui/types/key_name.ex +++ /dev/null @@ -1,11 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.KeyName do - use LiveViewNativePlatform.Modifier.Type - def type, do: :string - - def cast(nil), do: nil - - def cast(value) when is_atom(value) and not is_boolean(value), - do: {:ok, Atom.to_string(value)} - - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/list_item_tint.ex b/lib/live_view_native_swift_ui/types/list_item_tint.ex deleted file mode 100644 index f815c2319..000000000 --- a/lib/live_view_native_swift_ui/types/list_item_tint.ex +++ /dev/null @@ -1,17 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.ListItemTint do - @derive Jason.Encoder - defstruct [:type, :color] - - use LiveViewNativePlatform.Modifier.Type - def type, do: :map - - alias LiveViewNativeSwiftUi.Types.Color - - def cast(type) when is_atom(type), do: {:ok, %__MODULE__{ type: type, color: nil }} - def cast({type, color}) do - {:ok, color} = Color.cast(color) - {:ok, %__MODULE__{ type: type, color: color }} - end - - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/modifier_stack.ex b/lib/live_view_native_swift_ui/types/modifier_stack.ex deleted file mode 100644 index 093c0ce4d..000000000 --- a/lib/live_view_native_swift_ui/types/modifier_stack.ex +++ /dev/null @@ -1,7 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.ModifierStack do - use LiveViewNativePlatform.Modifier.Type - def type, do: :map - - def cast(%LiveViewNativeSwiftUi.Modifiers{} = value), do: {:ok, Jason.decode!(Jason.encode!(value))} - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/namespace.ex b/lib/live_view_native_swift_ui/types/namespace.ex deleted file mode 100644 index b19950715..000000000 --- a/lib/live_view_native_swift_ui/types/namespace.ex +++ /dev/null @@ -1,7 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.Namespace do - use LiveViewNativePlatform.Modifier.Type - def type, do: :string - - def cast(value) when is_atom(value), do: {:ok, Atom.to_string(value)} - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/popover_attachment_anchor.ex b/lib/live_view_native_swift_ui/types/popover_attachment_anchor.ex deleted file mode 100644 index 6599831d2..000000000 --- a/lib/live_view_native_swift_ui/types/popover_attachment_anchor.ex +++ /dev/null @@ -1,32 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.PopoverAttachmentAnchor do - @derive Jason.Encoder - defstruct [ - :type, - :properties - ] - - use LiveViewNativePlatform.Modifier.Type - def type, do: :map - - alias LiveViewNativeSwiftUi.Types.{UnitPoint, RectAnchorSource} - - def cast({:point = type, unit_point}) do - with {:ok, unit_point} <- UnitPoint.cast(unit_point) do - {:ok, %__MODULE__{ type: type, properties: unit_point }} - else - _ -> - :error - end - end - - def cast({:rect = type, rect}) do - with {:ok, rect} <- RectAnchorSource.cast(rect) do - {:ok, %__MODULE__{ type: type, properties: rect }} - else - _ -> - :error - end - end - - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/presentation_detent.ex b/lib/live_view_native_swift_ui/types/presentation_detent.ex deleted file mode 100644 index ae5412dc8..000000000 --- a/lib/live_view_native_swift_ui/types/presentation_detent.ex +++ /dev/null @@ -1,14 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.PresentationDetent do - @derive Jason.Encoder - defstruct [:type, :value] - - use LiveViewNativePlatform.Modifier.Type - def type, do: :map - - def cast(value) when value in [:large, :medium], do: {:ok, %__MODULE__{type: value, value: nil}} - - def cast({type, value}) when type in [:fraction, :height] and is_number(value), - do: {:ok, %__MODULE__{type: type, value: value}} - - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/projection_transform.ex b/lib/live_view_native_swift_ui/types/projection_transform.ex deleted file mode 100644 index 845e0867d..000000000 --- a/lib/live_view_native_swift_ui/types/projection_transform.ex +++ /dev/null @@ -1,130 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.ProjectionTransform do - use LiveViewNativePlatform.Modifier.Type - def type, do: :array - - alias LiveViewNativeSwiftUi.Types.Angle - - @identity [ - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - ] - - def cast(:identity), do: cast(@identity) - - def cast({:translate, {x, y, z}}), do: cast([ - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - x, y, z, 1 - ]) - - def cast({:scale, {x, y, z}}), do: cast([ - x, 0, 0, 0, - 0, y, 0, 0, - 0, 0, z, 0, - 0, 0, 0, 1 - ]) - - def cast({:scale, factor}), do: cast({:scale, {factor, factor, factor}}) - - def cast({:rotate, angle, {x, y, z}}) do - with {:ok, r} <- Angle.cast(angle) do - magnitude = :math.sqrt((x*x) + (y*y) + (z*z)) - r = r / 2 - s = :math.sin(r) - c = :math.cos(r) - {x, y, z} = {x / magnitude * s, y / magnitude * s, z / magnitude * s} - cast([ - 1 - 2 * (y * y + z * z), 2 * (x * y + z * c), 2 * (x * z - y * c), 0, - 2 * (x * y - z * c), 1 - 2 * (x * x + z * z), 2 * (y * z + x * c), 0, - 2 * (x * z + y * c), 2 * (y * z - x * c), 1 - 2 * (x * x + y * y), 0, - 0, 0, 0, 1 - ]) - else - _ -> - :error - end - end - - def cast([ - m11, m12, - m21, m22, - m31, m32 - ]) - when is_number(m11) and is_number(m12) - and is_number(m21) and is_number(m22) - and is_number(m31) and is_number(m32), - do: cast([ - m11, m12, 0, 0, - m21, m22, 0, 0, - m31, m32, 1, 0, - 0, 0, 0, 1 - ]) - - def cast([ - m11, m12, m13, m14, - m21, m22, m23, m24, - m31, m32, m33, m34, - m41, m42, m43, m44 - ] = matrix) - when is_number(m11) and is_number(m12) and is_number(m13) and is_number(m14) - and is_number(m21) and is_number(m22) and is_number(m23) and is_number(m24) - and is_number(m31) and is_number(m32) and is_number(m33) and is_number(m34) - and is_number(m41) and is_number(m42) and is_number(m43) and is_number(m44), - do: {:ok, matrix} - - def cast(transforms) when is_list(transforms), - do: Enum.reduce( - transforms, - {:ok, @identity}, - fn element, acc -> - with {:ok, acc} <- acc, - {:ok, element} <- cast(element) - do - {:ok, concat(element, acc)} - else - _ -> - :error - end - end - ) - - def cast(_), do: :error - - defp as_map([ - m11, m12, m13, m14, - m21, m22, m23, m24, - m31, m32, m33, m34, - m41, m42, m43, m44 - ]), do: %{ - m11: m11, m12: m12, m13: m13, m14: m14, - m21: m21, m22: m22, m23: m23, m24: m24, - m31: m31, m32: m32, m33: m33, m34: m34, - m41: m41, m42: m42, m43: m43, m44: m44 - } - - defp concat(a, b) do - a = as_map(a) - b = as_map(b) - [ - a[:m11] * b[:m11] + a[:m12] * b[:m21] + a[:m13] * b[:m31] + a[:m14] * b[:m41], - a[:m11] * b[:m12] + a[:m12] * b[:m22] + a[:m13] * b[:m32] + a[:m14] * b[:m42], - a[:m11] * b[:m13] + a[:m12] * b[:m23] + a[:m13] * b[:m33] + a[:m14] * b[:m43], - a[:m11] * b[:m14] + a[:m12] * b[:m24] + a[:m13] * b[:m34] + a[:m14] * b[:m44], - a[:m21] * b[:m11] + a[:m22] * b[:m21] + a[:m23] * b[:m31] + a[:m24] * b[:m41], - a[:m21] * b[:m12] + a[:m22] * b[:m22] + a[:m23] * b[:m32] + a[:m24] * b[:m42], - a[:m21] * b[:m13] + a[:m22] * b[:m23] + a[:m23] * b[:m33] + a[:m24] * b[:m43], - a[:m21] * b[:m14] + a[:m22] * b[:m24] + a[:m23] * b[:m34] + a[:m24] * b[:m44], - a[:m31] * b[:m11] + a[:m32] * b[:m21] + a[:m33] * b[:m31] + a[:m34] * b[:m41], - a[:m31] * b[:m12] + a[:m32] * b[:m22] + a[:m33] * b[:m32] + a[:m34] * b[:m42], - a[:m31] * b[:m13] + a[:m32] * b[:m23] + a[:m33] * b[:m33] + a[:m34] * b[:m43], - a[:m31] * b[:m14] + a[:m32] * b[:m24] + a[:m33] * b[:m34] + a[:m34] * b[:m44], - a[:m41] * b[:m11] + a[:m42] * b[:m21] + a[:m43] * b[:m31] + a[:m44] * b[:m41], - a[:m41] * b[:m12] + a[:m42] * b[:m22] + a[:m43] * b[:m32] + a[:m44] * b[:m42], - a[:m41] * b[:m13] + a[:m42] * b[:m23] + a[:m43] * b[:m33] + a[:m44] * b[:m43], - a[:m41] * b[:m14] + a[:m42] * b[:m24] + a[:m43] * b[:m34] + a[:m44] * b[:m44] - ] - end -end diff --git a/lib/live_view_native_swift_ui/types/rect.ex b/lib/live_view_native_swift_ui/types/rect.ex deleted file mode 100644 index db37fc3ca..000000000 --- a/lib/live_view_native_swift_ui/types/rect.ex +++ /dev/null @@ -1,12 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.Rect do - use LiveViewNativePlatform.Modifier.Type - def type, do: {:array, {:array, :number}} - - def cast([x, y, width, height]) when is_number(x) and is_number(y) and is_number(width) and is_number(height) do - {:ok, [[x, y], [width, height]]} - end - def cast([[_, _], [_, _]] = value), do: {:ok, value} - def cast(value) when is_map(value) or is_list(value), do: {:ok, [[value[:x], value[:y]], [value[:width], value[:height]]]} - - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/rect_anchor_source.ex b/lib/live_view_native_swift_ui/types/rect_anchor_source.ex deleted file mode 100644 index 813098ee7..000000000 --- a/lib/live_view_native_swift_ui/types/rect_anchor_source.ex +++ /dev/null @@ -1,27 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.RectAnchorSource do - @derive Jason.Encoder - defstruct [ - :type, - :properties - ] - - use LiveViewNativePlatform.Modifier.Type - def type, do: :map - - alias LiveViewNativeSwiftUi.Types.Rect - - def cast({:rect = type, rect}) do - with {:ok, rect} <- Rect.cast(rect) do - {:ok, %__MODULE__{ type: type, properties: rect }} - else - _ -> - :error - end - end - - def cast(:bounds = type) do - {:ok, %__MODULE__{ type: type, properties: %{} }} - end - - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/rotation_3d_effect_axis.ex b/lib/live_view_native_swift_ui/types/rotation_3d_effect_axis.ex deleted file mode 100644 index d29371586..000000000 --- a/lib/live_view_native_swift_ui/types/rotation_3d_effect_axis.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.Rotation3DEffectAxis do - @derive Jason.Encoder - defstruct [:x, :y, :z] - - use LiveViewNativePlatform.Modifier.Type - def type, do: :map - - def cast({x, y, z}), do: {:ok, %__MODULE__{ x: x, y: y, z: z }} - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/shape.ex b/lib/live_view_native_swift_ui/types/shape.ex deleted file mode 100644 index a0bd540b7..000000000 --- a/lib/live_view_native_swift_ui/types/shape.ex +++ /dev/null @@ -1,33 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.Shape do - @derive Jason.Encoder - defstruct [ - static: nil, - properties: %{}, - key: nil - ] - - use LiveViewNativePlatform.Modifier.Type - def type, do: :map - - def cast(nil), do: nil - - @static_shapes [ - :capsule, - :circle, - :container_relative_shape, - :ellipse, - :rectangle - ] - - # Static shape - def cast(value) when value in @static_shapes, do: cast({value, []}) - - def cast({type, opts}) when is_atom(type) and (is_list(opts) or is_map(opts)), - do: {:ok, %__MODULE__{ static: type, properties: Enum.into(opts, %{}) }} - - # KeyName equivalent - def cast(value) when is_atom(value) and not is_boolean(value), - do: {:ok, %__MODULE__{ key: Atom.to_string(value) }} - - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/shape_style/angular_gradient.ex b/lib/live_view_native_swift_ui/types/shape_style/angular_gradient.ex deleted file mode 100644 index 24838a51f..000000000 --- a/lib/live_view_native_swift_ui/types/shape_style/angular_gradient.ex +++ /dev/null @@ -1,47 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.AngularGradient do - @derive Jason.Encoder - defstruct [ - :gradient, - :start_angle, - :end_angle, - :angle, - center: {0.5, 0.5} - ] - - use LiveViewNativePlatform.Modifier.Type - def type, do: :map - - alias LiveViewNativeSwiftUi.Types.Gradient - alias LiveViewNativeSwiftUi.Types.UnitPoint - alias LiveViewNativeSwiftUi.Types.Angle - - def cast(value) when is_map(value) or is_list(value) do - with {:ok, gradient} <- Gradient.cast(value[:gradient]), - {:ok, center} <- UnitPoint.cast(value[:center] || {0.5, 0.5}) - do - case value[:angle] do - nil -> - {:ok, %__MODULE__{ - gradient: gradient, - center: center, - angle: nil, - start_angle: elem(Angle.cast(value[:start_angle]), 1), - end_angle: elem(Angle.cast(value[:end_angle]), 1) - }} - angle -> - {:ok, %__MODULE__{ - gradient: gradient, - center: center, - angle: elem(Angle.cast(angle), 1), - start_angle: nil, - end_angle: nil - }} - end - else - _ -> - :error - end - end - - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/shape_style/color.ex b/lib/live_view_native_swift_ui/types/shape_style/color.ex deleted file mode 100644 index 357defe71..000000000 --- a/lib/live_view_native_swift_ui/types/shape_style/color.ex +++ /dev/null @@ -1,72 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.Color do - import LiveViewNativeSwiftUi.Utils, only: [encode_key: 1] - - @derive Jason.Encoder - defstruct [ - :blue, - :brightness, - :green, - :hue, - :opacity, - :red, - :rgb_color_space, - :saturation, - :string, - :white - ] - - @system_colors ~w( - black - blue - brown - clear - cyan - gray - green - indigo - mint - orange - pink - purple - red - teal - white - yellow - accent - primary - secondary - )a - - @rgb_color_spaces ~w( - srgb - srgb_linear - display_p3 - )a - - use LiveViewNativePlatform.Modifier.Type - def type, do: :map - - def cast(value) when is_map(value), do: {:ok, struct(__MODULE__, value)} - - def cast(value) when is_bitstring(value), - do: {:ok, %__MODULE__{string: value}} - - def cast(value) when value in @system_colors, - do: {:ok, %__MODULE__{string: "system-#{value}"}} - - def cast({rgb_color_space, %{white: white} = opts}) when rgb_color_space in @rgb_color_spaces, - do: {:ok, %__MODULE__{rgb_color_space: encode_key(rgb_color_space), white: white, opacity: opts[:opacity]}} - - def cast({rgb_color_space, %{} = opts}) when rgb_color_space in @rgb_color_spaces, - do: - {:ok, - %__MODULE__{ - rgb_color_space: encode_key(rgb_color_space), - red: opts[:red], - green: opts[:green], - blue: opts[:blue], - opacity: opts[:opacity] - }} - - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/shape_style/elliptical_gradient.ex b/lib/live_view_native_swift_ui/types/shape_style/elliptical_gradient.ex deleted file mode 100644 index 8dc7aba51..000000000 --- a/lib/live_view_native_swift_ui/types/shape_style/elliptical_gradient.ex +++ /dev/null @@ -1,33 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.EllipticalGradient do - @derive Jason.Encoder - defstruct [ - :gradient, - center: {0.5, 0.5}, - start_radius_fraction: 0, - end_radius_fraction: 0.5 - ] - - use LiveViewNativePlatform.Modifier.Type - def type, do: :map - - alias LiveViewNativeSwiftUi.Types.Gradient - alias LiveViewNativeSwiftUi.Types.UnitPoint - - def cast(value) when is_map(value) or is_list(value) do - with {:ok, gradient} <- Gradient.cast(value[:gradient]), - {:ok, center} <- UnitPoint.cast(value[:center] || {0.5, 0.5}) - do - {:ok, %__MODULE__{ - gradient: gradient, - center: center, - start_radius_fraction: value[:start_radius_fraction] || 0, - end_radius_fraction: value[:end_radius_fraction] || 0.5 - }} - else - _ -> - :error - end - end - - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/shape_style/gradient.ex b/lib/live_view_native_swift_ui/types/shape_style/gradient.ex deleted file mode 100644 index 448647467..000000000 --- a/lib/live_view_native_swift_ui/types/shape_style/gradient.ex +++ /dev/null @@ -1,39 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.Gradient do - @derive Jason.Encoder - defstruct [:colors, :stops] - - use LiveViewNativePlatform.Modifier.Type - def type, do: :map - - alias LiveViewNativeSwiftUi.Types.Color - alias LiveViewNativeSwiftUi.Types.Gradient.Stop - - def cast({:colors, colors}) when is_list(colors) do - Enum.reduce(colors, {:ok, %__MODULE__{colors: []}}, fn color, acc -> - with {:ok, %__MODULE__{colors: gradient_colors} = gradient} <- acc, - {:ok, cast_color} <- Color.cast(color) - do - {:ok, %__MODULE__{gradient | colors: gradient_colors ++ [cast_color]}} - else - _ -> - :error - end - end) - end - - def cast({:stops, stops}) when is_list(stops) do - Enum.reduce(stops, {:ok, %__MODULE__{stops: []}}, fn stop, acc -> - with {:ok, %__MODULE__{stops: gradient_stops} = gradient} <- acc, - {:ok, cast_stop} <- Stop.cast(stop) - do - {:ok, %__MODULE__{gradient | stops: gradient_stops ++ [cast_stop]}} - else - _ -> - :error - end - end) - end - - def cast(value) when is_map(value) or is_list(value), do: {:ok, struct(__MODULE__, value)} - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/shape_style/gradient/stop.ex b/lib/live_view_native_swift_ui/types/shape_style/gradient/stop.ex deleted file mode 100644 index 7375a1d73..000000000 --- a/lib/live_view_native_swift_ui/types/shape_style/gradient/stop.ex +++ /dev/null @@ -1,23 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.Gradient.Stop do - @derive Jason.Encoder - defstruct [:color, :location] - - use LiveViewNativePlatform.Modifier.Type - def type, do: :map - - alias LiveViewNativeSwiftUi.Types.Color - - def cast(value) when is_map(value) or is_list(value), do: cast({value[:color], value[:location]}) - - def cast({color, location}) do - case Color.cast(color) do - {:ok, cast_color} -> - {:ok, %__MODULE__{color: cast_color, location: location}} - - _ -> - :error - end - end - - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/shape_style/image_paint.ex b/lib/live_view_native_swift_ui/types/shape_style/image_paint.ex deleted file mode 100644 index ab8252d4f..000000000 --- a/lib/live_view_native_swift_ui/types/shape_style/image_paint.ex +++ /dev/null @@ -1,44 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.ImagePaint do - @derive Jason.Encoder - defstruct [ - :image, - :system_image, - :source_rect, - :scale - ] - - use LiveViewNativePlatform.Modifier.Type - def type, do: :map - - alias LiveViewNativeSwiftUi.Types.Rect - - def cast(value) when is_map(value) or is_list(value) do - with {:ok, source_rect} <- Rect.cast(value[:source_rect] || [x: 0, y: 0, width: 1, height: 1]) do - case value[:image] do - {:name, image} -> - {:ok, %__MODULE__{ - image: image, - system_image: nil, - source_rect: source_rect, - scale: value[:scale] || 1 - }} - - {:system, system_image} -> - {:ok, %__MODULE__{ - image: nil, - system_image: system_image, - source_rect: source_rect, - scale: value[:scale] || 1 - }} - - _ -> - :error - end - else - _ -> - :error - end - end - - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/shape_style/linear_gradient.ex b/lib/live_view_native_swift_ui/types/shape_style/linear_gradient.ex deleted file mode 100644 index d7d9e9376..000000000 --- a/lib/live_view_native_swift_ui/types/shape_style/linear_gradient.ex +++ /dev/null @@ -1,32 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.LinearGradient do - @derive Jason.Encoder - defstruct [ - :gradient, - start_point: {0, 0}, - end_point: {1, 1} - ] - - use LiveViewNativePlatform.Modifier.Type - def type, do: :map - - alias LiveViewNativeSwiftUi.Types.Gradient - alias LiveViewNativeSwiftUi.Types.UnitPoint - - def cast(value) when is_map(value) or is_list(value) do - with {:ok, gradient} <- Gradient.cast(value[:gradient]), - {:ok, start_point} <- UnitPoint.cast(value[:start_point] || {0, 0}), - {:ok, end_point} <- UnitPoint.cast(value[:end_point] || {1, 1}) - do - {:ok, %__MODULE__{ - gradient: gradient, - start_point: start_point, - end_point: end_point - }} - else - _ -> - :error - end - end - - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/shape_style/radial_gradient.ex b/lib/live_view_native_swift_ui/types/shape_style/radial_gradient.ex deleted file mode 100644 index 229bff6bc..000000000 --- a/lib/live_view_native_swift_ui/types/shape_style/radial_gradient.ex +++ /dev/null @@ -1,33 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.RadialGradient do - @derive Jason.Encoder - defstruct [ - :gradient, - :start_radius, - :end_radius, - center: {0.5, 0.5} - ] - - use LiveViewNativePlatform.Modifier.Type - def type, do: :map - - alias LiveViewNativeSwiftUi.Types.Gradient - alias LiveViewNativeSwiftUi.Types.UnitPoint - - def cast(value) when is_map(value) or is_list(value) do - with {:ok, gradient} <- Gradient.cast(value[:gradient]), - {:ok, center} <- UnitPoint.cast(value[:center] || {0.5, 0.5}) - do - {:ok, %__MODULE__{ - gradient: gradient, - center: center, - start_radius: value[:start_radius], - end_radius: value[:end_radius] - }} - else - _ -> - :error - end - end - - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/shape_style/shadow_style.ex b/lib/live_view_native_swift_ui/types/shape_style/shadow_style.ex deleted file mode 100644 index 67c6a4533..000000000 --- a/lib/live_view_native_swift_ui/types/shape_style/shadow_style.ex +++ /dev/null @@ -1,36 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.ShadowStyle do - @derive Jason.Encoder - defstruct [ - :type, - :color, - :radius, - :x, - :y - ] - - use LiveViewNativePlatform.Modifier.Type - def type, do: :map - - alias LiveViewNativeSwiftUi.Types.Color - - def cast({type, opts}) when type in [:drop, :inner] and is_map(opts) or is_list(opts) do - with_type = - opts - |> Enum.into(%{}) - |> Map.put(:type, type) - - {:ok, struct(__MODULE__, cast_color(with_type))} - end - - def cast(_), do: :error - - ### - - defp cast_color(%{color: color} = with_type) do - cast_color = Color.cast(color) - - Map.replace(with_type, :color, elem(cast_color, 1)) - end - - defp cast_color(with_type), do: with_type -end diff --git a/lib/live_view_native_swift_ui/types/shape_style/shape_style.ex b/lib/live_view_native_swift_ui/types/shape_style/shape_style.ex deleted file mode 100644 index 588764a2d..000000000 --- a/lib/live_view_native_swift_ui/types/shape_style/shape_style.ex +++ /dev/null @@ -1,69 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.ShapeStyle do - @derive Jason.Encoder - defstruct [:concrete_style, :style, :modifiers] - - use LiveViewNativePlatform.Modifier.Type - def type, do: :map - - alias LiveViewNativeSwiftUi.Types.Color - alias LiveViewNativeSwiftUi.Types.AngularGradient - alias LiveViewNativeSwiftUi.Types.EllipticalGradient - alias LiveViewNativeSwiftUi.Types.LinearGradient - alias LiveViewNativeSwiftUi.Types.RadialGradient - alias LiveViewNativeSwiftUi.Types.ImagePaint - alias LiveViewNativeSwiftUi.Types.ShadowStyle - - @static_styles [:selection, :separator, :tint, :foreground, :background] - - def cast(value) when value in @static_styles do - {:ok, %__MODULE__{ concrete_style: value, style: nil, modifiers: [] }} - end - def cast({value, modifiers}) when value in @static_styles and is_list(modifiers) do - {:ok, %__MODULE__{ concrete_style: value, style: nil, modifiers: Enum.map(modifiers, &cast_modifier/1) }} - end - def cast({concrete_style, style}), do: cast({concrete_style, style, []}) - def cast({concrete_style, style, modifiers}) do - case cast_style({concrete_style, style}) do - {:ok, cast_style} -> - {:ok, %__MODULE__{ - concrete_style: concrete_style, - style: cast_style, - modifiers: Enum.map(modifiers, &cast_modifier/1) - }} - - :error -> - :error - end - end - - def cast(_), do: :error - - ### - - defp cast_style({:color, value}), do: Color.cast(value) - defp cast_style({:gradient, value}), do: Color.cast(value) - defp cast_style({:angular_gradient, value}), do: AngularGradient.cast(value) - defp cast_style({:elliptical_gradient, value}), do: EllipticalGradient.cast(value) - defp cast_style({:linear_gradient, value}), do: LinearGradient.cast(value) - defp cast_style({:radial_gradient, value}), do: RadialGradient.cast(value) - defp cast_style({:hierarchical, value}), do: {:ok, value} - defp cast_style({:material, value}), do: {:ok, value} - defp cast_style({:image, value}), do: ImagePaint.cast(value) - defp cast_style(_), do: :error - - defp cast_modifier({:shadow, shadow_style}) do - with {:ok, shadow_style} <- ShadowStyle.cast(shadow_style) do - %{ "type" => :shadow, "properties" => shadow_style } - end - end - defp cast_modifier({type, properties}), do: %{ "type" => type, "properties" => properties } - - defimpl Phoenix.HTML.Safe do - def to_iodata(data) do - data - |> Map.from_struct() - |> Jason.encode!() - |> Phoenix.HTML.Engine.html_escape() - end - end -end diff --git a/lib/live_view_native_swift_ui/types/stroke_style.ex b/lib/live_view_native_swift_ui/types/stroke_style.ex deleted file mode 100644 index 71789f70a..000000000 --- a/lib/live_view_native_swift_ui/types/stroke_style.ex +++ /dev/null @@ -1,21 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.StrokeStyle do - @derive Jason.Encoder - defstruct [ - line_width: 1, - line_cap: :butt, - line_join: :miter, - miter_limit: 10, - dash: [], - dash_phase: 0 - ] - - use LiveViewNativePlatform.Modifier.Type - def type, do: :map - - def cast(nil), do: {:ok, nil} - def cast(value) when is_map(value) or is_list(value) do - {:ok, struct(__MODULE__, value)} - end - - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/submit_triggers.ex b/lib/live_view_native_swift_ui/types/submit_triggers.ex deleted file mode 100644 index f72f9af4f..000000000 --- a/lib/live_view_native_swift_ui/types/submit_triggers.ex +++ /dev/null @@ -1,8 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.SubmitTriggers do - use LiveViewNativePlatform.Modifier.Type - def type, do: {:array, :string} - - def cast(trigger) when is_atom(trigger), do: {:ok, [Atom.to_string(trigger)]} - def cast(triggers) when is_list(triggers), do: {:ok, Enum.map(triggers, &Atom.to_string/1)} - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/symbol_variants.ex b/lib/live_view_native_swift_ui/types/symbol_variants.ex deleted file mode 100644 index fbba58826..000000000 --- a/lib/live_view_native_swift_ui/types/symbol_variants.ex +++ /dev/null @@ -1,8 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.SymbolVariants do - use LiveViewNativePlatform.Modifier.Type - def type, do: {:array, :string} - - def cast(value) when is_atom(value), do: {:ok, [Atom.to_string(value)]} - def cast(value) when is_list(value), do: {:ok, Enum.map(value, &Atom.to_string/1)} - def cast(_), do: :error -end diff --git a/lib/live_view_native_swift_ui/types/transition.ex b/lib/live_view_native_swift_ui/types/transition.ex deleted file mode 100644 index b6519236f..000000000 --- a/lib/live_view_native_swift_ui/types/transition.ex +++ /dev/null @@ -1,69 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.Transition do - @derive Jason.Encoder - defstruct [:type, :properties] - - use LiveViewNativePlatform.Modifier.Type - def type, do: :map - - alias LiveViewNativeSwiftUi.Types.Animation - - def cast(combined) when is_list(combined) and length(combined) > 0 do - {:ok, %__MODULE__{ type: :combined, properties: %{ transitions: Enum.map(combined, fn t -> elem(cast(t), 1) end) } }} - end - - def cast(value) when is_atom(value), do: {:ok, %__MODULE__{ type: value, properties: %{} }} - - def cast({:asymmetric = type, [insertion: insertion, removal: removal]}) do - {:ok, i} = cast(insertion) - {:ok, r} = cast(removal) - {:ok, %__MODULE__{ type: type, properties: %{ insertion: i, removal: r } }} - end - - def cast({ - :modifier, - [ - active: %LiveViewNativePlatform.Env{ modifiers: active }, - identity: %LiveViewNativePlatform.Env{ modifiers: identity } - ] - }) do - {:ok, %__MODULE__{ - type: :modifier, - properties: %{ - active: Phoenix.HTML.Safe.to_iodata(active) |> IO.iodata_to_binary, - identity: Phoenix.HTML.Safe.to_iodata(identity) |> IO.iodata_to_binary - } - }} - end - - def cast({:symbol_effect = type, effect}), do: cast({type, effect, []}) - def cast({:symbol_effect = type, effect, options}) when is_list(options) do - {:ok, %__MODULE__{ type: type, properties: %{ effect: effect, options: Enum.map(options, &cast_symbol_effect_option/1) } }} - end - - def cast({value, [ {k, _} | _ ] = properties}) when is_atom(value) and is_atom(k) do - {:ok, %__MODULE__{ type: value, properties: Enum.into(properties, %{}) }} - end - - def cast({transition, animation}) do - {:ok, t} = cast(transition) - case Animation.cast(animation) do - {:ok, a} -> - {:ok, %__MODULE__{ type: :animation, properties: %{ transition: t, animation: a } }} - :error -> - :error - end - end - - def cast(_), do: :error - - def cast_modifier({type, properties}) when is_list(properties), do: %{ type: type, properties: Enum.into(properties, %{}) } - def cast_modifier({type, properties}), do: %{ type: type, properties: properties } - - def cast_symbol_effect_option(type) when is_atom(type), do: Atom.to_string(type) - def cast_symbol_effect_option({type, properties}) when is_atom(type) and is_list(properties) do - %{ type: type, properties: Enum.into(properties, %{}) } - end - def cast_symbol_effect_option({type, properties}) when is_atom(type) do - %{ type: type, properties: properties } - end -end diff --git a/lib/live_view_native_swift_ui/types/unit_point.ex b/lib/live_view_native_swift_ui/types/unit_point.ex deleted file mode 100644 index ad18dfdd4..000000000 --- a/lib/live_view_native_swift_ui/types/unit_point.ex +++ /dev/null @@ -1,25 +0,0 @@ -defmodule LiveViewNativeSwiftUi.Types.UnitPoint do - @derive Jason.Encoder - defstruct [:x, :y, :named] - - use LiveViewNativePlatform.Modifier.Type - def type, do: :map - - @static_members [ - :zero, - :center, - :leading, - :trailing, - :top, - :bottom, - :top_leading, - :top_trailing, - :bottom_leading, - :bottom_trailing - ] - - def cast(value) when value in @static_members, do: {:ok, %__MODULE__{named: Atom.to_string(value)}} - def cast(value) when is_map(value) or is_list(value), do: {:ok, struct(__MODULE__, value)} - def cast({x, y}), do: {:ok, %__MODULE__{x: x, y: y}} - def cast(_), do: :error -end diff --git a/mix.exs b/mix.exs index a0d7082ac..132466b78 100644 --- a/mix.exs +++ b/mix.exs @@ -1,4 +1,4 @@ -defmodule LiveViewNativeSwiftUi.MixProject do +defmodule LiveViewNative.SwiftUI.MixProject do use Mix.Project def project do @@ -23,9 +23,11 @@ defmodule LiveViewNativeSwiftUi.MixProject do # Run "mix help deps" to learn about dependencies. defp deps do [ - {:jason, "~> 1.2"}, {:ex_doc, ">= 0.0.0", only: :dev, runtime: false}, - {:live_view_native_platform, "~> 0.1"} + {:jason, "~> 1.2"}, + {:live_view_native_platform, "~> 0.1"}, + {:live_view_native_stylesheet, github: "liveview-native/live_view_native_stylesheet"}, + {:nimble_parsec, "~> 1.3"} ] end diff --git a/mix.lock b/mix.lock index 9d31a0283..e4a42d4d5 100644 --- a/mix.lock +++ b/mix.lock @@ -5,6 +5,7 @@ "ex_doc": {:hex, :ex_doc, "0.30.5", "aa6da96a5c23389d7dc7c381eba862710e108cee9cfdc629b7ec021313900e9e", [:mix], [{:earmark_parser, "~> 1.4.31", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "88a1e115dcb91cefeef7e22df4a6ebbe4634fbf98b38adcbc25c9607d6d9d8e6"}, "jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"}, "live_view_native_platform": {:hex, :live_view_native_platform, "0.1.0", "679b51f3f5c51869bfc934459afcc6946787724b7f480b6f92a26adb5f2f3479", [:mix], [{:ecto, "~> 3.8", [hex: :ecto, repo: "hexpm", optional: false]}, {:jason, "~> 1.2", [hex: :jason, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}], "hexpm", "66bb38079a44b4d648509687757636cfa187cca8950d592c8ce0d58ad7aa45ca"}, + "live_view_native_stylesheet": {:git, "https://github.com/liveview-native/live_view_native_stylesheet.git", "4ec329ebcbe81adacda7d864f2e2e406b42cb2ef", []}, "makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"}, "makeup_elixir": {:hex, :makeup_elixir, "0.16.1", "cc9e3ca312f1cfeccc572b37a09980287e243648108384b97ff2b76e505c3555", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "e127a341ad1b209bd80f7bd1620a15693a9908ed780c3b763bccf7d200c767c6"}, "makeup_erlang": {:hex, :makeup_erlang, "0.1.2", "ad87296a092a46e03b7e9b0be7631ddcf64c790fa68a9ef5323b6cbb36affc72", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "f3f5a1ca93ce6e092d92b6d9c049bcda58a3b617a8d888f8e7231c85630e8108"}, diff --git a/test/live_view_native/swiftui/rules_parser_test.exs b/test/live_view_native/swiftui/rules_parser_test.exs new file mode 100644 index 000000000..a2b846016 --- /dev/null +++ b/test/live_view_native/swiftui/rules_parser_test.exs @@ -0,0 +1,279 @@ +defmodule LiveViewNative.SwiftUI.RulesParserTest do + use ExUnit.Case + import LiveViewNative.SwiftUI.RulesParser, only: [parse: 1] + + describe "parse/1" do + test "parses modifier function definition" do + input = "bold(true)" + output = {:bold, [], [true]} + + assert parse(input) == output + end + + test "parses modifier function with content syntax" do + input = "background(){:content}" + output = {:background, [], [[content: :content]]} + + assert parse(input) == output + + # permits whitespace surrounds + input = "background() { :content }" + + assert parse(input) == output + + # permits array of content references + + input = "background() { [:content1, :content2] }" + + output = {:background, [], [[content: [:content1, :content2]]]} + + assert parse(input) == output + + # permits multiline + input = """ + background() { + :content1 + :content2 + } + """ + + assert parse(input) == output + end + + test "parses modifier with multiple arguments" do + input = "background(\"foo\", \"bar\")" + output = {:background, [], ["foo", "bar"]} + + assert parse(input) == output + + # space at start and end + input = "background( \"foo\", \"bar\" )" + assert parse(input) == output + + # space at start only + input = "background( \"foo\", \"bar\")" + assert parse(input) == output + + # space at end only + input = "background(\"foo\", \"bar\" )" + assert parse(input) == output + end + + test "parses single modifier with atom as IME" do + input = "font(.largeTitle)" + + output = {:font, [], [{:., [], [nil, :largeTitle]}]} + + assert parse(input) == output + end + + test "parses chained IMEs" do + input = "font(color: Color.red)" + + output = {:font, [], [[color: {:., [], [:Color, :red]}]]} + + assert parse(input) == output + + input = "font(color: Color.red.shadow(.thick))" + + output = + {:font, [], + [[color: {:., [], [:Color, {:., [], [:red, {:shadow, [], [{:., [], [nil, :thick]}]}]}]}]]} + + assert parse(input) == output + end + + test "parses chained IMEs within the content block" do + input = "background() { Color.red }" + + output = {:background, [], [[content: {:., [], [:Color, :red]}]]} + + assert parse(input) == output + end + + test "parses multiple modifiers" do + input = "font(.largeTitle) bold(true) italic(true)" + + output = [ + {:font, [], [{:., [], [nil, :largeTitle]}]}, + {:bold, [], [true]}, + {:italic, [], [true]} + ] + + assert parse(input) == output + end + + test "parses complex modifier chains" do + input = "color(color: .foo.bar.baz(1, 2).qux)" + + output = + {:color, [], + [ + [ + color: + {:., [], + [nil, {:., [], [:foo, {:., [], [:bar, {:., [], [{:baz, [], [1, 2]}, :qux]}]}]}]} + ] + ]} + + assert parse(input) == output + end + + test "parses multiline" do + input = """ + font(.largeTitle) + bold(true) + italic(true) + """ + + output = [ + {:font, [], [{:., [], [nil, :largeTitle]}]}, + {:bold, [], [true]}, + {:italic, [], [true]} + ] + + assert parse(input) == output + end + + test "parses string literal value type" do + input = "foo(\"bar\")" + output = {:foo, [], ["bar"]} + + assert parse(input) == output + end + + test "parses numerical types" do + input = "foo(1, -1, 1.1)" + output = {:foo, [], [1, -1, 1.1]} + + assert parse(input) == output + end + + test "parses key/value pairs" do + input = ~s|foo(bar: "baz", qux: .quux)| + output = {:foo, [], [[bar: "baz", qux: {:., [], [nil, :quux]}]]} + + assert parse(input) == output + end + + test "parses bool and nil values" do + input = "foo(true, false, nil)" + output = {:foo, [], [true, false, nil]} + + assert parse(input) == output + end + + test "parses Implicit Member Expressions" do + input = "color(.red)" + output = {:color, [], [{:., [], [nil, :red]}]} + + assert parse(input) == output + end + + test "parses nested function calls" do + input = ~s|foo(bar("baz"))| + output = {:foo, [], [{:bar, [], ["baz"]}]} + + assert parse(input) == output + end + + test "parses attr value references" do + input = ~s|foo(attr("bar"))| + output = {:foo, [], [{:__attr__, [], "bar"}]} + + assert parse(input) == output + end + + test "parses variables" do + input = "foo(color_name)" + + output = {:foo, [], [{Elixir, [], {:color_name, [], Elixir}}]} + end + end + + describe "helper functions" do + test "to_atom" do + input = "buttonStyle(style: to_atom(style))" + + output = {:buttonStyle, [], [[style: {Elixir, [], {:to_atom, [], [{:style, [], Elixir}]}}]]} + + assert parse(input) == output + end + + test "to_integer" do + input = "frame(height: to_integer(height))" + + output = {:frame, [], [[height: {Elixir, [], {:to_integer, [], [{:height, [], Elixir}]}}]]} + + assert parse(input) == output + end + + test "to_float" do + input = "kerning(kerning: to_float(kerning))" + + output = + {:kerning, [], [[kerning: {Elixir, [], {:to_float, [], [{:kerning, [], Elixir}]}}]]} + + assert parse(input) == output + end + + test "to_boolean" do + input = "hidden(to_boolean(is_hidden))" + + output = {:hidden, [], [{Elixir, [], {:to_boolean, [], [{:is_hidden, [], Elixir}]}}]} + + assert parse(input) == output + end + + test "camelize" do + input = "font(family: camelize(family))" + + output = {:font, [], [[family: {Elixir, [], {:camelize, [], [{:family, [], Elixir}]}}]]} + + assert parse(input) == output + end + + test "snake_case" do + input = "font(family: snake_case(family))" + + output = {:font, [], [[family: {Elixir, [], {:snake_case, [], [{:family, [], Elixir}]}}]]} + + assert parse(input) == output + end + + test "to_ime" do + input = "color(to_ime(color))" + + output = {:color, [], [{:., [], [nil, {Elixir, [], {:to_ime, [], [{:color, [], Elixir}]}}]}]} + + assert parse(input) == output + end + + test "to_ime with chaining" do + input = "color(to_ime(color).foo)" + + output = {:color, [], [{:., [], [nil, {:., [], [{Elixir, [], {:to_ime, [], [{:color, [], Elixir}]}}, :foo]}]}]} + + assert parse(input) == output + end + + test "to_ime in the middle of a chain" do + input = "color(foo.to_ime(color).bar)" + + output = {:color, [], [{:., [], [:foo, {:., [], [{Elixir, [], {:to_ime, [], [{:color, [], Elixir}]}}, :bar]}]}]} + + assert parse(input) == output + end + + + @tag :skip + test "to_ime as a function call" do + # for now I'm not sure how to implement the AST for this. + # input "color(foo.to_ime(color)(1).bar)" + + # output = {:color, [], [{:., [], [:foo, {:., [], [{Elixir, [], {:to_ime, [], [{:color, [], Elixir}]}}, :bar]}]}]} + + # assert parse(input) == output + end + end +end diff --git a/test/live_view_native_swift_ui_test.exs b/test/live_view_native_swift_ui_test.exs index eef30b636..657ad340e 100644 --- a/test/live_view_native_swift_ui_test.exs +++ b/test/live_view_native_swift_ui_test.exs @@ -1,8 +1,4 @@ -defmodule LiveViewNativeSwiftUiTest do +defmodule LiveViewNative.SwiftUITest do use ExUnit.Case - doctest LiveViewNativeSwiftUi - test "greets the world" do - assert LiveViewNativeSwiftUi.hello() == :world - end end diff --git a/test/live_view_native_swift_ui_test/modifiers_test.exs b/test/live_view_native_swift_ui_test/modifiers_test.exs deleted file mode 100644 index 5552f4920..000000000 --- a/test/live_view_native_swift_ui_test/modifiers_test.exs +++ /dev/null @@ -1,13 +0,0 @@ -defmodule LiveViewNativeSwiftUiTest.ModifiersTest do - use ExUnit.Case - doctest LiveViewNativeSwiftUi.Modifiers - - test "escapes json quotes" do - actual = - %LiveViewNativeSwiftUi.Modifiers{padding: %{all: 100}} - |> Phoenix.HTML.Safe.to_iodata() - |> IO.iodata_to_binary() - - assert actual == "[{"type":"padding","all":100}]" - end -end