breeze_icons 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1a7c16ac0740573fb72dd34ad987fa23ebde4f04a4b35cb80e1f8705267fb571
4
+ data.tar.gz: 490d7ec4309f3853610b80cd746205832017a20001b427b5232415bc4ca1c315
5
+ SHA512:
6
+ metadata.gz: '080a8cf3c544c98a61832b83744c931dfb09f5720dd34ba31ee965a40bc2247a6a275772c2381032fe3f5c6600edfd85b715bcd00e425752931c3236f4fb8eff'
7
+ data.tar.gz: ac8fbb06b30b95552ef810b0a9e42bdf800169399f477ce958d0b7fa01d875a5894e5465980b98eec98abca059cdea102d2e8767a365cf28ba05145bcce504fb
data/CHANGELOG.md ADDED
@@ -0,0 +1,6 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2023-09-01
4
+
5
+ - Initial release
6
+ - breeze-icons built from `b090ca463d8fb3fcfd50bb325c7581a67c9528b0`
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at nilsding@nilsding.org. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in breeze_icons.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "minitest", "~> 5.0"
11
+
12
+ gem "nokogiri", "~> 1.15"
data/LICENSE.txt ADDED
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
data/README.md ADDED
@@ -0,0 +1,75 @@
1
+ # breeze-icons-ruby
2
+
3
+ This gem provides a subset of the excellent
4
+ [KDE Breeze Icons](https://invent.kde.org/frameworks/breeze-icons) as a gem.
5
+
6
+ It mostly only contains the "symbolic" icons which make it perfect for using it
7
+ on websites without resorting to an icon font.
8
+
9
+ Inspired by [octicons](https://github.com/primer/octicons/tree/main/lib/octicons_gem).
10
+
11
+ ## Installation
12
+
13
+ Install the gem and add to the application's Gemfile by executing:
14
+
15
+ ```sh
16
+ $ bundle add breeze_icons
17
+ ```
18
+
19
+ If bundler is not being used to manage dependencies, install the gem by executing:
20
+
21
+ ```sh
22
+ $ gem install breeze_icons
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ ```ruby
28
+ require "breeze_icons"
29
+ icon = BreezeIcons::Icon.new("media-playback-start")
30
+ icon.to_svg
31
+ # <svg class="breeze-icon breeze-icon-media-playback-start" version="1.1" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="m2 2v12l12-6z"></path></svg>
32
+ ```
33
+
34
+ ## Development
35
+
36
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run
37
+ `rake test` to run the tests. You can also run `bin/console` for an
38
+ interactive prompt that will allow you to experiment.
39
+
40
+ To install this gem onto your local machine, run `bundle exec rake install`.
41
+ To release a new version, update the version number in `version.rb`, and then
42
+ run `bundle exec rake release`, which will create a git tag for the version,
43
+ push git commits and the created tag, and push the `.gem` file to
44
+ [rubygems.org](https://rubygems.org).
45
+
46
+ To update the `breeze_icons` data file run:
47
+ ```sh
48
+ rake generate_data_file
49
+ ```
50
+
51
+ To generate a demo page with all the icons the gem supports:
52
+ ```sh
53
+ rake generate_demo_page
54
+ ```
55
+
56
+ ## Contributing
57
+
58
+ Bug reports and pull requests are welcome on GitHub at
59
+ https://github.com/nilsding/breeze-icons-ruby. This project is intended to be
60
+ a safe, welcoming space for collaboration, and contributors are expected to
61
+ adhere to the [code of conduct](https://github.com/nilsding/breeze-icons-ruby/blob/main/CODE_OF_CONDUCT.md).
62
+
63
+ ## License
64
+
65
+ The gem is available as open source under the terms of the
66
+ [LGPLv3 Licence](https://opensource.org/license/lgpl-3-0/).
67
+
68
+ The icon data is licensed under the terms of LGPLv3 as per
69
+ https://invent.kde.org/frameworks/breeze-icons/-/blob/master/COPYING-ICONS.
70
+
71
+ ## Code of Conduct
72
+
73
+ Everyone interacting in the BreezeIcons project's codebases, issue trackers,
74
+ chat rooms and mailing lists is expected to follow the
75
+ [code of conduct](https://github.com/nilsding/breeze-icons-ruby/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,196 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList["test/**/test_*.rb"]
10
+ end
11
+
12
+ desc "generate data file"
13
+ task :generate_data_file do
14
+ require "nokogiri"
15
+ require "pp"
16
+
17
+ breeze_icons_path = File.expand_path("./vendor/breeze-icons/icons", __dir__)
18
+
19
+ icons = {
20
+ icons: {},
21
+ aliases: {},
22
+ }
23
+
24
+ puts "==> reading svgs ..."
25
+ Dir["#{breeze_icons_path}/**/*.svg"].sort.each do |file|
26
+ icon_name = File.basename(file, ".svg")
27
+ category, size, *rest = File.dirname(file.delete_prefix("#{breeze_icons_path}/")).split("/")
28
+
29
+ if File.symlink?(file)
30
+ alias_to = File.basename(File.readlink(file), ".svg")
31
+ icons[:aliases][size] ||= {}
32
+ icons[:aliases][size][icon_name] ||= alias_to
33
+ next
34
+ end
35
+
36
+ doc = Nokogiri::XML::Document.parse(File.read(file))
37
+ path_nodes = doc.css("svg path")
38
+ unless path_nodes.size == 1
39
+ # puts "ignoring #{category}/#{size}/#{icon_name} as it has #{path_nodes.size} path nodes"
40
+ next
41
+ end
42
+
43
+ path = path_nodes.first
44
+
45
+ transform = path.parent["transform"]
46
+ # if the parent group has a transform the path might inverse it
47
+ transform = nil if transform && path["transform"]
48
+
49
+ icons[:icons][size] ||= {}
50
+ icons[:icons][size][icon_name] = {
51
+ category:,
52
+ class: path["class"],
53
+ path: path["d"],
54
+ stroke_linecap: path["stroke-linecap"],
55
+ stroke_width: path["stroke-width"],
56
+ transform: transform,
57
+ view_box: doc.first_element_child["viewBox"],
58
+ }.compact
59
+ end
60
+
61
+ puts "==> cleaning up aliases"
62
+ icons[:aliases].each do |size, aliases|
63
+ aliases.reject! do |from, to|
64
+ next false if icons[:icons][size]&.key?(to)
65
+
66
+ true
67
+ end
68
+ end
69
+
70
+ puts "==> generating data file"
71
+ File.open(File.expand_path("./lib/breeze_icons/data.rb"), "w") do |f|
72
+ f.puts <<~RUBY
73
+ # frozen_string_literal: true
74
+ #
75
+ # generated by `rake generate_data_file`
76
+
77
+ module BreezeIcons
78
+ module Data
79
+ RUBY
80
+ f.print " ICONS = "
81
+ PP.pp icons, f
82
+ f.puts <<~RUBY
83
+ end
84
+ end
85
+ RUBY
86
+ end
87
+
88
+ puts "==> stats"
89
+ icons[:icons].each do |size, icons|
90
+ puts "%5s: %5s icons" % [size, icons.size]
91
+ end
92
+ icons[:aliases].each do |size, aliases|
93
+ puts "%5s: %5s aliases" % [size, aliases.size]
94
+ end
95
+ end
96
+
97
+ desc "generate a demo page"
98
+ task :generate_demo_page do
99
+ require_relative "./lib/breeze_icons"
100
+
101
+ puts "==> generating demo.html"
102
+ File.open("./demo.html", "w") do |f|
103
+ f.puts <<~HTML
104
+ <!doctype html>
105
+ <html>
106
+ <head>
107
+ <meta charset="utf-8">
108
+ <title>breeze-icons-ruby showcase</title>
109
+ <style>
110
+ @media(prefers-color-scheme: dark) {
111
+ body {
112
+ background: #000;
113
+ color: #fff;
114
+ fill: #fff; /* this is for the SVG icons */
115
+ }
116
+ input {
117
+ background: #000;
118
+ color: #fff;
119
+ border: 1px solid #aaa;
120
+ }
121
+ }
122
+ .iconlist {
123
+ display: flex;
124
+ flex-wrap: wrap;
125
+ }
126
+ .icon {
127
+ width: 15em;
128
+ border: solid 1px;
129
+ margin: .25em;
130
+ padding: .25em;
131
+ text-align: center;
132
+ height: 15em;
133
+ overflow-y: scroll;
134
+ }
135
+ .icon > tt {
136
+ font-weight: bold;
137
+ }
138
+ .nojs {
139
+ display: none;
140
+ }
141
+ </style>
142
+ </head>
143
+ <body>
144
+ <h1>breeze-icons-ruby showcase</h1>
145
+ <div class="nojs">
146
+ filter: <input oninput="filter(this)">
147
+ <style id="filterstyle"></style>
148
+ </div>
149
+ <script>
150
+ document.querySelectorAll(".nojs").forEach(elem => elem.classList.remove("nojs"));
151
+ const jsstyle = document.getElementById("filterstyle");
152
+ function filter(elem)
153
+ {
154
+ if (elem.value == "" || elem.value.indexOf('"') > -1)
155
+ {
156
+ jsstyle.innerText = "";
157
+ return;
158
+ }
159
+ jsstyle.innerText = `.icon:not([class*="${elem.value}"]) { display: none; }`;
160
+ }
161
+ </script>
162
+ HTML
163
+
164
+ data = BreezeIcons::Data::ICONS
165
+ data[:icons].each do |size, icons|
166
+ f.puts "<h2>#{size}</h2>"
167
+ grouped_icons = icons.group_by { _2[:category] }.transform_values(&:to_h)
168
+ grouped_icons.keys.sort.each do |category|
169
+ f.puts "<h3>#{category}</h3>"
170
+ f.puts %(<div class="iconlist">)
171
+ grouped_icons[category].each_key do |name|
172
+ aliases = data[:aliases][size]&.select { _2 == name }&.map(&:first)
173
+ class_list = ["icon", "icon-#{name}", *aliases&.map { "icon-#{_1}" }].compact.join(" ")
174
+ f.print %(<div class="#{class_list}">)
175
+ icon = BreezeIcons::Icon.new(name, size:)
176
+ f.print icon.to_svg
177
+ f.print "<br><tt>#{name}</tt>"
178
+ if aliases && !aliases.empty?
179
+ f.print "<br><small>"
180
+ f.print aliases.map { "<tt>#{_1}</tt>" }.join("<br>")
181
+ f.print "</small>"
182
+ end
183
+ f.puts "</div>"
184
+ end
185
+ f.puts "</div>"
186
+ end
187
+ end
188
+
189
+ f.puts <<~HTML
190
+ </body>
191
+ </html>
192
+ HTML
193
+ end
194
+ end
195
+
196
+ task default: %i[generate_data_file test]