m9sh 0.1.0 → 0.2.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 (47) hide show
  1. checksums.yaml +4 -4
  2. data/Dockerfile +2 -1
  3. data/GEM_README.md +284 -0
  4. data/LICENSE.txt +21 -0
  5. data/M9SH_CLI.md +453 -0
  6. data/PUBLISHING.md +331 -0
  7. data/README.md +120 -52
  8. data/app/components/m9sh/accordion_component.rb +3 -3
  9. data/app/components/m9sh/alert_component.rb +7 -9
  10. data/app/components/m9sh/base_component.rb +1 -0
  11. data/app/components/m9sh/button_component.rb +3 -2
  12. data/app/components/m9sh/color_customizer_component.rb +624 -0
  13. data/app/components/m9sh/dialog_close_component.rb +30 -0
  14. data/app/components/m9sh/dialog_component.rb +11 -99
  15. data/app/components/m9sh/dialog_content_component.rb +102 -0
  16. data/app/components/m9sh/dialog_description_component.rb +14 -0
  17. data/app/components/m9sh/dialog_footer_component.rb +14 -0
  18. data/app/components/m9sh/dialog_header_component.rb +27 -0
  19. data/app/components/m9sh/dialog_title_component.rb +14 -0
  20. data/app/components/m9sh/dialog_trigger_component.rb +23 -0
  21. data/app/components/m9sh/dropdown_menu_content_component.rb +1 -1
  22. data/app/components/m9sh/dropdown_menu_item_component.rb +1 -1
  23. data/app/components/m9sh/dropdown_menu_trigger_component.rb +1 -1
  24. data/app/components/m9sh/icon_component.rb +78 -0
  25. data/app/components/m9sh/main_component.rb +1 -1
  26. data/app/components/m9sh/menu_component.rb +85 -0
  27. data/app/components/m9sh/navbar_component.rb +186 -0
  28. data/app/components/m9sh/navigation_menu_component.rb +2 -2
  29. data/app/components/m9sh/popover_component.rb +12 -7
  30. data/app/components/m9sh/radio_group_component.rb +45 -13
  31. data/app/components/m9sh/sheet_component.rb +6 -6
  32. data/app/components/m9sh/sidebar_component.rb +6 -1
  33. data/app/components/m9sh/skeleton_component.rb +7 -1
  34. data/app/components/m9sh/tabs_component.rb +76 -48
  35. data/app/components/m9sh/textarea_component.rb +1 -1
  36. data/app/components/m9sh/theme_toggle_component.rb +1 -0
  37. data/app/javascript/controllers/m9sh/popover_controller.js +24 -18
  38. data/app/javascript/controllers/m9sh/sidebar_controller.js +29 -7
  39. data/lib/m9sh/config.rb +5 -5
  40. data/lib/m9sh/registry.rb +2 -2
  41. data/lib/m9sh/registry.yml +37 -0
  42. data/lib/m9sh/version.rb +1 -1
  43. data/lib/tasks/tailwindcss.rake +15 -0
  44. data/m9sh.gemspec +48 -0
  45. data/publish.sh +48 -0
  46. metadata +20 -3
  47. data/fix_namespaces.py +0 -32
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 15abe8ca859f94770761794841f7844ec485314e25a084a491e784f20212fb6a
4
- data.tar.gz: f28037d63d39224a79783679285a7f7906a8ce616c924f06626b44ee6cbf57be
3
+ metadata.gz: 5f7f878f0cd2a01e7c564dce92c4ca1cd28401b150114859533d07bfc7fc0a58
4
+ data.tar.gz: 4a2895dcc4372fde0ab0d1fcfc11afddbf2735741116bf4b4652bf0c9e400dcc
5
5
  SHA512:
6
- metadata.gz: d2a92e62142a02eab15c3925c76365587a49cdf026a15f6d823ff1e12f554f0fc041ded166126ee889c8664414f18233b432c2fd973388a446df44225386087c
7
- data.tar.gz: 32192a8c31a70aac61c036be5c23ede466f4d9e754899cc738b3dda97f32ebed4aff05a4d9c26581db1b476127b2d0cd7003125c99e89758906bd2ee1b511d88
6
+ metadata.gz: 1c3da513464fb90f16f4eae358f4c508353b52509550d576914e90cf9c74279f22a47428dbcad69ad239f58733bbb9ba5143fc1a9510621d66ecc2979564d730
7
+ data.tar.gz: 4451b13eeafd4acfa954744c164a7acc536c34aed2761e1c08e1d05a8b88f78f5aed8c0ebc398dff2ff5139243737a7ce0247960658e1ec8e8be7a262f111381
data/Dockerfile CHANGED
@@ -59,7 +59,8 @@ RUN npm run build:css
59
59
  RUN bundle exec bootsnap precompile app/ lib/
60
60
 
61
61
  # Precompiling assets for production without requiring secret RAILS_MASTER_KEY
62
- RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
62
+ # Skip tailwindcss:build since we already built CSS with npm
63
+ RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile RAILS_ENV=production
63
64
 
64
65
 
65
66
  # Final stage for app image
data/GEM_README.md ADDED
@@ -0,0 +1,284 @@
1
+ # M9sh - Beautiful UI Components for Rails
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/m9sh.svg)](https://badge.fury.io/rb/m9sh)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ Beautiful, accessible UI components for Rails applications using ViewComponent and Hotwire, inspired by [shadcn/ui](https://ui.shadcn.com).
7
+
8
+ ## Features
9
+
10
+ - 🚀 **Rails Native** - Built specifically for Rails with ViewComponent
11
+ - ⚡ **Hotwire Powered** - Interactive components using Stimulus controllers
12
+ - 🎨 **Tailwind CSS v4** - Modern styling with the latest Tailwind features
13
+ - ♿ **Accessible** - ARIA compliant components
14
+ - 🌙 **Dark Mode** - Built-in dark mode support
15
+ - 📦 **CLI Generator** - Easy component generation with namespace customization
16
+ - 🔧 **Customizable** - Components you can customize and own
17
+
18
+ ## Installation
19
+
20
+ Add this line to your application's Gemfile:
21
+
22
+ ```ruby
23
+ gem 'm9sh'
24
+ ```
25
+
26
+ And then execute:
27
+
28
+ ```bash
29
+ bundle install
30
+ ```
31
+
32
+ Or install it yourself as:
33
+
34
+ ```bash
35
+ gem install m9sh
36
+ ```
37
+
38
+ ## Quick Start
39
+
40
+ ### 1. Initialize M9sh
41
+
42
+ ```bash
43
+ m9sh init
44
+ ```
45
+
46
+ This will create a `m9sh.yml` configuration file and set up your project.
47
+
48
+ ### 2. Add Components
49
+
50
+ ```bash
51
+ # Add individual components
52
+ m9sh add button
53
+ m9sh add card
54
+ m9sh add dialog
55
+
56
+ # Add all components at once
57
+ m9sh add --all
58
+ ```
59
+
60
+ ### 3. Use Components in Your Views
61
+
62
+ ```erb
63
+ <%= render M9sh::ButtonComponent.new(variant: :primary, size: :lg) do %>
64
+ Click Me!
65
+ <% end %>
66
+
67
+ <%= render M9sh::CardComponent.new do |card| %>
68
+ <% card.with_header do |header| %>
69
+ <% header.with_title { "Card Title" } %>
70
+ <% header.with_description { "Card description" } %>
71
+ <% end %>
72
+
73
+ <% card.with_body do %>
74
+ Your content here
75
+ <% end %>
76
+ <% end %>
77
+ ```
78
+
79
+ ## CLI Commands
80
+
81
+ ### Initialize Configuration
82
+
83
+ ```bash
84
+ m9sh init # Interactive setup
85
+ m9sh init --interactive=false \
86
+ --namespace=MyApp \
87
+ --components_path=app/components/ui
88
+ ```
89
+
90
+ ### Add Components
91
+
92
+ ```bash
93
+ m9sh add button # Add specific component
94
+ m9sh add button --force # Overwrite existing
95
+ m9sh add --all # Add all components
96
+ ```
97
+
98
+ ### List Components
99
+
100
+ ```bash
101
+ m9sh list # List all components
102
+ m9sh list -i # Show only installed
103
+ m9sh list -a # Show only available
104
+ ```
105
+
106
+ ### Component Information
107
+
108
+ ```bash
109
+ m9sh info button # Show component details
110
+ ```
111
+
112
+ ### Sync Components
113
+
114
+ ```bash
115
+ m9sh sync button # Update component to latest
116
+ m9sh sync --all # Update all components
117
+ ```
118
+
119
+ ## Available Components
120
+
121
+ ### Form Components
122
+ - **button** - Button with multiple variants
123
+ - **input** - Text input field
124
+ - **textarea** - Multi-line text input
125
+ - **select** - Dropdown select
126
+ - **checkbox** - Checkbox input
127
+ - **switch** - Toggle switch
128
+ - **slider** - Range slider
129
+ - **radio_group** - Radio button group
130
+ - **label** - Form label
131
+
132
+ ### Layout Components
133
+ - **card** - Container with header, body, and footer
134
+ - **table** - Styled table component
135
+ - **separator** - Horizontal/vertical separator
136
+ - **main** - Main content wrapper
137
+
138
+ ### Navigation Components
139
+ - **tabs** - Tab navigation
140
+ - **breadcrumb** - Breadcrumb navigation
141
+ - **navigation_menu** - Navigation menu
142
+ - **sidebar** - Sidebar navigation
143
+
144
+ ### Feedback Components
145
+ - **alert** - Alert notifications
146
+ - **toast** - Toast notifications
147
+ - **progress** - Progress bar
148
+ - **spinner** - Loading spinner
149
+ - **skeleton** - Loading skeleton placeholder
150
+
151
+ ### Interactive Components
152
+ - **accordion** - Collapsible accordion
153
+ - **dialog** - Modal dialog
154
+ - **alert_dialog** - Confirmation dialog
155
+ - **sheet** - Side sheet panel
156
+ - **tooltip** - Tooltip overlay
157
+ - **popover** - Popover overlay
158
+ - **hover_card** - Hover card
159
+ - **collapsible** - Collapsible section
160
+ - **dropdown_menu** - Dropdown menu
161
+ - **toggle** - Toggle button
162
+
163
+ ### Display Components
164
+ - **avatar** - User avatar
165
+ - **badge** - Status badge
166
+ - **typography** - Typography styles
167
+
168
+ ### Theme Components
169
+ - **theme_toggle** - Dark/light mode toggle
170
+
171
+ ## Customization
172
+
173
+ ### Custom Namespace
174
+
175
+ You can use a custom namespace for your components:
176
+
177
+ ```bash
178
+ m9sh init --namespace=MyApp::UI --components_path=app/components/myapp/ui
179
+ ```
180
+
181
+ This will generate components like:
182
+
183
+ ```ruby
184
+ module MyApp
185
+ module UI
186
+ class ButtonComponent < BaseComponent
187
+ # ...
188
+ end
189
+ end
190
+ end
191
+ ```
192
+
193
+ ### Styling
194
+
195
+ All components use Tailwind CSS. Customize by modifying:
196
+ - `tailwind.config.js` - Tailwind configuration
197
+ - CSS custom properties in your CSS file
198
+ - Component classes directly (they're in your project!)
199
+
200
+ ### Override Per Command
201
+
202
+ You can override configuration per command:
203
+
204
+ ```bash
205
+ m9sh add button --namespace=CustomNamespace --components_path=custom/path
206
+ ```
207
+
208
+ ## Requirements
209
+
210
+ - Ruby 3.0+
211
+ - Rails 7.0+
212
+ - ViewComponent 3.0+
213
+ - Tailwind CSS 3.0+
214
+ - Hotwire/Stimulus (for interactive components)
215
+
216
+ ## Configuration
217
+
218
+ The `m9sh.yml` file stores your project configuration:
219
+
220
+ ```yaml
221
+ namespace: M9sh
222
+ components_path: app/components/m9sh
223
+ javascript_path: app/javascript/controllers/m9sh
224
+ tailwind_config: tailwind.config.js
225
+ css_file: app/assets/stylesheets/application.tailwind.css
226
+ style: default
227
+ ```
228
+
229
+ ## How It Works
230
+
231
+ M9sh uses a registry-based approach:
232
+
233
+ 1. **Component Registry** - All components are defined in a YAML registry
234
+ 2. **Dependency Resolution** - Dependencies are automatically resolved and installed
235
+ 3. **File Generation** - Components are copied to your project
236
+ 4. **Namespace Transformation** - Namespaces are automatically transformed to match your config
237
+
238
+ Unlike traditional UI libraries, M9sh components become part of your codebase - you own them and can customize them freely.
239
+
240
+ ## Documentation
241
+
242
+ - [CLI Documentation](https://github.com/yourusername/m9sh/blob/main/M9SH_CLI.md)
243
+ - [Component Documentation](https://m9sh-docs.example.com)
244
+ - [Examples](https://github.com/yourusername/m9sh/tree/main/examples)
245
+
246
+ ## Development
247
+
248
+ After checking out the repo, run:
249
+
250
+ ```bash
251
+ bundle install
252
+ ```
253
+
254
+ To build the gem:
255
+
256
+ ```bash
257
+ gem build m9sh.gemspec
258
+ ```
259
+
260
+ To install the gem locally:
261
+
262
+ ```bash
263
+ gem install ./m9sh-0.1.0.gem
264
+ ```
265
+
266
+ ## Contributing
267
+
268
+ Bug reports and pull requests are welcome on GitHub at https://github.com/yourusername/m9sh.
269
+
270
+ ## License
271
+
272
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
273
+
274
+ ## Credits
275
+
276
+ - Inspired by [shadcn/ui](https://ui.shadcn.com)
277
+ - Built with [ViewComponent](https://viewcomponent.org)
278
+ - Powered by [Hotwire](https://hotwired.dev)
279
+ - Styled with [Tailwind CSS](https://tailwindcss.com)
280
+ - CLI framework: [Thor](https://github.com/rails/thor)
281
+
282
+ ## Support
283
+
284
+ If you find this helpful, please give it a ⭐ on GitHub!
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Marcin Doliwa
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.