atome 0.5.6.4.1 → 0.5.6.4.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be5a4e028a94d97ed9c98c222aadee8ff85e4be1e2e920c68cf3004dd7e1d0ee
4
- data.tar.gz: 771096cb369eaed0fcc571e174e5c3b772b88fb227e4a3df8c34487530923a5c
3
+ metadata.gz: b69a163445e2951c51c54eb1b65684a98173f755e39df75e7d481d74c745174b
4
+ data.tar.gz: 3fd395704a55b4944f183a596bd1decabc72cedff93f79bfb35efe7782d202d0
5
5
  SHA512:
6
- metadata.gz: 01fb8cb48f2cf2c4a5be2001dc2db338f9a9f1792c96d81760226384936f675b0fc67338647ccdfcec459158a801a8c498149a01c8d27859f8c0ead10eb63507
7
- data.tar.gz: f7d499f608aef58e19148e435e6fa57b16a6aaa72e6bbb0f34a993571327950281540dd1e67822025cd858a3d05fbac861c55c31c67fdd1b54bb8a94ccc22539
6
+ metadata.gz: a743dc6eee1c2f35c15a2b839c0eadb11b27c0829c2ac38fa281cf252a27066673509ea95d932e940f3a8997ccf92737f150033042a46b4a16b3a33bee303780
7
+ data.tar.gz: 480441e90a518f5172dc60c82ea18331dfb95f828bb1e870654690848447e211824ab9fbe32abc5c07717d78375b1b200a7f3f74f66a6590b7fd5c78df209481
data/Rakefile CHANGED
@@ -183,17 +183,17 @@ task :test_server_wasm do
183
183
  threads << Thread.new do
184
184
 
185
185
  sleep 1
186
+ timestamp=Time.now.strftime("%Y%m%d%H%M%S")
186
187
  if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
187
188
  # code to exec for Windows
188
- `start http://localhost:9292`
189
+ `start http://localhost:9292?date=#{timestamp}`
189
190
  # `start #{destination}\\#{project_name}\\src\\index_server.html`
190
-
191
191
  elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
192
192
  # code to exec for MacOS
193
- `open http://localhost:9292`
193
+ `open http://localhost:9292?date=#{timestamp}`
194
194
  else
195
195
  # code to exec for Unix/Linux
196
- `open http://localhost:9292`
196
+ `open http://localhost:9292?date=#{timestamp}`
197
197
  end
198
198
 
199
199
  end
@@ -225,17 +225,19 @@ task :test_server do
225
225
  threads << Thread.new do
226
226
 
227
227
  sleep 1
228
+ timestamp=Time.now.strftime("%Y%m%d%H%M%S")
229
+
228
230
  if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
229
231
  # code to exec for Windows
230
- `start http://localhost:9292`
232
+ `start http://localhost:9292?date=#{timestamp}`
231
233
  # `start #{destination}\\#{project_name}\\src\\index_server.html`
232
234
 
233
235
  elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
234
236
  # code to exec for MacOS
235
- `open http://localhost:9292`
237
+ `open http://localhost:9292?date=#{timestamp}`
236
238
  else
237
239
  # code to exec for Unix/Linux
238
- `open http://localhost:9292`
240
+ `open http://localhost:9292?date=#{timestamp}`
239
241
  end
240
242
 
241
243
  end
@@ -268,17 +270,18 @@ task :opal_server_rebuild do
268
270
  threads << Thread.new do
269
271
 
270
272
  sleep 1
273
+ timestamp=Time.now.strftime("%Y%m%d%H%M%S")
271
274
  if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
272
275
  # code to exec for Windows
273
- `start http://localhost:9292`
276
+ `start http://localhost:9292?date=#{timestamp}`
274
277
  # `start #{destination}\\#{project_name}\\src\\index_server.html`
275
278
 
276
279
  elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
277
280
  # code to exec for MacOS
278
- `open http://localhost:9292`
281
+ `open http://localhost:9292?date=#{timestamp}`
279
282
  else
280
283
  # code to exec for Unix/Linux
281
- `open http://localhost:9292`
284
+ `open http://localhost:9292?date=#{timestamp}`
282
285
  end
283
286
 
284
287
  end
@@ -372,6 +375,10 @@ end
372
375
 
373
376
  def gem_builder
374
377
  # building the gem
378
+ dossier = './pkg'
379
+
380
+ # we cleanup pkg folder content
381
+ FileUtils.rm_rf(Dir.glob("#{dossier}/*"))
375
382
  `rake build` # run build_app thru ARGV in exe atome
376
383
  # installing the gem
377
384
  if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
data/exe/atome CHANGED
@@ -826,16 +826,18 @@ else
826
826
  if ARGV.include?('server_refresh')
827
827
  puts 're building Server'
828
828
  build_opal_application(nil, destination, project_name)
829
+ timestamp=Time.now.strftime("%Y%m%d%H%M%S")
830
+
829
831
  if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
830
832
  # code to exec with Windows
831
833
  # `start #{destination}\\#{project_name}\\src\\index_server.html`
832
- `start http://localhost:9292`
834
+ `start http://localhost:9292?date=#{timestamp}`
833
835
  elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
834
836
  # code to exec with MacOS
835
- `open http://localhost:9292`
837
+ `open http://localhost:9292?date=#{timestamp}`
836
838
  else
837
839
  # code to exec with Unix/Linux
838
- `open http://localhost:9292`
840
+ `open http://localhost:9292?date=#{timestamp}`
839
841
  end
840
842
  end
841
843
 
data/lib/atome/atome.rb CHANGED
@@ -29,12 +29,13 @@ class Atome
29
29
  @tag = {}
30
30
  @selected = false
31
31
  #@metrics = {}
32
- @unit = {}
32
+ @unit = {}
33
+ @apply = []
33
34
  @collect = {}
34
35
  @collect = {}
35
36
  @int8= {}
36
37
  @css = {}
37
- @aid = identity_generator(:a)
38
+ @aid = identity_generator
38
39
  Universe.add_to_atomes( @aid, self)
39
40
  @id = new_atome[:id] || @aid
40
41
  Universe.id_to_aid(@id,@aid)
@@ -119,8 +119,9 @@ class Object
119
119
  grab(:view).delete(atomes)
120
120
  end
121
121
 
122
- def identity_generator(type_needed = :element)
123
- "#{type_needed}_#{Universe.counter}".to_sym
122
+ def identity_generator
123
+
124
+ "#{Universe.app_identity}_#{Universe.counter}".to_sym
124
125
  end
125
126
 
126
127
  def hook(a_id)
@@ -152,14 +152,17 @@ class Genesis
152
152
  # then add condition same things fo code in presets/atome atome_common
153
153
  if %i[color shadow paint].include?(element)
154
154
  # we do the same for apply to be able to retrieve 'color' and other atome that apply instead of being attached
155
- apply.each do |attached_atome|
155
+ @apply.each do |attached_atome|
156
156
  collected_atomes << attached_atome if grab(attached_atome).type.to_sym == element.to_sym
157
157
  end
158
158
  else
159
159
  # collected_atomes = attached
160
- attached.each do |attached_atome|
161
- collected_atomes << attached_atome if grab(attached_atome).type.to_sym == element.to_sym
162
- end
160
+ # if @attached
161
+ attached.each do |attached_atome|
162
+ collected_atomes << attached_atome if grab(attached_atome).type.to_sym == element.to_sym
163
+ end
164
+ # end
165
+
163
166
  end
164
167
  # TODO/ FIXME : potential problem with group here"
165
168
  # group({ collect: collected_atomes })
@@ -16,7 +16,7 @@ class Atome
16
16
 
17
17
  basic_params[:type] = preset_params[:type] || :element
18
18
  # basic_params[:aid] = identity_generator(:a)
19
- basic_params[:id] = params[:id]|| identity_generator(atome_preset)
19
+ basic_params[:id] = params[:id]|| identity_generator
20
20
  basic_params[:renderers] = @renderers || preset_params[:renderers]
21
21
  essential_params = basic_params.merge(preset_params)
22
22
  #
data/lib/atome/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  # return atome version
4
4
  class Atome
5
- VERSION = '0.5.6.4.1'
5
+ VERSION = '0.5.6.4.5'
6
6
  end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+
4
+ # aid is used to provide an unique and persistent id for any atome
5
+ b=box({ left: 12, id: :the_first_box })
6
+
7
+ puts " atome aid is : #{ b.aid}"
@@ -0,0 +1,141 @@
1
+ # frozen_string_literal: true
2
+
3
+ @current_matrix = ""
4
+
5
+ def matrix(id, horizontal_nb, vertical_nb, spacing, size)
6
+ view = grab(:view)
7
+ @current_matrix = group({ id: id })
8
+ @current_matrix.data({ spacing: spacing, size: size })
9
+ matrix_cells = []
10
+ total_spacing_x = spacing * (horizontal_nb + 1)
11
+ total_spacing_y = spacing * (vertical_nb + 1)
12
+ size_coefficient = size.end_with?('%') ? (size.to_f / 100) : size.to_f / view.to_px(:width)
13
+
14
+ view_width = view.to_px(:width)
15
+ view_height = view.to_px(:height)
16
+ if view_width > view_height
17
+ available_width = (view_height * size_coefficient) - total_spacing_x
18
+ available_height = (view_height * size_coefficient) - total_spacing_y
19
+ else
20
+ available_width = (view_width * size_coefficient) - total_spacing_x
21
+ available_height = (view_width * size_coefficient) - total_spacing_y
22
+ end
23
+ box_width = available_width / horizontal_nb
24
+ box_height = available_height / vertical_nb
25
+
26
+ vertical_nb.times do |y|
27
+ horizontal_nb.times do |x|
28
+ id_generated = "#{id}_#{x}_#{y}"
29
+ matrix_cells << id_generated
30
+ new_box = box({ id: id_generated })
31
+ new_box.width(box_width)
32
+ new_box.height(box_height)
33
+ new_box.left((box_width + spacing) * x + spacing)
34
+ new_box.top((box_height + spacing) * y + spacing)
35
+ end
36
+ end
37
+ @current_matrix.collect(matrix_cells)
38
+ end
39
+
40
+ matrix(:vie_0, 8, 8, 9, '69%')
41
+
42
+ def resize_matrix(current_matrix, new_width, new_height, spacing, size)
43
+ # matrix_group = grab(matrix_id)
44
+ total_spacing_x = spacing * (current_matrix.collect.length ** (0.5) + 1)
45
+ total_spacing_y = spacing * (current_matrix.collect.length ** (0.5) + 1)
46
+ size_coefficient = size.end_with?('%') ? (size.to_f / 100) : size.to_f / new_width
47
+
48
+ if new_width > new_height
49
+ available_width = (new_height * size_coefficient) - total_spacing_x
50
+ available_height = (new_height * size_coefficient) - total_spacing_y
51
+ else
52
+ available_width = (new_width * size_coefficient) - total_spacing_x
53
+ available_height = (new_width * size_coefficient) - total_spacing_y
54
+ end
55
+
56
+ box_width = available_width / current_matrix.collect.length ** (0.5)
57
+ box_height = available_height / current_matrix.collect.length ** (0.5)
58
+ current_matrix.collect.each_with_index do |box_id, index|
59
+ box = grab(box_id)
60
+ box.width(box_width)
61
+ box.height(box_height)
62
+ box.left((box_width + spacing) * (index % current_matrix.collect.length ** (0.5)) + spacing)
63
+ box.top((box_height + spacing) * (index / current_matrix.collect.length ** (0.5)).floor + spacing)
64
+ end
65
+ end
66
+
67
+ grab(:view).on(:resize) do |event|
68
+ new_event = Native(event)
69
+ new_width = new_event[:width].to_f
70
+ new_height = new_event[:height].to_f
71
+ matrix_spacing = @current_matrix.data[:spacing]
72
+ matrix_size = @current_matrix.data[:size]
73
+ resize_matrix(@current_matrix, new_width, new_height, matrix_spacing, matrix_size)
74
+ end
75
+ # alert grab(:vie_0).data
76
+ # wait 2 do
77
+
78
+ @current_matrix.color(:blue)
79
+ @current_matrix.smooth(6)
80
+ @current_matrix.shadow({
81
+ id: :s1,
82
+ # affect: [:the_circle],
83
+ left: 3, top: 3, blur: 6,
84
+ invert: false,
85
+ red: 0, green: 0, blue: 0, alpha: 0.6
86
+ })
87
+ ###################
88
+ col_1 = color(:yellow)
89
+ col_2 = color({ red: 1, id: :red_col })
90
+
91
+
92
+ # @current_matrix.paint({ gradient: [col_1.id, col_2.id], direction: :left })
93
+ @current_matrix.paint({ gradient: [col_1.id, col_2.id], direction: :top })
94
+
95
+
96
+ ###################
97
+
98
+
99
+ test_cell = grab(:vie_0_2_3)
100
+ wait 1 do
101
+ test_cell.color(:red)
102
+ end
103
+
104
+
105
+ module Molecule
106
+
107
+ def states(val = nil)
108
+ if val
109
+ else
110
+ end
111
+
112
+ end
113
+
114
+
115
+ def alternate(states = nil)
116
+ if states
117
+
118
+ else
119
+ @alternate
120
+ end
121
+
122
+ end
123
+ end
124
+
125
+ test_cell.touch(true) do
126
+ alert :ok
127
+ test_cell.alternate([{ width: 33, color: :red }, { width: 66, color: :orange }])
128
+ # puts "=> #{Universe.atomes.length}"
129
+ # puts test_cell.color
130
+ # if test_cell.data==true
131
+ # test_cell.data(false)
132
+ col_1 = color(:black)
133
+ test_cell.paint({ gradient: [col_1, col_1], direction: :left })
134
+ grab(:red_col).delete(true)
135
+ test_cell.color(:green)
136
+ # else
137
+ # test_cell.data(true)
138
+ # test_cell.color(:blue)
139
+ # end
140
+
141
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atome
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6.4.1
4
+ version: 0.5.6.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean-Eric Godard
@@ -514,6 +514,7 @@ files:
514
514
  - vendor/assets/Guardfile
515
515
  - vendor/assets/Rakefile
516
516
  - vendor/assets/application/examples/affect.rb
517
+ - vendor/assets/application/examples/aid.rb
517
518
  - vendor/assets/application/examples/animation.rb
518
519
  - vendor/assets/application/examples/apply.rb
519
520
  - vendor/assets/application/examples/atome.rb
@@ -574,6 +575,7 @@ files:
574
575
  - vendor/assets/application/examples/login.rb
575
576
  - vendor/assets/application/examples/markup.rb
576
577
  - vendor/assets/application/examples/match.rb
578
+ - vendor/assets/application/examples/matrix.rb
577
579
  - vendor/assets/application/examples/monitor.rb
578
580
  - vendor/assets/application/examples/on_resize.rb
579
581
  - vendor/assets/application/examples/on_the_fly_ruby_code_loading.rb