peasy-css 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 +7 -0
- data/lib/peasy_css/engine.rb +62 -0
- data/lib/peasy_css/version.rb +5 -0
- data/lib/peasy_css.rb +4 -0
- metadata +50 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 6e14a971444073e466989d6ef8aa320c13eafa95d062d747c6a05da64c88a5cf
|
|
4
|
+
data.tar.gz: e0f29e6d09e48c3d450333a54c2beab5a7381dff7f79e77e77d5c17103db72f6
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: f24927929056fd17176d3262fc98d857e0cdffb67d0152f8f4e64d56e0c83c114599ec8fc0a01e60f2586361e9b94208572b7028cdfa72c1fda1f56f9f4383d1
|
|
7
|
+
data.tar.gz: 6243788b4a21af02a8c365cc473c24406f9b2b67244eaf8991bf2699bfcc1e08c788a52a31407eb66fb4ee43690e763c8d158e36d76e08a2b32529ad34430071
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module PeasyCSS
|
|
4
|
+
module_function
|
|
5
|
+
|
|
6
|
+
def linear_gradient(colors, direction: "to right")
|
|
7
|
+
"background: linear-gradient(#{direction}, #{colors.join(', ')});"
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def radial_gradient(colors, shape: "circle")
|
|
11
|
+
"background: radial-gradient(#{shape}, #{colors.join(', ')});"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def conic_gradient(colors, angle: 0)
|
|
15
|
+
"background: conic-gradient(from #{angle}deg, #{colors.join(', ')});"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def box_shadow(x: 0, y: 4, blur: 6, spread: 0, color: "rgba(0,0,0,0.1)")
|
|
19
|
+
"box-shadow: #{x}px #{y}px #{blur}px #{spread}px #{color};"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def text_shadow(x: 1, y: 1, blur: 2, color: "rgba(0,0,0,0.3)")
|
|
23
|
+
"text-shadow: #{x}px #{y}px #{blur}px #{color};"
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def border_radius(*radii)
|
|
27
|
+
vals = radii.map { |r| r.is_a?(Numeric) ? "#{r}px" : r.to_s }
|
|
28
|
+
"border-radius: #{vals.join(' ')};"
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def flexbox(direction: "row", justify: "flex-start", align: "stretch", wrap: "nowrap", gap: nil)
|
|
32
|
+
lines = [
|
|
33
|
+
"display: flex",
|
|
34
|
+
"flex-direction: #{direction}",
|
|
35
|
+
"justify-content: #{justify}",
|
|
36
|
+
"align-items: #{align}",
|
|
37
|
+
"flex-wrap: #{wrap}",
|
|
38
|
+
]
|
|
39
|
+
lines << "gap: #{gap}" if gap
|
|
40
|
+
lines.join(";\n") + ";"
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def grid(columns: 3, gap: "1rem", min_width: nil)
|
|
44
|
+
col = min_width ? "repeat(auto-fit, minmax(#{min_width}, 1fr))" : "repeat(#{columns}, 1fr)"
|
|
45
|
+
"display: grid;\ngrid-template-columns: #{col};\ngap: #{gap};"
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def transform(rotate: nil, scale: nil, translate_x: nil, translate_y: nil)
|
|
49
|
+
parts = []
|
|
50
|
+
parts << "rotate(#{rotate}deg)" if rotate
|
|
51
|
+
parts << "scale(#{scale})" if scale
|
|
52
|
+
parts << "translateX(#{translate_x}px)" if translate_x
|
|
53
|
+
parts << "translateY(#{translate_y}px)" if translate_y
|
|
54
|
+
"transform: #{parts.join(' ')};"
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def transition(property: "all", duration: "0.3s", easing: "ease", delay: nil)
|
|
58
|
+
val = "#{property} #{duration} #{easing}"
|
|
59
|
+
val += " #{delay}" if delay
|
|
60
|
+
"transition: #{val};"
|
|
61
|
+
end
|
|
62
|
+
end
|
data/lib/peasy_css.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: peasy-css
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- PeasyTools
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
12
|
+
description: CSS code generator for Ruby — create linear/radial gradients, box/text
|
|
13
|
+
shadows, border-radius, flexbox layouts, and CSS grid. Zero dependencies, outputs
|
|
14
|
+
copy-paste CSS.
|
|
15
|
+
email:
|
|
16
|
+
- hello@peasytools.com
|
|
17
|
+
executables: []
|
|
18
|
+
extensions: []
|
|
19
|
+
extra_rdoc_files: []
|
|
20
|
+
files:
|
|
21
|
+
- lib/peasy_css.rb
|
|
22
|
+
- lib/peasy_css/engine.rb
|
|
23
|
+
- lib/peasy_css/version.rb
|
|
24
|
+
homepage: https://peasycss.com
|
|
25
|
+
licenses:
|
|
26
|
+
- MIT
|
|
27
|
+
metadata:
|
|
28
|
+
homepage_uri: https://peasycss.com
|
|
29
|
+
source_code_uri: https://github.com/peasytools/peasy-css-rb
|
|
30
|
+
changelog_uri: https://github.com/peasytools/peasy-css-rb/blob/main/CHANGELOG.md
|
|
31
|
+
documentation_uri: https://peasycss.com
|
|
32
|
+
bug_tracker_uri: https://github.com/peasytools/peasy-css-rb/issues
|
|
33
|
+
rdoc_options: []
|
|
34
|
+
require_paths:
|
|
35
|
+
- lib
|
|
36
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '3.0'
|
|
41
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
42
|
+
requirements:
|
|
43
|
+
- - ">="
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
version: '0'
|
|
46
|
+
requirements: []
|
|
47
|
+
rubygems_version: 4.0.3
|
|
48
|
+
specification_version: 4
|
|
49
|
+
summary: CSS generators — gradients, shadows, flexbox, grid
|
|
50
|
+
test_files: []
|