rails_pulse 0.2.5.pre.12 → 0.2.5.pre.13

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: 14471ad08eb69ba71cfa596ede0a58f1638a5d17cd6ff18c161ada4fc92524a8
4
- data.tar.gz: d823c824b84c21b6b3b6b6eec433d1b7774b60c14e5ec6b1a4a54b32886499b4
3
+ metadata.gz: 87e2202480962f4a5735a53b9b54bbb0b0451e946e8a6d85a4ca210bf2c1e06b
4
+ data.tar.gz: 50278863c4fede9a3035637542cec66ea1cf399768136ae21301015cc1de5bd9
5
5
  SHA512:
6
- metadata.gz: bb0ea2202d39365fe7a6751090a888909479336d7c3b1977b8095cb0cddae8f00d896be95d53c8c402e03ee34b477127192fc5f9873c008e8d4ca11944467fcc
7
- data.tar.gz: c1db7e38744e0476a629be2d88e0e5adf66bbd23a2db93c0657512de19d7aefe003270eb39d53d61f7d9d9b72634afaf7de10e89d650a697e85d9abaed6a353f
6
+ metadata.gz: 54fb3f0409b7f83c25ab0d03d52675d1ed19900ee5ec251b8c4499f71cd2e2d371ccdf0aec3ca1756535c4d49be8f43dd48718818bb5d90456d1c5c34da7dabf
7
+ data.tar.gz: 875b12636d95f8afa12f977841d0f6fb11f5303339d00e22c477211a234ac2e624feeee2048198479c5ce56b4996a18006508924ab4f19a263d94a7df80c1a29
data/Rakefile CHANGED
@@ -365,14 +365,39 @@ task :test_release do
365
365
  puts "-" * 70
366
366
  sh "npm run build"
367
367
 
368
- # Verify assets were built
369
- assets_dir = "public/rails-pulse-assets"
370
- if Dir.exist?(assets_dir) && !Dir.empty?(assets_dir)
371
- puts "✅ Assets built successfully!"
372
- puts " Location: #{assets_dir}"
368
+ # Verify assets were built in both locations
369
+ public_assets = "public/rails-pulse-assets"
370
+ vendor_css = "vendor/assets/stylesheets"
371
+ vendor_js = "vendor/assets/javascripts"
372
+
373
+ all_dirs_valid = true
374
+
375
+ if Dir.exist?(public_assets) && !Dir.empty?(public_assets)
376
+ puts "✅ Public assets built: #{public_assets}"
377
+ else
378
+ puts "❌ Public assets directory is missing or empty!"
379
+ failed_tasks << "public_assets_verification"
380
+ all_dirs_valid = false
381
+ end
382
+
383
+ if Dir.exist?(vendor_css) && !Dir.empty?(vendor_css)
384
+ puts "✅ Vendor CSS built: #{vendor_css}"
373
385
  else
374
- puts "❌ Assets directory is missing or empty!"
375
- failed_tasks << "asset_build_verification"
386
+ puts "❌ Vendor CSS directory is missing or empty!"
387
+ failed_tasks << "vendor_css_verification"
388
+ all_dirs_valid = false
389
+ end
390
+
391
+ if Dir.exist?(vendor_js) && !Dir.empty?(vendor_js)
392
+ puts "✅ Vendor JS built: #{vendor_js}"
393
+ else
394
+ puts "❌ Vendor JS directory is missing or empty!"
395
+ failed_tasks << "vendor_js_verification"
396
+ all_dirs_valid = false
397
+ end
398
+
399
+ if all_dirs_valid
400
+ puts "✅ All assets built successfully!"
376
401
  end
377
402
  rescue => e
378
403
  puts "❌ Asset building failed!"
@@ -94,9 +94,25 @@ module RailsPulse
94
94
  RailsPulse::Engine.routes.url_helpers.respond_to?(method, include_private) || super
95
95
  end
96
96
 
97
- # Generate asset paths that work with our custom asset serving
97
+ # Generate asset paths using Rails asset pipeline
98
+ # This allows assets to work with CDN, digests, and precompiled manifests
98
99
  def asset_path(asset_name)
99
- "/rails-pulse-assets/#{asset_name}"
100
+ # Only use asset pipeline if we have Sprockets/Propshaft configured
101
+ # Otherwise fall back to middleware serving
102
+ if defined?(::Sprockets) || defined?(::Propshaft)
103
+ # Use the main application's asset_path helper to ensure we get
104
+ # the correct digested paths from the precompiled manifest
105
+ begin
106
+ ActionController::Base.helpers.asset_path(asset_name)
107
+ rescue => e
108
+ # Fallback to direct path if asset pipeline is not available
109
+ Rails.logger.warn "[Rails Pulse] Asset pipeline error for #{asset_name}: #{e.message}"
110
+ "/rails-pulse-assets/#{asset_name}"
111
+ end
112
+ else
113
+ # No asset pipeline - use middleware serving
114
+ "/rails-pulse-assets/#{asset_name}"
115
+ end
100
116
  end
101
117
  end
102
118
 
@@ -45,12 +45,26 @@ module RailsPulse
45
45
  require "generators/rails_pulse/install_generator"
46
46
  end
47
47
 
48
- initializer "rails_pulse.static_assets", before: "sprockets.environment" do |app|
49
- # Configure Rack::Static middleware to serve pre-compiled assets
50
- assets_path = Engine.root.join("public")
48
+ initializer "rails_pulse.assets" do |app|
49
+ # Register Rails Pulse assets with Sprockets for production/CDN deployment
50
+ if app.config.respond_to?(:assets)
51
+ # Add vendor assets to the asset pipeline
52
+ app.config.assets.paths << Engine.root.join("vendor", "assets", "stylesheets").to_s
53
+ app.config.assets.paths << Engine.root.join("vendor", "assets", "javascripts").to_s
54
+
55
+ # Register bundled assets for precompilation
56
+ if defined?(::Sprockets)
57
+ app.config.assets.precompile += %w[
58
+ rails-pulse.css
59
+ rails-pulse.js
60
+ rails-pulse-icons.js
61
+ ]
62
+ end
63
+ end
51
64
 
52
- # Add custom middleware for serving Rails Pulse assets with proper headers
53
- # Insert after Rack::Runtime but before ActionDispatch::Static for better compatibility
65
+ # Fallback: Add middleware for development/non-CDN setups
66
+ # This serves assets directly when not using precompiled manifest
67
+ assets_path = Engine.root.join("public")
54
68
  app.middleware.insert_after Rack::Runtime, RailsPulse::Middleware::AssetServer,
55
69
  assets_path.to_s,
56
70
  {
@@ -1,3 +1,3 @@
1
1
  module RailsPulse
2
- VERSION = "0.2.5.pre.12"
2
+ VERSION = "0.2.5.pre.13"
3
3
  end
@@ -0,0 +1,150 @@
1
+ # CSS Zero Vendoring Documentation
2
+
3
+ This document describes the process for vendoring CSS Zero dependencies for Rails Pulse asset independence.
4
+
5
+ ## Overview
6
+
7
+ Rails Pulse vendors CSS Zero files to eliminate external gem dependencies during asset compilation. This ensures the build system can function independently without requiring the `css-zero` gem to be installed.
8
+
9
+ ## Current CSS Zero Version
10
+
11
+ **Vendored Version**: 1.1.5
12
+ **Vendored Date**: 2025-07-02
13
+ **Source**: `css-zero` gem (https://github.com/lazaronixon/css-zero)
14
+
15
+ ## Directory Structure
16
+
17
+ ```
18
+ vendor/css-zero/
19
+ ├── reset.css # CSS reset and base styles
20
+ ├── colors.css # Color variables and utilities
21
+ ├── sizes.css # Size and spacing variables
22
+ ├── borders.css # Border variables and utilities
23
+ ├── effects.css # Shadow and effect variables
24
+ ├── typography.css # Font and text variables
25
+ ├── animations.css # Animation keyframes and utilities
26
+ ├── transforms.css # Transform utilities
27
+ ├── transitions.css # Transition utilities
28
+ ├── filters.css # Filter utilities
29
+ ├── utilities.css # All utility classes
30
+ └── variables.css # Master import file (not used in build)
31
+ ```
32
+
33
+ ## Build Integration
34
+
35
+ The CSS build system (`scripts/build-css.js`) includes CSS Zero files in this order:
36
+
37
+ 1. **CSS Zero Reset** (`reset.css`)
38
+ 2. **CSS Zero Variables** (9 component files):
39
+ - `colors.css`
40
+ - `sizes.css`
41
+ - `borders.css`
42
+ - `effects.css`
43
+ - `typography.css`
44
+ - `animations.css`
45
+ - `transforms.css`
46
+ - `transitions.css`
47
+ - `filters.css`
48
+ 3. **Rails Pulse Components** (all files in `app/assets/stylesheets/rails_pulse/components/`)
49
+ 4. **Rails Pulse Application CSS** (`app/assets/stylesheets/rails_pulse/application.css`)
50
+ 5. **CSS Zero Utilities** (`utilities.css`)
51
+
52
+ ## Updating CSS Zero
53
+
54
+ To update the vendored CSS Zero files:
55
+
56
+ ### 1. Update CSS Zero Gem
57
+
58
+ ```bash
59
+ # Update Gemfile or gemspec with new version
60
+ bundle update css-zero
61
+ ```
62
+
63
+ ### 2. Find New CSS Zero Path
64
+
65
+ ```bash
66
+ bundle show css-zero
67
+ # Example output: /path/to/gems/css-zero-X.Y.Z
68
+ ```
69
+
70
+ ### 3. Copy New Files
71
+
72
+ ```bash
73
+ # Remove old vendored files
74
+ rm -rf vendor/css-zero
75
+
76
+ # Create directory
77
+ mkdir -p vendor/css-zero
78
+
79
+ # Copy new CSS files
80
+ cp /path/to/gems/css-zero-X.Y.Z/app/assets/stylesheets/css-zero/*.css vendor/css-zero/
81
+ ```
82
+
83
+ ### 4. Verify File Structure
84
+
85
+ Ensure these files exist:
86
+ - `reset.css`
87
+ - `colors.css`
88
+ - `sizes.css`
89
+ - `borders.css`
90
+ - `effects.css`
91
+ - `typography.css`
92
+ - `animations.css`
93
+ - `transforms.css`
94
+ - `transitions.css`
95
+ - `filters.css`
96
+ - `utilities.css`
97
+ - `variables.css` (not used in build, but included for completeness)
98
+
99
+ ### 5. Test Build System
100
+
101
+ ```bash
102
+ # Test CSS build
103
+ npm run build:css
104
+
105
+ # Test complete build
106
+ npm run build
107
+
108
+ # Verify bundle size and content
109
+ ls -la public/rails-pulse-assets/rails-pulse.css
110
+ ```
111
+
112
+ ### 6. Update Documentation
113
+
114
+ - Update version number in this file
115
+ - Update vendored date
116
+ - Note any breaking changes or new features
117
+ - Update ASSET_PIPELINE.md if build order changes
118
+
119
+ ## Verification Checklist
120
+
121
+ After updating CSS Zero:
122
+
123
+ - [ ] All CSS files copied successfully
124
+ - [ ] Build system completes without errors
125
+ - [ ] CSS bundle includes all expected utilities
126
+ - [ ] Rails Pulse styling works correctly
127
+ - [ ] No missing CSS variables or utilities
128
+ - [ ] Bundle size is reasonable (typically 50-60KB)
129
+
130
+ ## Breaking Changes
131
+
132
+ When updating CSS Zero, watch for:
133
+
134
+ - **Removed utilities**: Check if any CSS classes used by Rails Pulse were removed
135
+ - **Variable changes**: Ensure CSS custom properties haven't changed names
136
+ - **File structure changes**: Verify all expected CSS files are still present
137
+ - **Import dependencies**: Check if new files need to be added to the build order
138
+
139
+ ## Support
140
+
141
+ If you encounter issues with vendored CSS Zero:
142
+
143
+ 1. Check the CSS Zero repository for changelog: https://github.com/lazaronixon/css-zero
144
+ 2. Verify all files are properly copied and accessible
145
+ 3. Test the build system with a clean npm run build
146
+ 4. Compare bundle size and content with previous versions
147
+
148
+ ## License
149
+
150
+ CSS Zero is licensed under the MIT License. The vendored files retain their original license headers.
@@ -0,0 +1,91 @@
1
+ // Rails Pulse Icons Bundle - Auto-generated
2
+ // Contains 35 SVG icons for Rails Pulse
3
+
4
+ (function() {
5
+ 'use strict';
6
+
7
+ // Icon data
8
+ const icons = {
9
+ "menu": "<path d=\"M4 5h16\" /><path d=\"M4 12h16\" /><path d=\"M4 19h16\" />",
10
+ "sun": "<circle cx=\"12\" cy=\"12\" r=\"4\" /><path d=\"M12 2v2\" /><path d=\"M12 20v2\" /><path d=\"m4.93 4.93 1.41 1.41\" /><path d=\"m17.66 17.66 1.41 1.41\" /><path d=\"M2 12h2\" /><path d=\"M20 12h2\" /><path d=\"m6.34 17.66-1.41 1.41\" /><path d=\"m19.07 4.93-1.41 1.41\" />",
11
+ "moon": "<path d=\"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401\" />",
12
+ "chevron-right": "<path d=\"m9 18 6-6-6-6\" />",
13
+ "chevron-left": "<path d=\"m15 18-6-6 6-6\" />",
14
+ "chevron-down": "<path d=\"m6 9 6 6 6-6\" />",
15
+ "chevron-up": "<path d=\"m18 15-6-6-6 6\" />",
16
+ "chevrons-left": "<path d=\"m11 17-5-5 5-5\" /><path d=\"m18 17-5-5 5-5\" />",
17
+ "chevrons-right": "<path d=\"m6 17 5-5-5-5\" /><path d=\"m13 17 5-5-5-5\" />",
18
+ "loader-circle": "<path d=\"M12 2v4\" /><path d=\"m16.2 7.8 2.9-2.9\" /><path d=\"M18 12h4\" /><path d=\"m16.2 16.2 2.9 2.9\" /><path d=\"M12 18v4\" /><path d=\"m4.9 19.1 2.9-2.9\" /><path d=\"M2 12h4\" /><path d=\"m4.9 4.9 2.9 2.9\" />",
19
+ "search": "<path d=\"m21 21-4.34-4.34\" /><circle cx=\"11\" cy=\"11\" r=\"8\" />",
20
+ "list-filter": "<path d=\"M2 5h20\" /><path d=\"M6 12h12\" /><path d=\"M9 19h6\" />",
21
+ "list-filter-plus": "<path d=\"M12 5H2\" /><path d=\"M6 12h12\" /><path d=\"M9 19h6\" /><path d=\"M16 5h6\" /><path d=\"M19 8V2\" />",
22
+ "x": "<path d=\"M18 6 6 18\" /><path d=\"m6 6 12 12\" />",
23
+ "x-circle": "<circle cx=\"12\" cy=\"12\" r=\"10\" /><path d=\"m15 9-6 6\" /><path d=\"m9 9 6 6\" />",
24
+ "check": "<path d=\"M20 6 9 17l-5-5\" />",
25
+ "alert-circle": "<circle cx=\"12\" cy=\"12\" r=\"10\" /><line x1=\"12\" x2=\"12\" y1=\"8\" y2=\"12\" /><line x1=\"12\" x2=\"12.01\" y1=\"16\" y2=\"16\" />",
26
+ "alert-triangle": "<path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\" /><path d=\"M12 9v4\" /><path d=\"M12 17h.01\" />",
27
+ "info": "<circle cx=\"12\" cy=\"12\" r=\"10\" /><path d=\"M12 16v-4\" /><path d=\"M12 8h.01\" />",
28
+ "external-link": "<path d=\"M15 3h6v6\" /><path d=\"M10 14 21 3\" /><path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\" />",
29
+ "download": "<path d=\"M12 15V3\" /><path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\" /><path d=\"m7 10 5 5 5-5\" />",
30
+ "refresh-cw": "<path d=\"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8\" /><path d=\"M21 3v5h-5\" /><path d=\"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16\" /><path d=\"M8 16H3v5\" />",
31
+ "clock": "<path d=\"M12 6v6l4 2\" /><circle cx=\"12\" cy=\"12\" r=\"10\" />",
32
+ "database": "<ellipse cx=\"12\" cy=\"5\" rx=\"9\" ry=\"3\" /><path d=\"M3 5V19A9 3 0 0 0 21 19V5\" /><path d=\"M3 12A9 3 0 0 0 21 12\" />",
33
+ "server": "<rect width=\"20\" height=\"8\" x=\"2\" y=\"2\" rx=\"2\" ry=\"2\" /><rect width=\"20\" height=\"8\" x=\"2\" y=\"14\" rx=\"2\" ry=\"2\" /><line x1=\"6\" x2=\"6.01\" y1=\"6\" y2=\"6\" /><line x1=\"6\" x2=\"6.01\" y1=\"18\" y2=\"18\" />",
34
+ "activity": "<path d=\"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2\" />",
35
+ "layout-dashboard": "<rect width=\"7\" height=\"9\" x=\"3\" y=\"3\" rx=\"1\" /><rect width=\"7\" height=\"5\" x=\"14\" y=\"3\" rx=\"1\" /><rect width=\"7\" height=\"9\" x=\"14\" y=\"12\" rx=\"1\" /><rect width=\"7\" height=\"5\" x=\"3\" y=\"16\" rx=\"1\" />",
36
+ "audio-lines": "<path d=\"M2 10v3\" /><path d=\"M6 6v11\" /><path d=\"M10 3v18\" /><path d=\"M14 8v7\" /><path d=\"M18 5v13\" /><path d=\"M22 10v3\" />",
37
+ "message-circle-question": "<path d=\"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719\" /><path d=\"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3\" /><path d=\"M12 17h.01\" />",
38
+ "route": "<circle cx=\"6\" cy=\"19\" r=\"3\" /><path d=\"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15\" /><circle cx=\"18\" cy=\"5\" r=\"3\" />",
39
+ "trending-up": "<path d=\"M16 7h6v6\" /><path d=\"m22 7-8.5 8.5-5-5L2 17\" />",
40
+ "trending-down": "<path d=\"M16 17h6v-6\" /><path d=\"m22 17-8.5-8.5-5 5L2 7\" />",
41
+ "move-right": "<path d=\"M18 8L22 12L18 16\" /><path d=\"M2 12H22\" />",
42
+ "eye": "<path d=\"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0\" /><circle cx=\"12\" cy=\"12\" r=\"3\" />",
43
+ "zap": "<path d=\"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z\" />"
44
+ };
45
+
46
+ // Global icon registry
47
+ window.RailsPulseIcons = {
48
+ icons: icons,
49
+
50
+ // Get icon SVG content
51
+ get: function(name) {
52
+ return icons[name] || null;
53
+ },
54
+
55
+ // Check if icon exists
56
+ has: function(name) {
57
+ return name in icons;
58
+ },
59
+
60
+ // Get all icon names
61
+ list: function() {
62
+ return Object.keys(icons);
63
+ },
64
+
65
+ // Render icon to element (CSP-safe)
66
+ render: function(name, element, options = {}) {
67
+ const svgContent = this.get(name);
68
+ if (!svgContent || !element) return false;
69
+
70
+ // Create SVG element
71
+ const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
72
+ svg.setAttribute('width', options.width || '24');
73
+ svg.setAttribute('height', options.height || '24');
74
+ svg.setAttribute('viewBox', '0 0 24 24');
75
+ svg.setAttribute('fill', 'none');
76
+ svg.setAttribute('stroke', 'currentColor');
77
+ svg.setAttribute('stroke-width', '2');
78
+ svg.setAttribute('stroke-linecap', 'round');
79
+ svg.setAttribute('stroke-linejoin', 'round');
80
+
81
+ // Add icon content
82
+ svg.innerHTML = svgContent;
83
+
84
+ // Replace element content
85
+ element.innerHTML = '';
86
+ element.appendChild(svg);
87
+
88
+ return true;
89
+ }
90
+ };
91
+ })();