atomic_view 0.0.7 → 0.1.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.
- checksums.yaml +4 -4
- data/README.md +2 -14
- data/Rakefile +10 -0
- data/app/assets/config/atomic_view_manifest.js +3 -0
- data/app/assets/stylesheets/atomic_view/application.css +15 -0
- data/app/assets/stylesheets/atomic_view/application.tailwind.css +26 -0
- data/app/assets/tailwind/atomic_view/engine.css +25 -0
- data/app/controllers/atomic_view/application_controller.rb +6 -0
- data/app/controllers/atomic_view/lookbook_controller.rb +11 -0
- data/app/controllers/atomic_view/models_controller.rb +9 -0
- data/{lib/atomic_view/railtie.rb → app/helpers/atomic_view/application_helper.rb} +1 -1
- data/app/helpers/atomic_view/heroicons_helper.rb +14 -0
- data/app/jobs/atomic_view/application_job.rb +6 -0
- data/app/mailers/atomic_view/application_mailer.rb +8 -0
- data/app/models/atomic_view/application_record.rb +7 -0
- data/app/models/atomic_view/model.rb +7 -0
- data/app/views/layouts/atomic_view/application.html.erb +15 -0
- data/app/views/layouts/atomic_view/lookbook.html.erb +13 -0
- data/config/importmap.rb +3 -0
- data/config/routes.rb +4 -0
- data/config/tailwind.config.js +13 -0
- data/lib/atomic_view/configuration.rb +7 -0
- data/lib/atomic_view/engine.rb +38 -0
- data/lib/atomic_view/post_install.rb +10 -0
- data/lib/atomic_view/version.rb +1 -1
- data/lib/atomic_view.rb +17 -11
- data/lib/generators/atomic_view/install_generator.rb +43 -0
- data/lib/tasks/atomic_view_tasks.rake +6 -0
- data/lib/tasks/install.rake +13 -0
- metadata +41 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50345526674109809839b113ef0118c8830a6cbef9f81c25191c50f5b2796df6
|
4
|
+
data.tar.gz: de35f4bfdac1d689ceaa2c264c98d718f0f0ea5fd1bfb24c5059466ea3197689
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 243ba7f352a8c340e407058670a7e5b073479de0cd6d85458c1c3fd60a7c111d41d9b44120dd7f22141ec30009cd378f1f7be02e18814f56bb2c032c5d03ac88
|
7
|
+
data.tar.gz: e41d5ce855a1431c6d78ba09f6ff4e1ef5e15d8103965ce9e53d02e8eae495c5092baf7f408a2b2d9f9f370707bd5439d7bc6aa7792e178b6900a09e35c3cafe
|
data/README.md
CHANGED
@@ -15,20 +15,8 @@ gem "atomic_view"
|
|
15
15
|
bundle install
|
16
16
|
```
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
```js
|
21
|
-
const execSync = require("child_process").execSync;
|
22
|
-
const atomicViewPath =
|
23
|
-
execSync("bundle show atomic_view", { encoding: "utf-8" }).trim() +
|
24
|
-
"/lib/atomic_view/components/**/*.{erb,rb}";
|
25
|
-
|
26
|
-
module.exports = {
|
27
|
-
content: [
|
28
|
-
// other paths...
|
29
|
-
atomicViewPath,
|
30
|
-
],
|
31
|
-
};
|
18
|
+
```shell
|
19
|
+
rails atomic_view:install
|
32
20
|
```
|
33
21
|
|
34
22
|
## Getting Started
|
data/Rakefile
ADDED
@@ -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,26 @@
|
|
1
|
+
@import "tailwindcss" source(none);
|
2
|
+
@source "../../javascripts/**/*.js";
|
3
|
+
@source "../../../views/**/*.erb";
|
4
|
+
|
5
|
+
@plugin "@tailwindcss/forms";
|
6
|
+
@plugin "@tailwindcss/typography";
|
7
|
+
|
8
|
+
@custom-variant dark (&:where(.dark, .dark *));
|
9
|
+
|
10
|
+
/*
|
11
|
+
The default border color has changed to `currentColor` in Tailwind CSS v4,
|
12
|
+
so we've added these compatibility styles to make sure everything still
|
13
|
+
looks the same as it did with Tailwind CSS v3.
|
14
|
+
|
15
|
+
If we ever want to remove these styles, we need to add an explicit border
|
16
|
+
color utility to any element that depends on these defaults.
|
17
|
+
*/
|
18
|
+
@layer base {
|
19
|
+
*,
|
20
|
+
::after,
|
21
|
+
::before,
|
22
|
+
::backdrop,
|
23
|
+
::file-selector-button {
|
24
|
+
border-color: var(--color-gray-200, currentColor);
|
25
|
+
}
|
26
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
@import "tailwindcss" source(none);
|
2
|
+
@source "../../javascripts/**/*.js";
|
3
|
+
@source "../../../views/**/*.{erb}";
|
4
|
+
@source "../../../../lib/atomic_view//components/**/*.{erb,rb}";
|
5
|
+
|
6
|
+
@plugin "@tailwindcss/forms";
|
7
|
+
@plugin "@tailwindcss/typography";
|
8
|
+
|
9
|
+
/*
|
10
|
+
The default border color has changed to `currentColor` in Tailwind CSS v4,
|
11
|
+
so we've added these compatibility styles to make sure everything still
|
12
|
+
looks the same as it did with Tailwind CSS v3.
|
13
|
+
|
14
|
+
If we ever want to remove these styles, we need to add an explicit border
|
15
|
+
color utility to any element that depends on these defaults.
|
16
|
+
*/
|
17
|
+
@layer base {
|
18
|
+
*,
|
19
|
+
::after,
|
20
|
+
::before,
|
21
|
+
::backdrop,
|
22
|
+
::file-selector-button {
|
23
|
+
border-color: var(--color-gray-200, currentColor);
|
24
|
+
}
|
25
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AtomicView
|
4
|
+
module HeroiconsHelper
|
5
|
+
def icon(name, variant: Heroicons.configuration.variant, options: {}, path_options: {})
|
6
|
+
raw Heroicons::Icon.render(
|
7
|
+
name: name,
|
8
|
+
variant: variant,
|
9
|
+
options: options,
|
10
|
+
path_options: path_options
|
11
|
+
)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>AtomicView</title>
|
5
|
+
<%= csrf_meta_tags %>
|
6
|
+
<%= csp_meta_tag %>
|
7
|
+
<%= stylesheet_link_tag "atomic_view/tailwind", "data-turbo-track": "reload" %>
|
8
|
+
<%= javascript_importmap_tags %>
|
9
|
+
<%= javascript_import_module_tag "atomic_view/application" %>
|
10
|
+
<%= stylesheet_link_tag "atomic_view/application", media: "all" %>
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
<%= yield %>
|
14
|
+
</body>
|
15
|
+
</html>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>AtomicView</title>
|
5
|
+
<%= csrf_meta_tags %>
|
6
|
+
<%= csp_meta_tag %>
|
7
|
+
<%= stylesheet_link_tag "atomic_view/tailwind", "data-turbo-track": "reload" %>
|
8
|
+
<%= javascript_importmap_tags %>
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<%= yield %>
|
12
|
+
</body>
|
13
|
+
</html>
|
data/config/importmap.rb
ADDED
data/config/routes.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'importmap-rails'
|
4
|
+
|
5
|
+
module AtomicView
|
6
|
+
class Engine < ::Rails::Engine
|
7
|
+
isolate_namespace AtomicView
|
8
|
+
|
9
|
+
initializer 'local_helper.action_controller' do
|
10
|
+
ActiveSupport.on_load :action_controller do
|
11
|
+
helper AtomicView::HeroiconsHelper
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
initializer 'atomic_view.tailwindcss' do |app|
|
16
|
+
ActiveSupport.on_load(:tailwindcss_rails) do
|
17
|
+
config.tailwindcss_rails.engines << AtomicView::Engine.engine_name
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
initializer 'atomic_view.importmap', before: 'importmap' do |app|
|
23
|
+
app.config.importmap.paths << root.join('config/importmap.rb')
|
24
|
+
app.config.importmap.cache_sweepers << root.join('app/assets/javascripts')
|
25
|
+
end
|
26
|
+
|
27
|
+
initializer 'atomic_view.assets' do |app|
|
28
|
+
app.config.assets.precompile += %w[atomic_view_manifest]
|
29
|
+
end
|
30
|
+
|
31
|
+
initializer 'atomic_view.precompile' do |app|
|
32
|
+
app.config.assets.paths << root.join('app/assets/javascripts')
|
33
|
+
app.config.assets.precompile << 'atomic_view/application.js'
|
34
|
+
app.config.assets.paths << root.join('app/assets/dist')
|
35
|
+
app.config.assets.precompile << 'atomic_view/tailwind.css'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AtomicView
|
4
|
+
def self.post_install
|
5
|
+
puts 'AtomicView: Running post install tasks...'
|
6
|
+
rescue StandardError => e
|
7
|
+
puts "AtomicView: Failed to update Tailwind configuration. Error: #{e.message}"
|
8
|
+
puts "You may need to run 'bin/rails atomic_view:install' manually to complete the setup."
|
9
|
+
end
|
10
|
+
end
|
data/lib/atomic_view/version.rb
CHANGED
data/lib/atomic_view.rb
CHANGED
@@ -1,26 +1,32 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'atomic_view/version'
|
4
|
+
require 'atomic_view/engine'
|
5
|
+
require 'atomic_view/configuration'
|
6
|
+
|
5
7
|
require "tailwind_merge"
|
6
8
|
require "heroicons"
|
9
|
+
require "view_component"
|
7
10
|
require "view_component/form"
|
8
|
-
|
9
11
|
require "zeitwerk"
|
10
12
|
loader = Zeitwerk::Loader.for_gem
|
11
|
-
|
12
|
-
vcf_gem_dir = Gem::Specification.find_by_name("view_component-form").gem_dir
|
13
|
-
loader.push_dir File.join(vcf_gem_dir, "app", "components")
|
14
|
-
loader.push_dir File.join(vcf_gem_dir, "app", "components", "concerns")
|
15
|
-
|
13
|
+
loader.ignore("#{__dir__}/generators")
|
16
14
|
loader.setup
|
17
15
|
|
18
|
-
# Component library built for Ruby on Rails with first-class support for ActionView using ViewComponent.
|
19
16
|
module AtomicView
|
17
|
+
class << self
|
18
|
+
attr_accessor :configuration
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.configuration
|
22
|
+
@configuration ||= Configuration.new
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.configure
|
26
|
+
yield(configuration)
|
27
|
+
end
|
20
28
|
end
|
21
29
|
|
22
30
|
ViewComponent::Form.configure do |config|
|
23
31
|
config.parent_component = "AtomicView::Component"
|
24
32
|
end
|
25
|
-
|
26
|
-
loader.eager_load
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AtomicView
|
4
|
+
class InstallGenerator < Rails::Generators::Base
|
5
|
+
source_root File.expand_path('templates', __dir__)
|
6
|
+
|
7
|
+
IMPORT = '@import "../builds/tailwind/atomic_view.css";'.freeze
|
8
|
+
|
9
|
+
def add_atomic_view_tailwind
|
10
|
+
return if options[:update_tailwind_only]
|
11
|
+
|
12
|
+
tailwind_path = Rails.root.join('app/assets/tailwind/application.css')
|
13
|
+
unless tailwind_path.exist?
|
14
|
+
raise '`app/assets/tailwind/application.css` does not exist'
|
15
|
+
end
|
16
|
+
|
17
|
+
if tailwind_path.read.include?(IMPORT)
|
18
|
+
puts "`app/assets/tailwind/application.css` already contains `#{IMPORT}`"
|
19
|
+
else
|
20
|
+
insert_into_file tailwind_path, after: '@import "tailwindcss";' do
|
21
|
+
"\n#{IMPORT}\n"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def add_atomic_view_js_controllers
|
27
|
+
return if options[:update_tailwind_only]
|
28
|
+
|
29
|
+
controllers_path = Rails.root.join('app/javascript/controllers/index.js')
|
30
|
+
if controllers_path.exist? && controllers_path.read.include?('eagerLoadControllersFrom("controllers", application)')
|
31
|
+
if controllers_path.read.include?('eagerLoadControllersFrom("atomic_view", application)')
|
32
|
+
puts '`app/javascript/controllers/index.js` already contains `eagerLoadControllersFrom("atomic_view", application)`'
|
33
|
+
else
|
34
|
+
insert_into_file controllers_path, after: 'eagerLoadControllersFrom("controllers", application)' do
|
35
|
+
"\neagerLoadControllersFrom(\"atomic_view\", application)\n"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
else
|
39
|
+
puts '`app/javascript/controllers/index.js` does not exist or does not contain `eagerLoadControllersFrom("controllers", application)`'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
namespace :atomic_view do
|
4
|
+
desc 'Installs AtomicView'
|
5
|
+
task install: :environment do
|
6
|
+
Rails::Command.invoke :generate, ['atomic_view:install']
|
7
|
+
end
|
8
|
+
|
9
|
+
desc 'Updates Tailwind configuration'
|
10
|
+
task update_tailwind: :environment do
|
11
|
+
Rails::Command.invoke :generate, %w[atomic_view:install --update-tailwind-only]
|
12
|
+
end
|
13
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: atomic_view
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Warrington
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-07-
|
11
|
+
date: 2025-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: zeitwerk
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 2.7.2
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: importmap-rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.0.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.0.1
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rails
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -104,6 +118,25 @@ files:
|
|
104
118
|
- CHANGELOG.md
|
105
119
|
- LICENSE.txt
|
106
120
|
- README.md
|
121
|
+
- Rakefile
|
122
|
+
- app/assets/config/atomic_view_manifest.js
|
123
|
+
- app/assets/stylesheets/atomic_view/application.css
|
124
|
+
- app/assets/stylesheets/atomic_view/application.tailwind.css
|
125
|
+
- app/assets/tailwind/atomic_view/engine.css
|
126
|
+
- app/controllers/atomic_view/application_controller.rb
|
127
|
+
- app/controllers/atomic_view/lookbook_controller.rb
|
128
|
+
- app/controllers/atomic_view/models_controller.rb
|
129
|
+
- app/helpers/atomic_view/application_helper.rb
|
130
|
+
- app/helpers/atomic_view/heroicons_helper.rb
|
131
|
+
- app/jobs/atomic_view/application_job.rb
|
132
|
+
- app/mailers/atomic_view/application_mailer.rb
|
133
|
+
- app/models/atomic_view/application_record.rb
|
134
|
+
- app/models/atomic_view/model.rb
|
135
|
+
- app/views/layouts/atomic_view/application.html.erb
|
136
|
+
- app/views/layouts/atomic_view/lookbook.html.erb
|
137
|
+
- config/importmap.rb
|
138
|
+
- config/routes.rb
|
139
|
+
- config/tailwind.config.js
|
107
140
|
- lib/atomic_view.rb
|
108
141
|
- lib/atomic_view/component.rb
|
109
142
|
- lib/atomic_view/components/button_component.rb
|
@@ -137,9 +170,14 @@ files:
|
|
137
170
|
- lib/atomic_view/components/url_field_component.rb
|
138
171
|
- lib/atomic_view/components/week_field_component.rb
|
139
172
|
- lib/atomic_view/components/weekday_select_component.rb
|
173
|
+
- lib/atomic_view/configuration.rb
|
174
|
+
- lib/atomic_view/engine.rb
|
140
175
|
- lib/atomic_view/form_builder.rb
|
141
|
-
- lib/atomic_view/
|
176
|
+
- lib/atomic_view/post_install.rb
|
142
177
|
- lib/atomic_view/version.rb
|
178
|
+
- lib/generators/atomic_view/install_generator.rb
|
179
|
+
- lib/tasks/atomic_view_tasks.rake
|
180
|
+
- lib/tasks/install.rake
|
143
181
|
homepage: https://github.com/joelzwarrington/atomic_view
|
144
182
|
licenses:
|
145
183
|
- MIT
|