protos 0.3.0 → 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.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +5 -5
  3. data/CHANGELOG.md +11 -0
  4. data/README.md +26 -7
  5. data/benchmarks/.keep +0 -0
  6. data/benchmarks/table.txt +12 -0
  7. data/examples/list.rb +2 -0
  8. data/lib/protos/accordion/item.rb +5 -6
  9. data/lib/protos/accordion.rb +6 -10
  10. data/lib/protos/alert/actions.rb +2 -2
  11. data/lib/protos/alert/icon.rb +2 -2
  12. data/lib/protos/alert.rb +4 -8
  13. data/lib/protos/attributes.rb +7 -8
  14. data/lib/protos/breadcrumbs/crumb.rb +2 -2
  15. data/lib/protos/breadcrumbs.rb +1 -3
  16. data/lib/protos/card/actions.rb +2 -2
  17. data/lib/protos/card/body.rb +2 -2
  18. data/lib/protos/card/image.rb +2 -2
  19. data/lib/protos/card/title.rb +2 -2
  20. data/lib/protos/card.rb +6 -14
  21. data/lib/protos/carousel/actions.rb +2 -2
  22. data/lib/protos/carousel/item.rb +2 -2
  23. data/lib/protos/carousel.rb +4 -8
  24. data/lib/protos/chat_bubble/content.rb +2 -2
  25. data/lib/protos/chat_bubble/footer.rb +2 -2
  26. data/lib/protos/chat_bubble/header.rb +2 -2
  27. data/lib/protos/chat_bubble/image.rb +2 -2
  28. data/lib/protos/chat_bubble.rb +6 -14
  29. data/lib/protos/collapse/content.rb +2 -2
  30. data/lib/protos/collapse/title.rb +3 -3
  31. data/lib/protos/collapse.rb +2 -6
  32. data/lib/protos/combobox.rb +8 -24
  33. data/lib/protos/command/empty.rb +2 -2
  34. data/lib/protos/command/item.rb +2 -2
  35. data/lib/protos/command/list.rb +2 -2
  36. data/lib/protos/command/title.rb +2 -2
  37. data/lib/protos/command/trigger.rb +2 -2
  38. data/lib/protos/command.rb +10 -26
  39. data/lib/protos/component.rb +21 -30
  40. data/lib/protos/drawer/content.rb +2 -2
  41. data/lib/protos/drawer/trigger.rb +2 -2
  42. data/lib/protos/drawer.rb +3 -9
  43. data/lib/protos/dropdown/item.rb +2 -2
  44. data/lib/protos/dropdown.rb +3 -9
  45. data/lib/protos/hero/content.rb +2 -2
  46. data/lib/protos/hero/overlay.rb +2 -2
  47. data/lib/protos/hero.rb +4 -8
  48. data/lib/protos/list/item.rb +2 -2
  49. data/lib/protos/list.rb +3 -5
  50. data/lib/protos/modal/trigger.rb +2 -2
  51. data/lib/protos/modal.rb +5 -11
  52. data/lib/protos/popover/content.rb +2 -0
  53. data/lib/protos/popover/trigger.rb +2 -2
  54. data/lib/protos/popover.rb +4 -8
  55. data/lib/protos/stats/actions.rb +2 -2
  56. data/lib/protos/stats/description.rb +2 -2
  57. data/lib/protos/stats/figure.rb +2 -2
  58. data/lib/protos/stats/stat.rb +2 -2
  59. data/lib/protos/stats/title.rb +2 -2
  60. data/lib/protos/stats/value.rb +2 -2
  61. data/lib/protos/stats.rb +8 -20
  62. data/lib/protos/swap/off.rb +2 -2
  63. data/lib/protos/swap/on.rb +2 -2
  64. data/lib/protos/swap.rb +2 -6
  65. data/lib/protos/table/body.rb +2 -2
  66. data/lib/protos/table/caption.rb +3 -3
  67. data/lib/protos/table/cell.rb +2 -2
  68. data/lib/protos/table/footer.rb +2 -2
  69. data/lib/protos/table/head.rb +2 -2
  70. data/lib/protos/table/header.rb +2 -2
  71. data/lib/protos/table/row.rb +2 -2
  72. data/lib/protos/table.rb +7 -21
  73. data/lib/protos/tabs/tab.rb +3 -3
  74. data/lib/protos/tabs.rb +3 -5
  75. data/lib/protos/theme.rb +34 -45
  76. data/lib/protos/timeline/center.rb +2 -2
  77. data/lib/protos/timeline/item.rb +2 -2
  78. data/lib/protos/timeline/left.rb +2 -2
  79. data/lib/protos/timeline/right.rb +2 -2
  80. data/lib/protos/timeline.rb +6 -14
  81. data/lib/protos/toast/close_button.rb +1 -0
  82. data/lib/protos/toast.rb +3 -5
  83. data/lib/protos/token_list.rb +18 -31
  84. data/lib/protos/typography/heading.rb +2 -2
  85. data/lib/protos/typography/inline_link.rb +3 -3
  86. data/lib/protos/typography/paragraph.rb +2 -2
  87. data/lib/protos/typography.rb +12 -12
  88. data/lib/protos/version.rb +1 -1
  89. data/protos.gemspec +14 -2
  90. metadata +6 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5fe048d407665dc19039444171da359495565d7b94d1787c444c4e8e8c5fe191
4
- data.tar.gz: fda1eea822602572a8a28be104b8e60b533d429745d4ef616be8c7f14bf9e53e
3
+ metadata.gz: 2e1c2bbb97997971d3380fb5846b8720a01d50d61942a9dea5a00e5d19d2c416
4
+ data.tar.gz: 10c0adb3dfeef8488ae235b0b7d4ec9567f7011ec5bbe0707d33bff3d6cc0049
5
5
  SHA512:
6
- metadata.gz: e4859a4076a79386043b18ad71735b9b372c9120a0f3a8a816d1020174152b19ed2a030172ef01e7240ec26d28dce73070ce478ed440e15526eabde03f500067
7
- data.tar.gz: 2ac30388a8534552f10cb32bc68b9f7786bd14caf1eab69d8f15c6a310a08d92b27eeb1a97896a60df18cd6e489c30f179706fd72ac0eca7072f435d05ebad9e
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
- Style/ConstantVisibility:
12
- Enabled: false
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
@@ -49,7 +49,7 @@ depending on their context.
49
49
 
50
50
  ```ruby
51
51
  class List < Protos::Component
52
- def template
52
+ def view_template
53
53
  ul(class: css[:list]) do
54
54
  li(class: css[:item]) { "Item 1" }
55
55
  li(class: css[:item]) { "Item 2" }
@@ -152,7 +152,7 @@ By doing this we enable 2 main conveniences:
152
152
 
153
153
  ```ruby
154
154
  class List < Protos::Component
155
- def template
155
+ def view_template
156
156
  ul(**attrs) do
157
157
  # ...
158
158
  end
@@ -238,7 +238,7 @@ Here is an example of a small navbar component:
238
238
  require "protos"
239
239
 
240
240
  class Navbar < Protos::Component
241
- def template
241
+ def view_template
242
242
  # **attrs will add:
243
243
  # - Any html options defined on the component initialization such as data,
244
244
  # role, for, etc..
@@ -375,11 +375,11 @@ import "protos-stimulus"
375
375
  Then you can use the components in your apps.
376
376
 
377
377
  ```ruby
378
- render Protos::Card.new(class: "bg-base-100") do |card|
379
- render card.body(class: "gap-sm") do
380
- render card.title(class: "font-bold") { "Hello world" }
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" }
381
381
  span { "This is some more content" }
382
- render card.actions do
382
+ card.actions do
383
383
  button(class: "btn btn-primary") { "Action 1" }
384
384
  end
385
385
  end
@@ -657,6 +657,25 @@ git commits and the created tag, and push the `.gem` file to
657
657
  Bug reports and pull requests are welcome on GitHub at
658
658
  https://github.com/inhouse-work/protos.
659
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
+
660
679
  ## License
661
680
 
662
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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "protos"
2
4
 
3
5
  class List < Protos::Component
@@ -9,7 +9,7 @@ module Protos
9
9
 
10
10
  def view_template(&block)
11
11
  li(**attrs) do
12
- render collapse_component do
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
15
  input(type: :radio, name: id, form: "", autocomplete: :off)
@@ -20,11 +20,10 @@ module Protos
20
20
 
21
21
  private
22
22
 
23
- def collapse_component
24
- collapse_theme = { "!container": tokens("bg-base-100") }
25
- collapse_theme[:container!] = css[:collapse] if css[:collapse]
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
@@ -10,20 +10,16 @@ module Protos
10
10
  option :id,
11
11
  default: -> { "collapse-#{SecureRandom.hex(4)}" }
12
12
 
13
- def view_template(&block)
14
- ul(**attrs, &block)
13
+ def view_template(&)
14
+ ul(**attrs, &)
15
15
  end
16
16
 
17
- def item(**kwargs)
18
- Item.new(id:, **kwargs)
19
- end
17
+ def item(*, **, &) = render Item.new(*, id:, **, &)
20
18
 
21
- def title(*args, **kwargs, &block)
22
- Collapse::Title.new(*args, id:, **kwargs, &block)
23
- end
19
+ def content(...) = render Collapse::Content.new(...)
24
20
 
25
- def content(...)
26
- Collapse::Content.new(...)
21
+ def title(*, **, &)
22
+ render Collapse::Title.new(*, id:, **, &)
27
23
  end
28
24
 
29
25
  private
@@ -5,8 +5,8 @@ module Protos
5
5
  class Actions < Component
6
6
  # DOCS: Area for actions (e.g buttons) within an alert
7
7
 
8
- def view_template(&block)
9
- nav(**attrs, &block)
8
+ def view_template(&)
9
+ nav(**attrs, &)
10
10
  end
11
11
 
12
12
  private
@@ -6,8 +6,8 @@ module Protos
6
6
  # DOCS: Icon for the alert, usually showing at the top left corner aligned
7
7
  # to the text
8
8
 
9
- def view_template(&block)
10
- div(**attrs, &block)
9
+ def view_template(&)
10
+ div(**attrs, &)
11
11
  end
12
12
 
13
13
  private
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 view_template(&block)
19
- div(**attrs, &block)
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
 
@@ -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
- tap do
23
- @attrs = mix(@attrs, hash)
24
- end
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({}).each do |hash, result|
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}"
@@ -5,8 +5,8 @@ module Protos
5
5
  class Crumb < Component
6
6
  # DOCS: A crumb is a single item within a breadcrumb
7
7
 
8
- def view_template(&block)
9
- li(**attrs, &block)
8
+ def view_template(&)
9
+ li(**attrs, &)
10
10
  end
11
11
  end
12
12
  end
@@ -11,9 +11,7 @@ module Protos
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
 
@@ -5,8 +5,8 @@ module Protos
5
5
  class Actions < Component
6
6
  # DOCS: Area for actions (e.g buttons) within a card
7
7
 
8
- def view_template(&block)
9
- nav(**attrs, &block)
8
+ def view_template(&)
9
+ nav(**attrs, &)
10
10
  end
11
11
 
12
12
  private
@@ -5,8 +5,8 @@ module Protos
5
5
  class Body < Component
6
6
  # DOCS: The main content area of a card
7
7
 
8
- def view_template(&block)
9
- div(**attrs, &block)
8
+ def view_template(&)
9
+ div(**attrs, &)
10
10
  end
11
11
 
12
12
  private
@@ -7,8 +7,8 @@ module Protos
7
7
  # on daisyui which will style the <figure> tag depending on whether
8
8
  # image-overlay is present on the card.
9
9
 
10
- def view_template(&block)
11
- figure(**attrs, &block)
10
+ def view_template(&)
11
+ figure(**attrs, &)
12
12
  end
13
13
  end
14
14
  end
@@ -5,8 +5,8 @@ module Protos
5
5
  class Title < Component
6
6
  # DOCS: The title of a card
7
7
 
8
- def view_template(&block)
9
- div(**attrs, &block)
8
+ def view_template(&)
9
+ div(**attrs, &)
10
10
  end
11
11
 
12
12
  private
data/lib/protos/card.rb CHANGED
@@ -14,25 +14,17 @@ module Protos
14
14
  default: -> { :default },
15
15
  reader: false
16
16
 
17
- def view_template(&block)
18
- article(**attrs, &block)
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
 
@@ -5,8 +5,8 @@ module Protos
5
5
  class Actions < Component
6
6
  # DOCS: Area for actions (e.g buttons) within a carousel
7
7
 
8
- def view_template(&block)
9
- div(**attrs, &block)
8
+ def view_template(&)
9
+ div(**attrs, &)
10
10
  end
11
11
 
12
12
  private
@@ -5,8 +5,8 @@ module Protos
5
5
  class Item < Component
6
6
  # DOCS: A single item within a carousel
7
7
 
8
- def view_template(&block)
9
- div(**attrs, &block)
8
+ def view_template(&)
9
+ div(**attrs, &)
10
10
  end
11
11
 
12
12
  private
@@ -16,17 +16,13 @@ module Protos
16
16
  :end
17
17
  )
18
18
 
19
- def view_template(&block)
20
- div(**attrs, &block)
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
 
@@ -20,8 +20,8 @@ module Protos
20
20
  :error
21
21
  )
22
22
 
23
- def view_template(&block)
24
- div(**attrs, &block)
23
+ def view_template(&)
24
+ div(**attrs, &)
25
25
  end
26
26
 
27
27
  private
@@ -5,8 +5,8 @@ module Protos
5
5
  class Footer < Component
6
6
  # DOCS: The footer of a chat bubble
7
7
 
8
- def view_template(&block)
9
- div(**attrs, &block)
8
+ def view_template(&)
9
+ div(**attrs, &)
10
10
  end
11
11
 
12
12
  private
@@ -6,8 +6,8 @@ module Protos
6
6
  # DOCS: The header of a chat bubble. This is typically used to display the
7
7
  # name of the user who sent the message.
8
8
 
9
- def view_template(&block)
10
- div(**attrs, &block)
9
+ def view_template(&)
10
+ div(**attrs, &)
11
11
  end
12
12
 
13
13
  private
@@ -6,8 +6,8 @@ module Protos
6
6
  # DOCS: An image within a chat bubble. This would typically be an avatar
7
7
  # component.
8
8
 
9
- def view_template(&block)
10
- div(**attrs, &block)
9
+ def view_template(&)
10
+ div(**attrs, &)
11
11
  end
12
12
 
13
13
  private
@@ -15,25 +15,17 @@ module Protos
15
15
  :end
16
16
  )
17
17
 
18
- def view_template(&block)
19
- div(**attrs, &block)
18
+ def view_template(&)
19
+ div(**attrs, &)
20
20
  end
21
21
 
22
- def content(...)
23
- Content.new(...)
24
- end
22
+ def content(...) = render Content.new(...)
25
23
 
26
- def footer(...)
27
- Footer.new(...)
28
- end
24
+ def footer(...) = render Footer.new(...)
29
25
 
30
- def header(...)
31
- Header.new(...)
32
- end
26
+ def header(...) = render Header.new(...)
33
27
 
34
- def image(...)
35
- Image.new(...)
36
- end
28
+ def image(...) = render Image.new(...)
37
29
 
38
30
  private
39
31
 
@@ -6,8 +6,8 @@ module Protos
6
6
  # DOCS: The content of a collapse. This would be hidden until the collapse
7
7
  # is opened.
8
8
 
9
- def view_template(&block)
10
- div(**attrs, &block)
9
+ def view_template(&)
10
+ div(**attrs, &)
11
11
  end
12
12
 
13
13
  private
@@ -10,11 +10,11 @@ module Protos
10
10
  reader: false,
11
11
  default: -> { "" }
12
12
 
13
- def view_template(&block)
13
+ def view_template(&)
14
14
  if @id.size.positive?
15
- label(for: @id, **attrs, &block)
15
+ label(for: @id, **attrs, &)
16
16
  else
17
- div(**attrs, &block)
17
+ div(**attrs, &)
18
18
  end
19
19
  end
20
20
 
@@ -18,13 +18,9 @@ module Protos
18
18
  end
19
19
  end
20
20
 
21
- def title(*args, **kwargs, &block)
22
- Title.new(*args, id:, **kwargs, &block)
23
- end
21
+ def title(*, **, &) = render Title.new(*, id:, **, &)
24
22
 
25
- def content(...)
26
- Content.new(...)
27
- end
23
+ def content(...) = render Content.new(...)
28
24
 
29
25
  private
30
26
 
@@ -11,37 +11,21 @@ module Protos
11
11
  reader: false,
12
12
  type: TriggerTypes | Types::Array.of(TriggerTypes)
13
13
 
14
- def trigger(...)
15
- Popover::Trigger.new(...)
16
- end
14
+ def trigger(...) = render Popover::Trigger.new(...)
17
15
 
18
- def content(...)
19
- Popover::Content.new(...)
20
- end
16
+ def content(...) = render Popover::Content.new(...)
21
17
 
22
- def input(...)
23
- Command::Input.new(...)
24
- end
18
+ def input(...) = render Command::Input.new(...)
25
19
 
26
- def group(...)
27
- Command::Group.new(...)
28
- end
20
+ def group(...) = render Command::Group.new(...)
29
21
 
30
- def item(...)
31
- Command::Item.new(...)
32
- end
22
+ def item(...) = render Command::Item.new(...)
33
23
 
34
- def list(...)
35
- Command::List.new(...)
36
- end
24
+ def list(...) = render Command::List.new(...)
37
25
 
38
- def title(...)
39
- Command::Title.new(...)
40
- end
26
+ def title(...) = render Command::Title.new(...)
41
27
 
42
- def empty(...)
43
- Command::Empty.new(...)
44
- end
28
+ def empty(...) = render Command::Empty.new(...)
45
29
 
46
30
  private
47
31
 
@@ -6,8 +6,8 @@ module Protos
6
6
  # DOCS: The empty component is displayed in the list when there are no
7
7
  # matches in an input.
8
8
 
9
- def view_template(&block)
10
- li(**attrs, &block)
9
+ def view_template(&)
10
+ li(**attrs, &)
11
11
  end
12
12
 
13
13
  private
@@ -5,8 +5,8 @@ module Protos
5
5
  class Item < Component
6
6
  # DOCS: A single option within a command
7
7
 
8
- def view_template(&block)
9
- li(**attrs, &block)
8
+ def view_template(&)
9
+ li(**attrs, &)
10
10
  end
11
11
 
12
12
  private
@@ -5,8 +5,8 @@ module Protos
5
5
  class List < Component
6
6
  # DOCS: A list of commands. This can contain either items or groups.
7
7
 
8
- def view_template(&block)
9
- ul(**attrs, &block)
8
+ def view_template(&)
9
+ ul(**attrs, &)
10
10
  end
11
11
 
12
12
  private
@@ -6,8 +6,8 @@ module Protos
6
6
  # DOCS: The title for a group of commands. This is expected to be used
7
7
  # inside a Protos::Command::Group component.
8
8
 
9
- def view_template(&block)
10
- h2(**attrs, &block)
9
+ def view_template(&)
10
+ h2(**attrs, &)
11
11
  end
12
12
 
13
13
  private
@@ -5,8 +5,8 @@ module Protos
5
5
  class Trigger < Component
6
6
  # DOCS: A trigger is a button that opens a command palette modal
7
7
 
8
- def view_template(&block)
9
- button(**attrs, &block)
8
+ def view_template(&)
9
+ button(**attrs, &)
10
10
  end
11
11
 
12
12
  private