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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 41e57280d576fef1b03e0eaddf9d4fac505a023b8e1ec3f476dbfdc88bd9d870
4
- data.tar.gz: 9d82a32392538a9ed853a1fb747debe50634113285bb13b809606c379c0f135b
3
+ metadata.gz: 1bb7678277542f5768bfb43e48f033b00b7de92ae4c508a04b026ab962822c13
4
+ data.tar.gz: b1a78f138f8db6883895d6db010066f47c0bfb2a0601205549ef90087a56749d
5
5
  SHA512:
6
- metadata.gz: 7e56b1cefaa018e136a609f6a03290315e40a33e6317c4aeaeaa0bb40d11bad781cfae549cd4a8d90c4fcaffb430b6b19b3c16accae2d3b5767aa05bb203452c
7
- data.tar.gz: 80eb9204d77e22133590320a760141a9df2cf0067a80639071e514c7f1909372f497df060e0bd7bfb82c918d1df7a4e72fe2745677952662657cb741822ed646
6
+ metadata.gz: 4f230aced332a51e53fe127baa1271e2b27cab8a627f6563a3e4794b69bfdbf9df965b5e22b9417684b1fa1586a392621de6fb9ba2d43940e5c9d34849599c2b
7
+ data.tar.gz: df4d529d5d271d9a83737b3d3ac824a8408d5ed614c2cabeb9c831cabe168bdaa07f54c51bd76c945bc9f85a9161a07bbeb46403e5766727a401c801dd67d35d
data/Gemfile.lock CHANGED
@@ -1,11 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- railsui (3.2.7)
4
+ railsui (3.3.0)
5
5
  meta-tags
6
6
  psych
7
7
  rails (>= 7.0)
8
8
  railsui_icon
9
+ tailwindcss-rails (>= 2.0)
9
10
 
10
11
  GEM
11
12
  remote: https://rubygems.org/
@@ -222,6 +223,12 @@ GEM
222
223
  stimulus-rails (1.3.4)
223
224
  railties (>= 6.0.0)
224
225
  stringio (3.1.1)
226
+ tailwindcss-rails (4.3.0)
227
+ railties (>= 7.0.0)
228
+ tailwindcss-ruby (~> 4.0)
229
+ tailwindcss-ruby (4.1.13-arm64-darwin)
230
+ tailwindcss-ruby (4.1.13-x86_64-darwin)
231
+ tailwindcss-ruby (4.1.13-x86_64-linux-gnu)
225
232
  thor (1.3.2)
226
233
  timeout (0.4.1)
227
234
  tzinfo (2.0.6)
data/README.md CHANGED
@@ -6,92 +6,206 @@ Professionally designed themes and components for Ruby on Rails. Leverage breath
6
6
 
7
7
  ### Links
8
8
 
9
- - [Website](https://railsui.com)
10
- - [Documentation](https://railsui.com/docs)
11
- - [FAQs](https://railsui.com/docs/faqs)
9
+ - [Installation](#installation)
10
+ - [Configuration](guides/CONFIGURATION.md)
11
+ - [Migration guide](guides/MIGRATION_GUIDE.md)
12
+ - [Extended documentation](https://railsui.com/docs)
13
+ - [FAQs](#frequently-asked-questions)
12
14
  - [Discussions](https://github.com/getrailsui/railsui/discussions)
13
- - [Updates](https://railsui.com/updates)
15
+ - [Updates](https://railsui.com/blog)
16
+ - [Website](https://railsui.com)
14
17
  - [Follow on X](https://x.com/railsui_)
15
18
  - [Migrating from v2](https://railsui.com/docs/updates)
16
19
 
17
20
  ## Installation
18
21
 
19
- You must already have node and yarn installed on your system. You will also need npx version 7.1.0 or later. A solid understanding of Tailwind CSS will go far.
22
+ Rails UI v3.3+ now works with **both importmap (nobuild) and JS bundler (build) setups**. It uses the `tailwindcss-rails` gem for CSS in both modes so no separate Tailwind installation needed.
23
+
24
+ ### Requirements
25
+
26
+ - **Rails**: 7.0 or higher
27
+ - **CSS**: ✅ Automatically handled via `tailwindcss-rails` gem (included)
28
+ - **JS (build mode)**: Node.js, package manager (yarn/npm/pnpm/bun), and jsbundling-rails
29
+ - **JS (nobuild mode)**: Nothing extra needed!
30
+
31
+ ### Intalling Rails UI on new applications
32
+
33
+ #### With importmaps (nobuild) - default
34
+
35
+ ```bash
36
+ # Create app (Rails 8 defaults to importmap)
37
+ rails new myapp
38
+ cd myapp
39
+
40
+ # Install Rails UI
41
+ bundle add railsui
42
+ rails railsui:install
43
+
44
+ # Start server
45
+ bin/dev
46
+ ```
20
47
 
21
- ### New applications
48
+ **When to use:** Zero build step, no Node.js required, fast refresh.
22
49
 
23
- The easiest install is on new Rails apps with options passed like so. For new apps, use the `-c tailwind` flag to install it.
50
+ #### With JS Bundler (build mode)
24
51
 
25
52
  ```bash
26
- rails new app_name -c tailwind -j esbuild
53
+ # Create app with JS bundler
54
+ rails new myapp -j [bun|esbuild|rollup|webpack]
55
+ cd myapp
56
+
57
+ # Install Rails UI with --build flag
58
+ bundle add railsui
59
+ rails railsui:install --build
60
+
61
+ # Start server
62
+ bin/dev
27
63
  ```
28
64
 
29
- It's recommended to use the `-j` flag to one of the bundling solutions from the [`jsbundling-rails`](https://github.com/rails/jsbundling-rails) gem (bun, esbuild rollup, webpack) for max compatibility.
65
+ **When to use:** TypeScript, advanced JS tooling, or complex dependencies.
30
66
 
31
- Support for [importmaps](https://github.com/rails/importmap-rails) or [propshaft](https://github.com/rails/propshaft) is not available at this time.
67
+ **Note:** When you run `rails new myapp -j esbuild` (or other bundler), you may see build errors about missing packages. This is expected - the initial build runs before dependencies are installed. These errors are harmless and will be resolved when Rails UI installs the required packages.
32
68
 
33
- ### Existing applications
69
+ > [!IMPORTANT]
70
+ > Don't use `-c tailwind` when creating your app like in previous versions of the gem - Rails UI handles Tailwind CSS automatically now using the tailwindcss-rails gem.
34
71
 
35
- #### CSS
36
72
 
37
- For an existing app you need to first install Tailwind if you haven't. If you are using another CSS framework, like Bootstrap, remove that first for best results.
73
+ ### Installing Rails UI on existing applications
74
+
75
+ #### Importmaps (nobuild)
38
76
 
39
77
  ```bash
40
- ./bin/bundle add cssbundling-rails
41
- ./bin/rails css:install:tailwind
78
+ bundle add railsui
79
+ rails railsui:install
42
80
  ```
43
81
 
44
- Note: There are several ways to approach adding Tailwind CSS support. We find the easiest way is using [cssbundling-rails](https://github.com/rails/cssbundling-rails) gem for max control. If you were to scaffold a new rails application, this gem is the one used when passing `-c` or `-css`.
82
+ #### Apps with a JS Bundler (esbuild, webpack, bun, rollup)
45
83
 
46
- Adding Tailwind CSS to an existing app _may_ result in CSS class name conflicts. We've done our best to make it integrate with your existing setup but there's always a chance.
47
-
48
- #### JavaScript
84
+ ```bash
85
+ bundle add railsui
86
+ rails railsui:install --build
87
+ ```
49
88
 
50
- Rails UI works best combined with the [jsbundling-rails](https://github.com/rails/jsbundling-rails) gem.
89
+ #### Apps without any JavaScript setup
51
90
 
52
- When ready, install jsbundling-rails using the gem and the installer task. Choose the build tool you prefer.
91
+ **Importmap:**
92
+ ```bash
93
+ bundle add railsui
94
+ rails railsui:install
95
+ ```
53
96
 
97
+ **JS Bundler:**
54
98
  ```bash
55
- ./bin/bundle add jsbundling-rails
56
- ./bin/rails javascript:install:[bun|esbuild|rollup|webpack]
99
+ # First install jsbundling-rails
100
+ bundle add jsbundling-rails
101
+ rails javascript:install:[bun|esbuild|rollup|webpack]
102
+ # Note: You may see build errors - this is expected and harmless
103
+
104
+ # Then install Rails UI
105
+ bundle add railsui
106
+ rails railsui:install --build
57
107
  ```
58
108
 
59
- Most of the JavaScript used in Rails UI is based on Stimulus.js. This code can likely work fine alongside something like importmaps or propshaft but we have not tested this theory just yet.
109
+ ### Migration scenarios
60
110
 
61
- ## Installation
111
+ If you use an older version of Rails UI or have cssbundling-rails gem configured you can move to the new version with our built in migration task.
62
112
 
63
- Add the `railsui` gem to your Gemfile.
113
+ #### Migrating from cssbundling-rails
64
114
 
65
- ```ruby
66
- # Gemfile
67
- gem "railsui"
115
+ If your app uses `cssbundling-rails` for Tailwind (installed with `rails new myapp -c tailwind`):
116
+
117
+ ```bash
118
+ # Install Rails UI first
119
+ bundle add railsui
120
+ rails railsui:install
121
+
122
+ # Then migrate to tailwindcss-rails
123
+ rails railsui:migrate_to_tailwindcss_rails
68
124
  ```
69
125
 
70
- Run the bundle install command to fetch the new gem and its assets.
126
+ This removes Tailwind from package.json and switches to the faster `tailwindcss-rails` gem.
127
+
128
+ #### Migrating from importmaps to JS Bundler
129
+
130
+ If your existing app uses importmap and you want to switch to a JS bundler for Rails UI:
71
131
 
72
132
  ```bash
73
- bundle install
133
+ # First install jsbundling-rails
134
+ bundle add jsbundling-rails
135
+ rails javascript:install:[bun|esbuild|rollup|webpack]
136
+
137
+ # Then install Rails UI with --build flag
138
+ bundle add railsui
139
+ rails railsui:install --build
74
140
  ```
75
141
 
76
- The gem includes several tasks and generators. Run the `install` task to kick things off.
142
+ > [!IMPORTANT]
143
+ > You'll need to manually migrate your existing JavaScript imports from importmap format to bundler format. Rails UI will handle its own imports, but your app's custom JavaScript may need adjustments. Consider removing `config/importmap.rb` if you're fully migrating to the bundler.
144
+
145
+ #### Switching between build modes
146
+
147
+ You can change modes after installation by editing `config/railsui.yml`:
148
+
149
+ ```yaml
150
+ build_mode: nobuild # or "build"
151
+ ```
77
152
 
78
- This task is responsible for setting the foundation for Rails UI, which includes assets, themes, theme-driven pages, and more.
153
+ Then run the appropriate setup:
154
+ `rails railsui:update`
79
155
 
80
- The default theme for Rails UI is [Hound](https://railsui.com/themes/hound). It will install when you install Rails UI. You can change it any time.
156
+ ### Installation Warnings
157
+
158
+ Rails UI detects your setup and tries to provide helpful guidance:
159
+
160
+ - ⚠️ **cssbundling-rails detected** → Suggests migration task
161
+ - ⚠️ **Missing jsbundling-rails** (with --build flag) → Shows setup instructions
162
+ - ℹ️ **Configuration conflicts** → Provides recommendations
163
+
164
+ Skip warnings: `RAILSUI_SKIP_WARNINGS=1 rails railsui:install`
165
+
166
+ ## Running Your App
167
+
168
+ After installing Rails UI, start your server:
81
169
 
82
170
  ```bash
83
- rails railsui:install
171
+ bin/dev
84
172
  ```
85
173
 
86
- After installing Rails UI, run your server using the `bin/dev` command and proceed to the configuration screen to customize your install (i.e. `localhost:3000/railsui` for new apps).
174
+ Then visit `localhost:3000/railsui` to access the configuration screen and customize your install.
175
+
176
+ ### What `bin/dev` does
177
+
178
+ - **nobuild mode**: Runs Rails server + Tailwind CSS watcher
179
+ - **build mode**: Runs Rails server + Tailwind CSS watcher + JS bundler watcher
180
+
181
+ Both modes use the same `rails tailwindcss:watch` command for CSS.
87
182
 
88
183
  ## Configuration
89
184
 
90
- Configuration is a simple process where you configure your app's details (app name, support email), and theme.
185
+ Rails UI is configured via `config/railsui.yml` or the admin UI at `/railsui`. The easiest way to configure Rails UI is to visit `localhost:3000/railsui` and follow the prompts.
91
186
 
92
- Each theme comes with different pages and are designed for different niches in mind. They reside in the `app/views/rui` directory once installed and should be treated as read-only.
187
+ ### Quick Configuration
93
188
 
94
- **Updating your configuration at anytime will overwrite the pages and theme assets so if you want to keep your changes, you'll need to copy the files to your application in another directory.**
189
+ After installation, visit `localhost:3000/railsui` to configure:
190
+ - Application name and support email
191
+ - Theme selection
192
+ - Preview enabled pages for your theme
193
+ - Preview your theme.css file found in `app/assets/stylesheets/railsui/theme.css`
194
+
195
+ ### Configuration Files
196
+
197
+ - **`config/railsui.yml`** - Main configuration
198
+ - **`app/assets/stylesheets/railsui/theme.css`** - Color palette customization and Tailwind CSS configuration.
199
+
200
+ **📚 For detailed configuration options, read the [configuration guide](CONFIGURATION.md)**
201
+
202
+ ### Important Notes
203
+
204
+ Each theme comes with pages in `app/views/rui` that are treated as read-only. Updating your configuration will overwrite these files. To customize pages, copy them to your app:
205
+
206
+ ```bash
207
+ cp app/views/rui/pages/dashboard.html.erb app/views/pages/dashboard.html.erb
208
+ ```
95
209
 
96
210
  ## Themes
97
211
 
@@ -117,7 +231,7 @@ After installing Rails UI and choosing a theme you'll find a collection of compo
117
231
 
118
232
  ### Color
119
233
 
120
- Each theme comes with a custom color palette built on top of the default Tailwind CSS v4 color palette. We've added two new colors for you to use in your app using Tailwind CSS classes called `primary` and `secondary`. You can change those colors any time in `app/assets/stylesheets/railsui/theme.css`.
234
+ Each theme comes with a custom color palette built on top of the default Tailwind CSS v4 color palette you can customize in `app/assets/stylesheets/railsui/theme.css`.
121
235
 
122
236
  ### Icons
123
237
 
@@ -145,12 +259,52 @@ gem "railsui", github: "getrailsui/railsui", branch: "v2"
145
259
 
146
260
  ### v3+
147
261
 
148
- Version 3 resides on the main branch accessbile via the main branch and/or rubygems.org.
262
+ Version 3 now resides on the main branch accessbile via the main branch and/or rubygems.org.
149
263
 
150
264
  ```ruby
151
265
  gem "railsui"
152
266
  ```
153
267
 
268
+ ---
269
+
154
270
  ## Frequently Asked Questions
155
271
 
156
- [Read FAQs here](https://railsui.com/docs/faqs).
272
+ ### Which build mode should I choose?
273
+
274
+ **nobuild mode**: Perfect for simpler apps, prototypes, or if you want zero build complexity. JavaScript loads from CDN via importmap.
275
+
276
+ **build mode**: Best for production apps with complex JavaScript needs, TypeScript, or when you need full control over bundling.
277
+
278
+ Both modes are equally capable - choose based on your JavaScript requirements.
279
+
280
+ ### Can I switch modes later?
281
+
282
+ Yes! Update `config/railsui.yml` and regenerate assets:
283
+
284
+ ```bash
285
+ # Edit config/railsui.yml: build_mode: nobuild (or build)
286
+ build_mode: [nobuild, build]
287
+
288
+ # run this command to update assets
289
+ rails generate railsui:update
290
+ ```
291
+
292
+ For more scenarios see the [migration guide](guides/MIGRATION_GUIDE.md) for instructions.
293
+
294
+ ### Do I need Node.js?
295
+
296
+ - **nobuild mode**: No Node.js required ✅
297
+ - **build mode**: Yes, Node.js and a package manager (yarn/npm/pnpm/bun) required
298
+
299
+ ### Where are the CSS files located?
300
+
301
+ Rails UI uses tailwindcss-rails v4 defaults:
302
+ - **Input files**: [`app/assets/tailwind/application.css`, `app/assets/stylesheets/railsui/*.css`]
303
+ - **Output file**: `app/assets/builds/tailwind.css`
304
+ - **In layouts**: `stylesheet_link_tag "tailwind"`
305
+
306
+ Both build and nobuild modes use the same CSS paths. The only difference between modes is JavaScript handling (importmap vs bundler).
307
+
308
+ ### More Questions?
309
+
310
+ [Read the more FAQs](https://railsui.com/docs/faqs) or [submit an issue](https://github.com/getrailsui/railsui/issues).
@@ -0,0 +1,12 @@
1
+ // Rails UI Inline Controllers
2
+ // This file registers all Rails UI Stimulus controllers inline for CDN usage
3
+
4
+ (function() {
5
+ const application = Stimulus.Application.start()
6
+ window.Stimulus = application
7
+
8
+ const hljs = window.hljs
9
+ const { useTransition, useClickOutside } = window.StimulusUse || {}
10
+
11
+ // <%= File.read(Rails.root.join('app/javascript/controllers/index.js')) %>
12
+ })()
@@ -4,14 +4,22 @@ module Railsui
4
4
  class ConfigurationsController < ApplicationController
5
5
  def create
6
6
  config_params = configuration_params.to_h
7
+ previous_build_mode = Railsui::Configuration.load!.build_mode
7
8
 
8
9
  Railsui::Configuration.update(config_params)
9
- Railsui.bundle
10
+
11
+ # Handle build mode changes
12
+ if config_params[:build_mode] && config_params[:build_mode] != previous_build_mode
13
+ # Build mode changed - regenerate assets appropriately
14
+ system("bin/rails generate railsui:update")
15
+ end
16
+
10
17
  Railsui.build_css
11
18
  sleep 1
12
19
  Railsui.restart
13
20
 
14
- redirect_to root_path(update: true), notice: " App configuration updated successfully"
21
+ build_mode_msg = config_params[:build_mode] ? " (#{config_params[:build_mode]} mode)" : ""
22
+ redirect_to root_path(update: true), notice: "✅ App configuration updated successfully#{build_mode_msg}"
15
23
  end
16
24
 
17
25
  private
@@ -23,6 +31,7 @@ module Railsui
23
31
  :support_email,
24
32
  :theme,
25
33
  :body_classes,
34
+ :build_mode,
26
35
  pages: []
27
36
  )
28
37
  end
@@ -270,5 +270,17 @@ module Railsui
270
270
  end
271
271
  end
272
272
 
273
+ def main_app_asset_exists?(asset_name)
274
+ # Check if the host app has the specified compiled asset
275
+ # tailwindcss-rails puts compiled CSS in app/assets/builds/
276
+ builds_path = Rails.root.join("app/assets/builds/#{asset_name}.css")
277
+ return true if File.exist?(builds_path)
278
+
279
+ # Fallback to checking Sprockets for other assets
280
+ Rails.application.assets.resolver.resolve("#{asset_name}.css").present?
281
+ rescue
282
+ false
283
+ end
284
+
273
285
  end
274
286
  end
@@ -1,4 +1,5 @@
1
- import { application } from "./application"
1
+ // Use global Stimulus from CDN
2
+ const application = window.Stimulus
2
3
 
3
4
  import RailsuiAnchorController from "./railsui_anchor_controller.js"
4
5
  application.register("railsui-anchor", RailsuiAnchorController)
@@ -48,33 +49,4 @@ application.register("railsui-pages", RailsuiPagesController)
48
49
  import RailsuiLoadingController from "./railsui_loading_controller.js"
49
50
  application.register("railsui-loading", RailsuiLoadingController)
50
51
 
51
- // Import components adhoc.
52
- import {
53
- RailsuiClipboard,
54
- RailsuiCountUp,
55
- RailsuiCombobox,
56
- RailsuiDateRangePicker,
57
- RailsuiDropdown,
58
- RailsuiModal,
59
- RailsuiRange,
60
- RailsuiReadMore,
61
- RailsuiSelectAll,
62
- RailsuiTabs,
63
- RailsuiToast,
64
- RailsuiToggle,
65
- RailsuiTooltip,
66
- } from "railsui-stimulus"
67
-
68
- application.register("railsui-clipboard", RailsuiClipboard)
69
- application.register("railsui-count-up", RailsuiCountUp)
70
- application.register("railsui-combobox", RailsuiCombobox)
71
- application.register("railsui-date-range-picker", RailsuiDateRangePicker)
72
- application.register("railsui-dropdown", RailsuiDropdown)
73
- application.register("railsui-modal", RailsuiModal)
74
- application.register("railsui-range", RailsuiRange)
75
- application.register("railsui-read-more", RailsuiReadMore)
76
- application.register("railsui-select-all", RailsuiSelectAll)
77
- application.register("railsui-tabs", RailsuiTabs)
78
- application.register("railsui-toast", RailsuiToast)
79
- application.register("railsui-toggle", RailsuiToggle)
80
- application.register("railsui-tooltip", RailsuiTooltip)
52
+ // railsui-stimulus components are loaded via CDN and auto-register
@@ -1,7 +1,8 @@
1
- import { Controller } from '@hotwired/stimulus'
2
- import tippy from 'tippy.js'
1
+ // Use globals from CDN
2
+ // Use Stimulus.Controller from CDN
3
+ const tippy = window.tippy
3
4
 
4
- export default class extends Controller {
5
+ export default class extends Stimulus.Controller {
5
6
  static values = {
6
7
  url: String,
7
8
  }
@@ -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
  expand() {
5
5
  this.element.style.height = `${this.element.scrollHeight + 2}px`
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
  connect() {
5
5
  if (this.element) {
6
6
  var c = this.element,
@@ -1,32 +1,7 @@
1
- import hljs from "highlight.js"
1
+ // Use global hljs from CDN
2
+ const hljs = window.hljs
2
3
 
3
- import bash from "highlight.js/lib/languages/bash"
4
- import javascript from "highlight.js/lib/languages/javascript"
5
- import css from "highlight.js/lib/languages/css"
6
- import xml from "highlight.js/lib/languages/xml"
7
- import erb from "highlight.js/lib/languages/erb"
8
- import haml from "highlight.js/lib/languages/haml"
9
- import ruby from "highlight.js/lib/languages/ruby"
10
- import scss from "highlight.js/lib/languages/scss"
11
- import yaml from "highlight.js/lib/languages/yaml"
12
-
13
- hljs.registerLanguage("bash", bash)
14
- hljs.registerLanguage("css", css)
15
- hljs.registerLanguage("javascript", javascript)
16
- hljs.registerLanguage("xml", xml)
17
- hljs.registerLanguage("erb", erb)
18
- hljs.registerLanguage("haml", haml)
19
- hljs.registerLanguage("ruby", ruby)
20
- hljs.registerLanguage("scss", scss)
21
- hljs.registerLanguage("yaml", yaml)
22
-
23
- hljs.configure({
24
- languages: ["bash", "css", "javascript", "xml", "erb", "haml", "ruby", "scss", "yaml"]
25
- })
26
-
27
- import { Controller } from "@hotwired/stimulus"
28
-
29
- export default class extends Controller {
4
+ export default class extends Stimulus.Controller {
30
5
  static targets = ["snippet"]
31
6
  connect() {
32
7
  this.snippetTargets.forEach((el) => {
@@ -3,7 +3,7 @@ import "vanilla-colorful/hex-input.js"
3
3
 
4
4
  import { Controller } from "@hotwired/stimulus"
5
5
 
6
- export default class extends Controller {
6
+ export default class extends Stimulus.Controller {
7
7
  static targets = ["picker"]
8
8
  connect() {
9
9
  this.pickerTargets.forEach((picker) => {
@@ -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 = ["submit", "submitContainer", "saving"]
5
5
 
6
6
  initialize() {
@@ -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 = ["dialog", "button", "cancel"]
5
5
 
6
6
  launch(event) {
@@ -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
  connect() {
5
5
  if (this.element) {
6
6
  setTimeout(() => {
@@ -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 = ["extension"]
5
5
  static values = {
6
6
  path: String,
@@ -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 = ["content", "saving"]
5
5
  static values = {
6
6
  label: { type: String, default: "Loading..." },
@@ -1,7 +1,8 @@
1
- import { Controller } from "@hotwired/stimulus"
2
- import { useTransition, useClickOutside } from 'stimulus-use'
1
+ // Use globals from CDN
2
+ // Use Stimulus.Controller from CDN
3
+ const { useTransition, useClickOutside } = window.StimulusUse
3
4
 
4
- export default class extends Controller {
5
+ export default class extends Stimulus.Controller {
5
6
  static targets = ['container', 'content']
6
7
 
7
8
  connect() {
@@ -1,7 +1,8 @@
1
- import { Controller } from '@hotwired/stimulus'
2
- import { useTransition } from 'stimulus-use'
1
+ // Use globals from CDN
2
+ // Use Stimulus.Controller from CDN
3
+ const { useTransition } = window.StimulusUse
3
4
 
4
- export default class extends Controller {
5
+ export default class extends Stimulus.Controller {
5
6
  static targets = ['nav', 'menuBars', 'menuCross']
6
7
 
7
8
  connect() {
@@ -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 = ["checkbox"]
5
5
 
6
6
  checkAll() {
@@ -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
  prevent(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 = ["scrollitem", "launcher"]
5
5
  connect() {
6
6
  if (this.hasScrollitemTarget) {
@@ -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 = ["link", "scrollContainer"]
5
5
 
6
6
  static values = {
@@ -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 = ["result", "form", "resultList"]
5
5
  currentResults = this.resultListTarget.innerHTML
6
6