glimmer-dsl-css 1.2.1 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/LICENSE.txt +1 -1
- data/README.md +106 -27
- data/VERSION +1 -1
- data/glimmer-dsl-css.gemspec +22 -32
- data/lib/glimmer/css/rule.rb +1 -1
- data/lib/glimmer/css/style_sheet.rb +1 -1
- data/lib/glimmer/dsl/css/css_expression.rb +1 -1
- data/lib/glimmer/dsl/css/dsl.rb +6 -3
- data/lib/glimmer/dsl/css/dynamic_property_expression.rb +1 -1
- data/lib/glimmer/dsl/css/element_rule_expression.rb +47 -0
- data/lib/glimmer/dsl/css/general_rule_expression.rb +47 -0
- data/lib/glimmer/dsl/css/property_expression.rb +1 -1
- data/lib/glimmer/dsl/css/pv_expression.rb +1 -1
- data/lib/glimmer/dsl/css/ru_expression.rb +34 -0
- data/lib/glimmer/dsl/css/rul_expression.rb +34 -0
- data/lib/glimmer/dsl/css/rule_expression.rb +6 -19
- data/lib/glimmer/dsl/css/s_expression.rb +4 -17
- data/lib/glimmer-dsl-css.rb +10 -1
- metadata +25 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 967caae689a729dcf6c70d97a761bc48da8e8d285cd19348aada3dee83ffc32a
|
4
|
+
data.tar.gz: 8f896b942182779e573bed0a4c039efbabe724b40b3d82dff6ded1d5d0ebe8fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5faae751daf2f5e6c608682fd8c035993f4fef13ce7fa2c8ff21100b30f09338939cb7d3e9b33f225632ee203a5f858610c1992bf14954dc1e0efc1b135dbf6
|
7
|
+
data.tar.gz: '018c7875e4fcbd9c32012f0a489c5524de5cd76be406e1349ce0665204f5f4dac27e27ad0e98e30924816467f2c3ba66aa768533adbb26fa68f5ba506c0b8def'
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 1.2.3
|
4
|
+
|
5
|
+
- Add `r`, `ru`, `rul`, `rule`, `_` alternatives to `s` for specifying a CSS rule selector with a block of expressions (e.g. `r('body > h1') { color: red; }`)
|
6
|
+
|
7
|
+
## 1.2.2
|
8
|
+
|
9
|
+
- Relax glimmer dependency to between 2.0.0 and 3.0.0
|
10
|
+
|
3
11
|
## 1.2.1
|
4
12
|
|
5
13
|
- Relax glimmer dependency to between 2.0.0 and 2.4.x
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,29 +1,49 @@
|
|
1
|
-
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for CSS 1.2.
|
1
|
+
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for CSS 1.2.3
|
2
|
+
## Ruby Programmable Cascading Style Sheets
|
2
3
|
[![Gem Version](https://badge.fury.io/rb/glimmer-dsl-css.svg)](http://badge.fury.io/rb/glimmer-dsl-css)
|
3
4
|
[![Travis CI](https://travis-ci.com/AndyObtiva/glimmer-dsl-css.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer-dsl-css)
|
4
5
|
[![Coverage Status](https://coveralls.io/repos/github/AndyObtiva/glimmer-dsl-css/badge.svg?branch=master)](https://coveralls.io/github/AndyObtiva/glimmer-dsl-css?branch=master)
|
5
6
|
[![Maintainability](https://api.codeclimate.com/v1/badges/c7365cdb8556be433115/maintainability)](https://codeclimate.com/github/AndyObtiva/glimmer-dsl-css/maintainability)
|
6
7
|
[![Join the chat at https://gitter.im/AndyObtiva/glimmer](https://badges.gitter.im/AndyObtiva/glimmer.svg)](https://gitter.im/AndyObtiva/glimmer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
7
8
|
|
8
|
-
[Glimmer](https://github.com/AndyObtiva/glimmer) DSL for CSS provides Ruby syntax for building CSS (Cascading Style Sheets).
|
9
|
+
[Glimmer](https://github.com/AndyObtiva/glimmer) DSL for CSS provides Ruby syntax for building CSS (Cascading Style Sheets). It used to be part of the [Glimmer](https://github.com/AndyObtiva/glimmer) library (created in 2007), but eventually got extracted into its own project.
|
9
10
|
|
10
|
-
|
11
|
+
Example (you can try in IRB):
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
require 'glimmer-dsl-css'
|
15
|
+
include Glimmer
|
16
|
+
@css = css {
|
17
|
+
body {
|
18
|
+
font_size '1.1em'
|
19
|
+
background 'white'
|
20
|
+
}
|
21
|
+
r('body > h1') {
|
22
|
+
background_color :red
|
23
|
+
font_size 24
|
24
|
+
}
|
25
|
+
}
|
26
|
+
puts @css
|
27
|
+
```
|
28
|
+
|
29
|
+
Output (minified CSS):
|
30
|
+
|
31
|
+
```css
|
32
|
+
body{font-size:1.1em;background:white}body > h1{background-color:red;font-size:24px}
|
33
|
+
```
|
11
34
|
|
12
|
-
|
35
|
+
The key reason for using the CSS DSL instead of actual CSS is Ruby programmability without getting lost in string concatenations. The CSS DSL helps in including conditional CSS with `if` or ternery expressions as well as looping from lists while building CSS.
|
13
36
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
[Glimmer DSL for Swing (JRuby Swing Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-swing) | Mac / Windows / Linux | No | Yes (Java2D) | Very Mature | Slow JRuby Startup Time / Heavy Memory Footprint / Widgets Do Not Look Native | Java / JRuby
|
25
|
-
[Glimmer DSL for XML (& HTML)](https://github.com/AndyObtiva/glimmer-dsl-xml) | All Web Browsers | No | Yes (SVG) | Programmable / Lighter-weight Than Actual XML | XML Elements Are Sometimes Not Well-Named (Many Types of Input) | None
|
26
|
-
[Glimmer DSL for CSS](https://github.com/AndyObtiva/glimmer-dsl-css) | All Web Browsers | No | Yes | Programmable | CSS Is Over-Engineered / Too Many Features To Learn | None
|
37
|
+
```
|
38
|
+
rule('body > h1') {
|
39
|
+
background_color is_error ? :red : :green
|
40
|
+
font_size new_user ? 24 : 20
|
41
|
+
}
|
42
|
+
```
|
43
|
+
|
44
|
+
Within the context of [Glimmer](https://github.com/AndyObtiva/glimmer) app development, Glimmer DSL for CSS is useful in providing CSS for [Glimmer DSL for Web](https://github.com/AndyObtiva/glimmer-dsl-web), [Glimmer DSL for Opal](https://github.com/AndyObtiva/glimmer-dsl-opal), and the [SWT Browser widget](https://github.com/AndyObtiva/glimmer-dsl-swt/tree/master#browser-widget).
|
45
|
+
|
46
|
+
Learn more about the differences between various [Glimmer](https://github.com/AndyObtiva/glimmer) DSLs by looking at the **[Glimmer DSL Comparison Table](https://github.com/AndyObtiva/glimmer#glimmer-dsl-comparison-table)**.
|
27
47
|
|
28
48
|
## Setup
|
29
49
|
|
@@ -33,7 +53,7 @@ Please follow these instructions to make the `glimmer` command available on your
|
|
33
53
|
|
34
54
|
Run this command to install directly:
|
35
55
|
```
|
36
|
-
gem install glimmer-dsl-css -v 1.2.
|
56
|
+
gem install glimmer-dsl-css -v 1.2.3
|
37
57
|
```
|
38
58
|
|
39
59
|
Note: In case you are using JRuby, `jgem` is JRuby's version of the `gem` command. RVM allows running `gem` as an alias in JRuby. Otherwise, you may also run `jruby -S gem install ...`
|
@@ -48,7 +68,7 @@ That's it! Requiring the gem activates the Glimmer CSS DSL automatically.
|
|
48
68
|
|
49
69
|
Add the following to `Gemfile` (after `glimmer-dsl-swt` and/or `glimmer-dsl-opal` if included too):
|
50
70
|
```
|
51
|
-
gem 'glimmer-dsl-css', '~> 1.2.
|
71
|
+
gem 'glimmer-dsl-css', '~> 1.2.3'
|
52
72
|
```
|
53
73
|
|
54
74
|
And, then run:
|
@@ -66,15 +86,22 @@ That's it! Requiring the gem activates the Glimmer CSS DSL automatically.
|
|
66
86
|
|
67
87
|
## CSS DSL
|
68
88
|
|
69
|
-
The key reason for using the CSS DSL instead of actual CSS is Ruby programmability without getting lost in string concatenations. The CSS DSL helps in including conditional CSS as well as looping from lists while building CSS.
|
89
|
+
The key reason for using the CSS DSL instead of actual CSS is Ruby programmability without getting lost in string concatenations. The CSS DSL helps in including conditional CSS with `if` or ternery expressions as well as looping from lists while building CSS.
|
90
|
+
|
91
|
+
```
|
92
|
+
_('body > h1') {
|
93
|
+
background_color is_error ? :red : :green
|
94
|
+
font_size new_user ? 24 : 20
|
95
|
+
}
|
96
|
+
```
|
70
97
|
|
71
98
|
Simply start with `css` keyword and add stylesheet rule sets inside its block using Glimmer DSL syntax.
|
72
99
|
Once done, you may call `to_s` or `to_css` to get the formatted CSS output.
|
73
100
|
|
74
101
|
`css` is the only top-level keyword in the Glimmer CSS DSL
|
75
102
|
|
76
|
-
Selectors may be specified by `s`
|
77
|
-
Rule property values may be specified by `
|
103
|
+
Selectors may be specified by any of `_`, `s`, `r`, `ru`, `rul`, `rule` keywords or HTML element keyword directly (e.g. `body`)
|
104
|
+
Rule property values may be specified by underscored property name directly (e.g. `font_size`), which is auto-translated to CSS property name by replacing underscores with dashes (e.g. `font-size`)
|
78
105
|
|
79
106
|
Example (you can try in IRB):
|
80
107
|
|
@@ -84,11 +111,11 @@ include Glimmer
|
|
84
111
|
@css = css {
|
85
112
|
body {
|
86
113
|
font_size '1.1em'
|
87
|
-
|
114
|
+
background 'white'
|
88
115
|
}
|
89
|
-
|
116
|
+
r('body > h1') {
|
90
117
|
background_color :red
|
91
|
-
|
118
|
+
font_size 24
|
92
119
|
}
|
93
120
|
}
|
94
121
|
puts @css
|
@@ -100,9 +127,61 @@ Output (minified CSS):
|
|
100
127
|
body{font-size:1.1em;background:white}body > h1{background-color:red;font-size:24px}
|
101
128
|
```
|
102
129
|
|
130
|
+
The `body > h1` rule could have been written in any other alternative way:
|
131
|
+
|
132
|
+
```ruby
|
133
|
+
rule('body > h1') {
|
134
|
+
background_color :red
|
135
|
+
font_size 24
|
136
|
+
}
|
137
|
+
```
|
138
|
+
|
139
|
+
```ruby
|
140
|
+
rul('body > h1') {
|
141
|
+
background_color :red
|
142
|
+
font_size 24
|
143
|
+
}
|
144
|
+
```
|
145
|
+
|
146
|
+
```ruby
|
147
|
+
_('body > h1') {
|
148
|
+
background_color :red
|
149
|
+
font_size 24
|
150
|
+
}
|
151
|
+
```
|
152
|
+
|
153
|
+
```ruby
|
154
|
+
_ 'body > h1' do
|
155
|
+
background_color :red
|
156
|
+
font_size 24
|
157
|
+
end
|
158
|
+
```
|
159
|
+
|
103
160
|
### Numeric Values
|
104
161
|
|
105
|
-
As you saw above, numeric values (e.g. `24` in `
|
162
|
+
As you saw above, numeric values (e.g. `24` in `font_size 24`) automatically get suffixed with `px` by convention (e.g. `24px`).
|
163
|
+
|
164
|
+
```ruby
|
165
|
+
require 'glimmer-dsl-css'
|
166
|
+
include Glimmer
|
167
|
+
@css = css {
|
168
|
+
body {
|
169
|
+
font_size '1.1em'
|
170
|
+
background 'white'
|
171
|
+
}
|
172
|
+
_ 'body > h1' do
|
173
|
+
background_color :red
|
174
|
+
font_size 24
|
175
|
+
end
|
176
|
+
}
|
177
|
+
puts @css
|
178
|
+
```
|
179
|
+
|
180
|
+
Output (minified CSS):
|
181
|
+
|
182
|
+
```css
|
183
|
+
body{font-size:1.1em;background:white}body > h1{background-color:red;font-size:24px}
|
184
|
+
```
|
106
185
|
|
107
186
|
## Multi-DSL Support
|
108
187
|
|
@@ -146,7 +225,7 @@ These features have been suggested. You might see them in a future version of Gl
|
|
146
225
|
|
147
226
|
[MIT](LICENSE.txt)
|
148
227
|
|
149
|
-
Copyright (c) 2020-
|
228
|
+
Copyright (c) 2020-2024 - Andy Maleh.
|
150
229
|
|
151
230
|
--
|
152
231
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
1
|
+
1.2.3
|
data/glimmer-dsl-css.gemspec
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: glimmer-dsl-css 1.2.
|
5
|
+
# stub: glimmer-dsl-css 1.2.3 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "glimmer-dsl-css".freeze
|
9
|
-
s.version = "1.2.
|
9
|
+
s.version = "1.2.3".freeze
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["AndyMaleh".freeze]
|
14
|
-
s.date = "
|
15
|
-
s.description = "Glimmer DSL for CSS (Cascading Style Sheets)".freeze
|
14
|
+
s.date = "2024-01-08"
|
15
|
+
s.description = "Glimmer DSL for CSS (Ruby Programmable Cascading Style Sheets)".freeze
|
16
16
|
s.email = "andy.am@gmail.com".freeze
|
17
17
|
s.extra_rdoc_files = [
|
18
18
|
"CHANGELOG.md",
|
@@ -32,42 +32,32 @@ Gem::Specification.new do |s|
|
|
32
32
|
"lib/glimmer/dsl/css/css_expression.rb",
|
33
33
|
"lib/glimmer/dsl/css/dsl.rb",
|
34
34
|
"lib/glimmer/dsl/css/dynamic_property_expression.rb",
|
35
|
+
"lib/glimmer/dsl/css/element_rule_expression.rb",
|
36
|
+
"lib/glimmer/dsl/css/general_rule_expression.rb",
|
35
37
|
"lib/glimmer/dsl/css/property_expression.rb",
|
36
38
|
"lib/glimmer/dsl/css/pv_expression.rb",
|
39
|
+
"lib/glimmer/dsl/css/ru_expression.rb",
|
40
|
+
"lib/glimmer/dsl/css/rul_expression.rb",
|
37
41
|
"lib/glimmer/dsl/css/rule_expression.rb",
|
38
42
|
"lib/glimmer/dsl/css/s_expression.rb"
|
39
43
|
]
|
40
44
|
s.homepage = "http://github.com/AndyObtiva/glimmer-dsl-css".freeze
|
41
45
|
s.licenses = ["MIT".freeze]
|
42
|
-
s.rubygems_version = "3.3
|
43
|
-
s.summary = "Glimmer DSL for CSS".freeze
|
46
|
+
s.rubygems_version = "3.5.3".freeze
|
47
|
+
s.summary = "Glimmer DSL for CSS (Ruby Programmable Cascading Style Sheets)".freeze
|
44
48
|
|
45
|
-
|
46
|
-
s.specification_version = 4
|
47
|
-
end
|
49
|
+
s.specification_version = 4
|
48
50
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
else
|
61
|
-
s.add_dependency(%q<glimmer>.freeze, [">= 2.0.0", "< 2.5.0"])
|
62
|
-
s.add_dependency(%q<rspec-mocks>.freeze, ["~> 3.0"])
|
63
|
-
s.add_dependency(%q<rspec>.freeze, ["~> 3.0"])
|
64
|
-
s.add_dependency(%q<puts_debuggerer>.freeze, [">= 0"])
|
65
|
-
s.add_dependency(%q<rake>.freeze, [">= 10.1.0", "< 14.0.0"])
|
66
|
-
s.add_dependency(%q<jeweler>.freeze, [">= 2.3.9", "< 3.0.0"])
|
67
|
-
s.add_dependency(%q<rdoc>.freeze, [">= 6.2.1", "< 7.0.0"])
|
68
|
-
s.add_dependency(%q<coveralls>.freeze, ["= 0.8.23"])
|
69
|
-
s.add_dependency(%q<simplecov>.freeze, ["~> 0.16.1"])
|
70
|
-
s.add_dependency(%q<simplecov-lcov>.freeze, ["~> 0.7.0"])
|
71
|
-
end
|
51
|
+
s.add_runtime_dependency(%q<glimmer>.freeze, [">= 2.0.0".freeze, "< 3.0.0".freeze])
|
52
|
+
s.add_development_dependency(%q<rspec-mocks>.freeze, ["~> 3.0".freeze])
|
53
|
+
s.add_development_dependency(%q<rspec>.freeze, ["~> 3.0".freeze])
|
54
|
+
s.add_development_dependency(%q<puts_debuggerer>.freeze, [">= 0".freeze])
|
55
|
+
s.add_development_dependency(%q<rake>.freeze, [">= 10.1.0".freeze, "< 14.0.0".freeze])
|
56
|
+
s.add_development_dependency(%q<jeweler>.freeze, [">= 2.3.9".freeze, "< 3.0.0".freeze])
|
57
|
+
s.add_development_dependency(%q<rdoc>.freeze, [">= 6.2.1".freeze, "< 7.0.0".freeze])
|
58
|
+
s.add_development_dependency(%q<coveralls>.freeze, ["= 0.8.23".freeze])
|
59
|
+
s.add_development_dependency(%q<simplecov>.freeze, ["~> 0.16.1".freeze])
|
60
|
+
s.add_development_dependency(%q<simplecov-lcov>.freeze, ["~> 0.7.0".freeze])
|
61
|
+
s.add_development_dependency(%q<rake-tui>.freeze, [">= 0".freeze])
|
72
62
|
end
|
73
63
|
|
data/lib/glimmer/css/rule.rb
CHANGED
data/lib/glimmer/dsl/css/dsl.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2020-
|
1
|
+
# Copyright (c) 2020-2024 - Andy Maleh
|
2
2
|
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
@@ -21,9 +21,12 @@
|
|
21
21
|
|
22
22
|
require 'glimmer/dsl/engine'
|
23
23
|
# Dir[File.expand_path('../*_expression.rb', __FILE__)].each {|f| require f} # cannot in Opal
|
24
|
-
require 'glimmer/dsl/css/
|
24
|
+
require 'glimmer/dsl/css/element_rule_expression'
|
25
25
|
require 'glimmer/dsl/css/dynamic_property_expression'
|
26
26
|
require 'glimmer/dsl/css/css_expression'
|
27
|
+
require 'glimmer/dsl/css/rule_expression'
|
28
|
+
require 'glimmer/dsl/css/rul_expression'
|
29
|
+
require 'glimmer/dsl/css/ru_expression'
|
27
30
|
require 'glimmer/dsl/css/s_expression'
|
28
31
|
require 'glimmer/dsl/css/pv_expression'
|
29
32
|
|
@@ -33,7 +36,7 @@ module Glimmer
|
|
33
36
|
Engine.add_dynamic_expressions(
|
34
37
|
CSS,
|
35
38
|
%w[
|
36
|
-
|
39
|
+
element_rule
|
37
40
|
dynamic_property
|
38
41
|
]
|
39
42
|
)
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# Copyright (c) 2020-2024 - Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
require 'glimmer/dsl/expression'
|
23
|
+
require 'glimmer/dsl/parent_expression'
|
24
|
+
require 'glimmer/css/style_sheet'
|
25
|
+
require 'glimmer/css/rule'
|
26
|
+
|
27
|
+
module Glimmer
|
28
|
+
module DSL
|
29
|
+
module CSS
|
30
|
+
class ElementRuleExpression < Expression
|
31
|
+
include ParentExpression
|
32
|
+
|
33
|
+
def can_interpret?(parent, keyword, *args, &block)
|
34
|
+
parent.is_a?(Glimmer::CSS::StyleSheet) and
|
35
|
+
block_given? and
|
36
|
+
args.empty?
|
37
|
+
end
|
38
|
+
|
39
|
+
def interpret(parent, keyword, *args, &block)
|
40
|
+
Glimmer::CSS::Rule.new(keyword.to_s.downcase).tap do |rule|
|
41
|
+
parent.rules << rule
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# Copyright (c) 2020-2024 - Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
require 'glimmer/dsl/parent_expression'
|
23
|
+
require 'glimmer/css/style_sheet'
|
24
|
+
require 'glimmer/css/rule'
|
25
|
+
|
26
|
+
module Glimmer
|
27
|
+
module DSL
|
28
|
+
module CSS
|
29
|
+
module GeneralRuleExpression
|
30
|
+
include ParentExpression
|
31
|
+
|
32
|
+
def can_interpret?(parent, keyword, *args, &block)
|
33
|
+
super(parent, keyword, *args, &block) and
|
34
|
+
parent.is_a?(Glimmer::CSS::StyleSheet) and
|
35
|
+
block_given? and
|
36
|
+
!args.empty?
|
37
|
+
end
|
38
|
+
|
39
|
+
def interpret(parent, keyword, *args, &block)
|
40
|
+
Glimmer::CSS::Rule.new(args.first.to_s).tap do |rule|
|
41
|
+
parent.rules << rule
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# Copyright (c) 2020-2024 - Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
require 'glimmer/dsl/static_expression'
|
23
|
+
|
24
|
+
require 'glimmer/dsl/css/general_rule_expression'
|
25
|
+
|
26
|
+
module Glimmer
|
27
|
+
module DSL
|
28
|
+
module CSS
|
29
|
+
class RuExpression < StaticExpression
|
30
|
+
include GeneralRuleExpression
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# Copyright (c) 2020-2024 - Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
require 'glimmer/dsl/static_expression'
|
23
|
+
|
24
|
+
require 'glimmer/dsl/css/general_rule_expression'
|
25
|
+
|
26
|
+
module Glimmer
|
27
|
+
module DSL
|
28
|
+
module CSS
|
29
|
+
class RulExpression < StaticExpression
|
30
|
+
include GeneralRuleExpression
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2020-
|
1
|
+
# Copyright (c) 2020-2024 - Andy Maleh
|
2
2
|
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
@@ -19,28 +19,15 @@
|
|
19
19
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
20
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
21
|
|
22
|
-
require 'glimmer/dsl/
|
23
|
-
|
24
|
-
require 'glimmer/css/
|
25
|
-
require 'glimmer/css/rule'
|
22
|
+
require 'glimmer/dsl/static_expression'
|
23
|
+
|
24
|
+
require 'glimmer/dsl/css/general_rule_expression'
|
26
25
|
|
27
26
|
module Glimmer
|
28
27
|
module DSL
|
29
28
|
module CSS
|
30
|
-
class RuleExpression <
|
31
|
-
include
|
32
|
-
|
33
|
-
def can_interpret?(parent, keyword, *args, &block)
|
34
|
-
parent.is_a?(Glimmer::CSS::StyleSheet) and
|
35
|
-
block_given? and
|
36
|
-
args.empty?
|
37
|
-
end
|
38
|
-
|
39
|
-
def interpret(parent, keyword, *args, &block)
|
40
|
-
Glimmer::CSS::Rule.new(keyword.to_s.downcase).tap do |rule|
|
41
|
-
parent.rules << rule
|
42
|
-
end
|
43
|
-
end
|
29
|
+
class RuleExpression < StaticExpression
|
30
|
+
include GeneralRuleExpression
|
44
31
|
end
|
45
32
|
end
|
46
33
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2020-
|
1
|
+
# Copyright (c) 2020-2024 - Andy Maleh
|
2
2
|
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
@@ -20,27 +20,14 @@
|
|
20
20
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
21
|
|
22
22
|
require 'glimmer/dsl/static_expression'
|
23
|
-
|
24
|
-
require 'glimmer/css/
|
23
|
+
|
24
|
+
require 'glimmer/dsl/css/general_rule_expression'
|
25
25
|
|
26
26
|
module Glimmer
|
27
27
|
module DSL
|
28
28
|
module CSS
|
29
29
|
class SExpression < StaticExpression
|
30
|
-
include
|
31
|
-
|
32
|
-
def can_interpret?(parent, keyword, *args, &block)
|
33
|
-
keyword == 's' and
|
34
|
-
parent.is_a?(Glimmer::CSS::StyleSheet) and
|
35
|
-
block_given? and
|
36
|
-
!args.empty?
|
37
|
-
end
|
38
|
-
|
39
|
-
def interpret(parent, keyword, *args, &block)
|
40
|
-
Glimmer::CSS::Rule.new(args.first.to_s).tap do |rule|
|
41
|
-
parent.rules << rule
|
42
|
-
end
|
43
|
-
end
|
30
|
+
include GeneralRuleExpression
|
44
31
|
end
|
45
32
|
end
|
46
33
|
end
|
data/lib/glimmer-dsl-css.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2020-
|
1
|
+
# Copyright (c) 2020-2024 - Andy Maleh
|
2
2
|
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
@@ -26,3 +26,12 @@ require 'facets/string/camelcase'
|
|
26
26
|
require 'glimmer'
|
27
27
|
|
28
28
|
require 'glimmer/dsl/css/dsl'
|
29
|
+
|
30
|
+
module Glimmer
|
31
|
+
def _(selector, &rule_block)
|
32
|
+
rule(selector, &rule_block)
|
33
|
+
end
|
34
|
+
def r(selector, &rule_block)
|
35
|
+
rule(selector, &rule_block)
|
36
|
+
end
|
37
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-css
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AndyMaleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: 2.0.0
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
22
|
+
version: 3.0.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: 2.0.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
32
|
+
version: 3.0.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: rspec-mocks
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -174,7 +174,21 @@ dependencies:
|
|
174
174
|
- - "~>"
|
175
175
|
- !ruby/object:Gem::Version
|
176
176
|
version: 0.7.0
|
177
|
-
|
177
|
+
- !ruby/object:Gem::Dependency
|
178
|
+
name: rake-tui
|
179
|
+
requirement: !ruby/object:Gem::Requirement
|
180
|
+
requirements:
|
181
|
+
- - ">="
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: '0'
|
184
|
+
type: :development
|
185
|
+
prerelease: false
|
186
|
+
version_requirements: !ruby/object:Gem::Requirement
|
187
|
+
requirements:
|
188
|
+
- - ">="
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
version: '0'
|
191
|
+
description: Glimmer DSL for CSS (Ruby Programmable Cascading Style Sheets)
|
178
192
|
email: andy.am@gmail.com
|
179
193
|
executables: []
|
180
194
|
extensions: []
|
@@ -195,8 +209,12 @@ files:
|
|
195
209
|
- lib/glimmer/dsl/css/css_expression.rb
|
196
210
|
- lib/glimmer/dsl/css/dsl.rb
|
197
211
|
- lib/glimmer/dsl/css/dynamic_property_expression.rb
|
212
|
+
- lib/glimmer/dsl/css/element_rule_expression.rb
|
213
|
+
- lib/glimmer/dsl/css/general_rule_expression.rb
|
198
214
|
- lib/glimmer/dsl/css/property_expression.rb
|
199
215
|
- lib/glimmer/dsl/css/pv_expression.rb
|
216
|
+
- lib/glimmer/dsl/css/ru_expression.rb
|
217
|
+
- lib/glimmer/dsl/css/rul_expression.rb
|
200
218
|
- lib/glimmer/dsl/css/rule_expression.rb
|
201
219
|
- lib/glimmer/dsl/css/s_expression.rb
|
202
220
|
homepage: http://github.com/AndyObtiva/glimmer-dsl-css
|
@@ -218,8 +236,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
218
236
|
- !ruby/object:Gem::Version
|
219
237
|
version: '0'
|
220
238
|
requirements: []
|
221
|
-
rubygems_version: 3.3
|
239
|
+
rubygems_version: 3.5.3
|
222
240
|
signing_key:
|
223
241
|
specification_version: 4
|
224
|
-
summary: Glimmer DSL for CSS
|
242
|
+
summary: Glimmer DSL for CSS (Ruby Programmable Cascading Style Sheets)
|
225
243
|
test_files: []
|