vitrail 0.4.0 → 1.0.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 (45) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +16 -30
  3. data/app/components/vitrail/badge.rb +7 -7
  4. data/app/components/vitrail/button_tag/component.rb +74 -0
  5. data/app/components/vitrail/card/component.html.erb +18 -0
  6. data/app/components/vitrail/card/component.rb +9 -0
  7. data/app/components/vitrail/link_to/component.rb +64 -0
  8. data/app/components/vitrail/notice.html.erb +5 -5
  9. data/app/components/vitrail/notice.rb +6 -6
  10. data/app/components/vitrail/table/component.html.erb +15 -0
  11. data/app/components/vitrail/table/component.rb +10 -0
  12. data/app/components/vitrail/table/division.html.erb +1 -1
  13. data/app/components/vitrail/table/division.rb +3 -3
  14. data/app/components/vitrail/table/header.rb +3 -3
  15. data/app/components/vitrail/table/row.rb +2 -2
  16. data/app/components/vitrail/title/component.rb +34 -0
  17. data/lib/generators/vitrail/install/install_generator.rb +50 -0
  18. data/lib/generators/vitrail/install/templates/stylesheets/vitrail/button_tag.css.tt +36 -0
  19. data/lib/generators/vitrail/install/templates/stylesheets/vitrail/card.css.tt +20 -0
  20. data/lib/generators/vitrail/install/templates/stylesheets/vitrail/config.css.tt +23 -0
  21. data/lib/generators/vitrail/install/templates/stylesheets/vitrail/index.css.tt +8 -0
  22. data/lib/generators/vitrail/install/templates/stylesheets/vitrail/link_to.css.tt +36 -0
  23. data/lib/generators/vitrail/install/templates/stylesheets/vitrail/primitives.css.tt +24 -0
  24. data/lib/generators/vitrail/install/templates/stylesheets/vitrail/table.css.tt +37 -0
  25. data/lib/generators/vitrail/install/templates/stylesheets/vitrail/title.css.tt +21 -0
  26. data/lib/generators/vitrail/install/templates/vitrail_preset.js.tt +41 -0
  27. data/lib/vitrail/engine.rb +18 -2
  28. data/lib/vitrail/helper.rb +9 -0
  29. data/lib/vitrail/tasks/install.rake +8 -0
  30. data/lib/vitrail/version.rb +1 -1
  31. data/lib/vitrail.rb +2 -0
  32. metadata +25 -19
  33. data/Rakefile +0 -8
  34. data/app/assets/config/vitrail_manifest.js +0 -1
  35. data/app/assets/stylesheets/vitrail/application.css +0 -15
  36. data/app/assets/stylesheets/vitrail/vitrail.css +0 -891
  37. data/app/assets/stylesheets/vitrail.tailwind.css +0 -13
  38. data/app/components/vitrail/card.html.erb +0 -12
  39. data/app/components/vitrail/card.rb +0 -18
  40. data/app/components/vitrail/link_to.rb +0 -40
  41. data/app/components/vitrail/table.html.erb +0 -19
  42. data/app/components/vitrail/table.rb +0 -10
  43. data/app/components/vitrail/title.rb +0 -29
  44. data/app/views/layouts/vitrail/component_preview.html.erb +0 -16
  45. data/config/tailwind.config.js +0 -22
@@ -1,13 +0,0 @@
1
- @tailwind base;
2
- @tailwind components;
3
- @tailwind utilities;
4
-
5
- /*
6
-
7
- @layer components {
8
- .btn-primary {
9
- @apply py-2 px-4 bg-blue-200;
10
- }
11
- }
12
-
13
- */
@@ -1,12 +0,0 @@
1
- <div class="<%= html_classes %>" <%= html_attributes %>>
2
- <% if header? %>
3
- <header>
4
- <div class="flex justify-between items-center mb-2">
5
- <h3 class="truncate text-sm font-medium text-slate-500">
6
- <%= title %>
7
- </h3>
8
- <i class="fa-light text-slate-600 ml-2 fa-<%= icon %>" aria-hidden="true"></i>
9
- </header>
10
- <% end %>
11
- <%= content %>
12
- </div>
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Vitrail
4
- class Card < BaseComponent
5
- LOCAL_CLASSES = "border border-slate-200 rounded px-4 py-2 bg-white shadow-sm"
6
-
7
- private attr_reader :title, :icon
8
-
9
- def initialize(title: nil, icon: nil, **html_options)
10
- super(**html_options)
11
- @title = title
12
- @icon = icon
13
- end
14
-
15
- def local_classes = LOCAL_CLASSES
16
- def header? = title || icon
17
- end
18
- end
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Vitrail
4
- class LinkTo < ViewComponent::Base
5
- def initialize(level, options = nil, html_options = nil)
6
- @level = level
7
- @options = options
8
- @html_options = html_options || {}
9
- end
10
-
11
- def call = link_to(options, decorated_html_options) { content }
12
-
13
- private
14
-
15
- attr_reader :level, :options, :html_options
16
-
17
- GLOBAL_CLASSES = "font-semibold px-3 py-2".freeze
18
- private_constant :GLOBAL_CLASSES
19
-
20
- LEVEL_CLASSES = {
21
- primary: <<~TXT.squish,
22
- text-indigo-600 hover:text-indigo-500
23
- focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2
24
- focus-visible:outline-indigo-600
25
- TXT
26
- secondary: <<~TXT.squish,
27
- text-slate-700 hover:text-slate-80
28
- underline decoration-dashed underline-offset-4 decoration-slate-500
29
- TXT
30
- }.freeze
31
- private_constant :LEVEL_CLASSES
32
- def level_classes
33
- LEVEL_CLASSES[level.to_sym]
34
- end
35
-
36
- def decorated_html_options
37
- html_options&.merge(class: [GLOBAL_CLASSES, level_classes].join(" "))
38
- end
39
- end
40
- end
@@ -1,19 +0,0 @@
1
- <div class="flow-root" <%= html_attributes %>>
2
- <div class="<%= html_classes %>">
3
- <div class="inline-block min-w-full align-middle">
4
- <table class="table-auto min-w-full divide-y divide-gray-300">
5
- <thead class="sticky top-0 bg-white">
6
- <tr>
7
- <% headers.each do |header| %>
8
- <%= header %>
9
- <% end %>
10
- </tr>
11
- <tbody class="divide-y divide-gray-200">
12
- <% rows.each do |row| %>
13
- <%= row %>
14
- <% end %>
15
- </tbody>
16
- </table>
17
- </div>
18
- </div>
19
- </div>
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Vitrail
4
- class Table < BaseComponent
5
- renders_many :headers, Table::Header
6
- renders_many :rows, Table::Row
7
-
8
- def local_classes = "overflow-x-auto"
9
- end
10
- end
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Vitrail
4
- class Title < BaseComponent
5
- erb_template <<~ERB.squish
6
- <h<%= level %> class="<%= html_classes %>" <%= html_attributes %>>
7
- <%= content %>
8
- </h<%= level %>>
9
- ERB
10
-
11
- LEVEL_CLASSES = {
12
- 1 => "mt-10 mb-4 text-2xl xl:text-3xl font-bold tracking-tight text-slate-900",
13
- 2 => "mt-8 mb-2 text-xl xl:text-2xl font-bold tracking-tight text-slate-900",
14
- 3 => "mt-4 mb-1 xl:text-lg font-semibold tracking-tight text-slate-800"
15
- }.freeze
16
- private_constant :LEVEL_CLASSES
17
-
18
- private attr_reader :level
19
-
20
- def initialize(level: 1, **html_options)
21
- super(**html_options)
22
- @level = level
23
- end
24
-
25
- private
26
-
27
- def local_classes = LEVEL_CLASSES[level]
28
- end
29
- end
@@ -1,16 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Vitrail</title>
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <%= csrf_meta_tags %>
7
- <%= csp_meta_tag %>
8
-
9
- <%= stylesheet_link_tag "tailwind", "inter-font", "data-turbo-track": "reload" %>
10
- <%= stylesheet_link_tag "vitrail/application" %>
11
- <script src="https://kit.fontawesome.com/910f22a437.js" crossorigin="anonymous"></script>
12
- </head>
13
- <body class="px-8 py-4 margin-x-auto">
14
- <%= yield %>
15
- </body>
16
- </html>
@@ -1,22 +0,0 @@
1
- const defaultTheme = require('tailwindcss/defaultTheme')
2
-
3
- module.exports = {
4
- content: [
5
- './app/views/**/*.{erb,html,slim}',
6
- './app/components/**/*.{erb,html,slim}',
7
- './test/components/previews/**/*.{rb,erb,html,slim}'
8
- ],
9
- theme: {
10
- extend: {
11
- fontFamily: {
12
- sans: ['Inter var', ...defaultTheme.fontFamily.sans],
13
- },
14
- },
15
- },
16
- plugins: [
17
- require('@tailwindcss/forms'),
18
- require('@tailwindcss/aspect-ratio'),
19
- require('@tailwindcss/typography'),
20
- require('@tailwindcss/container-queries'),
21
- ]
22
- }