atome 0.5.1.4 → 0.5.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +23 -2
  3. data/lib/atome/atome.rb +40 -18
  4. data/lib/atome/extensions/atome.rb +5 -26
  5. data/lib/atome/extensions/geolocation.rb +0 -1
  6. data/lib/atome/extensions/matrix.rb +171 -0
  7. data/lib/atome/extensions/ping.rb +9 -11
  8. data/lib/atome/genesis/generators/atome.rb +14 -2
  9. data/lib/atome/genesis/generators/communication.rb +1 -1
  10. data/lib/atome/genesis/generators/event.rb +36 -0
  11. data/lib/atome/genesis/generators/identity.rb +28 -2
  12. data/lib/atome/genesis/generators/material.rb +21 -0
  13. data/lib/atome/genesis/generators/spatial.rb +1 -0
  14. data/lib/atome/genesis/generators/utility.rb +20 -2
  15. data/lib/atome/genesis/genesis.rb +2 -2
  16. data/lib/atome/genesis/sparkle.rb +1 -1
  17. data/lib/atome/helpers/callbacks.rb +76 -0
  18. data/lib/atome/helpers/essentials.rb +10 -5
  19. data/lib/atome/helpers/utilities.rb +52 -8
  20. data/lib/atome/kernel/universe.rb +0 -4
  21. data/lib/atome/presets/atome.rb +12 -8
  22. data/lib/atome/renderers/browser/atome.rb +8 -19
  23. data/lib/atome/renderers/browser/browser.rb +15 -210
  24. data/lib/atome/renderers/browser/effect.rb +2 -2
  25. data/lib/atome/renderers/browser/event.rb +49 -11
  26. data/lib/atome/renderers/browser/geometry.rb +2 -2
  27. data/lib/atome/renderers/browser/helpers/animation_helper.rb +69 -0
  28. data/lib/atome/renderers/browser/helpers/browser_helper.rb +17 -0
  29. data/lib/atome/renderers/browser/helpers/color_helper.rb +33 -0
  30. data/lib/atome/renderers/browser/helpers/drag_helper.rb +39 -0
  31. data/lib/atome/renderers/browser/helpers/effect_helper.rb +26 -0
  32. data/lib/atome/renderers/browser/helpers/event_helper.rb +59 -0
  33. data/lib/atome/renderers/browser/helpers/image_helper.rb +27 -0
  34. data/lib/atome/renderers/browser/helpers/shadow_helper.rb +33 -0
  35. data/lib/atome/renderers/browser/helpers/shape_helper.rb +22 -0
  36. data/lib/atome/renderers/browser/helpers/text_helper.rb +26 -0
  37. data/lib/atome/renderers/browser/helpers/video_helper.rb +43 -0
  38. data/lib/atome/renderers/browser/helpers/web_helper.rb +30 -0
  39. data/lib/atome/renderers/browser/identity.rb +10 -3
  40. data/lib/atome/renderers/browser/material.rb +28 -5
  41. data/lib/atome/renderers/browser/spatial.rb +36 -5
  42. data/lib/atome/renderers/browser/utility.rb +21 -12
  43. data/lib/atome/renderers/headless/utility.rb +2 -2
  44. data/lib/atome/renderers/html/atome.rb +5 -5
  45. data/lib/atome/renderers/html/effect.rb +1 -1
  46. data/lib/atome/renderers/html/event.rb +1 -1
  47. data/lib/atome/renderers/html/geometry.rb +2 -2
  48. data/lib/atome/renderers/html/html.rb +1 -1
  49. data/lib/atome/renderers/html/identity.rb +2 -2
  50. data/lib/atome/renderers/html/spatial.rb +5 -5
  51. data/lib/atome/renderers/html/utility.rb +7 -7
  52. data/lib/atome/renderers/server/utility.rb +2 -2
  53. data/lib/atome/version.rb +1 -1
  54. data/lib/atome.rb +6 -4
  55. data/sig/atome.rbs +1 -0
  56. data/sig/atome_js.rbs +1 -0
  57. data/vendor/assets/build/css/style.css +25 -17
  58. data/vendor/assets/build/index.html +12 -3
  59. data/vendor/assets/build/js/atome/atome.js +150 -145
  60. data/vendor/assets/build/js/atome/atome_helpers/atome_animate.js +65 -0
  61. data/vendor/assets/build/js/atome/atome_helpers/atome_drag.js +85 -0
  62. data/vendor/assets/build/js/atome/atome_helpers/atome_file.js +7 -0
  63. data/vendor/assets/build/js/atome/atome_helpers/atome_sort.js +20 -0
  64. data/vendor/assets/build/js/atome/atome_helpers/atome_time.js +10 -0
  65. data/vendor/assets/build/js/atome/atome_helpers/atome_video.js +12 -0
  66. data/vendor/assets/build/js/third_parties/popmotion.min.js +1 -1
  67. data/vendor/assets/build/js/third_parties/sortable.min.js +2 -0
  68. data/vendor/assets/build/js/third_parties/wad.min.js +9 -0
  69. data/vendor/assets/build/medias/audios/Binrpilot.mp3 +0 -0
  70. data/vendor/assets/build/medias/rubies/examples/_2_solve.rb +45 -0
  71. data/vendor/assets/build/medias/rubies/examples/_audio.rb +178 -0
  72. data/vendor/assets/build/medias/rubies/examples/_dataset.rb +82 -0
  73. data/vendor/assets/build/medias/rubies/examples/_markers.rb +57 -0
  74. data/vendor/assets/build/medias/rubies/examples/_os.rb +29 -0
  75. data/vendor/assets/build/medias/rubies/examples/_vie.rb +211 -0
  76. data/vendor/assets/build/medias/rubies/examples/animation.rb +81 -0
  77. data/vendor/assets/build/medias/rubies/examples/at.rb +21 -0
  78. data/vendor/assets/build/medias/rubies/examples/{atome.new.rb → atome_new.rb} +5 -5
  79. data/vendor/assets/build/medias/rubies/examples/bottom.rb +1 -1
  80. data/vendor/assets/build/medias/rubies/examples/center.rb +21 -0
  81. data/vendor/assets/build/medias/rubies/examples/clone.rb +20 -0
  82. data/vendor/assets/build/medias/rubies/examples/color.rb +20 -15
  83. data/vendor/assets/build/medias/rubies/examples/cursor.rb +7 -0
  84. data/vendor/assets/build/medias/rubies/examples/delete.rb +25 -3
  85. data/vendor/assets/build/medias/rubies/examples/drag.rb +39 -0
  86. data/vendor/assets/build/medias/rubies/examples/edit.rb +12 -0
  87. data/vendor/assets/build/medias/rubies/examples/empty_atome.rb +12 -0
  88. data/vendor/assets/build/medias/rubies/examples/hide.rb +7 -0
  89. data/vendor/assets/build/medias/rubies/examples/matrix.rb +58 -0
  90. data/vendor/assets/build/medias/rubies/examples/monitoring.rb +22 -11
  91. data/vendor/assets/build/medias/rubies/examples/mute.rb +22 -0
  92. data/vendor/assets/build/medias/rubies/examples/on.rb +7 -1
  93. data/vendor/assets/build/medias/rubies/examples/{parent.rb → parents.rb} +6 -6
  94. data/vendor/assets/build/medias/rubies/examples/pause.rb +15 -0
  95. data/vendor/assets/build/medias/rubies/examples/play.rb +15 -0
  96. data/vendor/assets/build/medias/rubies/examples/read.rb +7 -4
  97. data/vendor/assets/build/medias/rubies/examples/remove.rb +16 -0
  98. data/vendor/assets/build/medias/rubies/examples/right.rb +1 -1
  99. data/vendor/assets/build/medias/rubies/examples/schedule.rb +2 -2
  100. data/vendor/assets/build/medias/rubies/examples/shadow.rb +8 -1
  101. data/vendor/assets/build/medias/rubies/examples/sort.rb +19 -0
  102. data/vendor/assets/build/medias/rubies/examples/style.rb +4 -0
  103. data/vendor/assets/build/medias/rubies/examples/time.rb +14 -0
  104. data/vendor/assets/build/medias/rubies/examples/touch.rb +50 -7
  105. data/vendor/assets/build/medias/texts/lorem.txt +1 -0
  106. metadata +50 -7
  107. data/lib/atome/processors/utilities.rb +0 -10
  108. data/vendor/assets/build/medias/rubies/examples/_animation.rb +0 -0
  109. data/vendor/assets/build/medias/rubies/examples/_drag.rb +0 -44
@@ -3,7 +3,7 @@
3
3
 
4
4
  generator = Genesis.generator
5
5
 
6
- generator.build_render_method(:html_shape) do
6
+ generator.build_render(:html_shape) do
7
7
  current_atome = @atome
8
8
  id_found = current_atome[:id]
9
9
  @html_object = Html.new
@@ -11,7 +11,7 @@ generator.build_render_method(:html_shape) do
11
11
  @html_object.attr('id', id_found)
12
12
  end
13
13
 
14
- generator.build_render_method(:html_color) do |_value|
14
+ generator.build_render(:html_color) do |_value|
15
15
  # we remove previous unused style tag
16
16
  opal_document[id]&.remove
17
17
  red_found = @atome[:red]
@@ -24,7 +24,7 @@ generator.build_render_method(:html_color) do |_value|
24
24
  # `document.getElementById(#{id}).sheet.cssRules[0].style.backgroundColor = 'red'`
25
25
  end
26
26
 
27
- generator.build_render_method(:html_image) do |_user_prc|
27
+ generator.build_render(:html_image) do |_user_prc|
28
28
  # id_found = id
29
29
  # instance_exec(&proc) if proc.is_a?(Proc)
30
30
  # DOM do
@@ -34,10 +34,10 @@ generator.build_render_method(:html_image) do |_user_prc|
34
34
  # @html_type = :image
35
35
  end
36
36
 
37
- generator.build_render_method(:html_shadow) do
37
+ generator.build_render(:html_shadow) do
38
38
  end
39
39
 
40
- generator.build_render_method(:html_video) do |_value, _user_proc|
40
+ generator.build_render(:html_video) do |_value, _user_proc|
41
41
  # id_found = id
42
42
  # # instance_exec(&proc) if proc.is_a?(Proc)
43
43
  # DOM do
@@ -2,7 +2,7 @@
2
2
 
3
3
  generator = Genesis.generator
4
4
 
5
- generator.build_render_method(:html_smooth) do |value|
5
+ generator.build_render(:html_smooth) do |value|
6
6
  formated_params = case value
7
7
  when Array
8
8
  properties = []
@@ -2,7 +2,7 @@
2
2
 
3
3
  generator = Genesis.generator
4
4
 
5
- generator.build_render_method(:html_touch) do |_value, proc|
5
+ generator.build_render(:html_touch) do |_value, proc|
6
6
  @html_object.on :click do |e|
7
7
  instance_exec(&proc) if proc.is_a?(Proc)
8
8
  end
@@ -2,10 +2,10 @@
2
2
 
3
3
  generator = Genesis.generator
4
4
 
5
- generator.build_render_method(:html_width) do |value|
5
+ generator.build_render(:html_width) do |value|
6
6
  @html_object.style[:width] = "#{value}px" unless @html_type == :style
7
7
  end
8
8
 
9
- generator.build_render_method(:html_height) do |value|
9
+ generator.build_render(:html_height) do |value|
10
10
  @html_object.style[:height] = "#{value}px" unless @html_type == :style
11
11
  end
@@ -34,7 +34,7 @@ class Html
34
34
  `#{parent_found}.appendChild(#{@html})`
35
35
  end
36
36
  def append_color(parent)
37
- alert "color : #{parent.class}"
37
+ aleputsrt "color : #{parent.class}"
38
38
  end
39
39
  def append_to(_node)
40
40
 
@@ -2,11 +2,11 @@
2
2
 
3
3
  generator = Genesis.generator
4
4
 
5
- generator.build_render_method(:html_type) do |params|
5
+ generator.build_render(:html_type) do |params|
6
6
  send("html_#{params}", user_proc)
7
7
  end
8
8
 
9
- generator.build_render_method(:html_parents) do |parents_found|
9
+ generator.build_render(:html_parents) do |parents_found|
10
10
  type_found = @atome[:type]
11
11
  parents_found.each do |parent_found|
12
12
  @html_object.send("append_#{type_found}", parent_found)
@@ -2,7 +2,7 @@
2
2
 
3
3
  generator = Genesis.generator
4
4
 
5
- # generator.build_render_method(:html_left) do |_value, user_proc|
5
+ # generator.build_render(:html_left) do |_value, user_proc|
6
6
  # instance_exec(&user_proc) if user_proc.is_a?(Proc)
7
7
  # end
8
8
  #
@@ -11,18 +11,18 @@ generator = Genesis.generator
11
11
  # instance_exec(&user_proc) if user_proc.is_a?(Proc)
12
12
  # end
13
13
 
14
- generator.build_render_method(:html_left) do |value, _user_proc|
14
+ generator.build_render(:html_left) do |value, _user_proc|
15
15
  @html_object.style[:left] = "#{value}px" unless @html_type == :style
16
16
  end
17
17
 
18
- generator.build_render_method(:html_right) do |value, _user_proc|
18
+ generator.build_render(:html_right) do |value, _user_proc|
19
19
  @html_object.style[:right] = "#{value}px" unless @html_type == :style
20
20
  end
21
21
 
22
- generator.build_render_method(:html_top) do |value, _user_proc|
22
+ generator.build_render(:html_top) do |value, _user_proc|
23
23
  @html_object.style[:top] = "#{value}px" unless @html_type == :style
24
24
  end
25
25
 
26
- generator.build_render_method(:html_bottom) do |value, _user_proc|
26
+ generator.build_render(:html_bottom) do |value, _user_proc|
27
27
  @html_object.style[:bottom] = "#{value}px" unless @html_type == :style
28
28
  end
@@ -1,17 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  generator = Genesis.generator
4
- generator.build_render_method(:html_bloc)
5
- generator.build_render_method(:html_id)
6
- generator.build_render_method(:html_render)
7
- generator.build_render_method(:html_delete) do
4
+ generator.build_render(:html_bloc)
5
+ generator.build_render(:html_id)
6
+ generator.build_render(:html_render)
7
+ generator.build_render(:html_delete) do
8
8
  html_object&.remove
9
9
  end
10
- generator.build_render_method(:html_clear) do
10
+ generator.build_render(:html_clear) do
11
11
  @atome[:children].each do |child_found|
12
12
  grab(child_found).html_object&.remove
13
13
  end
14
14
  children([])
15
15
  end
16
- generator.build_render_method(:html_schedule)
17
- generator.build_render_method(:html_reader)
16
+ generator.build_render(:html_schedule)
17
+ generator.build_render(:html_reader)
@@ -2,5 +2,5 @@
2
2
 
3
3
  generator = Genesis.generator
4
4
 
5
- generator.build_render_method(:server_schedule)
6
- generator.build_render_method(:server_reader)
5
+ generator.build_render(:server_schedule)
6
+ generator.build_render(:server_reader)
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.1.4'
4
+ VERSION = '0.5.2.5'
5
5
  end
data/lib/atome.rb CHANGED
@@ -8,8 +8,8 @@ require 'atome/kernel/universe'
8
8
  require 'atome/helpers/essentials'
9
9
  require 'atome/renderers/renderer'
10
10
  require 'atome/helpers/color_helper/color'
11
+ require 'atome/extensions/atome'
11
12
  require 'atome/atome'
12
- require 'atome/processors/utilities'
13
13
  require 'atome/helpers/utilities'
14
14
  require 'atome/helpers/callbacks'
15
15
  require 'atome/genesis/generators/atome'
@@ -22,10 +22,12 @@ require 'atome/genesis/generators/identity'
22
22
  require 'atome/genesis/generators/material'
23
23
  require 'atome/genesis/generators/spatial'
24
24
  require 'atome/genesis/generators/utility'
25
- require 'atome/renderers/browser/browser'
26
- require 'atome/renderers/html/html'
25
+ if RUBY_ENGINE.downcase == 'opal'
26
+ require 'atome/renderers/browser/browser'
27
+ require 'atome/renderers/html/html'
28
+ end
27
29
  require 'atome/renderers/headless/headless'
28
30
  require 'atome/renderers/server/server'
29
- require 'atome/extensions/atome'
31
+ require 'atome/extensions/matrix'
30
32
  require 'atome/helpers/sanitizer'
31
33
  require 'atome/genesis/sparkle'
data/sig/atome.rbs CHANGED
@@ -1,4 +1,5 @@
1
1
  module Atome
2
2
  VERSION: String
3
3
  # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ def sort_callback: -> untyped
4
5
  end
data/sig/atome_js.rbs ADDED
@@ -0,0 +1 @@
1
+ ATOME_JS: untyped
@@ -18,7 +18,7 @@ html, body {
18
18
  }
19
19
 
20
20
 
21
- #device {
21
+ #view {
22
22
  left: 0;
23
23
  font-size: 25px;
24
24
  right: 0;
@@ -43,6 +43,7 @@ html, body {
43
43
 
44
44
  .selected {
45
45
  outline: 2px dashed white;
46
+ background-color: #00bb00;
46
47
  }
47
48
 
48
49
  .atome {
@@ -68,29 +69,26 @@ html, body {
68
69
  -webkit-background-clip: text;
69
70
  }
70
71
 
71
- .vertical-center {
72
- /*font-size: 18px;*/
72
+ .center {
73
+ display: flex;
74
+ justify-content: center;
75
+ align-items: center;
73
76
  position: absolute;
74
- top: 50%;
75
- -ms-transform: translateY(-50%);
76
- /*transform: translateY(calc(50% - 200px));*/
77
+ transform: translate(-50%, -50%);
77
78
  }
78
79
 
79
- .center {
80
- /*font-size: 18px;*/
80
+ .center_vertical {
81
+ display: flex;
82
+ align-items: center;
81
83
  position: absolute;
82
- top: 50%;
83
- left: 50%;
84
- -ms-transform: translateY(-50%);
85
- /* #calc is width -border*2 */
86
- /*transform: translateX(calc(50% - 200px)) translateY(calc(50% - 200px));*/
84
+ transform: translateY(-50%);
87
85
  }
88
86
 
89
- .horizontal-center {
87
+ .center_horizontal{
88
+ display: flex;
89
+ justify-content: center;
90
90
  position: absolute;
91
- left: 50%;
92
- -ms-transform: translateY(-50%);
93
- /*transform: translateX(calc(50% - 200px));*/
91
+ transform: translateX(-50%);
94
92
  }
95
93
 
96
94
  .e_align_h_left {
@@ -119,3 +117,13 @@ html, body {
119
117
  display: flex;
120
118
  align-items: flex-end;
121
119
  }
120
+
121
+ /*::selection {*/
122
+ /* color: transparent;*/
123
+ /* background: none;*/
124
+ /*}*/
125
+ /*!* For Mozilla Firefox *!*/
126
+ /*::-moz-selection {*/
127
+ /* color: transparent;*/
128
+ /* background: none;*/
129
+ /*}*/
@@ -8,9 +8,13 @@
8
8
  <link type="text/css" rel="stylesheet" href="css/style.css">
9
9
  <script type="text/javascript" src="js/third_parties/interact.min.js"></script>
10
10
  <script type="text/javascript" src="js/third_parties/popmotion.min.js"></script>
11
+ <script type="text/javascript" src="js/third_parties/sortable.min.js"></script>
12
+ <script type="text/javascript" src="js/third_parties/wad.min.js"></script>
13
+ <!-- <script type="text/javascript" src="js/third_parties/tone.min.js"></script>-->
14
+ <!-- <script type="text/javascript" src="js/third_parties/xsound.min.js"></script>-->
11
15
  <script type="text/javascript" src="js/third_parties/sha256.min.js"></script>
12
16
  <script type="text/javascript" src="js/third_parties/ping.min.js"></script>
13
- <script src='js/third_parties/w3color.js'></script>
17
+ <!-- <script src='js/third_parties/w3color.js'></script>-->
14
18
  <script src='js/opal/opal.js'></script>
15
19
  <script src='js/opal/opal_browser.js'></script>
16
20
  <!-- TODO: we line below is commented when using stand alone mode and loaded on demand when using server mode-->
@@ -18,13 +22,18 @@
18
22
  <!-- <script type="text/javascript" src="js/third_parties/three.min.js"></script>-->
19
23
  <!-- <script src='js/opal/opal_parser.js'></script>-->
20
24
  <script src='js/aui.js'></script>
25
+ <script src='js/atome/atome_helpers/atome_animate.js' defer></script>
26
+ <script src='js/atome/atome_helpers/atome_drag.js' defer></script>
27
+ <script src='js/atome/atome_helpers/atome_file.js' defer></script>
28
+ <script src='js/atome/atome_helpers/atome_sort.js' defer></script>
29
+ <script src='js/atome/atome_helpers/atome_time.js' defer></script>
30
+ <script src='js/atome/atome_helpers/atome_video.js' defer></script>
21
31
  <script src='js/atome/atome.js' defer></script>
22
32
  <script src='js/atome/kernel.js' defer></script>
23
33
  <script src='js/opal/atome_opal_extensions.js'></script>
24
34
  <title>atome</title>
25
35
  <link rel="icon" type="image/x-icon" href="./favicon.ico">
26
36
  </head>
27
- <body id='user_view' class='atome' oncontextmenu="return false;">
28
- </body>
37
+ <body id='user_view' class='atome' oncontextmenu="return false;"></body>
29
38
  <script src='js/application.js' defer></script>
30
39
  </html>
@@ -1,155 +1,160 @@
1
- // class AtomeDrag {
2
- // constructor() {
3
- // }
1
+ const atomeJS = Object.assign(atomeAnimate,atomeDrag,atomeFile,atomeSort, atomeTime, atomeVideo);
2
+
3
+ // // class AtomeDrag {
4
+ // // constructor() {
5
+ // // }
6
+ // //
7
+ // // drag(atome_drag_id) {
8
+ // // // target elements with the "draggable" class
9
+ // // self.current_obj = Opal.Utilities.$grab(atome_drag_id)
10
+ // // interact('.'+atome_drag_id)
11
+ // // .draggable({
12
+ // // // enable inertial throwing
13
+ // // startAxis: 'x',
14
+ // // lockAxis: 'x',
15
+ // // // lockAxis: ''+lock_axis,
16
+ // // inertia: true,
17
+ // // // keep the element within the area of it's parent
18
+ // // modifiers: [
19
+ // // interact.modifiers.restrictRect({
20
+ // // restriction: 'parent',
21
+ // // endOnly: true
22
+ // // })
23
+ // // ],
24
+ // // // enable autoScroll
25
+ // // autoScroll: true,
26
+ // //
27
+ // // listeners: {
28
+ // // // call this function on every dragmove event
29
+ // //
30
+ // // move: dragMoveListener,
31
+ // // start(event) {
32
+ // // //TODO: optimise this passing the proc to the drag callback
33
+ // // // lets get the current atome Object
34
+ // // // self.current_obj = Opal.Utilities.$grab(atome_drag_id)
35
+ // // // now get the grab proc
36
+ // // self.proc_meth = current_obj.bloc
37
+ // // },
38
+ // // // call this function on every dragend event
39
+ // // end(event) {
40
+ // // }
41
+ // // }
42
+ // // })
43
+ // //
44
+ // // function dragMoveListener(event) {
45
+ // // const target = event.target
46
+ // // // the code below can be conditioned to receive the drag event without moving the object
47
+ // // // keep the dragged position in the data-x/data-y attributes
48
+ // // const x = (parseFloat(target.getAttribute('data-x')) || 0) + event.dx;
49
+ // // const y = (parseFloat(target.getAttribute('data-y')) || 0) + event.dy
50
+ // // // translate the element
51
+ // // target.style.transform = 'translate(' + x + 'px, ' + y + 'px)'
52
+ // // // update the position attributes
53
+ // // target.setAttribute('data-x', x)
54
+ // // target.setAttribute('data-y', y)
55
+ // // // CallBack here
56
+ // // self.current_obj.$dragCallback(event.pageX, event.pageY, event.rect.left, event.rect.top, self.current_obj, self.proc_meth);
57
+ // // }
58
+ // // }
59
+ // //
60
+ // // }
61
+ //
62
+ // // Usage:
63
+ // // let atomeDrag = new AtomeDrag();
64
+ // // atomeDrag.drag('atome_id', 'options');
65
+ // // const Atomeanimation = {}
66
+ //
67
+ //
68
+ //
69
+ // // TODO: put in a class
70
+ //
4
71
  //
5
- // drag(atome_drag_id) {
6
- // // target elements with the "draggable" class
7
- // self.current_obj = Opal.Utilities.$grab(atome_drag_id)
8
- // interact('.'+atome_drag_id)
9
- // .draggable({
10
- // // enable inertial throwing
11
- // startAxis: 'x',
12
- // lockAxis: 'x',
13
- // // lockAxis: ''+lock_axis,
14
- // inertia: true,
15
- // // keep the element within the area of it's parent
16
- // modifiers: [
17
- // interact.modifiers.restrictRect({
18
- // restriction: 'parent',
19
- // endOnly: true
20
- // })
21
- // ],
22
- // // enable autoScroll
23
- // autoScroll: true,
24
- //
25
- // listeners: {
26
- // // call this function on every dragmove event
27
- //
28
- // move: dragMoveListener,
29
- // start(event) {
30
- // //TODO: optimise this passing the proc to the drag callback
31
- // // lets get the current atome Object
32
- // // self.current_obj = Opal.Utilities.$grab(atome_drag_id)
33
- // // now get the grab proc
34
- // self.proc_meth = current_obj.bloc
35
- // },
36
- // // call this function on every dragend event
37
- // end(event) {
38
- // }
39
- // }
40
- // })
41
- //
42
- // function dragMoveListener(event) {
43
- // const target = event.target
44
- // // the code below can be conditioned to receive the drag event without moving the object
45
- // // keep the dragged position in the data-x/data-y attributes
46
- // const x = (parseFloat(target.getAttribute('data-x')) || 0) + event.dx;
47
- // const y = (parseFloat(target.getAttribute('data-y')) || 0) + event.dy
48
- // // translate the element
49
- // target.style.transform = 'translate(' + x + 'px, ' + y + 'px)'
50
- // // update the position attributes
51
- // target.setAttribute('data-x', x)
52
- // target.setAttribute('data-y', y)
53
- // // CallBack here
54
- // self.current_obj.$dragCallback(event.pageX, event.pageY, event.rect.left, event.rect.top, self.current_obj, self.proc_meth);
72
+ // const atome = {
73
+ // jsSchedule: function (years, months, days, hours, minutes, seconds, atome, proc) {
74
+ // const now = new Date();
75
+ // const formatDate = new Date(years, months - 1, days, hours, minutes, seconds);
76
+ // const diffTime = Math.abs(formatDate - now);
77
+ // setTimeout(function () {
78
+ // atome.$schedule_callback(proc);
79
+ // }, diffTime);
80
+ // },
81
+ // jsReader: function (file, atome, proc) {
82
+ // fetch('medias/' + file)
83
+ // .then(response => response.text())
84
+ // .then(text => atome.$read_callback(text, proc))
85
+ // },
86
+ // js_Fullscreen: function (atome_id){
87
+ // let elem = document.getElementById(atome_id)
88
+ // if (elem.requestFullscreen) {
89
+ // elem.requestFullscreen();
90
+ // } else if (elem.webkitRequestFullscreen) { /* Safari */
91
+ // elem.webkitEnterFullscreen();
92
+ // } else if (elem.msRequestFullscreen) { /* IE11 */
93
+ // elem.msRequestFullscreen();
55
94
  // }
95
+ //
56
96
  // }
57
97
  //
58
98
  // }
59
99
 
60
- // Usage:
61
- // let atomeDrag = new AtomeDrag();
62
- // atomeDrag.drag('atome_id', 'options');
63
- const Atomeanimation = {}
64
-
65
-
66
-
67
- // TODO: put in a class
68
-
69
-
70
- const atome = {
71
- jsSchedule: function (years, months, days, hours, minutes, seconds, atome, proc) {
72
- const now = new Date();
73
- const formatDate = new Date(years, months - 1, days, hours, minutes, seconds);
74
- const diffTime = Math.abs(formatDate - now);
75
- setTimeout(function () {
76
- atome.$schedule_callback(proc);
77
- }, diffTime);
78
- },
79
- jsReader: function (file, atome, proc) {
80
- fetch('medias/' + file)
81
- .then(response => response.text())
82
- .then(text => atome.$read_callback(text, proc))
83
- },
84
- js_Fullscreen: function (atome_id){
85
- let elem = document.getElementById(atome_id)
86
- if (elem.requestFullscreen) {
87
- elem.requestFullscreen();
88
- } else if (elem.webkitRequestFullscreen) { /* Safari */
89
- elem.webkitEnterFullscreen();
90
- } else if (elem.msRequestFullscreen) { /* IE11 */
91
- elem.msRequestFullscreen();
92
- }
93
-
94
- }
95
-
96
- }
97
-
98
-
99
- // example ruby equivalent in js //
100
- Opal.queue(function (Opal) {/* Generated by Opal 1.6.0 */
101
- const $klass = Opal.klass, $defs = Opal.defs, $def = Opal.def;
102
- // The line below create the AtomicJS cons to simplify access to js object from ruby
103
-
104
- // var $const_set = Opal.const_set, $nesting = [], nil = Opal.nil;
105
- // return $const_set($nesting[0], 'AtomicJS', atome)
106
-
107
- (function ($base, $super) {
108
- const self = $klass($base, $super, 'Atome_html');
109
- $def(self, '$initialize', function $$initialize(val) {
110
- // Init code below
111
- }, 1);
112
-
113
- $defs(self, '$check_this', function $$check_this(val) {
114
- // getter code below
115
- return (val);
116
- }, 0);
117
-
118
- $def(self, '$way', function $way() {
119
- // getter code below
120
- return (self.my_var);
121
- }, 0);
122
-
123
- return $def(self, '$way=', function $way(val) {
124
- //self method example
125
- return (self.my_var = val);
126
- }, 0);
127
100
 
128
-
129
- })();
130
-
131
- // new class below
132
- return (function ($base, $super) {
133
- const self = $klass($base, $super, 'Atome');
134
-
135
- $defs(self, '$verif', function $$verif(val) {
136
- //self method example
137
- return (val);
138
- }, 0);
139
-
140
- $def(self, '$new_method', function $way() {
141
- // getter code below
142
- return (self.new_method);
143
- }, 0);
144
-
145
-
146
- return $def(self, '$new_method=', function $way(val) {
147
- //setter code below
148
- return (self.atome = val);
149
- }, 0);
150
-
151
- })();
152
- });
101
+ ///////////////////////////////////////////////////////////
102
+ // //// example ruby equivalent in js ///
103
+ // Opal.queue(function (Opal) {/* Generated by Opal 1.6.0 */
104
+ // const $klass = Opal.klass, $defs = Opal.defs, $def = Opal.def;
105
+ // // The line below create the AtomicJS cons to simplify access to js object from ruby
106
+ //
107
+ // // var $const_set = Opal.const_set, $nesting = [], nil = Opal.nil;
108
+ // // return $const_set($nesting[0], 'AtomicJS', atome)
109
+ //
110
+ // (function ($base, $super) {
111
+ // const self = $klass($base, $super, 'AtomeJS');
112
+ // $def(self, '$initialize', function $$initialize(val) {
113
+ // // Init code below
114
+ // }, 1);
115
+ //
116
+ // $defs(self, '$check_this', function $$check_this(val) {
117
+ // // getter code below
118
+ // // alert ('Suoer cool!!'+val)
119
+ // // alert(atomeJS)
120
+ // return (val);
121
+ // }, 0);
122
+ //
123
+ // $def(self, '$way', function $way() {
124
+ // // getter code below
125
+ // return (self.my_var);
126
+ // }, 0);
127
+ //
128
+ // return $def(self, '$way=', function $way(val) {
129
+ // //self method example
130
+ // return (self.my_var = val);
131
+ // }, 0);
132
+ //
133
+ //
134
+ // })();
135
+ //
136
+ // // new class below
137
+ // return (function ($base, $super) {
138
+ // const self = $klass($base, $super, 'Atome');
139
+ //
140
+ // $defs(self, '$verif', function $$verif(val) {
141
+ // //self method example
142
+ // return (val);
143
+ // }, 0);
144
+ //
145
+ // $def(self, '$new_method', function $way() {
146
+ // // getter code below
147
+ // return (self.new_method);
148
+ // }, 0);
149
+ //
150
+ //
151
+ // return $def(self, '$new_method=', function $way(val) {
152
+ // //setter code below
153
+ // return (self.atome = val);
154
+ // }, 0);
155
+ //
156
+ // })();
157
+ // });
153
158
 
154
159
 
155
160