atome 0.5.6.4.0 → 0.5.6.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 155b40eec80fff72a131cbe7477280a2b199e36f443f55d754eb740277af3925
4
- data.tar.gz: 252b75fca3bcef7e79d5e0b0d91b38fa1f13dbac75facc46e69807277c325c10
3
+ metadata.gz: be5a4e028a94d97ed9c98c222aadee8ff85e4be1e2e920c68cf3004dd7e1d0ee
4
+ data.tar.gz: 771096cb369eaed0fcc571e174e5c3b772b88fb227e4a3df8c34487530923a5c
5
5
  SHA512:
6
- metadata.gz: 762b8f9035bc10f086d5686f7986f230d8ea37760d99585370462265c5baac244e1ba9cede31b4b194491f7d92fc6779df267e72e1e965909603599a20bf444a
7
- data.tar.gz: aabaf5a1ee343093b1f89b0991296567a01e60ec2170cf2d6f2c52c1b8e7f603b57f131bddd13407b068f687a5f35cdb1e4b98aeda03f5058b49f77ea67515c1
6
+ metadata.gz: 01fb8cb48f2cf2c4a5be2001dc2db338f9a9f1792c96d81760226384936f675b0fc67338647ccdfcec459158a801a8c498149a01c8d27859f8c0ead10eb63507
7
+ data.tar.gz: f7d499f608aef58e19148e435e6fa57b16a6aaa72e6bbb0f34a993571327950281540dd1e67822025cd858a3d05fbac861c55c31c67fdd1b54bb8a94ccc22539
@@ -2,6 +2,14 @@
2
2
 
3
3
  new({ atome: :color, type: :hash })
4
4
 
5
+ # new({ post: :color }) do |params|
6
+ # puts "====> #{params}"
7
+ # params
8
+ # end
9
+ # new({ pre: :color}) do |params|
10
+ # alert "==> pre color params : #{params}"
11
+ # end
12
+
5
13
  # new({ atome: :color, type: :hash })do |params|
6
14
  # puts "1 #{params}______"
7
15
  # params
@@ -14,7 +22,11 @@ new({ atome: :color, type: :hash })
14
22
  # # end
15
23
  # end
16
24
  new({ sanitizer: :color }) do |params|
25
+ # alert "sanitizer color: #{params}"
17
26
  params = create_color_hash(params) unless params.instance_of? Hash
27
+ # if params[:id]
28
+ # alert "id is #{params[:id]}"
29
+ # end
18
30
  # the condition below is to prevent the creation of multiple unwanted colors with same property and no ID specified
19
31
  unless params[:id]
20
32
  uniq_value = "#{params[:red].to_s.sub('.', '_')}_#{params[:green].to_s.sub('.', '_')}_#{params[:blue].to_s.sub('.', '_')}_#{params[:alpha].to_s.sub('.', '_')}_#{params[:left].to_s.sub('.', '_')}_#{params[:top].to_s.sub('.', '_')}_#{params[:diffusion].to_s.sub('.', '_')}"
@@ -177,7 +177,11 @@ class Genesis
177
177
 
178
178
  if Universe.atomes[params[:id]]
179
179
  # if atome id already exist we grab the previous one
180
- grab(params[:id])
180
+ # this prevent the creation of new atome if the atome already exist
181
+ previous_atome= grab(params[:id])
182
+ # now we must re-affect affected atomes
183
+ previous_atome.affect(params[:affect])
184
+ previous_atome
181
185
  else
182
186
  Atome.new(params, &user_proc)
183
187
  end
@@ -52,7 +52,6 @@ end
52
52
  new({ particle: :apply, category: :hierarchy, type: :string, render: false, store: false }) do |parents_ids, &user_proc|
53
53
  # TODO: optimize the 2 lines below:
54
54
  # html.reset_background
55
- # alert :ok
56
55
  @apply ||= []
57
56
  parents_ids = [parents_ids] unless parents_ids.instance_of?(Array)
58
57
  parents_ids.each do |parent_id|
@@ -12,19 +12,35 @@ end
12
12
  new({ particle: :hide, category: :material, type: :boolean })
13
13
 
14
14
  new({ particle: :remove, category: :property, type: :hash }) do |params|
15
+ if params.instance_of? Hash
16
+ if params[:row]
17
+ data.delete_at(params[:row])
15
18
 
16
- if params[:row]
17
- data.delete_at(params[:row])
18
-
19
- elsif params[:column]
20
- column = params[:column]
21
- data.map do |hash|
22
- hash.delete(hash.keys[column]) if hash.keys[column]
23
- hash
19
+ elsif params[:column]
20
+ column = params[:column]
21
+ data.map do |hash|
22
+ hash.delete(hash.keys[column]) if hash.keys[column]
23
+ hash
24
+ end
25
+ # elsif params[:all]
26
+ # apply.each do |applied_atome|
27
+ # if grab(applied_atome).type.to_sym == params[:all].to_sym
28
+ # puts "!go"
29
+ # end
30
+ # end
31
+ # puts "so_good #{params}"
32
+ # puts "***> #{apply}"
24
33
  end
34
+ params
35
+ else
36
+
37
+ params
25
38
  end
26
- params
39
+
40
+
27
41
  end
42
+ # new({ particle: :remove, category: :property, type: :hash })
43
+
28
44
 
29
45
  new({ post: :remove }) do |params|
30
46
  # TODO : we have to rethink the removal of atome and particles (with exception like category) and maybe 'use particle type' to handle removal
@@ -38,13 +54,17 @@ new({ post: :remove }) do |params|
38
54
  paint.each do |atome_id_found|
39
55
  @apply.delete(atome_id_found)
40
56
  end
57
+ when :shadow
58
+ shadow.each do |atome_id_found|
59
+ @apply.delete(atome_id_found)
60
+ end
41
61
  else
42
62
  params.each do |particle, value|
43
63
  case particle
44
64
  when :category
45
65
  @category.delete(value) if particle == :category
46
66
  else
47
- puts 'write code'
67
+ puts 'write code to remove atome applied'
48
68
  end
49
69
  end
50
70
 
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.0'
5
+ VERSION = '0.5.6.4.1'
6
6
  end
@@ -210,8 +210,8 @@ class HTML
210
210
  end
211
211
 
212
212
  def connect(params, &bloc)
213
- type= params[:type]
214
- server= params[:address]
213
+ type = params[:type]
214
+ server = params[:address]
215
215
  # user=params[:user]
216
216
  # pass=params[:pass]
217
217
  # atomes=params[:atomes]
@@ -1401,72 +1401,136 @@ class HTML
1401
1401
 
1402
1402
  end
1403
1403
 
1404
- def table_remove(params)
1405
- if params[:row]
1406
- row_index = params[:row]
1407
- table_element = JS.global[:document].querySelector("##{@id} table")
1408
-
1409
- if table_element.nil?
1410
- puts 'Table not found'
1411
- return
1412
- end
1404
+ def remove(params)
1405
+ # puts "remove => #{params}"
1406
+ # TODO: FIXME: "html : must create a case here #{params} (#{@original_atome.id})"
1407
+ case params
1408
+ when Hash
1409
+ params.each do |k, v|
1410
+ case k
1411
+ when :row
1412
+ row_index = params[:row]
1413
+ table_element = JS.global[:document].querySelector("##{@id} table")
1414
+
1415
+ if table_element.nil?
1416
+ puts 'Table not found'
1417
+ return
1418
+ end
1413
1419
 
1414
- rows = table_element.querySelectorAll('tbody tr').to_a
1420
+ rows = table_element.querySelectorAll('tbody tr').to_a
1415
1421
 
1416
- if row_index >= rows.length
1417
- puts "row not found : #{row_index}"
1418
- return
1419
- end
1420
- row_to_remove = rows[row_index]
1422
+ if row_index >= rows.length
1423
+ puts "row not found : #{row_index}"
1424
+ return
1425
+ end
1426
+ row_to_remove = rows[row_index]
1421
1427
 
1422
- row_to_remove[:parentNode].removeChild(row_to_remove)
1428
+ row_to_remove[:parentNode].removeChild(row_to_remove)
1423
1429
 
1424
- rows.each_with_index do |row, i|
1425
- next if i <= row_index
1426
- end
1427
- elsif params[:column]
1428
- column_index = params[:column]
1429
- table_element = JS.global[:document].querySelector("##{@id} table")
1430
+ rows.each_with_index do |row, i|
1431
+ next if i <= row_index
1432
+ end
1433
+ when :column
1434
+ column_index = params[:column]
1435
+ table_element = JS.global[:document].querySelector("##{@id} table")
1430
1436
 
1431
- if table_element.nil?
1432
- puts 'Table not found'
1433
- return
1434
- end
1437
+ if table_element.nil?
1438
+ puts 'Table not found'
1439
+ return
1440
+ end
1435
1441
 
1436
- rows = table_element.querySelectorAll('tbody tr').to_a
1437
- rows.each do |row|
1438
- cells = row.querySelectorAll('td').to_a
1439
- if column_index < cells.length
1440
- cell_to_remove = cells[column_index]
1441
- cell_to_remove[:parentNode].removeChild(cell_to_remove)
1442
+ rows = table_element.querySelectorAll('tbody tr').to_a
1443
+ rows.each do |row|
1444
+ cells = row.querySelectorAll('td').to_a
1445
+ if column_index < cells.length
1446
+ cell_to_remove = cells[column_index]
1447
+ cell_to_remove[:parentNode].removeChild(cell_to_remove)
1448
+ end
1449
+ end
1450
+ when :all
1451
+ case v
1452
+ when :paint
1453
+ style(:background, 'black')
1454
+ # style('box-shadow', 'none')
1455
+ # style('text-shadow', 'none')
1456
+ when :color
1457
+ when :shadow
1458
+ style('box-shadow', 'none')
1459
+ style('text-shadow', 'none')
1460
+ end
1442
1461
  end
1443
1462
  end
1444
-
1445
- end
1446
- end
1447
-
1448
- def reset_background
1449
- style(:background, 'black')
1450
- end
1451
-
1452
- def remove(params)
1453
- #TODO: FIXME: "html : must create a case here #{params} (#{@original_atome.id})"
1454
-
1455
- # puts @original_atome.color[0]
1456
-
1457
- reset_background
1463
+ else
1464
+ @original_atome.apply.delete(params)
1465
+ style(:background, 'black')
1466
+ style('box-shadow', 'none')
1467
+ style('text-shadow', 'none')
1468
+ @original_atome.apply(@original_atome.apply)
1469
+ end
1470
+ # alert "remove : #{params} , type: #{@original_atome.type}"
1471
+ # reset_background
1458
1472
  # style(:background, '')
1459
1473
  # style(:background, 'black')
1460
1474
  # @original_atome.color(:red)
1461
1475
  # @original_atome.apply(@original_atome.color[0])
1462
1476
  end
1477
+
1478
+ def table_remove(params)
1479
+ if params[:row]
1480
+ # row_index = params[:row]
1481
+ # table_element = JS.global[:document].querySelector("##{@id} table")
1482
+ #
1483
+ # if table_element.nil?
1484
+ # puts 'Table not found'
1485
+ # return
1486
+ # end
1487
+ #
1488
+ # rows = table_element.querySelectorAll('tbody tr').to_a
1489
+ #
1490
+ # if row_index >= rows.length
1491
+ # puts "row not found : #{row_index}"
1492
+ # return
1493
+ # end
1494
+ # row_to_remove = rows[row_index]
1495
+ #
1496
+ # row_to_remove[:parentNode].removeChild(row_to_remove)
1497
+ #
1498
+ # rows.each_with_index do |row, i|
1499
+ # next if i <= row_index
1500
+ # end
1501
+ elsif params[:column]
1502
+ # column_index = params[:column]
1503
+ # table_element = JS.global[:document].querySelector("##{@id} table")
1504
+ #
1505
+ # if table_element.nil?
1506
+ # puts 'Table not found'
1507
+ # return
1508
+ # end
1509
+ #
1510
+ # rows = table_element.querySelectorAll('tbody tr').to_a
1511
+ # rows.each do |row|
1512
+ # cells = row.querySelectorAll('td').to_a
1513
+ # if column_index < cells.length
1514
+ # cell_to_remove = cells[column_index]
1515
+ # cell_to_remove[:parentNode].removeChild(cell_to_remove)
1516
+ # end
1517
+ # end
1518
+
1519
+ end
1520
+ end
1521
+
1522
+ # def reset_background
1523
+ # style(:background, 'black')
1524
+ # style('box-shadow', 'none')
1525
+ # style('text-shadow', 'none')
1526
+ # end
1527
+
1463
1528
  # atomisation!
1464
1529
  def atomized(html_object)
1465
1530
  html_object = html_object[0] if html_object.instance_of? Array
1466
1531
  @element = html_object
1467
1532
  end
1468
1533
 
1469
-
1470
1534
  # def center(options, attach)
1471
1535
  # parent = grab(attach)
1472
1536
  #
@@ -59,7 +59,8 @@ new({ method: :insert, renderer: :html, type: :hash }) do |params|
59
59
  end
60
60
 
61
61
  new({ method: :remove, renderer: :html, type: :hash }) do |params|
62
- html.table_remove(params)
62
+ # alert "===> #{params}"
63
+ # html.table_remove(params)
63
64
  html.remove(params)
64
65
  end
65
66
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
 
4
- col=color({red: 1, blue: 1, id: :the_col})
4
+ col=color({red: 1, green: 0.2, id: :the_col})
5
5
  c=circle
6
6
  b=box({left: 333})
7
7
  c2=circle({top: 190, width: 99, height: 99})
@@ -10,7 +10,7 @@ c2.border({ thickness: 5, color: :blue, pattern: :dotted })
10
10
  c.border({ thickness: 5, color: col, pattern: :dotted })
11
11
  b.border({ thickness: 5, color: col, pattern: :dotted })
12
12
 
13
- wait 3 do
13
+ wait 1 do
14
14
  c2.border({ thickness: 5, color: :green, pattern: :dotted })
15
15
  c.border({ thickness: 5, color: :green, pattern: :dotted })
16
16
  b.border({ thickness: 5, color: :green, pattern: :dotted })
@@ -19,7 +19,7 @@ end
19
19
  b.touch(true) do
20
20
 
21
21
  b.border({ thickness: 5, color: { red: 1, green: 0 }, pattern: :dotted })
22
-
22
+ puts " no new atome added!, number of atomes: #{Universe.atomes.length}"
23
23
  end
24
24
  # wait 6 do
25
25
  # iamge(:red_planet)
@@ -2,15 +2,23 @@
2
2
 
3
3
  b = box()
4
4
  b.text('click me')
5
-
5
+ orange=''
6
6
  b.touch(true) do
7
- c = grab(:view).circle({id: :circling, left: 222, color: :orange, blur: 6 })
8
- c.box({id: :boxing,color: :orange, width: 33, height: 33, left: 123})
9
- c.box({id: :boxy,color: :red, width: 33, height: 33, left: 333})
7
+ c = grab(:view).circle({id: :circling, left: 222, color: :orange, blur: 1.9 })
8
+ orange=c.box({id: :boxing,color: {id: :orange_col, red: 1, blue: 0.2 }, width: 33, height: 33, left: 123})
9
+ orange.shadow({
10
+ id: :s1,
11
+ # affect: [:the_circle],
12
+ left: 9, top: 3, blur: 9,
13
+ invert: false,
14
+ red: 0, green: 0, blue: 0, alpha: 1
15
+ })
16
+ c.box({id: :boxy,color: {id: :red_col, red: 1 }, width: 33, height: 33, left: 333})
10
17
  c.text('tap here')
11
18
  wait 0.5 do
12
19
  c.delete(:left)
13
20
  wait 0.5 do
21
+ # orange.color(:pink)
14
22
  c.delete(:blur)
15
23
  end
16
24
  end
@@ -18,8 +26,12 @@ b.touch(true) do
18
26
  c.touch(true) do
19
27
  c.delete({ recursive: true })
20
28
  end
29
+ # alert orange.apply
21
30
  end
22
31
 
32
+
33
+
34
+
23
35
  ############
24
36
  # b = box({left: 333, id: :the_box_1})
25
37
  # b.color({id: :the_orange_col, red: 1, blue: 0.5})
@@ -14,22 +14,34 @@ b.shadow({
14
14
  invert: false,
15
15
  red: 0, green: 0, blue: 0, alpha: 1
16
16
  })
17
+
18
+
17
19
  wait 1 do
18
20
  b.remove(:other_col)
19
21
  wait 1 do
20
22
  b.remove(:new_col)
21
23
  wait 1 do
22
24
  b.remove(:box_color)
25
+
23
26
  wait 1 do
24
27
  b.apply(:last_col)
25
28
  wait 1 do
26
29
  b.apply(:last_col2)
30
+ b.remove(:s1)
27
31
  end
28
32
  end
29
33
  end
30
34
  end
31
35
  end
32
36
  b.touch(true) do
37
+ b.shadow({
38
+ id: :s1,
39
+ # affect: [:the_circle],
40
+ left: 9, top: 3, blur: 9,
41
+ invert: false,
42
+ red: 0, green: 0, blue: 0, alpha: 1
43
+ })
44
+
33
45
  puts "before => #{b.apply}"
34
46
  b.remove({all: :color})
35
47
  puts "after => #{b.apply}"
@@ -40,6 +52,7 @@ b.touch(true) do
40
52
  b.remove(:the_gradient)
41
53
  wait 1 do
42
54
  b.remove(all: :shadow)
55
+ b.color(:cyan)
43
56
  end
44
57
  end
45
58
  end
@@ -7,7 +7,7 @@ c.touch(true) do
7
7
  alert :okk
8
8
  end
9
9
  m = matrix({ renderers: [:html], attach: :view, id: :my_test_box, type: :matrix, apply: [:shape_color],
10
- left: 333, top: 0, width: 600, smooth: 15, height: 900, overflow: :scroll, option: { header: true },
10
+ left: 333, top: 0, width: 900, smooth: 15, height: 900, overflow: :scroll, option: { header: true },
11
11
  component: {
12
12
  border: { thickness: 5, color: color(:blue), pattern: :dotted },
13
13
  overflow: :auto,
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.6.4.0
4
+ version: 0.5.6.4.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-02-28 00:00:00.000000000 Z
11
+ date: 2024-02-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: artoo