protos 0.2.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +5 -5
- data/CHANGELOG.md +11 -0
- data/README.md +82 -67
- data/benchmarks/.keep +0 -0
- data/benchmarks/table.txt +12 -0
- data/examples/list.rb +3 -1
- data/examples/navbar.rb +1 -1
- data/lib/protos/accordion/item.rb +7 -8
- data/lib/protos/accordion.rb +6 -10
- data/lib/protos/alert/actions.rb +2 -2
- data/lib/protos/alert/icon.rb +2 -2
- data/lib/protos/alert.rb +4 -8
- data/lib/protos/attributes.rb +7 -8
- data/lib/protos/avatar.rb +1 -1
- data/lib/protos/breadcrumbs/crumb.rb +2 -2
- data/lib/protos/breadcrumbs.rb +2 -4
- data/lib/protos/card/actions.rb +2 -2
- data/lib/protos/card/body.rb +2 -2
- data/lib/protos/card/image.rb +2 -2
- data/lib/protos/card/title.rb +2 -2
- data/lib/protos/card.rb +6 -14
- data/lib/protos/carousel/actions.rb +2 -2
- data/lib/protos/carousel/item.rb +2 -2
- data/lib/protos/carousel.rb +4 -8
- data/lib/protos/chat_bubble/content.rb +2 -2
- data/lib/protos/chat_bubble/footer.rb +2 -2
- data/lib/protos/chat_bubble/header.rb +2 -2
- data/lib/protos/chat_bubble/image.rb +2 -2
- data/lib/protos/chat_bubble.rb +6 -14
- data/lib/protos/collapse/content.rb +2 -2
- data/lib/protos/collapse/title.rb +3 -3
- data/lib/protos/collapse.rb +4 -8
- data/lib/protos/combobox.rb +8 -24
- data/lib/protos/command/dialog.rb +1 -1
- data/lib/protos/command/empty.rb +2 -2
- data/lib/protos/command/group.rb +1 -1
- data/lib/protos/command/input.rb +3 -2
- data/lib/protos/command/item.rb +2 -2
- data/lib/protos/command/list.rb +2 -2
- data/lib/protos/command/title.rb +2 -2
- data/lib/protos/command/trigger.rb +2 -2
- data/lib/protos/command.rb +10 -26
- data/lib/protos/component.rb +21 -30
- data/lib/protos/drawer/content.rb +2 -2
- data/lib/protos/drawer/side.rb +1 -1
- data/lib/protos/drawer/trigger.rb +2 -2
- data/lib/protos/drawer.rb +5 -11
- data/lib/protos/dropdown/item.rb +2 -2
- data/lib/protos/dropdown/menu.rb +1 -1
- data/lib/protos/dropdown.rb +3 -9
- data/lib/protos/hero/content.rb +2 -2
- data/lib/protos/hero/overlay.rb +2 -2
- data/lib/protos/hero.rb +4 -8
- data/lib/protos/list/item.rb +2 -2
- data/lib/protos/list.rb +3 -5
- data/lib/protos/modal/close_button.rb +1 -1
- data/lib/protos/modal/dialog.rb +1 -1
- data/lib/protos/modal/trigger.rb +2 -2
- data/lib/protos/modal.rb +5 -11
- data/lib/protos/popover/content.rb +3 -1
- data/lib/protos/popover/trigger.rb +2 -2
- data/lib/protos/popover.rb +4 -8
- data/lib/protos/stats/actions.rb +2 -2
- data/lib/protos/stats/description.rb +2 -2
- data/lib/protos/stats/figure.rb +2 -2
- data/lib/protos/stats/stat.rb +2 -2
- data/lib/protos/stats/title.rb +2 -2
- data/lib/protos/stats/value.rb +2 -2
- data/lib/protos/stats.rb +8 -20
- data/lib/protos/swap/off.rb +2 -2
- data/lib/protos/swap/on.rb +2 -2
- data/lib/protos/swap.rb +5 -10
- data/lib/protos/table/body.rb +2 -2
- data/lib/protos/table/caption.rb +3 -3
- data/lib/protos/table/cell.rb +2 -2
- data/lib/protos/table/footer.rb +2 -2
- data/lib/protos/table/head.rb +2 -2
- data/lib/protos/table/header.rb +2 -2
- data/lib/protos/table/row.rb +2 -2
- data/lib/protos/table.rb +8 -22
- data/lib/protos/tabs/tab.rb +5 -4
- data/lib/protos/tabs.rb +3 -5
- data/lib/protos/theme.rb +34 -45
- data/lib/protos/timeline/center.rb +2 -2
- data/lib/protos/timeline/item.rb +2 -2
- data/lib/protos/timeline/left.rb +2 -2
- data/lib/protos/timeline/right.rb +2 -2
- data/lib/protos/timeline.rb +6 -14
- data/lib/protos/toast/close_button.rb +2 -1
- data/lib/protos/toast.rb +3 -5
- data/lib/protos/token_list.rb +18 -31
- data/lib/protos/typography/heading.rb +2 -2
- data/lib/protos/typography/inline_link.rb +3 -3
- data/lib/protos/typography/paragraph.rb +2 -2
- data/lib/protos/typography.rb +12 -12
- data/lib/protos/version.rb +1 -1
- data/protos.gemspec +15 -3
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e1c2bbb97997971d3380fb5846b8720a01d50d61942a9dea5a00e5d19d2c416
|
4
|
+
data.tar.gz: 10c0adb3dfeef8488ae235b0b7d4ec9567f7011ec5bbe0707d33bff3d6cc0049
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8b800214d96624b909934dde77611d12e55aca2eeac34c499d4f905f3fd5e39ca4d56b8130e9b7ffe0240292b27a852842bce3aef47b22607ef68c00d2df675
|
7
|
+
data.tar.gz: 42a866cc6f7d50169d464b6a016c4852e37634c63003552f732d149725289580c8b031b3d3ce29c6c0f1eb93bd18b73d2cf46f1ff1588cef9a0e39ebe7892a9b
|
data/.rubocop.yml
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
require:
|
2
2
|
- rubocop-inhouse
|
3
3
|
|
4
|
-
AllCops:
|
5
|
-
TargetRubyVersion: 3.1
|
6
|
-
|
7
4
|
inherit_gem:
|
8
5
|
rubocop-inhouse:
|
9
6
|
- config/default.yml
|
10
7
|
|
11
|
-
|
12
|
-
|
8
|
+
AllCops:
|
9
|
+
TargetRubyVersion: 3.2
|
10
|
+
|
11
|
+
Naming/BlockForwarding:
|
12
|
+
EnforcedStyle: anonymous
|
data/CHANGELOG.md
CHANGED
@@ -9,3 +9,14 @@
|
|
9
9
|
- Chose to move away from daisyUI dropdown defaults as they have problems
|
10
10
|
displaying properly in too many situations
|
11
11
|
- Opted for using a protos-stimulus controller that uses tippy.js
|
12
|
+
|
13
|
+
## [0.3.0] - 2024-04-06
|
14
|
+
|
15
|
+
- Updates to phlex v0.10 by changing all `template` methods to `view_template`
|
16
|
+
- Improvements to README
|
17
|
+
|
18
|
+
## [0.4.0] - ???
|
19
|
+
|
20
|
+
- Phlex discord didn't like all the calls to `render`
|
21
|
+
- Apparently `render` is called differently within ERB
|
22
|
+
- Suggested to change all calls to immediately render, would improve ergonomics
|
data/README.md
CHANGED
@@ -25,11 +25,11 @@ Other Phlex based UI libraries worth checking out:
|
|
25
25
|
A protos component follows some conventions that make them easy to work with as
|
26
26
|
components in your app.
|
27
27
|
|
28
|
-
Every UI component library will have a tension between being too general
|
29
|
-
narrow to be useful. Making components that look good out of
|
30
|
-
them hard to customize.
|
28
|
+
Every UI component library will have a tension between being too general to fit
|
29
|
+
in your app or too narrow to be useful. Making components that look good out of
|
30
|
+
the box can make them hard to customize.
|
31
31
|
|
32
|
-
We try and resolve this
|
32
|
+
We try and resolve this tension by making these components have a minimal style
|
33
33
|
that can be easily overridden using some ergonomic conventions.
|
34
34
|
|
35
35
|
There are 3 core conventions:
|
@@ -40,11 +40,16 @@ There are 3 core conventions:
|
|
40
40
|
### Slots and themes
|
41
41
|
|
42
42
|
Components are styled with `css` slots that are filled with values from
|
43
|
-
a `theme
|
43
|
+
a `theme`.
|
44
|
+
|
45
|
+
You define a theme for your component by defining a `#theme` method that returns
|
46
|
+
a hash. This hash will be merged with any theme provided when rendering your
|
47
|
+
component. This allows you to easily override styles for your components
|
48
|
+
depending on their context.
|
44
49
|
|
45
50
|
```ruby
|
46
51
|
class List < Protos::Component
|
47
|
-
def
|
52
|
+
def view_template
|
48
53
|
ul(class: css[:list]) do
|
49
54
|
li(class: css[:item]) { "Item 1" }
|
50
55
|
li(class: css[:item]) { "Item 2" }
|
@@ -53,31 +58,8 @@ class List < Protos::Component
|
|
53
58
|
|
54
59
|
def theme
|
55
60
|
{
|
56
|
-
list: tokens("space-y-4"),
|
57
|
-
item:
|
58
|
-
}
|
59
|
-
end
|
60
|
-
end
|
61
|
-
```
|
62
|
-
|
63
|
-
Here we are using conditional `tokens` from Phlex but you can also use
|
64
|
-
simple strings.
|
65
|
-
|
66
|
-
If you want to change the method we define our default theme you can override the
|
67
|
-
`theme_method` on the class:
|
68
|
-
|
69
|
-
```ruby
|
70
|
-
class List < Protos::Component
|
71
|
-
theme_method :custom_theme
|
72
|
-
|
73
|
-
# ...
|
74
|
-
|
75
|
-
private
|
76
|
-
|
77
|
-
def custom_theme
|
78
|
-
{
|
79
|
-
list: tokens("space-y-4"),
|
80
|
-
item: tokens("font-bold", "text-2xl")
|
61
|
+
list: tokens("space-y-4"), # We can use `#tokens` from phlex (recommended)
|
62
|
+
item: "font-bold text-2xl" # Or just plain old strings
|
81
63
|
}
|
82
64
|
end
|
83
65
|
end
|
@@ -137,18 +119,40 @@ The new `css[:item]` slot would be:
|
|
137
119
|
<li class="font-bold">Item 1</li>
|
138
120
|
```
|
139
121
|
|
122
|
+
If you want to change the method we define our default theme you can override the
|
123
|
+
`theme_method` on the class:
|
124
|
+
|
125
|
+
```ruby
|
126
|
+
class List < Protos::Component
|
127
|
+
theme_method :custom_theme
|
128
|
+
|
129
|
+
# ...
|
130
|
+
|
131
|
+
private
|
132
|
+
|
133
|
+
def custom_theme
|
134
|
+
{
|
135
|
+
list: tokens("space-y-4"),
|
136
|
+
item: tokens("font-bold", "text-2xl")
|
137
|
+
}
|
138
|
+
end
|
139
|
+
end
|
140
|
+
```
|
141
|
+
|
140
142
|
### Attrs and default attrs
|
141
143
|
|
142
144
|
By convention, all components spread in an `attrs` hash on their outermost
|
143
145
|
element of the component.
|
144
146
|
|
145
147
|
By doing this we enable 2 main conveniences:
|
146
|
-
1. We can pass `class` when initializing the component
|
147
|
-
|
148
|
+
1. We can pass a `class` keyword when initializing the component which will be
|
149
|
+
merged safely into the `css[:container]` slot
|
150
|
+
2. We can add default attributes that are safely merged with any provided to the
|
151
|
+
component when its being initialized
|
148
152
|
|
149
153
|
```ruby
|
150
154
|
class List < Protos::Component
|
151
|
-
def
|
155
|
+
def view_template
|
152
156
|
ul(**attrs) do
|
153
157
|
# ...
|
154
158
|
end
|
@@ -158,9 +162,7 @@ class List < Protos::Component
|
|
158
162
|
|
159
163
|
def default_attrs
|
160
164
|
{
|
161
|
-
|
162
|
-
controller: "list"
|
163
|
-
}
|
165
|
+
data: { controller: "list" }
|
164
166
|
}
|
165
167
|
end
|
166
168
|
|
@@ -173,9 +175,24 @@ class List < Protos::Component
|
|
173
175
|
end
|
174
176
|
```
|
175
177
|
|
176
|
-
|
177
|
-
|
178
|
-
|
178
|
+
`#attrs` will by default merge the `class` keyword into the `css[:container]`
|
179
|
+
slot which we define in our theme.
|
180
|
+
|
181
|
+
Special html options will be safely merged. For examples, the component above
|
182
|
+
defines a list controller. If we passed our own controller into data when we
|
183
|
+
initialize, the component's data-controller attribute would be appended to:
|
184
|
+
|
185
|
+
```ruby
|
186
|
+
render List.new(
|
187
|
+
data: { controller: "tooltip" }
|
188
|
+
)
|
189
|
+
```
|
190
|
+
|
191
|
+
That would output both controllers to the DOM element:
|
192
|
+
|
193
|
+
```html
|
194
|
+
<ul data-controller="list tooltip">
|
195
|
+
```
|
179
196
|
|
180
197
|
If we wanted to, just like for our theme we can change the method from
|
181
198
|
`default_attrs` by defining the `default_attrs_method` on the class:
|
@@ -184,37 +201,16 @@ If we wanted to, just like for our theme we can change the method from
|
|
184
201
|
class List < Protos::Component
|
185
202
|
default_attrs_method :custom_attrs
|
186
203
|
|
187
|
-
# ...
|
188
|
-
|
189
204
|
private
|
190
205
|
|
191
206
|
def custom_attrs
|
192
207
|
{
|
193
|
-
data: {
|
194
|
-
controller: "list"
|
195
|
-
}
|
208
|
+
data: { controller: "list" }
|
196
209
|
}
|
197
210
|
end
|
198
|
-
|
199
|
-
# ...
|
200
211
|
end
|
201
212
|
```
|
202
213
|
|
203
|
-
Now we get some additional convenience:
|
204
|
-
|
205
|
-
```ruby
|
206
|
-
render List.new(
|
207
|
-
class: "my-lg",
|
208
|
-
data: { controller: "confetti" }
|
209
|
-
)
|
210
|
-
```
|
211
|
-
|
212
|
-
This would merge our `data` and `class` safely into the attributes:
|
213
|
-
|
214
|
-
```html
|
215
|
-
<ul data-controller="list confetti" class="space-y-4 my-lg">
|
216
|
-
```
|
217
|
-
|
218
214
|
### Params and options
|
219
215
|
|
220
216
|
Components extend
|
@@ -242,7 +238,7 @@ Here is an example of a small navbar component:
|
|
242
238
|
require "protos"
|
243
239
|
|
244
240
|
class Navbar < Protos::Component
|
245
|
-
def
|
241
|
+
def view_template
|
246
242
|
# **attrs will add:
|
247
243
|
# - Any html options defined on the component initialization such as data,
|
248
244
|
# role, for, etc..
|
@@ -379,11 +375,11 @@ import "protos-stimulus"
|
|
379
375
|
Then you can use the components in your apps.
|
380
376
|
|
381
377
|
```ruby
|
382
|
-
|
383
|
-
|
384
|
-
|
378
|
+
Protos::Card.new(class: "bg-base-100") do |card|
|
379
|
+
card.body(class: "gap-sm") do
|
380
|
+
card.title(class: "font-bold") { "Hello world" }
|
385
381
|
span { "This is some more content" }
|
386
|
-
|
382
|
+
card.actions do
|
387
383
|
button(class: "btn btn-primary") { "Action 1" }
|
388
384
|
end
|
389
385
|
end
|
@@ -661,6 +657,25 @@ git commits and the created tag, and push the `.gem` file to
|
|
661
657
|
Bug reports and pull requests are welcome on GitHub at
|
662
658
|
https://github.com/inhouse-work/protos.
|
663
659
|
|
660
|
+
## Benchmarks
|
661
|
+
|
662
|
+
You can run the benchmarks using the raketasks, e.g:
|
663
|
+
|
664
|
+
- `bin/rake benchmark:ips:table`
|
665
|
+
- `bin/rake benchmark:memory:table`
|
666
|
+
- `bin/rake benchmark:ips:theme`
|
667
|
+
- `bin/rake benchmark:ips:attributes`
|
668
|
+
|
669
|
+
There are also tasks for profiling and exploring memory consumption.
|
670
|
+
|
671
|
+
You can find the latest benchmarks in `benchmarks/`.
|
672
|
+
|
673
|
+
Currently this library is 30x slower than plain Phlex components. This is due to
|
674
|
+
the overhead of themes, attributes and other quality of life improvements.
|
675
|
+
|
676
|
+
This may seem like a lot but Phlex is so fast that rendering a large table can
|
677
|
+
still be done 4000 times per second with this lib.
|
678
|
+
|
664
679
|
## License
|
665
680
|
|
666
681
|
The gem is available as open source under the terms of the
|
data/benchmarks/.keep
ADDED
File without changes
|
@@ -0,0 +1,12 @@
|
|
1
|
+
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]
|
2
|
+
Warming up --------------------------------------
|
3
|
+
Protos::Table 41.000 i/100ms
|
4
|
+
Phlex::Table 1.239k i/100ms
|
5
|
+
Calculating -------------------------------------
|
6
|
+
Protos::Table 417.028 (± 0.2%) i/s - 2.091k in 5.014103s
|
7
|
+
Phlex::Table 12.785k (± 0.6%) i/s - 64.428k in 5.039702s
|
8
|
+
|
9
|
+
Comparison:
|
10
|
+
Phlex::Table: 12784.6 i/s
|
11
|
+
Protos::Table: 417.0 i/s - 30.66x slower
|
12
|
+
|
data/examples/list.rb
CHANGED
data/examples/navbar.rb
CHANGED
@@ -7,12 +7,12 @@ module Protos
|
|
7
7
|
|
8
8
|
option :id, type: Types::Coercible::String
|
9
9
|
|
10
|
-
def
|
10
|
+
def view_template(&block)
|
11
11
|
li(**attrs) do
|
12
|
-
render
|
12
|
+
render Collapse.new(theme: collapse_theme) do
|
13
13
|
# form: "" prevents the radio button from being submitted if its
|
14
14
|
# within a form
|
15
|
-
input(type: :radio, name: id, form: "")
|
15
|
+
input(type: :radio, name: id, form: "", autocomplete: :off)
|
16
16
|
yield if block
|
17
17
|
end
|
18
18
|
end
|
@@ -20,11 +20,10 @@ module Protos
|
|
20
20
|
|
21
21
|
private
|
22
22
|
|
23
|
-
def
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
Collapse.new(theme: collapse_theme)
|
23
|
+
def collapse_theme
|
24
|
+
{ "!container": tokens("bg-base-100") }.tap do |theme|
|
25
|
+
theme[:container!] = css[:collapse] if css[:collapse]
|
26
|
+
end
|
28
27
|
end
|
29
28
|
|
30
29
|
def theme
|
data/lib/protos/accordion.rb
CHANGED
@@ -10,20 +10,16 @@ module Protos
|
|
10
10
|
option :id,
|
11
11
|
default: -> { "collapse-#{SecureRandom.hex(4)}" }
|
12
12
|
|
13
|
-
def
|
14
|
-
ul(**attrs, &
|
13
|
+
def view_template(&)
|
14
|
+
ul(**attrs, &)
|
15
15
|
end
|
16
16
|
|
17
|
-
def item(
|
18
|
-
Item.new(id:, **kwargs)
|
19
|
-
end
|
17
|
+
def item(*, **, &) = render Item.new(*, id:, **, &)
|
20
18
|
|
21
|
-
def
|
22
|
-
Collapse::Title.new(*args, id:, **kwargs, &block)
|
23
|
-
end
|
19
|
+
def content(...) = render Collapse::Content.new(...)
|
24
20
|
|
25
|
-
def
|
26
|
-
Collapse::
|
21
|
+
def title(*, **, &)
|
22
|
+
render Collapse::Title.new(*, id:, **, &)
|
27
23
|
end
|
28
24
|
|
29
25
|
private
|
data/lib/protos/alert/actions.rb
CHANGED
data/lib/protos/alert/icon.rb
CHANGED
data/lib/protos/alert.rb
CHANGED
@@ -15,17 +15,13 @@ module Protos
|
|
15
15
|
|
16
16
|
option :type, type: AlertTypes, default: -> { :info }, reader: :private
|
17
17
|
|
18
|
-
def
|
19
|
-
div(**attrs, &
|
18
|
+
def view_template(&)
|
19
|
+
div(**attrs, &)
|
20
20
|
end
|
21
21
|
|
22
|
-
def icon(...)
|
23
|
-
Icon.new(...)
|
24
|
-
end
|
22
|
+
def icon(...) = render Icon.new(...)
|
25
23
|
|
26
|
-
def actions(...)
|
27
|
-
Actions.new(...)
|
28
|
-
end
|
24
|
+
def actions(...) = render Actions.new(...)
|
29
25
|
|
30
26
|
private
|
31
27
|
|
data/lib/protos/attributes.rb
CHANGED
@@ -11,7 +11,7 @@ module Protos
|
|
11
11
|
# controllers do not get overridden.
|
12
12
|
|
13
13
|
def initialize(attrs = {}, **kwargs)
|
14
|
-
@attrs = attrs.merge(kwargs)
|
14
|
+
@attrs = attrs.merge!(kwargs)
|
15
15
|
end
|
16
16
|
|
17
17
|
def [](key)
|
@@ -19,9 +19,10 @@ module Protos
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def merge(hash)
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
return self unless hash
|
23
|
+
|
24
|
+
@attrs = mix(@attrs, hash)
|
25
|
+
self
|
25
26
|
end
|
26
27
|
|
27
28
|
# Allows for the use of the `**` operator to pass the attributes to
|
@@ -32,10 +33,8 @@ module Protos
|
|
32
33
|
|
33
34
|
private
|
34
35
|
|
35
|
-
def mix(*hashes)
|
36
|
-
hashes.each_with_object(
|
37
|
-
hash ||= {}
|
38
|
-
|
36
|
+
def mix(hash, *hashes)
|
37
|
+
hashes.each_with_object(hash) do |hash, result|
|
39
38
|
result.merge!(hash) do |_key, a, b| # rubocop:disable Metrics/ParameterLists
|
40
39
|
case [a, b]
|
41
40
|
in String, String then "#{a} #{b}"
|
data/lib/protos/avatar.rb
CHANGED
data/lib/protos/breadcrumbs.rb
CHANGED
@@ -5,15 +5,13 @@ module Protos
|
|
5
5
|
# DOCS: A list of breadcrumbs (e.g links) for navigation
|
6
6
|
# https://daisyui.com/components/breadcrumbs/
|
7
7
|
|
8
|
-
def
|
8
|
+
def view_template(&block)
|
9
9
|
nav(**attrs) do
|
10
10
|
ul(class: css[:list], &block)
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
def crumb(...)
|
15
|
-
Crumb.new(...)
|
16
|
-
end
|
14
|
+
def crumb(...) = render Crumb.new(...)
|
17
15
|
|
18
16
|
private
|
19
17
|
|
data/lib/protos/card/actions.rb
CHANGED
data/lib/protos/card/body.rb
CHANGED
data/lib/protos/card/image.rb
CHANGED
data/lib/protos/card/title.rb
CHANGED
data/lib/protos/card.rb
CHANGED
@@ -14,25 +14,17 @@ module Protos
|
|
14
14
|
default: -> { :default },
|
15
15
|
reader: false
|
16
16
|
|
17
|
-
def
|
18
|
-
article(**attrs, &
|
17
|
+
def view_template(&)
|
18
|
+
article(**attrs, &)
|
19
19
|
end
|
20
20
|
|
21
|
-
def body(...)
|
22
|
-
Body.new(...)
|
23
|
-
end
|
21
|
+
def body(...) = render Body.new(...)
|
24
22
|
|
25
|
-
def image(...)
|
26
|
-
Image.new(...)
|
27
|
-
end
|
23
|
+
def image(...) = render Image.new(...)
|
28
24
|
|
29
|
-
def title(...)
|
30
|
-
Title.new(...)
|
31
|
-
end
|
25
|
+
def title(...) = render Title.new(...)
|
32
26
|
|
33
|
-
def actions(...)
|
34
|
-
Actions.new(...)
|
35
|
-
end
|
27
|
+
def actions(...) = render Actions.new(...)
|
36
28
|
|
37
29
|
private
|
38
30
|
|
data/lib/protos/carousel/item.rb
CHANGED
data/lib/protos/carousel.rb
CHANGED
@@ -16,17 +16,13 @@ module Protos
|
|
16
16
|
:end
|
17
17
|
)
|
18
18
|
|
19
|
-
def
|
20
|
-
div(**attrs, &
|
19
|
+
def view_template(&)
|
20
|
+
div(**attrs, &)
|
21
21
|
end
|
22
22
|
|
23
|
-
def item(...)
|
24
|
-
Item.new(...)
|
25
|
-
end
|
23
|
+
def item(...) = render Item.new(...)
|
26
24
|
|
27
|
-
def actions(...)
|
28
|
-
Actions.new(...)
|
29
|
-
end
|
25
|
+
def actions(...) = render Actions.new(...)
|
30
26
|
|
31
27
|
private
|
32
28
|
|