atome 0.5.4.1.0 → 0.5.4.1.1

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: 1de05964aef532fdea97ad87df059c4c8d1680b95c9ff3e4f584bcd497f759d9
4
- data.tar.gz: 8ecfcf60c08122af0b74997d779a70e37826668c64abe1b9e557fafa2a60e8d5
3
+ metadata.gz: d25a52a19d43efc9be423d30200a1e9449c33a1cfd83236bf2decb48b8a9edde
4
+ data.tar.gz: a8498b1eebc5f7d1a02960a65173f37fe9f4c9bff861b0420d999afd1bb229fe
5
5
  SHA512:
6
- metadata.gz: b0ce2a3feae40b1a21f509699b25857ecbf8d3e3a0f6faa40a673b67ed1c592cb8a4676570e0e23681d83c098c045e48267ab1d3b04dc02b259799c16d79206b
7
- data.tar.gz: 3c828d6324954e125c17254cdf5376bdabfde5f4b155ee8c0c15eba9d8d10bdc1a6187176606b3f3207b53e2b927b67046fe496e91a760e2f3b2c336f3e1b666
6
+ metadata.gz: b54d244241eacb79b8c89f46fe97759826b6cde783224f16c629f822f0a8cbc556dc3f6ab1b29195b8b6dc0b0659a88e865aa1e32259aef85d08aab795b664d9
7
+ data.tar.gz: 9ad98aac937ffdba6019f19b66bd2fc3b2025c78db0e5260b49c1ef32e997ca5ab7522a91f9facf97d731105a4d536d0f695234d6c4ccb635de84594a2d35ea5
@@ -40,6 +40,10 @@ class Object
40
40
  grab(:view).box(params, &proc)
41
41
  end
42
42
 
43
+ def vector(params = {}, &proc)
44
+ grab(:view).vector(params, &proc)
45
+ end
46
+
43
47
  def circle(params = {}, &proc)
44
48
  grab(:view).circle(params, &proc)
45
49
  end
@@ -2,6 +2,8 @@
2
2
 
3
3
  new({ particle: :attach })
4
4
  new({ sanitizer: :attach }) do |parents_ids|
5
+ puts "=> attach it! : #{parents_ids} <="
6
+
5
7
  parents_ids = parents_ids if parents_ids.instance_of? Atome
6
8
  parents_ids = [parents_ids] unless parents_ids.instance_of?(Array)
7
9
  parents_ids.each do |parents_id|
@@ -28,6 +30,7 @@ end
28
30
 
29
31
  new({ particle: :attached })
30
32
  new({ sanitizer: :attached }) do |children_ids|
33
+ puts "=> attached now! : #{children_ids}<="
31
34
  children_ids = children_ids if children_ids.instance_of? Atome
32
35
  children_ids = [children_ids] unless children_ids.instance_of?(Array)
33
36
  children_ids.each do |child_id|
@@ -56,33 +56,4 @@ new ({particle: :opacity})
56
56
  # vector shape
57
57
  new({particle: :definition})
58
58
 
59
- new({ browser: :definition, type: :string }) do |value, _user_proc|
60
- # alert "value is #{value}"
61
- target=id
62
- `
63
-
64
- var divElement = document.querySelector('#'+#{target});;
65
-
66
- // select the first svg tag inside the div
67
- var svgElement = divElement.querySelector('svg');
68
-
69
- // delete the first svg tag inside the div if it exist
70
- if (svgElement) {
71
- divElement.removeChild(svgElement);
72
- }
73
-
74
-
75
- let svg_content='<svg style="width: 1em; height: 1em;vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg">'+#{value}+'</svg>'
76
- let svgContainer = document.getElementById(#{target});
77
- let parser = new DOMParser();
78
- let svgDoc = parser.parseFromString(svg_content, "image/svg+xml");
79
- let importedSVG = svgDoc.getElementsByTagName("svg")[0];
80
- importedSVG.style.width = "100%";
81
- importedSVG.style.height = "100%";
82
- let elements = importedSVG.getElementsByTagName("path");
83
-
84
- svgContainer.appendChild(importedSVG);
85
-
86
- `
87
-
88
- end
59
+ new({ browser: :definition, type: :string })
@@ -17,6 +17,9 @@ module Essentials
17
17
  box: { type: :shape, width: 99, height: 99,
18
18
  attached: :box_color, attach: [:view],
19
19
  left: 100, top: 100, clones: [], preset: :box },
20
+ vector: { type: :shape, width: 99, height: 99,
21
+ attach: [:view],
22
+ left: 100, top: 100, clones: [], preset: :vector },
20
23
  circle: { type: :shape, width: 99, height: 99, smooth: '100%',
21
24
  attached: :circle_color, attach: [:view],
22
25
  left: 100, top: 100, clones: [], preset: :circle },
@@ -22,6 +22,12 @@ class Atome
22
22
  Atome.new({ atome_type => params }, &bloc)
23
23
  end
24
24
 
25
+ def vector(params = {}, &bloc)
26
+ atome_type = :vector
27
+ params = atome_common(atome_type, params)
28
+ Atome.new({ atome_type => params }, &bloc)
29
+ end
30
+
25
31
  def circle(params = {}, &bloc)
26
32
  atome_type = :circle
27
33
  # puts "counter#{Universe.counter}"
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'atome/renderers/browser/opal_add_on'
3
4
  require 'atome/renderers/browser/effect'
4
5
  require 'atome/renderers/browser/event'
5
6
  require 'atome/renderers/browser/geometry'
@@ -62,11 +62,11 @@ generator.build_render(:browser_edit) do |value|
62
62
  if value == true
63
63
  caret_color = 'white'
64
64
  user_select = 'text'
65
- selection_color= 'blue'
65
+ selection_color = 'blue'
66
66
  else
67
67
  caret_color = 'transparent'
68
68
  user_select = 'none'
69
- selection_color= 'transparent'
69
+ selection_color = 'transparent'
70
70
  end
71
71
 
72
72
  @browser_object.attributes[:contenteditable] = value
@@ -90,6 +90,35 @@ generator.build_render(:browser_remove_classes) do |value, _user_proc|
90
90
  @browser_object.remove_class(value)
91
91
  end
92
92
 
93
- new ({browser: :opacity}) do |value|
93
+ new ({ browser: :opacity }) do |value|
94
94
  @browser_object.style['opacity'] = value
95
+ end
96
+
97
+ new ({ browser: :definition }) do |value|
98
+ target=id
99
+ `
100
+
101
+ var divElement = document.querySelector('#'+#{target});;
102
+
103
+ // select the first svg tag inside the div
104
+ var svgElement = divElement.querySelector('svg');
105
+
106
+ // delete the first svg tag inside the div if it exist
107
+ if (svgElement) {
108
+ divElement.removeChild(svgElement);
109
+ }
110
+
111
+
112
+ let svg_content='<svg style="width: 1em; height: 1em;vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg">'+#{value}+'</svg>'
113
+ let svgContainer = document.getElementById(#{target});
114
+ let parser = new DOMParser();
115
+ let svgDoc = parser.parseFromString(svg_content, "image/svg+xml");
116
+ let importedSVG = svgDoc.getElementsByTagName("svg")[0];
117
+ importedSVG.style.width = "100%";
118
+ importedSVG.style.height = "100%";
119
+ let elements = importedSVG.getElementsByTagName("path");
120
+
121
+ svgContainer.appendChild(importedSVG);
122
+
123
+ `
95
124
  end
@@ -0,0 +1,31 @@
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}';
6
+ `
7
+ end
8
+
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')
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.0'
4
+ VERSION = '0.5.4.1.1'
5
5
  end
@@ -1,8 +1,9 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="En">
3
3
  <head>
4
- <!-- <link rel="icon" type="image/x-icon" href="./favicon.ico">-->
5
- <link rel="icon" type="image/x-icon" href="https://github.com/atomecorp/atome/blob/master/vendor/assets/src/favicon.ico">
4
+ <!-- <link rel="icon" type="image/x-icon" href="./favicon.ico">-->
5
+ <link rel="icon" type="image/x-icon"
6
+ href="https://github.com/atomecorp/atome/blob/master/vendor/assets/src/favicon.ico">
6
7
 
7
8
 
8
9
  <meta name='viewport' content='initial-scale=1, width=device-width, viewport-fit=cover'>
@@ -10,21 +11,22 @@
10
11
  <meta name="format-detection" content="telephone=no">
11
12
  <meta name="msapplication-tap-highlight" content="no">
12
13
  <link type="text/css" rel="stylesheet" href="css/style.css">
14
+ <style id="atomic_style"></style>
13
15
  <script type="text/javascript" src="js/third_parties/interact.min.js"></script>
14
16
  <script type="text/javascript" src="js/third_parties/popmotion.min.js"></script>
15
17
  <script type="text/javascript" src="js/third_parties/sortable.min.js"></script>
16
18
  <script type="text/javascript" src="js/third_parties/wad.min.js"></script>
17
- <!-- <script type="text/javascript" src="js/third_parties/tone.min.js"></script>-->
18
- <!-- <script type="text/javascript" src="js/third_parties/xsound.min.js"></script>-->
19
+ <!-- <script type="text/javascript" src="js/third_parties/tone.min.js"></script>-->
20
+ <!-- <script type="text/javascript" src="js/third_parties/xsound.min.js"></script>-->
19
21
  <script type="text/javascript" src="js/third_parties/sha256.min.js"></script>
20
22
  <script type="text/javascript" src="js/third_parties/ping.min.js"></script>
21
- <!-- <script src='js/third_parties/w3color.js'></script>-->
23
+ <!-- <script src='js/third_parties/w3color.js'></script>-->
22
24
  <script src='js/opal/opal.js'></script>
23
25
  <script src='js/opal/opal_browser.js'></script>
24
26
  <!-- TODO: we line below is commented when using stand alone mode and loaded on demand when using server mode-->
25
- <script type="text/javascript" src="js/third_parties/fabric.min.js"></script>
27
+ <script type="text/javascript" src="js/third_parties/fabric.min.js"></script>
26
28
  <!-- <script type="text/javascript" src="js/third_parties/three.min.js"></script>-->
27
- <script src='js/opal/opal_parser.js'></script>
29
+ <script src='js/opal/opal_parser.js'></script>
28
30
  <script src='js/aui.js'></script>
29
31
 
30
32
  <script src='js/atome/atome_helpers/atome_animate.js' defer></script>
@@ -1,10 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # b=Atome.new(
4
+ # { shape: { renderers: [:browser], id: :the_shape, type: :shape, attach: [:view],
5
+ # left: 0, right: 0, top: 0, bottom: 0, width: 30, height: 30, overflow: :hidden, tag: {system: false}
6
+ # } })
3
7
 
4
- b=Atome.new(
5
- { shape: { renderers: [:browser], id: :the_shape, type: :shape, attach: [:view],
6
- left: 0, right: 0, top: 0, bottom: 0, width: 30, height: 30, overflow: :hidden, tag: {system: false}
7
- } })
8
+ b=vector
8
9
 
9
10
  edition = <<~STR
10
11
  <path id="p1" d="M257.7 752c2 0 4-0.2 6-0.5L431.9 722c2-0.4 3.9-1.3 5.3-2.8l423.9-423.9c3.9-3.9 3.9-10.2 0-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2c-1.9 11.1 1.5 21.9 9.4 29.8 6.6 6.4 14.9 9.9 23.8 9.9z m67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"/>
@@ -28,4 +29,5 @@ end
28
29
 
29
30
  wait 3 do
30
31
  b.color(:orange)
32
+ b.width(33)
31
33
  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.0
4
+ version: 0.5.4.1.1
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-17 00:00:00.000000000 Z
11
+ date: 2023-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: arduino_firmata
@@ -453,6 +453,7 @@ files:
453
453
  - lib/atome/renderers/browser/helpers/web_helper.rb
454
454
  - lib/atome/renderers/browser/identity.rb
455
455
  - lib/atome/renderers/browser/material.rb
456
+ - lib/atome/renderers/browser/opal_add_on.rb
456
457
  - lib/atome/renderers/browser/opal_browser.rb
457
458
  - lib/atome/renderers/browser/spatial.rb
458
459
  - lib/atome/renderers/browser/time.rb