hakumi_components 0.1.14.pre → 0.1.16.pre

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7bec75a545771e6c254f1ee01a342c902df4edd874c0008f79d6cb6f335efb7e
4
- data.tar.gz: 85ed87c07bbf6c45dd939561a43bfc2cca61826b1070224c55ee8af3e97c55aa
3
+ metadata.gz: 3a8dd617e9d2de8d3db3296397eb5f8d452ad1632b5021033951a063cf2638f1
4
+ data.tar.gz: e0c7cd5b4e0a481780bfd23d21484f868f27af1634cf16fd68a6411479843980
5
5
  SHA512:
6
- metadata.gz: 917134d998017f7c0bb90ac486c54f844b74c2ae069daab65e2412dfec28749fca27b27a0be9603e3ca5c0f7a1f48235d05896b3d1dce756ff10c46434147a2f
7
- data.tar.gz: fdc40788e81ac061a3aa738840a40afa5c29421180483cc37e92baa66747e20207e8a914e798c4b89fbd7268b554b07a0cb9f0dcde8459530d8dd2569c866381
6
+ metadata.gz: d877aebe66b66b309762d09077ebe6ac27c89a7a0c9a25d8af8b8bcf97ef1a266ac88a025df216a985354b2018f6240b1a941b6b557838c318e1488beaef17bb
7
+ data.tar.gz: d2f887ac18633b53d081442a81a9cb4753af33020a189a5056893cbf315b69ac52f5e213dbec740775caee9ff385629a71c4aa3e4660d452960fc16132c22bb6
data/README.md ADDED
@@ -0,0 +1,341 @@
1
+ <div align="center">
2
+ <a href="https://github.com/hakumi-dev/hakumi-components">
3
+ <img src="logo-hakumi-full.png" alt="Logo" width="250">
4
+ </a>
5
+
6
+ <h3 align="center">Hakumi Components</h3>
7
+
8
+ <p align="center">
9
+ Elegant UI component library for Ruby on Rails
10
+ <br />
11
+ <a href="https://components.hakumi.dev"><strong>View Live Playground »</strong></a>
12
+ ·
13
+ <a href="https://github.com/hakumi-dev/hakumi-components/issues">Report Bug</a>
14
+ ·
15
+ <a href="https://www.npmjs.com/package/@hakumi-dev/hakumi-components">npm Package</a>
16
+ ·
17
+ <a href="https://rubygems.org/gems/hakumi_components">RubyGems</a>
18
+ </p>
19
+ </div>
20
+
21
+ ## About The Project
22
+
23
+ Hakumi Components is a comprehensive UI component library for Ruby on Rails applications, inspired by Ant Design. It provides 55+ production-ready, accessible components with light/dark theme support, combining the power of ViewComponent, Stimulus, and modern CSS.
24
+
25
+ **✨ Key Features:**
26
+ - 🎨 **55+ Components** - Button, Form, Table, Modal, Menu, Calendar, and more
27
+ - 🌓 **Light/Dark Theme** - Built-in theme support with CSS variables
28
+ - 📦 **Rails Engine** - Drop-in integration with ViewComponent
29
+ - ⚡ **Modern Stack** - Stimulus controllers with clean JavaScript API
30
+ - 🎯 **Ant Design Inspired** - Familiar design patterns and conventions
31
+ - 🔧 **Customizable** - Override styles and behavior easily
32
+
33
+ **🎮 [Try the Interactive Playground](https://components.hakumi.dev)** - See all components in action with live examples
34
+
35
+ ## Built With
36
+
37
+ [![Ruby][Ruby-badge]][Ruby-url] [![ViewComponent][ViewComponent-badge]][ViewComponent-url] [![Stimulus][Stimulus-badge]][Stimulus-url]
38
+
39
+ **Core Technologies:**
40
+ - Ruby on Rails 7.1+ as a Rails Engine
41
+ - ViewComponent 3.0+ for Ruby components
42
+ - Stimulus 3.0+ for JavaScript interactivity
43
+ - SCSS with CSS variables for theming
44
+
45
+ ## Getting Started
46
+
47
+ ### Prerequisites
48
+
49
+ **Required:**
50
+ - Ruby 3.0 or higher
51
+ - Rails 7.1 or higher
52
+ - Node.js 16.9+ (for npm package)
53
+ - A JavaScript bundler (Vite, Webpack, esbuild, etc.)
54
+ - SCSS processor (sass, sass-embedded, etc.)
55
+
56
+ **Recommended:**
57
+ - Vite (via `vite_rails` gem)
58
+ - Yarn or npm for package management
59
+
60
+ ### Installation
61
+
62
+ #### Option A: Automatic Installation (Recommended)
63
+
64
+ **1. Add the gem to your Gemfile:**
65
+
66
+ ```ruby
67
+ gem 'hakumi_components', '~> 0.1.0.pre'
68
+ ```
69
+
70
+ **2. Run the installer:**
71
+
72
+ ```bash
73
+ bundle install
74
+ bin/rails generate hakumi:install
75
+ ```
76
+
77
+ The generator will automatically:
78
+ - ✅ Install the npm package with correct version (`@pre`)
79
+ - ✅ Detect your JavaScript entry point (Vite/Webpack/Sprockets)
80
+ - ✅ Add imports with complete configuration
81
+ - ✅ Setup stylesheets with appropriate syntax (`@use` or `@import`)
82
+ - ✅ Configure the FormBuilder (optional)
83
+
84
+ **3. Restart your server and you're done! 🎉**
85
+
86
+ ---
87
+
88
+ #### Option B: Manual Installation
89
+
90
+ If you prefer manual setup or the generator doesn't work for your setup:
91
+
92
+ **1. Add the gem:**
93
+
94
+ ```ruby
95
+ gem 'hakumi_components', '~> 0.1.0.pre'
96
+ ```
97
+
98
+ **2. Install dependencies:**
99
+
100
+ ```bash
101
+ bundle install
102
+
103
+ # Using Yarn
104
+ yarn add @hakumi-dev/hakumi-components@pre
105
+
106
+ # Using npm
107
+ npm install @hakumi-dev/hakumi-components@pre
108
+ ```
109
+
110
+ **3. Setup JavaScript:**
111
+
112
+ ```javascript
113
+ // app/javascript/application.js (or entrypoints/application.js for Vite)
114
+ import { Application } from "@hotwired/stimulus"
115
+ import HakumiComponents, { registerHakumiControllers } from "@hakumi-dev/hakumi-components"
116
+
117
+ const application = Application.start()
118
+ window.HakumiComponents = HakumiComponents
119
+ registerHakumiControllers(application)
120
+ ```
121
+
122
+ **4. Setup stylesheets:**
123
+
124
+ ```scss
125
+ // For Vite/Webpack (modern bundlers)
126
+ // app/javascript/stylesheets/application.scss
127
+ @use '@hakumi-dev/hakumi-components/styles';
128
+
129
+ // OR for Sprockets/traditional setup
130
+ // app/assets/stylesheets/application.scss
131
+ @import "@hakumi-dev/hakumi-components/styles";
132
+ ```
133
+
134
+ **5. (Optional) Configure FormBuilder:**
135
+
136
+ ```ruby
137
+ # config/initializers/hakumi_components.rb
138
+ Rails.application.config.action_view.default_form_builder = Hakumi::FormBuilder
139
+ ```
140
+
141
+ ## Usage
142
+
143
+ ### Basic Component Example
144
+
145
+ ```erb
146
+ <%# Simple button %>
147
+ <%= render Hakumi::Button::Component.new(type: :primary) do %>
148
+ Click me
149
+ <% end %>
150
+
151
+ <%# Form with automatic validation detection %>
152
+ <%= form_with model: @user, builder: Hakumi::FormBuilder do |f| %>
153
+ <%= f.text_field :email %>
154
+ <%= f.text_field :name %>
155
+ <%= f.submit "Save", type: :primary %>
156
+ <% end %>
157
+
158
+ <%# Modal with programmatic control %>
159
+ <%= render Hakumi::Modal::Component.new(
160
+ id: "my-modal",
161
+ title: "Confirm Action"
162
+ ) do %>
163
+ Are you sure you want to proceed?
164
+ <% end %>
165
+ ```
166
+
167
+ ### Component Categories
168
+
169
+ - **Layout**: Divider, Flex, Grid, Layout, Space, Splitter
170
+ - **Navigation**: Breadcrumb, Dropdown, Menu, Pagination, Steps, Tabs
171
+ - **Data Display**: Avatar, Badge, Card, Table, Tag, Timeline, Tooltip, Tree
172
+ - **Form Controls**: Button, Checkbox, ColorPicker, DatePicker, Input, Select, Radio, Slider, Switch
173
+ - **Feedback**: Alert, Drawer, Message, Modal, Notification, Progress, Spin
174
+ - **Typography**: Link, Paragraph, Text, Title
175
+
176
+ _For detailed component documentation, please refer to the [Component Guide](#) (coming soon)_
177
+
178
+ ## JavaScript API
179
+
180
+ Components with interactivity expose programmatic APIs:
181
+
182
+ ```javascript
183
+ // Access component API via element
184
+ const modal = document.getElementById('my-modal')
185
+ modal.hakumiComponent.api.open()
186
+ modal.hakumiComponent.api.close()
187
+
188
+ // Or via global registry
189
+ window.HakumiComponents.get('my-modal').open()
190
+ ```
191
+
192
+ Common API methods by component type:
193
+ - **Toggleables** (Modal, Drawer): `open()`, `close()`, `toggle()`, `isOpen()`
194
+ - **Inputs** (Input, Select): `getValue()`, `setValue(value)`, `clear()`, `focus()`
195
+ - **Navigation** (Carousel, Tabs): `next()`, `prev()`, `goTo(index)`, `getCurrent()`
196
+
197
+ ## Architecture
198
+
199
+ Components follow a three-layer pattern:
200
+ 1. **Ruby Component** (`component.rb`) - Props and rendering logic
201
+ 2. **ERB Template** (`component.html.erb`) - HTML structure (optional)
202
+ 3. **Stimulus Controller** (`{component}_controller.js`) - Interactivity (when needed)
203
+
204
+ **Note:** Not all components need JavaScript controllers. Many are purely presentational (Typography, Space, Divider, etc.).
205
+
206
+ ## Troubleshooting
207
+
208
+ ### Installation Issues
209
+
210
+ If you encounter problems during installation:
211
+
212
+ 1. **Try the automatic installer first:**
213
+ ```bash
214
+ bin/rails generate hakumi:install
215
+ ```
216
+
217
+ 2. **If the installer fails**, follow the manual installation steps above
218
+
219
+ 3. **Check compatibility:**
220
+ - Ruby 3.0+
221
+ - Rails 7.1+
222
+ - Node.js 16.9+
223
+ - A JavaScript bundler (Vite, Webpack, esbuild)
224
+
225
+ ### Controllers not registering
226
+
227
+ If components don't respond to interactions:
228
+
229
+ 1. **Verify the npm package is installed:**
230
+ ```bash
231
+ yarn list @hakumi-dev/hakumi-components
232
+ # or
233
+ npm list @hakumi-dev/hakumi-components
234
+ ```
235
+
236
+ 2. **Check browser console:**
237
+ - Should see: `"[HakumiComponents] Registered X controllers"`
238
+ - If you see errors, check your import paths
239
+
240
+ 3. **Verify Stimulus is properly configured:**
241
+ ```javascript
242
+ console.log(window.Stimulus) // Should not be undefined
243
+ console.log(window.HakumiComponents) // Should be an object with methods
244
+ ```
245
+
246
+ 4. **Ensure imports are complete:**
247
+ ```javascript
248
+ // ✅ Correct - includes both exports
249
+ import HakumiComponents, { registerHakumiControllers } from "@hakumi-dev/hakumi-components"
250
+
251
+ // ❌ Wrong - missing default export
252
+ import { registerHakumiControllers } from "@hakumi-dev/hakumi-components"
253
+ ```
254
+
255
+ ### Styles not loading
256
+
257
+ 1. Verify you're using SCSS (not plain CSS)
258
+ 2. Check your bundler configuration supports node_modules imports
259
+ 3. For Vite, ensure `@use` syntax is used (not `@import`)
260
+
261
+ ### Version mismatches
262
+
263
+ Keep gem and npm versions in sync:
264
+ ```ruby
265
+ # Gemfile
266
+ gem 'hakumi_components', '~> 0.1.15.pre'
267
+ ```
268
+ ```bash
269
+ # package.json
270
+ yarn add @hakumi-dev/hakumi-components@0.1.15-pre
271
+ ```
272
+
273
+ ## Updating
274
+
275
+ To update to the latest version:
276
+
277
+ ```bash
278
+ # Update Ruby gem
279
+ bundle update hakumi_components
280
+
281
+ # Update npm package (always use latest pre-release)
282
+ yarn add @hakumi-dev/hakumi-components@pre
283
+ # or
284
+ npm install @hakumi-dev/hakumi-components@pre --save
285
+ ```
286
+
287
+ **Note:** Currently in pre-release. Use `@pre` tag to get the latest version.
288
+
289
+ ## Contributing
290
+
291
+ Contributions are welcome! This is an open-source project and we'd love your help.
292
+
293
+ **For Contributors:**
294
+
295
+ 1. Fork the Project
296
+ 2. Clone your fork and setup:
297
+ ```bash
298
+ git clone https://github.com/your-username/hakumi-components.git
299
+ cd hakumi-components
300
+ bin/setup
301
+ ```
302
+ 3. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
303
+ 4. Make your changes and add tests
304
+ 5. Run tests: `bundle exec rake test`
305
+ 6. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
306
+ 7. Push to the Branch (`git push origin feature/AmazingFeature`)
307
+ 8. Open a Pull Request
308
+
309
+ **Development Commands:**
310
+ ```bash
311
+ bin/setup # Initial setup
312
+ bundle exec rake test # Run Ruby tests
313
+ yarn test # Run JavaScript tests
314
+ bin/ci # Run full CI suite locally
315
+ ```
316
+
317
+ ## License
318
+
319
+ Distributed under the MIT License. See `LICENSE` for more information.
320
+
321
+ ## Contact
322
+
323
+ Project Link: [https://github.com/hakumi-dev/hakumi-components](https://github.com/hakumi-dev/hakumi-components)
324
+
325
+ ## Acknowledgments
326
+
327
+ - Inspired by [Ant Design](https://ant.design/)
328
+ - Built with [ViewComponent](https://viewcomponent.org/)
329
+ - Powered by [Stimulus](https://stimulus.hotwired.dev/)
330
+
331
+ <!-- MARKDOWN LINKS & IMAGES -->
332
+ [Ruby-badge]: https://img.shields.io/badge/Ruby-CC342D?style=for-the-badge&logo=ruby&logoColor=white
333
+ [Ruby-url]: https://www.ruby-lang.org/
334
+ [Rails-badge]: https://img.shields.io/badge/Rails-CC0000?style=for-the-badge&logo=ruby-on-rails&logoColor=white
335
+ [Rails-url]: https://rubyonrails.org/
336
+ [ViewComponent-badge]: https://img.shields.io/badge/ViewComponent-FE7A16?style=for-the-badge&logo=ruby&logoColor=white
337
+ [ViewComponent-url]: https://viewcomponent.org/
338
+ [Stimulus-badge]: https://img.shields.io/badge/Stimulus-77E8B9?style=for-the-badge&logo=stimulus&logoColor=black
339
+ [Stimulus-url]: https://stimulus.hotwired.dev/
340
+ [Vite-badge]: https://img.shields.io/badge/Vite-646CFF?style=for-the-badge&logo=vite&logoColor=white
341
+ [Vite-url]: https://vitejs.dev/
@@ -8,125 +8,208 @@ module Hakumi
8
8
 
9
9
  def add_npm_package
10
10
  say "Adding @hakumi-dev/hakumi-components to package.json...", :green
11
- run "yarn add @hakumi-dev/hakumi-components"
11
+
12
+ # Install latest pre-release version
13
+ if package_manager == :npm
14
+ run "npm install @hakumi-dev/hakumi-components@pre --save"
15
+ else
16
+ run "yarn add @hakumi-dev/hakumi-components@pre"
17
+ end
12
18
  end
13
19
 
14
20
  def setup_javascript
15
21
  say "Setting up JavaScript...", :green
16
22
 
17
- js_file = "app/javascript/controllers/index.js"
23
+ js_file = detect_js_entry_point
18
24
 
19
- if File.exist?(js_file)
25
+ if js_file
20
26
  content = File.read(js_file)
21
27
 
22
28
  unless content.include?("hakumi-components")
23
- # Add import at the top
24
- import_line = 'import { registerHakumiControllers } from "@hakumi-dev/hakumi-components"'
25
-
26
- # Add registration after Stimulus setup
27
- register_line = "registerHakumiControllers(application)"
28
-
29
- # Insert import after other imports
30
- if content.include?("import")
31
- # Find the last import line and add after it
32
- lines = content.split("\n")
33
- last_import_index = lines.rindex { |line| line.start_with?("import ") }
34
-
35
- if last_import_index
36
- lines.insert(last_import_index + 1, import_line)
37
- content = lines.join("\n")
29
+ # Full import with default export and named export
30
+ import_lines = [
31
+ 'import HakumiComponents, { registerHakumiControllers } from "@hakumi-dev/hakumi-components"'
32
+ ]
33
+
34
+ # Add global window assignment and registration
35
+ register_lines = [
36
+ "window.HakumiComponents = HakumiComponents",
37
+ "registerHakumiControllers(application)"
38
+ ]
39
+
40
+ # Insert imports after other imports
41
+ lines = content.split("\n")
42
+ last_import_index = lines.rindex { |line| line.match?(/^import\s/) }
43
+
44
+ if last_import_index
45
+ # Insert after last import
46
+ import_lines.reverse_each do |line|
47
+ lines.insert(last_import_index + 1, line)
38
48
  end
39
49
  else
40
- content = "#{import_line}\n#{content}"
50
+ # Add at the top
51
+ lines = import_lines + [ "" ] + lines
41
52
  end
42
53
 
43
- # Add registration at the end if not present
44
- unless content.include?("registerHakumiControllers")
45
- content += "\n#{register_line}\n"
54
+ # Find where to add registration (after Stimulus application setup)
55
+ application_index = lines.index { |line| line.include?("Application.start()") || line.include?("application = Application") }
56
+
57
+ if application_index
58
+ # Add after application setup
59
+ register_lines.reverse_each do |line|
60
+ lines.insert(application_index + 1, line)
61
+ end
62
+ else
63
+ # Add at the end
64
+ lines += [ "" ] + register_lines
46
65
  end
47
66
 
67
+ content = lines.join("\n")
48
68
  File.write(js_file, content)
49
- say " Updated #{js_file}", :green
69
+ say " Updated #{js_file}", :green
50
70
  else
51
- say " #{js_file} already configured", :yellow
71
+ say " #{js_file} already configured", :yellow
52
72
  end
53
73
  else
54
- say " Could not find #{js_file}. Please add manually:", :yellow
55
- say ' import { registerHakumiControllers } from "@hakumi-dev/hakumi-components"'
74
+ say " Could not find JavaScript entry point. Please add manually:", :yellow
75
+ say ""
76
+ say " import HakumiComponents, { registerHakumiControllers } from \"@hakumi-dev/hakumi-components\""
77
+ say " window.HakumiComponents = HakumiComponents"
56
78
  say " registerHakumiControllers(application)"
79
+ say ""
57
80
  end
58
81
  end
59
82
 
60
83
  def setup_stylesheets
61
84
  say "Setting up stylesheets...", :green
62
85
 
63
- # Check for different stylesheet configurations
64
- scss_files = [
65
- "app/assets/stylesheets/application.scss",
66
- "app/assets/stylesheets/application.css.scss",
67
- "app/javascript/stylesheets/application.scss"
68
- ]
69
-
70
- css_files = [
71
- "app/assets/stylesheets/application.css"
72
- ]
73
-
74
- scss_file = scss_files.find { |f| File.exist?(f) }
75
- css_file = css_files.find { |f| File.exist?(f) }
86
+ scss_file = detect_scss_file
76
87
 
77
88
  if scss_file
78
89
  content = File.read(scss_file)
79
- import_line = '@import "@hakumi-dev/hakumi-components/styles";'
80
90
 
81
91
  unless content.include?("hakumi-components")
92
+ # Use modern @use syntax for Vite/Webpack, @import for Sprockets
93
+ import_line = if using_modern_bundler?
94
+ '@use "@hakumi-dev/hakumi-components/styles";'
95
+ else
96
+ '@import "@hakumi-dev/hakumi-components/styles";'
97
+ end
98
+
99
+ # Add at the top of the file
82
100
  File.write(scss_file, "#{import_line}\n#{content}")
83
- say " Updated #{scss_file}", :green
101
+ say " Updated #{scss_file}", :green
102
+ say " Using #{using_modern_bundler? ? '@use' : '@import'} syntax", :cyan
84
103
  else
85
- say " #{scss_file} already configured", :yellow
104
+ say " #{scss_file} already configured", :yellow
86
105
  end
87
- elsif css_file
88
- say " Found CSS file. For full styling support, rename to .scss and add:", :yellow
89
- say ' @import "@hakumi-dev/hakumi-components/styles";'
90
106
  else
91
- say " Could not find stylesheet. Please add manually:", :yellow
92
- say ' @import "@hakumi-dev/hakumi-components/styles";'
107
+ say " Could not find SCSS file. Please add manually:", :yellow
108
+ say ""
109
+ if using_modern_bundler?
110
+ say " // For Vite/Webpack (modern bundlers):"
111
+ say " @use \"@hakumi-dev/hakumi-components/styles\";"
112
+ else
113
+ say " // For Sprockets:"
114
+ say " @import \"@hakumi-dev/hakumi-components/styles\";"
115
+ end
116
+ say ""
93
117
  end
94
118
  end
95
119
 
96
120
  def setup_form_builder
97
- say "Setting up FormBuilder...", :green
121
+ say "Setting up FormBuilder (optional)...", :green
98
122
 
99
123
  initializer_file = "config/initializers/hakumi_components.rb"
100
124
 
101
125
  if File.exist?(initializer_file)
102
- say " #{initializer_file} already exists", :yellow
126
+ say " #{initializer_file} already exists", :yellow
103
127
  else
104
128
  create_file initializer_file, <<~RUBY
105
129
  # frozen_string_literal: true
106
130
 
107
131
  # Configure default form builder for Hakumi Components
132
+ # This enables automatic validation styling and label generation
108
133
  Rails.application.config.action_view.default_form_builder = Hakumi::FormBuilder
109
134
  RUBY
110
- say " Created #{initializer_file}", :green
135
+ say " Created #{initializer_file}", :green
111
136
  end
112
137
  end
113
138
 
114
139
  def show_post_install
115
140
  say ""
116
- say "=" * 60, :green
117
- say "Hakumi Components installed successfully!", :green
118
- say "=" * 60, :green
141
+ say "=" * 70, :green
142
+ say "🎉 Hakumi Components installed successfully!", :green
143
+ say "=" * 70, :green
144
+ say ""
145
+ say "📋 Next steps:", :cyan
119
146
  say ""
120
- say "Next steps:"
121
- say " 1. Restart your Rails server"
122
- say " 2. Start using components in your views:"
147
+ say " 1. Restart your Rails server and asset pipeline"
148
+ say " 2. Try using a component in your views:"
123
149
  say ""
124
- say " <%= render Hakumi::Button::Component.new(type: :primary) do %>"
125
- say " Click me"
126
- say " <% end %>"
150
+ say " <%= render Hakumi::Button::Component.new(type: :primary) do %>", :cyan
151
+ say " Click me", :cyan
152
+ say " <% end %>", :cyan
127
153
  say ""
128
- say "Documentation: https://github.com/hakumi-dev/hakumi-components"
154
+ say " 3. Check the browser console for confirmation:"
155
+ say " → Should see: \"[HakumiComponents] Registered X controllers\""
129
156
  say ""
157
+ say "📚 Resources:", :cyan
158
+ say " • Live Playground: https://antrails.kb714.com"
159
+ say " • Documentation: https://github.com/hakumi-dev/hakumi-components"
160
+ say " • npm Package: https://www.npmjs.com/package/@hakumi-dev/hakumi-components"
161
+ say ""
162
+
163
+ if needs_manual_setup?
164
+ say "⚠️ Manual setup required:", :yellow
165
+ say " Some files could not be configured automatically."
166
+ say " Please refer to the output above for manual instructions."
167
+ say ""
168
+ end
169
+ end
170
+
171
+ private
172
+
173
+ def detect_js_entry_point
174
+ # Check common JavaScript entry points in order of preference
175
+ candidates = [
176
+ "app/javascript/entrypoints/application.js", # Vite
177
+ "app/javascript/application.js", # esbuild, Webpack
178
+ "app/assets/javascripts/application.js" # Sprockets
179
+ ]
180
+
181
+ candidates.find { |file| File.exist?(file) }
182
+ end
183
+
184
+ def detect_scss_file
185
+ # Check common SCSS file locations
186
+ candidates = [
187
+ "app/javascript/stylesheets/application.scss", # Vite/Webpack
188
+ "app/assets/stylesheets/application.scss", # Sprockets
189
+ "app/assets/stylesheets/application.css.scss" # Old Sprockets
190
+ ]
191
+
192
+ candidates.find { |file| File.exist?(file) }
193
+ end
194
+
195
+ def using_modern_bundler?
196
+ # Detect if using Vite, Webpack, or esbuild (modern bundlers)
197
+ File.exist?("vite.config.js") ||
198
+ File.exist?("vite.config.ts") ||
199
+ File.exist?("vite.config.mts") ||
200
+ File.exist?("webpack.config.js") ||
201
+ File.exist?("config/webpack") ||
202
+ (File.exist?("Gemfile") && File.read("Gemfile").include?("vite_rails"))
203
+ end
204
+
205
+ def package_manager
206
+ return :yarn if File.exist?("yarn.lock")
207
+ return :npm if File.exist?("package-lock.json")
208
+ :yarn # default
209
+ end
210
+
211
+ def needs_manual_setup?
212
+ !detect_js_entry_point || !detect_scss_file
130
213
  end
131
214
  end
132
215
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HakumiComponents
4
- VERSION = "0.1.14.pre"
4
+ VERSION = "0.1.16.pre"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hakumi_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.14.pre
4
+ version: 0.1.16.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - kb714
@@ -74,6 +74,7 @@ extra_rdoc_files: []
74
74
  files:
75
75
  - CHANGELOG.md
76
76
  - LICENSE
77
+ - README.md
77
78
  - app/assets/icons/filled/account-book.svg
78
79
  - app/assets/icons/filled/alert.svg
79
80
  - app/assets/icons/filled/alipay-circle.svg