atome 0.5.5.8.7 → 0.5.6.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) 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 +2 -1
  5. data/lib/atome/atome.rb +10 -5
  6. data/lib/atome/extensions/atome.rb +52 -0
  7. data/lib/atome/genesis/generators/atome.rb +3 -0
  8. data/lib/atome/genesis/generators/communication.rb +19 -6
  9. data/lib/atome/genesis/generators/geometry.rb +0 -3
  10. data/lib/atome/genesis/generators/spatial.rb +22 -33
  11. data/lib/atome/genesis/generators/utility.rb +16 -12
  12. data/lib/atome/genesis/genesis.rb +2 -1
  13. data/lib/atome/genesis/sparkle.rb +27 -3
  14. data/lib/atome/helpers/essentials.rb +10 -10
  15. data/lib/atome/helpers/utilities.rb +46 -0
  16. data/lib/atome/kernel/ruby +0 -0
  17. data/lib/atome/kernel/universe.rb +18 -0
  18. data/lib/atome/presets/atome.rb +4 -1
  19. data/lib/atome/version.rb +2 -1
  20. data/lib/renderers/html/communication.rb +3 -0
  21. data/lib/renderers/html/effect.rb +0 -1
  22. data/lib/renderers/html/geometry.rb +30 -18
  23. data/lib/renderers/html/html.rb +15 -7
  24. data/lib/renderers/html/identity.rb +6 -2
  25. data/lib/renderers/html/property.rb +9 -7
  26. data/lib/renderers/html/spatial.rb +24 -27
  27. data/server/atome_server.rb +148 -0
  28. data/server/atome_server_wasm.rb +112 -0
  29. data/server/capture.rb +10 -0
  30. data/server/config.ru +13 -0
  31. data/src/css/style.css +162 -0
  32. data/src-tauri/.gitignore +4 -0
  33. data/src-tauri/Cargo.toml +27 -0
  34. data/src-tauri/build.rs +3 -0
  35. data/src-tauri/icons/128x128.png +0 -0
  36. data/src-tauri/icons/128x128@2x.png +0 -0
  37. data/src-tauri/icons/32x32.png +0 -0
  38. data/src-tauri/icons/Square107x107Logo.png +0 -0
  39. data/src-tauri/icons/Square142x142Logo.png +0 -0
  40. data/src-tauri/icons/Square150x150Logo.png +0 -0
  41. data/src-tauri/icons/Square284x284Logo.png +0 -0
  42. data/src-tauri/icons/Square30x30Logo.png +0 -0
  43. data/src-tauri/icons/Square310x310Logo.png +0 -0
  44. data/src-tauri/icons/Square44x44Logo.png +0 -0
  45. data/src-tauri/icons/Square71x71Logo.png +0 -0
  46. data/src-tauri/icons/Square89x89Logo.png +0 -0
  47. data/src-tauri/icons/StoreLogo.png +0 -0
  48. data/src-tauri/icons/icon.icns +0 -0
  49. data/src-tauri/icons/icon.ico +0 -0
  50. data/src-tauri/icons/icon.png +0 -0
  51. data/src-tauri/src/main.rs +71 -0
  52. data/src-tauri/tauri.conf.json +70 -0
  53. data/src-wasm/wasm/wasi-vfs-osx_arm +0 -0
  54. data/src-wasm/wasm/wasi-vfs-osx_x86 +0 -0
  55. data/src-wasm/wasm/wasi-vfs-unix +0 -0
  56. data/src-wasm/wasm/wasi-vfs.exe +0 -0
  57. data/vendor/assets/application/examples/atome.rb +0 -1
  58. data/vendor/assets/application/examples/center.rb +2 -3
  59. data/vendor/assets/application/examples/compute.rb +3 -3
  60. data/vendor/assets/application/examples/css.rb +6 -0
  61. data/vendor/assets/application/examples/example.rb +27 -0
  62. data/vendor/assets/application/examples/help.rb +17 -0
  63. data/vendor/assets/application/examples/int8.rb +17 -0
  64. data/vendor/assets/application/examples/selected.rb +6 -0
  65. data/vendor/assets/application/examples/sub_atome_manipulation.rb +19 -0
  66. data/vendor/assets/application/examples/test.rb +27 -0
  67. data/vendor/assets/application/examples/unit.rb +14 -0
  68. data/vendor/assets/application/index.rb +1 -1
  69. data/vendor/assets/server/atome_server.rb +175 -27
  70. data/vendor/assets/src/index_server.html +2 -0
  71. data/vendor/assets/src/index_server_wasm.html +1 -0
  72. data/vendor/assets/src/js/atome/atome_helpers/communication.js +2 -4
  73. metadata +44 -14
  74. data/vendor/assets/application/required_example.rb +0 -1
  75. data/vendor/assets/application/test.rb +0 -29
  76. data/vendor/assets/application/works/photos.rb +0 -672
  77. data/vendor/assets/application/works/photos2.rb +0 -218
  78. data/vendor/assets/application/works/photos3.rb +0 -343
  79. data/vendor/assets/application/works/photos4.rb +0 -34
  80. data/vendor/assets/application/works/photos6.rb +0 -6
  81. data/vendor/assets/application/works/vie.rb +0 -196
  82. /data/{vendor/assets/application/works/trigga.rb → Guardfile} +0 -0
  83. /data/vendor/assets/application/examples/{presets.rb → preset.rb} +0 -0
  84. /data/vendor/assets/application/examples/{messaging.rb → server.rb} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4aa832acc6d311b046d0d0efeee475a0f1ec11774eb392218ab8fe8d8d2f3c52
4
- data.tar.gz: 8e6c9a171461da40f3d88f2466a50d72e3a4d16bd80db228b53ea9e69d6d58be
3
+ metadata.gz: bbc7236b206c7741018b0083521206b61197799683b4e56b38784ebeb4b13753
4
+ data.tar.gz: 0215331e8b52b78c1acc1696f2b7dee0a001dc112562fb13356125ee8a461fbd
5
5
  SHA512:
6
- metadata.gz: 07b0fadc4e1818654614b1a47acde2bca31654f74782069a5f6b01a545740dfcf1a6676b960d50000ffa87ad66c6e50f6626e9997ada0ecaeaa772d5f910b4c9
7
- data.tar.gz: f96b61891e6b0f359085f1412bd6bc5ed368be0dd8ee23df2dcdc087cfa31d4146482478129622113aef1fec9a4d15634b844db1eb329285fe3ea02c7fc4df35
6
+ metadata.gz: 60cd13a82053afa4a6dc037671869bf3bb81c7f20c4c04b7d230dae479eafcc2e5fa03774aa532f4e69d6aa1cc2f23a3ee8dcc703a6f26d585a31a62f17c9bc1
7
+ data.tar.gz: 7423d4715cb7cfc9cde10c7feef399869d9a5c8f5d99ca37917b6025f2b129b5b9d64f599ef7ba0ecca33043478481497e04926c2768f6b60f23dc7f63ceffb0
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)
@@ -667,7 +668,7 @@ else
667
668
  sleep 1
668
669
  if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
669
670
  # code to exec with Windows
670
- `start "" "#{destination}\\#{project_name}\\src\\index_opal.html`
671
+ `start "" "#{destination}\\#{project_name}\\src\\index_server.html`
671
672
  elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
672
673
  # code to exec with MacOS
673
674
  `open http://localhost:9292`
data/lib/atome/atome.rb CHANGED
@@ -10,11 +10,16 @@ class Atome
10
10
 
11
11
  # the keys :renderers, :type and :id should be placed in the first position in the hash
12
12
  @history = {}
13
+ # @language = :english
13
14
  @callback = {}
14
15
  @tag = {}
15
16
  @selected = false
17
+ #@metrics = {}
16
18
  @unit = {}
17
19
  @collect = {}
20
+ @collect = {}
21
+ @int8= {}
22
+ @css = {}
18
23
  @id = new_atome[:id] || identity_generator(:element)
19
24
  @type = new_atome[:type] || :element
20
25
  @attached = []
@@ -26,16 +31,16 @@ class Atome
26
31
  # now we store the proc in a an atome's property called :bloc
27
32
  new_atome[:code] = atomes_proc if atomes_proc
28
33
  # we reorder the hash
29
- ordered_keys = %i[renderers id alien type]
30
- ordered_part = ordered_keys.map { |k| [k, new_atome[k]] }.to_h
31
- other_part = new_atome.reject { |k, _| ordered_keys.include?(k) }
32
- # merge the parts to obtain an re-ordered hash
33
- reordered_atome = ordered_part.merge(other_part)
34
+ reordered_atome =reorder_particles(new_atome)
34
35
 
35
36
  # FIXME : try to remove the condition below (it crash in the method : def generator ... in genesis.rb)
36
37
  collapse(reordered_atome)
37
38
  end
38
39
 
40
+ def js
41
+ html.object
42
+ end
43
+
39
44
  def particle_creation(element, params, store, rendering, &user_proc)
40
45
 
41
46
  # @store_allow = false
@@ -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,19 +1,32 @@
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|
9
14
 
10
- params = {message: params } unless params.instance_of? Hash
11
- params[:user]=Universe.current_user
12
- params[:pass]=Black_matter.password
15
+ params = { message: params } unless params.instance_of? Hash
16
+ params[:user] = Universe.current_user
17
+ params[:pass] = Black_matter.password
13
18
 
14
19
  html.send_message(params, &bloc)
15
20
  end
16
21
 
17
22
  new({ particle: :controller }) do |msg|
18
23
  Atome.controller_sender(msg)
19
- end
24
+ end
25
+
26
+ new({ particle: :int8 })
27
+
28
+ new({ particle: :language }) do |params|
29
+ @data = int8[params]
30
+ params
31
+ end
32
+
@@ -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,31 +1,25 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- new({ particle: :left, type: :integer })
4
- new({ particle: :right, type: :integer })
5
- new({ particle: :top, type: :integer })
6
- new({ particle: :bottom, type: :integer })
3
+ new({ particle: :left })
4
+ new({ particle: :right })
5
+ new({ particle: :top })
6
+ new({ particle: :bottom })
7
7
  new({ particle: :rotate, type: :integer })
8
8
  new({ particle: :direction, type: :string })
9
- new({ particle: :center, type: :string})
10
- new({particle: :depth, type: :integer})
9
+ new({ particle: :depth, type: :integer })
11
10
  new({ particle: :position })
12
11
  new({ particle: :organise })
13
12
  new({ particle: :spacing })
14
13
  new({ particle: :display }) do |params|
15
- unless params.instance_of? Hash
16
- params = { mode: params }
17
- end
14
+ params = { mode: params } unless params.instance_of? Hash
18
15
  params
19
16
  end
20
17
  new({ particle: :layout }) do |params|
21
-
22
18
  mode_found = params.delete(:mode) || :list
23
19
  elements_style = params.delete(:element) || {}
24
20
  # now we get the list of the atome to layout
25
21
  atomes_to_organise = []
26
- if type == :group
27
- atomes_to_organise = collect
28
- end
22
+ atomes_to_organise = collect if type == :group
29
23
  # if params[:listing] is specified group collection is override
30
24
  atomes_to_organise = params[:listing] if params[:listing]
31
25
  if mode_found == :default
@@ -33,14 +27,13 @@ new({ particle: :layout }) do |params|
33
27
  atomes_to_organise.each do |atome_id_to_organise|
34
28
  atome_found = grab(atome_id_to_organise)
35
29
  # now restoring
36
- if atome_found.backup
37
- atome_found.backup.each do |particle, value|
38
- atome_found.send(:delete, particle)
39
- atome_found.send(particle, value)
40
- end
41
- atome_found.remove_layout
42
- end
30
+ next unless atome_found.backup
43
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
44
37
  end
45
38
  else
46
39
 
@@ -56,9 +49,7 @@ new({ particle: :layout }) do |params|
56
49
  end
57
50
  container.remove({ category: :atome })
58
51
  container.category(:matrix)
59
- if mode_found == :list
60
- params[:organise] = '1fr'
61
- end
52
+ params[:organise] = '1fr' if mode_found == :list
62
53
  params.each do |particle, value|
63
54
  container.send(particle, value)
64
55
  end
@@ -66,12 +57,10 @@ new({ particle: :layout }) do |params|
66
57
  atomes_to_organise.each do |atome_id_to_organise|
67
58
  atome_found = grab(atome_id_to_organise)
68
59
  # now restoring
69
- if atome_found.backup
70
- atome_found.backup.each do |particle, value|
71
- atome_found.send(:delete, particle)
72
- atome_found.send(particle, value)
73
- end
74
- # 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)
75
64
  end
76
65
  # we remove previous display mode
77
66
  atome_found.remove_layout
@@ -97,7 +86,7 @@ new({ particle: :layout }) do |params|
97
86
  end
98
87
  params
99
88
  end
100
- new({particle: :center})
101
-
102
-
103
-
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: :unit, 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
 
@@ -91,7 +91,7 @@ Atome.new({ renderers: default_render, id: machine_id, type: :machine, password:
91
91
  #user
92
92
  user_password = {global: :star_win, read: { atome: :star_wars }, write: { atome: :star_wars } }
93
93
 
94
- human({ id: :anonymous, login: true, password: user_password, data: { birthday: '10/05/1996' },selection: [], tag: { system: true } , attach: :user_view })
94
+ human({ id: :anonymous, login: true, password: user_password, data: { birthday: '10/05/1996' },selection: [], attach: :user_view })
95
95
 
96
96
  Universe.current_machine = machine_id
97
97
  # the constant A is used to access alla atomes methods
@@ -116,4 +116,28 @@ def atome_infos
116
116
  puts "server: #{server}"
117
117
  end
118
118
 
119
- # atome_infos
119
+
120
+ # help and example below :
121
+ #
122
+ A.example(:left) do
123
+ english = 'here is an example, touch me to get some help, or click the code to exec'
124
+ french = "voici un example, click moi pour de l'aide, ou clicker le code pour l'executer"
125
+ code = <<STR
126
+ b=box
127
+ puts b.left
128
+ b.left(155)
129
+ puts b.left
130
+ STR
131
+ example = text({ int8: { english: english, french: french }, language: :english, width: 666 })
132
+ code_text = text({ int8: { english: code }, language: :english, width: 666, top: 33 })
133
+ example.touch(true) do
134
+ example.delete(true)
135
+ help(:left)
136
+ end
137
+ code_text.touch(true) do
138
+ eval(code)
139
+ end
140
+ end
141
+
142
+ # we init server default address
143
+ A.server({ address: 'localhost:9292' , type: 'ws'})
@@ -22,20 +22,20 @@ 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
- width: :auto, height: :auto },
38
+ width: :auto, height: :auto, language: :english },
39
39
  drm: { type: :drm, attach: :black_matter },
40
40
  shadow: { type: :shadow, red: 0, green: 0, blue: 0, alpha: 0 },
41
41
  color: { type: :color, red: 0, green: 0, blue: 0, alpha: 1}
@@ -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)
@@ -52,6 +55,26 @@ class Atome
52
55
 
53
56
  end
54
57
 
58
+
59
+ def help(particle, &doc)
60
+ if doc
61
+ Universe.set_help(particle, &doc)
62
+ else
63
+ doc_found = Universe.get_help(particle)
64
+ instance_exec(&doc_found) if doc_found.is_a?(Proc)
65
+ end
66
+ end
67
+
68
+ def example(particle, &example)
69
+ if example
70
+ Universe.set_example(particle, &example)
71
+ else
72
+ example_found = Universe.get_example(particle)
73
+ instance_exec(&example_found) if example_found.is_a?(Proc)
74
+ end
75
+ end
76
+
77
+
55
78
  # local server messaging
56
79
  def file_for_opal(parent, bloc)
57
80
  JS.eval("fileForOpal('#{parent}', #{bloc})")
@@ -262,6 +285,14 @@ class Atome
262
285
  end
263
286
  end
264
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
+
265
296
  def <<(item)
266
297
  collect << item
267
298
  end
@@ -310,5 +341,20 @@ class Atome
310
341
  parent_found.delete(true)
311
342
  end
312
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
313
356
 
314
357
  end
358
+
359
+
360
+
File without changes
@@ -11,10 +11,28 @@ class Universe
11
11
  @specificities = {}
12
12
  @history = {}
13
13
  @users = {}
14
+ @help = {}
15
+ @example = {}
14
16
 
15
17
  class << self
16
18
  attr_reader :atomes, :renderer_list, :atome_list, :particle_list, :classes, :counter, :atomes_specificities
17
19
 
20
+ def set_help(particle, &doc)
21
+ @help[particle] = doc
22
+ end
23
+
24
+ def get_help(particle)
25
+ @help[particle]
26
+ end
27
+
28
+ def set_example(particle, &example)
29
+ @example[particle] = example
30
+ end
31
+
32
+ def get_example(particle)
33
+ @example[particle]
34
+ end
35
+
18
36
  def add_to_particle_list(particle = nil, type)
19
37
  instance_variable_get('@particle_list')[particle] = type
20
38
  end
@@ -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.8.7'
5
+ VERSION = '0.5.6.0.2'
6
6
  end
7
+
@@ -0,0 +1,3 @@
1
+ new({ method: :language, renderer: :html }) do |params|
2
+ js[:innerHTML] = int8[params].to_s
3
+ end