atome 0.5.7.4.7 → 0.5.7.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/lib/atome/extensions/atome.rb +27 -1
  3. data/lib/atome/genesis/genesis.rb +3 -3
  4. data/lib/atome/genesis/particles/communication.rb +4 -4
  5. data/lib/atome/genesis/particles/utility.rb +6 -5
  6. data/lib/atome/genesis/sparkle.rb +17 -16
  7. data/lib/atome/kernel/universe.rb +3 -1
  8. data/lib/atome/utilities/essentials.rb +3 -1
  9. data/lib/atome/utilities/utilities.rb +118 -37
  10. data/lib/atome/version.rb +1 -1
  11. data/lib/molecules/intuition/tools.rb +2 -2
  12. data/lib/molecules/intuition/utilities.rb +7 -6
  13. data/lib/renderers/html/html.rb +36 -13
  14. data/lib/renderers/html/identity.rb +12 -5
  15. data/vendor/assets/application/examples/animation.rb +21 -17
  16. data/vendor/assets/application/examples/applications.rb +11 -3
  17. data/vendor/assets/application/examples/buttons.rb +28 -33
  18. data/vendor/assets/application/examples/flash.rb +5 -0
  19. data/vendor/assets/application/examples/input.rb +7 -2
  20. data/vendor/assets/application/examples/int8.rb +30 -11
  21. data/vendor/assets/application/examples/retreive.rb +24 -0
  22. data/vendor/assets/application/examples/schedule.rb +23 -0
  23. data/vendor/assets/application/examples/server.rb +1 -0
  24. data/vendor/assets/application/examples/terminal.rb +3 -1
  25. data/vendor/assets/application/examples/test.rb +15 -0
  26. data/vendor/assets/application/examples/touch.rb +4 -4
  27. data/vendor/assets/server/atome_server_wasm.rb +0 -1
  28. data/vendor/assets/server/eDen.rb +1 -0
  29. data/vendor/assets/src/index_server_wasm.html +5 -1
  30. data/vendor/assets/src/js/atome/atome.js +12 -8
  31. data/vendor/assets/src/js/atome/specific/wasm.js +2 -2
  32. metadata +6 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4307d31fea820f10f0830b00698f327cd08181a864b4440a25a57021fb0ffb7e
4
- data.tar.gz: 6a66d5336fa6a58eae59571504d92230eb8482bdd44c4821bbf3e79e27a356d2
3
+ metadata.gz: cfe78ba10396036f7ff7cfcb324d6e121006e841e276f0602b5ffd50e480df9f
4
+ data.tar.gz: 713ee69cadbee8b0fd7d7ae7456589537c8e815e138881b183bf5eda1b4612c4
5
5
  SHA512:
6
- metadata.gz: b0a16ea7a7865bc3b13bdc81ce6d57dccf557c25c016446a151eee1203d582e22a246dae317f2531c19cba16fa7c2e3455f64f49ab3966cd526f3ccd2675fff4
7
- data.tar.gz: c5988d35c2b6af02f6db44e610c0f01ede3d99cd5558db342bbfa186a04cf4669bc0344ad50d187e0208272234c49d2683f0b9ff326082575beeb8177e11490b
6
+ metadata.gz: d67424076d1715af0771efee85a60eeaa140900125e1458319c84746b00a0d3651ab0f46c530e43f3c9fa539cdc1259f532fae5ad188636dd538b6249bdc131e
7
+ data.tar.gz: ff448ccf270a36189e590bafb6030cea066f35f2a960801ea6af81c70fbea9908c3d897bf04c7a214cfc0f1bb13c0a114e4b61eec69079f50ed366241cb391d6
@@ -69,6 +69,16 @@ end
69
69
  class Object
70
70
  include ObjectExtension
71
71
 
72
+ def refresh
73
+ grab(:view).retrieve do |child|
74
+ child.refresh
75
+ end
76
+ # atomes_to_treat=grab(:view).fasten.dup
77
+ # atomes_to_treat.each do |atome_found|
78
+ # grab(atome_found).refresh
79
+ # end
80
+ end
81
+
72
82
  def truncate_string(string, max_length)
73
83
  string.length > max_length ? string.slice(0, max_length) + '.' : string
74
84
  end
@@ -128,7 +138,20 @@ class Object
128
138
 
129
139
  def hook(a_id)
130
140
  a_id = a_id.to_sym
131
- Universe.atomes[a_id]
141
+ # Universe.atomes[a_id]
142
+ atome_get=''
143
+ Universe.atomes.each do |aid_f, atome|
144
+ # alert "1 #{atome}"
145
+
146
+ if atome.id== a_id
147
+ atome_get= atome
148
+ # alert "2 #{atome}"
149
+ end
150
+ # alert "3 #{atome_get}"
151
+
152
+ end
153
+ # alert atome_get
154
+ atome_get
132
155
  end
133
156
 
134
157
  def grab(id_to_get)
@@ -804,4 +827,7 @@ class CssProxy
804
827
  end
805
828
 
806
829
 
830
+
831
+
832
+
807
833
  end
@@ -133,11 +133,11 @@ class Genesis
133
133
  @apply.each do |fasten_atome|
134
134
  collected_atomes << fasten_atome if grab(fasten_atome).type.to_sym == element.to_sym
135
135
  end
136
- else
136
+ elsif fasten
137
137
  fasten.each do |fasten_atome|
138
- collected_atomes << fasten_atome if grab(fasten_atome).type.to_sym == element.to_sym
138
+ child_found=grab(fasten_atome)
139
+ collected_atomes << fasten_atome if child_found.type.to_sym == element.to_sym
139
140
  end
140
-
141
141
  end
142
142
  # TODO/ FIXME : potential problem with group here"
143
143
  collected_atomes
@@ -24,10 +24,10 @@ end
24
24
 
25
25
  new({ particle: :int8, category: :communication, type: :int })
26
26
 
27
- new({ particle: :language, category: :communication, type: :string }) do |params|
28
- @data = int8[params]
29
- params
30
- end
27
+ # new({ particle: :language, category: :communication, type: :string }) do |params|
28
+ # @data = int8[params]
29
+ # params
30
+ # end
31
31
  # method below are used for communication with native core
32
32
  def receptor(msg)
33
33
  parsed = JSON.parse(msg)
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  def delete_recursive(atome_id, force=false)
3
3
  return if grab(atome_id).tag && (grab(atome_id).tag[:persistent] || grab(atome_id).tag[:system]) unless force
4
-
4
+ touch(false)
5
5
  parent_id_found = grab(atome_id).attach
6
6
  parent_found = grab(parent_id_found)
7
7
  new_array = parent_found.fasten.dup
@@ -11,7 +11,7 @@ def delete_recursive(atome_id, force=false)
11
11
  delete_recursive(atome_id_found, force)
12
12
  end
13
13
  grab(atome_id).render(:delete, { :recursive => true })
14
- grab(atome_id).touch(:remove)
14
+ grab(atome_id).touch(false)
15
15
  Universe.delete(grab(atome_id).aid)
16
16
  end
17
17
 
@@ -37,7 +37,7 @@ new({ particle: :target }) do |params|
37
37
  end
38
38
  new({ particle: :delete, category: :utility, type: :boolean, render: false }) do |params|
39
39
  if params == true
40
-
40
+ touch(false)
41
41
  # We use the tag persistent to exclude color of system object and other default colors
42
42
  unless @tag && (@tag[:persistent] || @tag[:system])
43
43
  # if we are on a matrix we delete cells found & group found
@@ -64,13 +64,14 @@ new({ particle: :delete, category: :utility, type: :boolean, render: false }) do
64
64
  # if we are on a matrix we delete cells found & group found
65
65
  cells.delete(true)
66
66
  group.delete(true)
67
+ touch(false)
67
68
  if params[:recursive]
68
69
  grab(attach).unfasten([id])
69
70
  unless grab(@id).tag && (grab(@id).tag[:persistent] || grab(@id).tag[:system])
70
71
  fasten.each do |atttached_atomes|
71
72
  delete_recursive(atttached_atomes)
72
73
  end
73
- touch(:remove)
74
+ # touch(false)
74
75
  render(:delete, params)
75
76
  Universe.delete(@aid)
76
77
  end
@@ -79,7 +80,7 @@ new({ particle: :delete, category: :utility, type: :boolean, render: false }) do
79
80
  # alert "fasten : #{fasten}"
80
81
  delete_recursive(atttached_atomes, true)
81
82
  end
82
- touch(:remove)
83
+ touch(false)
83
84
  render(:delete, params)
84
85
  # alert "Universe : #{Universe.atomes[@aid]}"
85
86
  # alert "length = #{Universe.atomes.length}"
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ Universe.language = :english
4
+
3
5
  # now let's get the default render engine
4
6
 
5
7
  # Lets create the U.I.
@@ -62,16 +64,16 @@ Atome.new(
62
64
 
63
65
  # view port
64
66
  Atome.new(
65
- { renderers: default_render, aid: :view,type: :shape, attach: :user_view, apply: [:view_color],
67
+ { renderers: default_render, aid: :view, type: :shape, attach: :user_view, apply: [:view_color],
66
68
  tag: { system: true }, left: 0, right: 0, top: 0, bottom: 0, width: :auto, height: :auto, overflow: :auto,
67
- language: :english
69
+ # language: :english
68
70
  }
69
71
 
70
72
  )
71
73
 
72
74
  # unreal port, hold system object and tools
73
75
  Atome.new(
74
- { renderers: default_render, aid: :intuition, type: :shape, attach: :user_view,data: {}, tag: { system: true },
76
+ { renderers: default_render, aid: :intuition, type: :shape, attach: :user_view, data: {}, tag: { system: true },
75
77
  left: 0, top: 0, bottom: 0, width: 0, height: :auto, overflow: :visible
76
78
  }
77
79
  )
@@ -87,8 +89,6 @@ Atome.new({ renderers: [:html], aid: :copy, collect: [], type: :group, tag: { sy
87
89
  Atome.new({ renderers: default_render, id: machine_id, type: :machine, password: machine_password,
88
90
  name: :macAir, data: { date: '10090717' }, tag: { system: true } })
89
91
 
90
-
91
-
92
92
  # user
93
93
  user_password = { global: :star_win, read: { atome: :star_wars }, write: { atome: :star_wars } }
94
94
 
@@ -126,8 +126,12 @@ puts b.left
126
126
  b.left(155)
127
127
  puts b.left
128
128
  STR
129
- example = text({ int8: { english: english, french: french }, language: :english, width: 666 })
130
- code_text = text({ int8: { english: code }, language: :english, width: 666, top: 33 })
129
+ example = text({ int8: { english: english, french: french },
130
+ # language: :english,
131
+ width: 666 })
132
+ code_text = text({ int8: { english: code },
133
+ # language: :english,
134
+ width: 666, top: 33 })
131
135
  example.touch(true) do
132
136
  example.delete(true)
133
137
  help(:left)
@@ -143,15 +147,13 @@ def atome_genesis
143
147
  server = Universe.current_server
144
148
  server ||= 'disconnected'
145
149
  puts "server: #{server}"
146
-
147
- if server.start_with?('http')
148
- Universe.connected = true
149
- A.server({ address: 'localhost:9292', type: 'ws' })
150
- A.init_websocket do |msg|
151
- puts "websocket initialised #{msg}"
152
- end
153
- Universe.allow_sync = true
150
+ return unless server.start_with?('http') && Atome::host.to_sym != :tauri
151
+ Universe.connected = true
152
+ A.server({ address: 'localhost:9292', type: 'ws' })
153
+ A.init_websocket do |msg|
154
+ puts "websocket initialised #{msg}"
154
155
  end
156
+ Universe.allow_sync = true
155
157
  end
156
158
 
157
159
  # this method is call from JS (atome/communication) at WS connection
@@ -182,7 +184,6 @@ def init_database
182
184
  A.sync({ action: :create_db_column, data: { table: :history, column: :date, type: :datetime } }) do |_db_state|
183
185
  end
184
186
 
185
-
186
187
  # now we send localstorage content to the server
187
188
  Atome.send_localstorage_content
188
189
 
@@ -28,6 +28,7 @@ class Universe
28
28
  @allow_tool_operations = false
29
29
  @active_tools = []
30
30
  @atome_preset = []
31
+ @translation={}
31
32
  @default_selection_style = { border: { thickness: 1, red: 1, green: 0, blue: 0, alpha: 1, pattern: :dotted } }
32
33
  @applicable_atomes = %i[color shadow border paint animation]
33
34
  # @historicize=false
@@ -35,7 +36,8 @@ class Universe
35
36
  attr_reader :atomes, :atomes_ids, :renderer_list, :molecule_list, :atome_list, :particle_list, :classes, :counter,
36
37
  :atomes_specificities
37
38
  attr_accessor :connected, :allow_sync, :allow_localstorage, :database_ready, :edit_mode, :tools, :tools_root,
38
- :allow_tool_operations, :active_tools, :atome_preset, :applicable_atomes, :default_selection_style
39
+ :allow_tool_operations, :active_tools, :atome_preset, :applicable_atomes, :default_selection_style,
40
+ :translation, :language
39
41
 
40
42
  def messages
41
43
  @messages
@@ -38,7 +38,9 @@ module Essentials
38
38
  left: 0, top: 0 },
39
39
  text: { type: :text, component: { size: 12 },left: 0, top: 0,
40
40
  apply: [:text_color],
41
- width: :auto, height: :auto, language: :english },
41
+ width: :auto, height: :auto,
42
+ # language: :english
43
+ },
42
44
  drm: { type: :drm, attach: :black_matter },
43
45
  shadow: { type: :shadow, red: 0, green: 0, blue: 0, alpha: 1, blur: 3, left: 3, top: 3 },
44
46
  border: { type: :border, red: 0, green: 0, blue: 0, alpha: 0, pattern: :solid, thickness: 6 },
@@ -9,7 +9,6 @@ class Atome
9
9
  class << self
10
10
  attr_accessor :initialized
11
11
 
12
-
13
12
  def sanitize_data_for_json(data)
14
13
  data.gsub('"', '\\"')
15
14
  end
@@ -86,7 +85,9 @@ class Atome
86
85
  end
87
86
  args = args[0]
88
87
  end
89
- instance_exec({ original: value_before, altered: args, particle: monitored_particle }, &bloc) if bloc.is_a?(Proc)
88
+ if bloc.is_a?(Proc)
89
+ instance_exec({ original: value_before, altered: args, particle: monitored_particle }, &bloc)
90
+ end
90
91
  original_method.call(*args)
91
92
  end
92
93
  end
@@ -114,9 +115,7 @@ class Atome
114
115
 
115
116
  fasten.each do |child_id|
116
117
  child_found = grab(child_id)
117
- if child_found.role && child_found.role.include?(role_wanted)
118
- gripped_atome << child_id
119
- end
118
+ gripped_atome << child_id if child_found.role && child_found.role.include?(role_wanted)
120
119
  end
121
120
  gripped_atome
122
121
  end
@@ -125,9 +124,48 @@ class Atome
125
124
  # dummy method
126
125
  end
127
126
 
127
+ def retrieve(params = {}, &block)
128
+ closest_first = true, include_self = false
129
+ if params[:ascending] == false
130
+ closest_first = :inverted
131
+ end
132
+ if params[:self] == true
133
+ include_self = true
134
+ end
135
+
136
+ # this method allow to retrieve all children of an atome recursively, beginning from the closet child or inverted
128
137
 
138
+ all_children = []
139
+ fetch_children_recursively = lambda do |parent, depth|
140
+ children_ids = parent.fasten
141
+ if children_ids.any?
142
+ children_ids.each do |child_id|
143
+ child = grab(child_id)
144
+ fetch_children_recursively.call(child, depth + 1)
145
+ end
146
+ end
147
+ if include_self
148
+ all_children << { depth: depth, child: parent }
149
+ else
150
+ all_children << { depth: depth, child: parent } unless parent == self
151
+ end
129
152
 
130
- def spacing_found(parent_width, child_width, nb_of_children)
153
+ end
154
+
155
+ fetch_children_recursively.call(self, 0)
156
+
157
+ sorted_children = if closest_first != :inverted
158
+ all_children.sort_by { |entry| entry[:depth] }
159
+ else
160
+ all_children.sort_by { |entry| -entry[:depth] }
161
+ end
162
+
163
+ sorted_children.each do |entry|
164
+ block.call(entry[:child])
165
+ end
166
+ end
167
+
168
+ def found_spacing_in_percent(parent_width, child_width, nb_of_children)
131
169
  total_child_width = child_width * nb_of_children
132
170
  remaining_width = parent_width - total_child_width
133
171
  spacing = remaining_width.to_f / (nb_of_children + 1)
@@ -171,14 +209,16 @@ class Atome
171
209
  end
172
210
 
173
211
  def blocks(params)
212
+ # alert 'blocks case'
213
+
174
214
  blocks = params.delete(:blocks)
175
215
  distribute = params.delete(:distribute)
176
216
  if distribute && params[:direction] == :horizontal
177
217
  width_found = to_px(:width)
178
- params[:spacing] = "#{spacing_found(width_found, params[:width], blocks.length)}%"
218
+ params[:spacing] = "#{found_spacing_in_percent(width_found, params[:width], blocks.length)}%"
179
219
  elsif distribute
180
220
  height_found = to_px(:height)
181
- params[:spacing] = spacing_found(height_found, params[:height], blocks.length)
221
+ params[:spacing] = found_spacing_in_percent(height_found, params[:height], blocks.length)
182
222
  end
183
223
  blocks.each do |bloc_id, block_to_create|
184
224
  sanitized_bloc_data = params.merge(block_to_create)
@@ -186,7 +226,6 @@ class Atome
186
226
  end
187
227
  end
188
228
 
189
-
190
229
  def sub_block(sub_params, spacing_found = 3)
191
230
  num_blocks = sub_params.size
192
231
  parent_width = to_px(:width)
@@ -202,13 +241,11 @@ class Atome
202
241
  sub_created.set(sub_content)
203
242
  sub_created.width(block_width)
204
243
  left_offset += block_width + spacing_found
205
- sub_created.width(sub_created.to_percent(:width))
206
- sub_created.left(sub_created.to_percent(:left))
244
+ sub_created.width(sub_created.to_percent(:width))
245
+ sub_created.left(sub_created.to_percent(:left))
207
246
  end
208
247
  end
209
248
 
210
-
211
-
212
249
  def help(particle, &doc)
213
250
  if doc
214
251
  Universe.set_help(particle, &doc)
@@ -408,7 +445,7 @@ class Atome
408
445
  # This method is used to automatically create a callback method suffixed by '_callback'. For example: shell => shell_callback.
409
446
  # it can be override if you create a method like:
410
447
  # new({callback: :shell}) do |params, bloc|
411
- # # write what you want …
448
+ # # write what you want …
412
449
  # end
413
450
  def particle_callback(element)
414
451
  Atome.define_method("#{element}_callback") do |return_params|
@@ -433,6 +470,21 @@ class Atome
433
470
  end
434
471
  end
435
472
 
473
+ def store_ruby_callback(params)
474
+
475
+ params.each do |element, value_v|
476
+ send("#{element}_code")[element].call(value_v)
477
+ end
478
+ end
479
+
480
+ def read_ruby_callback(element)
481
+ puts "dunno what this method is about ?? method call :#{element}"
482
+ # alert id
483
+ # puts "2 ===> #{element} !!!"
484
+ # alert send("terminal_callback").inspect
485
+ # alert send("#{element}_callback")
486
+ end
487
+
436
488
  # this method generate the method accessible for end developers
437
489
  # it's the send the method define in "particle_callback"
438
490
  def callback(element, return_params = nil)
@@ -475,31 +527,62 @@ class Atome
475
527
  hash
476
528
  end
477
529
 
478
- def refresh
479
- # we get the current color because they will be removed
480
- particles_found = particles_to_hash
481
- particles_found.each do |particle_found, value_found|
482
- puts "refresh : #{particle_found}, #{value_found}"
483
- send(particle_found, value_found)
484
- end
485
- Universe.applicable_atomes.each do |atome_type|
486
- send(atome_type).each do |col|
487
- apply(col)
530
+ # def refresh
531
+ #
532
+ # # we get the current color because they will be removed
533
+ # particles_found = particles_to_hash.dup
534
+ # # id_found=id
535
+ # data_found=particles_found.delete(:data)
536
+ # attach_found=particles_found.delete(:attach)
537
+ # apply_found=particles_found.delete(:apply)
538
+ # particles_found.each do |particle_found, value_found|
539
+ # send(particle_found, value_found)
540
+ # end
541
+ # # Universe.applicable_atomes.each do |atome_type|
542
+ # #
543
+ # # send(atome_type).each do |col|
544
+ # # apply(col)
545
+ # # end
546
+ # # end
547
+ # # alert id_found
548
+ # # grab(attach_found).fasten(id_found)
549
+ # data(data_found)
550
+ #
551
+ # apply_found.delete(:text_color) #TODO : patch here : the array is not correctly ordered so default color are apply over the next
552
+ # apply_found.delete(:box_color) ##TODO : patch here : the array is not correctly ordered so default color are apply over the next
553
+ # apply(apply_found)
554
+ # # attach(attach_found)
555
+ # end
556
+
557
+ def refresh_atome
558
+ id_found = id.dup
559
+ id(:temporary)
560
+ fasten_atomes = []
561
+ fasten_found = fasten.dup
562
+ fasten_found.each do |child_id_found|
563
+ child_found = grab(child_id_found)
564
+ if child_found
565
+ new_child = child_found.duplicate({})
566
+ fasten_atomes << new_child.id
488
567
  end
489
568
  end
490
- end
491
569
 
492
- def each(&proc)
493
- collect.each do |val|
494
- instance_exec(val, &proc) if proc.is_a?(Proc)
495
- end
570
+ infos_found = infos.dup
571
+ data_found = infos_found.delete(:data)
572
+ keys_to_delete = %i[history callback duplicate copy paste touch_code html fasten aid]
573
+ keys_to_delete.each { |key| infos_found.delete(key) }
574
+ new_atome_id = id_found
575
+ infos_found[:id] = new_atome_id
576
+ new_atome = Atome.new(infos_found)
577
+ @duplicate ||= {}
578
+ @duplicate[new_atome_id] = new_atome
579
+ new_atome.data(data_found) # needed because if atome type is a text we need add type at the end
580
+ new_atome
496
581
  end
497
582
 
498
- def each_with_index(&proc)
499
- index = 0
500
- collect.each do |val|
501
- instance_exec(val, index, &proc) if proc.is_a?(Proc)
502
- index += 1
583
+ def refresh(&bloc)
584
+ retrieve({ self: true }) do |child|
585
+ child.refresh_atome
503
586
  end
504
587
  end
505
588
 
@@ -548,9 +631,7 @@ class Atome
548
631
  category(:atome)
549
632
  attach(grand_parent)
550
633
  # we delete the parent (the layout) if it no more children fasten
551
- if parent_found.fasten.length == 0
552
- parent_found.delete(true)
553
- end
634
+ parent_found.delete(true) if parent_found.fasten.length == 0
554
635
  end
555
636
 
556
637
  def server(server_params = nil)
data/lib/atome/version.rb CHANGED
@@ -3,5 +3,5 @@
3
3
  # return atome version
4
4
 
5
5
  class Atome
6
- VERSION = '0.5.7.4.7'
6
+ VERSION = '0.5.7.5.1'
7
7
  end
@@ -91,7 +91,7 @@ class Atome
91
91
  @click_analysis_active = false
92
92
 
93
93
  click_timeout = nil
94
- double_click_delay = 150
94
+ double_click_delay = 222
95
95
 
96
96
  JS.global[:document].addEventListener('click') do |native_event|
97
97
  if @click_analysis
@@ -115,7 +115,7 @@ class Atome
115
115
 
116
116
  else
117
117
  click_timeout = wait(double_click_delay / 1000.0) do
118
- click_timeout = nil
118
+ click_timeout = nil # important do not remove !
119
119
  Atome.instance_exec(native_event, &@click_analysis) if @click_analysis.is_a?(Proc)
120
120
  end
121
121
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  class Atome
4
4
  def reorder_menu
5
+ # disposition = data
5
6
  disposition = data[:inactive][:disposition]
6
7
  margin = data[:inactive][:margin]
7
8
  spacing = data[:inactive][:spacing]
@@ -72,9 +73,9 @@ class Atome
72
73
  menu_item.top = margin[:top] + (inactive_style[:height] + spacing) * position_in_menu
73
74
  menu_item.left = margin[:left]
74
75
  end
75
-
76
76
  menu_item.text.each do |text_f|
77
- grab(text_f).set(inactive_state_text)
77
+ item_found = grab(text_f)
78
+ item_found.set(inactive_state_text)
78
79
  end
79
80
 
80
81
  end
@@ -184,7 +185,7 @@ new(molecule: :input) do |params, bloc|
184
185
  position: :absolute
185
186
  }.merge(text_params)
186
187
  )
187
- text_input.touch(:down) do
188
+ input_back.touch(:down) do
188
189
  input_back.tick(:input)
189
190
  text_input.edit(true)
190
191
  end
@@ -592,10 +593,10 @@ new(molecule: :show) do |page_id, &bloc|
592
593
  color({ id: :page_color, red: 0.1, green: 0.1, blue: 0.1 })
593
594
 
594
595
  id_f = "#{id}_content"
595
- main_page = box({ width: :auto, depth: -1, height: :auto, id: id_f, top: 0, bottom: 0, left: 0, right: 0, apply: :page_color, category: :page })
596
+ main_page = box({ width: :auto, depth: -1, height: :auto, id: id_f, top: 0, bottom: 0, left: 0, right: 0, apply: :page_color, category: :page})
596
597
  main_page.remove(:box_color)
597
598
 
598
- new_page = main_page.box({ width: '100%', height: '100%', top: 0, left: 0, id: page_id })
599
+ new_page = main_page.box({ width: '100%', height: '100%', top: 0, left: 0, id: page_id, overflow: :auto })
599
600
 
600
601
  # now looking for associated blocks
601
602
  blocks_found = params[:blocks]
@@ -664,7 +665,7 @@ new(molecule: :show) do |page_id, &bloc|
664
665
  grab("#{id_f}_header").left(basic_size) if header
665
666
  end
666
667
  end
667
- main_page
668
+ new_page
668
669
  end
669
670
 
670
671
 
@@ -254,6 +254,7 @@ class HTML
254
254
  end
255
255
 
256
256
  def send_message(message)
257
+ # puts "message : #{message}"
257
258
  # FIXME : find why we have to sanitize this message when using ruby wams
258
259
  message = transform_to_string_keys_and_values(message)
259
260
  JS.eval("atomeJS.ws_sender('#{message}')")
@@ -732,7 +733,14 @@ class HTML
732
733
  end
733
734
  end
734
735
 
736
+ def drag_code(params=nil)
737
+ #FIXME : this method is an ugly patch when refreshing an atome twice, else it crash
738
+ # and lose it's drag
739
+ drag_move(params)
740
+ end
741
+
735
742
  def event(action, variance, option = nil)
743
+ # puts " remove 'if option', if unable ti unbind# : #{action} _ #{variance}"
736
744
  send("#{action}_#{variance}", option)
737
745
  end
738
746
 
@@ -1207,11 +1215,11 @@ class HTML
1207
1215
  interact = JS.eval("return interact('##{@id}')")
1208
1216
  # unless @touch_removed[:down]
1209
1217
  interact.on('down') do |native_event|
1210
- event = Native(native_event)
1218
+ @touch_down_event = Native(native_event)
1211
1219
  # we use .call instead of instance_eval because instance_eval bring the current object as context
1212
1220
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
1213
1221
  # group etc..
1214
- proc_content = @touch_down.call(event) if event_validation(@touch_down)
1222
+ proc_content = @touch_down.call(@touch_down_event) if event_validation(@touch_down)
1215
1223
  if proc_content.instance_of? Hash
1216
1224
  proc_content.each do |k, v|
1217
1225
  @original_atome.send(k, v)
@@ -1229,11 +1237,11 @@ class HTML
1229
1237
  # unless @touch_removed[:tap]
1230
1238
  interact.on('tap') do |native_event|
1231
1239
 
1232
- event = Native(native_event)
1240
+ @touch_tap_event = Native(native_event)
1233
1241
  # we use .call instead of instance_eval because instance_eval bring the current object as context
1234
1242
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
1235
1243
  # group etc..
1236
- proc_content = @touch_tap.call(event) if event_validation(@touch_tap)
1244
+ proc_content = @touch_tap.call(@touch_tap_event) if event_validation(@touch_tap)
1237
1245
  if proc_content.instance_of? Hash
1238
1246
  proc_content.each do |k, v|
1239
1247
  # alert "(#{@original_atome.id}, #{k}, #{v}, #{_option})"
@@ -1250,11 +1258,11 @@ class HTML
1250
1258
  @touch_up = @original_atome.instance_variable_get('@touch_code')[:up]
1251
1259
  # unless @touch_removed[:up]
1252
1260
  interact.on('up') do |native_event|
1253
- event = Native(native_event)
1261
+ @touch_up_event = Native(native_event)
1254
1262
  # we use .call instead of instance_eval because instance_eval bring the current object as context
1255
1263
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
1256
1264
  # group etc..
1257
- proc_content = @touch_up.call(event) if event_validation(@touch_up)
1265
+ proc_content = @touch_up.call(@touch_up_event) if event_validation(@touch_up)
1258
1266
  if proc_content.instance_of? Hash
1259
1267
  proc_content.each do |k, v|
1260
1268
  @original_atome.send(k, v)
@@ -1269,11 +1277,11 @@ class HTML
1269
1277
  @touch_double = @original_atome.instance_variable_get('@touch_code')[:double]
1270
1278
  # unless @touch_removed[:double]
1271
1279
  interact.on('doubletap') do |native_event|
1272
- event = Native(native_event)
1280
+ @touch_double_event = Native(native_event)
1273
1281
  # we use .call instead of instance_eval because instance_eval bring the current object as context
1274
1282
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
1275
1283
  # group etc..
1276
- proc_content = @touch_double.call(event) if event_validation(@touch_double)
1284
+ proc_content = @touch_double.call(@touch_double_event) if event_validation(@touch_double)
1277
1285
  if proc_content.instance_of? Hash
1278
1286
  proc_content.each do |k, v|
1279
1287
  @original_atome.send(k, v)
@@ -1289,11 +1297,11 @@ class HTML
1289
1297
  interact = JS.eval("return interact('##{@id}')")
1290
1298
  # unless @touch_removed[:long]
1291
1299
  interact.on('hold') do |native_event|
1292
- event = Native(native_event)
1300
+ @touch_long_event = Native(native_event)
1293
1301
  # we use .call instead of instance_eval because instance_eval bring the current object as context
1294
1302
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
1295
1303
  # group etc..
1296
- proc_content = @touch_long.call(event) if event_validation(@touch_long)
1304
+ proc_content = @touch_long.call(@touch_long_event) if event_validation(@touch_long)
1297
1305
  if proc_content.instance_of? Hash
1298
1306
  proc_content.each do |k, v|
1299
1307
  @original_atome.send(k, v)
@@ -1303,38 +1311,53 @@ class HTML
1303
1311
  end
1304
1312
 
1305
1313
  def touch_remove(option)
1306
-
1307
1314
  @element[:style][:cursor] = 'default'
1308
1315
  case option
1309
1316
  when :double
1310
1317
  @touch_double = ''
1311
1318
  @touch_removed[:double] = true
1319
+ @touch_double_event= nil
1312
1320
  when :down
1313
1321
  @touch_down = ''
1314
1322
  @touch_removed[:down] = true
1323
+ @touch_down_event= nil
1315
1324
  when :long
1316
1325
  @touch_removed[:long] = true
1317
1326
  @touch_long = ''
1327
+ @touch_long_event= nil
1318
1328
  when :tap
1319
1329
  @touch_removed[:tap] = true
1320
1330
  @touch_tap = ''
1321
1331
  @touch_removed[:touch] = true
1322
1332
  @touch_touch = ''
1333
+ @touch_tap_event= nil
1334
+
1323
1335
  when :touch
1324
1336
  @touch_removed[:tap] = true
1325
1337
  @touch_tap = ''
1326
1338
  @touch_removed[:touch] = true
1327
1339
  @touch_touch = ''
1340
+ @touch_tap_event= nil
1341
+
1328
1342
  when :up
1329
1343
  @touch_removed[:up] = true
1330
1344
  @touch_up = ''
1345
+ @touch_up_event= nil
1331
1346
  else
1332
1347
  touch_remove(:double)
1348
+ @touch_double_event= nil
1349
+
1333
1350
  touch_remove(:down)
1351
+ @touch_down_event= nil
1352
+
1334
1353
  touch_remove(:long)
1354
+ @touch_long_event= nil
1355
+
1335
1356
  touch_remove(:tap)
1336
1357
  touch_remove(:touch)
1358
+ @touch_tap_event= nil
1337
1359
  touch_remove(:up)
1360
+ @touch_up_event= nil
1338
1361
  end
1339
1362
 
1340
1363
  end
@@ -1355,7 +1378,7 @@ class HTML
1355
1378
  if Atome.host == 'tauri'
1356
1379
  JS.eval("readFile('#{id}','#{file}')")
1357
1380
  else
1358
- puts ' work in progress'
1381
+ puts 'read file in progress in server mode'
1359
1382
  end
1360
1383
  end
1361
1384
 
@@ -1363,7 +1386,7 @@ class HTML
1363
1386
  if Atome.host == 'tauri'
1364
1387
  JS.eval("browseFile('#{id}','#{file}')")
1365
1388
  else
1366
- puts 'work in progress'
1389
+ puts 'browse file in progress in server mode'
1367
1390
  end
1368
1391
  end
1369
1392
 
@@ -46,11 +46,18 @@ end
46
46
 
47
47
  new({ method: :data, type: :string, specific: :text, renderer: :html }) do |params|
48
48
 
49
- js[:innerHTML] = if int8[language]
50
- int8[language].to_s
51
- else
52
- params.to_s
53
- end
49
+ # js[:innerHTML] = if int8[language]
50
+ # int8[language].to_s
51
+ # else
52
+ # params.to_s
53
+ # end
54
+
55
+ # alert "#{Universe.translation} /// #{params} /// #{Universe.language}"
56
+ if Universe.translation[params]
57
+ params= Universe.translation[params][Universe.language]
58
+ end
59
+ js[:innerHTML] = params.to_s
60
+
54
61
  end
55
62
 
56
63
  new({ method: :data, type: :string, specific: :vector, renderer: :html }) do |value|
@@ -84,6 +84,8 @@
84
84
  # create callback methode when playing
85
85
 
86
86
  # # here is how to animate shape :
87
+ wait 0.2 do
88
+ puts " we wait 0.2 sec else there's a of a problem if we use server wasm "
87
89
 
88
90
  b=box({id: :the_box})
89
91
 
@@ -91,28 +93,30 @@ b=box({id: :the_box})
91
93
  puts "width +#{val}"
92
94
  end
93
95
 
94
- b.animate({ to: 456, particle: :left, duration: 5000}) do |val|
95
- puts "left +#{val}"
96
- end
96
+ b.animate({ to: 456, particle: :left, duration: 5000}) do |val|
97
+ puts "left +#{val}"
98
+ end
97
99
 
98
- b.animate({ end: :left}) do |val|
99
- puts "left ended"
100
- end
100
+ b.animate({ end: :left}) do |val|
101
+ puts "left ended"
102
+ end
101
103
 
102
- b.animate({ to: 69, particle: :smooth, duration: 10000}) do |val|
103
- puts "smooth +#{val}"
104
- end
104
+ b.animate({ to: 69, particle: :smooth, duration: 10000}) do |val|
105
+ puts "smooth +#{val}"
106
+ end
105
107
 
106
- b.animate({ end: :smooth}) do |val|
107
- puts " cool smooth end now!!!"
108
- end
108
+ b.animate({ end: :smooth}) do |val|
109
+ puts " cool smooth end now!!!"
110
+ end
109
111
 
110
- b.animate({ to: 90, particle: :rotate, duration: 10000}) do |val|
111
- puts "rotate +#{val}"
112
- end
112
+ b.animate({ to: 90, particle: :rotate, duration: 10000}) do |val|
113
+ puts "rotate +#{val}"
114
+ end
115
+
116
+ b.animate({ to: 222, particle: :top, duration: 10000}) do |val|
117
+ puts "top +#{val}"
118
+ end
113
119
 
114
- b.animate({ to: 222, particle: :top, duration: 10000}) do |val|
115
- puts "top +#{val}"
116
120
  end
117
121
 
118
122
 
@@ -41,9 +41,9 @@ page0 = { id: :page0,
41
41
 
42
42
  a.page(page0)
43
43
  a.page(page1)
44
- a.page(page2)
45
44
  a.page({ id: :page3,
46
45
  color: :red,
46
+ footer: { color: :green, height: 22 }
47
47
  })
48
48
 
49
49
 
@@ -66,11 +66,19 @@ wait 1 do
66
66
  a.extract({page3: :block1})
67
67
  end
68
68
 
69
- a.show(:page3)
69
+ page_3=a.show(:page3)
70
+
71
+ wait 1 do
72
+ page_3.color(:cyan)
73
+ page_3.box({top: 900})
74
+ end
75
+
76
+
70
77
  # how access blocks
71
78
  # wait 3 do
72
79
  # grab(:block2).color(:black)
73
80
  # end
74
81
 
75
82
 
76
- alert(grab(:project).inspect)
83
+ puts(grab(:project).inspect)
84
+
@@ -3,46 +3,41 @@
3
3
  box({color: :gray, width: 666, height: 666})
4
4
  box({ id: :the_box, drag: true, color: { alpha: 2 } })
5
5
 
6
- menu1_code = lambda do
7
- puts :menu1_code
8
- end
9
- menu2_code = lambda do
10
- puts :menu2
11
- end
12
-
13
- but = buttons({
14
- id: :menu1,
15
- attach: :the_box,
16
- inactive: { text: { color: :gray }, width: 66, height: 12, spacing: 3, disposition: :horizontal,
17
- color: :orange, margin: { left: 33, top: 12 } },
18
- active: { text: { color: :white, shadow: {} }, color: :blue, shadow: {} },
19
- item_1: {
20
- text: :acceuil,
21
- code: menu1_code
22
- },
23
- item_2: {
24
- text: :page_2,
25
- code: menu2_code
26
-
27
- },
28
- item_3: {
29
- text: :page_3,
30
- code: lambda { puts :item_3_touched }
31
- },
32
- })
33
-
34
- c = text({ top: 99, left: 99, data: 'add a button' })
6
+
7
+ but =buttons({
8
+ id: "my_menu",
9
+ depth: 9999,
10
+ attach: :the_box,
11
+ inactive: { text: { color: :gray }, width: 66, height: 12, spacing: 3, disposition: :horizontal,
12
+ color: :orange, margin: { left: 33, top: 12 } },
13
+ active: { text: { color: :white, shadow: {} }, color: :blue, shadow: {} },
14
+ })
15
+
16
+ c = text({ top: 99, left: 99, data: 'add buttons' })
35
17
 
36
18
  c.touch(:down) do
37
19
  but.add_button(new_button: {
38
20
  text: :button1,
39
21
  code: lambda { puts :button1_touched }
40
22
  })
41
- end
23
+ but.add_button(new_button2: {
24
+ text: :button2,
25
+ code: lambda { puts :button1_touched }
26
+ })
27
+ but.add_button(new_button3: {
28
+ text: :button3,
29
+ code: lambda { puts :button1_touched }
30
+ })
31
+
32
+ wait 0.2 do
33
+ grab(:my_menu).remove_menu_item(:new_button2)
34
+ end
35
+
36
+ end
37
+
38
+
39
+
42
40
 
43
41
 
44
- wait 2 do
45
- grab(:menu1).remove_menu_item(:item_2)
46
- end
47
42
 
48
43
  # TODO: remove menu_item ,reset_menu, reorder, delete
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ wait 1 do
4
+ flash(:msg)
5
+ end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  t = text({ left: 33, top: 33, data: 'data collected', id: :infos })
3
- b=box({drag: true, id: :titi})
3
+ b=box({drag: true, id: :the_b})
4
+ # Important to trigger on 'return' add the parameter : {trigger: :return}
4
5
  inp=b.input({ width: 166,
5
6
  trigger: :up,
6
7
  back: :orange,
@@ -11,7 +12,6 @@ inp=b.input({ width: 166,
11
12
  red: 0, green: 0, blue: 0, alpha: 0.9
12
13
  },
13
14
  component: {size: 8},
14
- # attach: :intuition,
15
15
  text: { color: :black , top: 5, left: 6},
16
16
  smooth: 3,
17
17
  left: 66,
@@ -33,4 +33,9 @@ inp.top(12)
33
33
  end
34
34
 
35
35
 
36
+ c=circle({top: 99})
37
+ c.touch(true) do
38
+ alert b.fasten
39
+ end
40
+
36
41
 
@@ -1,17 +1,36 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- t = text({ int8: { english: :hello, french: :salut, deutch: :halo } })
4
-
5
- wait 1 do
6
- t.language(:french)
7
- wait 1 do
8
- t.language(:english)
9
- # data is updated to the latest choice
10
- puts t.data
11
- end
12
- end
3
+ # t = text({ int8: { english: :hello, french: :salut, deutch: :halo } })
4
+
5
+ # wait 1 do
6
+ # t.language(:french)
7
+ # wait 1 do
8
+ # t.language(:english)
9
+ # # data is updated to the latest choice
10
+ # puts t.data
11
+ # wait 1 do
12
+ # t.data(:hi)
13
+ # end
14
+ # end
15
+ # end
16
+
17
+ Universe.translation[:hello] = { english: :hello, french: :salut, deutch: :halo }
13
18
 
14
- puts t.data
19
+ b = box({ left: 155,
20
+ drag: true,
21
+ id: :boxy })
15
22
 
16
23
 
24
+ b.text({ data: :hello, id: :t1, position: :absolute, color: :black })
25
+ t2 = b.text({ data: :hello, id: :t2, left: 9, top: 33, position: :absolute })
17
26
 
27
+
28
+
29
+ Universe.language = :french
30
+ wait 2 do
31
+ t2.refresh
32
+ Universe.language = :deutch
33
+ wait 2 do
34
+ grab(:boxy).refresh
35
+ end
36
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ b = box({ left: 155, drag: true, id: :boxy })
4
+
5
+ t=b.text({ data: :hello, id: :t1, position: :absolute, color: :black })
6
+ t2 = b.text({ data: :hello, id: :t2, left: 9, top: 33, position: :absolute })
7
+
8
+
9
+ wait 1 do
10
+ grab(:view).retrieve do |child|
11
+ child.left(33)
12
+ end
13
+ wait 1 do
14
+ grab(:boxy).retrieve do |child|
15
+ child.color(:green)
16
+ end
17
+ wait 1 do
18
+ grab(:view).retrieve({ ascending: false, self: false }) do |child|
19
+ child.delete(true)
20
+ end
21
+ end
22
+ end
23
+ end
24
+
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+
4
+
5
+ def format_time
6
+ time = Time.now
7
+ {
8
+ year: time.year,
9
+ month: time.month,
10
+ day: time.day,
11
+ hour: time.hour,
12
+ minute: time.min,
13
+ second: time.sec
14
+ }
15
+ end
16
+
17
+ # Exemple d'utilisation
18
+
19
+ t=text({data: "message here", id: :messenger})
20
+
21
+ schedule_task('every_minute_task', format_time[:year], format_time[:month], format_time[:day], format_time[:hour], format_time[:minute], format_time[:second]+5, recurrence: :minutely) do
22
+ t.data("every minute i change from :#{format_time}, now : #{format_time[:minute]} , #{format_time[:second]}")
23
+ end
@@ -20,5 +20,6 @@ c.touch(true) do
20
20
  A.message({ action: :terminal , data: 'cd ..;cd server;ls; pwd'}) do |result|
21
21
  puts "result : #{result}"
22
22
  end
23
+ {} #must add an empty hash else events events method will interpret keys of the hash and send a missing method errors
23
24
  end
24
25
  #
@@ -1,4 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  A.terminal('pwd') do |data|
3
3
  text "terminal response :\n #{data}"
4
- end
4
+ end
5
+
6
+ # alert A.inspect
@@ -1 +1,16 @@
1
1
  # frozen_string_literal: true
2
+
3
+
4
+ def contact_template
5
+ { id: :humans, role: nil, date: { companies: [], project: {}, events: {}, last_name: nil, first_name: nil ,
6
+ emails: { home: nil }, phones: {}, address: {}, groups: [] } }
7
+ end
8
+
9
+
10
+ element({id: :testing, data: contact_template})
11
+ # grab(:testing).data(contact_template)
12
+
13
+
14
+ wait 2 do
15
+ grab(:testing).data
16
+ end
@@ -8,17 +8,17 @@ t.touch(:down) do |event|
8
8
  puts :down
9
9
  puts event[:pageX]
10
10
  puts event[:pageY]
11
- b.touch({remove: :down})
11
+ b.touch({ remove: :down })
12
12
  # b.touch({remove: :up})
13
13
  # b.touch({remove: :long})
14
14
  # b.touch({remove: :double})
15
15
  # b.touch({remove: :tap})
16
16
  # b.touch({remove: :touch})
17
- # b.touch(:remove) # or b.touch(false) to remove all touches bindings
17
+ # b.touch(false) to remove all touches bindings
18
18
  t.data('touch down killed')
19
19
  end
20
20
 
21
- touch_code =lambda do
21
+ touch_code = lambda do
22
22
  b.color(:red)
23
23
  puts 'box tapped'
24
24
  # b.instance_variable_set('@touch_code', nil)
@@ -29,7 +29,7 @@ b.touch(:long) do
29
29
  # puts :long
30
30
  # t.data('type of touch is : long ')
31
31
  # b.color(:black)
32
- {color: :cyan}
32
+ { color: :cyan }
33
33
  end
34
34
 
35
35
  b.touch(:up) do
@@ -21,7 +21,6 @@ require './database'
21
21
  require './extensions'
22
22
 
23
23
  Faye::WebSocket.load_adapter('puma')
24
-
25
24
  class App < Roda
26
25
  index_content = File.read("../src/index_server_wasm.html")
27
26
  opts[:root] = '../src'
@@ -30,6 +30,7 @@ class EDen
30
30
  end
31
31
 
32
32
  def terminal(data, message_id, ws)
33
+ puts "terminal message test : #{data}"
33
34
  { data: { message: `#{data}` }, message_id: message_id }
34
35
  end
35
36
 
@@ -3,7 +3,8 @@
3
3
  <head>
4
4
  <link rel="icon" type="image/x-icon"
5
5
  href="https://github.com/atomecorp/atome/blob/master/vendor/assets/src/favicon.ico">
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, viewport-fit=cover,user-scalable=no">
6
+ <meta name="viewport"
7
+ content="width=device-width, initial-scale=1.0, maximum-scale=1.0, viewport-fit=cover,user-scalable=no">
7
8
  <meta charset='UTF-8'/>
8
9
  <meta name="format-detection" content="telephone=no">
9
10
  <meta name="msapplication-tap-highlight" content="no">
@@ -30,6 +31,7 @@
30
31
  <div id='copyright'>©atome 2024</div>
31
32
  </body>
32
33
  <script type="text/ruby">
34
+
33
35
  require 'js'
34
36
  require '/lib/platform_specific/wasm/atome_wasm_extensions'
35
37
  require '/utilities/aui'
@@ -38,6 +40,8 @@
38
40
  require './index'
39
41
  #atome_infos
40
42
  atome_genesis
43
+
44
+
41
45
  </script>
42
46
  <script defer src="js/atome/specific/wasm.js" type="text/javascript"></script>
43
47
  <script type="text/javascript">
@@ -28,8 +28,8 @@ async function readFile(atome_id, filePath) {
28
28
  } catch (error) {
29
29
  fileContent = error;
30
30
  }
31
- atomeJsToRuby("grab(:" + atome_id + ").callback({ read: '" + fileContent + "' })");
32
- atomeJsToRuby("grab(:" + atome_id + ").call(:read)");
31
+ atomeJsToRuby("grab(:" + atome_id + ").store_ruby_callback({ read: '" + fileContent + "' })");
32
+ atomeJsToRuby("grab(:" + atome_id + ").read_ruby_callback(:read)");
33
33
  }
34
34
 
35
35
 
@@ -43,8 +43,8 @@ async function browseFile(atome_id, directoryPath) {
43
43
  } catch (error) {
44
44
  directoryContent = error;
45
45
  }
46
- atomeJsToRuby("grab(:" + atome_id + ").callback({ browse: '" + directoryContent + "' })");
47
- atomeJsToRuby("grab(:" + atome_id + ").call(:browse)");
46
+ atomeJsToRuby("grab(:" + atome_id + ").store_ruby_callback({ browse: '" + directoryContent + "' })");
47
+ atomeJsToRuby("grab(:" + atome_id + ").read_ruby_callback(:browse)");
48
48
  }
49
49
 
50
50
 
@@ -75,18 +75,22 @@ async function terminal(atome_id, cmd) {
75
75
  }
76
76
  cmd_result = cmd_result.replace(/\r?\n/g, "");
77
77
 
78
- atomeJsToRuby("grab(:" + atome_id + ").callback({ terminal: '" + cmd_result + "' })");
79
- atomeJsToRuby("grab(:" + atome_id + ").call(:terminal)");
78
+ atomeJsToRuby("grab(:" + atome_id + ").store_ruby_callback({ terminal: '" + cmd_result + "' })");
79
+ atomeJsToRuby("grab(:" + atome_id + ").read_ruby_callback(:terminal)");
80
80
 
81
81
  }
82
82
 
83
83
 
84
84
  function distant_terminal(id, cmd) {
85
+
85
86
  let myd_data_test = 'Terminal particle will soon be implemented when using a non native mode\nYou can switch to OSX to test';
86
- let call_back_to_send = `grab(:${id}).callback({terminal: "${myd_data_test}"})`
87
- let call = `grab(:${id}).call(:terminal)`
87
+ let call_back_to_send = `grab(:${id}).store_ruby_callback({terminal: "${myd_data_test}"})`
88
+ let call = `grab(:${id}).read_ruby_callback(:terminal)`
88
89
  atomeJsToRuby(call_back_to_send)
89
90
  atomeJsToRuby(call)
91
+
92
+ // let call = `grab(:${id}).read_ruby_callback(:terminal)`
93
+ // atomeJsToRuby(call)
90
94
  }
91
95
 
92
96
 
@@ -3,7 +3,8 @@ function atomeJsToRuby(rubycode) {
3
3
  }
4
4
 
5
5
  function controller_message(msg) {
6
- rubyVM.eval(rubycode);
6
+ /// use for communication with server
7
+ rubyVM.eval(msg);
7
8
  }
8
9
 
9
10
  // document.addEventListener("DOMContentLoaded", function() {
@@ -119,7 +120,6 @@ const communication = {
119
120
  ws_sender: function (message) {
120
121
  // now we send the data to the server
121
122
  // puts "--> message : #{message}"
122
-
123
123
  this.websocket.send(message)
124
124
  },
125
125
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atome
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.7.4.7
4
+ version: 0.5.7.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean-Eric Godard
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-02 00:00:00.000000000 Z
11
+ date: 2024-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eventmachine
@@ -584,6 +584,7 @@ files:
584
584
  - vendor/assets/application/examples/fill.rb
585
585
  - vendor/assets/application/examples/find.rb
586
586
  - vendor/assets/application/examples/fit.rb
587
+ - vendor/assets/application/examples/flash.rb
587
588
  - vendor/assets/application/examples/fonts.rb
588
589
  - vendor/assets/application/examples/generator_and_build.rb
589
590
  - vendor/assets/application/examples/getter.rb
@@ -631,8 +632,10 @@ files:
631
632
  - vendor/assets/application/examples/remove.rb
632
633
  - vendor/assets/application/examples/repeat.rb
633
634
  - vendor/assets/application/examples/resize.rb
635
+ - vendor/assets/application/examples/retreive.rb
634
636
  - vendor/assets/application/examples/rotate.rb
635
637
  - vendor/assets/application/examples/run.rb
638
+ - vendor/assets/application/examples/schedule.rb
636
639
  - vendor/assets/application/examples/scheduler.rb
637
640
  - vendor/assets/application/examples/security.rb
638
641
  - vendor/assets/application/examples/select_text.rb
@@ -910,7 +913,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
910
913
  - !ruby/object:Gem::Version
911
914
  version: '0'
912
915
  requirements: []
913
- rubygems_version: 3.5.10
916
+ rubygems_version: 3.5.15
914
917
  signing_key:
915
918
  specification_version: 4
916
919
  summary: the creative framework