protos 0.2.1 → 0.2.2

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 (95) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +262 -70
  3. data/examples/list.rb +34 -0
  4. data/lib/protos/accordion/item.rb +6 -4
  5. data/lib/protos/accordion.rb +5 -0
  6. data/lib/protos/alert/actions.rb +2 -0
  7. data/lib/protos/alert/icon.rb +3 -0
  8. data/lib/protos/alert.rb +4 -0
  9. data/lib/protos/attributes.rb +8 -0
  10. data/lib/protos/avatar.rb +3 -0
  11. data/lib/protos/breadcrumbs/crumb.rb +2 -0
  12. data/lib/protos/breadcrumbs.rb +3 -0
  13. data/lib/protos/card/actions.rb +2 -0
  14. data/lib/protos/card/body.rb +2 -0
  15. data/lib/protos/card/image.rb +4 -0
  16. data/lib/protos/card/title.rb +2 -0
  17. data/lib/protos/card.rb +3 -0
  18. data/lib/protos/carousel/actions.rb +2 -0
  19. data/lib/protos/carousel/item.rb +2 -0
  20. data/lib/protos/carousel.rb +4 -0
  21. data/lib/protos/chat_bubble/content.rb +3 -0
  22. data/lib/protos/chat_bubble/footer.rb +2 -0
  23. data/lib/protos/chat_bubble/header.rb +3 -0
  24. data/lib/protos/chat_bubble/image.rb +3 -0
  25. data/lib/protos/chat_bubble.rb +5 -0
  26. data/lib/protos/collapse/content.rb +3 -0
  27. data/lib/protos/collapse/title.rb +3 -0
  28. data/lib/protos/collapse.rb +4 -0
  29. data/lib/protos/combobox.rb +4 -0
  30. data/lib/protos/command/dialog.rb +9 -1
  31. data/lib/protos/command/empty.rb +3 -0
  32. data/lib/protos/command/group.rb +4 -0
  33. data/lib/protos/command/input.rb +2 -0
  34. data/lib/protos/command/item.rb +2 -0
  35. data/lib/protos/command/list.rb +2 -0
  36. data/lib/protos/command/title.rb +3 -0
  37. data/lib/protos/command/trigger.rb +2 -0
  38. data/lib/protos/command.rb +4 -0
  39. data/lib/protos/component.rb +21 -9
  40. data/lib/protos/drawer/content.rb +3 -0
  41. data/lib/protos/drawer/side.rb +8 -1
  42. data/lib/protos/drawer/trigger.rb +3 -0
  43. data/lib/protos/drawer.rb +6 -1
  44. data/lib/protos/dropdown/item.rb +2 -0
  45. data/lib/protos/dropdown/menu.rb +4 -0
  46. data/lib/protos/dropdown/trigger.rb +2 -0
  47. data/lib/protos/dropdown.rb +8 -0
  48. data/lib/protos/engine.rb +3 -0
  49. data/lib/protos/hero/content.rb +3 -0
  50. data/lib/protos/hero/overlay.rb +4 -0
  51. data/lib/protos/hero.rb +4 -0
  52. data/lib/protos/list/item.rb +4 -0
  53. data/lib/protos/list.rb +3 -0
  54. data/lib/protos/modal/close_button.rb +2 -0
  55. data/lib/protos/modal/dialog.rb +9 -1
  56. data/lib/protos/modal/trigger.rb +2 -0
  57. data/lib/protos/modal.rb +3 -0
  58. data/lib/protos/popover/content.rb +5 -0
  59. data/lib/protos/popover/trigger.rb +3 -0
  60. data/lib/protos/popover.rb +8 -1
  61. data/lib/protos/stats/actions.rb +2 -0
  62. data/lib/protos/stats/description.rb +2 -0
  63. data/lib/protos/stats/figure.rb +2 -0
  64. data/lib/protos/stats/stat.rb +2 -0
  65. data/lib/protos/stats/title.rb +2 -0
  66. data/lib/protos/stats/value.rb +2 -0
  67. data/lib/protos/stats.rb +3 -0
  68. data/lib/protos/swap/off.rb +2 -0
  69. data/lib/protos/swap/on.rb +2 -0
  70. data/lib/protos/swap.rb +4 -0
  71. data/lib/protos/table/body.rb +2 -0
  72. data/lib/protos/table/caption.rb +2 -0
  73. data/lib/protos/table/cell.rb +2 -0
  74. data/lib/protos/table/footer.rb +2 -0
  75. data/lib/protos/table/head.rb +2 -0
  76. data/lib/protos/table/header.rb +3 -0
  77. data/lib/protos/table/row.rb +2 -0
  78. data/lib/protos/table.rb +3 -0
  79. data/lib/protos/tabs/tab.rb +2 -0
  80. data/lib/protos/tabs.rb +3 -0
  81. data/lib/protos/theme.rb +5 -0
  82. data/lib/protos/timeline/center.rb +3 -0
  83. data/lib/protos/timeline/item.rb +4 -0
  84. data/lib/protos/timeline/left.rb +3 -0
  85. data/lib/protos/timeline/right.rb +3 -0
  86. data/lib/protos/timeline.rb +3 -0
  87. data/lib/protos/toast/close_button.rb +2 -0
  88. data/lib/protos/toast.rb +4 -0
  89. data/lib/protos/token_list.rb +7 -1
  90. data/lib/protos/typography/heading.rb +3 -0
  91. data/lib/protos/typography/inline_link.rb +2 -0
  92. data/lib/protos/typography/paragraph.rb +2 -0
  93. data/lib/protos/typography.rb +3 -0
  94. data/lib/protos/version.rb +1 -1
  95. metadata +3 -2
@@ -3,6 +3,8 @@
3
3
  module Protos
4
4
  class Table
5
5
  class Cell < Component
6
+ # DOCS: A single cell in a table
7
+
6
8
  option :align,
7
9
  type: Types::Coercible::Symbol.enum(:left, :center, :right),
8
10
  default: -> {
@@ -3,6 +3,8 @@
3
3
  module Protos
4
4
  class Table
5
5
  class Footer < Component
6
+ # DOCS: The footer of a table
7
+
6
8
  def template(&block)
7
9
  tfoot(**attrs, &block)
8
10
  end
@@ -3,6 +3,8 @@
3
3
  module Protos
4
4
  class Table
5
5
  class Head < Component
6
+ # DOCS: The head of a table
7
+
6
8
  option :align,
7
9
  type: Types::Coercible::Symbol.enum(:left, :center, :right),
8
10
  default: -> {
@@ -3,6 +3,9 @@
3
3
  module Protos
4
4
  class Table
5
5
  class Header < Component
6
+ # DOCS: The header of a table that contains many Protos::Table::Head
7
+ # components
8
+
6
9
  def template(&block)
7
10
  thead(**attrs, &block)
8
11
  end
@@ -3,6 +3,8 @@
3
3
  module Protos
4
4
  class Table
5
5
  class Row < Component
6
+ # DOCS: The row of a table
7
+
6
8
  def template(&block)
7
9
  tr(**attrs, &block)
8
10
  end
data/lib/protos/table.rb CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  module Protos
4
4
  class Table < Component
5
+ # DOCS: A table component
6
+ # https://daisyui.com/components/table/
7
+
5
8
  option :pin_rows, default: -> { false }, type: Types::Bool
6
9
  option :pin_columns, default: -> { false }, type: Types::Bool
7
10
  option :striped, default: -> { false }, type: Types::Bool
@@ -3,6 +3,8 @@
3
3
  module Protos
4
4
  class Tabs
5
5
  class Tab < Component
6
+ # DOCS: A single tab in a tabs component
7
+
6
8
  param :id
7
9
  option :label
8
10
  option :active, default: -> { false }
data/lib/protos/tabs.rb CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  module Protos
4
4
  class Tabs < Component
5
+ # DOCS: A component that contains many Protos::Tab components
6
+ # https://daisyui.com/components/tab/
7
+
5
8
  option :type,
6
9
  default: -> { :default },
7
10
  reader: false,
data/lib/protos/theme.rb CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  module Protos
4
4
  class Theme
5
+ # DOCS: A class that holds data for a theme. This class is used to safely
6
+ # merge in user supplied css classes into a default theme.
7
+ # This is the object that is returned by `css` and used to set slots for
8
+ # a component style.
9
+
5
10
  def initialize(theme = {}, **kwargs)
6
11
  @theme = theme.merge(kwargs)
7
12
  end
@@ -3,6 +3,9 @@
3
3
  module Protos
4
4
  class Timeline
5
5
  class Center < Component
6
+ # DOCS: The center of a timeline. This would usually be an icon or
7
+ # something small that shows a point on the timeline.
8
+
6
9
  def template(&block)
7
10
  div(**attrs, &block)
8
11
  end
@@ -3,6 +3,10 @@
3
3
  module Protos
4
4
  class Timeline
5
5
  class Item < Component
6
+ # DOCS: The item of a timeline. Usually containing a center, left and
7
+ # right and depending on its position in the list, an hr at the beginning
8
+ # or end.
9
+
6
10
  def template(&block)
7
11
  li(**attrs, &block)
8
12
  end
@@ -3,6 +3,9 @@
3
3
  module Protos
4
4
  class Timeline
5
5
  class Left < Component
6
+ # DOCS: Content on the left (on daisyui "start") side of a timeline.
7
+ # We chose not to use start/end because of the keywork conflict with ruby.
8
+
6
9
  def template(&block)
7
10
  div(**attrs, &block)
8
11
  end
@@ -3,6 +3,9 @@
3
3
  module Protos
4
4
  class Timeline
5
5
  class Right < Component
6
+ # DOCS: Content on the right (on daisyui "end") side of a timeline.
7
+ # We chose not to use start/end because of the keywork conflict with ruby.
8
+
6
9
  def template(&block)
7
10
  div(**attrs, &block)
8
11
  end
@@ -2,6 +2,9 @@
2
2
 
3
3
  module Protos
4
4
  class Timeline < Component
5
+ # DOCS: A timeline component
6
+ # https://daisyui.com/components/timeline/
7
+
5
8
  option :vertical, type: Types::Bool, default: -> { false }
6
9
 
7
10
  def template(&block)
@@ -3,6 +3,8 @@
3
3
  module Protos
4
4
  class Toast
5
5
  class CloseButton < Component
6
+ # DOCS: A close button for a toast
7
+
6
8
  def template(&block)
7
9
  form(method: :dialog, class: css[:form]) do
8
10
  button(
data/lib/protos/toast.rb CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  module Protos
4
4
  class Toast < Component
5
+ # DOCS: A toast component that can be used to display messages to the user
6
+ # that popup at a fixed position on the screen.
7
+ # https://daisyui.com/components/toast/
8
+
5
9
  Positions = Types::Symbol.enum(
6
10
  :top_start,
7
11
  :top_center,
@@ -2,12 +2,18 @@
2
2
 
3
3
  module Protos
4
4
  class TokenList
5
+ # DOCS: A list of utility tokens that can handle parsing and merging sets of
6
+ # tokens together safely. It uses TailwindMerge to merge the tokens together
7
+ # while accounting for their conflicts.
8
+
5
9
  def self.parse(input)
6
10
  case input
7
11
  when String then new(input.split)
8
12
  when Array then new(input)
9
13
  when TokenList then input
10
- else raise ArgumentError, "Invalid input: #{input.inspect}"
14
+ when NilClass then new
15
+ else raise ArgumentError,
16
+ "Invalid input for #{self.class.name}: #{input.inspect}"
11
17
  end
12
18
  end
13
19
 
@@ -3,6 +3,9 @@
3
3
  module Protos
4
4
  module Typography
5
5
  class Heading < Protos::Component
6
+ # DOCS: A heading component that encapsulates all heading levels by their
7
+ # size and level.
8
+
6
9
  SizeTypes = Types::Coercible::Symbol.enum(:xs, :sm, :md, :lg, :xl)
7
10
  LevelTypes = Types::Integer.enum(1, 2, 3, 4, 5, 6)
8
11
 
@@ -3,6 +3,8 @@
3
3
  module Protos
4
4
  module Typography
5
5
  class InlineLink < Component
6
+ # DOCS: A link that is styled to be inline with text
7
+
6
8
  def template(&block)
7
9
  a(**attrs, &block)
8
10
  end
@@ -3,6 +3,8 @@
3
3
  module Protos
4
4
  module Typography
5
5
  class Paragraph < Component
6
+ # DOCS: A paragraph of text
7
+
6
8
  def template(&block)
7
9
  p(**attrs, &block)
8
10
  end
@@ -2,6 +2,9 @@
2
2
 
3
3
  module Protos
4
4
  module Typography
5
+ # DOCS: The core typography module that can be mixedin to override the
6
+ # default elements with custom elements.
7
+
5
8
  def h1(**options, &block)
6
9
  render(Heading.new(level: 1, size: :xl, **options), &block)
7
10
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Protos
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nolan J Tait
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-08 00:00:00.000000000 Z
11
+ date: 2024-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-core
@@ -93,6 +93,7 @@ files:
93
93
  - LICENSE.txt
94
94
  - README.md
95
95
  - Rakefile
96
+ - examples/list.rb
96
97
  - examples/navbar.rb
97
98
  - lib/protos.rb
98
99
  - lib/protos/accordion.rb