atome 0.5.5.6.4 → 0.5.5.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +112 -15
- data/exe/atome +119 -14
- data/lib/atome/atome.rb +2 -3
- data/lib/atome/genesis/generators/identity.rb +1 -1
- data/lib/atome/genesis/generators/spatial.rb +90 -0
- data/lib/atome/genesis/generators/utility.rb +7 -3
- data/lib/atome/genesis/sparkle.rb +3 -0
- data/lib/atome/helpers/utilities.rb +31 -0
- data/lib/atome/version.rb +1 -1
- data/lib/platform_specific/opal/atome_opal_extensions.rb +1 -0
- data/lib/renderers/html/html.rb +1 -1
- data/lib/renderers/html/spatial.rb +12 -0
- data/lib/renderers/html/utility.rb +46 -0
- data/vendor/assets/application/examples/duplicate.rb +2 -0
- data/vendor/assets/application/examples/file.rb +11 -46
- data/vendor/assets/application/examples/layout.rb +15 -191
- data/vendor/assets/application/examples/security.rb +5 -5
- data/vendor/assets/application/examples/selected.rb +0 -1
- data/vendor/assets/src/css/style.css +1 -1
- data/vendor/assets/src/js/atome/atome.js +155 -20
- metadata +2 -3
- data/app_builder_helpers/Rakefile +0 -278
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf1de59b3e8d3060f6c7714a7a4c11e16b42428aa6bc152c95248968c884e85e
|
4
|
+
data.tar.gz: 950f6e9967e30eb5be2d7437674b3471a3f8d1b513597e985de0fb8629378976
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f30d53165d850093d1692d23bd315acb3c47d60ac77bd700a091cf601b562cd2030c46a4ac57234b73dc29bc1d7fcce61731ecb096fe713e5448323d14a5492
|
7
|
+
data.tar.gz: a1b9d403f01442c3670cdbac25c367474514392464bd7f5cfee6123f50d775e5cf183563067e993df4f1584137c1803f319685109625afb494781b407a7bb2ec
|
data/Rakefile
CHANGED
@@ -6,11 +6,39 @@ require 'bundler/gem_tasks'
|
|
6
6
|
load 'exe/atome'
|
7
7
|
|
8
8
|
task :cleanup do
|
9
|
-
|
9
|
+
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
|
10
|
+
# Code à exécuter sous Windows
|
11
|
+
`gem cleanup atome`
|
12
|
+
`echo yes | gem uninstall atome`
|
13
|
+
`cd pkg`
|
14
|
+
|
15
|
+
elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
|
16
|
+
# Code à exécuter sous MacOS
|
17
|
+
`gem cleanup atome;yes | gem uninstall atome;cd pkg`
|
18
|
+
else
|
19
|
+
# Code à exécuter sous Unix/Linux
|
20
|
+
`gem cleanup atome;yes | gem uninstall atome;cd pkg`
|
21
|
+
end
|
22
|
+
|
23
|
+
|
10
24
|
end
|
11
25
|
task :reset_cache do
|
12
|
-
|
13
|
-
|
26
|
+
|
27
|
+
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
|
28
|
+
# Code à exécuter sous Windows
|
29
|
+
`rmdir /s /q .\\tmp`
|
30
|
+
`rmdir /s /q .\\pkg`
|
31
|
+
|
32
|
+
elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
|
33
|
+
# Code à exécuter sous MacOS
|
34
|
+
`rm -r -f ./tmp`
|
35
|
+
`rm -r -f ./pkg`
|
36
|
+
else
|
37
|
+
# Code à exécuter sous Unix/Linux
|
38
|
+
`rm -r -f ./tmp`
|
39
|
+
`rm -r -f ./pkg`
|
40
|
+
end
|
41
|
+
|
14
42
|
end
|
15
43
|
|
16
44
|
def resolve_requires(file_path, root_path, processed_files = Set.new, depth = 0)
|
@@ -51,7 +79,18 @@ task :test_wasm do
|
|
51
79
|
host_mode = 'pure_wasm'
|
52
80
|
create_application(source, destination, project_name)
|
53
81
|
wasm_common(source, destination, project_name, wasi_file, host_mode, script_source)
|
54
|
-
|
82
|
+
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
|
83
|
+
# Code à exécuter sous Windows
|
84
|
+
`start "" ".\\tmp\\#{project_name}\\src\\index.html"`
|
85
|
+
elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
|
86
|
+
# Code à exécuter sous MacOS
|
87
|
+
`open ./tmp/#{project_name}/src/index.html`
|
88
|
+
else
|
89
|
+
# Code à exécuter sous Unix/Linux
|
90
|
+
`open ./tmp/#{project_name}/src/index.html`
|
91
|
+
end
|
92
|
+
|
93
|
+
|
55
94
|
puts 'atome wasm is build and running!'
|
56
95
|
end
|
57
96
|
|
@@ -65,7 +104,18 @@ task :test_wasm_osx_x86 do
|
|
65
104
|
host_mode = 'pure_wasm'
|
66
105
|
create_application(source, destination, project_name)
|
67
106
|
wasm_common(source, destination, project_name, wasi_file, script_source, host_mode, script_source)
|
68
|
-
|
107
|
+
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
|
108
|
+
# Code à exécuter sous Windows
|
109
|
+
`start "" ".\\tmp\\#{project_name}\\src\\index.html"`
|
110
|
+
elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
|
111
|
+
# Code à exécuter sous MacOS
|
112
|
+
`open ./tmp/#{project_name}/src/index.html`
|
113
|
+
else
|
114
|
+
# Code à exécuter sous Unix/Linux
|
115
|
+
`open ./tmp/#{project_name}/src/index.html`
|
116
|
+
end
|
117
|
+
|
118
|
+
|
69
119
|
puts 'atome wasm is build and running!'
|
70
120
|
end
|
71
121
|
task :test_wasm_windows do
|
@@ -78,7 +128,16 @@ task :test_wasm_windows do
|
|
78
128
|
host_mode = 'pure_wasm'
|
79
129
|
create_application(source, destination, project_name)
|
80
130
|
wasm_common(source, destination, project_name, wasi_file, host_mode, script_source)
|
81
|
-
|
131
|
+
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
|
132
|
+
# Code à exécuter sous Windows
|
133
|
+
`start "" ".\\tmp\\#{project_name}\\src\\index.html"`
|
134
|
+
elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
|
135
|
+
# Code à exécuter sous MacOS
|
136
|
+
`open ./tmp/#{project_name}/src/index.html`
|
137
|
+
else
|
138
|
+
# Code à exécuter sous Unix/Linux
|
139
|
+
`open ./tmp/#{project_name}/src/index.html`
|
140
|
+
end
|
82
141
|
puts 'atome wasm is build and running!'
|
83
142
|
end
|
84
143
|
task :test_wasm_unix do
|
@@ -91,7 +150,16 @@ task :test_wasm_unix do
|
|
91
150
|
host_mode = 'pure_wasm'
|
92
151
|
create_application(source, destination, project_name)
|
93
152
|
wasm_common(source, destination, project_name, wasi_file, host_mode, script_source)
|
94
|
-
|
153
|
+
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
|
154
|
+
# Code à exécuter sous Windows
|
155
|
+
`start "" ".\\tmp\\#{project_name}\\src\\index.html"`
|
156
|
+
elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
|
157
|
+
# Code à exécuter sous MacOS
|
158
|
+
`open ./tmp/#{project_name}/src/index.html`
|
159
|
+
else
|
160
|
+
# Code à exécuter sous Unix/Linux
|
161
|
+
`open ./tmp/#{project_name}/src/index.html`
|
162
|
+
end
|
95
163
|
puts 'atome wasm is build and running!'
|
96
164
|
end
|
97
165
|
|
@@ -116,7 +184,17 @@ task :test_opal do
|
|
116
184
|
# build application
|
117
185
|
build_opal_application(source, destination, project_name)
|
118
186
|
# open the app
|
119
|
-
|
187
|
+
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
|
188
|
+
# Code à exécuter sous Windows
|
189
|
+
`start "" "#{destination}\\#{project_name}\\src\\index_opal.html"`
|
190
|
+
elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
|
191
|
+
# Code à exécuter sous MacOS
|
192
|
+
`open #{destination}/#{project_name}/src/index_opal.html`
|
193
|
+
else
|
194
|
+
# Code à exécuter sous Unix/Linux
|
195
|
+
`open #{destination}/#{project_name}/src/index_opal.html`
|
196
|
+
end
|
197
|
+
|
120
198
|
puts 'atome opal is build and running!'
|
121
199
|
end
|
122
200
|
task :server_wasm do
|
@@ -157,7 +235,18 @@ task :test_server do
|
|
157
235
|
threads = []
|
158
236
|
threads << Thread.new do
|
159
237
|
sleep 1
|
160
|
-
|
238
|
+
|
239
|
+
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
|
240
|
+
# Code à exécuter sous Windows
|
241
|
+
`start "" "http://localhost:9292"`
|
242
|
+
elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
|
243
|
+
# Code à exécuter sous MacOS
|
244
|
+
`open http://localhost:9292`
|
245
|
+
else
|
246
|
+
# Code à exécuter sous Unix/Linux
|
247
|
+
`open http://localhost:9292`
|
248
|
+
end
|
249
|
+
|
161
250
|
end
|
162
251
|
build_for_server(destination, project_name, 9292, :production)
|
163
252
|
end
|
@@ -245,10 +334,6 @@ task :osx_server do
|
|
245
334
|
|
246
335
|
puts 'atome osx is running'
|
247
336
|
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
337
|
end
|
253
338
|
|
254
339
|
|
@@ -256,8 +341,20 @@ task :build_gem do
|
|
256
341
|
# building the gem
|
257
342
|
`rake build` # run build_app thru ARGV in exe atome
|
258
343
|
# installing the gem
|
259
|
-
|
260
|
-
|
344
|
+
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
|
345
|
+
# Code à exécuter sous Windows
|
346
|
+
`cd pkg && gem install atome --local`
|
347
|
+
elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
|
348
|
+
# Code à exécuter sous MacOS
|
349
|
+
`cd pkg; gem install atome --local`
|
350
|
+
# open the app
|
351
|
+
else
|
352
|
+
# Code à exécuter sous Unix/Linux
|
353
|
+
`cd pkg; gem install atome --local`
|
354
|
+
# open the app
|
355
|
+
end
|
356
|
+
|
357
|
+
|
261
358
|
puts 'atome gem built and installed'
|
262
359
|
end
|
263
360
|
|
data/exe/atome
CHANGED
@@ -131,7 +131,20 @@ STR
|
|
131
131
|
File.open(opal_compiler, 'w') do |f|
|
132
132
|
f.puts opal_compiler_content
|
133
133
|
end
|
134
|
-
|
134
|
+
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
|
135
|
+
# Code à exécuter sous Windows
|
136
|
+
`cd #{destination}\\#{project_name}\\tmp\\application\\ && echo %cd% && ruby .opal_compiler.rb`
|
137
|
+
|
138
|
+
elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
|
139
|
+
# Code à exécuter sous MacOS
|
140
|
+
`cd #{destination}/#{project_name}/tmp/application/;pwd;ruby .opal_compiler.rb`
|
141
|
+
|
142
|
+
else
|
143
|
+
# Code à exécuter sous Unix/Linux
|
144
|
+
`cd #{destination}/#{project_name}/tmp/application/;pwd;ruby .opal_compiler.rb`
|
145
|
+
|
146
|
+
end
|
147
|
+
|
135
148
|
end
|
136
149
|
|
137
150
|
def add_to_application_folder(script_source, destination, project_name)
|
@@ -243,14 +256,42 @@ def wasm_initialize (source, destination, project_name, wasi_source)
|
|
243
256
|
#### IMPORTANT TO REFRESH RUBY WASM TO THE LATEST VERSION, (when ruby_browser get far too large)
|
244
257
|
# and UNCOMMENT the line below : ('curl -LO ....')
|
245
258
|
unless File.exist?("#{wasm_temp_folder}/ruby-3_2-wasm32-unknown-wasi-full-js.tar.gz")
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
259
|
+
|
260
|
+
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
|
261
|
+
`cd /d %wasm_temp_folder% && curl -LO https://github.com/ruby/ruby.wasm/releases/download/2023-11-17-a/ruby-3_2-wasm32-unknown-wasi-full-js.tar.gz
|
262
|
+
`
|
263
|
+
elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
|
264
|
+
# Code à exécuter sous MacOS
|
265
|
+
# `cd #{wasm_temp_folder};curl -LO https://github.com/ruby/ruby.wasm/releases/latest/download/ruby-3_2-wasm32-unknown-wasi-full-js.tar.gz`
|
266
|
+
`cd #{wasm_temp_folder};curl -LO https://github.com/ruby/ruby.wasm/releases/download/2023-11-17-a/ruby-3_2-wasm32-unknown-wasi-full-js.tar.gz`
|
267
|
+
# debug : https://github.com/ruby/ruby.wasm/releases/download/2023-11-17-a/ruby-3_2-wasm32-unknown-wasi-minimal-js-debug.tar.gz
|
268
|
+
# standard : `cd #{wasm_temp_folder};curl -LO https://github.com/ruby/ruby.wasm/releases/download/2023-11-17-a/ruby-3_2-wasm32-unknown-wasi-full-js.tar.gz`
|
269
|
+
|
270
|
+
else
|
271
|
+
# Code à exécuter sous Unix/Linux
|
272
|
+
`cd #{wasm_temp_folder};curl -LO https://github.com/ruby/ruby.wasm/releases/download/2023-11-17-a/ruby-3_2-wasm32-unknown-wasi-full-js.tar.gz`
|
273
|
+
end
|
274
|
+
|
275
|
+
end
|
276
|
+
|
277
|
+
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
|
278
|
+
# Code à exécuter sous Windows
|
279
|
+
`cd /d %wasm_temp_folder% && 7z x ruby-3_2-wasm32-unknown-wasi-full-js.tar.gz`
|
280
|
+
`move %wasm_temp_folder%\\3_2-wasm32-unknown-wasi-full-js\\usr\\local\\bin\\ruby %wasm_temp_folder%\\system_ruby_browser.wasm`
|
281
|
+
`del %application_location%\\src\\wasm\\ruby_browser.wasm`
|
282
|
+
|
283
|
+
elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
|
284
|
+
# Code à exécuter sous MacOS
|
285
|
+
`cd #{wasm_temp_folder}; tar xfz ruby-3_2-wasm32-unknown-wasi-full-js.tar.gz`
|
286
|
+
`mv #{wasm_temp_folder}/3_2-wasm32-unknown-wasi-full-js/usr/local/bin/ruby #{wasm_temp_folder}/system_ruby_browser.wasm`
|
287
|
+
`rm -f #{application_location}/src/wasm/ruby_browser.wasm`
|
288
|
+
else
|
289
|
+
# Code à exécuter sous Unix/Linux
|
290
|
+
`cd #{wasm_temp_folder}; tar xfz ruby-3_2-wasm32-unknown-wasi-full-js.tar.gz`
|
291
|
+
`mv #{wasm_temp_folder}/3_2-wasm32-unknown-wasi-full-js/usr/local/bin/ruby #{wasm_temp_folder}/system_ruby_browser.wasm`
|
292
|
+
`rm -f #{application_location}/src/wasm/ruby_browser.wasm`
|
250
293
|
end
|
251
|
-
|
252
|
-
`mv #{wasm_temp_folder}/3_2-wasm32-unknown-wasi-full-js/usr/local/bin/ruby #{wasm_temp_folder}/system_ruby_browser.wasm`
|
253
|
-
`rm -f #{application_location}/src/wasm/ruby_browser.wasm`
|
294
|
+
|
254
295
|
cmd = <<~STRDELIM
|
255
296
|
#{application_location}/src-wasm/wasm/#{wasi_source} pack #{wasm_temp_folder}/system_ruby_browser.wasm
|
256
297
|
--mapdir usr::#{wasm_temp_folder}/3_2-wasm32-unknown-wasi-full-js/usr
|
@@ -277,14 +318,34 @@ end
|
|
277
318
|
|
278
319
|
def build_for_osx(destination, mode = :dev)
|
279
320
|
# dev or build
|
321
|
+
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
|
322
|
+
# Code à exécuter sous Windows
|
323
|
+
`cd /d #{destination} && cargo tauri %mode%`
|
324
|
+
|
325
|
+
elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
|
326
|
+
# Code à exécuter sous MacOS
|
327
|
+
`cd #{destination};cargo tauri #{mode}`
|
328
|
+
else
|
329
|
+
# Code à exécuter sous Unix/Linux
|
330
|
+
`cd #{destination};cargo tauri #{mode}`
|
331
|
+
end
|
280
332
|
|
281
|
-
`cd #{destination};cargo tauri #{mode}`
|
282
333
|
|
283
334
|
end
|
284
335
|
|
285
336
|
def build_for_server(destination, project_name, port, production)
|
286
337
|
prod = '--env production' if production
|
287
|
-
|
338
|
+
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
|
339
|
+
# Code à exécuter sous Windows
|
340
|
+
`cd /d #{destination}\\#{project_name}\\server && puma --port %port% %prod%`
|
341
|
+
elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
|
342
|
+
# Code à exécuter sous MacOS
|
343
|
+
`cd #{destination}/#{project_name}/server;puma --port #{port} #{prod}`
|
344
|
+
else
|
345
|
+
# Code à exécuter sous Unix/Linux
|
346
|
+
`cd #{destination}/#{project_name}/server;puma --port #{port} #{prod}`
|
347
|
+
end
|
348
|
+
|
288
349
|
end
|
289
350
|
|
290
351
|
# def run_application(build_target, location, port = 9292, production = false)
|
@@ -295,7 +356,18 @@ end
|
|
295
356
|
# below we analyse the ARGV
|
296
357
|
location = '/'
|
297
358
|
project_name = ARGV[1]
|
298
|
-
|
359
|
+
|
360
|
+
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
|
361
|
+
# Code à exécuter sous Windows
|
362
|
+
destination = `cd`.chomp
|
363
|
+
elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
|
364
|
+
# Code à exécuter sous MacOS
|
365
|
+
destination = `pwd`.chomp
|
366
|
+
else
|
367
|
+
# Code à exécuter sous Unix/Linux
|
368
|
+
destination = `pwd`.chomp
|
369
|
+
end
|
370
|
+
|
299
371
|
source = Pathname(__FILE__).parent.parent.to_s
|
300
372
|
|
301
373
|
wasi_file = 'wasi-vfs-osx_arm' # default to osx arm
|
@@ -349,7 +421,17 @@ if ARGV.include?('guard')
|
|
349
421
|
end
|
350
422
|
|
351
423
|
if ARGV.include?('run')
|
352
|
-
|
424
|
+
|
425
|
+
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
|
426
|
+
# Code à exécuter sous Windows
|
427
|
+
current_path = `cd`.chomp
|
428
|
+
elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
|
429
|
+
# Code à exécuter sous MacOS
|
430
|
+
current_path = `pwd`.chomp
|
431
|
+
else
|
432
|
+
# Code à exécuter sous Unix/Linux
|
433
|
+
current_path = `pwd`.chomp
|
434
|
+
end
|
353
435
|
segments = current_path.split("/")
|
354
436
|
project_name = segments.last
|
355
437
|
destination = segments[0...-1].join("/")
|
@@ -366,7 +448,19 @@ if ARGV.include?('run')
|
|
366
448
|
threads = []
|
367
449
|
threads << Thread.new do
|
368
450
|
sleep 1
|
369
|
-
|
451
|
+
|
452
|
+
|
453
|
+
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
|
454
|
+
# Code à exécuter sous Windows
|
455
|
+
`start "" "#{destination}\\#{project_name}\\src\\index_opal.html`
|
456
|
+
elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
|
457
|
+
# Code à exécuter sous MacOS
|
458
|
+
`open http://localhost:9292`
|
459
|
+
else
|
460
|
+
# Code à exécuter sous Unix/Linux
|
461
|
+
`open http://localhost:9292`
|
462
|
+
end
|
463
|
+
|
370
464
|
end
|
371
465
|
build_for_server(destination, project_name, 9292, :production)
|
372
466
|
when 'osx'
|
@@ -386,7 +480,18 @@ if ARGV.include?('run')
|
|
386
480
|
else
|
387
481
|
wasi_file = 'wasi-vfs-osx_arm'
|
388
482
|
wasm_common(source, destination, project_name, wasi_file, 'pure_wasm')
|
389
|
-
|
483
|
+
|
484
|
+
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
|
485
|
+
# Code à exécuter sous Windows
|
486
|
+
`start "" "%current_path%\\src\\index.html"`
|
487
|
+
elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
|
488
|
+
# Code à exécuter sous MacOS
|
489
|
+
`open #{current_path}/src/index.html`
|
490
|
+
else
|
491
|
+
# Code à exécuter sous Unix/Linux
|
492
|
+
`open #{current_path}/src/index.html`
|
493
|
+
end
|
494
|
+
|
390
495
|
end
|
391
496
|
|
392
497
|
end
|
data/lib/atome/atome.rb
CHANGED
@@ -6,7 +6,6 @@ class Atome
|
|
6
6
|
|
7
7
|
def initialize(new_atome = {}, &atomes_proc)
|
8
8
|
# the keys :renderers, :type and :id should be placed in the first position in the hash
|
9
|
-
#@broadcast = {}
|
10
9
|
@history = {}
|
11
10
|
@callback = {}
|
12
11
|
@tag = {}
|
@@ -17,8 +16,8 @@ class Atome
|
|
17
16
|
@type = new_atome[:type] || :element
|
18
17
|
@attached = []
|
19
18
|
@category = []
|
20
|
-
@display = { mode: :default
|
21
|
-
# @
|
19
|
+
# @display = { mode: :default }
|
20
|
+
# @backup={} # mainly used to restore particle when using grid /table /list display mode
|
22
21
|
@html = HTML.new(@id, self)
|
23
22
|
@headless = Headless.new(@id, self)
|
24
23
|
# now we store the proc in a an atome's property called :bloc
|
@@ -53,7 +53,7 @@ new(particle: :selected) do |params|
|
|
53
53
|
if params == true
|
54
54
|
grab(Universe.current_user).selection << @id
|
55
55
|
elsif params == false
|
56
|
-
grab(Universe.current_user).selection.delete(@id)
|
56
|
+
grab(Universe.current_user).selection.collect.delete(@id)
|
57
57
|
else
|
58
58
|
# TODO: for future use
|
59
59
|
end
|
@@ -9,3 +9,93 @@ new({ particle: :direction, type: :string })
|
|
9
9
|
new({ particle: :center, type: :string})
|
10
10
|
new({particle: :depth, type: :integer})
|
11
11
|
new({ particle: :position })
|
12
|
+
new({ particle: :organise })
|
13
|
+
new({ particle: :spacing })
|
14
|
+
new({ particle: :display }) do |params|
|
15
|
+
unless params.instance_of? Hash
|
16
|
+
params = { mode: params }
|
17
|
+
end
|
18
|
+
params
|
19
|
+
end
|
20
|
+
new({ particle: :layout }) do |params|
|
21
|
+
|
22
|
+
mode_found = params.delete(:mode) || :list
|
23
|
+
elements_style = params.delete(:element) || {}
|
24
|
+
# now we get the list of the atome to layout
|
25
|
+
atomes_to_organise = []
|
26
|
+
if type == :group
|
27
|
+
atomes_to_organise = collect
|
28
|
+
end
|
29
|
+
# if params[:listing] is specified group collection is override
|
30
|
+
atomes_to_organise = params[:listing] if params[:listing]
|
31
|
+
if mode_found == :default
|
32
|
+
# the user want to revert the layout to the default
|
33
|
+
atomes_to_organise.each do |atome_id_to_organise|
|
34
|
+
atome_found = grab(atome_id_to_organise)
|
35
|
+
# now restoring
|
36
|
+
if atome_found.backup
|
37
|
+
atome_found.backup.each do |particle, value|
|
38
|
+
atome_found.send(:delete, particle)
|
39
|
+
atome_found.send(particle, value)
|
40
|
+
end
|
41
|
+
atome_found.remove_layout
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
else
|
46
|
+
|
47
|
+
if params[:id]
|
48
|
+
container_name = params[:id]
|
49
|
+
container = grab(:view).box({ id: container_name })
|
50
|
+
container_class = container_name
|
51
|
+
else
|
52
|
+
container = grab(:view).box
|
53
|
+
id_found = container.id
|
54
|
+
params[:id] = id_found
|
55
|
+
container_class = id_found
|
56
|
+
end
|
57
|
+
container.remove({ category: :atome })
|
58
|
+
container.category(:matrix)
|
59
|
+
if mode_found == :list
|
60
|
+
params[:organise] = '1fr'
|
61
|
+
end
|
62
|
+
params.each do |particle, value|
|
63
|
+
container.send(particle, value)
|
64
|
+
end
|
65
|
+
# now we add user wanted particles
|
66
|
+
atomes_to_organise.each do |atome_id_to_organise|
|
67
|
+
atome_found = grab(atome_id_to_organise)
|
68
|
+
# now restoring
|
69
|
+
if atome_found.backup
|
70
|
+
atome_found.backup.each do |particle, value|
|
71
|
+
atome_found.send(:delete, particle)
|
72
|
+
atome_found.send(particle, value)
|
73
|
+
end
|
74
|
+
# atome_found.remove_layout
|
75
|
+
end
|
76
|
+
# we remove previous display mode
|
77
|
+
atome_found.remove_layout
|
78
|
+
atome_found.display[:mode] = mode_found
|
79
|
+
atome_found.display[:layout] = id_found
|
80
|
+
atome_found.attach(container_class)
|
81
|
+
atome_found.remove({ category: :atome })
|
82
|
+
atome_found.category(container_class)
|
83
|
+
# the hash below is used to restore element state
|
84
|
+
|
85
|
+
# we only store the state if atome_found.display[:default]== {} it means this is the original state
|
86
|
+
elements_style.each do |particle, value|
|
87
|
+
# we have to store all elements particle to restore it later
|
88
|
+
atome_found.backup({}) unless atome_found.backup
|
89
|
+
unless atome_found.backup[particle]
|
90
|
+
particle_to_save = atome_found.send(particle) || 0
|
91
|
+
atome_found.backup[particle] = particle_to_save
|
92
|
+
end
|
93
|
+
|
94
|
+
atome_found.send(particle, value)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
params
|
99
|
+
end
|
100
|
+
|
101
|
+
|
@@ -197,7 +197,6 @@ new({ particle: :copy }) do |items_id|
|
|
197
197
|
grab(:copy).collect << items_id
|
198
198
|
end
|
199
199
|
|
200
|
-
|
201
200
|
new({ particle: :paste }) do |params|
|
202
201
|
|
203
202
|
all_copies = grab(:copy).collect
|
@@ -211,7 +210,7 @@ new({ particle: :paste }) do |params|
|
|
211
210
|
new_atomes = []
|
212
211
|
applies_found = []
|
213
212
|
copies_found.each do |copy_found|
|
214
|
-
new_atome = grab(copy_found).duplicate({attach: @id })
|
213
|
+
new_atome = grab(copy_found).duplicate({ attach: @id })
|
215
214
|
new_atomes << new_atome.id
|
216
215
|
# FIXME: below start to patch because apply is not apply , so we store it and apply it again
|
217
216
|
applies_found << new_atome.apply
|
@@ -226,4 +225,9 @@ end
|
|
226
225
|
|
227
226
|
new({ read: :paste }) do |p|
|
228
227
|
@copy
|
229
|
-
end
|
228
|
+
end
|
229
|
+
|
230
|
+
new({ particle: :backup })
|
231
|
+
|
232
|
+
new({ particle: :import })
|
233
|
+
|
@@ -87,6 +87,9 @@ Universe.current_machine = machine_id
|
|
87
87
|
A = Atome.new(
|
88
88
|
{ renderers: default_render, id: :atome, type: :element, tag: { system: true } }
|
89
89
|
)
|
90
|
+
# atome selector / collector
|
91
|
+
Atome.new({ renderers: [:html], id: :selector, collect: [], type: :group, tag: { system: true } })
|
92
|
+
|
90
93
|
# atome infos
|
91
94
|
def atome_infos
|
92
95
|
puts "atome version: #{Atome::VERSION}"
|
@@ -2,10 +2,19 @@
|
|
2
2
|
|
3
3
|
# toolbox method here
|
4
4
|
require 'json'
|
5
|
+
|
5
6
|
class Atome
|
6
7
|
class << self
|
8
|
+
|
9
|
+
def file_handler(parent, content, bloc)
|
10
|
+
grab(parent).instance_exec(content, &bloc)
|
11
|
+
end
|
12
|
+
|
13
|
+
|
14
|
+
|
7
15
|
def controller_sender(message)
|
8
16
|
return if $host == :html
|
17
|
+
|
9
18
|
json_msg = message.to_json
|
10
19
|
js_json_msg = json_msg.inspect
|
11
20
|
js_command = "atomeJS.controller_sender(#{js_json_msg})"
|
@@ -44,6 +53,9 @@ class Atome
|
|
44
53
|
end
|
45
54
|
|
46
55
|
# local server messaging
|
56
|
+
def file_for_opal(parent, bloc)
|
57
|
+
JS.eval("fileForOpal('#{parent}', #{bloc})")
|
58
|
+
end
|
47
59
|
|
48
60
|
def response_listener(hashed_msg)
|
49
61
|
js_action = hashed_msg.JS[:action]
|
@@ -127,6 +139,7 @@ class Atome
|
|
127
139
|
def atome_post_process(element, params, new_atome, &user_proc)
|
128
140
|
|
129
141
|
return unless Atome.instance_variable_get("@post_#{element}").is_a?(Proc)
|
142
|
+
|
130
143
|
new_atome.instance_exec(params, user_proc, &Atome.instance_variable_get("@post_#{element}"))
|
131
144
|
|
132
145
|
end
|
@@ -280,4 +293,22 @@ class Atome
|
|
280
293
|
debug "#{user_id} not found"
|
281
294
|
end
|
282
295
|
end
|
296
|
+
|
297
|
+
def remove_layout
|
298
|
+
display(:default)
|
299
|
+
# we get the current parent (the previous layout)
|
300
|
+
parent_found = grab(attach)
|
301
|
+
# we get the parent of the parent
|
302
|
+
grand_parent = parent_found.attach
|
303
|
+
# and attach the item to the grand parent
|
304
|
+
# we remove the parent category and restore atome category
|
305
|
+
remove({ category: attach })
|
306
|
+
category(:atome)
|
307
|
+
attach(grand_parent)
|
308
|
+
# we delete the parent (the layout) if it no more children attached
|
309
|
+
if parent_found.attached.length == 0
|
310
|
+
parent_found.delete(true)
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
283
314
|
end
|
data/lib/atome/version.rb
CHANGED
data/lib/renderers/html/html.rb
CHANGED
@@ -1096,7 +1096,7 @@ class HTML
|
|
1096
1096
|
end
|
1097
1097
|
|
1098
1098
|
def play_animation(properties)
|
1099
|
-
|
1099
|
+
puts 'change for standard method : action'
|
1100
1100
|
required_keys = [:from, :to, :duration]
|
1101
1101
|
if properties.is_a?(Hash) && (required_keys - properties.keys).empty?
|
1102
1102
|
animate(properties)
|
@@ -43,4 +43,16 @@ end
|
|
43
43
|
|
44
44
|
new({renderer: :html, method: :depth }) do |params|
|
45
45
|
html.style("z-index", params)
|
46
|
+
end
|
47
|
+
|
48
|
+
new({ method: :organise, renderer: :html }) do |params|
|
49
|
+
html.style(:gridTemplateColumns, params)
|
50
|
+
end
|
51
|
+
|
52
|
+
new({ method: :spacing, renderer: :html }) do |params|
|
53
|
+
html.style(:gap, "#{params}px")
|
54
|
+
end
|
55
|
+
|
56
|
+
new({ method: :display, renderer: :html }) do |params|
|
57
|
+
html.style(:display, params)
|
46
58
|
end
|