atome 0.5.4.1.7 → 0.5.4.1.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1cd2344c47f76ea286f9a43141167d453be88717f538f71be93cbb43dd37487b
4
- data.tar.gz: 26af922e7831e2a363adf36baa7112bde11e1b2cf7cc460a74ed04e348d7d46f
3
+ metadata.gz: 4feb89bd1af8453078bbe9c826af8f6176c321ee7b155e109c3b8a3f6033e87e
4
+ data.tar.gz: 7d13f98dde5fbafb74f27eae1ea4fe025ef7de735c939414cc23708205963a6f
5
5
  SHA512:
6
- metadata.gz: '0847ca30e88fc3c5cb33fa43dd030022b01fa5646455c13f706681516de240a29e5dabb0b9a25a4f714c37a28b87b9523ddddc70989fb7e2618082054a55a51d'
7
- data.tar.gz: 6c8ddbb6432e002be2c4eea459bab8ef5a8e7b620789005889e272851a9912ebe88c785f01fc2d7bbed9923ad81aa90e23fea988ae71b817036937f1021428e4
6
+ metadata.gz: 82eca49b901057c6070c7db3f64496efee49b63833a27b6b0dc2388a32a7cf1e6b37a7531bec2e9272f963f9d39f75ae7884c20d89cbe1482c0abe58dc674b6e
7
+ data.tar.gz: c1013e2b38c94c2a46fef8aa91fade3361ef952d71be71e7ddbeada26955c43a7ce21e252a5ceadf954fd4a8ea96faf7298f5666be5db9311b1478f6280d834e
data/CHANGELOG.md CHANGED
@@ -15,4 +15,7 @@ vector now use class instead of a local style
15
15
  ## [0.5.4.1.7] - 2023-05-25
16
16
 
17
17
  remove "shape :pre" and move the condition when using :definition to atome_common , because of a bug that remove all
18
- attached atome
18
+ attached atome
19
+
20
+ ## [0.5.4.1.8] - 2023-05-25
21
+ Ready to add gradient color now systematically use a variable for each component( Red, green , blue , alpha)
@@ -23,17 +23,17 @@ generator.build_render(:browser_shape) do
23
23
  end
24
24
 
25
25
  generator.build_render(:browser_color) do |_value|
26
- puts " @atome[:id] : #{@atome[:id]}"
26
+ puts " @atome[:id] : #{@atome[:id]}"
27
27
  @browser_type = :style
28
28
  # puts "1 - for the id : #{id} the browser type is ::::> #{@browser_type}"
29
29
  id_found = @atome[:id]
30
30
  # type_found = @atome[:type]
31
31
  # we remove previous unused style tag
32
32
  BrowserHelper.browser_document[id]&.remove
33
- red_found = @atome[:red]
34
- blue_found = @atome[:blue]
35
- green_found = @atome[:green]
36
- alpha_found = @atome[:alpha]
33
+ red = @atome[:red]
34
+ green = @atome[:green]
35
+ blue = @atome[:blue]
36
+ alpha = @atome[:alpha]
37
37
  ########################### old code ###########################
38
38
  # BrowserHelper.browser_document.head << Browser.DOM("<style atome='#{type_found}'
39
39
  # id='#{id_found}'>.#{id_found}{
@@ -47,11 +47,30 @@ generator.build_render(:browser_color) do |_value|
47
47
  ########################### new code ###########################
48
48
  atomic_style = BrowserHelper.browser_document['#atomic_style']
49
49
 
50
+ # class_content = <<STR
51
+ # .#{id_found} {
52
+ # --#{id_found}_r : #{red * 255}
53
+ # --#{id_found}_g : #{green * 255}
54
+ # --#{id_found}_b : #{blue * 255}
55
+ # --#{id_found}_a : #{alpha}
56
+ # --#{id_found}_col : rgba(var(--#{id_found}_r ),var(--#{id_found}_g ),var(--#{id_found}_b ),var(--#{id_found}_a ))
57
+ #
58
+ # background-color: rgba(#{red * 255}, #{green * 255}, #{blue * 255}, #{alpha});
59
+ # fill: rgba(#{red * 255}, #{green * 255}, #{blue * 255}, #{alpha});
60
+ # stroke: rgba(#{red * 255}, #{green * 255}, #{blue * 255}, #{alpha});
61
+ # }
62
+ # STR
63
+
50
64
  class_content = <<STR
51
65
  .#{id_found} {
52
- background-color: rgba(#{red_found * 255}, #{green_found * 255}, #{blue_found * 255}, #{alpha_found});
53
- fill: rgba(#{red_found * 255}, #{green_found * 255}, #{blue_found * 255}, #{alpha_found});
54
- stroke: rgba(#{red_found * 255}, #{green_found * 255}, #{blue_found * 255}, #{alpha_found});
66
+ --#{id_found}_r : #{red * 255};
67
+ --#{id_found}_g : #{green * 255};
68
+ --#{id_found}_b : #{blue * 255};
69
+ --#{id_found}_a : #{alpha};
70
+ --#{id_found}_col : rgba(var(--#{id_found}_r ),var(--#{id_found}_g ),var(--#{id_found}_b ),var(--#{id_found}_a ));
71
+ background-color: var(--#{id_found}_col);
72
+ fill: var(--#{id_found}_col);
73
+ stroke: var(--#{id_found}_col);
55
74
  }
56
75
  STR
57
76
 
@@ -114,8 +133,8 @@ STR
114
133
  atomic_style.text += class_content
115
134
  end
116
135
  end
117
- #
118
- # @browser_object = BrowserHelper.browser_document[id_found]
136
+ #
137
+ # @browser_object = BrowserHelper.browser_document[id_found]
119
138
 
120
139
  end
121
140
 
@@ -2,14 +2,20 @@
2
2
 
3
3
  # for browser rendering
4
4
  module BrowserHelper
5
- def self.browser_colorize_color(color_updated, atome)
5
+ def self.browser_colorize_color(red, green, blue, alpha, atome)
6
6
  ########################### new code ###########################
7
7
  id_found=atome[:id]
8
+ # color_updated = "rgba(#{red}, #{green}, #{blue}, #{alpha})"
8
9
  new_class_content = <<STR
9
10
  .#{id_found} {
10
- background-color: #{color_updated};
11
- fill: #{color_updated};
12
- stroke: #{color_updated};
11
+ --#{id_found}_r : #{red * 255};
12
+ --#{id_found}_g : #{green * 255};
13
+ --#{id_found}_b : #{blue * 255};
14
+ --#{id_found}_a : #{alpha};
15
+ --#{id_found}_col : rgba(var(--#{id_found}_r ),var(--#{id_found}_g ),var(--#{id_found}_b ),var(--#{id_found}_a ));
16
+ background-color: var(--#{id_found}_col);
17
+ fill: var(--#{id_found}_col);
18
+ stroke: var(--#{id_found}_col);
13
19
  }
14
20
  STR
15
21
 
@@ -32,13 +38,16 @@ STR
32
38
 
33
39
  end
34
40
 
35
- def self.browser_colorize_shadow(color_updated, atome)
36
- "new shadow color is : #{color_updated}"
37
- puts "=====> #{color_updated} : #{atome}"
41
+ def self.browser_colorize_shadow(red, green, blue, alpha, atome)
42
+ # "new shadow color is : #{color_updated}"
43
+ # puts "=====> #{color_updated} : #{atome}"
44
+ # TODO: check if we need to use variable for the color or let it like it is!
38
45
  left = atome[:left]
39
46
  top = atome[:top]
40
47
  blur = atome[:blur]
41
48
  direction = atome[:direction]
49
+
50
+
42
51
  # shadow_updated = "#{left}px #{top}px #{blur}px #{color_updated} #{direction}"
43
52
  # `document.getElementById(#{atome[:id]}).sheet.cssRules[0].style.boxShadow = #{shadow_updated}`
44
53
 
@@ -46,7 +55,13 @@ STR
46
55
  id_found= atome[:id]
47
56
  class_content = <<STR
48
57
  .#{id_found} {
49
- box-shadow: #{left}px #{top}px #{blur}px #{color_updated} #{direction};
58
+ --#{id_found}_r : #{red * 255};
59
+ --#{id_found}_g : #{green * 255};
60
+ --#{id_found}_b : #{blue * 255};
61
+ --#{id_found}_a : #{alpha};
62
+ --#{id_found}_col : rgba(var(--#{id_found}_r ),var(--#{id_found}_g ),var(--#{id_found}_b ),var(--#{id_found}_a ));
63
+
64
+ box-shadow: #{left}px #{top}px #{blur}px var(--#{id_found}_col) #{direction};
50
65
  }
51
66
  STR
52
67
 
@@ -3,46 +3,46 @@
3
3
  generator = Genesis.generator
4
4
 
5
5
  generator.build_render(:red) do |value|
6
- red = ((@atome[:red] = value) * 255)
7
- green = @atome[:green] * 255
8
- blue = @atome[:blue] * 255
6
+ red = (@atome[:red] = value)
7
+ green = @atome[:green]
8
+ blue = @atome[:blue]
9
9
  alpha = @atome[:alpha]
10
- color_updated = "rgba(#{red}, #{green}, #{blue}, #{alpha})"
11
- BrowserHelper.send("browser_colorize_#{@atome[:type]}", color_updated, @atome)
10
+ # color_updated = "rgba(#{red}, #{green}, #{blue}, #{alpha})"
11
+ BrowserHelper.send("browser_colorize_#{@atome[:type]}", red, green, blue, alpha, @atome)
12
12
  # we return self to allow syntax of the type : a.color(:black).red(1).green(0.3)
13
13
  self
14
14
  end
15
15
 
16
16
  generator.build_render(:green) do |value|
17
17
  # we return self to allow syntax of the type : a.color(:black).red(1).green(0.3)
18
- red = @atome[:red] * 255
19
- green = (@atome[:green] = value) * 255
20
- blue = @atome[:blue] * 255
18
+ red = @atome[:red]
19
+ green = (@atome[:green] = value)
20
+ blue = @atome[:blue]
21
21
  alpha = @atome[:alpha]
22
- color_updated = "rgba(#{red}, #{green}, #{blue}, #{alpha})"
23
- BrowserHelper.send("browser_colorize_#{@atome[:type]}", color_updated, @atome)
22
+ # color_updated = "rgba(#{red}, #{green}, #{blue}, #{alpha})"
23
+ BrowserHelper.send("browser_colorize_#{@atome[:type]}", red, green, blue, alpha, @atome)
24
24
  # we return self to allow syntax of the type : a.color(:black).red(1).green(0.3)
25
25
  self
26
26
  end
27
27
 
28
28
  generator.build_render(:blue) do |value|
29
- red = @atome[:red] * 255
30
- green = @atome[:green] * 255
31
- blue = (@atome[:blue] = value) * 255
29
+ red = @atome[:red]
30
+ green = @atome[:green]
31
+ blue = (@atome[:blue] = value)
32
32
  alpha = @atome[:alpha]
33
- color_updated = "rgba(#{red}, #{green}, #{blue}, #{alpha})"
34
- BrowserHelper.send("browser_colorize_#{@atome[:type]}", color_updated, @atome)
33
+ # color_updated = "rgba(#{red}, #{green}, #{blue}, #{alpha})"
34
+ BrowserHelper.send("browser_colorize_#{@atome[:type]}", red, green, blue, alpha, @atome)
35
35
  # we return self to allow syntax of the type : a.color(:black).red(1).green(0.3)
36
36
  self
37
37
  end
38
38
 
39
39
  generator.build_render(:alpha) do |value|
40
- red = @atome[:red] * 255
41
- green = @atome[:green] * 255
42
- blue = @atome[:blue] * 255
40
+ red = @atome[:red]
41
+ green = @atome[:green]
42
+ blue = @atome[:blue]
43
43
  alpha = (@atome[:alpha] = value)
44
- color_updated = "rgba(#{red}, #{green}, #{blue}, #{alpha})"
45
- BrowserHelper.send("browser_colorize_#{@atome[:type]}", color_updated, @atome)
44
+ # color_updated = "rgba(#{red}, #{green}, #{blue}, #{alpha})"
45
+ BrowserHelper.send("browser_colorize_#{@atome[:type]}", red, green, blue, alpha, @atome)
46
46
  # we return self to allow syntax of the type : a.color(:black).red(1).green(0.3)
47
47
  self
48
48
  end
@@ -89,7 +89,7 @@ new ({ browser: :opacity }) do |value|
89
89
  end
90
90
 
91
91
  new ({ browser: :definition }) do |value|
92
- target=id
92
+ target = id
93
93
  `
94
94
 
95
95
  var divElement = document.querySelector('#'+#{target});;
@@ -1,31 +1,32 @@
1
- def add_new_class(class_name, tag_name, tag_content)
1
+ # def add_new_class(class_name, tag_name, tag_content)
2
+ #
3
+ # `
4
+ # var styleTag = document.getElementById("atomic_style");
5
+ # styleTag.innerHTML += "\n."+#{class_name}+'{\n '+#{tag_name}+': '+#{tag_content}+';\n}\n\n\n\n';
6
+ # `
7
+ # end
8
+ #
9
+ # add_new_class('new_class', 'background-color','yellow')
10
+ # add_new_class('other_class', 'color','red')
2
11
 
3
- `
4
- var styleTag = document.getElementById("atomic_style");
5
- styleTag.innerHTML += "\n ."+#{class_name}+'{\n '+#{tag_name}+': '+#{tag_content}+';\n}';
6
- `
7
- end
12
+ # def update_css_tag(tag_name, var_name, value)
13
+ # alert "this code doesn't work with chrome"
14
+ # `
15
+ # var rules = null;
16
+ # var cssRules = document.styleSheets[0].cssRules;
17
+ # for (var i = 0; i < cssRules.length; i++) {
18
+ # var rule = cssRules[i];
19
+ # if (rule.selectorText === '.'+#{tag_name}) {
20
+ # rules = rule;
21
+ # break;
22
+ # }
23
+ # }
24
+ #
25
+ # if (rules) {
26
+ #
27
+ # rules.style.setProperty(#{var_name}, #{value});
28
+ # }
29
+ # `
30
+ # end
8
31
 
9
- add_new_class('new_class', 'background-color','yellow')
10
- add_new_class('other_class', 'color','red')
11
-
12
- def update_css_tag(tag_name, var_name, value)
13
- `
14
- var rules = null;
15
- var cssRules = document.styleSheets[0].cssRules;
16
- for (var i = 0; i < cssRules.length; i++) {
17
- var rule = cssRules[i];
18
- if (rule.selectorText === '.'+#{tag_name}) {
19
- rules = rule;
20
- break;
21
- }
22
- }
23
-
24
- if (rules) {
25
-
26
- rules.style.setProperty(#{var_name}, #{value});
27
- }
28
- `
29
- end
30
-
31
- update_css_tag('other_class', '--end-color', 'blue')
32
+ # update_css_tag('other_class', '--end-color', 'blue')
data/lib/atome/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Atome
4
- VERSION = '0.5.4.1.7'
4
+ VERSION = '0.5.4.1.9'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atome
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4.1.7
4
+ version: 0.5.4.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean-Eric Godard
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-05-25 00:00:00.000000000 Z
11
+ date: 2023-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: arduino_firmata