atome 0.5.6.2.5 → 0.5.6.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/atome.gemspec +4 -0
- data/lib/atome/atome.rb +7 -1
- data/lib/atome/extensions/atome.rb +22 -5
- data/lib/atome/genesis/generators/event.rb +11 -0
- data/lib/atome/genesis/generators/hierarchy.rb +6 -5
- data/lib/atome/genesis/generators/identity.rb +17 -8
- data/lib/atome/genesis/sparkle.rb +12 -7
- data/lib/atome/kernel/universe.rb +16 -3
- data/lib/atome/presets/atome.rb +3 -2
- data/lib/atome/version.rb +1 -1
- data/lib/eVe/eVe.rb +2 -1
- data/lib/eVe/eVe_relative.rb +2 -1
- data/lib/eVe/lib/examples/site.rb +34 -0
- data/lib/eVe/lib/init.rb +44 -10
- data/lib/eVe/lib/intuition/inputs.rb +111 -0
- data/lib/eVe/lib/intuition/sliders.rb +49 -0
- data/lib/eVe/lib/intuition/toolbox.rb +280 -0
- data/lib/eVe/lib/version.rb +11 -0
- data/lib/renderers/html/html.rb +2 -2
- data/vendor/assets/application/examples/animation.rb +2 -7
- data/vendor/assets/application/examples/attached.rb +9 -2
- data/vendor/assets/application/examples/basic_understanding.rb +2 -0
- data/vendor/assets/application/examples/category.rb +6 -2
- data/vendor/assets/application/examples/database_handling.rb +39 -39
- data/vendor/assets/application/examples/find.rb +5 -4
- data/vendor/assets/application/examples/random.rb +3 -3
- data/vendor/assets/application/examples/repeat.rb +1 -1
- data/vendor/assets/application/examples/test.rb +1 -6
- data/vendor/assets/server/eDen.rb +54 -25
- data/vendor/assets/src/index_wasm.html +6 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9034e0154aea8e0b9824eaf694efc80cee092201b66eaf4b053792c9bc0ee2a8
|
4
|
+
data.tar.gz: a8353fdc49263c322bd90e0d709b2ee18dd6052726bec4979c90d5e40578d2b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61338bfdb8ee585fa20a979e3587e3d8ee33e488ef307ead2049fbe1c3aaac4013ac6d40b0f039f7926dab5650c021369b8d61097938e9beefc355995d33c0d2
|
7
|
+
data.tar.gz: cf616fa2d32ffb36f8f67e1b31442488262df2577a7fc57b5ce0ab0107cebdb91deb86aca049e3ce876716779d937675ebdd7ee95d8e9dc21c8a11b01a6a0809
|
data/atome.gemspec
CHANGED
@@ -78,6 +78,10 @@ Gem::Specification.new do |spec|
|
|
78
78
|
# the gem below are need to make the atome server works on Windows
|
79
79
|
spec.add_runtime_dependency 'tzinfo-data', '~> 1.2023.4'
|
80
80
|
spec.add_runtime_dependency 'win32-security', '~> 0.5.0'
|
81
|
+
spec.add_runtime_dependency 'wdm', '>= 0.1.0' if Gem.win_platform?
|
82
|
+
|
83
|
+
# patch because guard have bad dependency
|
84
|
+
# spec.add_runtime_dependency 'pry', '>= 0.14.2'
|
81
85
|
|
82
86
|
# Uncomment to register a new dependency of your gem
|
83
87
|
# spec.add_dependency "example-gem", "~> 1.0"
|
data/lib/atome/atome.rb
CHANGED
@@ -4,6 +4,9 @@
|
|
4
4
|
class Atome
|
5
5
|
include Essentials
|
6
6
|
|
7
|
+
def aid(_v=nil)
|
8
|
+
@aid
|
9
|
+
end
|
7
10
|
def initialize(new_atome = {}, &atomes_proc)
|
8
11
|
# TODO: atome format should always be as followed : {value: 0.44, unit: :px, opt1: 554}
|
9
12
|
# when using optimised version of atome you must type eg : a.set({left: {value: 33, unit: '%', reference: :center}})
|
@@ -20,7 +23,10 @@ class Atome
|
|
20
23
|
@collect = {}
|
21
24
|
@int8= {}
|
22
25
|
@css = {}
|
23
|
-
@
|
26
|
+
@aid = identity_generator(:a)
|
27
|
+
Universe.add_to_atomes( @aid, self)
|
28
|
+
@id = new_atome[:id] || @aid
|
29
|
+
Universe.id_to_aid(@id,@aid)
|
24
30
|
@type = new_atome[:type] || :element
|
25
31
|
@attached = []
|
26
32
|
@category = []
|
@@ -120,15 +120,32 @@ class Object
|
|
120
120
|
end
|
121
121
|
|
122
122
|
def identity_generator(type_needed = :element)
|
123
|
-
"#{type_needed}_#{Universe.counter}"
|
123
|
+
"#{type_needed}_#{Universe.counter}".to_sym
|
124
|
+
end
|
125
|
+
|
126
|
+
def hook(a_id)
|
127
|
+
a_id=a_id.to_sym
|
128
|
+
Universe.atomes[a_id]
|
124
129
|
end
|
125
130
|
|
126
131
|
def grab(id_to_get)
|
132
|
+
id_to_get=id_to_get.to_sym
|
127
133
|
return if id_to_get == false
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
134
|
+
aid_to_get= Universe.atomes_ids[id_to_get]
|
135
|
+
# puts id_to_get.class
|
136
|
+
# alert Universe.atomes
|
137
|
+
aid_to_get = '' if aid_to_get.instance_of? Array
|
138
|
+
# id_to_get = id_to_get.to_sym
|
139
|
+
|
140
|
+
# if id_to_get.nil? do
|
141
|
+
# if aid_to_get.nil?
|
142
|
+
# alert id_to_get
|
143
|
+
# else
|
144
|
+
|
145
|
+
# end
|
146
|
+
# end
|
147
|
+
# alert Universe.atomes[id_to_get]
|
148
|
+
Universe.atomes[aid_to_get]
|
132
149
|
end
|
133
150
|
|
134
151
|
def box(params = {}, &proc)
|
@@ -322,3 +322,14 @@ new({ particle: :overflow, category: :event, type: :boolean }) do |params, bloc|
|
|
322
322
|
params
|
323
323
|
|
324
324
|
end
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
new({particle: :animate , category: :event, type: :hash}) do |params|
|
329
|
+
if params.instance_of? Hash
|
330
|
+
params={ from: 0, to: 300, duration: 1000 }.merge(params)
|
331
|
+
else
|
332
|
+
params={ from: 0, to: 300, duration: 1000 }
|
333
|
+
end
|
334
|
+
html.play_animation(params)
|
335
|
+
end
|
@@ -7,11 +7,12 @@ def detach_child(child)
|
|
7
7
|
|
8
8
|
end
|
9
9
|
|
10
|
-
def detach_from_parent(parent_found, child_found)
|
11
|
-
|
12
|
-
end
|
10
|
+
# def detach_from_parent(parent_found, child_found)
|
11
|
+
# child_found.attach(parent_found.id)
|
12
|
+
# end
|
13
13
|
|
14
14
|
def attachment_common(child_id, parents_id, direction, &user_proc)
|
15
|
+
|
15
16
|
parent_found = grab(parents_id)
|
16
17
|
if direction == :attach
|
17
18
|
if parent_found
|
@@ -21,11 +22,11 @@ def attachment_common(child_id, parents_id, direction, &user_proc)
|
|
21
22
|
render(:attach, parents_id, &user_proc)
|
22
23
|
else
|
23
24
|
# we remove the current id from parent
|
24
|
-
grab(attach).attached.delete(@id)
|
25
|
+
# grab(attach).attached.delete(@id)
|
25
26
|
end
|
26
27
|
else
|
27
28
|
child_found = grab(child_id)
|
28
|
-
|
29
|
+
child_found.attach(parents_id)
|
29
30
|
child_found.render(:attach, parents_id, &user_proc)
|
30
31
|
end
|
31
32
|
end
|
@@ -5,11 +5,20 @@ new({ particle: :type, category: :identity, type: :string })
|
|
5
5
|
new({ particle: :id, category: :identity, type: :int })
|
6
6
|
new({ sanitizer: :id }) do |params|
|
7
7
|
# first we sanitize the the id below
|
8
|
+
|
8
9
|
params = params.to_sym
|
9
|
-
|
10
|
-
|
10
|
+
# we check id is already assign
|
11
|
+
if Universe.atomes[params]
|
12
|
+
# we reassign the old id
|
13
|
+
puts "the id : #{params} is already used"
|
14
|
+
params = @id
|
11
15
|
else
|
12
|
-
|
16
|
+
if @id.to_sym != params
|
17
|
+
Universe.update_atome_id(params, self, @id)
|
18
|
+
else
|
19
|
+
Universe.add_to_atomes(params, self)
|
20
|
+
end
|
21
|
+
|
13
22
|
end
|
14
23
|
params
|
15
24
|
end
|
@@ -31,12 +40,12 @@ new({ particle: :active, category: :identity, type: :boolean })
|
|
31
40
|
# end
|
32
41
|
# end
|
33
42
|
new({ particle: :markup, category: :identity, type: :string })
|
34
|
-
new({particle: :bundle, category: :identity, type: :string})
|
43
|
+
new({ particle: :bundle, category: :identity, type: :string })
|
35
44
|
new({ particle: :data, category: :identity, type: :string })
|
36
45
|
|
37
|
-
new({particle: :category, category: :identity, type: :string, store: false}) do |category_names|
|
38
|
-
category_names=[category_names] unless category_names.instance_of? Array
|
39
|
-
category_names.each do |category_name|
|
46
|
+
new({ particle: :category, category: :identity, type: :string, store: false }) do |category_names|
|
47
|
+
category_names = [category_names] unless category_names.instance_of? Array
|
48
|
+
category_names.each do |category_name|
|
40
49
|
@category << category_name
|
41
50
|
end
|
42
51
|
end
|
@@ -61,6 +70,6 @@ new(particle: :selected, category: :identity, type: :boolean) do |params|
|
|
61
70
|
end
|
62
71
|
|
63
72
|
new({ particle: :format, category: :identity, type: :string })
|
64
|
-
new({ particle: :alien, category: :identity, type: :string }) #special particel that old alien object
|
73
|
+
new({ particle: :alien, category: :identity, type: :string }) # special particel that old alien object
|
65
74
|
|
66
75
|
new({ particle: :email, category: :identity, type: :string })
|
@@ -154,22 +154,27 @@ def init_database # this method is call from JS (atome/communication)
|
|
154
154
|
|
155
155
|
particles = Universe.particle_list
|
156
156
|
categories = Universe.categories
|
157
|
+
# here we populate the DB
|
157
158
|
categories.each do |category|
|
158
159
|
A.message({ action: :crate_db_table, data: { table: category } }) do |db_state|
|
159
|
-
puts db_state
|
160
|
+
# puts db_state
|
160
161
|
end
|
161
162
|
end
|
162
163
|
particles_length=particles.length
|
163
164
|
particles.each_with_index do |(particle, infos), index|
|
164
165
|
type = infos[:type]
|
165
166
|
table = infos[:category]
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
167
|
+
if type && table
|
168
|
+
@i=1
|
169
|
+
A.message({ action: :create_db_column, data: { table: table, column: particle, type: type } }) do |db_state|
|
170
|
+
@i+=1
|
171
|
+
if @i==particles_length
|
172
|
+
user_login
|
173
|
+
end
|
174
|
+
# puts db_state
|
171
175
|
end
|
172
|
-
|
176
|
+
else
|
177
|
+
puts "*** Warning feed type and category to #{particle}"
|
173
178
|
end
|
174
179
|
|
175
180
|
end
|
@@ -4,6 +4,7 @@
|
|
4
4
|
class Universe
|
5
5
|
@counter = 0
|
6
6
|
@atomes = {}
|
7
|
+
@atomes_ids = {}
|
7
8
|
@atome_list = []
|
8
9
|
@particle_list = {}
|
9
10
|
@renderer_list = %i[html browser headless server log]
|
@@ -19,12 +20,20 @@ class Universe
|
|
19
20
|
@example = {}
|
20
21
|
|
21
22
|
class << self
|
22
|
-
attr_reader :atomes, :renderer_list, :atome_list, :particle_list, :classes, :counter, :atomes_specificities
|
23
|
+
attr_reader :atomes,:atomes_ids, :renderer_list, :atome_list, :particle_list, :classes, :counter, :atomes_specificities
|
23
24
|
|
24
25
|
def messages
|
25
26
|
@messages
|
26
27
|
end
|
27
28
|
|
29
|
+
def eVe(val = nil)
|
30
|
+
if val
|
31
|
+
@eve = val
|
32
|
+
else
|
33
|
+
@eve
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
28
37
|
def store_messages(new_msg)
|
29
38
|
@messages[new_msg[:msg_nb]] = new_msg[:proc]
|
30
39
|
end
|
@@ -85,11 +94,15 @@ class Universe
|
|
85
94
|
instance_variable_get('@atome_list').push(atome)
|
86
95
|
end
|
87
96
|
|
88
|
-
def add_to_atomes(
|
89
|
-
@atomes[
|
97
|
+
def add_to_atomes(aid, atome)
|
98
|
+
@atomes[aid] = atome
|
90
99
|
@counter = @counter + 1
|
91
100
|
end
|
92
101
|
|
102
|
+
def id_to_aid(id, aid)
|
103
|
+
@atomes_ids[id] = aid
|
104
|
+
end
|
105
|
+
|
93
106
|
def update_atome_id(id, atome, prev_id)
|
94
107
|
@atomes[id] = atome
|
95
108
|
@atomes.delete(prev_id)
|
data/lib/atome/presets/atome.rb
CHANGED
@@ -14,6 +14,7 @@ class Atome
|
|
14
14
|
preset_params = Essentials.default_params[atome_preset] || {}
|
15
15
|
|
16
16
|
basic_params[:type] = preset_params[:type] || :element
|
17
|
+
# basic_params[:aid] = identity_generator(:a)
|
17
18
|
basic_params[:id] = params[:id] || identity_generator(atome_preset)
|
18
19
|
basic_params[:renderers] = @renderers || preset_params[:renderers]
|
19
20
|
essential_params = basic_params.merge(preset_params)
|
@@ -40,8 +41,8 @@ class Atome
|
|
40
41
|
end
|
41
42
|
|
42
43
|
def preset_common(params, &bloc)
|
43
|
-
|
44
|
-
params[:id] = "#{params[:id]}_#{Universe.atomes.length}" if grab(params[:id])
|
44
|
+
## if an atome with current id exist we update the ID in the params
|
45
|
+
# params[:id] = "#{params[:id]}_#{Universe.atomes.length}" if grab(params[:id])
|
45
46
|
Atome.new(params, &bloc)
|
46
47
|
end
|
47
48
|
|
data/lib/atome/version.rb
CHANGED
data/lib/eVe/eVe.rb
CHANGED
data/lib/eVe/eVe_relative.rb
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
|
2
|
+
new(application: {name: :compose })
|
3
|
+
|
4
|
+
|
5
|
+
grab(:toto).color(:cyan)
|
6
|
+
|
7
|
+
def layout
|
8
|
+
compose_back=box
|
9
|
+
|
10
|
+
compose_back.color({ alpha: 0 })
|
11
|
+
media_reader=compose_back.box({left: 99, width: 250, height: 250, top: 99})
|
12
|
+
viewer_1=compose_back.box({left: 360, width: 250, height: 250, top: 99})
|
13
|
+
viewer_2=compose_back.box({left: 690, width: 250, height: 250, top: 99})
|
14
|
+
timeline=compose_back.box({left: 99, width: 250, height: 250, top: 399})
|
15
|
+
login=compose_back.text(:log)
|
16
|
+
login.touch(true) do
|
17
|
+
compose_back.delete(true)
|
18
|
+
# grab(:view).clear(true)
|
19
|
+
form
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
def form
|
25
|
+
form1=box
|
26
|
+
form1.text(:login)
|
27
|
+
|
28
|
+
form1.touch(true) do
|
29
|
+
form1.delete(true)
|
30
|
+
layout
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
form
|
data/lib/eVe/lib/init.rb
CHANGED
@@ -1,20 +1,54 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
Universe.eVe(true)
|
4
|
+
puts "eVe version : #{EVe::VERSION}"
|
5
|
+
|
6
|
+
module EVe
|
4
7
|
def new(params, &bloc)
|
5
8
|
if params[:page]
|
6
|
-
|
9
|
+
site_found = grab(params[:page][:application])
|
10
|
+
site_found.clear(true)
|
11
|
+
page_id = params[:page][:name]
|
12
|
+
site_found.box({ id: page_id })
|
7
13
|
elsif params[:application]
|
8
|
-
box({ left: 0, right: 0, width: :auto, top: 0, bottom: 0, height: :auto, id: :toto })
|
9
|
-
elsif params[:master]
|
10
14
|
|
15
|
+
footer_header_size=33
|
16
|
+
footer_header_color=color({red: 0, green: 0, blue: 0, id: :footer_header_color})
|
17
|
+
|
18
|
+
if params[:header]
|
19
|
+
top = footer_header_size
|
20
|
+
header=box({ left: 0, right: 0, width: :auto, top: 0, height: top, id: :header })
|
21
|
+
# header.attach(:footer_header_color)
|
22
|
+
else
|
23
|
+
top = 0
|
24
|
+
end
|
25
|
+
if params[:footer]
|
26
|
+
bottom = footer_header_size
|
27
|
+
box({ left: 0, right: 0, width: :auto, top: :auto, bottom: 0, height: bottom, id: :footer })
|
28
|
+
else
|
29
|
+
bottom = 0
|
30
|
+
end
|
31
|
+
box({ left: 0, right: 0, width: :auto, top: top, bottom: bottom, height: :auto, id: params[:application] })
|
32
|
+
elsif params[:module]
|
33
|
+
|
34
|
+
end
|
35
|
+
super if defined?(super)
|
11
36
|
end
|
12
|
-
super if defined?(super)
|
13
37
|
end
|
14
|
-
end
|
15
38
|
|
16
|
-
class Object
|
17
|
-
|
18
|
-
end
|
39
|
+
class Object
|
40
|
+
include EVe
|
41
|
+
end
|
42
|
+
|
43
|
+
# tests
|
44
|
+
new({application: :compose, header: true, footer: true })
|
45
|
+
|
46
|
+
# new(page: {name: :home, application: :compose, attach: :root })
|
47
|
+
|
48
|
+
# new(module: {name: :home, application: :compose, attach: :root })
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
|
19
54
|
|
20
|
-
puts 'eVe ready'
|
@@ -0,0 +1,111 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# def atome_common(atome_preset, params)
|
4
|
+
# basic_params = { renderers: [] }
|
5
|
+
# # TODO : remove Essentials.default_params[atome_preset] || {} as it is
|
6
|
+
# # applied twice because preset is now a particle
|
7
|
+
# preset_params = Essentials.default_params[atome_preset] || {}
|
8
|
+
#
|
9
|
+
# basic_params[:type] = preset_params[:type] || :element
|
10
|
+
# basic_params[:id] = params[:id] || identity_generator(atome_preset)
|
11
|
+
# basic_params[:renderers] = @renderers || preset_params[:renderers]
|
12
|
+
# essential_params = basic_params.merge(preset_params)
|
13
|
+
# reordered_params = essential_params.reject { |key, _| params.has_key?(key) }
|
14
|
+
# params = reordered_params.merge(params)
|
15
|
+
#
|
16
|
+
# # condition to handle color/shadow/paint atomes that shouldn't be attach to view
|
17
|
+
# # TODO : add category for atome( material/physical vs modifier : color, shadow, .. vs shape, image ..)
|
18
|
+
# # then add condition same things fo code in genesis new_atome
|
19
|
+
# if %i[color shadow paint].include?(atome_preset)
|
20
|
+
# unless params[:affect]
|
21
|
+
# params[:affect] = if @id == :view
|
22
|
+
# [:black_matter]
|
23
|
+
# else
|
24
|
+
# [@id]
|
25
|
+
# end
|
26
|
+
# end
|
27
|
+
# else
|
28
|
+
# params[:attach] = params[:attach] || @id || :view
|
29
|
+
# end
|
30
|
+
# params
|
31
|
+
# end
|
32
|
+
#
|
33
|
+
# def preset_common(params, &bloc)
|
34
|
+
# # if an atome with current id exist we update the ID in the params
|
35
|
+
# params[:id] = "#{params[:id]}_#{Universe.atomes.length}" if grab(params[:id])
|
36
|
+
# Atome.new(params, &bloc)
|
37
|
+
# end
|
38
|
+
# class EVe < Atome
|
39
|
+
class EVe < Atome
|
40
|
+
def initialize
|
41
|
+
@atomes = {}
|
42
|
+
end
|
43
|
+
|
44
|
+
def atome(atome_to_find)
|
45
|
+
@atomes[atome_to_find]
|
46
|
+
end
|
47
|
+
|
48
|
+
def input_box(params = {}, &bloc)
|
49
|
+
height_wanted = 15
|
50
|
+
width_wanted = 222
|
51
|
+
input_back = Atome.new(
|
52
|
+
{ renderers: [:html], id: :input_back, type: :shape, attach: :view, apply: [:shape_color],
|
53
|
+
left: 120, top: 120,data: '', width: width_wanted, height: height_wanted + height_wanted * 20 / 100, smooth: 6 })
|
54
|
+
|
55
|
+
@atomes[:input_back] = input_back
|
56
|
+
|
57
|
+
Atome.new(
|
58
|
+
{ renderers: [:html], id: :input_text_color, type: :color, tag: ({ system: true, persistent: true }),
|
59
|
+
red: 0.1, green: 0.1, blue: 0.1, alpha: 1 }
|
60
|
+
)
|
61
|
+
|
62
|
+
text_input = Atome.new(
|
63
|
+
{ renderers: [:html], id: :input_text, type: :text, apply: [:input_text_color], component: { size: height_wanted },
|
64
|
+
data: :input, left: height_wanted * 20 / 100, top: 0, edit: true, attach: :input_back, height: height_wanted, position: :absolute })
|
65
|
+
|
66
|
+
text_input.touch(true) do
|
67
|
+
text_input.component({ selected: { color: 'rgba(0,0,0,0.3)', text: :orange } })
|
68
|
+
end
|
69
|
+
|
70
|
+
text_input.keyboard(:down) do |native_event|
|
71
|
+
event = Native(native_event)
|
72
|
+
if event[:keyCode].to_s == '13'
|
73
|
+
# we prevent the input
|
74
|
+
event.preventDefault()
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
text_input.keyboard(:up) do |native_event|
|
80
|
+
input_back.data=text_input.data
|
81
|
+
end
|
82
|
+
@atomes[:input_text] = text_input
|
83
|
+
|
84
|
+
input_back
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
|
89
|
+
def input(params = {}, &proc)
|
90
|
+
text_color = :white
|
91
|
+
text_size = 12
|
92
|
+
back_color = :gray
|
93
|
+
width = 2000
|
94
|
+
in_b = EVe.new()
|
95
|
+
in_b.input_box
|
96
|
+
end
|
97
|
+
|
98
|
+
i= input
|
99
|
+
|
100
|
+
b=box({top: 0, left: 0, width: 33, height: 33})
|
101
|
+
b.touch(true) do
|
102
|
+
puts "i.data : #{i.data}"
|
103
|
+
end
|
104
|
+
i.left(66)
|
105
|
+
i.color(:white)
|
106
|
+
i.text.left(55)
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
button = box({smooth: 6,left: 55,top: 160, color:{red: 0.3, green: 0.3, blue: 0.3},id: :my_box})
|
4
|
+
button.shadow({
|
5
|
+
id: :s1,
|
6
|
+
left: 3, top: 3, blur: 9,
|
7
|
+
invert: true,
|
8
|
+
red: 0, green: 0, blue: 0, alpha: 0.7
|
9
|
+
})
|
10
|
+
button.touch(true) do
|
11
|
+
button.controller(:hello)
|
12
|
+
end
|
13
|
+
slider=box({ width: 333, height: 25, top: 45, left: 55, smooth: 9, color:{red: 0.3, green: 0.3, blue: 0.3}})
|
14
|
+
slider.shadow({
|
15
|
+
id: :s2,
|
16
|
+
left: 3, top: 3, blur: 9,
|
17
|
+
invert: true,
|
18
|
+
red: 0, green: 0, blue: 0, alpha: 0.7
|
19
|
+
})
|
20
|
+
cursor= slider.circle({width: 30, height: 30, left: 2, top: 1, color:{red: 0.3, green: 0.3, blue: 0.3}})
|
21
|
+
|
22
|
+
cursor.left(0)
|
23
|
+
cursor.top(0)
|
24
|
+
cursor.shadow({
|
25
|
+
id: :s4,
|
26
|
+
left: 1, top: 1, blur: 3,
|
27
|
+
option: :natural,
|
28
|
+
red: 0, green: 0, blue: 0, alpha: 0.6
|
29
|
+
})
|
30
|
+
label=text({data: 0, top: 69, left: 69, component: { size: 12 }, color: :gray})
|
31
|
+
cursor.drag({ restrict: {max:{ left: 309, top: 0}} }) do |event|
|
32
|
+
puts cursor.left
|
33
|
+
value = cursor.left/309*100
|
34
|
+
label.data(value)
|
35
|
+
cursor.controller({ action: :setModuleParameterValue, params: { moduleId: 6456549897,parameterId: 9846546, value: value} })
|
36
|
+
|
37
|
+
end
|
38
|
+
support=box({top: 300, left: 55, width: 300, height: 40, smooth: 9, color:{red: 0.3, green: 0.3, blue: 0.3}, id: :support })
|
39
|
+
support.shadow({
|
40
|
+
id: :s3,
|
41
|
+
left: 3, top: 3, blur: 9,
|
42
|
+
invert: true,
|
43
|
+
red: 0, green: 0, blue: 0, alpha: 0.7
|
44
|
+
})
|
45
|
+
support.import(true) do |content|
|
46
|
+
puts "add code here, content: #{content}"
|
47
|
+
end
|
48
|
+
|
49
|
+
in_box=input_box
|
@@ -0,0 +1,280 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
text(:hello)
|
3
|
+
class Atome
|
4
|
+
|
5
|
+
def build_tool(&bloc)
|
6
|
+
# alert params[:tool]
|
7
|
+
a = Atome.instance_exec(&bloc)
|
8
|
+
puts "===> a is : #{a[:action]}"
|
9
|
+
# check below
|
10
|
+
wait 2 do
|
11
|
+
send a[:action]
|
12
|
+
end
|
13
|
+
grab(:toolbox).box({color: :white, width: 33, height: 33})
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class Object
|
18
|
+
def new(params, &bloc)
|
19
|
+
# Genesis = Genesis.Genesis
|
20
|
+
if params.key?(:atome)
|
21
|
+
Universe.add_atomes_specificities params[:atome]
|
22
|
+
Genesis.build_atome(params[:atome], &bloc)
|
23
|
+
elsif params.key?(:particle)
|
24
|
+
Atome.instance_variable_set("@main_#{params[:particle]}", bloc)
|
25
|
+
# render indicate if the particle needs to be rendered
|
26
|
+
# store tell the system if it need to store the particle value
|
27
|
+
# type help the system what type of type the particle will receive and store
|
28
|
+
Genesis.build_particle(params[:particle], { render: params[:render], return: params[:return],
|
29
|
+
store: params[:store], type: params[:type] }, &bloc)
|
30
|
+
elsif params.key?(:sanitizer)
|
31
|
+
Genesis.build_sanitizer(params[:sanitizer], &bloc)
|
32
|
+
elsif params.key?(:pre)
|
33
|
+
Atome.instance_variable_set("@pre_#{params[:pre]}", bloc)
|
34
|
+
elsif params.key?(:post)
|
35
|
+
Atome.instance_variable_set("@post_#{params[:post]}", bloc)
|
36
|
+
elsif params.key?(:after)
|
37
|
+
Atome.instance_variable_set("@after_#{params[:after]}", bloc)
|
38
|
+
elsif params.key?(:read)
|
39
|
+
Atome.instance_variable_set("@read_#{params[:read]}", bloc)
|
40
|
+
elsif params[:renderer]
|
41
|
+
renderer_found = params[:renderer]
|
42
|
+
if params[:specific]
|
43
|
+
Universe.set_atomes_specificities(params)
|
44
|
+
params[:specific] = "#{params[:specific]}_"
|
45
|
+
end
|
46
|
+
render_method = "#{renderer_found}_#{params[:specific]}#{params[:method]}"
|
47
|
+
Genesis.build_render(render_method, &bloc)
|
48
|
+
elsif params.key?(:callback)
|
49
|
+
particle_targetted = params[:callback]
|
50
|
+
Atome.define_method "#{particle_targetted}_callback" do
|
51
|
+
bloc.call
|
52
|
+
end
|
53
|
+
elsif params.key?(:tool)
|
54
|
+
A.build_tool(&bloc)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
grab(:intuition).box({id: :toolbox, top: :auto, bottom: 0, left: 0, width: 50, height: 255})
|
60
|
+
|
61
|
+
def record_tool
|
62
|
+
grab(Universe.current_user).selection
|
63
|
+
alert "must get selection to treat it "
|
64
|
+
end
|
65
|
+
|
66
|
+
|
67
|
+
module Intuition
|
68
|
+
def intuition_int8
|
69
|
+
# tool taxonomy and list
|
70
|
+
{
|
71
|
+
capture: { int8: { french: :enregistrement, english: :record, german: :datensatz } },
|
72
|
+
communication: { french: :communication, english: :communication, german: :communication },
|
73
|
+
tool: { french: :outils, english: :tools, german: :werkzeuge },
|
74
|
+
view: { french: :vue, english: :view, german: :aussicht },
|
75
|
+
time: { french: :horloge, english: :clock, german: :Uhr },
|
76
|
+
find: { french: :trouve, english: :find, german: :finden },
|
77
|
+
home: { french: :accueil, english: :home, german: :zuhause },
|
78
|
+
code: { french: :code, english: :code, german: :code },
|
79
|
+
impulse: { french: :impulse, english: :impulse, german: :impulse },
|
80
|
+
}
|
81
|
+
end
|
82
|
+
def intuition_taxonomy
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
def impulse
|
87
|
+
# tool start point
|
88
|
+
[:capture, :communication, :tool, :view, :time, :find, :home]
|
89
|
+
end
|
90
|
+
|
91
|
+
# def capture
|
92
|
+
# categories=ATOME.methods_categories
|
93
|
+
# [categories[:inputs]]
|
94
|
+
# end
|
95
|
+
#
|
96
|
+
# def communication
|
97
|
+
# categories=ATOME.methods_categories
|
98
|
+
# [categories[:communications]]
|
99
|
+
# end
|
100
|
+
#
|
101
|
+
# def toolz
|
102
|
+
# categories=ATOME.methods_categories
|
103
|
+
# [categories[:spatials],categories[:helpers],categories[:materials],
|
104
|
+
# categories[:geometries],categories[:effects],
|
105
|
+
# categories[:medias],categories[:hierarchies],categories[:utilities],categories[:events]]
|
106
|
+
# end
|
107
|
+
#
|
108
|
+
# def tool_style(size = 33)
|
109
|
+
# # styling
|
110
|
+
# shadows = [{ x: size / 15, y: size / 15, thickness: 0, blur: size / 3, color: { red: 0, green: 0, blue: 0, alpha: 0.3 } }, { x: -size / 15, y: -size / 15, thickness: 0, blur: size / 6, color: { red: 1, green: 1, blue: 1, alpha: 0.3 } }]
|
111
|
+
# style = { type: :tool, content: { points: 4 }, color: { red: 0.9, green: 0.9, blue: 0.9, alpha: 0.15 }, parent: :intuition, shadow: shadows, blur: { value: 6, invert: true } }
|
112
|
+
# return style
|
113
|
+
# end
|
114
|
+
#
|
115
|
+
# def open_tool(tool_id, widthness=3, orientation=:x, speed=0.6)
|
116
|
+
# if orientation == :x
|
117
|
+
# orientation = :width
|
118
|
+
# value = grab(tool_id).width
|
119
|
+
# else
|
120
|
+
# orientation = :height
|
121
|
+
# value = grab(tool_id).height
|
122
|
+
# end
|
123
|
+
# animate({
|
124
|
+
# start: { orientation => value },
|
125
|
+
# end: { orientation => value * widthness },
|
126
|
+
# duration: speed * 1000,
|
127
|
+
# loop: 0,
|
128
|
+
# curve: :easing,
|
129
|
+
# target: tool_id
|
130
|
+
# })
|
131
|
+
# notification "find why this id #{self.atome_id}, add annimation callback to set overflow when anim complete"
|
132
|
+
# grab(tool_id).overflow(:visible)
|
133
|
+
# end
|
134
|
+
#
|
135
|
+
# def close_tool(tool_id, widthness, orientation, speed)
|
136
|
+
# if orientation == :x
|
137
|
+
# orientation = :width
|
138
|
+
# value = grab(tool_id).width
|
139
|
+
# else
|
140
|
+
# orientation = :height
|
141
|
+
# value = grab(tool_id).height
|
142
|
+
# end
|
143
|
+
# animate({
|
144
|
+
# start: { orientation => value * widthness },
|
145
|
+
# end: { orientation => value },
|
146
|
+
# duration: speed * 1000,
|
147
|
+
# loop: 0,
|
148
|
+
# curve: :easing,
|
149
|
+
# target: tool_id
|
150
|
+
# })
|
151
|
+
# # grab(tool_id).overflow(:hidden)
|
152
|
+
# end
|
153
|
+
#
|
154
|
+
# def create_tool(tool_name, size = 33, x_pos = 0, y_pos = 33, offsset=0)
|
155
|
+
# tool_created = tool(self.tool_style(size).merge({ parent: :main_menu, atome_id: "tool_" + tool_name, id: "tool_" + tool_name,
|
156
|
+
# width: size, height: size, smooth: size / 9, overflow: :hidden, x: x_pos, y: y_pos, z: 1, content: [] }))
|
157
|
+
# icon=tool_created.shape({ path: tool_name, width: size - size / 2, height: size - size / 2, center: true })
|
158
|
+
# # name = intuition_list[tool_name][language]
|
159
|
+
# particle({ atome_id: :tools_property_container, color: { red: 0.6, green: 0.6, blue: 0.6 } })
|
160
|
+
# # we get the plugin code only if the plugin hasn't been interpreted before (unless condition below)
|
161
|
+
# unless grab(:intuition).content.include? tool_name
|
162
|
+
# ATOME.reader("./medias/e_rubies/tools/#{tool_name}.rb") do |data|
|
163
|
+
# # todo add a security parser here
|
164
|
+
# # we set the variable tool that can be used to facilitate plugin creation
|
165
|
+
# data="tool=grab(:#{tool_created.atome_id})\n"+data
|
166
|
+
# compile(data)
|
167
|
+
# # we add the tool to the intuition content so it won't be loaded twice
|
168
|
+
# grab(:intuition).content |= [tool_name]
|
169
|
+
# end
|
170
|
+
# end
|
171
|
+
# # end
|
172
|
+
# tool_created.active({ exec: false })
|
173
|
+
# tool_created.inactive({ exec: false })
|
174
|
+
# icon.touch(stop: true) do
|
175
|
+
# if tool_created.active[:exec] == true
|
176
|
+
# tool_created.color(:transparent)
|
177
|
+
# tool_created.active(exec: false, proc: tool_created.active[:proc] )
|
178
|
+
# tool_created.inactive(exec: true, proc: tool_created.inactive[:proc] )
|
179
|
+
# else
|
180
|
+
# tool_created.color({alpha: 0.3})
|
181
|
+
# tool_created.active({ exec: true, proc: tool_created.active[:proc] })
|
182
|
+
# end
|
183
|
+
# end
|
184
|
+
# end
|
185
|
+
#
|
186
|
+
# # we get menu entry point
|
187
|
+
# def open_intuition(position = {})
|
188
|
+
# position = { x: 0, yy: 0, size: 33, orientation: :vertical, offset: 0 }.merge(position)
|
189
|
+
# # we get content language from view's language
|
190
|
+
# if grab(:main_menu)
|
191
|
+
# grab(:main_menu).delete
|
192
|
+
# else
|
193
|
+
# grab(:view).language
|
194
|
+
# self.language(grab(:view).language)
|
195
|
+
# orientation = position.delete(:orientation)
|
196
|
+
# size = position.delete(:size)
|
197
|
+
# offset = position.delete(:offset)
|
198
|
+
# # positioning and scaling
|
199
|
+
# if orientation == :vertical
|
200
|
+
# requested_width = size
|
201
|
+
# requested_height = (size+offset)* impulse.length
|
202
|
+
# else
|
203
|
+
# requested_width = (size+offset) * impulse.length
|
204
|
+
# requested_height = size
|
205
|
+
# end
|
206
|
+
# tool({ atome_id: :main_menu, parent: :intuition, color: { alpha: 0 } }.merge(position).merge(width: requested_width, height: requested_height))
|
207
|
+
# impulse.each_with_index do |item, index|
|
208
|
+
# if orientation == :vertical
|
209
|
+
# create_tool(item, size, 0, index * (size+offset))
|
210
|
+
# else
|
211
|
+
# create_tool(item, size, index * (size+offset), 0)
|
212
|
+
# end
|
213
|
+
# end
|
214
|
+
# end
|
215
|
+
# end
|
216
|
+
end
|
217
|
+
# atome class extension for eVe
|
218
|
+
|
219
|
+
class Atome
|
220
|
+
include Intuition
|
221
|
+
# def atome(requested_property)
|
222
|
+
# # add component list iin the content we maybe ahave to create a tool object because box can't handle this type of content
|
223
|
+
# new_atome=self.tool({ atome_id: "#{self.atome_id}_#{requested_property}_atome_#{self.content.length}", x: 66})
|
224
|
+
# new_atome.touch({ stop: true, option: :down}) do
|
225
|
+
# color(:red)
|
226
|
+
# new_atome.height = new_atome.height*3
|
227
|
+
# end
|
228
|
+
# new_atome.touch({ stop: true, option: :up}) do
|
229
|
+
# color(:red)
|
230
|
+
# new_atome.height = new_atome.height/3
|
231
|
+
# end
|
232
|
+
# notification "now we have to add an object or a new property (style) to store complete tool style including size and
|
233
|
+
# orientation so we can position the new atome correctly"
|
234
|
+
# # alert self.content.class
|
235
|
+
# # alert self.content.length
|
236
|
+
# # alert tool_style
|
237
|
+
# end
|
238
|
+
end
|
239
|
+
|
240
|
+
# # we initialise the toolbox here :
|
241
|
+
#
|
242
|
+
# # the launch bar
|
243
|
+
# launch_bar = box({ x: 0, y: 0, width: 33, height: "100%", parent: :intuition, z: 0, color: { alpha: 0 } })
|
244
|
+
# launch_bar.touch({ option: :long }) do |evt|
|
245
|
+
# size = 33
|
246
|
+
# yy_touch_position = grab(:view).convert(:height) - evt.page_y
|
247
|
+
# if yy_touch_position < size
|
248
|
+
# #if the long touch is within the wanted area( in this at bottom of the screen) we open the menu
|
249
|
+
# # launch_bar.open_intuition({ x: size, yy: 6,offset: 6, orientation: :horizontal, size: size })
|
250
|
+
# launch_bar.open_intuition({ x: 6, yy: size,offset: 6, orientation: :vertical, size: size })
|
251
|
+
# end
|
252
|
+
# end
|
253
|
+
#
|
254
|
+
# # # # # # # # # # # # # # # tests below # # # # # # # # # # # # #
|
255
|
+
#
|
256
|
+
# list = molecule_analysis(@molecules_list)
|
257
|
+
# notif list[:tools]
|
258
|
+
# notif "======"
|
259
|
+
# notif list[:molecules]
|
260
|
+
# notif "======"
|
261
|
+
# notif list[:atomes]
|
262
|
+
# notif "======"
|
263
|
+
# notif list[:molecules][:shadow]
|
264
|
+
|
265
|
+
new({ tool: :capture }) do |params|
|
266
|
+
tool = { id: :rec_01,
|
267
|
+
|
268
|
+
name: :record, icon: :record, action: {open: [:sub_menu]}, code: :record_tool, position: { root: 1 }, # position can be multiple
|
269
|
+
option: { opt1: :method_2 }, int8: { french: :enregistrement, english: :record, german: :datensatz } }
|
270
|
+
tool
|
271
|
+
end
|
272
|
+
|
273
|
+
|
274
|
+
puts A.impulse
|
275
|
+
# def fill_toolzone(tools_ids)
|
276
|
+
#
|
277
|
+
# end
|
278
|
+
#
|
279
|
+
# fill_toolzone(%i[files edition select group link copy undo settings])
|
280
|
+
|
data/lib/renderers/html/html.rb
CHANGED
@@ -754,8 +754,8 @@ class HTML
|
|
754
754
|
parent_found = grab(option)
|
755
755
|
min_left = parent_found.left
|
756
756
|
min_top = parent_found.top
|
757
|
-
parent_width = parent_found.width
|
758
|
-
parent_height = parent_found.height
|
757
|
+
parent_width = parent_found.compute({ particle: :width })[:value]
|
758
|
+
parent_height = parent_found.compute({ particle: :height })[:value]
|
759
759
|
original_width = @original_atome.width
|
760
760
|
original_height = @original_atome.height
|
761
761
|
max_left = min_left + parent_width - original_width
|
@@ -83,14 +83,9 @@
|
|
83
83
|
# create a animation object
|
84
84
|
# create callback methode when playing
|
85
85
|
|
86
|
-
|
87
|
-
# here is how to animate shape :
|
88
|
-
new({particle: :animate}) do |params|
|
89
|
-
html.play_animation({ from: 0, to: 300, duration: 1000 })
|
90
|
-
end
|
91
|
-
|
86
|
+
# # here is how to animate shape :
|
92
87
|
|
93
88
|
b=box({id: :the_box})
|
94
89
|
|
95
|
-
b.animate(
|
90
|
+
b.animate({ to: 90 })
|
96
91
|
|
@@ -20,13 +20,20 @@ wait 1 do
|
|
20
20
|
b.apply([:active_color])
|
21
21
|
end
|
22
22
|
c = circle({ left: 333, id: :the_circle })
|
23
|
-
wait
|
23
|
+
wait 1 do
|
24
|
+
|
25
|
+
puts "before: -------"
|
26
|
+
puts "c.attach #{c.attach}"
|
27
|
+
puts "b.attached : #{b.attached}"
|
28
|
+
puts "b.color : #{b.color}"
|
29
|
+
puts "c.color : #{c.color}"
|
24
30
|
c.apply(:inactive_color)
|
25
31
|
b.attached([c.id])
|
32
|
+
puts "After: -------"
|
26
33
|
|
27
34
|
# Here is how to use it as a getter :
|
28
35
|
# to retrieve witch atomes b315 is attached to to the atome c_12 just type
|
29
|
-
puts "c.attach#{c.attach}" # => [:the_box]
|
36
|
+
puts "c.attach #{c.attach}" # => [:the_box]
|
30
37
|
# to retrieve atome attached to the atome c_12 just type tha other method
|
31
38
|
puts "b.attached : #{b.attached}" #=> [:the_circle]
|
32
39
|
puts "b.color : #{b.color}"
|
@@ -41,9 +41,11 @@ a.width(33)
|
|
41
41
|
a.height(33)
|
42
42
|
a.top(33)
|
43
43
|
a.left(33)
|
44
|
+
a.attach(:view)
|
44
45
|
# we can now add a color the atome using apply used to apply an atome onto another (please note that color is also an atome not a particle)
|
45
46
|
# in this case we apply the color atome name box_color this a default color created by the system
|
46
47
|
a.apply([:box_color])
|
48
|
+
|
47
49
|
wait 2 do
|
48
50
|
# a bit less efficient and a bit more processor intensive solution is to use the box preset, that render a box too
|
49
51
|
b=box
|
@@ -7,6 +7,10 @@ b=box({ left: 12, id: :the_first_box })
|
|
7
7
|
b.category(:matrix)
|
8
8
|
b.touch(true) do
|
9
9
|
b.remove({ category: :matrix})
|
10
|
-
t.data= " category is : #{b.category}
|
10
|
+
t.data= " category is : #{b.category}"
|
11
|
+
wait 1 do
|
12
|
+
b.category(:new_one)
|
13
|
+
t.data= " category is : #{b.category}"
|
14
|
+
end
|
11
15
|
end
|
12
|
-
t.data= " category is : #{b.category}
|
16
|
+
t.data= " category is : #{b.category} "
|
@@ -1,39 +1,39 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
A.message({ action: :insert, data: { table: :security, particle: :password, data: 'my_pass'} }) do |datas|
|
4
|
+
puts "0 data received: #{datas}"
|
5
|
+
end
|
6
|
+
|
7
|
+
A.message({ action: :insert, data: { table: :identity, particle: :name, data: 'jeezs' } }) do |data_received_from_server|
|
8
|
+
puts "1 my first insert #{data_received_from_server}"
|
9
|
+
end
|
10
|
+
|
11
|
+
A.message({ action: :insert, data: { table: :identity, particle: :name, data: 'jeezs2' } })
|
12
|
+
|
13
|
+
A.message({ action: :query, data: { table: :identity } }) do |data_received_from_server|
|
14
|
+
puts "2 another insert : #{data_received_from_server}"
|
15
|
+
end
|
16
|
+
|
17
|
+
A.message({ action: :query, data: { table: :identity } }) do |data_received|
|
18
|
+
puts "3 received : #{data_received}"
|
19
|
+
end
|
20
|
+
|
21
|
+
A.message({ action: :insert, data: { table: :identity, particle: :name, data: 'jeezs3' } }) do |result|
|
22
|
+
puts "4 insert done : #{result}"
|
23
|
+
end
|
24
|
+
|
25
|
+
A.message({ action: :insert, data: { table: :identity, particle: :name, data: 'jeezs4' } }) do |result|
|
26
|
+
puts "5 last message received: #{result}"
|
27
|
+
end
|
28
|
+
|
29
|
+
A.message({ action: :insert, data: { table: :security, particle: :name, data: 'john doe' } }) do |data_received_from_server|
|
30
|
+
puts "6 test 1 : #{data_received_from_server}"
|
31
|
+
end
|
32
|
+
|
33
|
+
A.message({ action: :insert, data: { table: :identity, particle: :tit, data: 'dummy' } }) do |data_received_from_server|
|
34
|
+
puts "7 test 2 : #{data_received_from_server}"
|
35
|
+
end
|
36
|
+
|
37
|
+
A.message({ action: :insert, data: { table: :unknown, particle: :name, data: 'dummy2' } }) do |data_received_from_server|
|
38
|
+
puts "test 3 : #{data_received_from_server}"
|
39
|
+
end
|
@@ -60,17 +60,18 @@ end
|
|
60
60
|
|
61
61
|
|
62
62
|
Universe.user_atomes.each do |atome_id|
|
63
|
-
atome_found =
|
63
|
+
atome_found = hook(atome_id)
|
64
64
|
if atome_found.type == :shape
|
65
65
|
atome_found.color(:orange)
|
66
66
|
atome_found.smooth(200)
|
67
67
|
atome_found.top(200)
|
68
68
|
end
|
69
69
|
end
|
70
|
-
|
70
|
+
|
71
|
+
|
71
72
|
random_found =Universe.user_atomes.sample(7)
|
72
73
|
random_found.each do |atome_id|
|
73
|
-
atome_found =
|
74
|
+
atome_found = hook(atome_id)
|
74
75
|
if atome_found.type == :shape
|
75
76
|
atome_found.top(rand(600))
|
76
77
|
atome_found.width(rand(120))
|
@@ -82,7 +83,7 @@ end
|
|
82
83
|
|
83
84
|
random_found =Universe.user_atomes.sample(9)
|
84
85
|
random_found.each do |atome_id|
|
85
|
-
atome_found =
|
86
|
+
atome_found = hook(atome_id)
|
86
87
|
if atome_found.type == :shape
|
87
88
|
atome_found.left(rand(700))
|
88
89
|
atome_found.width(rand(120))
|
@@ -9,7 +9,7 @@ end
|
|
9
9
|
|
10
10
|
|
11
11
|
Universe.user_atomes.each do |atome_id|
|
12
|
-
atome_found =
|
12
|
+
atome_found = hook(atome_id)
|
13
13
|
if atome_found.type == :shape
|
14
14
|
atome_found.color(:orange)
|
15
15
|
atome_found.smooth(200)
|
@@ -19,7 +19,7 @@ end
|
|
19
19
|
|
20
20
|
random_found =Universe.user_atomes.sample(7)
|
21
21
|
random_found.each do |atome_id|
|
22
|
-
atome_found =
|
22
|
+
atome_found = hook(atome_id)
|
23
23
|
if atome_found.type == :shape
|
24
24
|
atome_found.top(rand(600))
|
25
25
|
atome_found.width(rand(120))
|
@@ -31,7 +31,7 @@ end
|
|
31
31
|
|
32
32
|
random_found =Universe.user_atomes.sample(9)
|
33
33
|
random_found.each do |atome_id|
|
34
|
-
atome_found =
|
34
|
+
atome_found = hook(atome_id)
|
35
35
|
if atome_found.type == :shape
|
36
36
|
atome_found.left(rand(700))
|
37
37
|
atome_found.width(rand(120))
|
@@ -3,7 +3,14 @@
|
|
3
3
|
# server utils to handle eDen Db
|
4
4
|
|
5
5
|
class EDen
|
6
|
+
|
7
|
+
@@mail = nil
|
8
|
+
@@pass = nil
|
6
9
|
class << self
|
10
|
+
|
11
|
+
@@mail = nil
|
12
|
+
@@pass = nil
|
13
|
+
|
7
14
|
def db_access
|
8
15
|
Database.db_access
|
9
16
|
end
|
@@ -12,39 +19,62 @@ class EDen
|
|
12
19
|
{ data: { message: `#{data}` }, message_id: message_id }
|
13
20
|
end
|
14
21
|
|
15
|
-
def
|
16
|
-
|
17
|
-
|
18
|
-
user_password = data["password"]
|
19
|
-
user_exists = security_items.where(password: user_password).first
|
20
|
-
|
21
|
-
if !user_exists
|
22
|
-
{ return: 'Password not found', message_id: message_id }
|
23
|
-
# Ask to the user if he wants to subscribe
|
24
|
-
# Send the basic template
|
25
|
-
else
|
26
|
-
{ return: 'Password found, connected', message_id: message_id }
|
27
|
-
# Send the user account template
|
28
|
-
end
|
22
|
+
def sanitize_email(email)
|
23
|
+
invalid_chars_pattern = /[^a-zA-Z0-9.-@]+/
|
24
|
+
email.gsub(invalid_chars_pattern, '')
|
29
25
|
end
|
30
26
|
|
31
27
|
def authentication(data, message_id)
|
32
|
-
#
|
28
|
+
# database connexion :
|
33
29
|
db = db_access
|
30
|
+
# retrieving data from the 'identity' table
|
34
31
|
identity_items = db[:identity]
|
32
|
+
# retrieving sent data
|
35
33
|
user_email = data["email"]
|
36
|
-
|
34
|
+
# data cleansing of superfluous characters
|
35
|
+
sanitized_email = sanitize_email(user_email)
|
36
|
+
# database search
|
37
|
+
mail_exists = identity_items.where(email: sanitized_email).first
|
37
38
|
|
38
39
|
if !mail_exists
|
39
|
-
{ return: 'Email
|
40
|
-
|
41
|
-
|
42
|
-
|
40
|
+
return { return: 'Email non trouvé, erreur', authorized: false, message_id: message_id }
|
41
|
+
else
|
42
|
+
@@mail = user_email
|
43
|
+
if @@mail && @@pass
|
44
|
+
@@mail = nil
|
45
|
+
@@pass = nil
|
46
|
+
return { return: 'logged', authorized: true, message_id: message_id }
|
47
|
+
# Send the user account template
|
48
|
+
else
|
49
|
+
return { return: 'Email trouvé, cherche mdp', authorized: true, message_id: message_id }
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def authorization(data, message_id)
|
55
|
+
# database connexion :
|
56
|
+
db = db_access
|
57
|
+
# retrieving data from the 'security' table
|
58
|
+
security_items = db[:security]
|
59
|
+
# retrieving sent data
|
60
|
+
user_password = data["password"]
|
61
|
+
# database search
|
62
|
+
user_exists = security_items.where(password: user_password).first
|
63
|
+
|
64
|
+
if !user_exists
|
65
|
+
puts "password recu : :#{user_password}, @@mail : #{ @@mail} , pass : #{ @@pass}"
|
66
|
+
return { return: 'Password non trouvé, erreur', authorized: false, message_id: message_id }
|
43
67
|
else
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
68
|
+
@@pass = user_password
|
69
|
+
if @@mail && @@pass
|
70
|
+
# reset variables containing mail and password
|
71
|
+
@@mail = nil
|
72
|
+
@@pass = nil
|
73
|
+
return { return: 'logged', authorized: true, message_id: message_id }
|
74
|
+
# Send the user account template
|
75
|
+
else
|
76
|
+
return { return: 'Password trouvé, cherche mdp', authorized: true, message_id: message_id }
|
77
|
+
end
|
48
78
|
end
|
49
79
|
end
|
50
80
|
|
@@ -108,5 +138,4 @@ class EDen
|
|
108
138
|
send(method_sym, data, message_id)
|
109
139
|
end
|
110
140
|
end
|
111
|
-
|
112
141
|
end
|
@@ -38,7 +38,12 @@
|
|
38
38
|
require '/utilities/aui'
|
39
39
|
require '/utilities/host_mode'
|
40
40
|
require '/lib/atome_relative'
|
41
|
-
|
41
|
+
# if Universe.eVe
|
42
|
+
# require './index'
|
43
|
+
#else
|
44
|
+
# require './index'
|
45
|
+
# end
|
46
|
+
require './index'
|
42
47
|
#puts Universe.host
|
43
48
|
atome_infos
|
44
49
|
</script>
|
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.2.
|
4
|
+
version: 0.5.6.2.7
|
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-
|
11
|
+
date: 2024-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: artoo
|
@@ -465,7 +465,12 @@ files:
|
|
465
465
|
- lib/eVe/documentation/server.md
|
466
466
|
- lib/eVe/eVe.rb
|
467
467
|
- lib/eVe/eVe_relative.rb
|
468
|
+
- lib/eVe/lib/examples/site.rb
|
468
469
|
- lib/eVe/lib/init.rb
|
470
|
+
- lib/eVe/lib/intuition/inputs.rb
|
471
|
+
- lib/eVe/lib/intuition/sliders.rb
|
472
|
+
- lib/eVe/lib/intuition/toolbox.rb
|
473
|
+
- lib/eVe/lib/version.rb
|
469
474
|
- lib/eVe/todo.txt
|
470
475
|
- lib/platform_specific/opal/atome_opal_extensions.rb
|
471
476
|
- lib/platform_specific/opal/extensions/color.rb
|