glimmer-dsl-css 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '09f17a315cf56a9f08a1a91c57cc598f009a62b9badb2eba4da545cb17157f38'
4
- data.tar.gz: 4258369478ff7d33d7d666384d175bf3f0222d7dc792f36e372b028fa38a6339
3
+ metadata.gz: 967caae689a729dcf6c70d97a761bc48da8e8d285cd19348aada3dee83ffc32a
4
+ data.tar.gz: 8f896b942182779e573bed0a4c039efbabe724b40b3d82dff6ded1d5d0ebe8fd
5
5
  SHA512:
6
- metadata.gz: bc3d9abd5b4773008bba4e7ee710af47677123c0540d9bca7f15c3f25fd2cf3256b72d6fd4ade3400dfc0c8cd2ba990a5ec0c09009b9ba2776a2c21c2c81ec05
7
- data.tar.gz: 66ab0814f1e0ffba0aa4cde5c414763ec0a5b0388a5142b49e72697838b4228b23abd8cb8b77ede45013ce11ab8ca12f0bd7195dba61955cb076cbaefd864a9a
6
+ metadata.gz: b5faae751daf2f5e6c608682fd8c035993f4fef13ce7fa2c8ff21100b30f09338939cb7d3e9b33f225632ee203a5f858610c1992bf14954dc1e0efc1b135dbf6
7
+ data.tar.gz: '018c7875e4fcbd9c32012f0a489c5524de5cd76be406e1349ce0665204f5f4dac27e27ad0e98e30924816467f2c3ba66aa768533adbb26fa68f5ba506c0b8def'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
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
+
3
7
  ## 1.2.2
4
8
 
5
9
  - Relax glimmer dependency to between 2.0.0 and 3.0.0
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2020-2022 - Andy Maleh
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
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.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). 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
+ [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
- Within the context of [Glimmer](https://github.com/AndyObtiva/glimmer) app development, Glimmer DSL for CSS is useful in providing CSS for the [SWT Browser widget](https://github.com/AndyObtiva/glimmer-dsl-swt/tree/master#browser-widget).
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
- Additionally, it is useful with [Glimmer DSL for Opal](https://github.com/AndyObtiva/glimmer-dsl-opal).
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
- **[Glimmer](https://rubygems.org/gems/glimmer) DSL Comparison Table:**
15
- DSL | Platforms | Native? | Vector Graphics? | Pros | Cons | Prereqs
16
- ----|-----------|---------|------------------|------|------|--------
17
- [Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)](https://github.com/AndyObtiva/glimmer-dsl-swt) | Mac / Windows / Linux | Yes | Yes (Canvas Shape DSL) | Very Mature / Scaffolding / Native Executable Packaging / Custom Widgets | Slow JRuby Startup Time / Heavy Memory Footprint | Java / JRuby
18
- [Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)](https://github.com/AndyObtiva/glimmer-dsl-opal) | All Web Browsers | No | Yes (Canvas Shape DSL) | Simpler than All JavaScript Technologies / Auto-Webify Desktop Apps | Setup Process / Only Rails 5 Support for Now | Rails
19
- [Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-libui) | Mac / Windows / Linux | Yes | Yes (Area API) | Fast Startup Time / Light Memory Footprint | LibUI is an Incomplete Mid-Alpha Only | None Other Than MRI Ruby
20
- [Glimmer DSL for Tk (MRI Ruby Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-tk) | Mac / Windows / Linux | Some Native-Themed Widgets (Not Truly Native) | Yes (Canvas) | Fast Startup Time / Light Memory Footprint | Widgets Do Not Look Truly Native, Espcially on Linux | ActiveTcl / MRI Ruby
21
- [Glimmer DSL for GTK (Ruby-GNOME Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-gtk) | Mac / Windows / Linux | Only on Linux | Yes (Cairo) | Complete Access to GNOME Features on Linux (Forte) | Not Native on Mac and Windows | None Other Than MRI Ruby on Linux / Brew Packages on Mac / MSYS & MING Toolchains on Windows / MRI Ruby
22
- [Glimmer DSL for FX (FOX Toolkit Ruby Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-fx) | Mac (requires XQuartz) / Windows / Linux | No | Yes (Canvas) | No Prerequisites on Windows (Forte Since Binaries Are Included Out of The Box) | Widgets Do Not Look Native / Mac Usage Obtrusively Starts XQuartz | None Other Than MRI Ruby on Windows / XQuarts on Mac / MRI Ruby
23
- [Glimmer DSL for JFX (JRuby JavaFX Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-jfx) | Mac / Windows / Linux | No | Yes (javafx.scene.shape and javafx.scene.canvas) | Rich in Custom Widgets | Slow JRuby Startup Time / Heavy Memory Footprint / Widgets Do Not Look Native | Java / JRuby / JavaFX SDK
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.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.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` keyword or HTML element keyword directly (e.g. `body`)
77
- Rule property values may be specified by `pv` keyword or underscored property name directly (e.g. `font_size`)
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
- pv 'background', 'white'
114
+ background 'white'
88
115
  }
89
- s('body > h1') {
116
+ r('body > h1') {
90
117
  background_color :red
91
- pv 'font-size', 24
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 `pv 'font-size', 24`) automatically get suffixed with `px` by convention (e.g. `24px`).
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-2022 - Andy Maleh.
228
+ Copyright (c) 2020-2024 - Andy Maleh.
150
229
 
151
230
  --
152
231
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.2
1
+ 1.2.3
@@ -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.2 ruby lib
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.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 = "2023-06-15"
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,44 +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.2.22".freeze
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
- if s.respond_to? :specification_version then
46
- s.specification_version = 4
47
- end
49
+ s.specification_version = 4
48
50
 
49
- if s.respond_to? :add_runtime_dependency then
50
- s.add_runtime_dependency(%q<glimmer>.freeze, [">= 2.0.0", "< 3.0.0"])
51
- s.add_development_dependency(%q<rspec-mocks>.freeze, ["~> 3.0"])
52
- s.add_development_dependency(%q<rspec>.freeze, ["~> 3.0"])
53
- s.add_development_dependency(%q<puts_debuggerer>.freeze, [">= 0"])
54
- s.add_development_dependency(%q<rake>.freeze, [">= 10.1.0", "< 14.0.0"])
55
- s.add_development_dependency(%q<jeweler>.freeze, [">= 2.3.9", "< 3.0.0"])
56
- s.add_development_dependency(%q<rdoc>.freeze, [">= 6.2.1", "< 7.0.0"])
57
- s.add_development_dependency(%q<coveralls>.freeze, ["= 0.8.23"])
58
- s.add_development_dependency(%q<simplecov>.freeze, ["~> 0.16.1"])
59
- s.add_development_dependency(%q<simplecov-lcov>.freeze, ["~> 0.7.0"])
60
- s.add_development_dependency(%q<rake-tui>.freeze, [">= 0"])
61
- else
62
- s.add_dependency(%q<glimmer>.freeze, [">= 2.0.0", "< 3.0.0"])
63
- s.add_dependency(%q<rspec-mocks>.freeze, ["~> 3.0"])
64
- s.add_dependency(%q<rspec>.freeze, ["~> 3.0"])
65
- s.add_dependency(%q<puts_debuggerer>.freeze, [">= 0"])
66
- s.add_dependency(%q<rake>.freeze, [">= 10.1.0", "< 14.0.0"])
67
- s.add_dependency(%q<jeweler>.freeze, [">= 2.3.9", "< 3.0.0"])
68
- s.add_dependency(%q<rdoc>.freeze, [">= 6.2.1", "< 7.0.0"])
69
- s.add_dependency(%q<coveralls>.freeze, ["= 0.8.23"])
70
- s.add_dependency(%q<simplecov>.freeze, ["~> 0.16.1"])
71
- s.add_dependency(%q<simplecov-lcov>.freeze, ["~> 0.7.0"])
72
- s.add_dependency(%q<rake-tui>.freeze, [">= 0"])
73
- 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])
74
62
  end
75
63
 
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2022 - Andy Maleh
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
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2022 - Andy Maleh
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
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2022 - Andy Maleh
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
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2022 - Andy Maleh
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/rule_expression'
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
- rule
39
+ element_rule
37
40
  dynamic_property
38
41
  ]
39
42
  )
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2022 - Andy Maleh
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
@@ -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
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2022 - Andy Maleh
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
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2022 - Andy Maleh
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
@@ -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-2022 - Andy Maleh
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/expression'
23
- require 'glimmer/dsl/parent_expression'
24
- require 'glimmer/css/style_sheet'
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 < 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
29
+ class RuleExpression < StaticExpression
30
+ include GeneralRuleExpression
44
31
  end
45
32
  end
46
33
  end
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2022 - Andy Maleh
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
- require 'glimmer/css/style_sheet'
24
- require 'glimmer/css/rule'
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 ParentExpression
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
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2022 - Andy Maleh
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.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: 2023-06-15 00:00:00.000000000 Z
11
+ date: 2024-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: glimmer
@@ -188,7 +188,7 @@ dependencies:
188
188
  - - ">="
189
189
  - !ruby/object:Gem::Version
190
190
  version: '0'
191
- description: Glimmer DSL for CSS (Cascading Style Sheets)
191
+ description: Glimmer DSL for CSS (Ruby Programmable Cascading Style Sheets)
192
192
  email: andy.am@gmail.com
193
193
  executables: []
194
194
  extensions: []
@@ -209,8 +209,12 @@ files:
209
209
  - lib/glimmer/dsl/css/css_expression.rb
210
210
  - lib/glimmer/dsl/css/dsl.rb
211
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
212
214
  - lib/glimmer/dsl/css/property_expression.rb
213
215
  - lib/glimmer/dsl/css/pv_expression.rb
216
+ - lib/glimmer/dsl/css/ru_expression.rb
217
+ - lib/glimmer/dsl/css/rul_expression.rb
214
218
  - lib/glimmer/dsl/css/rule_expression.rb
215
219
  - lib/glimmer/dsl/css/s_expression.rb
216
220
  homepage: http://github.com/AndyObtiva/glimmer-dsl-css
@@ -232,8 +236,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
232
236
  - !ruby/object:Gem::Version
233
237
  version: '0'
234
238
  requirements: []
235
- rubygems_version: 3.2.22
239
+ rubygems_version: 3.5.3
236
240
  signing_key:
237
241
  specification_version: 4
238
- summary: Glimmer DSL for CSS
242
+ summary: Glimmer DSL for CSS (Ruby Programmable Cascading Style Sheets)
239
243
  test_files: []