atome 0.5.6.4.5 → 0.5.6.4.8

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: b69a163445e2951c51c54eb1b65684a98173f755e39df75e7d481d74c745174b
4
- data.tar.gz: 3fd395704a55b4944f183a596bd1decabc72cedff93f79bfb35efe7782d202d0
3
+ metadata.gz: dc73dbaea0b164408d4656f53afb29c6f207d7a3a9238d7e0f017fee5d99c76a
4
+ data.tar.gz: 97860122c2abfec80d74880bd80e24d3c4fb2bab39661aaf3d97e7d6bc1528b3
5
5
  SHA512:
6
- metadata.gz: a743dc6eee1c2f35c15a2b839c0eadb11b27c0829c2ac38fa281cf252a27066673509ea95d932e940f3a8997ccf92737f150033042a46b4a16b3a33bee303780
7
- data.tar.gz: 480441e90a518f5172dc60c82ea18331dfb95f828bb1e870654690848447e211824ab9fbe32abc5c07717d78375b1b200a7f3f74f66a6590b7fd5c78df209481
6
+ metadata.gz: bd5524c4909dd4c276c9af722af86b5eaa1505f82ff6503737a5cd6e50e62009bb8be7e7cd82db7e482e7f18e7beb7e1339c2728fbb211f96060b60143f3e136
7
+ data.tar.gz: b485ea4522218c293c36f92e79caeb22fb9233e6146cbeb7271d9b328e2be809a86268871338bc49b4ba105352878f3d4ea99361cb7d41b122b46e37e2bb4fac
@@ -111,8 +111,8 @@ class Object
111
111
  ordered_part = ordered_keys.map { |k| [k, hash_to_reorder[k]] }.to_h
112
112
  other_part = hash_to_reorder.reject { |k, _| ordered_keys.include?(k) }
113
113
  # merge the parts to obtain an re-ordered hash
114
- reordered_hash = ordered_part.merge(other_part)
115
- reordered_hash
114
+ ordered_part.merge(other_part)
115
+ # reordered_hash
116
116
  end
117
117
 
118
118
  def delete (atomes)
@@ -120,8 +120,7 @@ class Object
120
120
  end
121
121
 
122
122
  def identity_generator
123
-
124
- "#{Universe.app_identity}_#{Universe.counter}".to_sym
123
+ "a_#{Universe.app_identity}_#{Universe.counter}".to_sym
125
124
  end
126
125
 
127
126
  def hook(a_id)
@@ -69,10 +69,23 @@ new({ sanitizer: :video }) do |params|
69
69
  end
70
70
  new({ atome: :www })
71
71
  new({ atome: :shadow }) do |params|
72
+ # if params
73
+ # if params.delete(:affect)
74
+ # attach_value = params.delete(:affect)
75
+ # else
76
+ # attach_value=id
77
+ # end
78
+ #
79
+ # params[:affect] = attach_value
80
+ # alert "=> params : #{params}"
81
+ #
82
+ # end
83
+
72
84
  if params
73
85
  attach_value = params.delete(:affect)
74
86
  params[:affect] = attach_value
75
87
  end
88
+ # alert "=> params : #{params}"
76
89
  params
77
90
  end
78
91
  new({ atome: :raw })
@@ -100,7 +100,7 @@ class Genesis
100
100
 
101
101
  # we historicize all write action below
102
102
  # we add the changes to the stack that must be synchronised
103
- Universe.historicize(@id, :write, element, params)
103
+ Universe.historicize(@aid, :write, element, params)
104
104
  computed_params
105
105
  elsif params || params == false
106
106
  "send a valid password to write #{element} value"
@@ -82,18 +82,14 @@ end
82
82
  new({ particle: :affect, category: :hierarchy, type: :string, render: false }) do |children_ids, &user_proc|
83
83
  children_ids = [children_ids] unless children_ids.instance_of? Array
84
84
  children_ids.each do |child_id|
85
- # params[:affect].each do |affected|
86
- # end
87
-
88
85
  child_found = grab(child_id)
89
- # alert "must exist : #{child_found.id}"
90
- # puts "correct condition below #{id}"
91
- #FIXME : found why it crash when removing the conditon below
86
+ #FIXME : found why it crash when removing the condition below
92
87
  unless child_found.id == :black_matter
93
88
  child_found.remove({all: :paint})
94
89
  end
95
- child_found&.apply([id], &user_proc)
90
+ child_found.apply([id], &user_proc)
96
91
  end
92
+
97
93
  children_ids
98
94
  end
99
95
 
@@ -26,8 +26,52 @@ new ({ sanitizer: :password }) do |params|
26
26
  end
27
27
 
28
28
  new({ read: :password }) do |params|
29
- params = Black_matter.password if params.nil?
30
- params[:read][:atome] = Black_matter.password[:read][:atome] unless @authorisations[:write][:atome]
31
- params[:write][:atome] = Black_matter.password[:write][:atome] unless @authorisations[:write][:atome]
29
+ # TODO : check if we have to reactive the lines below
30
+ # params = Black_matter.password if params.nil?
31
+ # params[:read][:atome] = Black_matter.password[:read][:atome] unless @authorisations[:write][:atome]
32
+ # params[:write][:atome] = Black_matter.password[:write][:atome] unless @authorisations[:write][:atome]
33
+
32
34
  params
33
35
  end
36
+
37
+ # def get_all_local_storage_items
38
+ # Création d'un hash pour stocker les paires clé/valeur de localStorage
39
+ storage_items = {}
40
+
41
+ # Obtention du nombre d'éléments dans le localStorage
42
+ # storage= JS.global[:localStorage]
43
+ # # storage=storage.to_s
44
+ # storage_array= storage.to_a
45
+ # # alert storage_array.length
46
+ # storage_items={}
47
+ # storage_array.each_with_index do |_i, index|
48
+ # key = JS.global[:localStorage].key(index)
49
+ # #
50
+ # # # Récupération de la valeur associée à cette clé
51
+ # value = JS.global[:localStorage].getItem(key)
52
+ # #
53
+ # # # Stockage de la paire clé/valeur dans le hash
54
+ # storage_items[key] = value
55
+ # end
56
+ # puts storage_items
57
+
58
+ # alert Native(storage_length).class
59
+ # Itération sur tous les éléments de localStorage
60
+ # (0...storage_length).each do |i|
61
+ # # Récupération de la clé pour l'élément actuel
62
+ # key = JS.global[:localStorage].key(i)
63
+ #
64
+ # # Récupération de la valeur associée à cette clé
65
+ # value = JS.global[:localStorage].getItem(key)
66
+ #
67
+ # # Stockage de la paire clé/valeur dans le hash
68
+ # storage_items[key] = value
69
+ # end
70
+ #
71
+ # # Retour du hash contenant toutes les paires clé/valeur de localStorage
72
+ # storage_items
73
+ # end
74
+ #
75
+ # # Appel de la fonction pour récupérer et afficher le contenu de localStorage
76
+ # all_items = get_all_local_storage_items
77
+ # puts all_items
@@ -3,7 +3,6 @@
3
3
  # now let's get the default render engine
4
4
 
5
5
  # Lets create the U.I.
6
-
7
6
  default_render = Essentials.default_params[:render_engines]
8
7
  Atome.new(
9
8
  { renderers: [], id: :eDen, type: :element, tag: { system: true } }
@@ -90,7 +89,8 @@ Atome.new({ renderers: default_render, id: machine_id, type: :machine, password:
90
89
  # user
91
90
  user_password = { global: :star_win, read: { atome: :star_wars }, write: { atome: :star_wars } }
92
91
 
93
- human({ id: :anonymous, login: true, password: user_password, data: { birthday: '10/05/1996' }, selection: [], attach: :user_view })
92
+ # human({ id: :anonymous, login: true, password: user_password, data: { birthday: '10/05/1996' }, selection: [], attach: :user_view })
93
+ human({ id: identity_generator, login: true, password: user_password, data: { birthday: '10/05/1996' }, selection: [], attach: :user_view })
94
94
 
95
95
  Universe.current_machine = machine_id
96
96
  # the constant A is used to access alla atomes methods
@@ -146,7 +146,7 @@ def atome_genesis
146
146
  end
147
147
  end
148
148
 
149
- def init_database # this method is call from JS (atome/communication)
149
+ def init_database # this method is call from JS (atome/communication) at WS connection
150
150
  # we init the db file eDen
151
151
  A.message({ action: :init_db, data: { database: :eDen } }) do |_db_state|
152
152
  end
@@ -184,6 +184,11 @@ def init_database # this method is call from JS (atome/communication)
184
184
  end
185
185
  end
186
186
 
187
+ # now we send localstorage content to the server
188
+ puts "now we send localstorage send_localstorage_content to the server"
189
+ send_localstorage_content
190
+ # A.message({ action: :localstorage, data: get_localstorage_content }) do |_db_state|
191
+ # end
187
192
  end
188
193
 
189
194
  def user_login
@@ -193,6 +198,7 @@ def user_login
193
198
  puts "email received : #{email}"
194
199
  end
195
200
  message({ action: :authorization, data: { password: password } }) do |pass|
196
- puts "password recieved : #{pass}"
201
+ puts "password received : #{pass}"
197
202
  end
198
203
  end
204
+ # Universe.allow_history=true
@@ -6,6 +6,7 @@ require 'json'
6
6
  class Atome
7
7
  class << self
8
8
 
9
+
9
10
  def file_handler(parent, content, bloc)
10
11
  grab(parent).instance_exec(content, &bloc)
11
12
  end
@@ -398,6 +399,56 @@ class Atome
398
399
  # Digest::SHA256.hexdigest(string)
399
400
  # end
400
401
  end
402
+ def get_localstorage_content
403
+ storage= JS.global[:localStorage]
404
+ storage_array= storage.to_a
405
+ storage_items={}
406
+ storage_array.each_with_index do |_i, index|
407
+ key = JS.global[:localStorage].key(index)
408
+ value = JS.global[:localStorage].getItem(key)
409
+ storage_items[key] = value
410
+ end
411
+ storage_items
412
+ end
413
+
414
+ def sanitize_data_for_json(data)
415
+ data=data.gsub('"', '\\"')
416
+ # case data
417
+ # when String
418
+ # data.gsub('"', '\\"')
419
+ # when Hash
420
+ # data.transform_values { |value| sanitize_data(value) }
421
+ # when Array
422
+ # data.map { |value| sanitize_data(value) }
423
+ # else
424
+ # data
425
+ # end
426
+ data
427
+ end
428
+
429
+ def send_localstorage_content
430
+ storage= JS.global[:localStorage]
431
+ storage_array= storage.to_a
432
+ # storage_items={}
433
+ storage_array.each_with_index do |_i, index|
434
+ key = JS.global[:localStorage].key(index)
435
+ value = sanitize_data_for_json(JS.global[:localStorage].getItem(key))
436
+ # storage_items[key] = value
437
+ # puts key
438
+ # puts value
439
+ # A.message({ action: :localstorage, data: {key => value} }) do |_db_state|
440
+ # # puts _db_state
441
+ # end
442
+ end
443
+ # A.message({ action: :end_localstorage, data: '' }) do |_db_state|
444
+ # puts _db_state
445
+ # end
446
+ end
447
+
448
+ def to_sym
449
+ puts "sanitizer temp patch when an atome is passed instead of an id"
450
+ @id
451
+ end
401
452
  end
402
453
 
403
454
 
@@ -11,17 +11,18 @@ class Universe
11
11
  @sanitizers = {}
12
12
  @specificities = {}
13
13
  @messages = {}
14
-
14
+ @increment=0
15
15
  @categories = %w[atome communication effect event geometry hierarchy identity material
16
16
  property security spatial time utility ]
17
17
  @history = {}
18
18
  @users = {}
19
19
  @help = {}
20
20
  @example = {}
21
-
21
+ @allow_history= false
22
+ # @historicize=false
22
23
  class << self
23
24
  attr_reader :atomes,:atomes_ids, :renderer_list, :atome_list, :particle_list, :classes, :counter, :atomes_specificities
24
-
25
+ attr_accessor :allow_history
25
26
  def messages
26
27
  @messages
27
28
  end
@@ -236,7 +237,13 @@ class Universe
236
237
  end
237
238
 
238
239
  def historicize(id, operation, element, params)
239
- @history[@history.length] = { id => { operation => { element => params } }, sync: false, time: Time.now }
240
+ if @allow_history
241
+ operation_timing= Time.now.strftime("%Y%m%d%H%M%S%3N")+@increment.to_s
242
+ @increment+=1
243
+ @increment=@increment%100
244
+ JS.global[:localStorage].setItem(operation_timing,"{ #{id} => { #{operation} => { #{element} => #{params} } }, sync: false }")
245
+ @history[@history.length] = { operation_timing => { id => { operation => { element => params } }, sync: false, time: Time.now } }
246
+ end
240
247
  end
241
248
 
242
249
  def story(filter)
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.5'
5
+ VERSION = '0.5.6.4.8'
6
6
  end
@@ -21,7 +21,7 @@ new({ renderer: :html, method: :smooth, type: :string }) do |value, _user_proc|
21
21
  end
22
22
 
23
23
  new({ renderer: :html, method: :blur, type: :integer }) do |params, _user_proc|
24
- if params[:affect] == :back
24
+ if params[:affect] == :back || params[:affect] == :back
25
25
  html.backdropFilter(:blur, "#{params[:value]}px")
26
26
  else
27
27
  html.filter(:blur, "#{params[:value]}px")
@@ -93,7 +93,7 @@ new({ renderer: :html, method: :apply, type: :string, specific: :text }) do |par
93
93
  alpha = shadow_found.alpha
94
94
  left = shadow_found.left
95
95
  top = shadow_found.top
96
- blur = shadow_found.blur
96
+ blur = shadow_found.blur[:value] # new correct behavior all atome's value should now be get using :value,here to resolve conflict with blur and back blur
97
97
  inset = :inset if shadow_found.invert
98
98
  if shadow_found.option == :natural
99
99
  shadows_to_apply[:filter] << "drop-shadow(#{left}px #{top}px #{blur}px rgba(#{red}, #{green}, #{blue}, #{alpha}))"
@@ -1450,21 +1450,24 @@ class HTML
1450
1450
  when :all
1451
1451
  case v
1452
1452
  when :paint
1453
- style(:background, 'black')
1453
+ style(:background, 'none')
1454
1454
  # style('box-shadow', 'none')
1455
1455
  # style('text-shadow', 'none')
1456
1456
  when :color
1457
1457
  when :shadow
1458
1458
  style('box-shadow', 'none')
1459
1459
  style('text-shadow', 'none')
1460
+ style("filter", 'none')
1460
1461
  end
1461
1462
  end
1462
1463
  end
1463
1464
  else
1464
1465
  @original_atome.apply.delete(params)
1465
- style(:background, 'black')
1466
+ style(:background, 'none')
1466
1467
  style('box-shadow', 'none')
1467
1468
  style('text-shadow', 'none')
1469
+ style("boxShadow", 'none')
1470
+ style("filter", 'none')
1468
1471
  @original_atome.apply(@original_atome.apply)
1469
1472
  end
1470
1473
  # alert "remove : #{params} , type: #{@original_atome.type}"
@@ -1,6 +1,26 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ b=circle({left: 333})
4
+ b.blur(6)
3
5
 
6
+ image(:red_planet)
7
+ b2=box({color: {alpha: 0.1, red: 1, green: 0, blue: 0.2}, left: 99, top: 99, width: 99, height: 99})
8
+ b2.drag(true)
9
+ b2.border({ thickness: 0.3, color: :gray, pattern: :solid })
10
+ b2.smooth(12)
11
+ b2.shadow({
12
+ invert: true,
13
+ id: :s4,
14
+ left: 2, top: 2, blur: 9,
15
+ # option: :natural,
16
+ red: 0, green: 0, blue: 0, alpha: 0.3
17
+ })
4
18
 
5
- b=circle
6
- b.blur(20)
19
+ b2.shadow({
20
+ # invert: true,
21
+ id: :s5,
22
+ left: 2, top: 2, blur: 9,
23
+ # option: :natural,
24
+ red: 0, green: 0, blue: 0, alpha: 0.6
25
+ })
26
+ b2.blur({affect: :back, value: 15})
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # see import for drag and drop import
3
4
  b = box({ drag: true })
4
5
  b.import(true) do |content|
5
6
  puts "add code here, content: #{content}"
@@ -36,4 +36,5 @@ the_text.left(333)
36
36
 
37
37
  the_text.paint({ gradient: [col_1.id, col_2.id], direction: :left , id: :painted_love })
38
38
 
39
+ # #TODO : gradient on text!
39
40
 
@@ -121,18 +121,22 @@ module Molecule
121
121
 
122
122
  end
123
123
  end
124
-
124
+ c= circle({left: 399})
125
125
  test_cell.touch(true) do
126
- alert :ok
127
126
  test_cell.alternate([{ width: 33, color: :red }, { width: 66, color: :orange }])
128
127
  # puts "=> #{Universe.atomes.length}"
129
128
  # puts test_cell.color
130
129
  # if test_cell.data==true
131
130
  # 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)
131
+ # col_1 = color(:black)
132
+
133
+ @current_matrix.paint({ gradient: [col_1.id, col_1.id], direction: :top })
134
+ other_col=test_cell.color(:white)
135
+ c.paint({ gradient: [col_1, col_2], direction: :left })
136
+ test_cell.paint({ gradient: [col_1, other_col], direction: :left })
137
+ # test_cell
138
+ # grab(:red_col).delete(true)
139
+ # test_cell.color(:green)
136
140
  # else
137
141
  # test_cell.data(true)
138
142
  # test_cell.color(:blue)
@@ -34,14 +34,17 @@ wait 2 do
34
34
  end
35
35
 
36
36
 
37
- the_text = text({ data: 'hello for al the people in front of their machine', center: true, top: 222, width: 777, component: { size: 66 } })
38
-
37
+ the_text = text({ data: 'text with shadow!', center: true, top: 222, width: 777, component: { size: 66 } })
39
38
 
40
39
 
41
40
  the_text.shadow({
42
- id: :s4,
43
- left: 20, top: 0, blur: 9,
41
+ id: :my_shadow,
42
+ left: 6, top: 6, blur: 6,
44
43
  option: :natural,
45
- red: 0, green: 1, blue: 0, alpha: 1
44
+ red: 0, green: 0, blue: 0, alpha: 1
46
45
  })
47
46
 
47
+ the_text.left(255)
48
+ the_text.top(66)
49
+ the_text.color(:red)
50
+
@@ -78,6 +78,13 @@ class EDen
78
78
  end
79
79
  end
80
80
 
81
+ def localstorage(data, message_id)
82
+ # return test
83
+ # ws.send(return_message.to_json)
84
+ return { return: 'localstorage content received', authorized: true, message_id: message_id }
85
+
86
+ end
87
+
81
88
  def init_db(_data, message_id)
82
89
  unless File.exist?("eden.sqlite3")
83
90
  Sequel.connect("sqlite://eden.sqlite3")
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.5
4
+ version: 0.5.6.4.8
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-29 00:00:00.000000000 Z
11
+ date: 2024-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: artoo