atome 0.5.6.8.6 → 0.5.7.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/documentation/basic.md +7 -8
  3. data/documentation/deep learning/basic_infos.txt +6 -6
  4. data/documentation/installation/atome_server.md +66 -1
  5. data/documentation/installation/buiding_atome.md +307 -0
  6. data/lib/atome/atome.rb +2 -3
  7. data/lib/atome/extensions/atome.rb +38 -12
  8. data/lib/atome/genesis/atomes.rb +1 -1
  9. data/lib/atome/genesis/genesis.rb +11 -11
  10. data/lib/atome/genesis/particles/event.rb +58 -50
  11. data/lib/atome/genesis/particles/identity.rb +3 -0
  12. data/lib/atome/genesis/particles/property.rb +2 -1
  13. data/lib/atome/genesis/particles/utility.rb +18 -11
  14. data/lib/atome/genesis/presets.rb +10 -0
  15. data/lib/atome/genesis/sparkle.rb +11 -9
  16. data/lib/atome/kernel/universe.rb +22 -11
  17. data/lib/atome/presets/atome.rb +20 -17
  18. data/lib/atome/utilities/essentials.rb +5 -5
  19. data/lib/atome/utilities/utilities.rb +168 -15
  20. data/lib/atome/version.rb +1 -1
  21. data/lib/atome.rb +1 -0
  22. data/lib/atome_relative.rb +1 -0
  23. data/lib/molecules/init.rb +22 -42
  24. data/lib/molecules/intuition/_deprecated_inputs.rb +111 -0
  25. data/lib/molecules/intuition/utillities.rb +116 -29
  26. data/lib/renderers/html/event.rb +20 -4
  27. data/lib/renderers/html/html.rb +145 -161
  28. data/lib/renderers/html/identity.rb +10 -2
  29. data/lib/renderers/html/utility.rb +64 -8
  30. data/vendor/assets/application/examples/b64_to_image.rb +9 -0
  31. data/vendor/assets/application/examples/drag.rb +9 -2
  32. data/vendor/assets/application/examples/matrix.rb +77 -114
  33. data/vendor/assets/application/examples/recorder.rb +74 -0
  34. data/vendor/assets/application/examples/site.rb +41 -0
  35. data/vendor/assets/application/examples/sub_atome_manipulation.rb +0 -2
  36. data/vendor/assets/application/examples/svg_img_to_vector.rb +6 -0
  37. data/vendor/assets/application/examples/svg_vectorizer.rb +21 -0
  38. data/vendor/assets/application/examples/table.rb +1 -1
  39. data/vendor/assets/application/examples/test.rb +572 -0
  40. data/vendor/assets/application/examples/tools.rb +650 -304
  41. data/vendor/assets/application/examples/vector.rb +16 -3
  42. data/vendor/assets/server/atome_server.rb +3 -2
  43. data/vendor/assets/server/atome_server_wasm.rb +2 -2
  44. data/vendor/assets/server/eDen.rb +135 -14
  45. data/vendor/assets/src/index.html +1 -1
  46. data/vendor/assets/src/index_opal.html +1 -1
  47. data/vendor/assets/src/index_server.html +1 -1
  48. data/vendor/assets/src/index_server_wasm.html +1 -1
  49. data/vendor/assets/src/index_wasm.html +1 -1
  50. data/vendor/assets/src/js/atome/atome.js +250 -49
  51. data/vendor/assets/src/js/atome/atome_helpers/communication.js +4 -4
  52. data/vendor/assets/src/js/atome/specific/opal.js +19 -3
  53. data/vendor/assets/src/js/atome/specific/wasm.js +18 -3
  54. data/vendor/assets/src/js/molecules/web.js +1 -1
  55. data/vendor/assets/src/medias/images/icons/Lowpass.svg +8 -0
  56. data/vendor/assets/src/medias/images/icons/activate.svg +3 -0
  57. data/vendor/assets/src/medias/images/icons/audio.svg +7 -0
  58. data/vendor/assets/src/medias/images/icons/band_pass.svg +8 -0
  59. data/vendor/assets/src/medias/images/icons/clear.svg +5 -0
  60. data/vendor/assets/src/medias/images/icons/color.svg +5 -0
  61. data/vendor/assets/src/medias/images/icons/copy.svg +8 -0
  62. data/vendor/assets/src/medias/images/icons/create.svg +3 -0
  63. data/vendor/assets/src/medias/images/icons/delete.svg +8 -0
  64. data/vendor/assets/src/medias/images/icons/edit-.svg +4 -0
  65. data/vendor/assets/src/medias/images/icons/edit.svg +4 -0
  66. data/vendor/assets/src/medias/images/icons/edition.svg +4 -0
  67. data/vendor/assets/src/medias/images/icons/equalizer-.svg +5 -0
  68. data/vendor/assets/src/medias/images/icons/equalizer.svg +5 -0
  69. data/vendor/assets/src/medias/images/icons/filter.svg +4 -0
  70. data/vendor/assets/src/medias/images/icons/folder.svg +4 -0
  71. data/vendor/assets/src/medias/images/icons/group.svg +6 -0
  72. data/vendor/assets/src/medias/images/icons/hamburger.svg +8 -0
  73. data/vendor/assets/src/medias/images/icons/high_pass.svg +5 -0
  74. data/vendor/assets/src/medias/images/icons/link.svg +4 -0
  75. data/vendor/assets/src/medias/images/icons/load.svg +4 -0
  76. data/vendor/assets/src/medias/images/icons/low_pass.svg +5 -0
  77. data/vendor/assets/src/medias/images/icons/microphone.svg +7 -0
  78. data/vendor/assets/src/medias/images/icons/midi_in.svg +4 -0
  79. data/vendor/assets/src/medias/images/icons/midi_out.svg +4 -0
  80. data/vendor/assets/src/medias/images/icons/modules.svg +11 -0
  81. data/vendor/assets/src/medias/images/icons/paste.svg +4 -0
  82. data/vendor/assets/src/medias/images/icons/pause.svg +5 -0
  83. data/vendor/assets/src/medias/images/icons/play.svg +7 -0
  84. data/vendor/assets/src/medias/images/icons/record.svg +4 -0
  85. data/vendor/assets/src/medias/images/icons/save.svg +5 -0
  86. data/vendor/assets/src/medias/images/icons/select--.svg +4 -0
  87. data/vendor/assets/src/medias/images/icons/select-.svg +5 -0
  88. data/vendor/assets/src/medias/images/icons/select-all.svg +4 -0
  89. data/vendor/assets/src/medias/images/icons/select.svg +4 -0
  90. data/vendor/assets/src/medias/images/icons/settings.svg +5 -0
  91. data/vendor/assets/src/medias/images/icons/settings0.svg +2 -0
  92. data/vendor/assets/src/medias/images/icons/settings1.svg +17 -0
  93. data/vendor/assets/src/medias/images/icons/settings2.svg +25 -0
  94. data/vendor/assets/src/medias/images/icons/settings_old.svg +6 -0
  95. data/vendor/assets/src/medias/images/icons/shape.svg +7 -0
  96. data/vendor/assets/src/medias/images/icons/speaker.svg +6 -0
  97. data/vendor/assets/src/medias/images/icons/stop.svg +4 -0
  98. data/vendor/assets/src/medias/images/icons/tool.svg +7 -0
  99. data/vendor/assets/src/medias/images/icons/tools.svg +9 -0
  100. data/vendor/assets/src/medias/images/icons/undo2.svg +4 -0
  101. data/vendor/assets/src/medias/images/icons/validate.svg +9 -0
  102. data/vendor/assets/src/medias/images/icons/vie.svg +3 -0
  103. data/vendor/assets/src/medias/images/icons/wave-saw.svg +3 -0
  104. data/vendor/assets/src/medias/images/icons/wave-sine.svg +3 -0
  105. data/vendor/assets/src/medias/images/icons/wave-square-.svg +4 -0
  106. data/vendor/assets/src/medias/images/icons/wave-square.svg +3 -0
  107. data/vendor/assets/src/medias/images/icons/wave-triangle.svg +3 -0
  108. data/vendor/assets/src/medias/images/icons/waveform-.svg +4 -0
  109. data/vendor/assets/src/medias/images/icons/waveform.svg +7 -0
  110. metadata +68 -6
  111. data/lib/molecules/intuition/inputs.rb +0 -111
  112. /data/lib/molecules/{examples → _deprecated_examples}/site.rb +0 -0
  113. /data/lib/molecules/intuition/{toolbox.rb → _deprecated_toolbox.rb} +0 -0
@@ -23,7 +23,7 @@ new(molecule: :input) do |params, bloc|
23
23
  attach_to = params[:attach] || default_parent
24
24
  renderer_found = grab(attach_to).renderers
25
25
  input_back = Atome.new(
26
- { renderers: renderer_found,id: new_id, type: :shape, color: back_col,
26
+ { renderers: renderer_found, id: new_id, type: :shape, color: back_col,
27
27
  left: 0, top: 0, data: '', attach: attach_to,
28
28
  smooth: 6, overflow: :hidden,
29
29
  })
@@ -41,12 +41,11 @@ new(molecule: :input) do |params, bloc|
41
41
  end
42
42
 
43
43
  input_back.touch(:up) do
44
- if input_back.tick[:input] == 1
44
+ if input_back.tick[:input] == 1
45
45
  text_input.component({ selected: true })
46
46
  end
47
47
  end
48
48
 
49
-
50
49
  text_input.keyboard(:down) do |native_event|
51
50
  # text_input.component({ selected: { color: :red, text: :red } })
52
51
 
@@ -118,12 +117,8 @@ new(molecule: :list) do |params, _bloc|
118
117
  end
119
118
  attach_to = params[:attach] || default_parent
120
119
  renderer_found = grab(attach_to).renderers
121
- list = Atome.new({ renderers: renderer_found,id: new_id, type: :shape, color: { alpha: 0 }, attach: attach_to }.merge(params))
122
- # Atome.new(
123
- # { renderers: [:html], type: :shape, attach: :view, color: back_col,
124
- # left: 0, top: 0, data: '', attach: attach_to,
125
- # smooth: 6, overflow: :hidden,
126
- # })
120
+ list = Atome.new({ renderers: renderer_found, id: new_id, type: :shape, color: { alpha: 0 }, attach: attach_to }.merge(params))
121
+
127
122
  # now the listing
128
123
  listing.each_with_index do |data, index|
129
124
  # let's create the container
@@ -147,7 +142,7 @@ new({ molecule: :slider }) do |params, bloc|
147
142
  new_id = params.delete(:id) || identity_generator
148
143
 
149
144
  default_smooth = 9
150
- default_slider_particles = {id: new_id, color: color_found, width: 333, height: 33, left: 0, top: 0, smooth: default_smooth }
145
+ default_slider_particles = { id: new_id, color: color_found, width: 333, height: 33, left: 0, top: 0, smooth: default_smooth }
151
146
  default_cursor_particles = { color: color_found, width: 29, height: 29, left: 0, smooth: '100%' }
152
147
  cursor_found = params.delete(:cursor)
153
148
  slider_particle = default_slider_particles.merge(params)
@@ -186,7 +181,7 @@ new({ molecule: :slider }) do |params, bloc|
186
181
  end
187
182
  cursor_top_initial = ((max_value - new_value).to_f / (max_value - min_value)) * (slider_particle[:height] - cursor_particle[:height])
188
183
  bloc.call(new_value)
189
- slider.instance_variable_set('@value',new_value)
184
+ slider.instance_variable_set('@value', new_value)
190
185
  cursor.top(cursor_top_initial)
191
186
  cursor.left(cursor_left)
192
187
  range.height((slider.height - cursor.top) - cursor.height / 2)
@@ -200,7 +195,7 @@ new({ molecule: :slider }) do |params, bloc|
200
195
  end
201
196
  cursor_left_initial = ((new_value - min_value).to_f / (max_value - min_value)) * (slider_particle[:width] - cursor_particle[:width])
202
197
  bloc.call(new_value)
203
- slider.instance_variable_set('@value',new_value)
198
+ slider.instance_variable_set('@value', new_value)
204
199
  cursor.left(cursor_left_initial)
205
200
  cursor.top(cursor_top)
206
201
  range.width(cursor.left + cursor.width / 2)
@@ -210,11 +205,11 @@ new({ molecule: :slider }) do |params, bloc|
210
205
 
211
206
  update_value = lambda do |cursor_position, cursor_size, slider_size, orientation|
212
207
  effective_slider_size = slider_size - cursor_size
213
- if orientation == :vertical
214
- percentage = 1.0 - (cursor_position.to_f / effective_slider_size)
215
- else
216
- percentage = cursor_position.to_f / effective_slider_size
217
- end
208
+ percentage = if orientation == :vertical
209
+ 1.0 - (cursor_position.to_f / effective_slider_size)
210
+ else
211
+ cursor_position.to_f / effective_slider_size
212
+ end
218
213
  value_range = max_value - min_value
219
214
  calculated_value = min_value + (value_range * percentage).round
220
215
  calculated_value.clamp(min_value, max_value)
@@ -239,7 +234,7 @@ new({ molecule: :slider }) do |params, bloc|
239
234
  value = update_value.call(cursor.top, cursor_particle[:height], slider_particle[:height], orientation)
240
235
  range.height((slider.height - cursor.top) - cursor.height / 2)
241
236
  bloc.call(value)
242
- slider.instance_variable_set('@value',value)
237
+ slider.instance_variable_set('@value', value)
243
238
  end
244
239
 
245
240
  else
@@ -263,7 +258,7 @@ new({ molecule: :slider }) do |params, bloc|
263
258
  value = update_value.call(cursor.left, cursor_particle[:width], slider_particle[:width], orientation)
264
259
  range.width(cursor.left + cursor.width / 2)
265
260
  bloc.call(value)
266
- slider.instance_variable_set('@value',value)
261
+ slider.instance_variable_set('@value', value)
267
262
  end
268
263
  end
269
264
  cursor.touch(:double) do
@@ -282,10 +277,9 @@ end
282
277
  new(molecule: :button) do |params, bloc|
283
278
  params[:height] ||= 25
284
279
  params[:width] ||= 25
285
- states=params.delete(:states) || 1
280
+ states = params.delete(:states) || 1
286
281
  new_id = params.delete(:id) || identity_generator
287
282
 
288
-
289
283
  back_col = params.delete(:back)
290
284
  back_col ||= :grey
291
285
 
@@ -297,25 +291,118 @@ new(molecule: :button) do |params, bloc|
297
291
  attach_to = params[:attach] || default_parent
298
292
  renderer_found = grab(attach_to).renderers
299
293
  button = box(
300
- { renderers: renderer_found,id: new_id, type: :shape, color: back_col,
294
+ { renderers: renderer_found, id: new_id, type: :shape, color: back_col,
301
295
  left: 0, top: 0, data: '', attach: attach_to,
302
296
  smooth: 3, overflow: :hidden,
303
297
  })
304
298
 
305
-
306
-
307
299
  button.touch(:down) do
308
300
  button.tick(:button)
309
- bloc.call(button.tick[:button]%states)
310
- end
311
-
301
+ bloc.call((button.tick[:button] - 1) % states)
312
302
 
303
+ end
313
304
 
314
305
  params.each do |part_f, val_f|
315
306
  button.send(part_f, val_f)
316
307
  end
317
- button.left(55)
318
-
319
308
 
320
309
  button
321
310
  end
311
+
312
+ new(molecule: :matrix) do |params, &bloc|
313
+ id = params[:id]
314
+ rows = params[:rows]
315
+ columns = params[:columns]
316
+ spacing = params[:spacing]
317
+ size = params[:size]
318
+
319
+ parent_found = self
320
+ current_matrix = group({ id: id })
321
+
322
+ current_matrix.data({ spacing: spacing, size: size })
323
+ matrix_cells = []
324
+ total_spacing_x = spacing * (rows + 1)
325
+ total_spacing_y = spacing * (columns + 1)
326
+ size_coefficient = if size.instance_of? String
327
+ size.end_with?('%') ? (size.to_f / 100) : size.to_f / parent_found.to_px(:width)
328
+ else
329
+ size.to_f / parent_found.to_px(:width)
330
+ end
331
+ view_width = parent_found.to_px(:width)
332
+ view_height = parent_found.to_px(:height)
333
+ matrix_back = box({ id: "#{id}_background", width: size, height: size, color: { alpha: 0 } })
334
+
335
+ if view_width > view_height
336
+ full_size=view_height * size_coefficient
337
+ available_width = full_size - total_spacing_x
338
+ available_height = full_size - total_spacing_y
339
+ matrix_back.width(full_size)
340
+ matrix_back.height(full_size)
341
+ else
342
+ full_size=view_width * size_coefficient
343
+ available_width = full_size - total_spacing_x
344
+ available_height = full_size - total_spacing_y
345
+ matrix_back.width(full_size)
346
+ matrix_back.height(full_size)
347
+ end
348
+ box_width = available_width / rows
349
+ box_height = available_height / columns
350
+
351
+ columns.times do |y|
352
+ rows.times do |x|
353
+ id_generated = "#{id}_#{x}_#{y}"
354
+ matrix_cells << id_generated
355
+ new_box = matrix_back.box({ id: id_generated })
356
+ new_box.width(box_width)
357
+ new_box.height(box_height)
358
+ new_box.left((box_width + spacing) * x + spacing)
359
+ new_box.top((box_height + spacing) * y + spacing)
360
+ end
361
+ end
362
+ current_matrix.collect(matrix_cells)
363
+ current_matrix
364
+ # end
365
+ end
366
+ new(molecule: :page) do |params, &bloc|
367
+
368
+ b = box({ color: :red, left: 99, drag: true })
369
+ b.text(params)
370
+ end
371
+
372
+ new(molecule: :application) do |params, &bloc|
373
+
374
+ main_page = box({ drag: true, width: :auto, height: :auto, top: 0, bottom: 0, left: 0, right: 0 })
375
+
376
+ main_page
377
+
378
+ # def new(params, &bloc)
379
+ # if params[:page]
380
+ # site_found = grab(params[:page][:application])
381
+ # site_found.clear(true)
382
+ # page_id = params[:page][:name]
383
+ # site_found.box({ id: page_id })
384
+ # elsif params[:application]
385
+ #
386
+ # footer_header_size = 33
387
+ # footer_header_color = color({ red: 0, green: 0, blue: 0, id: :footer_header_color })
388
+ #
389
+ # if params[:header]
390
+ # top = footer_header_size
391
+ # header = box({ left: 0, right: 0, width: :auto, top: 0, height: top, id: :header })
392
+ # # header.attach(:footer_header_color)
393
+ # else
394
+ # top = 0
395
+ # end
396
+ # if params[:footer]
397
+ # bottom = footer_header_size
398
+ # box({ left: 0, right: 0, width: :auto, top: :auto, bottom: 0, height: bottom, id: :footer })
399
+ # else
400
+ # bottom = 0
401
+ # end
402
+ # box({ left: 0, right: 0, width: :auto, top: top, bottom: bottom, height: :auto, id: params[:application] })
403
+ # elsif params[:module]
404
+ #
405
+ # end
406
+ # super if defined?(super)
407
+ # end
408
+ end
@@ -1,8 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  new({ method: :drag, type: :symbol, renderer: :html }) do |params|
4
- option = @drag[params]
5
- html.event(:drag, params, option)
4
+ # if @drag
5
+ # option = @drag[params]
6
+ # else
7
+ # params = :remove
8
+ # option = true
9
+ # end
10
+ # html.event(:drag, params, option)
11
+
12
+ if params
13
+ option = @drag[params]
14
+ html.event(:drag, params, option)
15
+ else
16
+ html.event(:drag, :remove, true)
17
+ end
6
18
  end
7
19
 
8
20
  new({ method: :drop, type: :symbol, renderer: :html }) do |params|
@@ -11,8 +23,12 @@ new({ method: :drop, type: :symbol, renderer: :html }) do |params|
11
23
  end
12
24
 
13
25
  new({ method: :touch, type: :integer, renderer: :html }) do |params|
14
- option = @touch[params]
15
- html.event(:touch, params, option)
26
+ if params
27
+ option = @touch[params]
28
+ html.event(:touch, params, option)
29
+ else
30
+ html.event(:touch, :remove, true)
31
+ end
16
32
  end
17
33
 
18
34
  new({ method: :over, type: :integer, renderer: :html }) do |params|