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.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/demo/Gemfile +1 -1
  4. data/demo/Gemfile.lock +7 -3
  5. data/demo/app/controllers/welcome_controller.rb +4 -0
  6. data/demo/app/views/welcome/show.html.erb +2 -0
  7. data/lib/json_flit/builder.rb +26 -0
  8. data/lib/json_flit/factory/align.rb +7 -0
  9. data/lib/json_flit/factory/animated_align.rb +7 -0
  10. data/lib/json_flit/factory/animated_container.rb +7 -0
  11. data/lib/json_flit/factory/animated_cross_fade.rb +7 -0
  12. data/lib/json_flit/factory/animated_default_text_style.rb +7 -0
  13. data/lib/json_flit/factory/animated_opacity.rb +7 -0
  14. data/lib/json_flit/factory/animated_padding.rb +7 -0
  15. data/lib/json_flit/factory/animated_physical_model.rb +7 -0
  16. data/lib/json_flit/factory/animated_positioned.rb +7 -0
  17. data/lib/json_flit/factory/animated_positioned_directional.rb +7 -0
  18. data/lib/json_flit/factory/animated_size.rb +7 -0
  19. data/lib/json_flit/factory/animated_switcher.rb +7 -0
  20. data/lib/json_flit/factory/animated_theme.rb +7 -0
  21. data/lib/json_flit/factory/app_bar.rb +7 -0
  22. data/lib/json_flit/factory/aspect_ratio.rb +7 -0
  23. data/lib/json_flit/factory/asset_image.rb +7 -0
  24. data/lib/json_flit/factory/base.rb +7 -0
  25. data/lib/json_flit/factory/baseline.rb +7 -0
  26. data/lib/json_flit/factory/button_bar.rb +7 -0
  27. data/lib/json_flit/factory/card.rb +7 -0
  28. data/lib/json_flit/factory/center.rb +7 -0
  29. data/lib/json_flit/factory/checkbox.rb +7 -0
  30. data/lib/json_flit/factory/circular_progress_indicator.rb +7 -0
  31. data/lib/json_flit/factory/clip_oval.rb +7 -0
  32. data/lib/json_flit/factory/clip_path.rb +7 -0
  33. data/lib/json_flit/factory/clip_rect.rb +7 -0
  34. data/lib/json_flit/factory/clip_rrect.rb +7 -0
  35. data/lib/json_flit/factory/column.rb +7 -0
  36. data/lib/json_flit/factory/comment.rb +7 -0
  37. data/lib/json_flit/factory/conditional.rb +7 -0
  38. data/lib/json_flit/factory/container.rb +7 -0
  39. data/lib/json_flit/factory/cupertino_switch.rb +7 -0
  40. data/lib/json_flit/factory/custom_scroll_view.rb +7 -0
  41. data/lib/json_flit/factory/directionality.rb +7 -0
  42. data/lib/json_flit/factory/dropdown_button_form_field.rb +7 -0
  43. data/lib/json_flit/factory/dynamic.rb +7 -0
  44. data/lib/json_flit/factory/elevated_button.rb +7 -0
  45. data/lib/json_flit/factory/expanded.rb +7 -0
  46. data/lib/json_flit/factory/fitted_box.rb +7 -0
  47. data/lib/json_flit/factory/flexible.rb +7 -0
  48. data/lib/json_flit/factory/floating_action_button.rb +7 -0
  49. data/lib/json_flit/factory/form.rb +7 -0
  50. data/lib/json_flit/factory/fractional_translation.rb +7 -0
  51. data/lib/json_flit/factory/fractionally_sized.rb +7 -0
  52. data/lib/json_flit/factory/gesture_detector.rb +7 -0
  53. data/lib/json_flit/factory/grid_view.rb +7 -0
  54. data/lib/json_flit/factory/hero.rb +7 -0
  55. data/lib/json_flit/factory/icon.rb +7 -0
  56. data/lib/json_flit/factory/icon_button.rb +7 -0
  57. data/lib/json_flit/factory/ignore_pointer.rb +7 -0
  58. data/lib/json_flit/factory/indexed_stack.rb +7 -0
  59. data/lib/json_flit/factory/ink_well.rb +7 -0
  60. data/lib/json_flit/factory/input_error.rb +7 -0
  61. data/lib/json_flit/factory/interactive_viewer.rb +7 -0
  62. data/lib/json_flit/factory/intrinisic_height.rb +7 -0
  63. data/lib/json_flit/factory/intrinisic_width.rb +7 -0
  64. data/lib/json_flit/factory/limited_box.rb +7 -0
  65. data/lib/json_flit/factory/linear_progress_indicator.rb +7 -0
  66. data/lib/json_flit/factory/list_tile.rb +7 -0
  67. data/lib/json_flit/factory/list_view.rb +7 -0
  68. data/lib/json_flit/factory/material.rb +7 -0
  69. data/lib/json_flit/factory/memory_image.rb +7 -0
  70. data/lib/json_flit/factory/network_image.rb +7 -0
  71. data/lib/json_flit/factory/offstage.rb +7 -0
  72. data/lib/json_flit/factory/opacity.rb +7 -0
  73. data/lib/json_flit/factory/outlined_button.rb +7 -0
  74. data/lib/json_flit/factory/overflow_box.rb +7 -0
  75. data/lib/json_flit/factory/padding.rb +7 -0
  76. data/lib/json_flit/factory/placeholder.rb +7 -0
  77. data/lib/json_flit/factory/popup_menu_button.rb +7 -0
  78. data/lib/json_flit/factory/positioned.rb +7 -0
  79. data/lib/json_flit/factory/primary_scroll_container.rb +7 -0
  80. data/lib/json_flit/factory/radio.rb +7 -0
  81. data/lib/json_flit/factory/rich_text.rb +7 -0
  82. data/lib/json_flit/factory/row.rb +7 -0
  83. data/lib/json_flit/factory/safe_area.rb +7 -0
  84. data/lib/json_flit/factory/save_context.rb +7 -0
  85. data/lib/json_flit/factory/scaffold.rb +13 -0
  86. data/lib/json_flit/factory/scroll_configuration.rb +7 -0
  87. data/lib/json_flit/factory/scrollbar.rb +7 -0
  88. data/lib/json_flit/factory/set_default_value.rb +7 -0
  89. data/lib/json_flit/factory/set_scroll_container.rb +7 -0
  90. data/lib/json_flit/factory/set_value.rb +7 -0
  91. data/lib/json_flit/factory/single_child_scroll_view.rb +7 -0
  92. data/lib/json_flit/factory/sized_box.rb +7 -0
  93. data/lib/json_flit/factory/sliver_grid.rb +7 -0
  94. data/lib/json_flit/factory/sliver_list.rb +7 -0
  95. data/lib/json_flit/factory/sliver_padding.rb +7 -0
  96. data/lib/json_flit/factory/sliver_to_box_adapter.rb +7 -0
  97. data/lib/json_flit/factory/stack.rb +7 -0
  98. data/lib/json_flit/factory/switch.rb +7 -0
  99. data/lib/json_flit/factory/text.rb +7 -0
  100. data/lib/json_flit/factory/text_button.rb +7 -0
  101. data/lib/json_flit/factory/text_form_field.rb +7 -0
  102. data/lib/json_flit/factory/theme.rb +7 -0
  103. data/lib/json_flit/factory/tooltip.rb +7 -0
  104. data/lib/json_flit/factory/tween_animation.rb +7 -0
  105. data/lib/json_flit/factory/wrap.rb +7 -0
  106. data/lib/json_flit/registry.rb +98 -98
  107. data/lib/json_flit/version.rb +1 -1
  108. data/lib/json_flit.rb +3 -0
  109. metadata +101 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8b3795cdcd99257b24cbf9870f3c8a8050b74ef92241cb36330593a234b92b8
4
- data.tar.gz: 59d9ffb41e0cb8f7c52120c17fe774117ea6976ace721347d301b92647afd96d
3
+ metadata.gz: b21165a86ac304a46f2d41ba367f3dbc9f7d454f81582cce7fdd197ede5e02c7
4
+ data.tar.gz: 852c6cf5e1de9b920e4bf8172ef1f09227aa9bb3f4031963ab91771949646b7a
5
5
  SHA512:
6
- metadata.gz: 00ceceb4e2b7196fc055bb24e9e053ef90a741c2c7d30cfb10cbb21bc533d8d2ceda14a17bfcf88f04d36888565f85157896d4a666747f43c65fd535191b48f5
7
- data.tar.gz: e94dbee3f62924d37d1b8470a7447b367f15eba88af965a3ede42674ba82e4d249126cc51ca300e52347b4105feaa0bb7a09a4bff2b7f89caee3f673a1d87900
6
+ metadata.gz: 69484a418ac02f47cff1002ee3ef2dd6aad8a0c39e99acb8444a989aece834d40ac3012ef328513429847bb781a544fbfb1aab0a12ec15aaf34fe9f52519d8e7
7
+ data.tar.gz: 3749a94c61893a936bcebb7bf65c1dbb5f57571697432a795cd50f74bb91971b3fe83becb47f89c9c9263d96722c08945eea724be86c214ee43be4992125ba4b
data/Gemfile.lock CHANGED
@@ -9,7 +9,7 @@ GIT
9
9
  PATH
10
10
  remote: .
11
11
  specs:
12
- json_flit (0.0.3)
12
+ json_flit (0.0.4)
13
13
  flit_view_components
14
14
 
15
15
  GEM
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
@@ -18,5 +18,9 @@ class WelcomeController < ApplicationController
18
18
  raise "Invalid data format"
19
19
  end
20
20
 
21
+ registry = JsonFlit::Registry.new
22
+ builder = JsonFlit::Builder.new(registry: registry, layout: @layout, data: @data)
23
+ @component = builder.build
24
+
21
25
  end
22
26
  end
@@ -4,3 +4,5 @@
4
4
  <br/>
5
5
  <%= p @layout.inspect %>
6
6
  <br/>
7
+
8
+ <%= render @component %>
@@ -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
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class Align
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class AnimatedAlign
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class AnimatedContainer
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class AnimatedCrossFade
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class AnimatedDefaultTextStyle
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class AnimatedOpacity
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class AnimatedPadding
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class AnimatedPhysicalModel
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class AnimatedPositioned
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class AnimatedPositionedDirectional
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class AnimatedSize
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class AninmateSwitcher
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class AnimatedTheme
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class AppBar
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class AspectRatio
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class AssetImage
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class Base
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class Baseline
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class ButtonBar
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class Card
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class Center
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class Checkbox
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class CircularProgressIndicator
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class ClipOval
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class ClipPath
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class ClipRect
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class ClipRrect
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class Column
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class Comment
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class Conditional
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class Container
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class CupertinoSwitch
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class CustomScrollView
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class Directionality
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class DropdownButtonFormField
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class Dynamic
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class ElevatedButton
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class Expanded
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class FittedBox
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class Flexible
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class FloatingActionButton
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class Form
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class FractionalTranslation
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class FractionallySized
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class GestureDetector
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class GridView
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class Hero
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class Icon
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class IconButton
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class IgnorePointer
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class IndexedStack
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class InkWell
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class InputError
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class InteractiveViewer
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class IntrinsicHeight
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class IntrinsicWidth
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class LimitedBox
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class LinearProgressIndicator
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class ListTile
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class ListView
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class Material
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module JsonFlit
2
+ module Factory
3
+ class MemoryImage
4
+
5
+ end
6
+ end
7
+ end