atome 0.5.3.8.8 → 0.5.4.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +52 -17
  3. data/app_builder_helpers/Rakefile +20 -3
  4. data/exe/atome +33 -1
  5. data/lib/atome/atome.rb +43 -57
  6. data/lib/atome/extensions/atome.rb +82 -52
  7. data/lib/atome/extensions/mathematic.rb +8 -12
  8. data/lib/atome/extensions/matrix.rb +138 -210
  9. data/lib/atome/genesis/generators/atome.rb +8 -134
  10. data/lib/atome/genesis/generators/communication.rb +0 -1
  11. data/lib/atome/genesis/generators/effect.rb +0 -6
  12. data/lib/atome/genesis/generators/event.rb +64 -77
  13. data/lib/atome/genesis/generators/geometry.rb +0 -18
  14. data/lib/atome/genesis/generators/identity.rb +6 -33
  15. data/lib/atome/genesis/generators/material.rb +3 -54
  16. data/lib/atome/genesis/generators/utility.rb +63 -58
  17. data/lib/atome/genesis/genesis.rb +8 -0
  18. data/lib/atome/genesis/sparkle.rb +35 -16
  19. data/lib/atome/helpers/callbacks.rb +47 -1
  20. data/lib/atome/helpers/essentials.rb +1 -1
  21. data/lib/atome/helpers/sanitizer.rb +0 -10
  22. data/lib/atome/helpers/utilities.rb +74 -28
  23. data/lib/atome/kernel/batch.rb +13 -35
  24. data/lib/atome/kernel/universe.rb +2 -0
  25. data/lib/atome/presets/atome.rb +4 -12
  26. data/lib/atome/renderers/browser/atome.rb +1 -1
  27. data/lib/atome/renderers/browser/browser.rb +2 -0
  28. data/lib/atome/renderers/browser/event.rb +18 -0
  29. data/lib/atome/renderers/browser/helpers/drag_helper.rb +13 -0
  30. data/lib/atome/renderers/browser/helpers/drop_helper.rb +13 -0
  31. data/lib/atome/renderers/browser/helpers/event_helper.rb +16 -11
  32. data/lib/atome/renderers/browser/helpers/over_helper.rb +13 -0
  33. data/lib/atome/renderers/browser/helpers/text_helper.rb +5 -1
  34. data/lib/atome/renderers/browser/spatial.rb +3 -2
  35. data/lib/atome/renderers/browser/utility.rb +7 -7
  36. data/lib/atome/version.rb +2 -2
  37. data/lib/atome.rb +1 -0
  38. data/sig/atome.rbs +16 -0
  39. data/sig/batch.rbs +7 -0
  40. data/sig/browser_helper.rbs +14 -0
  41. data/sig/matrix.rbs +5 -0
  42. data/sig/object.rbs +3 -0
  43. data/vendor/assets/aui.rb +5 -0
  44. data/vendor/assets/src/index.html +15 -3
  45. data/vendor/assets/src/js/atome/atome.js +1 -1
  46. data/vendor/assets/src/js/atome/atome_helpers/atome_animate.js +1 -1
  47. data/vendor/assets/src/js/atome/atome_helpers/atome_communication.js +40 -0
  48. data/vendor/assets/src/js/atome/atome_helpers/atome_drag.js +40 -3
  49. data/vendor/assets/src/js/atome/atome_helpers/atome_drop.js +12 -0
  50. data/vendor/assets/src/js/atome/atome_helpers/atome_events.js +166 -0
  51. data/vendor/assets/src/js/atome/atome_helpers/atome_file.js +6 -1
  52. data/vendor/assets/src/js/atome/atome_helpers/atome_over.js +43 -0
  53. data/vendor/assets/src/medias/rubies/demos.rb +63 -0
  54. data/vendor/assets/src/medias/rubies/examples/add.rb +1 -1
  55. data/vendor/assets/src/medias/rubies/examples/animation.rb +1 -1
  56. data/vendor/assets/src/medias/rubies/examples/atome_new.rb +1 -1
  57. data/vendor/assets/src/medias/rubies/examples/attach.rb +10 -10
  58. data/vendor/assets/src/medias/rubies/examples/attached.rb +2 -3
  59. data/vendor/assets/src/medias/rubies/examples/batch.rb +17 -0
  60. data/vendor/assets/src/medias/rubies/examples/blur.rb +2 -2
  61. data/vendor/assets/src/medias/rubies/examples/box.rb +2 -2
  62. data/vendor/assets/src/medias/rubies/examples/code.rb +1 -1
  63. data/vendor/assets/src/medias/rubies/examples/color.rb +3 -3
  64. data/vendor/assets/src/medias/rubies/examples/delete.rb +17 -1
  65. data/vendor/assets/src/medias/rubies/examples/detached.rb +3 -3
  66. data/vendor/assets/src/medias/rubies/examples/drag.rb +52 -1
  67. data/vendor/assets/src/medias/rubies/examples/drop.rb +26 -0
  68. data/vendor/assets/src/medias/rubies/examples/fullscreen.rb +1 -1
  69. data/vendor/assets/src/medias/rubies/examples/markers.rb +1 -1
  70. data/vendor/assets/src/medias/rubies/examples/matrix.rb +102 -0
  71. data/vendor/assets/src/medias/rubies/examples/matrix_changes.rb +483 -0
  72. data/vendor/assets/src/medias/rubies/examples/matrix_simple.rb +32 -0
  73. data/vendor/assets/src/medias/rubies/examples/monitoring.rb +1 -1
  74. data/vendor/assets/src/medias/rubies/examples/mute.rb +1 -1
  75. data/vendor/assets/src/medias/rubies/examples/on.rb +1 -1
  76. data/vendor/assets/src/medias/rubies/examples/over.rb +6 -4
  77. data/vendor/assets/src/medias/rubies/examples/pause.rb +1 -1
  78. data/vendor/assets/src/medias/rubies/examples/physical.rb +19 -0
  79. data/vendor/assets/src/medias/rubies/examples/play.rb +1 -1
  80. data/vendor/assets/src/medias/rubies/examples/repeat.rb +3 -2
  81. data/vendor/assets/src/medias/rubies/examples/shadow.rb +1 -1
  82. data/vendor/assets/src/medias/rubies/examples/sort.rb +3 -4
  83. data/vendor/assets/src/medias/rubies/examples/tags.rb +10 -0
  84. data/vendor/assets/src/medias/rubies/examples/text.rb +4 -4
  85. data/vendor/assets/src/medias/rubies/examples/time.rb +2 -2
  86. data/vendor/assets/src/medias/rubies/examples/video.rb +2 -2
  87. data/vendor/assets/src/medias/rubies/{examples → unstable}/_2_solve.rb +1 -1
  88. data/vendor/assets/src/medias/rubies/{examples → unstable}/_audio.rb +1 -1
  89. data/vendor/assets/src/medias/rubies/{examples → unstable}/_dataset.rb +4 -4
  90. data/vendor/assets/src/medias/rubies/{examples → unstable}/_table2.rb +2 -2
  91. data/vendor/assets/src/medias/rubies/{examples → unstable}/_vie.rb +2 -2
  92. data/vendor/assets/src/utilities/mode.rb +0 -0
  93. data/vendor/assets/src-tauri/tauri.conf.json +2 -2
  94. metadata +32 -14
  95. data/vendor/assets/src/medias/rubies/examples/table.rb +0 -479
  96. /data/vendor/assets/src/medias/rubies/{examples → unstable}/!run.rb +0 -0
  97. /data/vendor/assets/src/medias/rubies/{examples → unstable}/_attach.rb +0 -0
  98. /data/vendor/assets/src/medias/rubies/{examples → unstable}/_matrix.rb +0 -0
  99. /data/vendor/assets/src/medias/rubies/{examples → unstable}/_os.rb +0 -0
  100. /data/vendor/assets/src/medias/rubies/{examples → unstable}/_test.rb +0 -0
@@ -0,0 +1,483 @@
1
+ # frozen_string_literal: true
2
+
3
+ params = {
4
+
5
+ id: :my_table, left: 0, top: 0, width: 500, height: 399, smooth: 8, color: :yellowgreen,
6
+ columns: { count: 8,
7
+ titles: { 1 => :col1, 3 => :mycol },
8
+ data: { 3 => :col_content },
9
+ actions: { 2 => { touch: :the_action } },
10
+ particles: { color: :blue }
11
+ },
12
+ rows: { count: 6,
13
+ titles: { 1 => :my_first_row, 5 => :other_row },
14
+ data: { 0 => :col_content },
15
+ actions: {},
16
+ particles: { shadows: :black }
17
+ },
18
+ cells: {
19
+ # data: { 0 => :here, 2 => "hello", 4 => :hi, 5 => :good, 7 => :super },
20
+ # actions: { 2 => { touch: :my_lambda } },
21
+ particles: { margin: 9, color: :blue, smooth: 9, shadow: { blur: 9, left: 3, top: 3 } }
22
+ },
23
+ exceptions: {
24
+ columns: {
25
+ # divided: { 2 => 3 },
26
+ fusion: { 1 => [3, 5], 7 => [2, 5] }
27
+ },
28
+ rows: {
29
+ divided: { 1 => 3 },
30
+ fusion: { 2 => [0, 3], 5 => [2, 5] }
31
+ }
32
+ }
33
+ }
34
+ m = matrix(params)
35
+
36
+ found = m.columns(5) do |el|
37
+ el.color(:yellow)
38
+ end
39
+
40
+ m.rows(3) do |el|
41
+ el.color(:orange)
42
+ end
43
+
44
+ m.rows(1) do |el|
45
+ el.color(:lightgray)
46
+ end
47
+
48
+ found.data.each do |el|
49
+ el.color(:red)
50
+ end
51
+
52
+ # found.data[0..2].each do |el|
53
+ # el.color(:cyan)
54
+ # end
55
+ #
56
+ grab(:my_table_21).color(:pink)
57
+ grab(:my_table_26).color(:purple)
58
+ # m.cells([20, 5]).rotate(15)
59
+ # m.cell(9).color(:black)
60
+ # test = m.cells([23, 26])
61
+ # test.color(:blue)
62
+ # m.columns(6).data[0..3].color(:white)
63
+
64
+ grab(m.id).drag({ move: true }) do |e|
65
+ puts e
66
+ end
67
+ wait 1 do
68
+ m.add_columns(3)
69
+ m.rows(3) do |el|
70
+ el.color(:orange)
71
+ end
72
+ wait 1 do
73
+ m.add_rows(4)
74
+ m.rows(1) do |el|
75
+ el.color(:lightgray)
76
+ end
77
+ wait 1 do
78
+ found.data.each do |el|
79
+ el.color(:red)
80
+ end
81
+ m.resize(330, 300)
82
+
83
+ m.fusion(rows: { 2 => [0, 3], 3 => [2, 5] })
84
+ end
85
+ end
86
+ end
87
+
88
+ #
89
+ m.fusion(columns: { 3=> [3, 5], 4 => [2, 5] })
90
+ m.fusion(rows: { 0 => [0, 3], 3 => [5, 9] })
91
+ # m.override( {
92
+ # columns: { number: [ 0, 3 ] ,width: 200},
93
+ # rows: { number: [ 1, 4 ] ,height: 200},
94
+ # })
95
+ m.last(:rows) do |el|
96
+ el.color(:violet)
97
+ end
98
+ m.divide( rows: {1 => 3})
99
+ m.cell(9).box({left: 0, top: 0, id: :the_big_one, width: 66, height: 66, color: :black})
100
+ # m.cell(9).content([box({ left: 0, top: 0, id: :another_one, width: 66, height: 66, color: :black })])
101
+
102
+
103
+
104
+
105
+ # # puts m.cell(9).content
106
+ # m.relations({ relation_1: {
107
+ # # start: {cell_id => out_nb},
108
+ # # end: {cell_id => in_nb},
109
+ # start: { 9 => 2 },
110
+ # end: { 2 => 3 }
111
+ # } })
112
+ # m.add({ relations: {
113
+ # # start: {cell_id => out_nb},
114
+ # # end: {cell_id => in_nb},
115
+ # rel_2: { start: { 7 => 3 },
116
+ # end: { 1 => 4 } }
117
+ # }
118
+ # })
119
+ # m.delete({ relations: :rel_2 })
120
+ # # alert m.relations
121
+ # # "sourceComponent": 0,
122
+ # # "sourceOutputSlot": 1,
123
+ # # "targetComponent": 1,
124
+ # # "targetInputSlot": 1
125
+ # # puts m.cell(9)
126
+ # # m.children.each do |child|
127
+ # # puts "#{grab(child).id} : #{grab(child).width}"
128
+ # # end
129
+ #
130
+ # # alert(grab("my_table_9"))
131
+ # # grab("my_table_9").children .each do |child|
132
+ # # grab(child).color(:white)
133
+ # # end
134
+ # matrix_ratio=m.height/m.width
135
+ # # alert prev_size
136
+ # $window.on :resize do |e|
137
+ # # m.top(0)
138
+ # # m.left(0)
139
+ # # ratio_w=m.width.value/$window.view.width
140
+ # # ratio_h=m.height.value/$window.view.height
141
+ # # puts "=====> :#{ratio_w}"
142
+ # # m.resize(ratio_w*$window.view.width,ratio_h*$window.view.height)
143
+ # m.resize($window.view.width, $window.view.width*matrix_ratio)
144
+ # end
145
+ # # m.ratio(:fixed)
146
+ #
147
+ # #TODO : add cell => style, actions, data, content, relation
148
+ # #TODO : mega important => I must have a reflection on .value
149
+ #
150
+ #
151
+ # # TODO : try matrix in a matrix's cell
152
+ # # TODO : store data, actions, and titles
153
+ # # alert m.cell(0)
154
+ # # ############################## end table tests #############
155
+ # # TODO : alteration data persistence when resizing color, and other particles are lost
156
+ #
157
+ # # generator = Genesis.generator
158
+ # ############
159
+ #
160
+ # # generator.build_option(:pre_render_parents) do |parents_ids|
161
+ # # parents_ids.each do |parents_id|
162
+ # # parents_found = grab(parents_id)
163
+ # # parents_found.atome[:children] << id if parents_found
164
+ # # end
165
+ # # family(parents_ids)
166
+ # # end
167
+ # #
168
+ # # generator.build_option(:pre_render_children) do |children_pass|
169
+ # # children_pass.each do |child_found|
170
+ # # atome_found = grab(child_found)
171
+ # # atome_found.parents([@atome[:id]])
172
+ # # end
173
+ # # end
174
+ # #
175
+ # # generator.build_particle(:family)
176
+ # #
177
+ # # generator.build_option(:pre_render_family) do |parents_ids|
178
+ # #
179
+ # # end
180
+ # #
181
+ # # ###### render #####
182
+ # #
183
+ # # generator.build_render(:browser_family) do |parents_found|
184
+ # # parents_found.each do |parent_found|
185
+ # # BrowserHelper.send("browser_attach_#{@browser_type}", parent_found, @browser_object, @atome)
186
+ # # end
187
+ # # end
188
+ # ############################## new attempt
189
+ # #
190
+ # # generator.build_sanitizer(:color) do |params|
191
+ # # parent_found = found_parents_and_renderers[:parent]
192
+ # # render_found = found_parents_and_renderers[:renderers]
193
+ # # default_params = { renderers: render_found, id: "color_#{Universe.atomes.length}", type: :color,
194
+ # # attach: parent_found,children: [],
195
+ # # red: 0, green: 0, blue: 0, alpha: 1 }
196
+ # # params = create_color_hash(params) unless params.instance_of? Hash
197
+ # # new_params = default_params.merge!(params)
198
+ # # atome[:color] = new_params
199
+ # # new_params
200
+ # # end
201
+ # #
202
+ # # generator.build_option(:pre_render_parents) do |parents_ids|
203
+ # # # family(parents_ids)
204
+ # # end
205
+ # # generator.build_option(:pre_render_children) do |children_pass|
206
+ # # # children_pass.each do |child_found|
207
+ # # # atome_found = grab(child_found)
208
+ # # # atome_found.parents([@atome[:id]])
209
+ # # # end
210
+ # # end
211
+ # # # render
212
+ # # generator.build_render(:browser_parent) do |parents_found|
213
+ # # # parents_found.each do |parent_found|
214
+ # # # BrowserHelper.send("browser_attach_#{@browser_type}", parent_found, @browser_object, @atome)
215
+ # # # end
216
+ # # end
217
+ # #
218
+ # # generator.build_render(:browser_children) do |parents_found|
219
+ # # # parents_found.each do |parent_found|
220
+ # # # BrowserHelper.send("browser_attach_#{@browser_type}", parent_found, @browser_object, @atome)
221
+ # # # end
222
+ # # end
223
+ #
224
+ # ########### #########
225
+ #
226
+ # # module BrowserHelper
227
+ # # def self.browser_document
228
+ # # # Work because of the patched version of opal-browser(0.39)
229
+ # # Browser.window
230
+ # # end
231
+ # #
232
+ # # def self.browser_attach_div(parents, html_object, _atome)
233
+ # # html_object.append_to(browser_document[parents])
234
+ # # end
235
+ # #
236
+ # # def self.browser_attach_style(parents, _html_object, atome)
237
+ # # browser_document[parents].add_class(atome[:id])
238
+ # # end
239
+ # # end
240
+ #
241
+ # # generator.build_option(:pre_render_parents) do |parents_ids|
242
+ # # parents_ids.each do |parents_id|
243
+ # # if parents_id.instance_of? Atome
244
+ # # parents_id = parents_id.value
245
+ # # end
246
+ # # parents_found = grab(parents_id)
247
+ # # family(parents_id)
248
+ # # parents_found.atome[:children] << atome[:id]
249
+ # # end
250
+ # # end
251
+ # #
252
+ # # generator.build_option(:pre_render_children) do |children_ids|
253
+ # # children_ids.each do |child_id|
254
+ # # if child_id.instance_of? Atome
255
+ # # child_id = child_id.value
256
+ # # end
257
+ # # child_found = grab(child_id)
258
+ # # parents_found=@atome[:id]
259
+ # # child_found.family(parents_found)
260
+ # # child_found.atome[:parents] = [parents_found]
261
+ # # end
262
+ # # end
263
+ # #
264
+ #
265
+ # # generator.build_particle(:family, { render: true, store: false })
266
+ # # generator.build_render(:browser_family) do |parents_found|
267
+ # # BrowserHelper.send("browser_attach_#{@browser_type}", parents_found, @browser_object, @atome)
268
+ # # end
269
+ #
270
+ # # class Universe
271
+ # # def add_to_atomes(id, atome)
272
+ # # # instance_variable_get('@atomes').merge!(atome)
273
+ # # @atomes[id] = atome
274
+ # # end
275
+ # #
276
+ # # def update_atome_id(id, atome, prev_id)
277
+ # # puts :ok
278
+ # # @atomes[id] = atome
279
+ # # @atomes.delete(prev_id)
280
+ # # end
281
+ # # end
282
+ #
283
+ # # generator.build_sanitizer(:id) do |params|
284
+ # # if @atome[:id] != params
285
+ # # Universe.update_atome_id(params, self, @atome[:id])
286
+ # # else
287
+ # # Universe.add_to_atomes(params, self)
288
+ # # end
289
+ # # params
290
+ # # end
291
+ # #
292
+ # # generator.build_render(:browser_id) do |params|
293
+ # # browser_object.id = params if @atome[:id] != params
294
+ # # end
295
+ #
296
+ #
297
+ #
298
+ # # b = box({ id: :titi })
299
+ # # c = color(:orange)
300
+ # # c.id(:tutu)
301
+ # # b.children([:tutu])
302
+ #
303
+ #
304
+ # # alert b.children
305
+ # # alert b
306
+ # # b.circle({id: :toto})
307
+ # # grab(:box_color).parents([:titi])
308
+ # # b.children([:box_color])
309
+ # # alert b
310
+ #
311
+ # # generator.build_render(:browser_parents) do |parents_found|
312
+ # # # p :number_parents
313
+ # # # parents_found.each do |parent_found|
314
+ # # # BrowserHelper.send("browser_attach_#{@browser_type}", parent_found, @browser_object, @atome)
315
+ # # # end
316
+ # # end
317
+ # #
318
+ # # generator.build_render(:browser_children) do |children_found|
319
+ # # # p :number_children
320
+ # # # children_found.each do |child_found|
321
+ # # # BrowserHelper.send("browser_attach_#{@browser_type}", child_found, @browser_object, @atome)
322
+ # # # end
323
+ # # end
324
+ #
325
+ # # b = box({ id: :the_test_box })
326
+ # # i = 0
327
+ # # while i < 9
328
+ # # # puts :ok
329
+ # # box({ left: i * 30, width: 9 })
330
+ # # i += 1
331
+ # # end
332
+ # # # c = color({red: 0, green: 1, blue: 0.3, alpha: 1, id: :thcol, children: []})
333
+ # # c = color(:red)
334
+ # # # alert a
335
+ # # # wait 1 do
336
+ # # b.children([c.id])
337
+ # # # c.parents([b.id])
338
+ # # # puts "box is :\n#{b}\n\n color is :\n#{c}"
339
+ # #
340
+ # # puts '-----'
341
+ # # puts "familly content #{b.family}"
342
+ # # # end
343
+ #
344
+ # # generator.build_option(:pre_render_parents) do |parents_ids|
345
+ # # parents_ids.each do |parents_id|
346
+ # # parents_found = grab(parents_id)
347
+ # # parents_found.atome[:children]<< id if parents_found
348
+ # # end
349
+ # # family({attach: parents_ids, children: [] })
350
+ # # end
351
+ # #
352
+ # #
353
+ # # #mess below
354
+ # # generator.build_option(:pre_render_children) do |children_ids|
355
+ # # children_ids.each do |child_found|
356
+ # # atome_found = grab(child_found)
357
+ # # atome_found.atome[:parents]=[@atome[:id]]
358
+ # # end
359
+ # # # family({children: children_ids, attach: [] })
360
+ # # end
361
+ # #
362
+ # #
363
+ # # generator.build_particle(:family)
364
+ # #
365
+ # #
366
+ # # ####################
367
+ # # generator.build_render(:browser_family) do |params|
368
+ # # # puts "kool super kool! : #{parents_found} , type : #{@browser_type}, object : #{@browser_object} ,atome : #{@atome}"
369
+ # # # puts "atome : #{@atome[:id]}, parent : #{parents_found}}"
370
+ # # # puts "atome : #{@atome} : #{params[:parents]}"
371
+ # # puts " #{params[:parents]}"
372
+ # # parents_found=params[:parents]
373
+ # # children_found=params[:children]
374
+ # # parents_found.each do |parent_found|
375
+ # # # atome=
376
+ # # BrowserHelper.send("browser_attach_#{@browser_type}", parent_found, @browser_object, @atome)
377
+ # # end
378
+ # #
379
+ # # children_found.each do |parent_found|
380
+ # # BrowserHelper.send("browser_attach_#{@browser_type}", parent_found, @browser_object, @atome)
381
+ # # end
382
+ # #
383
+ # # end
384
+ # #
385
+ # # generator.build_render(:browser_parents) do |parents_found|
386
+ # # # puts "moinskool super kool! : #{parents_found} "
387
+ # # # puts "moinskool super kool! : #{parents_found} , type : #{@browser_type}, object : #{@browser_object} ,atome : #{@atome}"
388
+ # # # parents_found.each do |parent_found|
389
+ # # # BrowserHelper.send("browser_attach_#{@browser_type}", parent_found, @browser_object, @atome)
390
+ # # # end
391
+ # # end
392
+ #
393
+ # ###################
394
+ # # class Atome
395
+ # #
396
+ # # def store_value(element)
397
+ # # params=instance_variable_get("@#{element}")
398
+ # # @atome[element] = params
399
+ # # end
400
+ # #
401
+ # # def build_particle(particle_name,options,&particle_proc)
402
+ # # type = options[:type]
403
+ # # type = :string if options[:type].nil?
404
+ # # store = options[:store]
405
+ # # store = true if options[:store].nil?
406
+ # # render = options[:render]
407
+ # # render = true if options[:render].nil?
408
+ # #
409
+ # # # we add the new method to the particle's collection of methods
410
+ # # Universe.add_to_particle_list(particle_name, type)
411
+ # # auto_render_generator(particle_name) if render # automatise the creation of an empty render method for current particle
412
+ # # new_particle(particle_name,store,render , &particle_proc)
413
+ # # additional_particle_methods(particle_name, &particle_proc) # create alternative methods such as create 'method='
414
+ # # end
415
+ # #
416
+ # # def additional_particle_methods(element, &method_proc)
417
+ # # Atome.define_method "#{element}=" do |params = nil, &user_proc|
418
+ # # instance_exec(params, user_proc, &method_proc) if method_proc.is_a?(Proc)
419
+ # # end
420
+ # # end
421
+ # #
422
+ # # def new_particle(element,store,render, &method_proc)
423
+ # # Atome.define_method element do |params = nil, &user_proc|
424
+ # # if params || params == false
425
+ # # # the line below execute the proc created when using the build_particle method
426
+ # # instance_exec(params, user_proc, &method_proc) if method_proc.is_a?(Proc)
427
+ # # params = sanitize(element, params)
428
+ # # create_particle(element,store,render)
429
+ # # send("set_#{element}", params, &user_proc)
430
+ # # else
431
+ # # get_particle(element, &user_proc)
432
+ # # end
433
+ # # end
434
+ # # end
435
+ # # def run_optional_proc(proc_name, atome = self, element, &user_proc)
436
+ # # params=instance_variable_get("@#{element}")
437
+ # # option_found = Universe.get_optional_method(proc_name)
438
+ # # atome.instance_exec(params, user_proc, atome, &option_found) if option_found.is_a?(Proc)
439
+ # # end
440
+ # #
441
+ # # def rendering(element, &user_proc)
442
+ # # params=instance_variable_get("@#{element}")
443
+ # # render_engines = @atome[:renderers]
444
+ # # render_engines.each do |render_engine|
445
+ # # send("#{render_engine}_#{element}", params, &user_proc)
446
+ # # end
447
+ # # end
448
+ # #
449
+ # # def broadcasting(element)
450
+ # # params=instance_variable_get("@#{element}")
451
+ # # @broadcast.each_value do |particle_monitored|
452
+ # # if particle_monitored[:particles].include?(element)
453
+ # # code_found=particle_monitored[:code]
454
+ # # instance_exec(self, element, params, &code_found) if code_found.is_a?(Proc)
455
+ # # end
456
+ # # end
457
+ # # end
458
+ # #
459
+ # # def particle_creation(element, params,store,render, &user_proc)
460
+ # # return false unless security_pass(element, params)
461
+ # # # we create a proc holder of any new particle if user pass a bloc
462
+ # # store_code_bloc(element, &user_proc) if user_proc
463
+ # # # Params is now an instance variable so it should be passed thru different methods
464
+ # # instance_variable_set("@#{element}", params)
465
+ # # run_optional_proc("pre_render_#{@atome[:type]}".to_sym, self, element, &user_proc)
466
+ # # run_optional_proc("pre_render_#{element}".to_sym, self, element, &user_proc)
467
+ # # rendering(element, &user_proc) if render
468
+ # # run_optional_proc("post_render_#{@atome[:type]}".to_sym, self, element, &user_proc)
469
+ # # run_optional_proc("post_render_#{element}".to_sym, self, element, &user_proc)
470
+ # # broadcasting(element)
471
+ # # store_value(element) if store
472
+ # # self
473
+ # # end
474
+ # #
475
+ # # def create_particle(element,store,render)
476
+ # # Atome.define_method "set_#{element}" do |params, &user_proc|
477
+ # # particle_creation(element, params, store,render,&user_proc)
478
+ # # end
479
+ # # end
480
+ # #
481
+ # # end
482
+
483
+
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ m=matrix({ id: :my_table, left: 330, top: 0, width: 500, height: 399, smooth: 8, color: :yellowgreen,
4
+ cells: {
5
+ particles: { margin: 9, color: :red, smooth: 9, shadow: { blur: 9, left: 3, top: 3,id: :cell_shadow } }
6
+ }
7
+ })
8
+
9
+ m.cells do |el|
10
+ batch(el)
11
+ batch.color(:white).rotate(22).text(:hello)
12
+ end
13
+
14
+ m.cells(["my_table_2", 9, "my_table_5"]) do |el|
15
+ batch(el)
16
+ batch.color(:red).rotate(33)
17
+ end
18
+
19
+
20
+ mm=matrix
21
+ #
22
+ mm.cells do |el|
23
+ batch(el)
24
+ batch.color(:yellowgreen).rotate(33)
25
+ end
26
+
27
+
28
+
29
+ mm.cells.each do |el|
30
+ el_found=grab(el)
31
+ el_found.rotate(22).text(:hello).color(:red)
32
+ end
@@ -32,7 +32,7 @@ wait 0.5 do
32
32
  end
33
33
  end
34
34
 
35
- puts a.monitor
35
+ puts "bb monitor is #{bb.monitor}"
36
36
 
37
37
  # test 2
38
38
  aa = text({ data: 'touch me and look in the console', top: 99, width: 399, left: 120 })
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  my_video2 = Atome.new(
4
- video: { renderers: [:browser], id: :video9, type: :video, parents: [:view], path: './medias/videos/madmax.mp4',
4
+ video: { renderers: [:browser], id: :video9, type: :video, attach: [:view], path: './medias/videos/madmax.mp4',
5
5
  left: 666, top: 333, width: 199, height: 99,
6
6
  }) do |params|
7
7
  puts "2- video callback time is #{params}, id is : #{id}"
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  my_video = Atome.new(
4
- video: { renderers: [:browser], id: :video1, type: :video, parents: [:view],
4
+ video: { renderers: [:browser], id: :video1, type: :video, attach: [:view],
5
5
  path: './medias/videos/avengers.mp4', left: 333, top: 33, width: 777
6
6
  }
7
7
  ) do |params|
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
-
3
- b=circle
2
+ c=circle
3
+ b=circle({left: 333, id: :the_c})
4
4
  b.touch(true) do
5
5
  self.color(:blue)
6
6
  end
@@ -11,9 +11,11 @@ b.touch(:long) do
11
11
  end
12
12
 
13
13
  b.over(:enter) do
14
- self.color(:red)
14
+ self.color(:black)
15
+
15
16
  end
16
17
 
17
18
  b.over(:leave) do
19
+
18
20
  self.color(:blue)
19
- end
21
+ end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  my_video = Atome.new(
4
- video: { renderers: [:browser], id: :video1, type: :video, parents: [:view],
4
+ video: { renderers: [:browser], id: :video1, type: :video, attach: [:view],
5
5
  path: './medias/videos/avengers.mp4', left: 333, top: 33, width: 777
6
6
  }
7
7
  ) do |params|
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ b = box({left: 333, id: :the_one_box})
4
+ b.color(:red)
5
+
6
+ b.circle({top: 66, id: :the_circle, color: :green})
7
+ b.box({left: 166,top: 166, id: :the_box, color: :green})
8
+ b.text({left: 166, id: :the_text, data: :green})
9
+ b.image('red_planet.png')
10
+ `console.clear()`
11
+ puts "b: #{b}"
12
+
13
+
14
+
15
+ wait 2 do
16
+ b.physical.each do |attached_atome_id|
17
+ b.delete({id: attached_atome_id})
18
+ end
19
+ end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  my_video = Atome.new(
4
- video: { renderers: [:browser], id: :video1, type: :video, parents: [:view],clones: [],
4
+ video: { renderers: [:browser], id: :video1, type: :video, attach: [:view],clones: [],
5
5
  time: 33, path: './medias/videos/avengers.mp4', left: 333, top: 33, width: 777
6
6
  }
7
7
  ) do |params|
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
-
3
2
  repeat 0.3, 10 do |evt|
3
+ alert :ok
4
4
  puts "hello:#{evt}:"
5
- end
5
+ end
6
+
@@ -5,7 +5,7 @@ b = box({ id: :the_box, left: 99, top: 99 })
5
5
 
6
6
 
7
7
 
8
- s = b.shadow({ renderers: [:browser], id: :shadow2, type: :shadow, parents: [],
8
+ s = b.shadow({ renderers: [:browser], id: :shadow2, type: :shadow, attach: [],
9
9
  left: 3, top: 9, blur: 3, direction: :inset,
10
10
  red: 0, green: 0, blue: 0, alpha: 1
11
11
  })
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- a = box({ width: 333, height: 333, id: :the_grid })
3
+ a = box({ width: 180, height: 333, id: :the_grid, overflow: :scroll })
4
4
  i = 0
5
5
  while i < 16
6
6
  b = Atome.new(
7
- shape: { renderers: [:browser],id: "the_shape#{i}", type: :shape, parents: [:the_grid], children: [],
7
+ shape: { renderers: [:browser],id: "the_shape#{i}", type: :shape, attach: [:the_grid], attached: [],
8
8
  width: 50, height: 50,
9
- color: { renderers: [:browser], id: :c31, type: :color, parents: ["the_shape#{i}"], children: [],
9
+ color: { renderers: [:browser], id: :c31, type: :color, attach: ["the_shape#{i}"], attached: [],
10
10
  red: 1, green: 0.15, blue: 0.15, alpha: 0.6 } }
11
11
  )
12
12
  b.text({ data: "item#{i + 1}", visual: { size: 12 } })
@@ -16,4 +16,3 @@ end
16
16
  a.sort(true) do |el|
17
17
  puts "just sorted : #{el}"
18
18
  end
19
-
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+ a=box({color: :orange})
3
+
4
+ a.tag({ color: :red })
5
+ a.tag({ star: 3 })
6
+ a.add({ tag: { quality: 9 } })
7
+
8
+ tags_found= a.tag.to_s
9
+
10
+ text({data: "Orange box tags are #{tags_found}" , width: :auto})
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  my_text = Atome.new(
4
- text: { renderers: [:browser], id: :text1, type: :text, parents: [:view], visual: { size: 33 },
4
+ text: { renderers: [:browser], id: :text1, type: :text, attach: [:view], visual: { size: 33 },
5
5
  data: 'My first text!', left: 120, top: 33, width: 199, height: 33,
6
6
 
7
7
  }
8
8
  )
9
9
 
10
- Atome.new(color: { renderers: [:browser], id: :c31, type: :color, parents: [:text1],
10
+ Atome.new(color: { renderers: [:browser], id: :c31, type: :color, attach: [:text1],
11
11
  red: 0.6, green: 0.6, blue: 0.6, alpha: 1 })
12
12
 
13
13
  wait 1 do
@@ -17,7 +17,7 @@ end
17
17
  text({ id: :the_text, left: 0 })
18
18
 
19
19
  text2=Atome.new(
20
- text: { renderers: [:browser], id: :text2, type: :text, parents: [:view], visual: { size: 33 },
20
+ text: { renderers: [:browser], id: :text2, type: :text, attach: [:view], visual: { size: 33 },
21
21
  data: 'My second text!', left: 333, top: 33, width: 199, height: 33,
22
22
 
23
23
  }
@@ -25,7 +25,7 @@ text2=Atome.new(
25
25
 
26
26
 
27
27
 
28
- Atome.new(color: { renderers: [:browser], id: :c33, type: :color, parents: [:text2],
28
+ Atome.new(color: { renderers: [:browser], id: :c33, type: :color, attach: [:text2],
29
29
  red: 0.6, green: 0.6, blue: 0.1, alpha: 1 })
30
30
  wait 2 do
31
31
  text2.data(:ok)