atome 0.5.3.7.2 → 0.5.3.7.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app_builder_helpers/Rakefile +1 -1
- data/lib/atome/atome.rb +10 -12
- data/lib/atome/extensions/atome.rb +6 -0
- data/lib/atome/extensions/mathematic.rb +24 -0
- data/lib/atome/extensions/matrix.rb +3 -1
- data/lib/atome/genesis/generators/atome.rb +23 -87
- data/lib/atome/genesis/generators/event.rb +8 -1
- data/lib/atome/genesis/generators/identity.rb +24 -75
- data/lib/atome/helpers/utilities.rb +17 -7
- data/lib/atome/kernel/batch.rb +3 -1
- data/lib/atome/kernel/universe.rb +3 -1
- data/lib/atome/presets/atome.rb +3 -66
- data/lib/atome/renderers/browser/event.rb +5 -0
- data/lib/atome/renderers/renderer.rb +2 -2
- data/lib/atome/version.rb +1 -1
- data/lib/atome.rb +1 -0
- data/vendor/assets/src/medias/images/logos/freebsd.svg +8 -0
- data/vendor/assets/src/medias/images/logos/vimeo.svg +16 -16
- data/vendor/assets/src/medias/rubies/examples/add.rb +4 -2
- data/vendor/assets/src/medias/rubies/examples/animation.rb +2 -2
- data/vendor/assets/src/medias/rubies/examples/clone.rb +1 -1
- data/vendor/assets/src/medias/rubies/examples/delete.rb +1 -4
- data/vendor/assets/src/medias/rubies/examples/drag.rb +10 -3
- data/vendor/assets/src/medias/rubies/examples/monitoring.rb +4 -4
- data/vendor/assets/src/medias/rubies/examples/table.rb +2 -2
- data/vendor/assets/src/medias/rubies/examples/text.rb +14 -8
- data/vendor/assets/src/medias/rubies/examples/touch.rb +3 -3
- metadata +4 -72
- data/vendor/assets/src/medias/audios/Binrpilot.mp3 +0 -0
- data/vendor/assets/src/medias/fonts/Dancing_Script/DancingScript-VariableFont_wght.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Dancing_Script/OFL.txt +0 -93
- data/vendor/assets/src/medias/fonts/Dancing_Script/README.txt +0 -66
- data/vendor/assets/src/medias/fonts/Dancing_Script/static/DancingScript-Bold.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Dancing_Script/static/DancingScript-Medium.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Dancing_Script/static/DancingScript-Regular.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Dancing_Script/static/DancingScript-SemiBold.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Mate_SC/MateSC-Regular.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Mate_SC/OFL.txt +0 -94
- data/vendor/assets/src/medias/fonts/Raleway/OFL.txt +0 -93
- data/vendor/assets/src/medias/fonts/Raleway/README.txt +0 -81
- data/vendor/assets/src/medias/fonts/Raleway/Raleway-Italic-VariableFont_wght.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Raleway/Raleway-VariableFont_wght.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Raleway/static/Raleway-Black.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Raleway/static/Raleway-BlackItalic.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Raleway/static/Raleway-Bold.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Raleway/static/Raleway-BoldItalic.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Raleway/static/Raleway-ExtraBold.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Raleway/static/Raleway-ExtraBoldItalic.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Raleway/static/Raleway-ExtraLight.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Raleway/static/Raleway-ExtraLightItalic.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Raleway/static/Raleway-Italic.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Raleway/static/Raleway-Light.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Raleway/static/Raleway-LightItalic.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Raleway/static/Raleway-Medium.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Raleway/static/Raleway-MediumItalic.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Raleway/static/Raleway-Regular.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Raleway/static/Raleway-SemiBold.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Raleway/static/Raleway-SemiBoldItalic.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Raleway/static/Raleway-Thin.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Raleway/static/Raleway-ThinItalic.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Vollkorn/OFL.txt +0 -93
- data/vendor/assets/src/medias/fonts/Vollkorn/README.txt +0 -75
- data/vendor/assets/src/medias/fonts/Vollkorn/Vollkorn-Italic-VariableFont_wght.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Vollkorn/Vollkorn-VariableFont_wght.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Vollkorn/static/Vollkorn-Black.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Vollkorn/static/Vollkorn-BlackItalic.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Vollkorn/static/Vollkorn-Bold.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Vollkorn/static/Vollkorn-BoldItalic.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Vollkorn/static/Vollkorn-ExtraBold.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Vollkorn/static/Vollkorn-ExtraBoldItalic.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Vollkorn/static/Vollkorn-Italic.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Vollkorn/static/Vollkorn-Medium.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Vollkorn/static/Vollkorn-MediumItalic.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Vollkorn/static/Vollkorn-Regular.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Vollkorn/static/Vollkorn-SemiBold.ttf +0 -0
- data/vendor/assets/src/medias/fonts/Vollkorn/static/Vollkorn-SemiBoldItalic.ttf +0 -0
- data/vendor/assets/src/medias/images/Icon_Help.png +0 -0
- data/vendor/assets/src/medias/images/avion.jpg +0 -0
- data/vendor/assets/src/medias/images/boat.png +0 -0
- data/vendor/assets/src/medias/images/dices.png +0 -0
- data/vendor/assets/src/medias/images/eVe_back.png +0 -0
- data/vendor/assets/src/medias/images/elephant.png +0 -0
- data/vendor/assets/src/medias/images/freebsd.png +0 -0
- data/vendor/assets/src/medias/images/grain_texture.png +0 -0
- data/vendor/assets/src/medias/images/image_missing.svg +0 -9
- data/vendor/assets/src/medias/images/jeezs.png +0 -0
- data/vendor/assets/src/medias/images/keyboard.png +0 -0
- data/vendor/assets/src/medias/images/living_room.png +0 -0
- data/vendor/assets/src/medias/images/logo.svg +0 -14
- data/vendor/assets/src/medias/images/moto.png +0 -0
- data/vendor/assets/src/medias/images/piano.png +0 -0
- data/vendor/assets/src/medias/images/the_mask.svg +0 -8
- data/vendor/assets/src/medias/images/tile_black.png +0 -0
- data/vendor/assets/src/medias/images/tile_white.png +0 -0
- data/vendor/assets/src/medias/videos/avengers.mp4 +0 -0
- data/vendor/assets/src/medias/videos/madmax.mp4 +0 -0
- data/vendor/assets/src/medias/videos/starwars.mov +0 -0
- data/vendor/assets/src/medias/videos/superman.mp4 +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a4400073c94d3ec5f105403f67d7000f183f1cd43b2de943267f2f4dda09248
|
4
|
+
data.tar.gz: cd98e412458149fab7088810f96a39d00035f54d2a5c385b88afc16564ad3aa8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cb7bb2d5da5fa0021bd568b543cf56a7e172457f3bf8e7907dbaacef4a6a15051bc682145da3447f9d051c0c5ac17bfa5d87038e3a6bdee06a63573efa3947b
|
7
|
+
data.tar.gz: 015efb61571056ffe114372af0bfe87b5a4056ca44ef581d0ec685313598936ea3870ae63d7e47b8017e3d655d77599c279ec540310f82edec50668141678696
|
data/lib/atome/atome.rb
CHANGED
@@ -14,7 +14,6 @@ class Atome
|
|
14
14
|
atomes.each_value do |elements|
|
15
15
|
# the instance variable below contain the id all any atomes that need to be informed when changes occurs
|
16
16
|
@broadcast = {}
|
17
|
-
# @at_time = {}
|
18
17
|
# now we store the proc in a an atome's property called :bloc
|
19
18
|
elements[:code] = atomes_proc if atomes_proc
|
20
19
|
@atome = elements
|
@@ -31,7 +30,7 @@ class Atome
|
|
31
30
|
if params || params == false
|
32
31
|
# the line below execute the proc created when using the build_particle method
|
33
32
|
instance_exec(params, user_proc, &method_proc) if method_proc.is_a?(Proc)
|
34
|
-
params = sanitize(element, params)
|
33
|
+
params = sanitize(element, params,&user_proc)
|
35
34
|
create_particle(element, store, render)
|
36
35
|
send("set_#{element}", params, &user_proc)
|
37
36
|
else
|
@@ -50,7 +49,9 @@ class Atome
|
|
50
49
|
|
51
50
|
def atome_creation_pre_treatment(element, params, &user_proc)
|
52
51
|
params = sanitize(element, params)
|
52
|
+
run_optional_proc("pre_render_#{@atome[:type]}".to_sym, self, params, &user_proc)
|
53
53
|
create_atome(element)
|
54
|
+
run_optional_proc("post_render_#{@atome[:type]}".to_sym, self, params, &user_proc)
|
54
55
|
send("set_#{element}", params, &user_proc)
|
55
56
|
end
|
56
57
|
|
@@ -88,8 +89,8 @@ class Atome
|
|
88
89
|
end
|
89
90
|
end
|
90
91
|
|
91
|
-
def run_optional_proc(proc_name, atome = self,
|
92
|
-
params = instance_variable_get("@#{element}")
|
92
|
+
def run_optional_proc(proc_name, atome = self, params, &user_proc)
|
93
|
+
# params = instance_variable_get("@#{element}")
|
93
94
|
option_found = Universe.get_optional_method(proc_name)
|
94
95
|
atome.instance_exec(params, user_proc, atome, &option_found) if option_found.is_a?(Proc)
|
95
96
|
end
|
@@ -115,14 +116,12 @@ class Atome
|
|
115
116
|
# we create a proc holder of any new particle if user pass a bloc
|
116
117
|
store_code_bloc(element, &user_proc) if user_proc
|
117
118
|
# Params is now an instance variable so it should be passed thru different methods
|
118
|
-
instance_variable_set("@#{element}", params)
|
119
|
-
run_optional_proc("pre_render_#{
|
120
|
-
|
121
|
-
|
122
|
-
run_optional_proc("post_render_#{@atome[:type]}".to_sym, self, element, &user_proc)
|
123
|
-
run_optional_proc("post_render_#{element}".to_sym, self, element, &user_proc)
|
119
|
+
instance_variable_set("@#{element}", params) if store
|
120
|
+
run_optional_proc("pre_render_#{element}".to_sym, self, params, &user_proc)
|
121
|
+
rendering(element,params, &user_proc) if render
|
122
|
+
run_optional_proc("post_render_#{element}".to_sym, self, params, &user_proc)
|
124
123
|
broadcasting(element)
|
125
|
-
store_value(element)
|
124
|
+
store_value(element) if store
|
126
125
|
self
|
127
126
|
end
|
128
127
|
|
@@ -154,7 +153,6 @@ class Atome
|
|
154
153
|
virtual_atome.user_proc = user_proc
|
155
154
|
virtual_atome.value = @atome[element]
|
156
155
|
virtual_atome
|
157
|
-
"it should contain the atome not : #{element}"
|
158
156
|
end
|
159
157
|
|
160
158
|
def create_atome(new_atome)
|
@@ -20,7 +20,13 @@ def new(params, &bloc)
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
def identity_generator(type=:element)
|
24
|
+
"#{type}_#{Universe.counter}"
|
25
|
+
# { date: Time.now, location: geolocation }
|
26
|
+
end
|
27
|
+
|
23
28
|
def grab(atome_to_get)
|
29
|
+
atome_to_get = atome_to_get.value if atome_to_get.instance_of? Atome
|
24
30
|
Universe.atomes[atome_to_get]
|
25
31
|
end
|
26
32
|
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Atome
|
4
|
+
def /val
|
5
|
+
val=val.value if val.instance_of? Atome
|
6
|
+
value/val
|
7
|
+
end
|
8
|
+
|
9
|
+
def *val
|
10
|
+
val=val.value if val.instance_of? Atome
|
11
|
+
value*val
|
12
|
+
end
|
13
|
+
|
14
|
+
def -val
|
15
|
+
val=val.value if val.instance_of? Atome
|
16
|
+
value-val
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
def +val
|
21
|
+
val=val.value if val.instance_of? Atome
|
22
|
+
value+val
|
23
|
+
end
|
24
|
+
end
|
@@ -242,7 +242,9 @@ module Matrix
|
|
242
242
|
default_renderer = Essentials.default_params[:render_engines]
|
243
243
|
atome_type = :matrix
|
244
244
|
generated_render = params[:renderers] || default_renderer
|
245
|
-
generated_id = params[:id] || "#{atome_type}_#{Universe.atomes.length}"
|
245
|
+
# generated_id = params[:id] || "#{atome_type}_#{Universe.atomes.length}"
|
246
|
+
generated_id = params[:id] || identity_generator(:matrix)
|
247
|
+
|
246
248
|
generated_parents = params[:parents] || [id.value]
|
247
249
|
generated_children = params[:children] || []
|
248
250
|
params = atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
|
@@ -1,7 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
new({ atome: :color })
|
4
|
+
|
4
5
|
new({ sanitizer: :color }) do |params|
|
6
|
+
# we delete any previous color if there's one
|
7
|
+
if color.value
|
8
|
+
attached.value.delete(color.value)
|
9
|
+
grab(color.value)&.delete(true) # we had the condition because the color may exist but
|
10
|
+
# so it is not sanitized so it has no id
|
11
|
+
end
|
5
12
|
parent_found = found_parents_and_renderers[:parent]
|
6
13
|
parent_found = [:black_matter] if parent_found == [:view]
|
7
14
|
render_found = found_parents_and_renderers[:renderers]
|
@@ -10,9 +17,10 @@ new({ sanitizer: :color }) do |params|
|
|
10
17
|
red: 0, green: 0, blue: 0, alpha: 1 }
|
11
18
|
params = create_color_hash(params) unless params.instance_of? Hash
|
12
19
|
new_params = default_params.merge!(params)
|
13
|
-
atome[:color] = new_params
|
20
|
+
atome[:color] = new_params[:id]
|
14
21
|
new_params
|
15
22
|
end
|
23
|
+
|
16
24
|
new({ atome: :image })
|
17
25
|
new({ sanitizer: :image }) do |params|
|
18
26
|
unless params.instance_of? Hash
|
@@ -39,19 +47,30 @@ new({ sanitizer: :video }) do |params|
|
|
39
47
|
end
|
40
48
|
new({ atome: :shadow })
|
41
49
|
new({ sanitizer: :shadow }) do |params|
|
50
|
+
# we delete any previous shadow if there's one
|
51
|
+
if shadow.value
|
52
|
+
attached.value.delete(shadow.value)
|
53
|
+
grab(shadow.value)&.delete(true) # we had the condition because the color may exist but
|
54
|
+
# so it is not sanitized so it has no id
|
55
|
+
end
|
42
56
|
parent_found = found_parents_and_renderers[:parent]
|
43
57
|
parent_found = [:user_view] if parent_found == [:view]
|
44
58
|
render_found = found_parents_and_renderers[:renderers]
|
45
59
|
default_params = { renderers: render_found, id: "shadow_#{Universe.atomes.length}", type: :shadow,
|
46
60
|
attach: parent_found,
|
47
61
|
red: 0, green: 0, blue: 0, alpha: 1, blur: 3, left: 3, top: 3 }
|
48
|
-
default_params.merge!(params)
|
62
|
+
# default_params.merge!(params)
|
63
|
+
params = create_shadow_hash(params) unless params.instance_of? Hash
|
64
|
+
new_params = default_params.merge!(params)
|
65
|
+
atome[:shadow] = new_params
|
66
|
+
new_params
|
67
|
+
|
49
68
|
end
|
50
69
|
new({ atome: :shape })
|
51
70
|
new({ atome: :code })
|
52
71
|
new({ atome: :audio })
|
53
72
|
new({ atome: :element })
|
54
|
-
new({ sanitizer: :element })do |params|
|
73
|
+
new({ sanitizer: :element }) do |params|
|
55
74
|
parent_found = found_parents_and_renderers[:parent]
|
56
75
|
render_found = []
|
57
76
|
default_params = { renderers: render_found, id: "element_#{Universe.atomes.length}", type: :element,
|
@@ -59,7 +78,7 @@ new({ sanitizer: :element })do |params|
|
|
59
78
|
default_params.merge!(params)
|
60
79
|
end
|
61
80
|
new({ atome: :web })
|
62
|
-
new({ sanitizer: :web })do |params|
|
81
|
+
new({ sanitizer: :web }) do |params|
|
63
82
|
default_renderer = Essentials.default_params[:render_engines]
|
64
83
|
|
65
84
|
generated_id = params[:id] || "web_#{Universe.atomes.length}"
|
@@ -96,86 +115,3 @@ new({ sanitizer: :text }) do |params|
|
|
96
115
|
params
|
97
116
|
end
|
98
117
|
|
99
|
-
|
100
|
-
# generator = Genesis.generator
|
101
|
-
#
|
102
|
-
# generator.build_atome(:animation)
|
103
|
-
# generator.build_atome(:color)
|
104
|
-
# generator.build_sanitizer(:color) do |params|
|
105
|
-
# parent_found = found_parents_and_renderers[:parent]
|
106
|
-
# parent_found = [:black_matter] if parent_found == [:view]
|
107
|
-
# render_found = found_parents_and_renderers[:renderers]
|
108
|
-
# default_params = { renderers: render_found, id: "color_#{Universe.atomes.length}", type: :color,
|
109
|
-
# attach: parent_found,
|
110
|
-
# red: 0, green: 0, blue: 0, alpha: 1 }
|
111
|
-
# params = create_color_hash(params) unless params.instance_of? Hash
|
112
|
-
# new_params = default_params.merge!(params)
|
113
|
-
# atome[:color] = new_params
|
114
|
-
# new_params
|
115
|
-
# end
|
116
|
-
#
|
117
|
-
# generator.build_atome(:video)
|
118
|
-
# generator.build_sanitizer(:video) do |params|
|
119
|
-
# parent_found = found_parents_and_renderers[:parent]
|
120
|
-
# render_found = found_parents_and_renderers[:renderers]
|
121
|
-
# default_params = { renderers: render_found, id: "video_#{Universe.atomes.length}", type: :video,
|
122
|
-
# parents: parent_found }
|
123
|
-
# default_params.merge!(params)
|
124
|
-
# end
|
125
|
-
# generator.build_atome(:shadow)
|
126
|
-
# generator.build_sanitizer(:shadow) do |params|
|
127
|
-
# parent_found = found_parents_and_renderers[:parent]
|
128
|
-
# parent_found = [:user_view] if parent_found == [:view]
|
129
|
-
# render_found = found_parents_and_renderers[:renderers]
|
130
|
-
# default_params = { renderers: render_found, id: "shadow_#{Universe.atomes.length}", type: :shadow,
|
131
|
-
# attach: parent_found,
|
132
|
-
# red: 0, green: 0, blue: 0, alpha: 1, blur: 3, left: 3, top: 3 }
|
133
|
-
# default_params.merge!(params)
|
134
|
-
# end
|
135
|
-
# generator.build_atome(:shape)
|
136
|
-
# generator.build_atome(:text)
|
137
|
-
# generator.build_atome(:code)
|
138
|
-
# generator.build_atome(:audio)
|
139
|
-
# generator.build_atome(:element)
|
140
|
-
# generator.build_sanitizer(:element) do |params|
|
141
|
-
# parent_found = found_parents_and_renderers[:parent]
|
142
|
-
# render_found = []
|
143
|
-
# default_params = { renderers: render_found, id: "element_#{Universe.atomes.length}", type: :element,
|
144
|
-
# parents: parent_found, data: '' }
|
145
|
-
# default_params.merge!(params)
|
146
|
-
# end
|
147
|
-
# generator.build_atome(:collector)
|
148
|
-
# generator.build_atome(:web)
|
149
|
-
# generator.build_sanitizer(:web) do |params|
|
150
|
-
# default_renderer = Essentials.default_params[:render_engines]
|
151
|
-
#
|
152
|
-
# generated_id = params[:id] || "web_#{Universe.atomes.length}"
|
153
|
-
# generated_render = params[:renderers] || default_renderer
|
154
|
-
# generated_parents = params[:parents] || id.value
|
155
|
-
# # TODO : the line below should get the value from default params Essentials
|
156
|
-
# temp_default = { renderers: generated_render, id: generated_id, type: :web, parents: [generated_parents],
|
157
|
-
# children: [], width: 120, height: 120, path: 'https://www.youtube.com/embed/usQDazZKWAk' }
|
158
|
-
# params = temp_default.merge(params)
|
159
|
-
# params
|
160
|
-
# end
|
161
|
-
# generator.build_sanitizer(:animation) do |params|
|
162
|
-
# default_renderer = Essentials.default_params[:render_engines]
|
163
|
-
# atome_type = :animation
|
164
|
-
# generated_render = params[:renderers] || default_renderer
|
165
|
-
# generated_id = params[:id] || "#{atome_type}_#{Universe.atomes.length}"
|
166
|
-
# generated_parents = params[:parents] || []
|
167
|
-
# generated_children = params[:children] || []
|
168
|
-
# params = atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
|
169
|
-
# params
|
170
|
-
# end
|
171
|
-
# generator.build_sanitizer(:text) do |params|
|
172
|
-
# params = { data: params } unless params.instance_of? Hash
|
173
|
-
# default_renderer = Essentials.default_params[:render_engines]
|
174
|
-
# atome_type = :text
|
175
|
-
# generated_render = params[:renderers] || default_renderer
|
176
|
-
# generated_id = params[:id] || "#{atome_type}_#{Universe.atomes.length}"
|
177
|
-
# generated_parents = params[:parents] || [id.value]
|
178
|
-
# generated_children = params[:children] || []
|
179
|
-
# params = atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
|
180
|
-
# params
|
181
|
-
# end
|
@@ -2,7 +2,14 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
-
new({particle: :touch })
|
5
|
+
new({particle: :touch , type: :hash, store: false })
|
6
|
+
new({ post: :touch }) do |params, user_bloc|
|
7
|
+
@touch = {} if @touch == nil
|
8
|
+
@touch[params] = user_bloc
|
9
|
+
# as store for touch is set to false we have to manually save the instance variable
|
10
|
+
store_value(:touch)
|
11
|
+
end
|
12
|
+
|
6
13
|
new({particle: :play }) do
|
7
14
|
@atome[:pause] = :false
|
8
15
|
end
|
@@ -2,9 +2,7 @@
|
|
2
2
|
|
3
3
|
new({ particle: :attached })
|
4
4
|
new({ sanitizer: :attached }) do |params|
|
5
|
-
unless params.instance_of? Array
|
6
|
-
params = [params]
|
7
|
-
end
|
5
|
+
params = [params] unless params.instance_of? Array
|
8
6
|
params
|
9
7
|
end
|
10
8
|
new({ pre: :attached }) do |children_ids|
|
@@ -13,32 +11,44 @@ new({ pre: :attached }) do |children_ids|
|
|
13
11
|
child_found = grab(child_id)
|
14
12
|
parents_found = @atome[:id]
|
15
13
|
child_found.family(parents_found)
|
16
|
-
# parents_found.atome[:attach] = [] unless parents_found.atome[:attach]
|
17
14
|
child_found.atome[:attach] = [parents_found]
|
18
15
|
end
|
19
16
|
end
|
20
17
|
new({ particle: :type })
|
21
18
|
new({ particle: :children })
|
22
|
-
|
23
|
-
|
19
|
+
|
20
|
+
new ({ sanitizer: :children }) do |params|
|
21
|
+
# TODO factorise the line below and 'sanitized_params' for all particle type of Array
|
22
|
+
params = [params] unless params.instance_of? Array
|
23
|
+
sanitized_params = []
|
24
|
+
params.each do |child_id|
|
24
25
|
child_id = child_id.value if child_id.instance_of? Atome
|
26
|
+
sanitized_params << child_id
|
25
27
|
child_found = grab(child_id)
|
26
28
|
parents_found = @atome[:id]
|
27
29
|
# FIXME : broadcast may malfunction because of the commented line below,
|
28
|
-
# FIXME suite : if uncomment object
|
29
|
-
#
|
30
|
+
# FIXME suite : if uncomment object hierarchy is broken (cf Vie Project)
|
31
|
+
# FIXME : parent child problem may be caused by th eline below
|
32
|
+
child_found.family(parents_found)
|
30
33
|
child_found.atome[:parents] = [parents_found]
|
31
34
|
end
|
35
|
+
sanitized_params
|
32
36
|
end
|
37
|
+
|
33
38
|
new({ particle: :parents })
|
34
|
-
new({
|
35
|
-
|
39
|
+
new({ sanitizer: :parents }) do |params|
|
40
|
+
params = [params] unless params.instance_of? Array
|
41
|
+
sanitized_params = []
|
42
|
+
params.each do |parents_id|
|
36
43
|
parents_id = parents_id.value if parents_id.instance_of? Atome
|
44
|
+
sanitized_params << parents_id
|
37
45
|
parents_found = grab(parents_id)
|
38
46
|
family(parents_id)
|
39
47
|
parents_found.atome[:children] << atome[:id]
|
40
48
|
end
|
49
|
+
sanitized_params
|
41
50
|
end
|
51
|
+
|
42
52
|
new({ particle: :family })
|
43
53
|
new({ particle: :link })
|
44
54
|
new({ particle: :id })
|
@@ -62,8 +72,10 @@ new({ pre: :attach }) do |parents_ids|
|
|
62
72
|
parents_found.atome[:attached] << atome[:id]
|
63
73
|
end
|
64
74
|
end
|
65
|
-
new({ particle: :detached })
|
66
|
-
|
75
|
+
new({ particle: :detached }) do |value|
|
76
|
+
attached.value.delete(value)
|
77
|
+
end
|
78
|
+
new({ particle: :intricate, type: :array })
|
67
79
|
new({ particle: :clones }) do |clones_found|
|
68
80
|
clones_found.each_with_index do |clone_found, index|
|
69
81
|
particles_intricated = clone_found[:intricate] ||= []
|
@@ -77,66 +89,3 @@ new({ particle: :clones }) do |clones_found|
|
|
77
89
|
end
|
78
90
|
end
|
79
91
|
end
|
80
|
-
|
81
|
-
# generator = Genesis.generator
|
82
|
-
#
|
83
|
-
# generator.build_particle(:type)
|
84
|
-
# generator.build_particle(:parents)
|
85
|
-
# generator.build_particle(:children)
|
86
|
-
# generator.build_option(:pre_render_parents) do |parents_ids|
|
87
|
-
# parents_ids.each do |parents_id|
|
88
|
-
# parents_id = parents_id.value if parents_id.instance_of? Atome
|
89
|
-
# parents_found = grab(parents_id)
|
90
|
-
# family(parents_id)
|
91
|
-
# parents_found.atome[:children] << atome[:id]
|
92
|
-
# end
|
93
|
-
# end
|
94
|
-
# generator.build_option(:pre_render_children) do |children_ids|
|
95
|
-
# children_ids.each do |child_id|
|
96
|
-
# child_id = child_id.value if child_id.instance_of? Atome
|
97
|
-
# child_found = grab(child_id)
|
98
|
-
# parents_found = @atome[:id]
|
99
|
-
# # FIXME : broadcast may malfunction because of the commented line below,
|
100
|
-
# # FIXME suite : if uncomment object hierreachy is broken (cf Vie Project)
|
101
|
-
# # child_found.family(parents_found)
|
102
|
-
# child_found.atome[:parents] = [parents_found]
|
103
|
-
# end
|
104
|
-
# end
|
105
|
-
# generator.build_particle(:family, { render: true, store: false })
|
106
|
-
# generator.build_particle(:link) do |child_id|
|
107
|
-
# child_found = grab(child_id)
|
108
|
-
# child_found.atome[:parents] << @atome[:id]
|
109
|
-
# child_found.refresh
|
110
|
-
# end
|
111
|
-
# generator.build_particle(:id)
|
112
|
-
# generator.build_sanitizer(:id)
|
113
|
-
# generator.build_particle(:name)
|
114
|
-
# generator.build_particle(:active)
|
115
|
-
# generator.build_particle(:attach)
|
116
|
-
# generator.build_option(:pre_render_attach) do |parents_ids|
|
117
|
-
# parents_ids.each do |parents_id|
|
118
|
-
# parents_id = parents_id.value if parents_id.instance_of? Atome
|
119
|
-
# parents_found = grab(parents_id)
|
120
|
-
# family(parents_id)
|
121
|
-
# parents_found.atome[:attached] = [] unless parents_found.atome[:attached]
|
122
|
-
# parents_found.atome[:attached] << atome[:id]
|
123
|
-
# end
|
124
|
-
# end
|
125
|
-
#
|
126
|
-
# generator.build_particle(:detached) do |attach_to_remove|
|
127
|
-
# attached.value.delete(attach_to_remove)
|
128
|
-
# end
|
129
|
-
# generator.build_particle(:intricate, { type: :array })
|
130
|
-
# generator.build_particle(:clones) do |clones_found|
|
131
|
-
# clones_found.each_with_index do |clone_found, index|
|
132
|
-
# particles_intricated = clone_found[:intricate] ||= []
|
133
|
-
# clone_id = "#{particles[:id]}_clone_#{index}"
|
134
|
-
# original_id = atome[:id]
|
135
|
-
# clone_found[:id] = clone_id
|
136
|
-
# clone_found = particles.merge(clone_found)
|
137
|
-
# cloned_atome = Atome.new({ clone: clone_found })
|
138
|
-
# cloned_atome.monitor({ atomes: [original_id], particles: particles_intricated }) do |_atome, particle, value|
|
139
|
-
# cloned_atome.send(particle, value)
|
140
|
-
# end
|
141
|
-
# end
|
142
|
-
# end
|
@@ -6,6 +6,7 @@ class Atome
|
|
6
6
|
|
7
7
|
def collapse
|
8
8
|
@atome.each do |element, value|
|
9
|
+
# puts "=============> #{element}"
|
9
10
|
send(element, value) unless element == :type
|
10
11
|
end
|
11
12
|
end
|
@@ -14,15 +15,12 @@ class Atome
|
|
14
15
|
true
|
15
16
|
end
|
16
17
|
|
17
|
-
def sanitize(element, params)
|
18
|
+
def sanitize(element, params,&user_proc)
|
18
19
|
bloc_found = Universe.get_sanitizer_method(element)
|
19
|
-
params = instance_exec(params, &bloc_found) if bloc_found.is_a?(Proc)
|
20
|
+
params = instance_exec(params,user_proc, &bloc_found) if bloc_found.is_a?(Proc)
|
20
21
|
params
|
21
22
|
end
|
22
23
|
|
23
|
-
def identity_generator
|
24
|
-
{ date: Time.now, location: geolocation }
|
25
|
-
end
|
26
24
|
|
27
25
|
def history(property, value)
|
28
26
|
"historize : #{property} #{value}"
|
@@ -42,11 +40,11 @@ class Atome
|
|
42
40
|
|
43
41
|
def monitor(params=nil, &proc_monitoring)
|
44
42
|
if params
|
45
|
-
atome[:monitor] ||= {}
|
43
|
+
monitoring=atome[:monitor] ||= {}
|
46
44
|
params[:atomes].each do |atome_id|
|
47
45
|
target_broadcaster = grab(atome_id).instance_variable_get('@broadcast')
|
48
46
|
monitor_id = params[:id] || "monitor#{target_broadcaster.length}"
|
49
|
-
|
47
|
+
monitoring[monitor_id]=params.merge({code: proc_monitoring})
|
50
48
|
target_broadcaster[monitor_id] = { particles: params[:particles], code: proc_monitoring }
|
51
49
|
end
|
52
50
|
else
|
@@ -118,6 +116,18 @@ class Atome
|
|
118
116
|
end
|
119
117
|
end
|
120
118
|
|
119
|
+
def include?(value)
|
120
|
+
self.value.include?(value)
|
121
|
+
end
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
def each_with_index(*args)
|
126
|
+
self.value.each_with_index do |val, index|
|
127
|
+
yield(val, index)
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
121
131
|
def [](range)
|
122
132
|
if value[range].class == Atome
|
123
133
|
return value[range]
|
data/lib/atome/kernel/batch.rb
CHANGED
@@ -17,7 +17,9 @@ class Batch
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def initialize(params)
|
20
|
-
@id = params[:id] || "batch_#{Universe.atomes.length}"
|
20
|
+
# @id = params[:id] || "batch_#{Universe.atomes.length}"
|
21
|
+
@id = params[:id] || identity_generator(:batch)
|
22
|
+
Universe.add_to_atomes(@id, self)
|
21
23
|
Universe.add_to_atomes(@id, self)
|
22
24
|
end
|
23
25
|
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
# universe method here
|
4
4
|
class Universe
|
5
|
+
@counter=0
|
5
6
|
@atomes = {}
|
6
7
|
@classes = {}
|
7
8
|
@atome_list = []
|
@@ -10,7 +11,7 @@ class Universe
|
|
10
11
|
@options = {}
|
11
12
|
@sanitizers = {}
|
12
13
|
class << self
|
13
|
-
attr_reader :atomes, :renderer_list, :atome_list, :particle_list, :classes
|
14
|
+
attr_reader :atomes, :renderer_list, :atome_list, :particle_list, :classes, :counter
|
14
15
|
|
15
16
|
def add_to_particle_list(particle = nil, type)
|
16
17
|
instance_variable_get('@particle_list')[particle]=type
|
@@ -43,6 +44,7 @@ class Universe
|
|
43
44
|
def add_to_atomes(id, atome)
|
44
45
|
# instance_variable_get('@atomes').merge!(atome)
|
45
46
|
@atomes[id] = atome
|
47
|
+
@counter=@counter+1
|
46
48
|
end
|
47
49
|
|
48
50
|
def update_atome_id(id, atome, prev_id)
|
data/lib/atome/presets/atome.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# TODO: Factorise codes below
|
6
6
|
# TODO we must clarified/unified the usage of presets and sanitizer it is not clear
|
7
7
|
|
8
|
-
|
8
|
+
|
9
9
|
class Atome
|
10
10
|
def atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
|
11
11
|
temp_default = Essentials.default_params[atome_type] || {}
|
@@ -21,7 +21,7 @@ class Atome
|
|
21
21
|
default_renderer = Essentials.default_params[:render_engines]
|
22
22
|
atome_type = :box
|
23
23
|
generated_render = params[:renderers] || default_renderer
|
24
|
-
generated_id = params[:id] ||
|
24
|
+
generated_id = params[:id] || identity_generator(:box)
|
25
25
|
generated_parents = params[:parents] || [id.value]
|
26
26
|
generated_children = params[:children] || []
|
27
27
|
|
@@ -34,74 +34,11 @@ class Atome
|
|
34
34
|
default_renderer = Essentials.default_params[:render_engines]
|
35
35
|
atome_type = :circle
|
36
36
|
generated_render = params[:renderers] || default_renderer
|
37
|
-
generated_id = params[:id] ||
|
37
|
+
generated_id = params[:id] || identity_generator(:circle)
|
38
38
|
generated_parents = params[:parents] || [id.value]
|
39
39
|
generated_children = params[:children] || []
|
40
40
|
params = atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
|
41
41
|
Atome.new({ atome_type => params }, &bloc)
|
42
42
|
end
|
43
43
|
|
44
|
-
# def image(params = {}, &bloc)
|
45
|
-
# default_renderer = Essentials.default_params[:render_engines]
|
46
|
-
# generated_id = params[:id] || "image_#{Universe.atomes.length}"
|
47
|
-
# generated_render = params[:renderers] || default_renderer
|
48
|
-
# generated_parents = params[:parents] || id.value
|
49
|
-
# # TODO : the line below should get the value from default params Essentials
|
50
|
-
# temp_default = { renderers: generated_render, id: generated_id, type: :image, parents: [generated_parents],
|
51
|
-
# children: [], width: 99, height: 99, path: './medias/images/atome.svg' }
|
52
|
-
# params = temp_default.merge(params)
|
53
|
-
# Atome.new({ image: params }, &bloc)
|
54
|
-
# end
|
55
|
-
#
|
56
|
-
# def text(params = {}, &bloc)
|
57
|
-
# default_renderer = Essentials.default_params[:render_engines]
|
58
|
-
# atome_type = :text
|
59
|
-
# generated_render = params[:renderers] || default_renderer
|
60
|
-
# generated_id = params[:id] || "#{atome_type}_#{Universe.atomes.length}"
|
61
|
-
# generated_parents = params[:parents] || [id.value]
|
62
|
-
# generated_children = params[:children] || []
|
63
|
-
# params = atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
|
64
|
-
# Atome.new({ atome_type => params }, &bloc)
|
65
|
-
# end
|
66
|
-
|
67
|
-
# def element(params = 'kjh', &bloc)
|
68
|
-
# atome_type = :element
|
69
|
-
#
|
70
|
-
# generated_render = params[:renderers] || []
|
71
|
-
#
|
72
|
-
# generated_id = params[:id] || "#{atome_type}_#{Universe.atomes.length}"
|
73
|
-
# generated_parents = params[:parents] || [id.value]
|
74
|
-
# generated_children = params[:children] || []
|
75
|
-
#
|
76
|
-
# generated_data = ""
|
77
|
-
# params = atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
|
78
|
-
# # FIXME: do not merge generated_data like this but change the atomecommon
|
79
|
-
# params.merge(generated_data)
|
80
|
-
#
|
81
|
-
# Atome.new({ atome_type => params }, &bloc)
|
82
|
-
# end
|
83
|
-
|
84
|
-
# def web(params = {}, &bloc)
|
85
|
-
# default_renderer = Essentials.default_params[:render_engines]
|
86
|
-
#
|
87
|
-
# generated_id = params[:id] || "web_#{Universe.atomes.length}"
|
88
|
-
# generated_render = params[:renderers] || default_renderer
|
89
|
-
# generated_parents = params[:parents] || id.value
|
90
|
-
# # TODO : the line below should get the value from default params Essentials
|
91
|
-
# temp_default = { renderers: generated_render, id: generated_id, type: :web, parents: [generated_parents],
|
92
|
-
# children: [], width: 120, height: 120, path: 'https://www.youtube.com/embed/usQDazZKWAk' }
|
93
|
-
# params = temp_default.merge(params)
|
94
|
-
# Atome.new({ image: params }, &bloc)
|
95
|
-
# end
|
96
|
-
|
97
|
-
# def animation(params = {}, &bloc)
|
98
|
-
# default_renderer = Essentials.default_params[:render_engines]
|
99
|
-
# atome_type = :animation
|
100
|
-
# generated_render = params[:renderers] || default_renderer
|
101
|
-
# generated_id = params[:id] || "#{atome_type}_#{Universe.atomes.length}"
|
102
|
-
# generated_parents = params[:parents] || []
|
103
|
-
# generated_children = params[:children] || []
|
104
|
-
# params = atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
|
105
|
-
# Atome.new({ atome_type => params }, &bloc)
|
106
|
-
# end
|
107
44
|
end
|
@@ -4,6 +4,11 @@ generator = Genesis.generator
|
|
4
4
|
|
5
5
|
generator.build_render(:browser_touch) do |value, proc|
|
6
6
|
atome_id = @browser_object.attribute(:id)
|
7
|
+
# value.each do |tap_mode, user_proc|
|
8
|
+
# alert "#{tap_mode} : #{user_proc}\n #{tap_mode.class} : #{user_proc.class}"
|
9
|
+
# BrowserHelper.send("browser_touch_#{tap_mode}", atome_id,self, user_proc)
|
10
|
+
# end
|
11
|
+
# alert "#{value} : #{proc}\n #{value.class} : #{proc.class}"
|
7
12
|
BrowserHelper.send("browser_touch_#{value}", atome_id,self, proc)
|
8
13
|
end
|
9
14
|
|
@@ -4,8 +4,8 @@
|
|
4
4
|
class Atome
|
5
5
|
private
|
6
6
|
|
7
|
-
def rendering(element, &user_proc)
|
8
|
-
params=instance_variable_get("@#{element}")
|
7
|
+
def rendering(element,params, &user_proc)
|
8
|
+
# params=instance_variable_get("@#{element}")
|
9
9
|
render_engines = @atome[:renderers]
|
10
10
|
render_engines.each do |render_engine|
|
11
11
|
send("#{render_engine}_#{element}", params, &user_proc)
|
data/lib/atome/version.rb
CHANGED