glyphs 0.1.0 → 0.2.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/CHANGELOG.md +12 -0
- data/README.md +4 -3
- data/lib/glyphs/configuration.rb +7 -5
- data/lib/glyphs/version.rb +1 -1
- data/lib/glyphs.rb +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 977c4ff81bc073f486991e32e6f27418419d440ddf15fc0cd8cb4357091abe8a
|
|
4
|
+
data.tar.gz: e2f6a73fa1545cae2d0714c9b2528b8b8d65b6474af45e1c73ae0999b5851cde
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3f9570e3186cf64e294a7ca0f4de342d5ef16ba7bd6ac86017737617566bef92caff25ea9f665a2d3044abe76990ec9ed81d020e0cd943bfc3983c4228f86360
|
|
7
|
+
data.tar.gz: 49bd88b05cc3dfe3370348ade5a9498a26b6b7db12fb25fff63fb1ef0c8be94091cc71ef30728273a10a90be740d3fc0e867e751d5a505add4c1a1e0a0f741ce
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.2.0] - 2026-07-07
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- **Breaking:** `config.raise_on_missing_icon` (a callable) is now `config.raise_on_missing`,
|
|
8
|
+
an honest boolean. The default is evaluated once: `Rails.env.local?` under Rails, `true` outside.
|
|
9
|
+
- **Breaking:** `config.on_missing_icon` now defaults to `nil` — set it only if you want a handler.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Release workflow with RubyGems trusted publishing (OIDC) and Sigstore attestation.
|
|
14
|
+
|
|
3
15
|
## [0.1.0] - 2026-07-07
|
|
4
16
|
|
|
5
17
|
### Added
|
data/README.md
CHANGED
|
@@ -80,10 +80,11 @@ BrandIcon(:logo)
|
|
|
80
80
|
```ruby
|
|
81
81
|
# config/initializers/glyphs.rb
|
|
82
82
|
Glyphs.configure do |config|
|
|
83
|
-
# Re-raise Icons::IconNotFound?
|
|
84
|
-
|
|
83
|
+
# Re-raise Icons::IconNotFound? Defaults to true in local Rails
|
|
84
|
+
# environments (and outside Rails), false otherwise.
|
|
85
|
+
config.raise_on_missing = Rails.env.local?
|
|
85
86
|
|
|
86
|
-
#
|
|
87
|
+
# Optional handler, called before the fallback renders (when not raising).
|
|
87
88
|
config.on_missing_icon = lambda do |error, name:, library:, variant:|
|
|
88
89
|
Rails.logger.error("Icon missing: #{library}/#{variant}/#{name} (#{error.message})")
|
|
89
90
|
end
|
data/lib/glyphs/configuration.rb
CHANGED
|
@@ -8,15 +8,17 @@ module Glyphs
|
|
|
8
8
|
heroicons: "question-mark-circle"
|
|
9
9
|
}.freeze
|
|
10
10
|
|
|
11
|
-
#
|
|
12
|
-
#
|
|
11
|
+
# raise_on_missing: boolean; when true, Icons::IconNotFound is re-raised.
|
|
12
|
+
# Defaults to true in local Rails environments (and outside Rails).
|
|
13
|
+
# on_missing_icon: optional callable(error, name:, library:, variant:),
|
|
14
|
+
# invoked before the fallback renders when not raising.
|
|
13
15
|
# fallback_icons: { library => icon_name } rendered instead of a missing icon.
|
|
14
16
|
# cache_svgs: memoize rendered SVG strings per [library, variant, name, attributes].
|
|
15
|
-
attr_accessor :
|
|
17
|
+
attr_accessor :raise_on_missing, :on_missing_icon, :fallback_icons, :cache_svgs
|
|
16
18
|
|
|
17
19
|
def initialize
|
|
18
|
-
@
|
|
19
|
-
@on_missing_icon =
|
|
20
|
+
@raise_on_missing = defined?(Rails) ? Rails.env.local? : true
|
|
21
|
+
@on_missing_icon = nil
|
|
20
22
|
@fallback_icons = DEFAULT_FALLBACK_ICONS.dup
|
|
21
23
|
@cache_svgs = true
|
|
22
24
|
end
|
data/lib/glyphs/version.rb
CHANGED
data/lib/glyphs.rb
CHANGED
|
@@ -92,9 +92,9 @@ module Glyphs
|
|
|
92
92
|
end
|
|
93
93
|
|
|
94
94
|
def handle_missing_icon(error, name:, library:, variant:, attributes:)
|
|
95
|
-
raise error if configuration.
|
|
95
|
+
raise error if configuration.raise_on_missing
|
|
96
96
|
|
|
97
|
-
configuration.on_missing_icon
|
|
97
|
+
configuration.on_missing_icon&.call(error, name:, library:, variant:)
|
|
98
98
|
|
|
99
99
|
fallback = configuration.fallback_icons[library.to_sym]
|
|
100
100
|
raise error if fallback.nil?
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: glyphs
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mikael Henriksson
|
|
@@ -27,14 +27,14 @@ dependencies:
|
|
|
27
27
|
name: rails_icons
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
|
-
- - "
|
|
30
|
+
- - "~>"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
32
|
version: '1.2'
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
|
-
- - "
|
|
37
|
+
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
39
|
version: '1.2'
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
110
|
version: '0'
|
|
111
111
|
requirements: []
|
|
112
|
-
rubygems_version:
|
|
112
|
+
rubygems_version: 3.6.9
|
|
113
113
|
specification_version: 4
|
|
114
114
|
summary: Phlex icon components for every rails_icons library
|
|
115
115
|
test_files: []
|