atome 0.5.6.3.1 → 0.5.6.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '096fbd8976e0d3a196119fb1bd219c74493a11fa8c55f2e9318c4d4b32308416'
4
- data.tar.gz: 460edf9559799b4991287cd0970ff5cba101e57186eef625fc4774f035e2310e
3
+ metadata.gz: '09634d52a8f3829297eb4f432ce16d2a6a7c9203155d01423c949d3d5f6d3627'
4
+ data.tar.gz: d5f17ab9bf3baee1a4a4a89aa27ac02319f746113b688c723f06e123f091db59
5
5
  SHA512:
6
- metadata.gz: a9ea992a2739715313875de3ec35e36622da17081768966b4870ccc67edd828990aef07e348a5a01b58169a7ad5be9b37de71f113414d0c2876d4b05df0548f9
7
- data.tar.gz: 0775056d33e35b50280f9645b522d0e05ab0c59de569eb62e19570b81e760dcfc856e2a1ea69768677313ad262f22c6bdab7310f9a7c44d8e74a5049d240a0a6
6
+ metadata.gz: a73cdcee8925ca328a5643b83467bbd9c12a3483b194133fd9c5ddd033a3f82f5209b91a30deebdb3c89ab18a2818433088a638d4aea34fc941b32c2ccf90547
7
+ data.tar.gz: 9732c3992657d13646a1a09628ff7f915ad0b6f584da4f420a995f2d03228c5fde39c04b9235abd3f76170537877f1e367ae9f02ac45e7dd939361c0e584a1d7
data/Rakefile CHANGED
@@ -1,4 +1,6 @@
1
1
  # frozen_string_literal: true
2
+
3
+
2
4
  require 'fileutils'
3
5
  require 'securerandom'
4
6
  require 'digest/sha2'
@@ -8,15 +10,23 @@ require 'rubygems/uninstaller'
8
10
  require 'bundler/gem_tasks'
9
11
  load 'exe/atome'
10
12
 
11
- folder_name = 'lib/eVe'
12
-
13
- unless Dir.exist?(folder_name)
14
- Dir.mkdir(folder_name)
15
- File.open('lib/eVe/eVe_relative.rb', 'w') do |file|
16
- end
17
- File.open('lib/eVe/eVe.rb', 'w') do |file|
18
- end
19
- end
13
+ # folder_name = 'lib/eVe'
14
+ #
15
+ # # allow or deny eVe gem content to be copied to local eVe or not
16
+ refresh_eVe=true
17
+ #
18
+ # # if refresh_eVe
19
+ # # # doesn't work
20
+ # # `bundle update`
21
+ # # end
22
+ #
23
+ # unless Dir.exist?(folder_name)
24
+ # Dir.mkdir(folder_name)
25
+ # File.open('lib/eVe/eVe_relative.rb', 'w') do |file|
26
+ # end
27
+ # File.open('lib/eVe/eVe.rb', 'w') do |file|
28
+ # end
29
+ # end
20
30
 
21
31
 
22
32
  task :cleanup do
@@ -77,8 +87,8 @@ def generate_resolved_file(source_file_path)
77
87
  resolve_requires(source_file_path, root_path)
78
88
  end
79
89
 
80
- def wasm_params(source, destination, project_name, wasi_file, host_mode, script_source)
81
- create_application(source, destination, project_name)
90
+ def wasm_params(source, destination, project_name, wasi_file, host_mode, script_source, refresh_eVe)
91
+ create_application(source, destination, project_name, refresh_eVe)
82
92
  wasm_common(source, destination, project_name, wasi_file, host_mode, script_source)
83
93
  end
84
94
 
@@ -104,19 +114,19 @@ task :test_wasm do
104
114
  destination = './tmp'
105
115
  script_source = './test/application'
106
116
 
107
- wasm_params(source, destination, project_name, wasi_file, host_mode, script_source)
117
+ wasm_params(source, destination, project_name, wasi_file, host_mode, script_source,refresh_eVe)
108
118
  system "open", file_path
109
119
  when /linux|bsd/
110
120
  destination = './tmp'
111
121
  script_source = './test/application'
112
122
  wasi_file = 'wasi-vfs-unix pack tmp'
113
- wasm_params(source, destination, project_name, wasi_file, host_mode, script_source)
123
+ wasm_params(source, destination, project_name, wasi_file, host_mode, script_source,refresh_eVe)
114
124
  system "xdg-open", file_path
115
125
  when /mswin|mingw|cygwin/
116
126
  destination = '.\\tmp'
117
127
  script_source = '.\\test\\application'
118
128
  wasi_file = 'wasi-vfs.exe pack'
119
- wasm_params(source, destination, project_name, wasi_file, host_mode, script_source)
129
+ wasm_params(source, destination, project_name, wasi_file, host_mode, script_source,refresh_eVe)
120
130
  system "start", file_path
121
131
  else
122
132
  raise "Système d'exploitation non reconnu"
@@ -130,7 +140,7 @@ task :test_opal do
130
140
  source = '.'
131
141
  destination = './tmp'
132
142
  script_source = './test/application'
133
- create_application(source, destination, project_name)
143
+ create_application(source, destination, project_name, refresh_eVe)
134
144
  # the line below is to add addition script to the application folder (useful for test per example)
135
145
  add_to_application_folder(script_source, destination, project_name)
136
146
  # build opal
@@ -166,9 +176,27 @@ task :test_server_wasm do
166
176
  script_source = './test/application'
167
177
  wasi_file = 'wasi-vfs-osx_arm'
168
178
  host_mode = 'pure_wasm'
169
- create_application(source, destination, project_name)
179
+ create_application(source, destination, project_name, refresh_eVe)
170
180
  wasm_common(source, destination, project_name, wasi_file, host_mode, script_source)
171
181
  puts 'atome wasm is build and running!'
182
+ threads = []
183
+ threads << Thread.new do
184
+
185
+ sleep 1
186
+ if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
187
+ # code to exec for Windows
188
+ `start http://localhost:9292`
189
+ # `start #{destination}\\#{project_name}\\src\\index_server.html`
190
+
191
+ elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
192
+ # code to exec for MacOS
193
+ `open http://localhost:9292`
194
+ else
195
+ # code to exec for Unix/Linux
196
+ `open http://localhost:9292`
197
+ end
198
+
199
+ end
172
200
  build_for_wasm_server(destination, project_name, 9292, :production)
173
201
 
174
202
  end
@@ -177,7 +205,7 @@ task :test_server do
177
205
  source = '.'
178
206
  destination = './tmp'
179
207
  script_source = './test/application'
180
- create_application(source, destination, project_name)
208
+ create_application(source, destination, project_name, refresh_eVe)
181
209
  # the line below is to add addition script to the application folder (useful for test per example)
182
210
  add_to_application_folder(script_source, destination, project_name)
183
211
  # build opal
@@ -220,7 +248,7 @@ task :opal_server_rebuild do
220
248
  source = '.'
221
249
  destination = './tmp'
222
250
  script_source = './test/application'
223
- create_application(source, destination, project_name)
251
+ create_application(source, destination, project_name, refresh_eVe)
224
252
  # the line below is to add addition script to the application folder (useful for test per example)
225
253
  add_to_application_folder(script_source, destination, project_name)
226
254
  # build opal
@@ -265,7 +293,7 @@ task :test_osx do
265
293
  script_source = './test/application'
266
294
  wasi_file = 'wasi-vfs-osx_arm'
267
295
  host_mode = 'tauri'
268
- create_application(source, destination, project_name)
296
+ create_application(source, destination, project_name, refresh_eVe)
269
297
  wasm_common(source, destination, project_name, wasi_file, host_mode, script_source)
270
298
  destination = './tmp'
271
299
  # build and open the app
@@ -280,7 +308,7 @@ task :build_osx do
280
308
  script_source = './test/application'
281
309
  wasi_file = 'wasi-vfs-osx_arm'
282
310
  host_mode = 'tauri'
283
- create_application(source, destination, project_name)
311
+ create_application(source, destination, project_name, refresh_eVe)
284
312
  wasm_common(source, destination, project_name, wasi_file, host_mode, script_source)
285
313
  destination = './tmp'
286
314
  # build and open the app
@@ -306,7 +334,7 @@ task :osx_server do
306
334
  source = '.'
307
335
  destination = './tmp'
308
336
  script_source = './test/application'
309
- create_application(source, destination, project_name)
337
+ create_application(source, destination, project_name, refresh_eVe)
310
338
  # the line below is to add addition script to the application folder (useful for test per example)
311
339
  add_to_application_folder(script_source, destination, project_name)
312
340
  # build opal
@@ -329,7 +357,7 @@ task :osx_server do
329
357
  script_source = './test/application'
330
358
  wasi_file = 'wasi-vfs-osx_arm'
331
359
  host_mode = 'tauri'
332
- create_application(source, destination, project_name)
360
+ create_application(source, destination, project_name, refresh_eVe)
333
361
  wasm_common(source, destination, project_name, wasi_file, host_mode, script_source)
334
362
  destination = './tmp'
335
363
  threads = []
@@ -425,7 +453,7 @@ task :full_test do
425
453
  source = '.'
426
454
  destination = './tmp'
427
455
  script_source = './test/application'
428
- create_application(source, destination, project_name)
456
+ create_application(source, destination, project_name, refresh_eVe)
429
457
  # the line below is to add addition script to the application folder (useful for test per example)
430
458
  add_to_application_folder(script_source, destination, project_name)
431
459
  # build opal
@@ -45,7 +45,7 @@ Bundle update
45
45
 
46
46
  Ruby wasm time allow local use of ruby wasm :
47
47
  1 - download :
48
- https://cdn.jsdelivr.net/npm/@ruby/3.2-wasm-wasi@2.3.0/dist/browser.script.iife.js
48
+ https://cdn.jsdelivr.net/npm/@ruby/3.2-wasm-wasi@2.3.0/dist/browser.script.iife2.js
49
49
  2 - change
50
50
 
51
51
 
data/exe/atome CHANGED
@@ -169,7 +169,7 @@ def build_opal_library(atome_source, destination, project_name, production = nil
169
169
  end
170
170
  end
171
171
 
172
- def create_application(source, destination, project_name)
172
+ def create_application(source, destination, project_name, eVe_copy=true)
173
173
  project_path = "#{destination}/#{project_name}"
174
174
  FileUtils.mkdir_p(destination) unless Dir.exist?(destination)
175
175
  FileUtils.mkdir_p(project_path) unless Dir.exist?(project_path)
@@ -185,10 +185,15 @@ def create_application(source, destination, project_name)
185
185
  end
186
186
  build_aui(destination, project_name)
187
187
  # now lets add eVe now
188
- gem_spec = Gem::Specification.find_by_name('eVe')
189
- gem_path = gem_spec.gem_dir
190
- FileUtils.cp_r(Dir["#{gem_path}/*"], source+"/lib/eVe/")
191
-
188
+ # if eVe_copy
189
+ # # we update eVe first
190
+ # gem_spec = Gem::Specification.find_by_name('atome_eVe')
191
+ # gem_path = gem_spec.gem_dir
192
+ # puts "eve location : #{gem_path}"
193
+ # FileUtils.cp_r(Dir["#{gem_path}/*"], source+"/lib/eVe/")
194
+ # end
195
+ # build eVe kernel
196
+ # build_eVe_kernel_for_opal(source, destination, project_name)
192
197
  end
193
198
 
194
199
  def update_application(source, destination, project_name)
@@ -231,6 +236,34 @@ def build_atome_kernel_for_opal(source, destination, project_name)
231
236
  end
232
237
  end
233
238
 
239
+ # def build_eVe_kernel_for_opal(source, destination, project_name)
240
+ #
241
+ # gem_name = 'atome_eVe'
242
+ # # begin
243
+ # Gem::Specification.find_by_name(gem_name)
244
+ # # puts " gem 'eve' est installée."
245
+ # gem_spec = Gem::Specification.find_by_name(gem_name)
246
+ # gem_path = gem_spec.gem_dir
247
+ # # puts "Le chemin vers la gem '#{gem_name}' est '#{gem_path}'"
248
+ # # puts '-----'
249
+ # # puts "==> #{gem_path}/lib/eVe.rb"
250
+ # # rescue Gem::LoadError
251
+ # # # Code à exécuter si la gemme 'eve' n'est pas installée
252
+ # # puts "La gem '#{gem_name}' n'est pas installée."
253
+ # # end
254
+ # # now lets build the atome kernel
255
+ # atome_directory = "#{destination}/#{project_name}/src/js/atome"
256
+ # kernel_js = "#{atome_directory}/eVe_kernel.js"
257
+ # FileUtils.mkdir_p(atome_directory)
258
+ # File.new kernel_js, 'w'
259
+ # builder = Opal::Builder.new
260
+ # builder.append_paths("#{source}/lib/")
261
+ # kernel_content = builder.build("#{gem_path}/lib/eVe.rb").to_s
262
+ # File.open(kernel_js, 'w') do |f|
263
+ # f.puts kernel_content
264
+ # end
265
+ # end
266
+
234
267
  def build_opal_extensions(source, destination, project_name)
235
268
  opal_directory = "#{destination}/#{project_name}/src/js/opal"
236
269
  extensions_js = "#{opal_directory}/atome_opal_extensions.js"
@@ -432,21 +465,20 @@ STR
432
465
  File.open("#{destination}/#{project_name}/server/config.ru", "w") do |f|
433
466
  f.write(ru_file)
434
467
  end
435
- puts 'w-a'
468
+ # puts 'w-a'
436
469
 
437
470
  `cd #{destination}/#{project_name}/server;puma --port #{port} #{prod}`
438
- puts 'w-b'
471
+ # puts 'w-b'
439
472
 
440
473
  else
441
- puts 'e'
474
+ # puts 'e'
442
475
  # code to exec with Unix/Linux
443
476
  File.open("#{destination}/#{project_name}/server/config.ru", "w") do |f|
444
477
  f.write(ru_file)
445
478
  end
446
479
  `cd #{destination}/#{project_name}/server;puma --port #{port} #{prod}`
447
480
  end
448
- puts 'f'
449
-
481
+ # puts 'f'
450
482
  end
451
483
 
452
484
  # utils
@@ -541,7 +573,7 @@ if ARGV.include?('update')
541
573
  if Dir.exist?("#{destination}/application") && !Dir.exist?("#{destination}/vendor")
542
574
  # first we delete everything but application
543
575
 
544
- files_to_treat = %w[server src-tauri src-wasm Guardfile Rakefile src/css src/js/atome src/js/third_parties src/medias
576
+ files_to_treat = %w[server src-tauri src-wasm Guardfile Rakefile src/css src/js/atome src/js/molecules src/js/third_parties src/medias
545
577
  src/favicon.ico src/index_wasm.html src/index_opal.html src/index_server.html src/index_server_wasm.html]
546
578
  files_to_treat.each do |item|
547
579
  item_path = File.join(destination, item)
@@ -116,7 +116,7 @@ def atome_infos
116
116
  end
117
117
 
118
118
  # help and example below :
119
- #
119
+
120
120
  A.example(:left) do
121
121
  english = 'here is an example, touch me to get some help, or click the code to exec'
122
122
  french = "voici un example, click moi pour de l'aide, ou clicker le code pour l'executer"
@@ -148,35 +148,40 @@ end
148
148
 
149
149
  def init_database # this method is call from JS (atome/communication)
150
150
  # we init the db file eDen
151
- A.message({ action: :init_db, data: { database: :eDen } }) do |db_state|
152
- puts db_state
151
+ A.message({ action: :init_db, data: { database: :eDen } }) do |_db_state|
153
152
  end
153
+ # authentication : email, pass
154
+ # atome : date, particles
155
+ # history : aid, particle, value, date
154
156
 
155
157
  particles = Universe.particle_list
156
- categories = Universe.categories
157
- # here we populate the DB
158
- categories.each do |category|
159
- A.message({ action: :crate_db_table, data: { table: category } }) do |db_state|
160
- # puts db_state
161
- end
158
+ # now we populate the DB
159
+ A.message({ action: :crate_db_table, data: { table: :authentication } }) do |_db_state|
160
+ end
161
+
162
+ A.message({ action: :create_db_column, data: { table: :user, column: :email, type: :string } }) do |_db_state|
163
+ end
164
+
165
+ A.message({ action: :create_db_column, data: { table: :user, column: :password, type: :string } }) do |_db_state|
166
+ end
167
+
168
+ A.message({ action: :crate_db_table, data: { table: :history } }) do |_db_state|
162
169
  end
163
- particles_length=particles.length
164
- particles.each_with_index do |(particle, infos), index|
170
+ A.message({ action: :create_db_column, data: { table: :history, column: :aid, type: :string } }) do |_db_state|
171
+ end
172
+ A.message({ action: :create_db_column, data: { table: :history, column: :particle, type: :string } }) do |_db_state|
173
+ end
174
+ A.message({ action: :create_db_column, data: { table: :history, column: :value, type: :string } }) do |_db_state|
175
+ end
176
+ A.message({ action: :create_db_column, data: { table: :history, column: :date, type: :datetime } }) do |_db_state|
177
+ end
178
+
179
+ A.message({ action: :crate_db_table, data: { table: :atome } }) do |_db_state|
180
+ end
181
+ particles.each do |particle, infos|
165
182
  type = infos[:type]
166
- table = infos[:category]
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
175
- end
176
- else
177
- puts "*** Warning feed type and category to #{particle}"
183
+ A.message({ action: :create_db_column, data: { table: :atome, column: particle, type: type } }) do |_db_state|
178
184
  end
179
-
180
185
  end
181
186
 
182
187
  end
data/lib/atome/version.rb CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  # return atome version
4
4
  class Atome
5
- VERSION = '0.5.6.3.1'
5
+ VERSION = '0.5.6.3.5'
6
6
  end
7
7
 
data/lib/atome.rb CHANGED
@@ -35,8 +35,5 @@ require 'renderers/headless/index'
35
35
  require 'renderers/server/index'
36
36
  require 'atome/helpers/sanitizer'
37
37
  require 'atome/genesis/sparkle'
38
- require 'eVe/lib/eVe'
39
- # require 'eVe'
40
- # gem_spec = Gem::Specification.find_by_name(gem_name)
41
- # gem_path = gem_spec.gem_dir
42
- # puts "Le chemin vers la gemme '#{gem_name}' est '#{gem_path}'"
38
+ require 'molecules/init'
39
+ # require 'eVe/lib/eVe'
@@ -34,9 +34,5 @@ require_relative './renderers/headless/index_relative'
34
34
  require_relative './renderers/server/index_relative'
35
35
  require_relative './atome/helpers/sanitizer'
36
36
  require_relative './atome/genesis/sparkle'
37
- require_relative './eVe/lib/eVe_relative'
38
-
39
- # require 'eVe'
40
- # gem_spec = Gem::Specification.find_by_name(gem_name)
41
- # gem_path = gem_spec.gem_dir
42
- # puts "Le chemin vers la gemme '#{gem_name}' est '#{gem_path}'"
37
+ require_relative './molecules/init'
38
+ # require_relative './eVe/lib/eVe'
@@ -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
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Molecule
4
+ def new(params, &bloc)
5
+ if params[:page]
6
+ site_found = grab(params[:page][:application])
7
+ site_found.clear(true)
8
+ page_id = params[:page][:name]
9
+ site_found.box({ id: page_id })
10
+ elsif params[:application]
11
+
12
+ footer_header_size=33
13
+ footer_header_color=color({red: 0, green: 0, blue: 0, id: :footer_header_color})
14
+
15
+ if params[:header]
16
+ top = footer_header_size
17
+ header=box({ left: 0, right: 0, width: :auto, top: 0, height: top, id: :header })
18
+ # header.attach(:footer_header_color)
19
+ else
20
+ top = 0
21
+ end
22
+ if params[:footer]
23
+ bottom = footer_header_size
24
+ box({ left: 0, right: 0, width: :auto, top: :auto, bottom: 0, height: bottom, id: :footer })
25
+ else
26
+ bottom = 0
27
+ end
28
+ box({ left: 0, right: 0, width: :auto, top: top, bottom: bottom, height: :auto, id: params[:application] })
29
+ elsif params[:module]
30
+
31
+ end
32
+ super if defined?(super)
33
+ end
34
+ end
35
+
36
+ class Object
37
+ include Molecule
38
+ end
39
+
40
+ # tests
41
+ new({application: :compose, header: true, footer: true })
42
+ #
43
+ # new(page: {name: :home, application: :compose, attach: :root })
44
+ #
45
+ # new(module: {name: :home, application: :compose, attach: :root })
46
+
47
+
48
+
49
+
50
+
51
+
@@ -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