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.
- checksums.yaml +4 -4
- data/lib/atome/atome.rb +24 -56
- data/lib/atome/extensions/atome.rb +10 -59
- data/lib/atome/extensions/sha.rb +7 -7
- data/lib/atome/genesis/genesis.rb +0 -89
- data/lib/atome/genesis/particles/communication.rb +1 -1
- data/lib/atome/genesis/particles/event.rb +0 -8
- data/lib/atome/genesis/particles/geometry.rb +0 -1
- data/lib/atome/genesis/particles/hierarchy.rb +0 -34
- data/lib/atome/genesis/particles/identity.rb +0 -30
- data/lib/atome/genesis/particles/material.rb +0 -11
- data/lib/atome/genesis/particles/property.rb +14 -16
- data/lib/atome/genesis/particles/security.rb +0 -45
- data/lib/atome/genesis/particles/utility.rb +17 -185
- data/lib/atome/genesis/sparkle.rb +3 -12
- data/lib/atome/kernel/black_matter.rb +0 -1
- data/lib/atome/kernel/universe.rb +5 -45
- data/lib/atome/presets/atome.rb +0 -22
- data/lib/atome/version.rb +1 -1
- data/lib/molecules/init.rb +0 -14
- data/lib/molecules/intuition/tools.rb +3 -22
- data/lib/molecules/intuition/utilities.rb +121 -77
- data/lib/platform_specific/opal/atome_opal_extensions.rb +0 -1
- data/lib/platform_specific/opal/extensions/color.rb +0 -5
- data/lib/platform_specific/opal/extensions/geolocation.rb +5 -5
- data/lib/platform_specific/opal/extensions/ping.rb +11 -20
- data/lib/renderers/html/effect.rb +0 -11
- data/lib/renderers/html/event.rb +0 -7
- data/lib/renderers/html/geometry.rb +0 -31
- data/lib/renderers/html/html.rb +13 -134
- data/lib/renderers/html/material.rb +0 -22
- data/lib/renderers/html/spatial.rb +0 -9
- data/lib/renderers/html/utility.rb +5 -8
- data/lib/renderers/renderer.rb +0 -1
- data/vendor/assets/application/examples/applications.rb +19 -71
- data/vendor/assets/application/examples/buttons.rb +5 -4
- data/vendor/assets/application/examples/unfasten.rb +15 -9
- data/vendor/assets/application/index.rb +1 -1
- data/vendor/assets/server/capture.rb +0 -1
- data/vendor/assets/server/database.rb +0 -1
- data/vendor/assets/server/eDen.rb +5 -80
- data/vendor/assets/src/index_server_wasm.html +0 -3
- data/vendor/assets/src/index_wasm.html +0 -6
- metadata +2 -6
- data/lib/molecules/_deprecated_examples/site.rb +0 -34
- data/lib/molecules/intuition/_deprecated_inputs.rb +0 -111
- data/lib/molecules/intuition/_deprecated_toolbox.rb +0 -282
- data/lib/platform_specific/opal/extensions/sha.rb +0 -25
@@ -21,14 +21,6 @@ new({ particle: :remove, category: :property, type: :hash }) do |params|
|
|
21
21
|
data.map do |hash|
|
22
22
|
hash.delete(hash.keys[column]) if hash.keys[column]
|
23
23
|
end
|
24
|
-
# elsif params[:all]
|
25
|
-
# apply.each do |applied_atome|
|
26
|
-
# if grab(applied_atome).type.to_sym == params[:all].to_sym
|
27
|
-
# puts "!go"
|
28
|
-
# end
|
29
|
-
# end
|
30
|
-
# puts "so_good #{params}"
|
31
|
-
# puts "***> #{apply}"
|
32
24
|
end
|
33
25
|
|
34
26
|
params
|
@@ -38,7 +30,6 @@ new({ particle: :remove, category: :property, type: :hash }) do |params|
|
|
38
30
|
end
|
39
31
|
|
40
32
|
end
|
41
|
-
# new({ particle: :remove, category: :property, type: :hash })
|
42
33
|
|
43
34
|
new({ post: :remove }) do |params|
|
44
35
|
# TODO : we have to rethink the removal of atome and particles (with exception like category) and maybe 'use particle type' to handle removal
|
@@ -86,7 +77,6 @@ end
|
|
86
77
|
new({ particle: :remove_classes, category: :material, type: :boolean }) do |value|
|
87
78
|
Universe.classes[value].delete(id)
|
88
79
|
end
|
89
|
-
# new ({ particle: :opacity, category: :material, type: :int })
|
90
80
|
|
91
81
|
# vector shape
|
92
82
|
new({ particle: :definition, category: :material, type: :string })
|
@@ -115,7 +105,6 @@ new({ after: :pattern }) do |params|
|
|
115
105
|
end
|
116
106
|
params
|
117
107
|
end
|
118
|
-
# new({ particle: :border, category: :material, type: :int })
|
119
108
|
new({ particle: :fill, category: :material, type: :array })
|
120
109
|
|
121
110
|
new({ particle: :opacity, category: :material, type: :int })
|
@@ -11,29 +11,27 @@ def extract_rgb_alpha(color_string)
|
|
11
11
|
end
|
12
12
|
|
13
13
|
new({ particle: :red, category: :property, type: :string }) do
|
14
|
-
# alert :ok
|
15
14
|
# we return self to allow syntax of the type : a.color(:black).red(1).green(0.3)
|
16
15
|
self
|
17
16
|
end
|
18
17
|
# FIXME we have to apply both at post and after to make it work
|
19
18
|
# used to refresh all affected atomes
|
20
|
-
new({after: :red}) do |params|
|
21
|
-
a=affect.dup # FIXME we have to dup else some items in the array array other duplicated
|
19
|
+
new({ after: :red }) do |params|
|
20
|
+
a = affect.dup # FIXME we have to dup else some items in the array array other duplicated
|
22
21
|
a.each do |atome_to_refresh|
|
23
|
-
|
24
|
-
|
22
|
+
grab(atome_to_refresh).apply(id)
|
23
|
+
end
|
25
24
|
params
|
26
25
|
end
|
27
26
|
|
28
|
-
|
29
27
|
new({ particle: :green, category: :property, type: :string }) do
|
30
28
|
# we return self to allow syntax of the type : a.color(:black).red(1).green(0.3)
|
31
29
|
self
|
32
30
|
end
|
33
31
|
|
34
32
|
# used to refresh all affected atomes
|
35
|
-
new({after: :green}) do |params|
|
36
|
-
a=affect.dup # FIXME we have to dup else some items in the array array other duplicated
|
33
|
+
new({ after: :green }) do |params|
|
34
|
+
a = affect.dup # FIXME we have to dup else some items in the array array other duplicated
|
37
35
|
a.each do |atome_to_refresh|
|
38
36
|
grab(atome_to_refresh).apply(id)
|
39
37
|
end
|
@@ -46,8 +44,8 @@ new({ particle: :blue, category: :property, type: :string }) do
|
|
46
44
|
end
|
47
45
|
|
48
46
|
# used to refresh all affected atomes
|
49
|
-
new({after: :blue}) do |params|
|
50
|
-
a=affect.dup # FIXME we have to dup else some items in the array array other duplicated
|
47
|
+
new({ after: :blue }) do |params|
|
48
|
+
a = affect.dup # FIXME we have to dup else some items in the array array other duplicated
|
51
49
|
a.each do |atome_to_refresh|
|
52
50
|
grab(atome_to_refresh).apply(id)
|
53
51
|
end
|
@@ -58,8 +56,8 @@ new({ particle: :alpha, category: :property, type: :string }) do
|
|
58
56
|
self
|
59
57
|
end
|
60
58
|
# used to refresh all affected atomes
|
61
|
-
new({after: :alpha}) do |params|
|
62
|
-
a=affect.dup # FIXME we have to dup else some items in the array array other duplicated
|
59
|
+
new({ after: :alpha }) do |params|
|
60
|
+
a = affect.dup # FIXME we have to dup else some items in the array array other duplicated
|
63
61
|
a.each do |atome_to_refresh|
|
64
62
|
grab(atome_to_refresh).apply(id)
|
65
63
|
end
|
@@ -70,7 +68,6 @@ new({ particle: :diffusion, category: :property, type: :string }) do
|
|
70
68
|
self
|
71
69
|
end
|
72
70
|
|
73
|
-
|
74
71
|
new({ particle: :clean, category: :property, type: :boolean }) do |params|
|
75
72
|
cell = params[:cell]
|
76
73
|
row_nb = cell[0]
|
@@ -91,6 +88,7 @@ new({ particle: :insert, category: :property, type: :string }) do |params|
|
|
91
88
|
position_to_insert = params[:row]
|
92
89
|
data.insert(position_to_insert, {})
|
93
90
|
elsif params[:column]
|
91
|
+
#
|
94
92
|
end
|
95
93
|
|
96
94
|
params
|
@@ -130,7 +128,7 @@ new({ particle: :sort, category: :property, type: :int }) do |params|
|
|
130
128
|
params
|
131
129
|
end
|
132
130
|
|
133
|
-
new({particle: :inside, render: false})
|
131
|
+
new({ particle: :inside, render: false })
|
134
132
|
new({ initialized: :inside }) do |params, &user_proc|
|
135
133
|
render(:inside, params, &user_proc)
|
136
134
|
end
|
@@ -142,11 +140,11 @@ new({ particle: :value }) do |val|
|
|
142
140
|
val
|
143
141
|
end
|
144
142
|
|
145
|
-
new({ particle: :behavior, type: :symbol, category: :property
|
143
|
+
new({ particle: :behavior, type: :symbol, category: :property })
|
146
144
|
|
147
145
|
new({ particle: :orientation, type: :symbol, category: :property })
|
148
146
|
|
149
|
-
new({ particle: :align
|
147
|
+
new({ particle: :align, type: :symbol, category: :property })
|
150
148
|
|
151
149
|
new({ particle: :actor, store: false }) do |params|
|
152
150
|
@actor ||= {}
|
@@ -27,51 +27,6 @@ end
|
|
27
27
|
|
28
28
|
new({ read: :password }) do |params|
|
29
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
30
|
|
34
31
|
params
|
35
32
|
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
|
@@ -1,20 +1,29 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
def delete_recursive(atome_id, force=false)
|
3
|
+
return if grab(atome_id).tag && (grab(atome_id).tag[:persistent] || grab(atome_id).tag[:system]) unless force
|
4
|
+
|
5
|
+
parent_id_found = grab(atome_id).attach
|
6
|
+
parent_found = grab(parent_id_found)
|
7
|
+
new_array = parent_found.fasten.dup
|
8
|
+
new_array.delete(atome_id)
|
9
|
+
parent_found.instance_variable_set('@fasten', new_array)
|
10
|
+
grab(atome_id).fasten.each do |atome_id_found|
|
11
|
+
delete_recursive(atome_id_found, force)
|
12
|
+
end
|
13
|
+
grab(atome_id).render(:delete, { :recursive => true })
|
14
|
+
grab(atome_id).touch(:remove)
|
15
|
+
Universe.delete(grab(atome_id).aid)
|
16
|
+
end
|
2
17
|
|
3
18
|
new({ particle: :renderers, category: :utility, type: :string })
|
4
19
|
new({ particle: :code, category: :utility, type: :string, store: false }) do |params, code|
|
5
20
|
@code[params] = code
|
6
21
|
end
|
7
|
-
# new({ particle: :run, category: :utility, type: :boolean }) do |params|
|
8
|
-
# code_found = @code
|
9
|
-
# instance_exec(params, &code_found) if code_found.is_a?(Proc)
|
10
|
-
# end
|
11
|
-
|
12
22
|
new({ particle: :run }) do |params, code|
|
13
23
|
instance_exec(¶ms) if params.is_a?(Proc)
|
14
24
|
code_found = @code[params]
|
15
25
|
instance_exec(params, &code_found) if code_found.is_a?(Proc)
|
16
26
|
end
|
17
|
-
|
18
27
|
new({ particle: :target }) do |params|
|
19
28
|
params.each do |atome_f, value_f|
|
20
29
|
if value_f.instance_of?(Hash)
|
@@ -26,26 +35,6 @@ new({ particle: :target }) do |params|
|
|
26
35
|
end
|
27
36
|
end
|
28
37
|
end
|
29
|
-
|
30
|
-
# new({ particle: :broadcast })
|
31
|
-
|
32
|
-
|
33
|
-
def delete_recursive(atome_id, force=false)
|
34
|
-
return if grab(atome_id).tag && (grab(atome_id).tag[:persistent] || grab(atome_id).tag[:system]) unless force
|
35
|
-
|
36
|
-
parent_id_found = grab(atome_id).attach
|
37
|
-
parent_found = grab(parent_id_found)
|
38
|
-
new_array = parent_found.fasten.dup
|
39
|
-
new_array.delete(atome_id)
|
40
|
-
parent_found.instance_variable_set('@fasten', new_array)
|
41
|
-
grab(atome_id).fasten.each do |atome_id_found|
|
42
|
-
delete_recursive(atome_id_found, force)
|
43
|
-
end
|
44
|
-
grab(atome_id).render(:delete, { :recursive => true })
|
45
|
-
grab(atome_id).touch(:remove)
|
46
|
-
Universe.delete(grab(atome_id).aid)
|
47
|
-
end
|
48
|
-
|
49
38
|
new({ particle: :delete, category: :utility, type: :boolean, render: false }) do |params|
|
50
39
|
if params == true
|
51
40
|
|
@@ -68,31 +57,15 @@ new({ particle: :delete, category: :utility, type: :boolean, render: false }) do
|
|
68
57
|
affected_found.apply.delete(id_found)
|
69
58
|
affected_found.refresh
|
70
59
|
end
|
60
|
+
grab(attach).unfasten([id])
|
71
61
|
Universe.delete(@aid)
|
72
62
|
end
|
73
|
-
# elsif params == :force
|
74
|
-
# cells.delete(true)
|
75
|
-
# group.delete(true)
|
76
|
-
# # now we detach the atome from it's parent
|
77
|
-
# # now we init rendering
|
78
|
-
# render(:delete, params)
|
79
|
-
# # the machine delete the current atome from the universe
|
80
|
-
# id_found = @id.to_sym
|
81
|
-
# if @attach
|
82
|
-
# parent_found = grab(@attach)
|
83
|
-
# parent_found.fasten.delete(id_found)
|
84
|
-
# end
|
85
|
-
# @affect&.each do |affected_atome|
|
86
|
-
# affected_found = grab(affected_atome)
|
87
|
-
# affected_found.apply.delete(id_found)
|
88
|
-
# affected_found.refresh
|
89
|
-
# end
|
90
|
-
# Universe.delete(@aid)
|
91
63
|
elsif params.instance_of? Hash
|
92
64
|
# if we are on a matrix we delete cells found & group found
|
93
65
|
cells.delete(true)
|
94
66
|
group.delete(true)
|
95
67
|
if params[:recursive]
|
68
|
+
grab(attach).unfasten([id])
|
96
69
|
unless grab(@id).tag && (grab(@id).tag[:persistent] || grab(@id).tag[:system])
|
97
70
|
fasten.each do |atttached_atomes|
|
98
71
|
delete_recursive(atttached_atomes)
|
@@ -128,119 +101,7 @@ new({ particle: :delete, category: :utility, type: :boolean, render: false }) do
|
|
128
101
|
send(params, 0) unless params == :id
|
129
102
|
end
|
130
103
|
end
|
131
|
-
|
132
|
-
|
133
|
-
# def delete_recursive(atome_id, force = false)
|
134
|
-
# return if grab(atome_id).tag && (grab(atome_id).tag[:persistent] || grab(atome_id).tag[:system]) unless force
|
135
|
-
#
|
136
|
-
# parent_id_found = grab(atome_id).attach
|
137
|
-
# parent_found = grab(parent_id_found)
|
138
|
-
# new_array = parent_found.fasten.dup
|
139
|
-
# new_array.delete(atome_id)
|
140
|
-
# parent_found.instance_variable_set('@fasten', new_array)
|
141
|
-
# grab(atome_id).fasten.each do |atome_id_found|
|
142
|
-
# delete_recursive(atome_id_found, force)
|
143
|
-
# end
|
144
|
-
# grab(atome_id).render(:delete, { :recursive => true })
|
145
|
-
# grab(atome_id).touch(:remove)
|
146
|
-
# Universe.delete(grab(atome_id).aid)
|
147
|
-
# end
|
148
|
-
|
149
|
-
# new({ particle: :delete, category: :utility, type: :boolean, render: false }) do |params|
|
150
|
-
#
|
151
|
-
# basic_system_object = %i[view eDen black_matter intuition copy atome
|
152
|
-
# user_view view_color shape_color
|
153
|
-
# box_color invisible_color text_color circle_color back_selection
|
154
|
-
# text_selection nil
|
155
|
-
# ]
|
156
|
-
#
|
157
|
-
# unless basic_system_object.include?(id) || id.nil?
|
158
|
-
# if params == true
|
159
|
-
# # We use the tag persistent to exclude color of system object and other default colors
|
160
|
-
# unless @tag && (@tag[:persistent] || @tag[:system])
|
161
|
-
# # if we are on a matrix we delete cells found & group found
|
162
|
-
# cells.delete(true)
|
163
|
-
# group.delete(true)
|
164
|
-
# # now we detach the atome from it's parent
|
165
|
-
# # now we init rendering
|
166
|
-
# render(:delete, params)
|
167
|
-
# # the machine delete the current atome from the universe
|
168
|
-
# id_found = @id.to_sym
|
169
|
-
# if @attach
|
170
|
-
# parent_found = grab(@attach)
|
171
|
-
# parent_found.fasten.delete(id_found)
|
172
|
-
# end
|
173
|
-
# @affect&.each do |affected_atome|
|
174
|
-
# affected_found = grab(affected_atome)
|
175
|
-
# affected_found.apply.delete(id_found)
|
176
|
-
# affected_found.refresh
|
177
|
-
# end
|
178
|
-
# # Universe.delete(@aid)
|
179
|
-
# end
|
180
|
-
# elsif params.instance_of? Hash
|
181
|
-
# # if we are on a matrix we delete cells found & group found
|
182
|
-
# cells.delete(true)
|
183
|
-
# group.delete(true)
|
184
|
-
# if params[:recursive]
|
185
|
-
# unless grab(@id).tag && (grab(@id).tag[:persistent] || grab(@id).tag[:system])
|
186
|
-
# fasten.each do |atttached_atomes|
|
187
|
-
# delete_recursive(atttached_atomes)
|
188
|
-
# end
|
189
|
-
# # touch(:remove)
|
190
|
-
# # render(:delete, params)
|
191
|
-
# # Universe.delete(@aid)
|
192
|
-
# end
|
193
|
-
# elsif params[:force]
|
194
|
-
# fasten.each do |atttached_atomes|
|
195
|
-
# # alert "fasten : #{fasten}"
|
196
|
-
# delete_recursive(atttached_atomes, true)
|
197
|
-
# end
|
198
|
-
# # touch(:remove)
|
199
|
-
# # render(:delete, params)
|
200
|
-
# # Universe.delete(@aid)
|
201
|
-
#
|
202
|
-
# else
|
203
|
-
#
|
204
|
-
# # the machine try to find the sub particle id and remove it eg a.delete(monitor: :my_monitor) remove the monitor
|
205
|
-
# # with id my_monitor
|
206
|
-
# #
|
207
|
-
# params.each do |param, value|
|
208
|
-
# atome[param][value] = nil
|
209
|
-
# end
|
210
|
-
# end
|
211
|
-
#
|
212
|
-
# elsif Universe.atome_list.include?(params)
|
213
|
-
# # we check if the params passed is an atome to treat it in a different way
|
214
|
-
# puts "write code here : #{apply} , #{fasten}"
|
215
|
-
# else
|
216
|
-
# send(params, 0) unless params == :id
|
217
|
-
# end
|
218
|
-
# touch(:remove)
|
219
|
-
# drag(false)
|
220
|
-
# drop(false)
|
221
|
-
# on(false)
|
222
|
-
# keyboard(false)
|
223
|
-
# resize(:remove)
|
224
|
-
# overflow(:remove)
|
225
|
-
#
|
226
|
-
# render(:delete, params)
|
227
|
-
# Universe.delete(@aid)
|
228
|
-
#
|
229
|
-
# exclusions = %i[@history @renderers @type @tag @html]
|
230
|
-
#
|
231
|
-
# instance_variables.each do |i_var|
|
232
|
-
# unless exclusions.include?(i_var)
|
233
|
-
# instance_variable_set(i_var, nil)
|
234
|
-
# end
|
235
|
-
# end
|
236
|
-
#
|
237
|
-
# instance_variable_set('@renderers', [])
|
238
|
-
# end
|
239
|
-
#
|
240
|
-
# end
|
241
|
-
|
242
104
|
new({ particle: :clear, category: :utility, type: :boolean })
|
243
|
-
|
244
105
|
new({ post: :clear }) do
|
245
106
|
fasten_found = []
|
246
107
|
fasten.each do |fasten_id_found|
|
@@ -261,9 +122,7 @@ new({ particle: :schedule, category: :utility, type: :string }) do |date, proc|
|
|
261
122
|
send("#{renderer}_schedule", format_date, &proc)
|
262
123
|
end
|
263
124
|
end
|
264
|
-
|
265
125
|
new({ particle: :cursor, category: :utility, type: :string })
|
266
|
-
|
267
126
|
new({ particle: :preset, category: :utility, type: :string }) do |params|
|
268
127
|
|
269
128
|
if params.instance_of? Hash
|
@@ -284,7 +143,6 @@ end
|
|
284
143
|
new({ particle: :relations, category: :utility, type: :hash })
|
285
144
|
new({ particle: :tag, render: false, category: :utility, type: :hash })
|
286
145
|
new({ particle: :web, category: :utility, type: :string })
|
287
|
-
# new({ particle: :metrics, type: :hash })
|
288
146
|
# do not change the line below initialise is a special method
|
289
147
|
new({ initialize: :unit, value: {} })
|
290
148
|
new({ particle: :unit, store: false, type: :string, category: :utility }) do |params|
|
@@ -306,19 +164,15 @@ new({ particle: :browse, category: :utility, type: :string })
|
|
306
164
|
new({ particle: :copies, category: :utility, type: :string })
|
307
165
|
new({ particle: :temporary, category: :utility, type: :int })
|
308
166
|
new({ particle: :atomes, category: :utility, type: :string })
|
309
|
-
|
310
167
|
new({ particle: :match, category: :utility, type: :string }) do |params, _bloc|
|
311
168
|
params
|
312
169
|
end
|
313
|
-
|
314
170
|
new({ sanitizer: :match }) do |params, _bloc|
|
315
171
|
params[:condition] = { min: { width: 0 } } unless params[:condition]
|
316
172
|
params
|
317
173
|
end
|
318
|
-
|
319
174
|
new({ particle: :invert, category: :utility, type: :boolean })
|
320
175
|
new({ particle: :option, category: :utility, type: :string })
|
321
|
-
|
322
176
|
new({ particle: :duplicate, category: :utility, type: :string, store: false }) do |params|
|
323
177
|
copy_number = if @duplicate
|
324
178
|
@duplicate.length
|
@@ -347,16 +201,13 @@ new({ particle: :duplicate, category: :utility, type: :string, store: false }) d
|
|
347
201
|
new_atome
|
348
202
|
|
349
203
|
end
|
350
|
-
|
351
204
|
new({ after: :duplicate }) do |params|
|
352
205
|
@duplicate[@duplicate.keys[@duplicate.keys.length - 1]]
|
353
206
|
end
|
354
|
-
|
355
207
|
new({ particle: :copy, category: :utility, type: :string }) do |items_id|
|
356
208
|
items_id = [items_id] unless items_id.instance_of? Array
|
357
209
|
grab(:copy).collect << items_id
|
358
210
|
end
|
359
|
-
|
360
211
|
new({ particle: :paste, category: :utility, type: :string }) do |params|
|
361
212
|
|
362
213
|
all_copies = grab(:copy).collect
|
@@ -382,37 +233,28 @@ new({ particle: :paste, category: :utility, type: :string }) do |params|
|
|
382
233
|
end
|
383
234
|
new_atomes
|
384
235
|
end
|
385
|
-
|
386
236
|
new({ read: :paste }) do |p|
|
387
237
|
@copy
|
388
238
|
end
|
389
|
-
|
390
239
|
new({ particle: :backup, category: :utility, type: :string })
|
391
|
-
|
392
240
|
new({ particle: :import, category: :utility, type: :string })
|
393
|
-
|
394
241
|
new({ particle: :compute, category: :utility, type: :string }) do |params|
|
395
242
|
params = { particle: params } unless params.instance_of?(Hash)
|
396
243
|
params[:unit] ||= :pixel
|
397
244
|
params[:reference] ||= :view
|
398
245
|
params
|
399
246
|
end
|
400
|
-
|
401
247
|
new({ particle: :get, category: :utility, type: :string }) do |params|
|
402
248
|
cell = params[:cell]
|
403
249
|
row_nb = cell[0]
|
404
250
|
column_nb = cell[1]
|
405
251
|
data[row_nb][data[row_nb].keys[column_nb]] # we get the content of the cell
|
406
252
|
end
|
407
|
-
|
408
253
|
new({ particle: :css, category: :utility, type: :string })
|
409
|
-
|
410
254
|
new({ read: :css }) do
|
411
255
|
CssProxy.new(js, nil, self)
|
412
256
|
end
|
413
|
-
|
414
257
|
new({ particle: :holder, category: :utility, type: :atome })
|
415
|
-
|
416
258
|
# this particle is mainly used in conjunction with alternate particle as a 'lambda' to alternate methods
|
417
259
|
new({ particle: :executor, category: :utility, type: :hash }) do |params|
|
418
260
|
params.each do |method, opt|
|
@@ -420,22 +262,12 @@ new({ particle: :executor, category: :utility, type: :hash }) do |params|
|
|
420
262
|
end
|
421
263
|
params
|
422
264
|
end
|
423
|
-
|
424
265
|
new({ particle: :tick, category: :utility, store: false, type: :hash }) do |val|
|
425
266
|
@tick[val] ||= 0
|
426
267
|
@tick[val] = @tick[val] += 1
|
427
268
|
@tick[val]
|
428
269
|
end
|
429
|
-
|
430
270
|
new({ particle: :storage, category: :utility, type: :hash })
|
431
271
|
new({ particle: :state, category: :utility, type: :symbol })
|
432
|
-
|
433
272
|
new({ particle: :record, category: :utility, type: :hash })
|
434
273
|
new({ particle: :preview, category: :utility, type: :hash })
|
435
|
-
|
436
|
-
# new(particle: :update) do |params| # specific to buttons molecule for now
|
437
|
-
# old_data= data
|
438
|
-
# delete({recursive: true})
|
439
|
-
# new_content=old_data.merge(params)
|
440
|
-
# buttons(new_content)
|
441
|
-
# end
|
@@ -92,7 +92,6 @@ Atome.new({ renderers: default_render, id: machine_id, type: :machine, password:
|
|
92
92
|
# user
|
93
93
|
user_password = { global: :star_win, read: { atome: :star_wars }, write: { atome: :star_wars } }
|
94
94
|
|
95
|
-
# human({ id: :anonymous, login: true, password: user_password, data: { birthday: '10/05/1996' }, selection: [], attach: :user_view })
|
96
95
|
human({ id: identity_generator, login: true, password: user_password, data: { birthday: '10/05/1996' }, selection: [], attach: :user_view })
|
97
96
|
|
98
97
|
Universe.current_machine = machine_id
|
@@ -161,14 +160,8 @@ def init_database
|
|
161
160
|
A.sync({ action: :init_db, data: { database: :eDen } }) do |data|
|
162
161
|
Universe.database_ready = data[:data][:message] == 'database_ready'
|
163
162
|
end
|
164
|
-
# authentication : email, pass
|
165
|
-
# atome : date, particles
|
166
|
-
# history : aid, particle, value, date
|
167
|
-
|
168
|
-
particles = Universe.particle_list
|
169
163
|
# now we populate the DB
|
170
164
|
A.sync({ action: :create_db_table, data: { table: :user, type: :string } }) do |_db_state|
|
171
|
-
# puts "===> #{_db_state}"
|
172
165
|
end
|
173
166
|
A.sync({ action: :create_db_table, data: { table: :atome } }) do |_db_state|
|
174
167
|
end
|
@@ -191,13 +184,11 @@ def init_database
|
|
191
184
|
|
192
185
|
|
193
186
|
# now we send localstorage content to the server
|
194
|
-
# puts "sending localstorage"
|
195
187
|
Atome.send_localstorage_content
|
196
188
|
|
197
189
|
end
|
198
190
|
|
199
191
|
def user_login
|
200
|
-
# user = Universe.current_user
|
201
192
|
password = Black_matter.password
|
202
193
|
sync({ action: :authentication, data: { email: 'jeezs@atome.one' } }) do |email|
|
203
194
|
puts "email received : #{email}"
|
@@ -212,6 +203,6 @@ end
|
|
212
203
|
# Universe.allow_sync= false # to stop data to be sync on server
|
213
204
|
touch_allow(false) # this lock the system right click in web view
|
214
205
|
# add a few default font
|
215
|
-
|
216
|
-
|
217
|
-
|
206
|
+
A.add_text_visual({ path: 'Roboto', name: 'Roboto-Bold' })
|
207
|
+
A.add_text_visual({ path: 'Roboto', name: 'Roboto-Thin' })
|
208
|
+
A.add_text_visual({ path: 'Roboto', name: 'Roboto-LightItalic' })
|
@@ -23,32 +23,24 @@ class Universe
|
|
23
23
|
@allow_sync = false # temp server storage sync
|
24
24
|
@connected = false
|
25
25
|
@database_ready = false
|
26
|
-
@tools_root=[]
|
26
|
+
@tools_root = []
|
27
27
|
@tools = {}
|
28
28
|
@allow_tool_operations = false
|
29
29
|
@active_tools = []
|
30
30
|
@atome_preset = []
|
31
|
-
@default_selection_style={border: { thickness: 1, red: 1, green: 0, blue: 0, alpha: 1, pattern: :dotted }}
|
32
|
-
@applicable_atomes= %i[color shadow border paint animation]
|
31
|
+
@default_selection_style = { border: { thickness: 1, red: 1, green: 0, blue: 0, alpha: 1, pattern: :dotted } }
|
32
|
+
@applicable_atomes = %i[color shadow border paint animation]
|
33
33
|
# @historicize=false
|
34
34
|
class << self
|
35
35
|
attr_reader :atomes, :atomes_ids, :renderer_list, :molecule_list, :atome_list, :particle_list, :classes, :counter,
|
36
36
|
:atomes_specificities
|
37
|
-
attr_accessor :connected, :allow_sync, :allow_localstorage, :database_ready, :edit_mode, :tools
|
37
|
+
attr_accessor :connected, :allow_sync, :allow_localstorage, :database_ready, :edit_mode, :tools, :tools_root,
|
38
38
|
:allow_tool_operations, :active_tools, :atome_preset, :applicable_atomes, :default_selection_style
|
39
39
|
|
40
40
|
def messages
|
41
41
|
@messages
|
42
42
|
end
|
43
43
|
|
44
|
-
# def eVe(val = nil)
|
45
|
-
# if val
|
46
|
-
# @eve = val
|
47
|
-
# else
|
48
|
-
# @eve
|
49
|
-
# end
|
50
|
-
# end
|
51
|
-
|
52
44
|
def store_messages(new_msg)
|
53
45
|
@messages[new_msg[:msg_nb]] = new_msg[:proc]
|
54
46
|
end
|
@@ -98,13 +90,11 @@ class Universe
|
|
98
90
|
|
99
91
|
def add_sanitizer_method(method_name, &method_proc)
|
100
92
|
# this method is used to add sanitizer methods
|
101
|
-
# instance_variable_get('@sanitizers').merge!({ method_name => method_proc })
|
102
93
|
@sanitizers.merge!({ method_name => method_proc })
|
103
94
|
end
|
104
95
|
|
105
96
|
def get_sanitizer_method(method_name)
|
106
97
|
# this method is used to add optional methods
|
107
|
-
# instance_variable_get('@sanitizers')[method_name]
|
108
98
|
@sanitizers[method_name]
|
109
99
|
end
|
110
100
|
|
@@ -125,21 +115,10 @@ class Universe
|
|
125
115
|
@atomes_ids[id] = aid
|
126
116
|
end
|
127
117
|
|
128
|
-
# def update_atome_id(aid, atome, prev_id)
|
129
|
-
# @atomes[id] = atome
|
130
|
-
# @atomes.delete(prev_id)
|
131
|
-
# end
|
132
|
-
# def update_atome_id(id, atome, prev_id)
|
133
|
-
# @atomes[id] = atome
|
134
|
-
# @atomes.delete(prev_id)
|
135
|
-
# end
|
136
|
-
|
137
118
|
def user_atomes
|
138
119
|
collected_id = []
|
139
|
-
@atomes.
|
140
|
-
# collected_id << id_found unless atome_found.tag && atome_found.tag[:system]
|
120
|
+
@atomes.each_value do |atome_found|
|
141
121
|
collected_id << atome_found.id unless atome_found.tag && atome_found.tag[:system]
|
142
|
-
|
143
122
|
end
|
144
123
|
collected_id
|
145
124
|
end
|
@@ -217,7 +196,6 @@ class Universe
|
|
217
196
|
end
|
218
197
|
|
219
198
|
def current_server
|
220
|
-
# return unless RUBY_ENGINE.downcase == 'opal'
|
221
199
|
JS.global[:location][:href].to_s
|
222
200
|
end
|
223
201
|
|
@@ -275,34 +253,16 @@ class Universe
|
|
275
253
|
operation_timing = Time.now.strftime("%Y%m%d%H%M%S%3N") + @increment.to_s
|
276
254
|
@increment += 1
|
277
255
|
@increment = @increment % 100
|
278
|
-
# puts "===> { #{id} => { #{operation} => { #{element} => #{params} } }, sync: false }"
|
279
|
-
# puts "<==== #{@allow_localstorage} : #{element} ====>"
|
280
256
|
if @allow_localstorage.include? element
|
281
257
|
JS.global[:localStorage].setItem(operation_timing, "{ #{id} => { #{operation} => { #{element} => #{params} } }, sync: false }")
|
282
258
|
@history[@history.length] = { operation_timing => { id => { operation => { element => params } }, sync: false, time: Time.now } }
|
283
|
-
# puts "===> { #{id} => { #{operation} => { #{element} => #{params} } }, sync: false }"
|
284
259
|
end
|
285
260
|
|
286
|
-
|
287
261
|
end
|
288
262
|
end
|
289
263
|
|
290
264
|
def story
|
291
265
|
@history
|
292
|
-
# # temp algo awaiting db to be ready, just for POC and tests
|
293
|
-
# return unless filter
|
294
|
-
#
|
295
|
-
# operation = filter[:operation]
|
296
|
-
# atome_id = filter[:id]
|
297
|
-
# particle = filter[:particle]
|
298
|
-
# filtered_history = []
|
299
|
-
# @history.each do |operation_number, alteration|
|
300
|
-
# if alteration[atome_id] && (alteration[atome_id][operation]) && (alteration[atome_id][operation][particle])
|
301
|
-
# filtered_history << { operation: operation_number, filter[:particle] => alteration[atome_id][operation][particle], sync: alteration[:sync], time: alteration[:time] }
|
302
|
-
# end
|
303
|
-
# end
|
304
|
-
# filtered_history
|
305
266
|
end
|
306
|
-
|
307
267
|
end
|
308
268
|
end
|