daisyui_on_phlex 0.3.0 → 0.5.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/README.md +15 -0
- data/lib/daisyui_on_phlex/generators/install_generator.rb +79 -40
- data/lib/daisyui_on_phlex/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c06ad40c76dc297ff9797fe359b68daf27c687970c534fc806ba538f38c3250
|
4
|
+
data.tar.gz: 40be3a774c215ca0ac34e70d1cdd96295f1b2e1fe8faee5a941fec710b506ec2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b642f267c2e92389fb1bb679bce649ce6f65f1dc987716fcda811fdae5ff01f0495dd5b3202ec4479c0369db10ad07a51df3876caae8b56e16be39001e12d9d
|
7
|
+
data.tar.gz: e933135c772eb7172321e602103fbb555cf35ae1314d05853754538eed52329cbfefc73081d208f5ea2c85648452f7f7a6272694543eb562cb6ffd1ca4a27a98
|
data/README.md
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
# DaisyUI On Phlex
|
2
2
|
|
3
|
+
> **⚠️ WARNING: UNDER ACTIVE DEVELOPMENT ⚠️**
|
4
|
+
>
|
5
|
+
> **🚧 THIS GEM IS NOT READY FOR PRODUCTION USE 🚧**
|
6
|
+
>
|
7
|
+
> This gem is currently in heavy development and APIs may change frequently. Components, installation process, and configuration may break between versions without notice. Please DO NOT use this in production applications yet.
|
8
|
+
>
|
9
|
+
> **Current Status:**
|
10
|
+
> - ⚠️ Installation process is being refined
|
11
|
+
> - ⚠️ Components may have bugs or missing features
|
12
|
+
> - ⚠️ Documentation may be outdated
|
13
|
+
>
|
14
|
+
> **We recommend waiting!**
|
15
|
+
>
|
16
|
+
> If you want to contribute or test, please use at your own risk and expect breaking changes.
|
17
|
+
|
3
18
|
[](https://badge.fury.io/rb/daisyui_on_phlex)
|
4
19
|
|
5
20
|
A Ruby gem that provides [DaisyUI](https://daisyui.com) components as [Phlex](https://phlex.fun) components for Rails applications. This gem makes it easy to use DaisyUI's beautiful components in your Ruby on Rails projects with the power and simplicity of Phlex.
|
@@ -21,12 +21,34 @@ module DaisyuiOnPhlex
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
def install_daisyui_npm
|
25
|
+
if File.exist?("package.json")
|
26
|
+
say "Installing DaisyUI via NPM...", :green
|
27
|
+
|
28
|
+
# Check if daisyui is already installed
|
29
|
+
package_json = File.read("package.json")
|
30
|
+
unless package_json.include?('"daisyui"')
|
31
|
+
if system("which npm > /dev/null")
|
32
|
+
run "npm install daisyui"
|
33
|
+
say "DaisyUI installed via NPM", :green
|
34
|
+
elsif system("which yarn > /dev/null")
|
35
|
+
run "yarn add daisyui"
|
36
|
+
say "DaisyUI installed via Yarn", :green
|
37
|
+
else
|
38
|
+
say "Neither NPM nor Yarn found. Please install DaisyUI manually: npm install daisyui", :yellow
|
39
|
+
end
|
40
|
+
else
|
41
|
+
say "DaisyUI already installed in package.json", :yellow
|
42
|
+
end
|
43
|
+
else
|
44
|
+
say "No package.json found. Skipping NPM installation.", :yellow
|
45
|
+
say "Please install DaisyUI manually: npm install daisyui", :yellow
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
24
49
|
def copy_daisyui_files
|
25
|
-
say "
|
26
|
-
|
27
|
-
# Download DaisyUI files
|
28
|
-
run "curl -sLo app/assets/tailwind/daisyui.js https://github.com/saadeghi/daisyui/releases/latest/download/daisyui.js" rescue nil
|
29
|
-
run "curl -sLo app/assets/tailwind/daisyui-theme.js https://github.com/saadeghi/daisyui/releases/latest/download/daisyui-theme.js" rescue nil
|
50
|
+
say "DaisyUI assets are now provided automatically via Rails Engine! 🎉", :green
|
51
|
+
say "CSS and JS files are included automatically in your application.", :blue
|
30
52
|
end
|
31
53
|
|
32
54
|
def copy_components_to_vendor
|
@@ -38,7 +60,7 @@ module DaisyuiOnPhlex
|
|
38
60
|
|
39
61
|
component_files.each do |component_path|
|
40
62
|
component_file_name = File.basename(component_path)
|
41
|
-
#
|
63
|
+
# We are using relative path from source_root
|
42
64
|
relative_path = File.join("components", component_file_name)
|
43
65
|
destination_path = Rails.root.join("vendor/daisyui_on_phlex/components", component_file_name)
|
44
66
|
|
@@ -48,46 +70,54 @@ module DaisyuiOnPhlex
|
|
48
70
|
|
49
71
|
def copy_base_class
|
50
72
|
say "Copying base class...", :green
|
51
|
-
#
|
73
|
+
# We are using relative path from source_root
|
52
74
|
copy_file "base.rb", Rails.root.join("vendor/daisyui_on_phlex/base.rb"), force: options["force"]
|
53
75
|
end
|
54
76
|
|
55
77
|
def create_vendor_initializer
|
56
|
-
vendor_initializer_path = Rails.root.join("config/initializers/
|
78
|
+
vendor_initializer_path = Rails.root.join("config/initializers/daisyui_on_phlex.rb")
|
57
79
|
|
58
80
|
create_file vendor_initializer_path, <<~RUBY, force: options["force"]
|
59
81
|
# frozen_string_literal: true
|
60
82
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
83
|
+
module DaisyuiOnPhlex
|
84
|
+
extend Phlex::Kit
|
85
|
+
end
|
86
|
+
|
87
|
+
# Require base.rb first
|
88
|
+
require Rails.root.join("vendor/daisyui_on_phlex/base.rb")
|
89
|
+
|
90
|
+
# Load all DaisyUI components from vendor directory
|
91
|
+
Dir[Rails.root.join("vendor/daisyui_on_phlex/components/*.rb")].each do |file|
|
92
|
+
require file
|
93
|
+
end
|
94
|
+
|
95
|
+
# Configure TailwindMerge for CSS class merging
|
96
|
+
if defined?(TailwindMerge) && defined?(ClassVariants)
|
97
|
+
ClassVariants.configure do |config|
|
98
|
+
merger = TailwindMerge::Merger.new
|
99
|
+
config.process_classes_with do |classes|
|
100
|
+
merger.merge(classes)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
65
104
|
RUBY
|
105
|
+
|
106
|
+
say "Created vendor initializer: config/initializers/daisyui_on_phlex.rb", :green
|
66
107
|
end
|
67
108
|
|
68
109
|
def update_tailwind_config
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
"@import \"tailwindcss\" source(none);\n@plugin \"./daisyui.js\";"
|
81
|
-
)
|
82
|
-
|
83
|
-
File.write(tailwind_config_path, updated_content)
|
84
|
-
say "Added DaisyUI plugin to Tailwind CSS configuration", :green
|
85
|
-
else
|
86
|
-
say "DaisyUI plugin already configured in Tailwind CSS", :yellow
|
87
|
-
end
|
88
|
-
else
|
89
|
-
say "Tailwind CSS configuration not found. Please add @plugin \"./daisyui.js\"; to your Tailwind CSS configuration manually.", :yellow
|
90
|
-
end
|
110
|
+
say "📝 To include DaisyUI styles in your application:", :green
|
111
|
+
say ""
|
112
|
+
say "1. Add to your main CSS file (application.css or application.tailwind.css):", :yellow
|
113
|
+
say " //= require daisyui_on_phlex", :cyan
|
114
|
+
say ""
|
115
|
+
say "2. Or in your JavaScript file (application.js):", :yellow
|
116
|
+
say " //= require daisyui_on_phlex", :cyan
|
117
|
+
say ""
|
118
|
+
say "3. For Tailwind CSS, ensure your tailwind.config.js includes:", :yellow
|
119
|
+
say ' content: ["./vendor/daisyui_on_phlex/**/*.rb"]', :cyan
|
120
|
+
say ""
|
91
121
|
end
|
92
122
|
|
93
123
|
def show_readme
|
@@ -99,10 +129,20 @@ module DaisyuiOnPhlex
|
|
99
129
|
DaisyUI On Phlex has been installed! 🎉
|
100
130
|
|
101
131
|
✅ All #{component_count} components have been copied to vendor/daisyui_on_phlex/
|
102
|
-
✅ DaisyUI
|
132
|
+
✅ DaisyUI CSS & JS automatically provided via Rails Engine
|
133
|
+
✅ Vendor initializer created (config/initializers/daisyui_on_phlex.rb)
|
103
134
|
✅ Ready to use in your Phlex views
|
104
135
|
|
105
|
-
|
136
|
+
📦 Optional: Install DaisyUI via NPM for latest features:
|
137
|
+
npm install daisyui
|
138
|
+
# or
|
139
|
+
yarn add daisyui
|
140
|
+
|
141
|
+
🎨 Recommended gems for better CSS handling:
|
142
|
+
gem 'tailwind_merge'
|
143
|
+
gem 'class_variants'
|
144
|
+
|
145
|
+
🚀 You can now use DaisyUI components in your Phlex views:
|
106
146
|
|
107
147
|
# In your Phlex view
|
108
148
|
class MyView < Phlex::HTML
|
@@ -117,16 +157,15 @@ module DaisyuiOnPhlex
|
|
117
157
|
end
|
118
158
|
end
|
119
159
|
|
120
|
-
All 61+ components are now available:
|
160
|
+
🎯 All 61+ components are now available:
|
121
161
|
- Button, Alert, Card, Badge, Modal, Input
|
122
162
|
- Navigation: Navbar, Menu, Breadcrumbs, Tabs
|
123
163
|
- Data Display: Table, Stat, Timeline, Avatar
|
124
164
|
- Forms: Checkbox, Radio, Select, Toggle
|
125
165
|
- And many more...
|
126
166
|
|
127
|
-
Components are in vendor/daisyui_on_phlex/components/ and can be customized.
|
128
|
-
|
129
|
-
For documentation: https://github.com/jacob/daisyui-on-phlex
|
167
|
+
📁 Components are in vendor/daisyui_on_phlex/components/ and can be customized.
|
168
|
+
📚 For documentation: https://github.com/jacob/daisyui-on-phlex
|
130
169
|
|
131
170
|
TEXT
|
132
171
|
end
|