railsui 3.2.7 → 3.3.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 (69) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +8 -1
  3. data/README.md +196 -42
  4. data/app/assets/javascripts/railsui-controllers.js +12 -0
  5. data/app/controllers/railsui/configurations_controller.rb +11 -2
  6. data/app/helpers/railsui/application_helper.rb +12 -0
  7. data/app/javascript/controllers/index.js +3 -31
  8. data/app/javascript/controllers/railsui_anchor_controller.js +4 -3
  9. data/app/javascript/controllers/railsui_auto_expand_text_area_controller.js +1 -1
  10. data/app/javascript/controllers/railsui_canvas_controller.js +1 -1
  11. data/app/javascript/controllers/railsui_code_controller.js +3 -28
  12. data/app/javascript/controllers/railsui_color_controller.js +1 -1
  13. data/app/javascript/controllers/railsui_configuration_controller.js +1 -1
  14. data/app/javascript/controllers/railsui_dialog_controller.js +1 -1
  15. data/app/javascript/controllers/railsui_flash_controller.js +1 -1
  16. data/app/javascript/controllers/railsui_helper_controller.js +1 -1
  17. data/app/javascript/controllers/railsui_loading_controller.js +1 -1
  18. data/app/javascript/controllers/railsui_modal_controller.js +4 -3
  19. data/app/javascript/controllers/railsui_nav_controller.js +4 -3
  20. data/app/javascript/controllers/railsui_pages_controller.js +1 -1
  21. data/app/javascript/controllers/railsui_prevent_controller.js +1 -1
  22. data/app/javascript/controllers/railsui_scroll_controller.js +1 -1
  23. data/app/javascript/controllers/railsui_scroll_spy_controller.js +1 -1
  24. data/app/javascript/controllers/railsui_search_controller.js +1 -1
  25. data/app/javascript/controllers/railsui_smooth_controller.js +1 -1
  26. data/app/javascript/controllers/railsui_snippet_controller.js +1 -1
  27. data/app/views/layouts/railsui/application.html.erb +7 -5
  28. data/app/views/layouts/railsui/fullwidth.html.erb +4 -4
  29. data/app/views/layouts/railsui/landing.html.erb +3 -4
  30. data/app/views/layouts/railsui/routes.html.erb +4 -3
  31. data/app/views/railsui/admin/_form.html.erb +18 -1
  32. data/app/views/railsui/admin/fields/_theme.html.erb +0 -1
  33. data/app/views/railsui/shared/_cdn_dependencies.html.erb +121 -0
  34. data/app/views/railsui/shared/_inline_controllers.html.erb +498 -0
  35. data/app/views/railsui/shared/_snippet.html.erb +23 -1
  36. data/app/views/railsui/themes/hound/forms/_input_group.html.erb +3 -1
  37. data/app/views/railsui/themes/shepherd/authentication/devise/_overview.html.erb +30 -28
  38. data/app/views/railsui/themes/shepherd/authentication/static/_overview.html.erb +8 -8
  39. data/app/views/railsui/themes/shepherd/content/typography/_headings.html.erb +23 -21
  40. data/app/views/railsui/themes/shepherd/forms/_input.html.erb +1 -1
  41. data/guides/CONFIGURATION.md +199 -0
  42. data/guides/MIGRATION_GUIDE.md +220 -0
  43. data/lib/generators/railsui/install/install_generator.rb +124 -38
  44. data/lib/generators/railsui/install/templates/Procfile.dev.build +1 -0
  45. data/lib/generators/railsui/install/templates/Procfile.dev.nobuild +2 -0
  46. data/lib/generators/railsui/install/templates/bin/dev +21 -0
  47. data/lib/generators/railsui/install/templates/themes/corgie/stylesheets/railsui/actiontext.css +0 -1
  48. data/lib/generators/railsui/install/templates/themes/corgie/views/layouts/rui/railsui.html.erb +7 -2
  49. data/lib/generators/railsui/install/templates/themes/corgie/views/layouts/rui/railsui_admin.html.erb +7 -2
  50. data/lib/generators/railsui/install/templates/themes/corgie/views/layouts/rui/railsui_auth.html.erb +6 -2
  51. data/lib/generators/railsui/install/templates/themes/corgie/views/rui/pages/{privacy.html.erb → privacy_policy.html.erb} +1 -1
  52. data/lib/generators/railsui/install/templates/themes/corgie/views/rui/pages/terms.html.erb +2 -2
  53. data/lib/generators/railsui/install/templates/themes/corgie/views/rui/shared/sidebar/_link.html.erb +4 -4
  54. data/lib/generators/railsui/install/templates/themes/hound/stylesheets/railsui/actiontext.css +0 -1
  55. data/lib/generators/railsui/install/templates/themes/hound/views/layouts/rui/railsui.html.erb +6 -2
  56. data/lib/generators/railsui/install/templates/themes/hound/views/layouts/rui/railsui_admin.html.erb +6 -2
  57. data/lib/generators/railsui/install/templates/themes/shepherd/stylesheets/railsui/actiontext.css +0 -1
  58. data/lib/generators/railsui/install/templates/themes/shepherd/views/layouts/rui/railsui.html.erb +6 -2
  59. data/lib/generators/railsui/install/templates/themes/shepherd/views/layouts/rui/railsui_admin.html.erb +6 -2
  60. data/lib/generators/railsui/update/update_generator.rb +40 -4
  61. data/lib/railsui/configuration.rb +116 -15
  62. data/lib/railsui/engine.rb +15 -0
  63. data/lib/railsui/theme_setup.rb +598 -38
  64. data/lib/railsui/version.rb +1 -1
  65. data/lib/railsui.rb +10 -7
  66. data/lib/tasks/install.rake +9 -3
  67. data/lib/tasks/migrate.rake +219 -0
  68. metadata +26 -4
  69. data/.claude/settings.local.json +0 -10
@@ -1,6 +1,6 @@
1
1
  import { Controller } from "@hotwired/stimulus"
2
2
 
3
- export default class extends Controller {
3
+ export default class extends Stimulus.Controller {
4
4
  scroll(event) {
5
5
  event.preventDefault()
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { Controller } from "@hotwired/stimulus"
2
2
 
3
- export default class extends Controller {
3
+ export default class extends Stimulus.Controller {
4
4
  static targets = ["preview", "previewBtn", "code", "codeBtn"]
5
5
 
6
6
  ACTIVE_CLASSES = [
@@ -14,12 +14,14 @@
14
14
  <meta name="viewport" content="width=device-width, initial-scale=1">
15
15
 
16
16
  <%= favicon_link_tag "favicon.svg" %>
17
- <%= javascript_include_tag "railsui/application" %>
18
- <%= javascript_include_tag "https://unpkg.com/alpinejs@3.10.3/dist/cdn.min.js", defer: true %>
19
17
 
20
- <%= stylesheet_link_tag "application", "railsui/railsui" %>
18
+ <%= render "railsui/shared/cdn_dependencies" %>
21
19
 
22
- <link rel="stylesheet" href="https://unpkg.com/tippy.js@6/dist/tippy.css" />
20
+ <%= stylesheet_link_tag "railsui/application" %>
21
+
22
+ <% if main_app_asset_exists?("tailwind") %>
23
+ <%= stylesheet_link_tag "tailwind" %>
24
+ <% end %>
23
25
 
24
26
  <link rel="preconnect" href="https://fonts.googleapis.com">
25
27
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
@@ -30,7 +32,7 @@
30
32
  <% end %>
31
33
 
32
34
  <%= yield :head %>
33
- </head>
35
+ </head>
34
36
 
35
37
  <body class="relative antialiased font-normal leading-normal railsui text-neutral-800 lg:h-screen selection:bg-neutral-300/20 selection:text-neutral-900 dark:selection:text-white dark:bg-neutral-900 dark:text-neutral-50" data-controller="railsui-toggle railsui-scroll railsui-smooth railsui-scroll-spy" data-railsui-scroll-spy-active-class-value="text-neutral-900 hover:text-neutral-950 dark:hover:text-neutral-200 dark:text-white dark:hover:text-white truncate"
36
38
  data-railsui-scroll-spy-inactive-class-value="text-neutral-500 hover:text-neutral-900 dark:text-neutral-400 dark:hover:text-white truncate">
@@ -14,10 +14,10 @@
14
14
  <meta name="viewport" content="width=device-width, initial-scale=1">
15
15
 
16
16
  <%= favicon_link_tag "favicon.svg" %>
17
- <%= javascript_include_tag "railsui/application" %>
18
- <%= javascript_include_tag "https://unpkg.com/alpinejs@3.10.3/dist/cdn.min.js", defer: true %>
19
17
 
20
- <%= stylesheet_link_tag "railsui/railsui", "application" %>
18
+ <%= render "railsui/shared/cdn_dependencies" %>
19
+
20
+ <%= stylesheet_link_tag "railsui/railsui", "tailwind" %>
21
21
 
22
22
  <link rel="preconnect" href="https://fonts.googleapis.com">
23
23
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
@@ -31,7 +31,7 @@
31
31
  <%= yield :head %>
32
32
  </head>
33
33
 
34
- <body class="relative antialiased font-normal leading-normal railsui text-neutral-800 lg:h-screen selection:bg-neutral-800/80 selection:text-neutral-100 dark:bg-neutral-900 dark:text-neutral-50" data-controller="railsui-toggle railsui-scroll railsui-smooth railsui-scroll-spy">
34
+ <body class="relative antialiased font-normal leading-normal railsui text-neutral-800 lg:h-screen selection:bg-neutral-800/80 selection:text-neutral-100 dark:bg-neutral-900 dark:text-neutral-50" data-controller="railsui-toggle railsui-scroll railsui-smooth railsui-scroll-spy railsui-code">
35
35
  <div class="flex md:flex-row flex-col items-start justify-between md:h-[calc(100vh-2px)] overflow-x-clip relative">
36
36
 
37
37
  <%= image_tag "blur.png", class: "absolute -top-[500px] -right-[500px] opacity-[0.09] dark:opacity-20 z-0" %>
@@ -14,11 +14,10 @@
14
14
  <meta name="viewport" content="width=device-width, initial-scale=1">
15
15
 
16
16
  <%= favicon_link_tag "favicon.svg" %>
17
- <%= javascript_include_tag "railsui/application" %>
18
- <%= javascript_include_tag "https://unpkg.com/alpinejs@3.10.3/dist/cdn.min.js", defer: true %>
19
17
 
20
- <%= stylesheet_link_tag "railsui/application" %>
21
- <%= stylesheet_link_tag "application" %>
18
+ <%= render "railsui/shared/cdn_dependencies" %>
19
+
20
+ <%= stylesheet_link_tag "railsui/application", "tailwind" %>
22
21
 
23
22
  <link rel="preconnect" href="https://fonts.googleapis.com">
24
23
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
@@ -14,9 +14,10 @@
14
14
  <meta name="viewport" content="width=device-width, initial-scale=1">
15
15
 
16
16
  <%= favicon_link_tag "favicon.svg" %>
17
- <%= javascript_include_tag "railsui/application" %>
18
- <%= javascript_include_tag "https://unpkg.com/alpinejs@3.10.3/dist/cdn.min.js", defer: true %>
19
- <%= stylesheet_link_tag "railsui/application", "application" %>
17
+
18
+ <%= render "railsui/shared/cdn_dependencies" %>
19
+
20
+ <%= stylesheet_link_tag "railsui/application", "tailwind" %>
20
21
 
21
22
  <link rel="preconnect" href="https://fonts.googleapis.com">
22
23
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
@@ -1,5 +1,22 @@
1
1
  <div class="pb-8">
2
- <%= heading text: "Configuration", id: "configuration", tag: "h1", class: "lg:text-3xl text-2xl text-neutral-800 font-bold dark:text-white mb-2 tracking-tight" %>
2
+ <div class="flex items-center gap-3 mb-2">
3
+ <%= heading text: "Configuration", id: "configuration", tag: "h1", class: "lg:text-3xl text-2xl text-neutral-800 font-bold dark:text-white tracking-tight" %>
4
+ <% if @config.build_mode == "nobuild" %>
5
+ <span class="inline-flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-full bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300">
6
+ <svg class="w-3 h-3" fill="currentColor" viewBox="0 0 20 20">
7
+ <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
8
+ </svg>
9
+ No-Build Mode
10
+ </span>
11
+ <% else %>
12
+ <span class="inline-flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-full bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300">
13
+ <svg class="w-3 h-3" fill="currentColor" viewBox="0 0 20 20">
14
+ <path d="M3 4a1 1 0 011-1h12a1 1 0 011 1v2a1 1 0 01-1 1H4a1 1 0 01-1-1V4zM3 10a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H4a1 1 0 01-1-1v-6zM14 9a1 1 0 00-1 1v6a1 1 0 001 1h2a1 1 0 001-1v-6a1 1 0 00-1-1h-2z"/>
15
+ </svg>
16
+ Build Mode
17
+ </span>
18
+ <% end %>
19
+ </div>
3
20
  <div class="prose dark:prose-invert prose-neutral max-w-full prose-lg mb-6">
4
21
  <p>Choose a theme, customize colors or stick with the defaults and go build. 🚀</p>
5
22
  </div>
@@ -67,7 +67,6 @@
67
67
 
68
68
  <p>Refer to <%= link_to "railsui.com/themes", "https://railsui.com/themes", target: :_blank %> for a good reference for Rails UI themes and their intended use case. We're always working on adding more.</p>
69
69
  </div>
70
-
71
70
  </details>
72
71
 
73
72
  <details class="group py-4">
@@ -0,0 +1,121 @@
1
+ <!-- Stylesheets -->
2
+ <link rel="stylesheet" href="https://unpkg.com/tippy.js@6/dist/tippy.css" />
3
+ <link rel="stylesheet" href="https://unpkg.com/@highlightjs/cdn-assets@11.9.0/styles/atom-one-dark.min.css" />
4
+ <style>
5
+ /* Custom styles for ERB/HAML code blocks using Ruby syntax */
6
+ .railsui .language-erb .hljs-comment,
7
+ .railsui .language-haml .hljs-comment {
8
+ color: #637777 !important;
9
+ font-style: italic;
10
+ }
11
+ /* Style HTML-like tags in ERB when they're not highlighted */
12
+ .railsui .language-erb code,
13
+ .railsui .language-haml code {
14
+ /* Ensure base text is visible */
15
+ color: #f5f5f5;
16
+ }
17
+
18
+ /* Ensure highlight.js styles aren't overridden */
19
+ .hljs {
20
+ background: transparent !important;
21
+ color: #abb2bf !important;
22
+ }
23
+
24
+ /* CSS syntax highlighting colors */
25
+ .language-css .hljs-attribute {
26
+ color: #e06c75 !important;
27
+ }
28
+ .language-css .hljs-number,
29
+ .language-css .hljs-literal {
30
+ color: #d19a66 !important;
31
+ }
32
+ .language-css .hljs-selector-class,
33
+ .language-css .hljs-selector-tag {
34
+ color: #e5c07b !important;
35
+ }
36
+ .language-css .hljs-built_in,
37
+ .language-css .hljs-title {
38
+ color: #61afef !important;
39
+ }
40
+ .language-css .hljs-comment {
41
+ color: #5c6370 !important;
42
+ font-style: italic;
43
+ }
44
+ .language-css .hljs-string {
45
+ color: #98c379 !important;
46
+ }
47
+ </style>
48
+
49
+ <!-- Import map for ES modules (required for railsui-stimulus package) -->
50
+ <script type="importmap">
51
+ {
52
+ "imports": {
53
+ "@hotwired/stimulus": "https://unpkg.com/@hotwired/stimulus@3.2.2/dist/stimulus.js",
54
+ "tippy.js": "https://unpkg.com/tippy.js@6.3.7/dist/tippy.esm.js"
55
+ }
56
+ }
57
+ </script>
58
+
59
+ <!-- Core Dependencies -->
60
+ <script src="https://unpkg.com/@hotwired/stimulus@3.2.2/dist/stimulus.umd.js"></script>
61
+ <script src="https://unpkg.com/stimulus-use@0.52.2/dist/index.umd.js"></script>
62
+
63
+ <!-- UI Libraries -->
64
+ <script src="https://unpkg.com/@popperjs/core@2.11.8/dist/umd/popper.min.js"></script>
65
+ <script src="https://unpkg.com/tippy.js@6.3.7/dist/tippy-bundle.umd.min.js"></script>
66
+ <%= javascript_include_tag "https://unpkg.com/alpinejs@3.10.3/dist/cdn.min.js", defer: true %>
67
+
68
+ <!-- Syntax Highlighting -->
69
+ <script src="https://unpkg.com/@highlightjs/cdn-assets@11.9.0/highlight.min.js"></script>
70
+ <script src="https://unpkg.com/@highlightjs/cdn-assets@11.9.0/languages/ruby.min.js"></script>
71
+ <script src="https://unpkg.com/@highlightjs/cdn-assets@11.9.0/languages/javascript.min.js"></script>
72
+ <script src="https://unpkg.com/@highlightjs/cdn-assets@11.9.0/languages/bash.min.js"></script>
73
+ <script src="https://unpkg.com/@highlightjs/cdn-assets@11.9.0/languages/css.min.js"></script>
74
+ <script src="https://unpkg.com/@highlightjs/cdn-assets@11.9.0/languages/xml.min.js"></script>
75
+ <script>
76
+ // Ensure hljs is available globally
77
+ window.hljs = window.hljs || hljs;
78
+
79
+ // Register ERB as an alias for Ruby (better syntax highlighting for embedded Ruby)
80
+ // Register HAML as an alias for Ruby as well
81
+ if (window.hljs) {
82
+ hljs.registerAliases(['erb'], {languageName: 'ruby'})
83
+ hljs.registerAliases(['haml'], {languageName: 'ruby'})
84
+
85
+ // Highlight all code blocks on page load
86
+ document.addEventListener('DOMContentLoaded', function() {
87
+ hljs.highlightAll();
88
+ });
89
+
90
+ // Also run immediately in case DOMContentLoaded already fired
91
+ if (document.readyState === 'loading') {
92
+ // Still loading, wait for DOMContentLoaded
93
+ } else {
94
+ // DOM already loaded, run now
95
+ hljs.highlightAll();
96
+ }
97
+ }
98
+ </script>
99
+
100
+ <!-- Initialize Stimulus and register controllers -->
101
+ <script>
102
+ (function() {
103
+ // Capture Stimulus globals before reassigning
104
+ const StimulusController = Stimulus.Controller
105
+ const StimulusApplication = Stimulus.Application
106
+
107
+ const application = StimulusApplication.start()
108
+
109
+ // Expose both application and Controller base class
110
+ window.Stimulus = {
111
+ application: application,
112
+ Controller: StimulusController,
113
+ Application: StimulusApplication
114
+ }
115
+
116
+ const hljs = window.hljs
117
+ const { useTransition, useClickOutside } = window.StimulusUse || {}
118
+
119
+ <%= render partial: "railsui/shared/inline_controllers" %>;
120
+ })()
121
+ </script>