atome 0.5.7.3.6 → 0.5.7.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1 -1
  3. data/documentation/deep learning/architecture.txt +4 -4
  4. data/documentation/deep learning/basic_infos.txt +2 -2
  5. data/documentation/deep learning/example_of_users_code.rb +43 -43
  6. data/documentation/installation/buiding_atome.md +2 -2
  7. data/lib/atome/atome.rb +24 -56
  8. data/lib/atome/extensions/atome.rb +31 -77
  9. data/lib/atome/extensions/sha.rb +7 -7
  10. data/lib/atome/genesis/atomes.rb +1 -1
  11. data/lib/atome/genesis/genesis.rb +6 -95
  12. data/lib/atome/genesis/particles/communication.rb +1 -1
  13. data/lib/atome/genesis/particles/event.rb +0 -8
  14. data/lib/atome/genesis/particles/geometry.rb +3 -4
  15. data/lib/atome/genesis/particles/hierarchy.rb +28 -27
  16. data/lib/atome/genesis/particles/identity.rb +0 -30
  17. data/lib/atome/genesis/particles/material.rb +13 -12
  18. data/lib/atome/genesis/particles/property.rb +41 -16
  19. data/lib/atome/genesis/particles/security.rb +0 -45
  20. data/lib/atome/genesis/particles/utility.rb +77 -137
  21. data/lib/atome/genesis/sparkle.rb +3 -12
  22. data/lib/atome/kernel/black_matter.rb +2 -0
  23. data/lib/atome/kernel/universe.rb +5 -45
  24. data/lib/atome/presets/atome.rb +0 -22
  25. data/lib/atome/utilities/utilities.rb +19 -8
  26. data/lib/atome/version.rb +2 -1
  27. data/lib/molecules/init.rb +0 -14
  28. data/lib/molecules/intuition/tools.rb +24 -43
  29. data/lib/molecules/intuition/utilities.rb +261 -135
  30. data/lib/platform_specific/opal/atome_opal_extensions.rb +0 -1
  31. data/lib/platform_specific/opal/extensions/color.rb +0 -5
  32. data/lib/platform_specific/opal/extensions/geolocation.rb +5 -5
  33. data/lib/platform_specific/opal/extensions/object.rb +1 -1
  34. data/lib/platform_specific/opal/extensions/ping.rb +11 -20
  35. data/lib/renderers/html/effect.rb +0 -11
  36. data/lib/renderers/html/event.rb +0 -7
  37. data/lib/renderers/html/geometry.rb +0 -31
  38. data/lib/renderers/html/html.rb +32 -128
  39. data/lib/renderers/html/material.rb +0 -22
  40. data/lib/renderers/html/spatial.rb +0 -9
  41. data/lib/renderers/html/utility.rb +5 -8
  42. data/lib/renderers/renderer.rb +0 -1
  43. data/vendor/assets/application/examples/account.rb +35 -0
  44. data/vendor/assets/application/examples/actor&role.rb +23 -0
  45. data/vendor/assets/application/examples/animation.rb +1 -1
  46. data/vendor/assets/application/examples/applications.rb +26 -77
  47. data/vendor/assets/application/examples/atome.rb +1 -1
  48. data/vendor/assets/application/examples/attach.rb +7 -7
  49. data/vendor/assets/application/examples/attached.rb +13 -15
  50. data/vendor/assets/application/examples/basic_understanding.rb +1 -1
  51. data/vendor/assets/application/examples/buttons.rb +48 -0
  52. data/vendor/assets/application/examples/clear.rb +12 -12
  53. data/vendor/assets/application/examples/clones&monitoring.rb +1 -1
  54. data/vendor/assets/application/examples/delete.rb +19 -14
  55. data/vendor/assets/application/examples/detach.rb +8 -0
  56. data/vendor/assets/application/examples/dig.rb +1 -1
  57. data/vendor/assets/application/examples/display.rb +6 -6
  58. data/vendor/assets/application/examples/drag.rb +1 -1
  59. data/vendor/assets/application/examples/duplicate.rb +6 -6
  60. data/vendor/assets/application/examples/exchange.rb +17 -0
  61. data/vendor/assets/application/examples/generator_and_build.rb +3 -3
  62. data/vendor/assets/application/examples/hierarchy.rb +5 -5
  63. data/vendor/assets/application/examples/layout.rb +1 -1
  64. data/vendor/assets/application/examples/preset.rb +3 -3
  65. data/vendor/assets/application/examples/selected.rb +1 -1
  66. data/vendor/assets/application/examples/shapes.rb +1 -1
  67. data/vendor/assets/application/examples/size.rb +1 -1
  68. data/vendor/assets/application/examples/test.rb +0 -320
  69. data/vendor/assets/application/examples/tools.rb +136 -192
  70. data/vendor/assets/application/examples/unfasten.rb +23 -0
  71. data/vendor/assets/application/index.rb +1 -1
  72. data/vendor/assets/server/atome_server.rb +1 -0
  73. data/vendor/assets/server/capture.rb +0 -1
  74. data/vendor/assets/server/database.rb +0 -1
  75. data/vendor/assets/server/eDen.rb +16 -94
  76. data/vendor/assets/src/index_server_wasm.html +1 -0
  77. data/vendor/assets/src/index_wasm.html +0 -6
  78. data/vendor/assets/src/js/atome/specific/wasm.js +22 -4
  79. data/vendor/assets/src/js/third_parties/three.min.js +1 -1
  80. data/vendor/assets/src/medias/fonts/Roboto/LICENSE.txt +1 -1
  81. data/vendor/assets/src/medias/fonts/Roboto_Slab/LICENSE.txt +1 -1
  82. metadata +8 -6
  83. data/lib/molecules/_deprecated_examples/site.rb +0 -34
  84. data/lib/molecules/intuition/_deprecated_inputs.rb +0 -111
  85. data/lib/molecules/intuition/_deprecated_toolbox.rb +0 -282
  86. data/lib/platform_specific/opal/extensions/sha.rb +0 -25
@@ -1,27 +1,5 @@
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
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
3
 
26
4
  new({ method: :width, renderer: :html, type: :int }) do |params, _user_proc|
27
5
  unit = @unit[:width] || :px if params.is_a? Numeric
@@ -34,15 +12,6 @@ new({ method: :height, renderer: :html, type: :int }) do |params, _user_proc|
34
12
  end
35
13
 
36
14
 
37
- # new({ method: :size, type: :hash, renderer: :html }) do |value, _user_proc|
38
- # # html.style('fontSize',"#{value}px")
39
- # end
40
- #
41
- #
42
- # new({ method: :size, type: :int, renderer: :html }) do |value, _user_proc|
43
- # # html.style('fontSize', "#{value}px")
44
- # end
45
-
46
15
 
47
16
  new({ method: :size, type: :int, renderer: :html, specific: :text }) do |value, _user_proc|
48
17
  html.style('fontSize', "#{value}px")
@@ -4,10 +4,6 @@
4
4
 
5
5
  class HTML
6
6
 
7
- # def id
8
- # :poil
9
- # end
10
-
11
7
  def self.locate(selector, base_element = JS.global[:document][:body])
12
8
  return base_element if selector.empty?
13
9
 
@@ -16,17 +12,19 @@ class HTML
16
12
  elsif selector.has_key?(:parent)
17
13
  parent = base_element.querySelector("##{selector[:parent]}")
18
14
  return nil if parent.nil?
15
+
19
16
  parent.querySelectorAll("*").to_a
20
17
  elsif selector.has_key?(:html)
21
18
  html_element = selector[:html]
22
19
  return nil if html_element.nil?
20
+
23
21
  html_element.querySelectorAll("*").to_a
24
22
  end
25
23
  end
26
24
 
27
25
  def initialize(id_found, current_atome)
28
26
 
29
- @element ||= JS.global[:document].getElementById(id_found.to_s)
27
+ @element = JS.global[:document].getElementById(id_found.to_s)
30
28
  @id = id_found
31
29
  @original_atome = current_atome
32
30
  @touch_removed = {}
@@ -220,10 +218,7 @@ class HTML
220
218
  end
221
219
 
222
220
  particles_found = particles_found.merge(particles_from_style)
223
- current_atome = grab(@id)
224
221
  usr_bloc.call(particles_found)
225
- # current_atome.callback({ hyperedit: particles_found })
226
- # current_atome.call(:hyperedit)
227
222
 
228
223
  end
229
224
 
@@ -235,19 +230,24 @@ class HTML
235
230
  def connect(params, &bloc)
236
231
  type = params[:type]
237
232
  server = params[:address]
238
- # user=params[:user]
239
- # pass=params[:pass]
240
- # atomes=params[:atomes]
241
- # particles=params[:particles]
242
- # 'atomeJS.connect' is in the communication.js file ( connect: function (type, server, )
233
+
243
234
  JS.eval("atomeJS.connect('#{type}','#{server}')")
244
235
 
245
- # @websocket = JS.new(JS.global.WebSocket.new("#{type}://#{server}"))
236
+ end
246
237
 
247
- # JS.eval("atomeJS.connect('ws://#{server}')")
238
+ def transform_to_string_keys_and_values(hash)
239
+ hash.transform_keys(&:to_s).transform_values do |value|
240
+ if value.is_a?(Hash)
241
+ transform_to_string_keys_and_values(value)
242
+ else
243
+ value.to_s
244
+ end
245
+ end
248
246
  end
249
247
 
250
248
  def send_message(message)
249
+ # FIXME : find why we have to sanitize this message when using ruby wams
250
+ message = transform_to_string_keys_and_values(message)
251
251
  JS.eval("atomeJS.ws_sender('#{message}')")
252
252
  end
253
253
 
@@ -302,28 +302,6 @@ class HTML
302
302
  JS.global[:document][:body].appendChild(@element)
303
303
  add_class('atome')
304
304
  id(id)
305
- ####
306
-
307
- # editable_pres = JS.global[:document].querySelectorAll('pre[contenteditable="true"]')
308
- # editable_pres_array = Array.new(editable_pres[:length].to_i) { |i| editable_pres.call(:item, i) }
309
- # editable_pres_array.each do |pre|
310
- # pre.addEventListener('input') do
311
- # if pre[:innerText].strip == ''
312
- # pre[:innerHTML] = '​' # Insère un caractère d'espace insécable
313
- # end
314
- # end
315
- # end
316
-
317
- # editable_pres = JS.global[:document].querySelectorAll('pre[contenteditable="true"]')
318
- #
319
- # editable_pres_array = Array.new(editable_pres[:length].to_i) { |i| editable_pres.call(:item, i) }
320
- # editable_pres_array.each do |pre|
321
- # pre.addEventListener('click') do
322
- # pre.focus()
323
- # pre[:style][:caretColor] = 'blue' # Changez la couleur du curseur en bleu
324
- # end
325
- # end
326
- ###
327
305
  self
328
306
  end
329
307
 
@@ -395,8 +373,6 @@ class HTML
395
373
  JS.global[:document][:body].appendChild(@element)
396
374
  add_class('atome')
397
375
  @element.setAttribute('src', 'https://www.youtube.com/embed/lLeQZ8Llkso?si=MMsGBEXELy9yBl9R')
398
- # below we get image to feed width and height if needed
399
- # image = JS.global[:Image].new
400
376
  self.id(id)
401
377
  self
402
378
  end
@@ -427,8 +403,6 @@ class HTML
427
403
  end
428
404
 
429
405
  def svg_data(all_datas)
430
- # we remove previous datas
431
- # @element.innerHTML = ''
432
406
  all_datas.each do |full_data|
433
407
  full_data.each do |type_passed, datas|
434
408
 
@@ -505,7 +479,6 @@ class HTML
505
479
  def path(objet_path)
506
480
  @element.setAttribute('src', objet_path)
507
481
  # below we get image to feed width and height if needed
508
- # image = JS.global[:Image].new
509
482
  @element[:src] = objet_path
510
483
  @element[:onload] = lambda do |_event|
511
484
  @element[:width]
@@ -623,10 +596,6 @@ class HTML
623
596
  self
624
597
  end
625
598
 
626
- # def visible(param)
627
- # @element[:style][:display] = param.to_s
628
- # end
629
-
630
599
  def delete(id_to_delete)
631
600
  element_to_delete = JS.global[:document].getElementById(id_to_delete.to_s)
632
601
  element_to_delete.remove if element_to_delete
@@ -650,7 +619,6 @@ class HTML
650
619
  mql = JS.global[:window].matchMedia(media_query)
651
620
 
652
621
  event_handler = ->(event) do
653
- # bloc.call({ matches: event[:matches] }) if bloc.is_a? Proc
654
622
  proc_content = bloc.call({ matches: event[:matches] }) if event_validation(bloc)
655
623
  if proc_content.instance_of? Hash
656
624
  proc_content.each do |k, v|
@@ -666,7 +634,6 @@ class HTML
666
634
  event_handler = ->(event) do
667
635
  width = JS.global[:window][:innerWidth]
668
636
  height = JS.global[:window][:innerHeight]
669
- # bloc.call({ width: width, height: height }) if bloc.is_a? Proc
670
637
  proc_content = bloc.call({ width: width, height: height }) if event_validation(bloc)
671
638
  if proc_content.instance_of? Hash
672
639
  proc_content.each do |k, v|
@@ -675,18 +642,9 @@ class HTML
675
642
  end
676
643
  end
677
644
 
678
- # proc_content = @drag_move.call(event) if event_validation(@drag_move)
679
- # if proc_content.instance_of? Hash
680
- # proc_content.each do |k, v|
681
- # @original_atome.send(k, v)
682
- # end
683
- # end
684
- # puts event_handler.class
685
645
  JS.global[:window].addEventListener('resize', event_handler)
686
- # JS.global[:window].addEventListener('resize', event_handler)
687
646
  else
688
647
  event_handler = ->(event) do
689
- # bloc.call(event) if bloc.is_a? Proc
690
648
  proc_content = bloc.call(event) if event_validation(bloc)
691
649
  if proc_content.instance_of? Hash
692
650
  proc_content.each do |k, v|
@@ -707,7 +665,6 @@ class HTML
707
665
  # we use .call instead of instance_eval because instance_eval bring the current object as context
708
666
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
709
667
  # group etc..
710
- # @keyboard_press.call(event) if @keyboard_press.is_a?(Proc)
711
668
  proc_content = @keyboard_press.call(event) if event_validation(@keyboard_press)
712
669
  if proc_content.instance_of? Hash
713
670
  proc_content.each do |k, v|
@@ -725,7 +682,6 @@ class HTML
725
682
  # we use .call instead of instance_eval because instance_eval bring the current object as context
726
683
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
727
684
  # group etc..
728
- # @keyboard_down.call(event) if @keyboard_down.is_a?(Proc)
729
685
  proc_content = @keyboard_down.call(event) if event_validation(@keyboard_down)
730
686
  if proc_content.instance_of? Hash
731
687
  proc_content.each do |k, v|
@@ -743,7 +699,6 @@ class HTML
743
699
  # we use .call instead of instance_eval because instance_eval bring the current object as context
744
700
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
745
701
  # group etc..
746
- # @keyboard_up.call(event) if @keyboard_up.is_a?(Proc)
747
702
  proc_content = @keyboard_up.call(event) if event_validation(@keyboard_up)
748
703
  if proc_content.instance_of? Hash
749
704
  proc_content.each do |k, v|
@@ -779,6 +734,7 @@ class HTML
779
734
  end
780
735
 
781
736
  def drag_remove(option)
737
+
782
738
  @draggable = nil
783
739
  interact = JS.eval("return interact('##{@id}')")
784
740
 
@@ -817,7 +773,6 @@ class HTML
817
773
  # we use .call instead of instance_eval because instance_eval bring the current object as context
818
774
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
819
775
  # group etc..
820
- # @drag_start.call(event) if event_validation(@drag_start)
821
776
  proc_content = @drag_start.call(event) if event_validation(@drag_start)
822
777
  if proc_content.instance_of? Hash
823
778
  proc_content.each do |k, v|
@@ -835,7 +790,6 @@ class HTML
835
790
  # we use .call instead of instance_eval because instance_eval bring the current object as context
836
791
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
837
792
  # group etc..
838
- # @drag_end.call(event) if event_validation(@drag_end)
839
793
  proc_content = @drag_end.call(event) if event_validation(@drag_end)
840
794
  if proc_content.instance_of? Hash
841
795
  proc_content.each do |k, v|
@@ -864,7 +818,6 @@ class HTML
864
818
  # we use .call instead of instance_eval because instance_eval bring the current object as context
865
819
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
866
820
  # group etc..
867
- # @drag_move.call(event) if event_validation(@drag_move)
868
821
  proc_content = @drag_move.call(event) if event_validation(@drag_move)
869
822
  if proc_content.instance_of? Hash
870
823
  proc_content.each do |k, v|
@@ -934,7 +887,6 @@ class HTML
934
887
  # we use .call instead of instance_eval because instance_eval bring the current object as context
935
888
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
936
889
  # group etc..
937
- # @drag_move.call(event) if event_validation(@drag_move)
938
890
  proc_content = @drag_move.call(event) if event_validation(@drag_move)
939
891
  if proc_content.instance_of? Hash
940
892
  proc_content.each do |k, v|
@@ -967,7 +919,6 @@ class HTML
967
919
  # we use .call instead of instance_eval because instance_eval bring the current object as context
968
920
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
969
921
  # group etc..
970
- # @drag_lock.call(event) if event_validation(@drag_lock)
971
922
  proc_content = @drag_lock.call(event) if event_validation(@drag_lock)
972
923
  if proc_content.instance_of? Hash
973
924
  proc_content.each do |k, v|
@@ -984,7 +935,6 @@ class HTML
984
935
  # we use .call instead of instance_eval because instance_eval bring the current object as context
985
936
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
986
937
  # group etc..
987
- # bloc.call({ source: draggable_element, destination: dropzone_element }) if event_validation(bloc)
988
938
  proc_content = bloc.call({ source: draggable_element, destination: dropzone_element }) if event_validation(bloc)
989
939
  if proc_content.instance_of? Hash
990
940
  proc_content.each do |k, v|
@@ -1001,16 +951,7 @@ class HTML
1001
951
  accept: nil, # Accept any element
1002
952
  overlap: 0.75,
1003
953
  ondropactivate: lambda do |native_event|
1004
- event = Native(native_event)
1005
-
1006
954
  drop_action(native_event, @drop_activate) if event_validation(@drop_activate)
1007
- # @drag_lock.call(event) if event_validation(@drag_lock)
1008
- # proc_content = @drop_activate.call(event) if event_validation(@drop_activate)
1009
- # if proc_content.instance_of? Hash
1010
- # proc_content.each do |k, v|
1011
- # @original_atome.send(k, v)
1012
- # end
1013
- # end
1014
955
  end
1015
956
  })
1016
957
  end
@@ -1020,7 +961,6 @@ class HTML
1020
961
  @drop_deactivate = @original_atome.instance_variable_get('@drop_code')[:deactivate]
1021
962
  interact.dropzone({
1022
963
  # accept: nil, # Accept any element
1023
- # overlap: 0.75,
1024
964
  # FIXME : remove because os an opal bug since 1.8 reactivate when opal will be debbuged
1025
965
  ondropdeactivate: lambda do |native_event|
1026
966
  drop_action(native_event, @drop_deactivate) if event_validation(@drop_deactivate)
@@ -1047,7 +987,6 @@ class HTML
1047
987
  @drop_enter = @original_atome.instance_variable_get('@drop_code')[:enter]
1048
988
 
1049
989
  interact.dropzone({
1050
- # accept: nil,
1051
990
  overlap: 0.001,
1052
991
  # FIXME : remove because os an opal bug since 1.8 reactivate when opal will be debbuged
1053
992
  ondragenter: lambda do |native_event|
@@ -1061,8 +1000,6 @@ class HTML
1061
1000
  @drop_leave = @original_atome.instance_variable_get('@drop_code')[:leave]
1062
1001
 
1063
1002
  interact.dropzone({
1064
- # accept: nil,
1065
- # overlap: 0.75,
1066
1003
  # FIXME : remove because os an opal bug since 1.8 reactivate when opal will be debbuged
1067
1004
  ondragleave: lambda do |native_event|
1068
1005
  drop_action(native_event, @drop_leave) if event_validation(@drop_enter)
@@ -1085,7 +1022,6 @@ class HTML
1085
1022
  @drop_leave = ''
1086
1023
  else
1087
1024
  # to remove all interact event ( touch, drag, scale, ... uncomment below)
1088
- # interact = JS.eval("return interact('##{@id}')")
1089
1025
  # interact.unset
1090
1026
  @drop_activate = ''
1091
1027
  @drop_deactivate = ''
@@ -1152,7 +1088,6 @@ class HTML
1152
1088
  style(:overflow, params)
1153
1089
  @overflow = @original_atome.instance_variable_get('@overflow_code')[:overflow]
1154
1090
  @element.addEventListener('scroll', lambda do |native_event|
1155
- # event = Native(native_event)
1156
1091
  scroll_top = @element[:scrollTop].to_i
1157
1092
  scroll_left = @element[:scrollLeft].to_i
1158
1093
  # we use .call instead of instance_eval because instance_eval bring the current object as context
@@ -1178,7 +1113,6 @@ class HTML
1178
1113
  # we use .call instead of instance_eval because instance_eval bring the current object as context
1179
1114
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
1180
1115
  # group etc..
1181
- # @over_over.call(event) if event_validation(@over_over)
1182
1116
 
1183
1117
  proc_content = @over_over.call(event) if event_validation(@over_over)
1184
1118
  if proc_content.instance_of? Hash
@@ -1197,7 +1131,6 @@ class HTML
1197
1131
  # we use .call instead of instance_eval because instance_eval bring the current object as context
1198
1132
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
1199
1133
  # group etc..
1200
- # @over_enter.call(event) if event_validation(@over_enter)
1201
1134
  proc_content = @over_enter.call(event) if event_validation(@over_enter)
1202
1135
  if proc_content.instance_of? Hash
1203
1136
  proc_content.each do |k, v|
@@ -1219,7 +1152,6 @@ class HTML
1219
1152
  # we use .call instead of instance_eval because instance_eval bring the current object as context
1220
1153
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
1221
1154
  # group etc..
1222
- # @over_leave.call(event) if event_validation(@over_leave)
1223
1155
  proc_content = @over_leave.call(event) if event_validation(@over_leave)
1224
1156
  if proc_content.instance_of? Hash
1225
1157
  proc_content.each do |k, v|
@@ -1271,8 +1203,6 @@ class HTML
1271
1203
  # we use .call instead of instance_eval because instance_eval bring the current object as context
1272
1204
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
1273
1205
  # group etc..
1274
- # @touch_down.call(event) if @touch_down.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
1275
- # @touch_down.call(event) if event_validation(@touch_down)
1276
1206
  proc_content = @touch_down.call(event) if event_validation(@touch_down)
1277
1207
  if proc_content.instance_of? Hash
1278
1208
  proc_content.each do |k, v|
@@ -1295,11 +1225,6 @@ class HTML
1295
1225
  # we use .call instead of instance_eval because instance_eval bring the current object as context
1296
1226
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
1297
1227
  # group etc..
1298
- # @touch_up.call(event) if @touch_up.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
1299
- # event = Native(native_event)
1300
- # ########## old code :
1301
- # @touch_tap.call(event) if event_validation(@touch_tap)
1302
- # ########## new code:
1303
1228
  proc_content = @touch_tap.call(event) if event_validation(@touch_tap)
1304
1229
  if proc_content.instance_of? Hash
1305
1230
  proc_content.each do |k, v|
@@ -1321,8 +1246,6 @@ class HTML
1321
1246
  # we use .call instead of instance_eval because instance_eval bring the current object as context
1322
1247
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
1323
1248
  # group etc..
1324
- # @touch_up.call(event) if @touch_up.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
1325
- # @touch_up.call(event) if event_validation(@touch_up)
1326
1249
  proc_content = @touch_up.call(event) if event_validation(@touch_up)
1327
1250
  if proc_content.instance_of? Hash
1328
1251
  proc_content.each do |k, v|
@@ -1342,15 +1265,12 @@ class HTML
1342
1265
  # we use .call instead of instance_eval because instance_eval bring the current object as context
1343
1266
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
1344
1267
  # group etc..
1345
- # @touch_double.call(event) if @touch_double.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
1346
- # @touch_double.call(event) if event_validation(@touch_double)
1347
1268
  proc_content = @touch_double.call(event) if event_validation(@touch_double)
1348
1269
  if proc_content.instance_of? Hash
1349
1270
  proc_content.each do |k, v|
1350
1271
  @original_atome.send(k, v)
1351
1272
  end
1352
1273
  end
1353
- # end
1354
1274
  end
1355
1275
 
1356
1276
  end
@@ -1365,21 +1285,17 @@ class HTML
1365
1285
  # we use .call instead of instance_eval because instance_eval bring the current object as context
1366
1286
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
1367
1287
  # group etc..
1368
- # @touch_long.call(event) if event_validation(@touch_long)
1369
1288
  proc_content = @touch_long.call(event) if event_validation(@touch_long)
1370
1289
  if proc_content.instance_of? Hash
1371
1290
  proc_content.each do |k, v|
1372
1291
  @original_atome.send(k, v)
1373
1292
  end
1374
1293
  end
1375
- # @touch_long.call(event) if @touch_long.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
1376
- # @touch_double.call(event) if event_validation(@touch_double)
1377
-
1378
1294
  end
1379
- # end
1380
1295
  end
1381
1296
 
1382
1297
  def touch_remove(option)
1298
+
1383
1299
  @element[:style][:cursor] = 'default'
1384
1300
  case option
1385
1301
  when :double
@@ -1405,9 +1321,12 @@ class HTML
1405
1321
  @touch_removed[:up] = true
1406
1322
  @touch_up = ''
1407
1323
  else
1408
- # interact = JS.eval("return interact('##{@id}')")
1409
- # interact.unset
1410
- @original_atome.instance_variable_set('@touch_code', nil)
1324
+ touch_remove(:double)
1325
+ touch_remove(:down)
1326
+ touch_remove(:long)
1327
+ touch_remove(:tap)
1328
+ touch_remove(:touch)
1329
+ touch_remove(:up)
1411
1330
  end
1412
1331
 
1413
1332
  end
@@ -1504,7 +1423,7 @@ class HTML
1504
1423
 
1505
1424
  table_html.appendChild(thead)
1506
1425
  tbody = JS.global[:document].createElement('tbody')
1507
- data.each_with_index do |row, row_index|
1426
+ data.each_with_index do |row, _row_index|
1508
1427
  tr = JS.global[:document].createElement('tr')
1509
1428
 
1510
1429
  max_length.times do |cell_index|
@@ -1583,21 +1502,7 @@ class HTML
1583
1502
  def set_td_style(td)
1584
1503
  cell_height = @original_atome.component[:height]
1585
1504
  cell_width = @original_atome.component[:width]
1586
- # shadow_found = @original_atome.component[:shadow]
1587
- # if shadow_found
1588
- # red = shadow_found[:red] * 255
1589
- # green = shadow_found[:green] * 255
1590
- # blue = shadow_found[:blue] * 255
1591
- # alpha = shadow_found[:alpha]
1592
- # left = shadow_found[:left]
1593
- # top = shadow_found[:top]
1594
- # blur = shadow_found[:blur] # new correct behavior all atome's value should now be get using :value,here to resolve conflict with blur and back blur
1595
- # inset = :inset if shadow_found[:invert]
1596
- # shadow_created = "#{left}px #{top}px #{blur}px rgba(#{red}, #{green}, #{blue}, #{alpha}) #{inset}"
1597
- # end
1598
- # td[:style][:border] = '1px solid black'
1599
1505
  td[:style][:backgroundColor] = 'white'
1600
- # td[:style][:boxShadow] = shadow_created
1601
1506
  td[:style][:width] = "#{cell_width}px"
1602
1507
  td[:style]['min-width'] = "#{cell_width}px"
1603
1508
  td[:style]['max-width'] = "#{cell_height}px"
@@ -1679,9 +1584,7 @@ class HTML
1679
1584
  end
1680
1585
  rows = table_element.querySelectorAll('tr').to_a
1681
1586
  rows.each_with_index do |row, index|
1682
- if index == 0
1683
- # case1
1684
- else
1587
+ unless index == 0
1685
1588
  new_cell = JS.global[:document].createElement('td')
1686
1589
  new_cell[:innerText] = ''
1687
1590
  set_td_style(new_cell)
@@ -1715,7 +1618,6 @@ class HTML
1715
1618
  end
1716
1619
 
1717
1620
  def remove(params)
1718
- # puts "remove => #{params}"
1719
1621
  # TODO: FIXME: "html : must create a case here #{params} (#{@original_atome.id})"
1720
1622
  case params
1721
1623
  when Hash
@@ -1734,7 +1636,7 @@ class HTML
1734
1636
 
1735
1637
  if row_index >= rows.length
1736
1638
  puts "row not found : #{row_index}"
1737
- return
1639
+ true
1738
1640
  end
1739
1641
  row_to_remove = rows[row_index]
1740
1642
 
@@ -1749,7 +1651,7 @@ class HTML
1749
1651
 
1750
1652
  if table_element.nil?
1751
1653
  puts 'Table not found'
1752
- return
1654
+ true
1753
1655
  end
1754
1656
 
1755
1657
  rows = table_element.querySelectorAll('tbody tr').to_a
@@ -1764,13 +1666,14 @@ class HTML
1764
1666
  case v
1765
1667
  when :paint
1766
1668
  style(:background, 'none')
1767
- # style('box-shadow', 'none')
1768
- # style('text-shadow', 'none')
1769
1669
  when :color
1670
+ #
1770
1671
  when :shadow
1771
1672
  style('box-shadow', 'none')
1772
1673
  style('text-shadow', 'none')
1773
1674
  style("filter", 'none')
1675
+ else
1676
+ #
1774
1677
  end
1775
1678
  end
1776
1679
  end
@@ -1788,13 +1691,14 @@ class HTML
1788
1691
 
1789
1692
  def table_remove(params)
1790
1693
  if params[:row]
1694
+ #
1791
1695
  elsif params[:column]
1696
+ #
1792
1697
  end
1793
1698
  end
1794
1699
 
1795
1700
  # atomisation!
1796
1701
  def atomized(html_object)
1797
- # html_object = html_object[0] if html_object.instance_of? Array
1798
1702
  @element = html_object
1799
1703
  end
1800
1704
 
@@ -6,11 +6,6 @@ end
6
6
 
7
7
  new({ method: :gradient, renderer: :html, type: :hash })
8
8
 
9
- # new({ method: :remove, renderer: :html, type: :hash }) do |params|
10
- # # alert "===> #{params}"
11
- # # html.table_remove(params)
12
- # html.remove(params)
13
- # end
14
9
 
15
10
  new({ method: :remove, renderer: :html, type: :string }) do |object_id_to_remove, bloc|
16
11
 
@@ -64,23 +59,6 @@ new({ method: :remove, renderer: :html, type: :string }) do |object_id_to_remove
64
59
  end
65
60
  end
66
61
 
67
- # new({ method: :border, type: :hash, renderer: :html }) do |value, _user_proc|
68
- # thickness = value[:thickness] || 5
69
- # type = value[:pattern] || :solid
70
- #
71
- # if value[:color].instance_of? Atome
72
- # color_found = value[:color]
73
- # else
74
- # color_found = grab('black_matter').color(value[:color])
75
- # end
76
- #
77
- # red = color_found.red * 255
78
- # green = color_found.green * 255
79
- # blue = color_found.blue * 255
80
- # alpha = color_found.alpha
81
- #
82
- # html.style(:border, "#{type} #{thickness}px rgba(#{red},#{green},#{blue},#{alpha})")
83
- # end
84
62
  new({ method: :thickness, type: :integer, renderer: :html })
85
63
 
86
64
  # end
@@ -26,15 +26,6 @@ new({ method: :top, type: :integer, renderer: :html, specific: :shadow }) do
26
26
  affect(affect)
27
27
  end
28
28
 
29
- # new({ method: :top, type: :integer, renderer: :html, specific: :text }) do |params|
30
- # unit = @unit[:left] || :px
31
- # html.style(:top, "#{params}#{unit}"
32
- # end
33
- #
34
- # new({ method: :bottom, type: :integer, renderer: :html, specific: :text }) do |params|
35
- # html.style(:bottom, "#{params}#{unit}")
36
- # end
37
-
38
29
  new({ method: :left, type: :integer, specific: :color, renderer: :html })
39
30
 
40
31
  new({ method: :left, type: :integer, renderer: :html, specific: :shadow }) do
@@ -106,20 +106,17 @@ new({ method: :compute, type: :hash, renderer: :html }) do |params|
106
106
  end
107
107
 
108
108
  new({ renderer: :html, method: :preview }) do |params, user_proc|
109
- if params[:id]
110
- id_f = params[:id]
111
- else
112
- id_f = identity_generator
113
- end
109
+ id_f = params[:id] || identity_generator
114
110
  if params[:stop]
115
111
  html.stop_video_preview(id_f)
116
112
  else
117
113
 
118
- if params[:media] == :video
114
+ case params[:media]
115
+ when :video
119
116
  html.video_preview(id_f, true, false)
120
- elsif params[:media] == :audio
117
+ when :audio
121
118
  html.video_preview(id_f, false, true)
122
- elsif params[:media] == :all
119
+ when :all
123
120
  html.video_preview(id_f, true, true)
124
121
  else
125
122
  html.video_preview(id_f, true, true)
@@ -3,7 +3,6 @@
3
3
  # Rendering method here
4
4
  class Atome
5
5
  # private
6
-
7
6
  def render(element, params, &user_proc)
8
7
 
9
8
  render_engines = @renderers || []
@@ -0,0 +1,35 @@
1
+ # # frozen_string_literal: true
2
+ b=box
3
+
4
+ b.touch(:down) do
5
+ A.message({ action: :authentication, data: { table: :user, particles: { email: 'tre@tre.tre', password: 'poipoi' } } }) do |response|
6
+ alert "=> #{response}"
7
+ end
8
+ end
9
+
10
+ #
11
+ #
12
+ # # # 1 login attempt
13
+
14
+ wait 1 do
15
+ A.message({ action: :authentication, data: { table: :user, particles: { email: 'tre@tre.tre', password: 'poipoi' } } }) do |response|
16
+ alert "=> #{response}"
17
+ end
18
+ wait 1 do
19
+ A.message({ action: :authentication, data: { table: :user, particles: { email: 'tre@tre.tre', password: 'poipoi' } } }) do |response|
20
+ alert "=> #{response}"
21
+ end
22
+ end
23
+ end
24
+ #
25
+ # 2 account creation attempt
26
+ # wait 1 do
27
+ # A.message({ action: :account_creation, data: { email: 'tre@tre.tre', password: 'poipoi', user_id: 'Nico' } }) do |response|
28
+ # puts response
29
+ # end
30
+ #
31
+ # end
32
+
33
+ # string=hello
34
+ #
35
+ # puts JS.global.sha256(string.to_s)