rails_icons 0.3.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6c3ee60bafe9a9cffae818c8304e8a69abf56d8de147ff607db5d775137ab5ea
4
- data.tar.gz: afacf89281c87e029a0866860ef6edf1a738e06d5918b5254524c2bbe803bbd3
3
+ metadata.gz: 3b822f3cdeb49bbe4e7d23109b89d0508e4b23e39c5da7b1c26a633977744b6f
4
+ data.tar.gz: 0becd12bf8f1a1ce9ae6f35877cb8c0ef936d8b6e2693d04849c8716fccb8c7e
5
5
  SHA512:
6
- metadata.gz: f1f4ed187c437220dc0b081dbddb95f1204f65a30dca2b89c4b72aba7574888d5adee9766a69821ecb26d2f9e9adff2e78d8b585ec7f639dd8d9754b0cb9296f
7
- data.tar.gz: e195bd6ade61e3018a478852d293c8437d0c0490c5d8727d774098c98a10189b4be7d982f73ebb191ce5486a947f46c424265f46fe79fec3fe03ae3e45be543a
6
+ metadata.gz: b34876d807ff8d3bb63faae9cb71d9a5527eee3543b1ce8b37034fe7719e8420149a202c3d1be2b0251d04fa7ebc0e52d0b6628570a045b8c469f84d56e3aace
7
+ data.tar.gz: 81f8bd92e599e2fa2ff1421ab75ff334728f06792063dfd7ae2a74a0559ae5b73778192e64c1d772ea1fb2e2cb32e43cecd809e0985d91f3386488f9f87d0810
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_icons (0.3.0)
4
+ rails_icons (0.4.0)
5
5
  nokogiri (~> 1.16, >= 1.16.4)
6
6
  rails (> 6.1)
7
7
 
data/README.md CHANGED
@@ -110,6 +110,11 @@ icon "reddit", library: "simple_icons", set: "solid"
110
110
  ```
111
111
 
112
112
 
113
+ ## Contributing
114
+
115
+ This project uses [Standard](https://github.com/testdouble/standard) for formatting Ruby code. Please make sure to run `be standardrb` before submitting pull requests. Run tests via `rails test`.
116
+
117
+
113
118
  ## License
114
119
 
115
120
  Rails Icons is released under the [MIT License](https://opensource.org/licenses/MIT).
@@ -1,4 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RailsIcons
4
+ # Copies the initializer template to your Rails project
2
5
  class InitializerGenerator < Rails::Generators::Base
3
6
  source_root File.expand_path("templates", __dir__)
4
7
 
@@ -4,9 +4,10 @@ module RailsIcons
4
4
  class SyncGenerator < Rails::Generators::Base
5
5
  ICON_VAULT_REPO_URL = "https://github.com/Rails-Designer/rails_icons_vault.git".freeze
6
6
 
7
- argument :libraries, type: :array, default: [], banner: "heroicons lucide"
7
+ argument :libraries, type: :array, default: [], banner: "heroicons lucide tabler"
8
8
 
9
- class_option :destination, type: :string, default: nil, desc: "Custom destination folder for icons (default: `app/assets/svg/icons/`)"
9
+ class_option :destination, type: :string, default: nil,
10
+ desc: "Custom destination folder for icons (default: `app/assets/svg/icons/`)"
10
11
 
11
12
  desc "Sync a specified icon set(s) from the Rails Icons Vault (https://github.com/Rails-Designer/rails_icons_vault)"
12
13
  source_root File.expand_path("templates", __dir__)
@@ -1,6 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "icon_configs/heroicons_config"
4
+ require_relative "icon_configs/lucide_config"
5
+ require_relative "icon_configs/tabler_config"
6
+
3
7
  module RailsIcons
8
+ # Configuration defines the available configuration options available for each of the icons sets
9
+ # as well as sets the defaults to heroicons
4
10
  class Configuration
5
11
  def initialize
6
12
  @config = ActiveSupport::OrderedOptions.new
@@ -32,43 +38,9 @@ module RailsIcons
32
38
  def set_libraries_config
33
39
  @config.libraries = ActiveSupport::OrderedOptions.new
34
40
 
35
- heroicons_config
36
- lucide_config
37
- end
38
-
39
- def heroicons_config
40
- @config.libraries.heroicons = ActiveSupport::OrderedOptions.new
41
-
42
- @config.libraries.heroicons.solid = ActiveSupport::OrderedOptions.new
43
- @config.libraries.heroicons.solid.default = ActiveSupport::OrderedOptions.new
44
- @config.libraries.heroicons.solid.default.css = "w-6 h-6"
45
- @config.libraries.heroicons.solid.default.data = {}
46
-
47
- @config.libraries.heroicons.outline = ActiveSupport::OrderedOptions.new
48
- @config.libraries.heroicons.outline.default = ActiveSupport::OrderedOptions.new
49
- @config.libraries.heroicons.outline.default.stroke_width = 1.5
50
- @config.libraries.heroicons.outline.default.css = "w-6 h-6"
51
- @config.libraries.heroicons.outline.default.data = {}
52
-
53
- @config.libraries.heroicons.mini = ActiveSupport::OrderedOptions.new
54
- @config.libraries.heroicons.mini.default = ActiveSupport::OrderedOptions.new
55
- @config.libraries.heroicons.mini.default.css = "w-5 h-5"
56
- @config.libraries.heroicons.mini.default.data = {}
57
-
58
- @config.libraries.heroicons.micro = ActiveSupport::OrderedOptions.new
59
- @config.libraries.heroicons.micro.default = ActiveSupport::OrderedOptions.new
60
- @config.libraries.heroicons.micro.default.css = "w-4 h-4"
61
- @config.libraries.heroicons.micro.default.data = {}
62
- end
63
-
64
- def lucide_config
65
- @config.libraries.lucide = ActiveSupport::OrderedOptions.new
66
-
67
- @config.libraries.lucide.outline = ActiveSupport::OrderedOptions.new
68
- @config.libraries.lucide.outline.default = ActiveSupport::OrderedOptions.new
69
- @config.libraries.lucide.outline.default.stroke_width = 2
70
- @config.libraries.lucide.outline.default.css = "w-6 h-6"
71
- @config.libraries.lucide.outline.default.data = {}
41
+ @config.libraries.heroicons = HeroiconsConfig.new.config
42
+ @config.libraries.lucide = LucideConfig.new.config
43
+ @config.libraries.tabler = TablerConfig.new.config
72
44
  end
73
45
  end
74
46
  end
@@ -4,6 +4,7 @@ require_relative "../configuration"
4
4
 
5
5
  module RailsIcons
6
6
  module Helpers
7
+ # Define the "icon" helper to generate and display icons
7
8
  module IconHelper
8
9
  def icon(name, library: RailsIcons.configuration.default_library, set: nil, **args)
9
10
  RailsIcons::Icon.new(
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RailsIcons
2
4
  class Icon
3
5
  class Attributes
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RailsIcons
4
+ # Defines the configuration options for the heroicons icon pack
5
+ class HeroiconsConfig
6
+ def config
7
+ options = ActiveSupport::OrderedOptions.new
8
+ setup_heroicons_outline_config(options)
9
+ setup_heroicons_solid_config(options)
10
+ setup_heroicons_mini_config(options)
11
+ setup_heroicons_micro_config(options)
12
+ options
13
+ end
14
+
15
+ private
16
+
17
+ def setup_heroicons_solid_config(options)
18
+ options.solid = ActiveSupport::OrderedOptions.new
19
+ options.solid.default = default_solid_options
20
+ end
21
+
22
+ def setup_heroicons_outline_config(options)
23
+ options.outline = ActiveSupport::OrderedOptions.new
24
+ options.outline.default = default_outline_options
25
+ end
26
+
27
+ def setup_heroicons_mini_config(options)
28
+ options.mini = ActiveSupport::OrderedOptions.new
29
+ options.mini.default = default_mini_options
30
+ end
31
+
32
+ def setup_heroicons_micro_config(options)
33
+ options.micro = ActiveSupport::OrderedOptions.new
34
+ options.micro.default = default_micro_options
35
+ end
36
+
37
+ def default_solid_options
38
+ options = ActiveSupport::OrderedOptions.new
39
+ options.css = "w-6 h-6"
40
+ options.data = {}
41
+ options
42
+ end
43
+
44
+ def default_outline_options
45
+ options = ActiveSupport::OrderedOptions.new
46
+ options.stroke_width = 1.5
47
+ options.css = "w-6 h-6"
48
+ options.data = {}
49
+ options
50
+ end
51
+
52
+ def default_mini_options
53
+ options = ActiveSupport::OrderedOptions.new
54
+ options.css = "w-5 h-5"
55
+ options.data = {}
56
+ options
57
+ end
58
+
59
+ def default_micro_options
60
+ options = ActiveSupport::OrderedOptions.new
61
+ options.css = "w-4 h-4"
62
+ options.data = {}
63
+ options
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RailsIcons
4
+ # Defines the configuration options for the Lucide icon pack
5
+ class LucideConfig
6
+ def config
7
+ options = ActiveSupport::OrderedOptions.new
8
+ setup_lucide_outlined_config(options)
9
+
10
+ options
11
+ end
12
+
13
+ private
14
+
15
+ def setup_lucide_outlined_config(options)
16
+ options.outline = ActiveSupport::OrderedOptions.new
17
+ options.outline.default = default_outlined_options
18
+ end
19
+
20
+ def default_outlined_options
21
+ options = ActiveSupport::OrderedOptions.new
22
+ options.stroke_width = "1.5"
23
+ options.css = "w-6 h-6"
24
+ options.data = {}
25
+ options
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RailsIcons
4
+ # Defines the configuration options for the Tabler icon pack
5
+ class TablerConfig
6
+ def config
7
+ options = ActiveSupport::OrderedOptions.new
8
+ setup_tabler_filled_config(options)
9
+ setup_tabler_outline_config(options)
10
+
11
+ options
12
+ end
13
+
14
+ private
15
+
16
+ def setup_tabler_filled_config(options)
17
+ options.filled = ActiveSupport::OrderedOptions.new
18
+ options.filled.default = default_filled_options
19
+ end
20
+
21
+ def setup_tabler_outline_config(options)
22
+ options.outline = ActiveSupport::OrderedOptions.new
23
+ options.outline.default = default_outline_options
24
+ end
25
+
26
+ def default_filled_options
27
+ options = ActiveSupport::OrderedOptions.new
28
+ options.css = "w-6 h-6"
29
+ options.data = {}
30
+ options
31
+ end
32
+
33
+ def default_outline_options
34
+ options = ActiveSupport::OrderedOptions.new
35
+ options.stroke_width = 2
36
+ options.css = "w-6 h-6"
37
+ options.data = {}
38
+ options
39
+ end
40
+ end
41
+ end
@@ -1,3 +1,3 @@
1
1
  module RailsIcons
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_icons
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rails Designer Developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-10 00:00:00.000000000 Z
11
+ date: 2024-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -70,6 +70,9 @@ files:
70
70
  - lib/rails_icons/helpers/icon_helper.rb
71
71
  - lib/rails_icons/icon.rb
72
72
  - lib/rails_icons/icon/attributes.rb
73
+ - lib/rails_icons/icon_configs/heroicons_config.rb
74
+ - lib/rails_icons/icon_configs/lucide_config.rb
75
+ - lib/rails_icons/icon_configs/tabler_config.rb
73
76
  - lib/rails_icons/railtie.rb
74
77
  - lib/rails_icons/version.rb
75
78
  - rails_icons.gemspec
@@ -94,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
97
  - !ruby/object:Gem::Version
95
98
  version: '0'
96
99
  requirements: []
97
- rubygems_version: 3.5.15
100
+ rubygems_version: 3.5.21
98
101
  signing_key:
99
102
  specification_version: 4
100
103
  summary: Add icons from multiple icons in your Rails app