aeros 0.0.1

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 (50) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +230 -0
  4. data/Rakefile +8 -0
  5. data/app/assets/stylesheets/aeros/application.css +15 -0
  6. data/app/assets/stylesheets/aeros/application.tailwind.css +7 -0
  7. data/app/assets/stylesheets/aeros/tailwind.css +1100 -0
  8. data/app/components/aeros/application_view_component.rb +75 -0
  9. data/app/components/aeros/button/component.rb +128 -0
  10. data/app/components/aeros/button/controller.js +7 -0
  11. data/app/components/aeros/card/component.html.erb +3 -0
  12. data/app/components/aeros/card/component.rb +7 -0
  13. data/app/components/aeros/dropdown/component.html.erb +26 -0
  14. data/app/components/aeros/dropdown/component.rb +66 -0
  15. data/app/components/aeros/empty/component.html.erb +12 -0
  16. data/app/components/aeros/empty/component.rb +5 -0
  17. data/app/components/aeros/form_builder.rb +71 -0
  18. data/app/components/aeros/input_password/component.html.erb +43 -0
  19. data/app/components/aeros/input_password/component.rb +6 -0
  20. data/app/components/aeros/input_password/controller.js +17 -0
  21. data/app/components/aeros/input_select/component.html.erb +43 -0
  22. data/app/components/aeros/input_select/component.rb +24 -0
  23. data/app/components/aeros/input_text/component.html.erb +25 -0
  24. data/app/components/aeros/input_text/component.rb +5 -0
  25. data/app/components/aeros/input_wrapper/component.html.erb +20 -0
  26. data/app/components/aeros/input_wrapper/component.rb +12 -0
  27. data/app/components/aeros/page/component.html.erb +24 -0
  28. data/app/components/aeros/page/component.rb +9 -0
  29. data/app/components/aeros/spinner/component.rb +55 -0
  30. data/app/components/aeros/table/component.html.erb +10 -0
  31. data/app/components/aeros/table/component.rb +64 -0
  32. data/app/controllers/aeros/application_controller.rb +4 -0
  33. data/app/controllers/aeros/showcase_controller.rb +4 -0
  34. data/app/helpers/aeros/application_helper.rb +16 -0
  35. data/app/javascript/aeros/application.js +3 -0
  36. data/app/javascript/aeros/controllers/application.js +5 -0
  37. data/app/javascript/aeros/controllers/index.js +5 -0
  38. data/app/javascript/aeros/controllers/loader.js +62 -0
  39. data/app/jobs/aeros/application_job.rb +4 -0
  40. data/app/models/aeros/application_record.rb +5 -0
  41. data/app/views/aeros/showcase/index.html.erb +1 -0
  42. data/app/views/layouts/aeros/application.html.erb +20 -0
  43. data/config/importmap.rb +15 -0
  44. data/config/routes.rb +3 -0
  45. data/lib/aeros/engine.rb +37 -0
  46. data/lib/aeros/engine_helpers.rb +44 -0
  47. data/lib/aeros/version.rb +3 -0
  48. data/lib/aeros.rb +9 -0
  49. data/lib/tasks/aeros_tasks.rake +21 -0
  50. metadata +220 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e3b2cb46425e66779531efc5a9dceb58fec72624117670955cc67c8d1d96acb9
4
+ data.tar.gz: c7e1a6a35537ecec3e6abcc3fcb92102bf2c6482d035dcf1e5f3583281ef0232
5
+ SHA512:
6
+ metadata.gz: 46eccf22886fa9abaf9f9c934d7db43056e936670021d69303d4b00c420bd73638ecb13be8e965fdd56806688f0219e19d6cfea8be7e0426ed7e9d553a998168
7
+ data.tar.gz: c0e763ed28d49f28109845222e63f0e292996e5e0b5a3f2ab59f8e41387461b5bddf367b2588d32db0150068b26bdafc657350c9903cfb69c14b9696d105f762
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright Ben
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,230 @@
1
+ # Aeros - Rails Engine UI Component Library
2
+
3
+ A Rails engine providing reusable UI components with Tailwind CSS styling and Stimulus controllers. Built with ViewComponent and designed for easy integration into Rails engines.
4
+
5
+ ## Components Library
6
+
7
+ The Aeros gem provides the following components:
8
+
9
+ ### Form Components
10
+ - **`Button`** - Styled button with variants (default, white, light, outline) and sizes (xsmall, small, large)
11
+ - **`InputText`** - Text input field with wrapper and label support
12
+ - **`InputPassword`** - Password input with show/hide toggle functionality
13
+ - **`InputSelect`** - Styled select dropdown
14
+ - **`InputWrapper`** - Wrapper component for form inputs with labels
15
+
16
+ ### Layout Components
17
+ - **`Page`** - Page container component
18
+ - **`Card`** - Card container with styling
19
+ - **`Table`** - Styled table component
20
+ - **`Dropdown`** - Interactive dropdown menu with Stimulus controller
21
+ - **`Empty`** - Empty state component
22
+ - **`Spinner`** - Loading spinner with size and variant options
23
+
24
+ ### Usage in Views
25
+
26
+ ```erb
27
+ <%= ui("button", label: "Click me", variant: :default) %>
28
+ <%= ui("input_text", name: "email", label: "Email") %>
29
+ <%= ui("input_password", name: "password", label: "Password") %>
30
+ <%= ui("card") do %>
31
+ <h2>Card content</h2>
32
+ <% end %>
33
+ ```
34
+
35
+ ## Installation
36
+
37
+ Add this line to your engine's Gemfile:
38
+
39
+ ```ruby
40
+ gem "aeros", path: "../ui" # or from a gem server
41
+ ```
42
+
43
+ And then execute:
44
+ ```bash
45
+ $ bundle
46
+ ```
47
+
48
+ ## Integration with Rails Engines
49
+
50
+ The Aeros gem provides convenience helpers to quickly integrate it into your Rails engine.
51
+
52
+ ### 1. Engine Setup
53
+
54
+ In your `lib/your_engine/engine.rb`:
55
+
56
+ ```ruby
57
+ require "aeros"
58
+
59
+ module YourEngine
60
+ class << self
61
+ attr_accessor :importmap
62
+ end
63
+
64
+ class Engine < ::Rails::Engine
65
+ isolate_namespace YourEngine
66
+
67
+ # Setup assets and importmap with Aeros gem integration
68
+ Aeros::EngineHelpers.setup_assets(self, namespace: YourEngine)
69
+ Aeros::EngineHelpers.setup_importmap(self, namespace: YourEngine)
70
+ end
71
+ end
72
+ ```
73
+
74
+ **What this does:**
75
+ - Configures asset paths for your engine and the Aeros gem
76
+ - Sets up importmap that automatically includes Aeros gem's JavaScript and components
77
+ - Configures cache sweepers for development hot-reloading
78
+
79
+ ### 2. ApplicationViewComponent
80
+
81
+ Create `app/components/your_engine/application_view_component.rb`:
82
+
83
+ ```ruby
84
+ module YourEngine
85
+ class ApplicationViewComponent < Aeros::ApplicationViewComponent
86
+ def controller_name
87
+ # Override to use your engine's namespace for Stimulus controllers
88
+ name = self.class.name
89
+ .sub(/^YourEngine::/, "")
90
+ .sub(/::Component$/, "")
91
+ .underscore
92
+
93
+ "your-engine--#{name.gsub('/', '--').gsub('_', '-')}"
94
+ end
95
+ end
96
+ end
97
+ ```
98
+
99
+ **What this provides:**
100
+ - All Aeros gem helper methods (stimulus_controller, stimulus_target, etc.)
101
+ - TailwindMerge integration for CSS class merging
102
+ - Style variants support via ViewComponentContrib
103
+ - Dry::Initializer for clean option definitions
104
+
105
+ ### 3. Controller Loading
106
+
107
+ In `app/javascript/your_engine/controllers/index.js`:
108
+
109
+ ```javascript
110
+ import { application } from "your_engine/controllers/application";
111
+ import { eagerLoadEngineControllersFrom } from "aeros/controllers/loader";
112
+
113
+ // Load your engine's controllers
114
+ eagerLoadEngineControllersFrom("your_engine/controllers", application);
115
+ eagerLoadEngineControllersFrom("your_engine/components", application);
116
+
117
+ // Load Aeros gem component controllers
118
+ eagerLoadEngineControllersFrom("aeros/components", application);
119
+ ```
120
+
121
+ **What this does:**
122
+ - Uses the shared controller loader from Aeros gem
123
+ - Automatically registers Stimulus controllers with correct naming conventions
124
+ - Supports multiple namespaces (your engine + Aeros gem)
125
+
126
+ ### 4. Layout Integration
127
+
128
+ In `app/views/layouts/your_engine/application.html.erb`:
129
+
130
+ ```erb
131
+ <!DOCTYPE html>
132
+ <html>
133
+ <head>
134
+ <%= csrf_meta_tags %>
135
+ <%= csp_meta_tag %>
136
+
137
+ <!-- Include Aeros gem stylesheets -->
138
+ <%= stylesheet_link_tag "aeros/application", media: "all" %>
139
+ <%= stylesheet_link_tag "aeros/tailwind", media: "all" %>
140
+
141
+ <!-- Your engine's stylesheets -->
142
+ <%= stylesheet_link_tag "your_engine/application", media: "all" %>
143
+ <%= stylesheet_link_tag "your_engine/tailwind", media: "all" %>
144
+
145
+ <!-- Importmap with Aeros gem integration -->
146
+ <%= javascript_importmap_tags "your_engine/application", importmap: YourEngine.importmap %>
147
+ </head>
148
+ <body>
149
+ <%= yield %>
150
+ </body>
151
+ </html>
152
+ ```
153
+
154
+ ### 5. Importmap Configuration
155
+
156
+ In `config/importmap.rb`:
157
+
158
+ ```ruby
159
+ pin "@hotwired/turbo-rails", to: "turbo.min.js"
160
+ pin "your_engine/application"
161
+ pin "@hotwired/stimulus", to: "stimulus.min.js"
162
+ pin "@hotwired/stimulus-loading", to: "stimulus-loading.js"
163
+
164
+ pin_all_from(
165
+ YourEngine::Engine.root.join("app/javascript/your_engine/controllers"),
166
+ under: "your_engine/controllers",
167
+ )
168
+
169
+ pin_all_from(
170
+ YourEngine::Engine.root.join("app/components/your_engine"),
171
+ under: "your_engine/components",
172
+ to: "your_engine"
173
+ )
174
+ ```
175
+
176
+ **Note:** Aeros gem's importmap is automatically included via `Aeros::EngineHelpers.setup_importmap`
177
+
178
+ ## Convenience Utilities
179
+
180
+ ### Ruby Helpers
181
+
182
+ #### `Aeros::EngineHelpers.setup_assets(engine_class, namespace:)`
183
+ Sets up asset paths for your engine with Propshaft/Sprockets support.
184
+
185
+ #### `Aeros::EngineHelpers.setup_importmap(engine_class, namespace:)`
186
+ Configures importmap with:
187
+ - Your engine's importmap
188
+ - Aeros gem's importmap (automatic)
189
+ - Cache sweepers for development
190
+ - Controller action integration
191
+
192
+ ### JavaScript Utilities
193
+
194
+ #### `eagerLoadEngineControllersFrom(under, application)`
195
+ Intelligent Stimulus controller loader for Rails engines that:
196
+ - Parses importmap to find controllers
197
+ - Registers with correct naming conventions (e.g., `aeros--button`, `your-engine--views--index`)
198
+ - Handles both `controller.js` and `*_controller.js` naming
199
+ - Supports multiple namespaces
200
+
201
+ ## Development
202
+
203
+ ### Running the Demo App
204
+
205
+ ```bash
206
+ cd ui
207
+ bin/rails server
208
+ ```
209
+
210
+ ### Watching Tailwind CSS
211
+
212
+ ```bash
213
+ bundle exec rake app:aeros:tailwind_engine_watch
214
+ ```
215
+
216
+ ## Dependencies
217
+
218
+ - Rails >= 8.0.3
219
+ - importmap-rails ~> 2.2.2
220
+ - turbo-rails ~> 2.0
221
+ - stimulus-rails ~> 1.3
222
+ - tailwindcss-rails ~> 4.3.0
223
+ - view_component ~> 4.0
224
+ - view_component-contrib ~> 0.2.5
225
+ - dry-effects ~> 0.5.0
226
+ - tailwind_merge ~> 1.3
227
+
228
+ ## License
229
+
230
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require "bundler/setup"
2
+
3
+ APP_RAKEFILE = File.expand_path("spec/dummy/Rakefile", __dir__)
4
+ load "rails/tasks/engine.rake"
5
+
6
+ load "rails/tasks/statistics.rake"
7
+
8
+ require "bundler/gem_tasks"
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,7 @@
1
+ @import "tailwindcss";
2
+
3
+ @layer base {
4
+ html {
5
+ @apply text-stone-700;
6
+ }
7
+ }