json_flit 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/demo/Gemfile +1 -1
- data/demo/Gemfile.lock +7 -3
- data/demo/app/controllers/welcome_controller.rb +4 -0
- data/demo/app/views/welcome/show.html.erb +2 -0
- data/lib/json_flit/builder.rb +26 -0
- data/lib/json_flit/factory/align.rb +7 -0
- data/lib/json_flit/factory/animated_align.rb +7 -0
- data/lib/json_flit/factory/animated_container.rb +7 -0
- data/lib/json_flit/factory/animated_cross_fade.rb +7 -0
- data/lib/json_flit/factory/animated_default_text_style.rb +7 -0
- data/lib/json_flit/factory/animated_opacity.rb +7 -0
- data/lib/json_flit/factory/animated_padding.rb +7 -0
- data/lib/json_flit/factory/animated_physical_model.rb +7 -0
- data/lib/json_flit/factory/animated_positioned.rb +7 -0
- data/lib/json_flit/factory/animated_positioned_directional.rb +7 -0
- data/lib/json_flit/factory/animated_size.rb +7 -0
- data/lib/json_flit/factory/animated_switcher.rb +7 -0
- data/lib/json_flit/factory/animated_theme.rb +7 -0
- data/lib/json_flit/factory/app_bar.rb +7 -0
- data/lib/json_flit/factory/aspect_ratio.rb +7 -0
- data/lib/json_flit/factory/asset_image.rb +7 -0
- data/lib/json_flit/factory/base.rb +7 -0
- data/lib/json_flit/factory/baseline.rb +7 -0
- data/lib/json_flit/factory/button_bar.rb +7 -0
- data/lib/json_flit/factory/card.rb +7 -0
- data/lib/json_flit/factory/center.rb +7 -0
- data/lib/json_flit/factory/checkbox.rb +7 -0
- data/lib/json_flit/factory/circular_progress_indicator.rb +7 -0
- data/lib/json_flit/factory/clip_oval.rb +7 -0
- data/lib/json_flit/factory/clip_path.rb +7 -0
- data/lib/json_flit/factory/clip_rect.rb +7 -0
- data/lib/json_flit/factory/clip_rrect.rb +7 -0
- data/lib/json_flit/factory/column.rb +7 -0
- data/lib/json_flit/factory/comment.rb +7 -0
- data/lib/json_flit/factory/conditional.rb +7 -0
- data/lib/json_flit/factory/container.rb +7 -0
- data/lib/json_flit/factory/cupertino_switch.rb +7 -0
- data/lib/json_flit/factory/custom_scroll_view.rb +7 -0
- data/lib/json_flit/factory/directionality.rb +7 -0
- data/lib/json_flit/factory/dropdown_button_form_field.rb +7 -0
- data/lib/json_flit/factory/dynamic.rb +7 -0
- data/lib/json_flit/factory/elevated_button.rb +7 -0
- data/lib/json_flit/factory/expanded.rb +7 -0
- data/lib/json_flit/factory/fitted_box.rb +7 -0
- data/lib/json_flit/factory/flexible.rb +7 -0
- data/lib/json_flit/factory/floating_action_button.rb +7 -0
- data/lib/json_flit/factory/form.rb +7 -0
- data/lib/json_flit/factory/fractional_translation.rb +7 -0
- data/lib/json_flit/factory/fractionally_sized.rb +7 -0
- data/lib/json_flit/factory/gesture_detector.rb +7 -0
- data/lib/json_flit/factory/grid_view.rb +7 -0
- data/lib/json_flit/factory/hero.rb +7 -0
- data/lib/json_flit/factory/icon.rb +7 -0
- data/lib/json_flit/factory/icon_button.rb +7 -0
- data/lib/json_flit/factory/ignore_pointer.rb +7 -0
- data/lib/json_flit/factory/indexed_stack.rb +7 -0
- data/lib/json_flit/factory/ink_well.rb +7 -0
- data/lib/json_flit/factory/input_error.rb +7 -0
- data/lib/json_flit/factory/interactive_viewer.rb +7 -0
- data/lib/json_flit/factory/intrinisic_height.rb +7 -0
- data/lib/json_flit/factory/intrinisic_width.rb +7 -0
- data/lib/json_flit/factory/limited_box.rb +7 -0
- data/lib/json_flit/factory/linear_progress_indicator.rb +7 -0
- data/lib/json_flit/factory/list_tile.rb +7 -0
- data/lib/json_flit/factory/list_view.rb +7 -0
- data/lib/json_flit/factory/material.rb +7 -0
- data/lib/json_flit/factory/memory_image.rb +7 -0
- data/lib/json_flit/factory/network_image.rb +7 -0
- data/lib/json_flit/factory/offstage.rb +7 -0
- data/lib/json_flit/factory/opacity.rb +7 -0
- data/lib/json_flit/factory/outlined_button.rb +7 -0
- data/lib/json_flit/factory/overflow_box.rb +7 -0
- data/lib/json_flit/factory/padding.rb +7 -0
- data/lib/json_flit/factory/placeholder.rb +7 -0
- data/lib/json_flit/factory/popup_menu_button.rb +7 -0
- data/lib/json_flit/factory/positioned.rb +7 -0
- data/lib/json_flit/factory/primary_scroll_container.rb +7 -0
- data/lib/json_flit/factory/radio.rb +7 -0
- data/lib/json_flit/factory/rich_text.rb +7 -0
- data/lib/json_flit/factory/row.rb +7 -0
- data/lib/json_flit/factory/safe_area.rb +7 -0
- data/lib/json_flit/factory/save_context.rb +7 -0
- data/lib/json_flit/factory/scaffold.rb +13 -0
- data/lib/json_flit/factory/scroll_configuration.rb +7 -0
- data/lib/json_flit/factory/scrollbar.rb +7 -0
- data/lib/json_flit/factory/set_default_value.rb +7 -0
- data/lib/json_flit/factory/set_scroll_container.rb +7 -0
- data/lib/json_flit/factory/set_value.rb +7 -0
- data/lib/json_flit/factory/single_child_scroll_view.rb +7 -0
- data/lib/json_flit/factory/sized_box.rb +7 -0
- data/lib/json_flit/factory/sliver_grid.rb +7 -0
- data/lib/json_flit/factory/sliver_list.rb +7 -0
- data/lib/json_flit/factory/sliver_padding.rb +7 -0
- data/lib/json_flit/factory/sliver_to_box_adapter.rb +7 -0
- data/lib/json_flit/factory/stack.rb +7 -0
- data/lib/json_flit/factory/switch.rb +7 -0
- data/lib/json_flit/factory/text.rb +7 -0
- data/lib/json_flit/factory/text_button.rb +7 -0
- data/lib/json_flit/factory/text_form_field.rb +7 -0
- data/lib/json_flit/factory/theme.rb +7 -0
- data/lib/json_flit/factory/tooltip.rb +7 -0
- data/lib/json_flit/factory/tween_animation.rb +7 -0
- data/lib/json_flit/factory/wrap.rb +7 -0
- data/lib/json_flit/registry.rb +98 -98
- data/lib/json_flit/version.rb +1 -1
- data/lib/json_flit.rb +3 -0
- metadata +101 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b21165a86ac304a46f2d41ba367f3dbc9f7d454f81582cce7fdd197ede5e02c7
|
4
|
+
data.tar.gz: 852c6cf5e1de9b920e4bf8172ef1f09227aa9bb3f4031963ab91771949646b7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69484a418ac02f47cff1002ee3ef2dd6aad8a0c39e99acb8444a989aece834d40ac3012ef328513429847bb781a544fbfb1aab0a12ec15aaf34fe9f52519d8e7
|
7
|
+
data.tar.gz: 3749a94c61893a936bcebb7bf65c1dbb5f57571697432a795cd50f74bb91971b3fe83becb47f89c9c9263d96722c08945eea724be86c214ee43be4992125ba4b
|
data/Gemfile.lock
CHANGED
data/demo/Gemfile
CHANGED
@@ -49,7 +49,7 @@ gem "bootsnap", require: false
|
|
49
49
|
# gem "image_processing", "~> 1.2"
|
50
50
|
|
51
51
|
# The whole point of this demo app is to test this gem
|
52
|
-
gem 'json_flit'
|
52
|
+
gem 'json_flit', path: '../'
|
53
53
|
gem 'flit_view_components', github: 'afstanton/flit_view_components', branch: 'main'
|
54
54
|
|
55
55
|
# For JSON
|
data/demo/Gemfile.lock
CHANGED
@@ -6,6 +6,12 @@ GIT
|
|
6
6
|
flit_view_components (0.0.2)
|
7
7
|
view_component (~> 3.0.0rc3)
|
8
8
|
|
9
|
+
PATH
|
10
|
+
remote: ..
|
11
|
+
specs:
|
12
|
+
json_flit (0.0.3)
|
13
|
+
flit_view_components
|
14
|
+
|
9
15
|
GEM
|
10
16
|
remote: https://rubygems.org/
|
11
17
|
specs:
|
@@ -93,8 +99,6 @@ GEM
|
|
93
99
|
jbuilder (2.11.5)
|
94
100
|
actionview (>= 5.0.0)
|
95
101
|
activesupport (>= 5.0.0)
|
96
|
-
json_flit (0.0.2)
|
97
|
-
flit_view_components
|
98
102
|
loofah (2.19.1)
|
99
103
|
crass (~> 1.0.2)
|
100
104
|
nokogiri (>= 1.5.9)
|
@@ -197,7 +201,7 @@ DEPENDENCIES
|
|
197
201
|
flit_view_components!
|
198
202
|
importmap-rails
|
199
203
|
jbuilder
|
200
|
-
json_flit
|
204
|
+
json_flit!
|
201
205
|
multi_json
|
202
206
|
oj
|
203
207
|
propshaft
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module JsonFlit
|
2
|
+
class Builder
|
3
|
+
def initialize(registry:, layout:, data:)
|
4
|
+
@registry = registry
|
5
|
+
@layout = layout
|
6
|
+
@data = data
|
7
|
+
end
|
8
|
+
|
9
|
+
def build(layout: @layout)
|
10
|
+
builder = @registry.component(layout['type'])
|
11
|
+
component = builder.new(data: @data).build
|
12
|
+
if layout['children']
|
13
|
+
layout['children'].each do |child|
|
14
|
+
component.children << build(layout: child)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
if layout['child']
|
19
|
+
component.child = build(layout: layout['child'])
|
20
|
+
end
|
21
|
+
|
22
|
+
component
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|