ascona 0.1.0 → 0.1.2

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: 8287078537d984be67b63cfdce58534dbe6614bb5c917c8051caa4b9ee6183f4
4
- data.tar.gz: 1393e656146786b20803a5723a2df72568bb32e1a5da3259e869e7f282b7ad1d
3
+ metadata.gz: e552faf28b1003107b30f7a4cfa0463d50eeba70c3d4c54b7cf7da216e4e6a37
4
+ data.tar.gz: c920983c5eead44035bf32df7741951778131df9450d66ef256568c2adffb183
5
5
  SHA512:
6
- metadata.gz: e7aa21e79c9d161f1be827e30920842e8d7caf7425fa79cc27b593228a7b5f94259fd910cfba83144df8403da8efdef82fa735a4f9dfe9e6c492701e65a4c256
7
- data.tar.gz: f7acf773a8c162fed5170d03efb7026b9a013734c6bfce73aea2bef1e91677d51b6e83c40a5ba18703beffe0e09059d1903e4c7e4f649cff3074869479b5115d
6
+ metadata.gz: 815c00c080456a6bfcf54a85104e91cd702f80f784b856a9398e3630245a9e30cf7e7a2d9141988566f8f71337ecc4d4a92be487d835acfef8cb8078232e1d0b
7
+ data.tar.gz: 276f173cd17cb4a93da418dedebb1fbbe75ccaad00ee14895cebe79b7c35e0c0295e4de6b33e4956e2a97ea77479ce40e90fe53f7871111e4a3efc7438cc7a41
@@ -0,0 +1,28 @@
1
+ name: Push Gem
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - v*
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ push:
13
+ if: github.repository == 'samuenti/ascona'
14
+ runs-on: ubuntu-latest
15
+
16
+ permissions:
17
+ contents: write
18
+ id-token: write
19
+
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+ - name: Set up Ruby
23
+ uses: ruby/setup-ruby@v1
24
+ with:
25
+ bundler-cache: true
26
+ ruby-version: ruby
27
+
28
+ - uses: rubygems/release-gem@v1
data/README.md CHANGED
@@ -66,11 +66,22 @@ The name of the folder will be used as the library name.
66
66
 
67
67
  ```erb
68
68
  <%= icon "star" %>
69
+ <%= icon "star", size: 5 %>
69
70
  <%= icon "star", class: "w-5 h-5" %>
70
71
  <%= icon "star", library: :heroicons, variant: :outline %>
71
72
  ```
72
73
 
73
- Attributes are added directly to the `<svg>` tag.
74
+ The `size` option adds Tailwind classes `w-{size} h-{size}`.
75
+
76
+ ## Default Size
77
+
78
+ Set a default size for all icons:
79
+
80
+ ```ruby
81
+ config.default_size = 5
82
+ ```
83
+
84
+ Icons without an explicit `size` will use this default.
74
85
 
75
86
  ## Variants
76
87
 
@@ -2,12 +2,13 @@
2
2
 
3
3
  module Ascona
4
4
  class Configuration
5
- attr_accessor :icon_path, :default_library, :default_variants
5
+ attr_accessor :icon_path, :default_library, :default_variants, :default_size
6
6
 
7
7
  def initialize
8
8
  @icon_path = "app/assets/icons"
9
9
  @default_library = nil
10
10
  @default_variants = {}
11
+ @default_size = nil
11
12
  end
12
13
  end
13
14
  end
data/lib/ascona/helper.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Ascona
4
4
  module Helper
5
- def icon(name, library: nil, variant: nil, **attributes)
5
+ def icon(name, library: nil, variant: nil, size: nil, **attributes)
6
6
  library ||= Ascona.configuration.default_library
7
7
  raise ArgumentError, "No library specified and no default set" unless library
8
8
 
@@ -10,9 +10,14 @@ module Ascona
10
10
  svg = Ascona.registry.get(name.to_sym, library: library.to_sym, variant: variant)
11
11
  raise ArgumentError, "Icon '#{name}' not found in library '#{library}'" unless svg
12
12
 
13
- return svg if attributes.empty?
13
+ size ||= Ascona.configuration.default_size
14
+ if size
15
+ size_class = "w-#{size} h-#{size}"
16
+ attributes[:class] = attributes[:class] ? "#{attributes[:class]} #{size_class}" : size_class
17
+ end
14
18
 
15
- inject_attributes(svg, attributes)
19
+ svg = inject_attributes(svg, attributes) unless attributes.empty?
20
+ svg.html_safe
16
21
  end
17
22
 
18
23
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ascona
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.2"
5
5
  end
@@ -6,4 +6,7 @@ Ascona.configure do |config|
6
6
 
7
7
  # Set default variants per library (only for libraries with variants):
8
8
  # config.default_variants = { heroicons: :outline }
9
+
10
+ # Set default size for all icons (uses Tailwind classes w-{size} h-{size}):
11
+ # config.default_size = 5
9
12
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ascona
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuenti
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2026-01-04 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: thor
@@ -32,6 +31,7 @@ executables:
32
31
  extensions: []
33
32
  extra_rdoc_files: []
34
33
  files:
34
+ - ".github/workflows/push_gem.yml"
35
35
  - LICENSE.txt
36
36
  - README.md
37
37
  - Rakefile
@@ -55,7 +55,6 @@ metadata:
55
55
  homepage_uri: https://github.com/samuenti/ascona
56
56
  source_code_uri: https://github.com/samuenti/ascona
57
57
  rubygems_mfa_required: 'true'
58
- post_install_message:
59
58
  rdoc_options: []
60
59
  require_paths:
61
60
  - lib
@@ -70,8 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
69
  - !ruby/object:Gem::Version
71
70
  version: '0'
72
71
  requirements: []
73
- rubygems_version: 3.4.19
74
- signing_key:
72
+ rubygems_version: 4.0.3
75
73
  specification_version: 4
76
74
  summary: Use SVG icons in Ruby
77
75
  test_files: []