atome 0.5.7.3.9 → 0.5.7.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/lib/atome/atome.rb +24 -56
  3. data/lib/atome/extensions/atome.rb +10 -59
  4. data/lib/atome/extensions/sha.rb +7 -7
  5. data/lib/atome/genesis/genesis.rb +0 -89
  6. data/lib/atome/genesis/particles/communication.rb +1 -1
  7. data/lib/atome/genesis/particles/event.rb +0 -8
  8. data/lib/atome/genesis/particles/geometry.rb +0 -1
  9. data/lib/atome/genesis/particles/hierarchy.rb +0 -34
  10. data/lib/atome/genesis/particles/identity.rb +0 -30
  11. data/lib/atome/genesis/particles/material.rb +0 -11
  12. data/lib/atome/genesis/particles/property.rb +14 -16
  13. data/lib/atome/genesis/particles/security.rb +0 -45
  14. data/lib/atome/genesis/particles/utility.rb +17 -185
  15. data/lib/atome/genesis/sparkle.rb +3 -12
  16. data/lib/atome/kernel/black_matter.rb +0 -1
  17. data/lib/atome/kernel/universe.rb +5 -45
  18. data/lib/atome/presets/atome.rb +0 -22
  19. data/lib/atome/version.rb +1 -1
  20. data/lib/molecules/init.rb +0 -14
  21. data/lib/molecules/intuition/tools.rb +3 -22
  22. data/lib/molecules/intuition/utilities.rb +121 -77
  23. data/lib/platform_specific/opal/atome_opal_extensions.rb +0 -1
  24. data/lib/platform_specific/opal/extensions/color.rb +0 -5
  25. data/lib/platform_specific/opal/extensions/geolocation.rb +5 -5
  26. data/lib/platform_specific/opal/extensions/ping.rb +11 -20
  27. data/lib/renderers/html/effect.rb +0 -11
  28. data/lib/renderers/html/event.rb +0 -7
  29. data/lib/renderers/html/geometry.rb +0 -31
  30. data/lib/renderers/html/html.rb +13 -134
  31. data/lib/renderers/html/material.rb +0 -22
  32. data/lib/renderers/html/spatial.rb +0 -9
  33. data/lib/renderers/html/utility.rb +5 -8
  34. data/lib/renderers/renderer.rb +0 -1
  35. data/vendor/assets/application/examples/applications.rb +19 -71
  36. data/vendor/assets/application/examples/buttons.rb +5 -4
  37. data/vendor/assets/application/examples/unfasten.rb +15 -9
  38. data/vendor/assets/application/index.rb +1 -1
  39. data/vendor/assets/server/capture.rb +0 -1
  40. data/vendor/assets/server/database.rb +0 -1
  41. data/vendor/assets/server/eDen.rb +5 -80
  42. data/vendor/assets/src/index_server_wasm.html +0 -3
  43. data/vendor/assets/src/index_wasm.html +0 -6
  44. metadata +2 -6
  45. data/lib/molecules/_deprecated_examples/site.rb +0 -34
  46. data/lib/molecules/intuition/_deprecated_inputs.rb +0 -111
  47. data/lib/molecules/intuition/_deprecated_toolbox.rb +0 -282
  48. data/lib/platform_specific/opal/extensions/sha.rb +0 -25
@@ -13,15 +13,10 @@ class Atome
13
13
  # TODO : remove Essentials.default_params[atome_preset] || {} as it is
14
14
  # applied twice because preset is now a particle
15
15
  preset_params = Essentials.default_params[atome_preset] || {}
16
- # preset_params = {preset: atome_preset}
17
16
  basic_params[:type] = preset_params[:type] || :element
18
- # basic_params[:aid] = identity_generator(:a)
19
- # alert "common => #{params[:id]}"
20
- # alert "basic_params #{basic_params[:id].class}"
21
17
  basic_params[:id] = params[:id] || identity_generator
22
18
  basic_params[:renderers] = @renderers || preset_params[:renderers]
23
19
  essential_params = basic_params.merge(preset_params)
24
- #
25
20
  reordered_params = essential_params.reject { |key, _| params.has_key?(key) }
26
21
  params = reordered_params.merge(params)
27
22
  params[:id] = params[:id].to_sym
@@ -45,23 +40,6 @@ class Atome
45
40
  Atome.new(params, &bloc)
46
41
  end
47
42
 
48
- # def box(params = {}, &bloc)
49
- # atome_preset = :box
50
- # params = atome_common(atome_preset, params)
51
- # preset_common(params, &bloc)
52
- # end
53
- #
54
- # # def intuition(params = {}, &bloc)
55
- # # atome_preset = :intuition
56
- # # params = atome_common(atome_preset, params)
57
- # # preset_common(params, &bloc)
58
- # # end
59
- #
60
- # def circle(params = {}, &bloc)
61
- # atome_preset = :circle
62
- # params = atome_common(atome_preset, params)
63
- # preset_common(params, &bloc)
64
- # end
65
43
  end
66
44
 
67
45
 
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.3.9'
6
+ VERSION = '0.5.7.4.2'
7
7
  end
@@ -6,10 +6,6 @@ end
6
6
 
7
7
  class Object
8
8
  include Molecule
9
- # we add a getter for the molecule in standard ruby Object
10
- # def molecule
11
- # @molecule
12
- # end
13
9
  end
14
10
 
15
11
  class Atome
@@ -17,15 +13,5 @@ class Atome
17
13
  end
18
14
 
19
15
 
20
- # tests
21
- # new({application: :compose, header: true, footer: true })
22
- #
23
- # new(page: {name: :home, application: :compose, attach: :root })
24
- #
25
- # new(module: {name: :home, application: :compose, attach: :root })
26
-
27
-
28
-
29
-
30
16
 
31
17
 
@@ -67,11 +67,9 @@ class Atome
67
67
  atome_found = grab(id_found)
68
68
  # unless (atome_found && atome_found.tag[:system])
69
69
  puts 'we have to check if operation is a creation or an alteration to include or exclude the view '
70
- # alert atome_touched
71
70
  Universe.active_tools.each do |tool|
72
- # alert "#{tool}, #{atome_found.id}"
73
71
  apply_tool(tool, atome_found, event)
74
- end # if atome_found #&& !atome_found.tag[:system]
72
+ end
75
73
 
76
74
  break
77
75
  end
@@ -122,8 +120,6 @@ class Atome
122
120
  end
123
121
 
124
122
  def creation(current_tool, tool_actions, atome_touched, a_event)
125
- # we store prev_local_storage prior to lock it to prevent unwanted logs
126
- # prev_local_storage=Universe.allow_localstorage()
127
123
  @creation_mode = true
128
124
  storage_allowed = Universe.allow_localstorage
129
125
  Universe.allow_localstorage = false
@@ -142,7 +138,6 @@ class Atome
142
138
  else
143
139
  grab(:view).send(atome, temp_val)
144
140
  end
145
- # current_tool.data[:treated] << new_atome
146
141
  current_tool.data[:created] << new_atome
147
142
  params.delete(:atome_touched)
148
143
  params[new_atome: new_atome]
@@ -174,9 +169,7 @@ class Atome
174
169
  else
175
170
  atome_touched
176
171
  end
177
- # unless method_found == :alteration && (target.id == :view_color || target.id == :view)
178
- unless method_found == :alteration && target.tag[:system]
179
-
172
+ unless method_found == :alteration && target.tag[:system]
180
173
 
181
174
  tools_scheme[:particles]&.each do |particle_f, value_f|
182
175
  target.send(particle_f, value_f)
@@ -220,7 +213,6 @@ class Atome
220
213
  tool.data[:created] = []
221
214
  tool.data[:prev_states] = {}
222
215
  # generic behavior
223
- # tool.apply(:active_tool_col)
224
216
  grab("#{tool_name}_icon").color(:white)
225
217
  grab("#{tool_name}_label").color(:white)
226
218
  Universe.active_tools << tool_name
@@ -251,8 +243,7 @@ class Atome
251
243
  Atome.apply_tool(tool_name, atome_found, event)
252
244
  end
253
245
  end
254
-
255
- # # activate tool analysis test
246
+ # activate tool analysis test
256
247
  Atome.activate_click_analysis
257
248
  tool.active(true)
258
249
  end
@@ -284,7 +275,6 @@ class Atome
284
275
  # generic behavior
285
276
  # we remove touch and resize binding on newly created atomes
286
277
  tool.apply(:inactive_tool_col)
287
- # alert tool.data[:created]
288
278
  tool.data[:created]&.each do |new_atome|
289
279
  new_atome.drag(false)
290
280
  new_atome.resize(:remove)
@@ -299,7 +289,6 @@ class Atome
299
289
  tool_name = "#{params[:name]}_tool"
300
290
  index = params[:index]
301
291
  tool_scheme = params[:scheme]
302
- # @tool_scheme=params[:scheme]
303
292
  toolbox = params[:toolbox] || {}
304
293
  orientation_wanted = tool_scheme[:orientation] || :sn
305
294
 
@@ -351,8 +340,6 @@ class Atome
351
340
  action: action,
352
341
  allow_alteration: true,
353
342
  allow_creation: true,
354
- # activation: tool_scheme[:activation],
355
- # inactivation: tool_scheme[:inactivation], zone: tool_scheme[:zone],
356
343
  post: tool_scheme[:post],
357
344
  pre: tool_scheme[:pre],
358
345
  }
@@ -421,8 +408,6 @@ class Atome
421
408
  if particle.instance_variable_get('@active')
422
409
  grab(slider_id).delete({ force: true })
423
410
  particle.instance_variable_set('@active', false)
424
- # particle.top(:auto)
425
- # particle.top(:bottom)
426
411
  particle.height(size)
427
412
  particle.top(0)
428
413
  else
@@ -446,9 +431,7 @@ class Atome
446
431
  if grab(slider_id).instance_variable_get('@initialised')
447
432
  Atome.selection.each do |atome_id_to_treat|
448
433
 
449
- # puts "-------> #{tool_scheme[:particles][particle_name]} , #{value }"
450
434
  tool_scheme[:particles][particle_name] = value.to_f / 100
451
- # tools_scheme[:particles]
452
435
  atome_found = grab(atome_id_to_treat)
453
436
  target = grab(atome_found.color.last)
454
437
 
@@ -495,10 +478,8 @@ class Atome
495
478
  tick[tool_name] = 0
496
479
  end
497
480
  end
498
- # puts 'reactivation'
499
481
  tool.instance_variable_set('@prevent_action', false)
500
482
  end
501
-
502
483
  end
503
484
 
504
485
  end
@@ -1,11 +1,36 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Atome
4
+ def reorder_menu
5
+ disposition = data[:inactive][:disposition]
6
+ margin = data[:inactive][:margin]
7
+ spacing = data[:inactive][:spacing]
8
+ inactive_style = data[:inactive]
9
+ keys_to_exclude = [:margin, :spacing, :disposition, :text]
10
+ inactive_style = inactive_style.reject { |key, _| keys_to_exclude.include?(key) }
11
+ fasten.each_with_index do |atome_f, index|
12
+ menu_item = grab(atome_f)
13
+ if disposition == :horizontal
14
+ menu_item.left = margin[:left] + (inactive_style[:width] + spacing) * index
15
+ menu_item.top = margin[:top]
16
+ else
17
+ menu_item.top = margin[:top] + (inactive_style[:height] + spacing) * index
18
+ menu_item.left = margin[:left]
19
+ end
20
+ end
21
+ end
22
+
23
+ def remove_menu_item(item_to_remove)
24
+ grab(item_to_remove).delete(recursive: true)
25
+ reorder_menu
26
+ end
4
27
 
5
28
  def create_new_button(button_id, position_in_menu, label, code)
6
29
  essential_keys = [:inactive, :active]
7
- buttons_style = data.select { |key, value| essential_keys.include?(key) }
30
+ buttons_style = data.select { |key, _value| essential_keys.include?(key) }
8
31
  menu_item = box({ id: button_id })
32
+ actor({ button_id => :button })
33
+ menu_item.role(:button)
9
34
  menu_item.text({ data: label, id: "#{button_id}_label" })
10
35
  menu_item.code({ button_code: code })
11
36
 
@@ -14,6 +39,7 @@ class Atome
14
39
  if active_style
15
40
  active_state_text = active_style[:text]
16
41
  keys_to_exclude = [:margin, :spacing, :disposition, :text]
42
+
17
43
  active_style = active_style.reject { |key, _| keys_to_exclude.include?(key) }
18
44
  end
19
45
 
@@ -26,6 +52,7 @@ class Atome
26
52
  inactive_style = inactive_style.reject { |key, _| keys_to_exclude.include?(key) }
27
53
  menu_item.set(inactive_style)
28
54
 
55
+ # reorder_menu
29
56
  if disposition == :horizontal
30
57
  menu_item.left = margin[:left] + (inactive_style[:width] + spacing) * position_in_menu
31
58
  menu_item.top = margin[:top]
@@ -42,29 +69,33 @@ class Atome
42
69
 
43
70
  menu_item.touch(:down) do
44
71
  unless @active_item == menu_item.id
45
- menu_item.set(active_style)
72
+
46
73
  menu_item.text.each do |text_f|
47
- grab(text_f).set(active_state_text)
48
- end
49
- fasten.each do |item_id|
50
- unless button_id == item_id
51
- grab(item_id).remove({ all: :shadow })
52
- grab(item_id).set(inactive_style)
53
- grab("#{item_id}_label").remove({ all: :shadow })
54
- grab("#{item_id}_label").set(inactive_state_text)
74
+ # below we unset any active style
75
+ fasten.each do |item_id|
76
+ unless button_id == item_id
77
+ grab(item_id).remove({ all: :shadow })
78
+ grab(item_id).set(inactive_style)
79
+ grab("#{item_id}_label").remove({ all: :shadow })
80
+ grab("#{item_id}_label").set(inactive_state_text)
81
+ end
82
+ grab(text_f).set(active_state_text)
55
83
  end
84
+
56
85
  end
57
- code.call if code
86
+ menu_item.set(active_style)
87
+ code&.call
88
+ @active_item = menu_item.id
58
89
  end
59
- @active_item = menu_item.id
90
+
60
91
  end
92
+
61
93
  end
62
94
 
63
95
  def add_button(params)
64
96
  params.each do |button_id, params|
65
97
  label = params[:text]
66
98
  code = params[:code]
67
- # {"new_button"=>{"text"=>"button1", "code"=>#<Proc:0xafe>}}
68
99
  index = fasten.length
69
100
  create_new_button(button_id, index, label, code)
70
101
  end
@@ -72,7 +103,6 @@ class Atome
72
103
  end
73
104
 
74
105
  def resize_matrix(params)
75
-
76
106
  width(params[:width])
77
107
  height(params[:height])
78
108
  current_matrix = self
@@ -106,14 +136,12 @@ class Atome
106
136
  end
107
137
 
108
138
  end
109
-
110
139
  end
111
140
 
112
141
  new(molecule: :input) do |params, bloc|
113
142
  params[:height] ||= 15
114
143
  params[:width] ||= 222
115
144
  new_id = params.delete(:id) || identity_generator
116
-
117
145
  trigger = params.delete(:trigger)
118
146
  trigger ||= :return
119
147
  limit = params.delete(:limit)
@@ -124,8 +152,6 @@ new(molecule: :input) do |params, bloc|
124
152
  text_params ||= {}
125
153
  default_text = params.delete(:default)
126
154
  component = params.delete(:component)
127
- # component ||= {}
128
-
129
155
  default_text ||= :input
130
156
  default_parent = if self.instance_of?(Atome)
131
157
  id
@@ -146,44 +172,33 @@ new(molecule: :input) do |params, bloc|
146
172
  position: :absolute
147
173
  }.merge(text_params)
148
174
  )
149
- # text_input.set()
150
175
  text_input.touch(:down) do
151
176
  input_back.tick(:input)
152
177
  text_input.edit(true)
153
178
  end
154
179
 
155
180
  input_back.touch(:up) do
156
- if input_back.tick[:input] == 1
157
- text_input.component({ selected: true })
158
- end
181
+ text_input.component({ selected: true }) if input_back.tick[:input] == 1
159
182
  end
160
183
 
161
184
  text_input.keyboard(:down) do |native_event|
162
- # text_input.component({ selected: { color: :red, text: :red } })
163
-
164
185
  event = Native(native_event)
165
186
  if event[:keyCode].to_s == '8' || event[:keyCode].to_s == '46'
166
187
  # always allow
167
188
  elsif event[:keyCode].to_s == '13'
168
189
  # we prevent the input
169
- if trigger == :return
170
- bloc.call(text_input.data)
171
- end
190
+ bloc.call(text_input.data) if trigger == :return
172
191
  text_input.edit(false)
173
192
  event.preventDefault()
174
193
  elsif text_input.data.length > limit
175
194
  event.preventDefault()
176
195
  end
177
- if trigger == :down
178
- bloc.call(text_input.data)
179
- end
196
+ bloc.call(text_input.data) if trigger == :down
180
197
  end
181
198
 
182
- text_input.keyboard(:up) do |native_event|
199
+ text_input.keyboard(:up) do |_native_event|
183
200
  input_back.data = text_input.data
184
- if trigger == :up
185
- bloc.call(text_input.data)
186
- end
201
+ bloc.call(text_input.data) if trigger == :up
187
202
  end
188
203
  params.each do |part_f, val_f|
189
204
  input_back.send(part_f, val_f)
@@ -193,13 +208,11 @@ new(molecule: :input) do |params, bloc|
193
208
  end
194
209
 
195
210
  new(molecule: :list) do |params, _bloc|
196
-
197
211
  styles_found = params.delete(:styles)
198
212
  element = params.delete(:element)
199
213
  listing = params.delete(:listing)
200
214
  action = params.delete(:action)
201
215
  new_id = params.delete(:id) || identity_generator
202
-
203
216
  styles_found ||= {
204
217
  width: 99,
205
218
  height: 33,
@@ -214,12 +227,8 @@ new(molecule: :list) do |params, _bloc|
214
227
  top: :center,
215
228
  color: :orange,
216
229
  type: :text }
217
- unless params[:width]
218
- params[:width] = styles_found[:width]
219
- end
220
- unless element[:width]
221
- element[:width] = styles_found[width]
222
- end
230
+ params[:width] = styles_found[:width] unless params[:width]
231
+ element[:width] = styles_found[width] unless element[:width]
223
232
  margin = styles_found[:margin]
224
233
  height_found = styles_found[:height]
225
234
 
@@ -475,22 +484,59 @@ new(molecule: :application) do |params, &bloc|
475
484
  else
476
485
  identity_generator
477
486
  end
487
+
478
488
  main_app = box({ id: id_f, width: :auto, height: :auto, top: 0, bottom: 0, left: 0, right: 0, apply: :app_color,
479
489
  category: :application })
480
490
  main_app.remove(:box_color)
481
491
  main_app.instance_variable_set('@pages', {})
492
+ main_app.role(:application)
493
+
494
+ menu = buttons({
495
+ id: "#{id_f}_menu",
496
+ attach: id_f,
497
+ inactive: { text: { color: :gray }, width: 66, height: 12, spacing: 3, disposition: :horizontal,
498
+ color: :orange, margin: { left: 33, top: 12 } },
499
+ active: { text: { color: :white, shadow: {} }, color: :blue, shadow: {} },
500
+ })
501
+ main_app.define_singleton_method(:menu) do
502
+ menu
503
+ end
504
+ main_app.define_singleton_method(:pages) do
505
+ @pages
506
+ end
507
+
508
+ main_app.define_singleton_method(:insert) do |bloc_to_add|
509
+ bloc_to_add.each do |page_id, params_f|
510
+ params_f.each do |block_id, block_content|
511
+ @pages[page_id][:blocks] ||= {}
512
+ @pages[page_id][:blocks][block_id.to_sym] = block_content
513
+ end
514
+ @blocks ||= {}
515
+ @blocks[page_id] = @pages[page_id][:blocks]
516
+ end
517
+
518
+ end
519
+ main_app.define_singleton_method(:extract) do |bloc_to_extract|
520
+ bloc_to_extract.each do |page_id, block_id|
521
+ @blocks[page_id].delete(block_id)
522
+ end
523
+
524
+ end
525
+
526
+ main_app.define_singleton_method(:blocks) do
527
+ @blocks
528
+ end
529
+ main_app.define_singleton_method(:margin) do
530
+ @margin = params[:margin]
531
+ end
532
+ main_app.define_singleton_method(:spacing) do
533
+ @spacing = params[:spacing]
534
+ end
482
535
 
483
- buttons({
484
- id: "#{id_f}_menu",
485
- attach: id_f,
486
- inactive: { text: { color: :gray }, width: 66, height: 12, spacing: 3, disposition: :horizontal,
487
- color: :orange, margin: { left: 33, top: 12 } },
488
- active: { text: { color: :white, shadow: {} }, color: :blue, shadow: {} },
489
- })
490
536
  main_app
491
537
  end
492
538
 
493
- new(molecule: :page) do |params, &bloc|
539
+ new(molecule: :page) do |params = nil, &bloc|
494
540
  allow_menu = params.delete(:menu)
495
541
  if params[:id]
496
542
  id_f = params.delete(:id)
@@ -510,35 +556,44 @@ new(molecule: :page) do |params, &bloc|
510
556
  code: item_code
511
557
  } })
512
558
  actor({ "#{@id}_menu_item_#{page_name}" => :buttons })
513
- menu_f.role([:button])
514
559
  end
515
560
  end
516
561
 
517
562
  new(molecule: :show) do |page_id, &bloc|
563
+
518
564
  params = @pages[page_id.to_sym]
519
565
  params ||= {}
520
566
  footer = params.delete(:footer)
521
567
  header = params.delete(:header)
522
568
  left_side_bar = params.delete(:left_side_bar)
523
569
  right_side_bar = params.delete(:right_side_bar)
524
- # modules = params.delete(:modules)
525
570
  basic_size = 30
526
571
  fasten.each do |page_id_found|
527
572
  page_found = grab(page_id_found)
528
- page_found.delete({ recursive: true }) if page_found && page_found.category.include?(:page)
573
+ page_found.delete({ recursive: true }) if page_found&.category&.include?(:page)
529
574
  end
530
575
  color({ id: :page_color, red: 0.1, green: 0.1, blue: 0.1 })
531
- # TODO : remove the patch below when possible
532
- id_f = if params[:id]
533
- params.delete(:id)
534
- else
535
- "#{id_f}_#{identity_generator}"
536
- end
576
+
577
+ id_f = "#{id}_content"
537
578
  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 })
538
579
  main_page.remove(:box_color)
539
580
 
540
- main_page.set(params)
581
+ new_page = main_page.box({ width: '100%', height: '100%', top: 0, left: 0, id: page_id })
582
+
583
+ # now looking for associated blocks
584
+ blocks_found = params[:blocks]
585
+ @prev_bloc_height = 0
586
+ blocks_found&.each_with_index do |(bloc_id, bloc_content), index|
587
+
588
+ new_bloc = new_page.box({ id: bloc_id, width: '100%', height: 99, top: spacing + @prev_bloc_height, bottom: 0, left: 0, right: 0 })
589
+ new_bloc.set(bloc_content)
590
+ @prev_bloc_height = @prev_bloc_height + new_bloc.height + spacing
591
+ end
541
592
 
593
+ keys_to_exclude = [:blocks]
594
+ particles_to_apply = params.reject { |key, _| keys_to_exclude.include?(key) }
595
+
596
+ new_page.set(particles_to_apply)
542
597
  if footer
543
598
  new_footer = box({ left: 0, depth: -1, right: 0, width: :auto, top: :auto, bottom: 0, height: basic_size, category: :footer, id: "#{id_f}_footer" })
544
599
  new_footer.remove(:box_color)
@@ -577,23 +632,15 @@ new(molecule: :show) do |page_id, &bloc|
577
632
  if item_found&.category&.include?(:right_side_bar)
578
633
  main_page.width(:auto)
579
634
  main_page.left(item_found.width)
580
- if footer
581
- grab("#{id_f}_footer").right(basic_size)
582
- end
583
- if header
584
- grab("#{id_f}_header").right(basic_size)
585
- end
635
+ grab("#{id_f}_footer").right(basic_size) if footer
636
+ grab("#{id_f}_header").right(basic_size) if header
586
637
  end
587
638
 
588
639
  if item_found&.category&.include?(:left_side_bar)
589
640
  main_page.width(:auto)
590
641
  main_page.right(item_found.width)
591
- if footer
592
- grab("#{id_f}_footer").left(basic_size)
593
- end
594
- if header
595
- grab("#{id_f}_header").left(basic_size)
596
- end
642
+ grab("#{id_f}_footer").left(basic_size) if footer
643
+ grab("#{id_f}_header").left(basic_size) if header
597
644
  end
598
645
  end
599
646
  main_page
@@ -604,8 +651,8 @@ new(molecule: :buttons) do |params, &bloc|
604
651
  actor_f = params.delete(:actor)
605
652
  params_saf = deep_copy(params)
606
653
  context = params.delete(:attach) || :view
607
- id = params.delete(:id) || identity_generator
608
- main = grab(context).box({ id: id })
654
+ id_f = params.delete(:id) || identity_generator
655
+ main = grab(context).box({ id: id_f })
609
656
  main.role(role_f) || main.role(:buttons)
610
657
  main.actor(actor_f) if actor_f
611
658
  main.color({ blue: 0.5, red: 1, green: 1, alpha: 0 })
@@ -615,7 +662,6 @@ new(molecule: :buttons) do |params, &bloc|
615
662
  default_text = default.delete(:text)
616
663
  main.data[:default_text] = default_text
617
664
  active = params.delete(:active) || {}
618
- active_text = active.delete(:text)
619
665
  inactive = {}
620
666
  active.each_key do |part_f|
621
667
  inactive[part_f] = default[part_f]
@@ -624,12 +670,10 @@ new(molecule: :buttons) do |params, &bloc|
624
670
  active.each_key do |part_f|
625
671
  inactive_text[part_f] = default_text[part_f]
626
672
  end
627
-
628
673
  params.each_with_index do |(item_id, part_f), index|
629
674
  label = part_f[:text]
630
675
  code = part_f[:code]
631
676
  main.create_new_button(item_id, index, label, code)
632
-
633
677
  end
634
678
  main
635
679
 
@@ -4,7 +4,6 @@ require 'extensions/object'
4
4
  require 'extensions/js'
5
5
  require 'extensions/geolocation'
6
6
  require 'extensions/ping'
7
- require 'extensions/sha'
8
7
  require 'extensions/color'
9
8
  require 'native'
10
9
  require 'promise'
@@ -3,11 +3,6 @@
3
3
  # rgb utility
4
4
  class Atome
5
5
  def rgb_html(string)
6
- # `
7
- # col = w3color(#{string});
8
- # rgb_col=col.toRgb();
9
- # return Opal.hash(rgb_col)
10
- # `
11
6
  js_code = <<-JS
12
7
  var col = w3color('#{string}');
13
8
  var rgb_col = col.toRgb();
@@ -2,13 +2,13 @@
2
2
 
3
3
  class Atome
4
4
  def geolocation
5
- localisation = {latitude: nil, longitude: nil}
5
+ localisation = { latitude: nil, longitude: nil }
6
6
  $window.navigator.geolocate.then do |pos|
7
- localisation[:latitude] = pos.coords.latitude
8
- localisation[:longitude] = pos.coords.longitude
7
+ localisation[:latitude] = pos.coords.latitude
8
+ localisation[:longitude] = pos.coords.longitude
9
9
  end.rescue do |err|
10
- p err
11
- localisation = nil
10
+ p err
11
+ nil
12
12
  end
13
13
  end
14
14
  end
@@ -4,28 +4,19 @@
4
4
  class Atome
5
5
  def ping(my_proc = false)
6
6
  instance_exec(my_proc) if my_proc.is_a?(Proc)
7
- # ` var p = new Ping();
8
- # p.ping('https://'+#{address}+'', function (err, data) {
9
- # if (err) {
10
- # return false;
11
- # } else {
12
- # console.log("the site "+#{address}+" is up!");
13
- # }
14
- # });
15
- # `
16
- js_code = <<-JS
17
- var p = new Ping();
18
- p.ping('https://' + "#{address}" + '', function (err, data) {
19
- if (err) {
20
- return false;
21
- } else {
22
- console.log("the site " + "#{address}" + " is up!");
23
- }
24
- });
25
- JS
7
+
8
+ js_code = <<~JS
9
+ var p = new Ping();
10
+ p.ping('https://' + "#{address}" + '', function (err, data) {
11
+ if (err) {
12
+ return false;
13
+ } else {
14
+ console.log("the site " + "#{address}" + " is up!");
15
+ }
16
+ });
17
+ JS
26
18
 
27
19
  # Exécute le code JavaScript
28
20
  JS.eval(js_code)
29
-
30
21
  end
31
22
  end
@@ -28,7 +28,6 @@ new({ renderer: :html, method: :blur, type: :integer }) do |params, _user_proc|
28
28
  end
29
29
  end
30
30
 
31
-
32
31
  new({ renderer: :html, method: :blur, type: :integer, specific: :shadow }) do |params, _user_proc|
33
32
  if params[:affect] == :back
34
33
  html.backdropFilter(:blur, "#{params[:value]}px")
@@ -39,13 +38,3 @@ new({ renderer: :html, method: :blur, type: :integer, specific: :shadow }) do |p
39
38
  affect(affect)
40
39
  end
41
40
 
42
- # new({ particle: :blur, category: :effect, type: :int , specific: :shadow}) do |params|
43
- # alert :cool
44
- # if affect.nil?
45
- # affect_to = affect
46
- # else
47
- # affect_to = [:self]
48
- # end
49
- # val= { value: params, affect: affect_to } unless params.instance_of?(Hash)
50
- # val
51
- # end
@@ -1,13 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  new({ method: :drag, type: :symbol, renderer: :html }) do |params|
4
- # if @drag
5
- # option = @drag[params]
6
- # else
7
- # params = :remove
8
- # option = true
9
- # end
10
- # html.event(:drag, params, option)
11
4
 
12
5
  if params
13
6
  option = @drag[params]