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.
- checksums.yaml +4 -4
- data/Gemfile.lock +8 -1
- data/README.md +196 -42
- data/app/assets/javascripts/railsui-controllers.js +12 -0
- data/app/controllers/railsui/configurations_controller.rb +11 -2
- data/app/helpers/railsui/application_helper.rb +12 -0
- data/app/javascript/controllers/index.js +3 -31
- data/app/javascript/controllers/railsui_anchor_controller.js +4 -3
- data/app/javascript/controllers/railsui_auto_expand_text_area_controller.js +1 -1
- data/app/javascript/controllers/railsui_canvas_controller.js +1 -1
- data/app/javascript/controllers/railsui_code_controller.js +3 -28
- data/app/javascript/controllers/railsui_color_controller.js +1 -1
- data/app/javascript/controllers/railsui_configuration_controller.js +1 -1
- data/app/javascript/controllers/railsui_dialog_controller.js +1 -1
- data/app/javascript/controllers/railsui_flash_controller.js +1 -1
- data/app/javascript/controllers/railsui_helper_controller.js +1 -1
- data/app/javascript/controllers/railsui_loading_controller.js +1 -1
- data/app/javascript/controllers/railsui_modal_controller.js +4 -3
- data/app/javascript/controllers/railsui_nav_controller.js +4 -3
- data/app/javascript/controllers/railsui_pages_controller.js +1 -1
- data/app/javascript/controllers/railsui_prevent_controller.js +1 -1
- data/app/javascript/controllers/railsui_scroll_controller.js +1 -1
- data/app/javascript/controllers/railsui_scroll_spy_controller.js +1 -1
- data/app/javascript/controllers/railsui_search_controller.js +1 -1
- data/app/javascript/controllers/railsui_smooth_controller.js +1 -1
- data/app/javascript/controllers/railsui_snippet_controller.js +1 -1
- data/app/views/layouts/railsui/application.html.erb +7 -5
- data/app/views/layouts/railsui/fullwidth.html.erb +4 -4
- data/app/views/layouts/railsui/landing.html.erb +3 -4
- data/app/views/layouts/railsui/routes.html.erb +4 -3
- data/app/views/railsui/admin/_form.html.erb +18 -1
- data/app/views/railsui/admin/fields/_theme.html.erb +0 -1
- data/app/views/railsui/shared/_cdn_dependencies.html.erb +121 -0
- data/app/views/railsui/shared/_inline_controllers.html.erb +498 -0
- data/app/views/railsui/shared/_snippet.html.erb +23 -1
- data/app/views/railsui/themes/hound/forms/_input_group.html.erb +3 -1
- data/app/views/railsui/themes/shepherd/authentication/devise/_overview.html.erb +30 -28
- data/app/views/railsui/themes/shepherd/authentication/static/_overview.html.erb +8 -8
- data/app/views/railsui/themes/shepherd/content/typography/_headings.html.erb +23 -21
- data/app/views/railsui/themes/shepherd/forms/_input.html.erb +1 -1
- data/guides/CONFIGURATION.md +199 -0
- data/guides/MIGRATION_GUIDE.md +220 -0
- data/lib/generators/railsui/install/install_generator.rb +124 -38
- data/lib/generators/railsui/install/templates/Procfile.dev.build +1 -0
- data/lib/generators/railsui/install/templates/Procfile.dev.nobuild +2 -0
- data/lib/generators/railsui/install/templates/bin/dev +21 -0
- data/lib/generators/railsui/install/templates/themes/corgie/stylesheets/railsui/actiontext.css +0 -1
- data/lib/generators/railsui/install/templates/themes/corgie/views/layouts/rui/railsui.html.erb +7 -2
- data/lib/generators/railsui/install/templates/themes/corgie/views/layouts/rui/railsui_admin.html.erb +7 -2
- data/lib/generators/railsui/install/templates/themes/corgie/views/layouts/rui/railsui_auth.html.erb +6 -2
- data/lib/generators/railsui/install/templates/themes/corgie/views/rui/pages/{privacy.html.erb → privacy_policy.html.erb} +1 -1
- data/lib/generators/railsui/install/templates/themes/corgie/views/rui/pages/terms.html.erb +2 -2
- data/lib/generators/railsui/install/templates/themes/corgie/views/rui/shared/sidebar/_link.html.erb +4 -4
- data/lib/generators/railsui/install/templates/themes/hound/stylesheets/railsui/actiontext.css +0 -1
- data/lib/generators/railsui/install/templates/themes/hound/views/layouts/rui/railsui.html.erb +6 -2
- data/lib/generators/railsui/install/templates/themes/hound/views/layouts/rui/railsui_admin.html.erb +6 -2
- data/lib/generators/railsui/install/templates/themes/shepherd/stylesheets/railsui/actiontext.css +0 -1
- data/lib/generators/railsui/install/templates/themes/shepherd/views/layouts/rui/railsui.html.erb +6 -2
- data/lib/generators/railsui/install/templates/themes/shepherd/views/layouts/rui/railsui_admin.html.erb +6 -2
- data/lib/generators/railsui/update/update_generator.rb +40 -4
- data/lib/railsui/configuration.rb +116 -15
- data/lib/railsui/engine.rb +15 -0
- data/lib/railsui/theme_setup.rb +598 -38
- data/lib/railsui/version.rb +1 -1
- data/lib/railsui.rb +10 -7
- data/lib/tasks/install.rake +9 -3
- data/lib/tasks/migrate.rake +219 -0
- metadata +26 -4
- data/.claude/settings.local.json +0 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1bb7678277542f5768bfb43e48f033b00b7de92ae4c508a04b026ab962822c13
|
|
4
|
+
data.tar.gz: b1a78f138f8db6883895d6db010066f47c0bfb2a0601205549ef90087a56749d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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.
|
|
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
|
-
- [
|
|
10
|
-
- [
|
|
11
|
-
- [
|
|
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/
|
|
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
|
-
|
|
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
|
-
|
|
48
|
+
**When to use:** Zero build step, no Node.js required, fast refresh.
|
|
22
49
|
|
|
23
|
-
|
|
50
|
+
#### With JS Bundler (build mode)
|
|
24
51
|
|
|
25
52
|
```bash
|
|
26
|
-
|
|
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
|
-
|
|
65
|
+
**When to use:** TypeScript, advanced JS tooling, or complex dependencies.
|
|
30
66
|
|
|
31
|
-
|
|
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
|
-
|
|
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
|
-
|
|
73
|
+
### Installing Rails UI on existing applications
|
|
74
|
+
|
|
75
|
+
#### Importmaps (nobuild)
|
|
38
76
|
|
|
39
77
|
```bash
|
|
40
|
-
|
|
41
|
-
|
|
78
|
+
bundle add railsui
|
|
79
|
+
rails railsui:install
|
|
42
80
|
```
|
|
43
81
|
|
|
44
|
-
|
|
82
|
+
#### Apps with a JS Bundler (esbuild, webpack, bun, rollup)
|
|
45
83
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
84
|
+
```bash
|
|
85
|
+
bundle add railsui
|
|
86
|
+
rails railsui:install --build
|
|
87
|
+
```
|
|
49
88
|
|
|
50
|
-
|
|
89
|
+
#### Apps without any JavaScript setup
|
|
51
90
|
|
|
52
|
-
|
|
91
|
+
**Importmap:**
|
|
92
|
+
```bash
|
|
93
|
+
bundle add railsui
|
|
94
|
+
rails railsui:install
|
|
95
|
+
```
|
|
53
96
|
|
|
97
|
+
**JS Bundler:**
|
|
54
98
|
```bash
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
|
|
109
|
+
### Migration scenarios
|
|
60
110
|
|
|
61
|
-
|
|
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
|
-
|
|
113
|
+
#### Migrating from cssbundling-rails
|
|
64
114
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
153
|
+
Then run the appropriate setup:
|
|
154
|
+
`rails railsui:update`
|
|
79
155
|
|
|
80
|
-
|
|
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
|
-
|
|
171
|
+
bin/dev
|
|
84
172
|
```
|
|
85
173
|
|
|
86
|
-
|
|
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
|
-
|
|
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
|
-
|
|
187
|
+
### Quick Configuration
|
|
93
188
|
|
|
94
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
//
|
|
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
|
-
|
|
2
|
-
|
|
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,32 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
// Use global hljs from CDN
|
|
2
|
+
const hljs = window.hljs
|
|
2
3
|
|
|
3
|
-
|
|
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,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
|
|
2
|
-
|
|
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() {
|