atome 0.5.5.9.1 → 0.5.6.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +9 -2
  3. data/documentation/deep learning/basic_infos.txt +9 -17
  4. data/exe/atome +13 -13
  5. data/lib/atome/atome.rb +5 -6
  6. data/lib/atome/eve.rb +0 -0
  7. data/lib/atome/extensions/atome.rb +52 -0
  8. data/lib/atome/genesis/generators/atome.rb +3 -0
  9. data/lib/atome/genesis/generators/communication.rb +7 -2
  10. data/lib/atome/genesis/generators/geometry.rb +0 -3
  11. data/lib/atome/genesis/generators/spatial.rb +19 -40
  12. data/lib/atome/genesis/generators/utility.rb +16 -12
  13. data/lib/atome/genesis/genesis.rb +2 -1
  14. data/lib/atome/genesis/sparkle.rb +5 -2
  15. data/lib/atome/helpers/essentials.rb +9 -9
  16. data/lib/atome/helpers/utilities.rb +26 -0
  17. data/lib/atome/kernel/ruby +0 -0
  18. data/lib/atome/presets/atome.rb +4 -1
  19. data/lib/atome/version.rb +2 -1
  20. data/lib/atome.rb +1 -1
  21. data/lib/atome_relative.rb +1 -1
  22. data/lib/renderers/html/geometry.rb +30 -18
  23. data/lib/renderers/html/html.rb +11 -1
  24. data/lib/renderers/html/identity.rb +2 -1
  25. data/lib/renderers/html/spatial.rb +6 -7
  26. data/server/atome_server.rb +148 -0
  27. data/server/atome_server_wasm.rb +112 -0
  28. data/server/capture.rb +10 -0
  29. data/server/config.ru +13 -0
  30. data/src/css/style.css +162 -0
  31. data/src-tauri/.gitignore +4 -0
  32. data/src-tauri/Cargo.toml +27 -0
  33. data/src-tauri/build.rs +3 -0
  34. data/src-tauri/icons/128x128.png +0 -0
  35. data/src-tauri/icons/128x128@2x.png +0 -0
  36. data/src-tauri/icons/32x32.png +0 -0
  37. data/src-tauri/icons/Square107x107Logo.png +0 -0
  38. data/src-tauri/icons/Square142x142Logo.png +0 -0
  39. data/src-tauri/icons/Square150x150Logo.png +0 -0
  40. data/src-tauri/icons/Square284x284Logo.png +0 -0
  41. data/src-tauri/icons/Square30x30Logo.png +0 -0
  42. data/src-tauri/icons/Square310x310Logo.png +0 -0
  43. data/src-tauri/icons/Square44x44Logo.png +0 -0
  44. data/src-tauri/icons/Square71x71Logo.png +0 -0
  45. data/src-tauri/icons/Square89x89Logo.png +0 -0
  46. data/src-tauri/icons/StoreLogo.png +0 -0
  47. data/src-tauri/icons/icon.icns +0 -0
  48. data/src-tauri/icons/icon.ico +0 -0
  49. data/src-tauri/icons/icon.png +0 -0
  50. data/src-tauri/src/main.rs +71 -0
  51. data/src-tauri/tauri.conf.json +70 -0
  52. data/src-wasm/wasm/wasi-vfs-osx_arm +0 -0
  53. data/src-wasm/wasm/wasi-vfs-osx_x86 +0 -0
  54. data/src-wasm/wasm/wasi-vfs-unix +0 -0
  55. data/src-wasm/wasm/wasi-vfs.exe +0 -0
  56. data/vendor/assets/application/examples/center.rb +2 -3
  57. data/vendor/assets/application/examples/compute.rb +1 -1
  58. data/vendor/assets/application/examples/css.rb +6 -0
  59. data/vendor/assets/application/examples/int8.rb +4 -1
  60. data/vendor/assets/application/examples/selected.rb +6 -0
  61. data/vendor/assets/application/examples/sub_atome_manipulation.rb +19 -0
  62. data/vendor/assets/application/examples/test.rb +19 -12
  63. data/vendor/assets/application/examples/unit.rb +1 -1
  64. data/vendor/assets/application/index.rb +1 -1
  65. data/vendor/assets/server/atome_server.rb +178 -33
  66. data/vendor/assets/src/index_server.html +2 -0
  67. data/vendor/assets/src/index_server_wasm.html +1 -0
  68. data/vendor/assets/src/js/atome/atome_helpers/communication.js +2 -4
  69. metadata +38 -12
  70. data/vendor/assets/application/required_example.rb +0 -1
  71. data/vendor/assets/application/test.rb +0 -29
  72. data/vendor/assets/application/works/photos.rb +0 -672
  73. data/vendor/assets/application/works/photos2.rb +0 -218
  74. data/vendor/assets/application/works/photos3.rb +0 -343
  75. data/vendor/assets/application/works/photos4.rb +0 -34
  76. data/vendor/assets/application/works/photos6.rb +0 -6
  77. data/vendor/assets/application/works/vie.rb +0 -196
  78. /data/{vendor/assets/application/works/trigga.rb → Guardfile} +0 -0
  79. /data/vendor/assets/application/examples/{presets.rb → preset.rb} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3bff5ca5d96c5da19c164ec49593ae7f237251c9656135a6f74d8fcfb028243a
4
- data.tar.gz: fc6035092c39b7d795157ab5b5dd91db2b1b7a3037b3d1af356c33050a316348
3
+ metadata.gz: 8723d92d171605dde5e7804554d0565a59ae6f772f2629a25f8ac82b03cf6c68
4
+ data.tar.gz: 36539ec4e3587e178e771571e3f2ed833bbcd7f36d8a2d33fc33e8212890bd77
5
5
  SHA512:
6
- metadata.gz: 10ca739de4b2760d6d77267f50ddc9aaf7d6b003e50dae9e2535259e542d83dc4da6536184fa45f59cafb84a4daf11764cb6f46e7fdc59028a3e201c4340d4f4
7
- data.tar.gz: 6c58b50fab38c6d5c89e4ec86e384530165a1e26547f13415e0e056fd7c7c94c4b9cb75cc4f72bcf40c90c112d098dc1d0e1dd44ad2fa475b992c31e25f68c83
6
+ metadata.gz: 7e36f92c209efba8c326f976689804a4283fe7b1230d41425571299f7d4954681d5cd36bb3d9414f0edb737cadafbc08792efba457c1e479e27eeaa285526adf
7
+ data.tar.gz: f9350e9bfe6a2d428e53b88d51e603bbdace00ae8953ef325b4180d90769980e51bb71eb7148b1e93c5185081c92dfde27beb0f7f0d5157a561049d4d84c6f38
data/Rakefile CHANGED
@@ -285,7 +285,7 @@ task :osx_server do
285
285
 
286
286
  end
287
287
 
288
- task :build_gem do
288
+ def gem_builder
289
289
  # building the gem
290
290
  `rake build` # run build_app thru ARGV in exe atome
291
291
  # installing the gem
@@ -301,14 +301,21 @@ task :build_gem do
301
301
  `cd pkg; gem install atome --local`
302
302
  # open the app
303
303
  end
304
+ end
305
+
306
+ task :build_gem do
307
+ gem_builder
304
308
 
305
309
  puts 'atome gem built and installed'
306
310
  end
307
311
 
308
312
 
309
313
  task :push_gem do
310
- # pushing the gem
311
314
 
315
+ # building gem
316
+ gem_builder
317
+
318
+ # pushing the gem
312
319
  dir_path = './pkg'
313
320
  entries = Dir.entries(dir_path)
314
321
 
@@ -109,12 +109,13 @@ cd my_app
109
109
  atome run browser
110
110
 
111
111
 
112
+ getter setter for atome are situated in lib/atome/genesis/genesis.rb : def new_atome(element, &method_proc)
113
+ the getter return a group from the collected atomes ( all included atomes)
112
114
 
113
115
 
114
116
 
115
-
116
- #Third parties javascript library is located at different location
117
- #If you need to update it or add a JS library you need to clone : https://github.com/atomecorp/atome_third_parties_js.git
117
+ # Third parties's javascript libraries are located at different location
118
+ # If you need to update it or add a JS library you need to clone : https://github.com/atomecorp/atome_third_parties_js.git
118
119
 
119
120
  The importance of the type :
120
121
 
@@ -145,12 +146,9 @@ class Object
145
146
  renderers are build here : /Users/jean-ericgodard/Documents/Work/codes/atome/lib/atome/genesis/genesis.rb
146
147
  def build_render(renderer_name, &method_proc)
147
148
 
149
+ remove condition /Users/jean-ericgodard/Documents/Work/codes/atome/lib/renderers/renderer.rb in def rendering
148
150
 
149
-
150
-
151
- remove condition /Users/jean-ericgodard/Documents/Work/codes/atome/lib/renderers/renderer.rb in def rendering
152
-
153
- New particle exemple :
151
+ New particle example :
154
152
 
155
153
  new({ particle: :shell })
156
154
  # automatically create a @shell instance variable in the atome to store the value
@@ -216,7 +214,6 @@ To save manually you can use the store method , like this :
216
214
 
217
215
  store({build: :my_data })
218
216
 
219
-
220
217
  The modifier atomes (color, shadow)
221
218
  Here is the mechanism of such atome:
222
219
 
@@ -232,15 +229,12 @@ Each Each particles and atome is store as an :
232
229
  It may need a bit more optimization
233
230
 
234
231
 
235
- Atomes have a special method to refresh all attached /affected atomes , call : Atome.global_monitoring
232
+ Atomes have a special method to monitor all attached /affected atomes , call : Atome.global_monitoring
236
233
  Code at : helpers/utilities.rb /def global_monitoring
237
234
  Usage :
238
235
  Atome.global_monitoring(self, [:red, :blue, :blue, :alpha, :left, :right, :diffusion], [:variable1, :variable2])
239
236
 
240
-
241
- The ephemera @new_atome to allow access to data send to the atome at init time
242
-
243
-
237
+ The ephemera @new_atome to allow access to data send to the atome at init time
244
238
 
245
239
  Important : for atomes that needs to be attached or apply to
246
240
  This happen in the method in presets/atome.rb : atome_common
@@ -248,8 +242,6 @@ at this line :
248
242
  if params[:type] == :color || basic_params[:type] == :color || params[:type] == :shadow || basic_params[:type] == :shadow
249
243
 
250
244
 
251
-
252
-
253
245
  Sanitizer , pre, post , after in atome/helpers/utilities.rb
254
246
 
255
247
  Sanitizer :
@@ -275,7 +267,7 @@ To alter a particle before getting the value
275
267
 
276
268
 
277
269
 
278
- pay attention to atome category marterial vs modifier
270
+ pay attention to atome category material vs modifier
279
271
  color, shadow and paint are modifier
280
272
  while shape, image, vector, video audio are materials
281
273
 
data/exe/atome CHANGED
@@ -184,6 +184,7 @@ def create_application(source, destination, project_name)
184
184
  end
185
185
 
186
186
  def update_application(source, destination, project_name)
187
+ `gem install atome`
187
188
  project_path = "#{destination}/#{project_name}"
188
189
  FileUtils.mkdir_p(destination) unless Dir.exist?(destination)
189
190
  FileUtils.mkdir_p(project_path) unless Dir.exist?(project_path)
@@ -664,17 +665,17 @@ else
664
665
  build_host_mode(destination, project_name, 'web-opal')
665
666
  threads = []
666
667
  threads << Thread.new do
667
- sleep 1
668
- if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
669
- # code to exec with Windows
670
- `start "" "#{destination}\\#{project_name}\\src\\index_opal.html`
671
- elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
672
- # code to exec with MacOS
673
- `open http://localhost:9292`
674
- else
675
- # code to exec with Unix/Linux
676
- `open http://localhost:9292`
677
- end
668
+ # sleep 1
669
+ # if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
670
+ # # code to exec with Windows
671
+ # `start "" "#{destination}\\#{project_name}\\src\\index_server.html`
672
+ # elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
673
+ # # code to exec with MacOS
674
+ # `open http://localhost:9292`
675
+ # else
676
+ # # code to exec with Unix/Linux
677
+ # `open http://localhost:9292`
678
+ # end
678
679
  end
679
680
  threads << Thread.new do
680
681
  build_for_server(destination, project_name, 9292, false)
@@ -688,7 +689,7 @@ else
688
689
  build_opal_application(nil, destination, project_name)
689
690
  if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
690
691
  # code to exec with Windows
691
- `start "" "#{destination}\\#{project_name}\\src\\index_opal.html`
692
+ `start "" "#{destination}\\#{project_name}\\src\\index_server.html`
692
693
  elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
693
694
  # code to exec with MacOS
694
695
  `open http://localhost:9292`
@@ -706,7 +707,6 @@ else
706
707
  end
707
708
 
708
709
  puts 'building Android' if ARGV.include?('android')
709
-
710
710
  puts 'building iOS' if ARGV.include?('ios')
711
711
  puts 'building Windows' if ARGV.include?('windows')
712
712
  puts 'building Linux' if ARGV.include?('linux')
data/lib/atome/atome.rb CHANGED
@@ -14,9 +14,12 @@ class Atome
14
14
  @callback = {}
15
15
  @tag = {}
16
16
  @selected = false
17
- @metrics = {}
17
+ #@metrics = {}
18
18
  @unit = {}
19
19
  @collect = {}
20
+ @collect = {}
21
+ @int8= {}
22
+ @css = {}
20
23
  @id = new_atome[:id] || identity_generator(:element)
21
24
  @type = new_atome[:type] || :element
22
25
  @attached = []
@@ -28,11 +31,7 @@ class Atome
28
31
  # now we store the proc in a an atome's property called :bloc
29
32
  new_atome[:code] = atomes_proc if atomes_proc
30
33
  # we reorder the hash
31
- ordered_keys = %i[renderers id alien type int8 unit]
32
- ordered_part = ordered_keys.map { |k| [k, new_atome[k]] }.to_h
33
- other_part = new_atome.reject { |k, _| ordered_keys.include?(k) }
34
- # merge the parts to obtain an re-ordered hash
35
- reordered_atome = ordered_part.merge(other_part)
34
+ reordered_atome =reorder_particles(new_atome)
36
35
 
37
36
  # FIXME : try to remove the condition below (it crash in the method : def generator ... in genesis.rb)
38
37
  collapse(reordered_atome)
data/lib/atome/eve.rb ADDED
File without changes
@@ -40,6 +40,17 @@ class Object
40
40
  end
41
41
  end
42
42
 
43
+ def reorder_particles(hash_to_reorder)
44
+ # we reorder the hash
45
+ ordered_keys = %i[renderers id alien type attach int8 unit]
46
+
47
+ ordered_part = ordered_keys.map { |k| [k, hash_to_reorder[k]] }.to_h
48
+ other_part = hash_to_reorder.reject { |k, _| ordered_keys.include?(k) }
49
+ # merge the parts to obtain an re-ordered hash
50
+ reordered_hash = ordered_part.merge(other_part)
51
+ reordered_hash
52
+ end
53
+
43
54
  def delete (atomes)
44
55
  grab(:view).delete(atomes)
45
56
  end
@@ -484,3 +495,44 @@ class Object
484
495
  end
485
496
 
486
497
  end
498
+
499
+
500
+ class CssProxy
501
+ def initialize(js, parent_key = nil, current_atome)
502
+ @js = js
503
+ @css={}
504
+ @parent_key = parent_key
505
+ @style = {}
506
+ @current_atome=current_atome
507
+ end
508
+
509
+
510
+ def [](key)
511
+ if @parent_key
512
+ @current_atome.instance_variable_get('@css')[@parent_key]&.[](key)
513
+ else
514
+ CssProxy.new(@js, key, @current_atome)
515
+ end
516
+ end
517
+
518
+
519
+
520
+ def []=(key, value)
521
+ if @parent_key
522
+ @js[@parent_key][key] = value
523
+ @current_atome.instance_variable_set('@css',{@parent_key => {key => value}})
524
+ @css[@parent_key]={key => value}
525
+ puts "==> Clé parente: #{@parent_key}, Clé: #{key}, Valeur: #{value}"
526
+ else
527
+ @style[key] = value
528
+ @js[key] = value
529
+ end
530
+
531
+ @js.update_style(@style) if @parent_key.nil?
532
+ end
533
+
534
+ def to_s
535
+ @current_atome.instance_variable_get('@css').to_s
536
+ end
537
+
538
+ end
@@ -95,5 +95,8 @@ new({ atome: :vector })
95
95
  new({ atome: :matrix })
96
96
  new({ atome: :atomized, type: :hash })
97
97
 
98
+ # new({ atome: :color, type: :model })
99
+ new({ atome: :color, type: :template })
100
+
98
101
 
99
102
 
@@ -1,8 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  new({ particle: :connection }) do |params, bloc|
4
- params = { server: params } unless params.instance_of? Hash
5
- html.connect(params[:server], &bloc)
4
+ # params = { server: params }
5
+ # type = { server: params }
6
+ params[:user] = Universe.current_user
7
+ params[:pass] = Black_matter.password
8
+ params[:atomes] = Universe.atome_list
9
+ params[:particles] = Universe.particle_list
10
+ html.connect(params, &bloc)
6
11
  end
7
12
 
8
13
  new({ particle: :message }) do |params, bloc|
@@ -2,9 +2,6 @@
2
2
 
3
3
  new({ particle: :width })
4
4
  new({ particle: :height })
5
- # new({ particle: :size }) do |params|
6
- # params
7
- # end
8
5
 
9
6
  new({ particle: :size }) do |params|
10
7
  params = { value: params } unless params.instance_of? Hash
@@ -1,29 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # new ({particle: :left}) do |params|
4
- # {value: params, unit: :px} unless params.instance_of? Hash
5
- # end
6
- # new({ particle: :right, type: :integer })do |params|
7
- # {value: params, unit: :px} unless params.instance_of? Hash
8
- # end
9
- # new({ particle: :top, type: :integer })do |params|
10
- # {value: params, unit: :px} unless params.instance_of? Hash
11
- #
12
- # end
13
- # new({ particle: :bottom, type: :integer })do |params|
14
- # {value: params, unit: :px} unless params.instance_of? Hash
15
- # end
16
-
17
- new ({particle: :left})
18
- new ({particle: :right})
19
- new ({particle: :top})
20
- new ({particle: :bottom})
21
-
22
-
3
+ new({ particle: :left })
4
+ new({ particle: :right })
5
+ new({ particle: :top })
6
+ new({ particle: :bottom })
23
7
  new({ particle: :rotate, type: :integer })
24
8
  new({ particle: :direction, type: :string })
25
- new({ particle: :center, type: :string})
26
- new({particle: :depth, type: :integer})
9
+ new({ particle: :depth, type: :integer })
27
10
  new({ particle: :position })
28
11
  new({ particle: :organise })
29
12
  new({ particle: :spacing })
@@ -32,7 +15,6 @@ new({ particle: :display }) do |params|
32
15
  params
33
16
  end
34
17
  new({ particle: :layout }) do |params|
35
-
36
18
  mode_found = params.delete(:mode) || :list
37
19
  elements_style = params.delete(:element) || {}
38
20
  # now we get the list of the atome to layout
@@ -45,14 +27,13 @@ new({ particle: :layout }) do |params|
45
27
  atomes_to_organise.each do |atome_id_to_organise|
46
28
  atome_found = grab(atome_id_to_organise)
47
29
  # now restoring
48
- if atome_found.backup
49
- atome_found.backup.each do |particle, value|
50
- atome_found.send(:delete, particle)
51
- atome_found.send(particle, value)
52
- end
53
- atome_found.remove_layout
54
- end
30
+ next unless atome_found.backup
55
31
 
32
+ atome_found.backup.each do |particle, value|
33
+ atome_found.send(:delete, particle)
34
+ atome_found.send(particle, value)
35
+ end
36
+ atome_found.remove_layout
56
37
  end
57
38
  else
58
39
 
@@ -76,12 +57,10 @@ new({ particle: :layout }) do |params|
76
57
  atomes_to_organise.each do |atome_id_to_organise|
77
58
  atome_found = grab(atome_id_to_organise)
78
59
  # now restoring
79
- if atome_found.backup
80
- atome_found.backup.each do |particle, value|
81
- atome_found.send(:delete, particle)
82
- atome_found.send(particle, value)
83
- end
84
- # atome_found.remove_layout
60
+ # atome_found.remove_layout
61
+ atome_found.backup&.each do |particle, value|
62
+ atome_found.send(:delete, particle)
63
+ atome_found.send(particle, value)
85
64
  end
86
65
  # we remove previous display mode
87
66
  atome_found.remove_layout
@@ -107,7 +86,7 @@ new({ particle: :layout }) do |params|
107
86
  end
108
87
  params
109
88
  end
110
- new({particle: :center})
111
-
112
-
113
-
89
+ new({ particle: :center, type: :hash }) do |params|
90
+ params = { x: 0, y: 0, dynamic: true } if params == true
91
+ params
92
+ end
@@ -65,17 +65,16 @@ new({ particle: :delete, render: false }) do |params|
65
65
  end
66
66
  new({ particle: :clear })
67
67
 
68
-
69
68
  new({ post: :clear }) do
70
- attached_found = []
71
- attached.each do |attached_id_found|
72
- attached_found << attached_id_found
73
- end
74
- attached_found.each do |child_id_found|
75
- child_found = grab(child_id_found)
76
- # we exclude system objects
77
- child_found&.delete(true) unless child_found.tag && child_found.tag[:system]
78
- end
69
+ attached_found = []
70
+ attached.each do |attached_id_found|
71
+ attached_found << attached_id_found
72
+ end
73
+ attached_found.each do |child_id_found|
74
+ child_found = grab(child_id_found)
75
+ # we exclude system objects
76
+ child_found&.delete(true) unless child_found.tag && child_found.tag[:system]
77
+ end
79
78
  end
80
79
  new({ particle: :path })
81
80
  new({ particle: :schedule }) do |date, proc|
@@ -113,7 +112,7 @@ end
113
112
  new({ particle: :relations, type: :hash })
114
113
  new({ particle: :tag, render: false, type: :hash })
115
114
  new({ particle: :web })
116
- new({ particle: :metrics, type: :hash })
115
+ # new({ particle: :metrics, type: :hash })
117
116
  new({ initialize: :unit, value: {} })
118
117
  new({ particle: :login }) do |params|
119
118
  set_current_user(id) if params
@@ -239,10 +238,15 @@ new({ particle: :compute }) do |params|
239
238
  params
240
239
  end
241
240
 
242
-
243
241
  new({ particle: :get }) do |params|
244
242
  cell = params[:cell]
245
243
  row_nb = cell[0]
246
244
  column_nb = cell[1]
247
245
  data[row_nb][data[row_nb].keys[column_nb]] # we get the content of the cell
246
+ end
247
+
248
+ new ({ particle: :css })
249
+
250
+ new({ read: :css }) do
251
+ CssProxy.new(js, nil, self)
248
252
  end
@@ -149,7 +149,8 @@ class Genesis
149
149
  collected_atomes << attached_atome if grab(attached_atome).type.to_sym == element.to_sym
150
150
  end
151
151
  end
152
- collected_atomes
152
+ group({ collect: collected_atomes })
153
+
153
154
  end
154
155
  end
155
156
 
@@ -72,7 +72,7 @@ Atome.new(
72
72
  # unreal port, hold system object and tools
73
73
  Atome.new(
74
74
  { renderers: default_render, id: :intuition, type: :shape, attach: :user_view, tag: { system: true },
75
- left: 0, top: 0, width: 0, height: 0, overflow: :visible
75
+ left: 0, top: 0, bottom: 0,width: 0, height: :auto, overflow: :visible
76
76
  }
77
77
  )
78
78
 
@@ -137,4 +137,7 @@ STR
137
137
  code_text.touch(true) do
138
138
  eval(code)
139
139
  end
140
- end
140
+ end
141
+
142
+ # we init server default address
143
+ A.server({ address: 'localhost:9292' , type: 'ws'})
@@ -22,18 +22,18 @@ module Essentials
22
22
  video: { type: :video },
23
23
  animation: { type: :animation, attach: :black_matter },
24
24
  element: { type: :element, renderers: [], attach: :black_matter },
25
- box: { type: :shape, width: 99, height: 99,
25
+ box: { type: :shape, width: 39, height: 39,
26
26
  apply: [:box_color],
27
- left: 100, top: 100, preset: :box },
28
- vector: { type: :vector, width: 99, height: 99,
29
- left: 100, top: 100, preset: :vector, definition: corp },
30
- circle: { type: :shape, width: 99, height: 99, smooth: '100%',
27
+ left: 0, top: 0, preset: :box },
28
+ vector: { type: :vector, width: 39, height: 39,
29
+ left: 0, top: 0, preset: :vector, definition: corp },
30
+ circle: { type: :shape, width: 39, height: 39, smooth: '100%',
31
31
  apply: [:circle_color],
32
- left: 100, top: 100, preset: :circle },
33
- shape: { type: :shape, width: 99, height: 99,
32
+ left: 0, top: 0, preset: :circle },
33
+ shape: { type: :shape, width: 39, height: 39,
34
34
  apply: [:shape_color],
35
- left: 100, top: 100 },
36
- text: { type: :text, component: { size: 18 },left: 0, top: 0,
35
+ left: 0, top: 0 },
36
+ text: { type: :text, component: { size: 12 },left: 0, top: 0,
37
37
  apply: [:text_color],
38
38
  width: :auto, height: :auto, language: :english },
39
39
  drm: { type: :drm, attach: :black_matter },
@@ -21,6 +21,9 @@ class Atome
21
21
  JS.eval(js_command)
22
22
  end
23
23
 
24
+
25
+
26
+
24
27
  # def global_monitoring(instance, methods_to_monitor, variables_to_monitor)
25
28
  # methods_to_monitor.each do |methode|
26
29
  # original_method = instance.method(methode)
@@ -282,6 +285,14 @@ class Atome
282
285
  end
283
286
  end
284
287
 
288
+ def each_with_index(&proc)
289
+ index=0
290
+ collect.each do |val|
291
+ instance_exec(val,index, &proc) if proc.is_a?(Proc)
292
+ index+=1
293
+ end
294
+ end
295
+
285
296
  def <<(item)
286
297
  collect << item
287
298
  end
@@ -330,5 +341,20 @@ class Atome
330
341
  parent_found.delete(true)
331
342
  end
332
343
  end
344
+ def server(server_params=nil)
345
+ if server_params
346
+ @current_server= server_params
347
+ else
348
+ @current_server
349
+ end
350
+
351
+ end
352
+
353
+ def init_websocket
354
+ connection(server)
355
+ end
333
356
 
334
357
  end
358
+
359
+
360
+
File without changes
@@ -34,7 +34,9 @@ class Atome
34
34
  else
35
35
  params[:attach] = params[:attach] || @id || :view
36
36
  end
37
- params
37
+ # # we reorder the hash
38
+ reordered_params =reorder_particles(params)
39
+ reordered_params
38
40
  end
39
41
 
40
42
  def preset_common(params, &bloc)
@@ -44,6 +46,7 @@ class Atome
44
46
  end
45
47
 
46
48
  def box(params = {}, &bloc)
49
+
47
50
  atome_preset = :box
48
51
  params = atome_common(atome_preset, params)
49
52
  preset_common(params, &bloc)
data/lib/atome/version.rb CHANGED
@@ -2,5 +2,6 @@
2
2
 
3
3
  # return atome version
4
4
  class Atome
5
- VERSION = '0.5.5.9.1'
5
+ VERSION = '0.5.6.0.3'
6
6
  end
7
+
data/lib/atome.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
-
2
+ # require 'eve'
3
3
 
4
4
  # require without relative is needed when using Opal
5
5
  require 'fileutils'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
-
2
+ # require 'eve'
3
3
  # relative is needed when using ruby wasm
4
4
  require 'fileutils'
5
5
  require 'securerandom'
@@ -1,27 +1,39 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- new({ method: :width, type: :integer, renderer: :html }) do |value, _user_proc|
4
- unit_found = metrics[:width]
5
- if unit_found
6
- html.style(:width, "#{value}#{unit_found}")
7
- elsif value.is_a?(Numeric)
8
- html.style(:width, "#{value}px")
9
- else
10
- html.style(:width, value)
11
- end
3
+ # new({ method: :width, type: :integer, renderer: :html }) do |value, _user_proc|
4
+ # unit_found = metrics[:width]
5
+ # if unit_found
6
+ # html.style(:width, "#{value}#{unit_found}")
7
+ # elsif value.is_a?(Numeric)
8
+ # html.style(:width, "#{value}px")
9
+ # else
10
+ # html.style(:width, value)
11
+ # end
12
+ # end
13
+ #
14
+ # new({ method: :height, renderer: :html, type: :string }) do |value, _user_proc|
15
+ # unit_found = metrics,
16
+ # [:height]
17
+ # if unit_found
18
+ # html.style(:height, "#{value}#{unit_found}")
19
+ # elsif value.is_a?(Numeric)
20
+ # html.style(:height, "#{value}px")
21
+ # else
22
+ # html.style(:height, value)
23
+ # end
24
+ # end
25
+
26
+ new({ method: :width, renderer: :html, type: :int }) do |params, _user_proc|
27
+ unit = @unit[:width] || :px if params.is_a? Numeric
28
+ js[:style][:width] = "#{params}#{unit}"
12
29
  end
13
30
 
14
- new({ method: :height, renderer: :html, type: :string }) do |value, _user_proc|
15
- unit_found = metrics[:height]
16
- if unit_found
17
- html.style(:height, "#{value}#{unit_found}")
18
- elsif value.is_a?(Numeric)
19
- html.style(:height, "#{value}px")
20
- else
21
- html.style(:height, value)
22
- end
31
+ new({ method: :height, renderer: :html, type: :int }) do |params, _user_proc|
32
+ unit = @unit[:height] || :px if params.is_a? Numeric
33
+ js[:style][:height] = "#{params}#{unit}"
23
34
  end
24
35
 
36
+
25
37
  # new({ method: :size, type: :hash, renderer: :html }) do |value, _user_proc|
26
38
  # # html.style('fontSize',"#{value}px")
27
39
  # end