atome 0.5.5.7.7 → 0.5.5.8.1
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/exe/atome +110 -91
- data/lib/atome/atome.rb +3 -0
- data/lib/atome/extensions/atome.rb +180 -0
- data/lib/atome/genesis/generators/communication.rb +6 -2
- data/lib/atome/genesis/generators/effect.rb +7 -1
- data/lib/atome/genesis/generators/property.rb +2 -0
- data/lib/atome/genesis/generators/security.rb +4 -2
- data/lib/atome/genesis/generators/utility.rb +1 -0
- data/lib/atome/genesis/sparkle.rb +3 -2
- data/lib/atome/version.rb +1 -1
- data/lib/platform_specific/opal/extensions/js.rb +1 -2
- data/lib/renderers/html/effect.rb +7 -3
- data/lib/renderers/html/hierarchy.rb +1 -1
- data/lib/renderers/html/html.rb +5 -0
- data/lib/renderers/html/property.rb +14 -0
- data/lib/renderers/html/spatial.rb +14 -5
- data/sig/global_variables.rbs +1 -0
- data/vendor/assets/application/examples/a_concat.rb +3 -0
- data/vendor/assets/application/examples/blur.rb +6 -0
- data/vendor/assets/application/examples/border.rb +6 -0
- data/vendor/assets/application/examples/console.rb +4 -0
- data/vendor/assets/application/examples/import.rb +33 -0
- data/vendor/assets/application/examples/messaging.rb +17 -4
- data/vendor/assets/application/examples/shortcut.rb +25 -0
- data/vendor/assets/application/works/vie.rb +3 -0
- data/vendor/assets/server/atome_server.rb +40 -7
- data/vendor/assets/server/capture.rb +1 -1
- data/vendor/assets/src/index.html +7 -6
- data/vendor/assets/src/index_opal.html +11 -6
- data/vendor/assets/src/index_server.html +11 -7
- data/vendor/assets/src/index_server_wasm.html +7 -6
- data/vendor/assets/src/js/atome/atome.js +0 -95
- data/vendor/assets/src/js/atome/atome_helpers/communication.js +7 -6
- metadata +8 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dca916be3525186dfd79400fc93edeffbe278488c372a9ce67be16ae595d01a5
|
|
4
|
+
data.tar.gz: a332d054df5551d18058ef0e692e87eb362cb498962bcbc4f6717d2dc31d45b9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 99f23cb4a77974b91c1169727740c4c20afd3c9b06c91b3de1d20fbaa4cd95e75806bc3f2775b659d4467be7618290ed14bd2045e04b0df0cdac1572f1b795ad
|
|
7
|
+
data.tar.gz: afdd19c60b61262fa4cd5abc89edc5a01692adf2aac3878741d1f508980c4cb48ea2d332468c649835f933742084082c13d3481673462ccda86bb9dd17611580
|
data/exe/atome
CHANGED
|
@@ -413,6 +413,8 @@ def find_requires(file)
|
|
|
413
413
|
end
|
|
414
414
|
|
|
415
415
|
def copy_file(source, destination)
|
|
416
|
+
return if source == 'server.rb'
|
|
417
|
+
|
|
416
418
|
FileUtils.mkdir_p(File.dirname(destination))
|
|
417
419
|
FileUtils.cp(source, destination)
|
|
418
420
|
end
|
|
@@ -577,52 +579,113 @@ STR
|
|
|
577
579
|
|
|
578
580
|
end
|
|
579
581
|
|
|
580
|
-
if ARGV.include?('
|
|
581
|
-
|
|
582
|
+
if ARGV.include?('sparkle')
|
|
583
|
+
temp_dir = if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
|
|
584
|
+
'C:\Windows\Temp'
|
|
585
|
+
# code to exec with Windows
|
|
586
|
+
elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
|
|
587
|
+
'/tmp'
|
|
588
|
+
# code to exec with MacOS
|
|
589
|
+
else
|
|
590
|
+
'/tmp'
|
|
591
|
+
# code to exec with Unix/Linux
|
|
592
|
+
end
|
|
593
|
+
|
|
594
|
+
`cd #{temp_dir}; atome create atome_app` unless Dir.exist?("#{temp_dir}/atome_app")
|
|
595
|
+
# search for server file
|
|
596
|
+
if File.exist?('server.rb')
|
|
597
|
+
file_content = File.read('server.rb')
|
|
598
|
+
File.write("#{temp_dir}/atome_app/server/atome_server.rb", file_content)
|
|
599
|
+
base_folder = File.dirname(project_name)
|
|
600
|
+
copy_with_requires('server.rb', "#{temp_dir}/atome_app/server", base_folder)
|
|
601
|
+
end
|
|
602
|
+
project_name = ARGV[1]
|
|
603
|
+
if project_name.nil? || project_name == 'opal' || project_name == 'wasm' || project_name == 'server'
|
|
604
|
+
project_name = 'index.rb'
|
|
605
|
+
end
|
|
606
|
+
project_name = ensure_rb_extension(project_name)
|
|
607
|
+
base_folder = File.dirname(project_name)
|
|
608
|
+
copy_with_requires(project_name, "#{temp_dir}/atome_app/application", base_folder)
|
|
582
609
|
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
# code to exec for MacOS
|
|
592
|
-
`open #{destination}/#{project_name}/src/index_opal.html`
|
|
610
|
+
if ARGV.include?('opal')
|
|
611
|
+
`cd #{temp_dir}/atome_app;atome run opal`
|
|
612
|
+
|
|
613
|
+
elsif ARGV.include?('wasm')
|
|
614
|
+
`cd #{temp_dir}/atome_app;atome run wasm`
|
|
615
|
+
|
|
616
|
+
elsif ARGV.include?('server')
|
|
617
|
+
`cd #{temp_dir}/atome_app;atome run server`
|
|
593
618
|
else
|
|
594
|
-
#
|
|
595
|
-
`open #{destination}/#{project_name}/src/index_opal.html`
|
|
619
|
+
`cd #{temp_dir}/atome_app;atome run opal`
|
|
596
620
|
end
|
|
621
|
+
else
|
|
622
|
+
if ARGV.include?('opal')
|
|
623
|
+
puts 'building Opal'
|
|
597
624
|
|
|
598
|
-
|
|
599
|
-
|
|
625
|
+
build_opal_application(nil, destination, project_name)
|
|
626
|
+
# build host_mode
|
|
627
|
+
build_host_mode(destination, project_name, 'web-opal')
|
|
628
|
+
# build Opal extensions
|
|
629
|
+
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
|
|
630
|
+
# code to exec for Windows
|
|
631
|
+
`start "" "#{destination}\\#{project_name}\\src\\index_opal.html"`
|
|
632
|
+
elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
|
|
633
|
+
# code to exec for MacOS
|
|
634
|
+
`open #{destination}/#{project_name}/src/index_opal.html`
|
|
635
|
+
else
|
|
636
|
+
# code to exec for Unix/Linux
|
|
637
|
+
`open #{destination}/#{project_name}/src/index_opal.html`
|
|
638
|
+
end
|
|
600
639
|
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
640
|
+
puts "opal ready!"
|
|
641
|
+
end
|
|
642
|
+
|
|
643
|
+
if ARGV.include?('wasm')
|
|
644
|
+
puts 'building Ruby wasm'
|
|
645
|
+
wasi_file = 'wasi-vfs-osx_arm'
|
|
646
|
+
wasm_common(source, destination, project_name, wasi_file, :pure_wasi)
|
|
647
|
+
|
|
648
|
+
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
|
|
649
|
+
# code to exec for Windows
|
|
650
|
+
`start "" "#{destination}\\#{project_name}\\src\\index.html"`
|
|
651
|
+
elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
|
|
652
|
+
# code to exec for MacOS
|
|
653
|
+
`open #{destination}/#{project_name}/src/index.html`
|
|
654
|
+
else
|
|
655
|
+
# code to exec for Unix/Linux
|
|
656
|
+
`open #{destination}/#{project_name}/src/index.html`
|
|
657
|
+
end
|
|
605
658
|
|
|
606
|
-
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
|
|
607
|
-
# code to exec for Windows
|
|
608
|
-
`start "" "#{destination}\\#{project_name}\\src\\index.html"`
|
|
609
|
-
elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
|
|
610
|
-
# code to exec for MacOS
|
|
611
|
-
`open #{destination}/#{project_name}/src/index.html`
|
|
612
|
-
else
|
|
613
|
-
# code to exec for Unix/Linux
|
|
614
|
-
`open #{destination}/#{project_name}/src/index.html`
|
|
615
659
|
end
|
|
616
660
|
|
|
617
|
-
|
|
661
|
+
if ARGV.include?('server')
|
|
662
|
+
puts 'building Server'
|
|
663
|
+
build_opal_application(nil, destination, project_name)
|
|
664
|
+
build_host_mode(destination, project_name, 'web-opal')
|
|
665
|
+
threads = []
|
|
666
|
+
threads << Thread.new do
|
|
667
|
+
sleep 1
|
|
668
|
+
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
|
|
669
|
+
# code to exec with Windows
|
|
670
|
+
`start "" "#{destination}\\#{project_name}\\src\\index_opal.html`
|
|
671
|
+
elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
|
|
672
|
+
# code to exec with MacOS
|
|
673
|
+
`open http://localhost:9292`
|
|
674
|
+
else
|
|
675
|
+
# code to exec with Unix/Linux
|
|
676
|
+
`open http://localhost:9292`
|
|
677
|
+
end
|
|
678
|
+
end
|
|
679
|
+
threads << Thread.new do
|
|
680
|
+
build_for_server(destination, project_name, 9292, false)
|
|
681
|
+
end
|
|
618
682
|
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
sleep 1
|
|
683
|
+
threads.each(&:join)
|
|
684
|
+
end
|
|
685
|
+
|
|
686
|
+
if ARGV.include?('server_refresh')
|
|
687
|
+
puts 're building Server'
|
|
688
|
+
build_opal_application(nil, destination, project_name)
|
|
626
689
|
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
|
|
627
690
|
# code to exec with Windows
|
|
628
691
|
`start "" "#{destination}\\#{project_name}\\src\\index_opal.html`
|
|
@@ -634,63 +697,19 @@ if ARGV.include?('server')
|
|
|
634
697
|
`open http://localhost:9292`
|
|
635
698
|
end
|
|
636
699
|
end
|
|
637
|
-
threads << Thread.new do
|
|
638
|
-
build_for_server(destination, project_name, 9292, false)
|
|
639
|
-
end
|
|
640
|
-
|
|
641
|
-
threads.each(&:join)
|
|
642
|
-
end
|
|
643
700
|
|
|
644
|
-
if ARGV.include?('
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
`start "" "#{destination}\\#{project_name}\\src\\index_opal.html`
|
|
650
|
-
elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
|
|
651
|
-
# code to exec with MacOS
|
|
652
|
-
`open http://localhost:9292`
|
|
653
|
-
else
|
|
654
|
-
# code to exec with Unix/Linux
|
|
655
|
-
`open http://localhost:9292`
|
|
701
|
+
if ARGV.include?('osx')
|
|
702
|
+
puts 'building osx'
|
|
703
|
+
wasi_file = 'wasi-vfs-osx_arm'
|
|
704
|
+
wasm_common(source, destination, project_name, wasi_file, :tauri)
|
|
705
|
+
build_for_osx(destination)
|
|
656
706
|
end
|
|
657
|
-
end
|
|
658
|
-
|
|
659
|
-
if ARGV.include?('osx')
|
|
660
|
-
puts 'building osx'
|
|
661
|
-
wasi_file = 'wasi-vfs-osx_arm'
|
|
662
|
-
wasm_common(source, destination, project_name, wasi_file, :tauri)
|
|
663
|
-
build_for_osx(destination)
|
|
664
|
-
end
|
|
665
707
|
|
|
666
|
-
puts 'building Android' if ARGV.include?('android')
|
|
708
|
+
puts 'building Android' if ARGV.include?('android')
|
|
667
709
|
|
|
668
|
-
puts 'building iOS' if ARGV.include?('ios')
|
|
669
|
-
puts 'building Windows' if ARGV.include?('windows')
|
|
670
|
-
puts 'building Linux' if ARGV.include?('linux')
|
|
671
|
-
puts 'building Freebsd' if ARGV.include?('freebsd')
|
|
672
|
-
|
|
673
|
-
if ARGV.include?('sparkle')
|
|
674
|
-
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
|
|
675
|
-
temp_dir = 'C:\Windows\Temp'
|
|
676
|
-
# code to exec with Windows
|
|
677
|
-
elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
|
|
678
|
-
temp_dir = '/tmp'
|
|
679
|
-
# code to exec with MacOS
|
|
680
|
-
else
|
|
681
|
-
temp_dir = '/tmp'
|
|
682
|
-
# code to exec with Unix/Linux
|
|
683
|
-
end
|
|
684
|
-
unless Dir.exist?("#{temp_dir}/atome_app")
|
|
685
|
-
# `cd #{temp_dir}; atome create atome_app;cd atome_app;atome run opal`
|
|
686
|
-
`cd #{temp_dir}; atome create atome_app`
|
|
687
|
-
end
|
|
688
|
-
|
|
689
|
-
project_name = ARGV[1]
|
|
690
|
-
project_name = ensure_rb_extension(project_name)
|
|
691
|
-
base_folder = File.dirname(project_name)
|
|
692
|
-
|
|
693
|
-
copy_with_requires(project_name, "#{temp_dir}/atome_app/application", base_folder)
|
|
694
|
-
`cd #{temp_dir}/atome_app;atome run opal`
|
|
710
|
+
puts 'building iOS' if ARGV.include?('ios')
|
|
711
|
+
puts 'building Windows' if ARGV.include?('windows')
|
|
712
|
+
puts 'building Linux' if ARGV.include?('linux')
|
|
713
|
+
puts 'building Freebsd' if ARGV.include?('freebsd')
|
|
695
714
|
|
|
696
715
|
end
|
data/lib/atome/atome.rb
CHANGED
|
@@ -5,6 +5,9 @@ class Atome
|
|
|
5
5
|
include Essentials
|
|
6
6
|
|
|
7
7
|
def initialize(new_atome = {}, &atomes_proc)
|
|
8
|
+
# TODO: atome format should always be as followed : {value: 0.44, unit: :px, opt1: 554}
|
|
9
|
+
# when using optimised version of atome you must type eg : a.set({left: {value: 33, unit: '%', reference: :center}})
|
|
10
|
+
|
|
8
11
|
# the keys :renderers, :type and :id should be placed in the first position in the hash
|
|
9
12
|
@history = {}
|
|
10
13
|
@callback = {}
|
|
@@ -165,5 +165,185 @@ class Object
|
|
|
165
165
|
end
|
|
166
166
|
atome_get
|
|
167
167
|
end
|
|
168
|
+
# shortcut
|
|
169
|
+
|
|
170
|
+
# we initialise $current_hovered_element
|
|
171
|
+
$current_hovered_element = nil
|
|
172
|
+
|
|
173
|
+
def shortcut(key:, option: nil, affect: :all, exclude: [], &block)
|
|
174
|
+
element_ids = (Array(affect) + Array(exclude)).uniq
|
|
175
|
+
|
|
176
|
+
element_ids.each do |element_id|
|
|
177
|
+
element = JS.global[:document].querySelector("##{element_id}")
|
|
178
|
+
if element
|
|
179
|
+
element.addEventListener("mouseenter") { $current_hovered_element = element_id }
|
|
180
|
+
element.addEventListener("mouseleave") { $current_hovered_element = nil }
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
JS.global[:document].addEventListener("keydown") do |native_event|
|
|
185
|
+
event = Native(native_event)
|
|
186
|
+
key_pressed = event[:key].downcase
|
|
187
|
+
ctrl_pressed = event[:ctrlKey]
|
|
188
|
+
alt_pressed = event[:altKey]
|
|
189
|
+
meta_pressed = event[:metaKey]
|
|
190
|
+
|
|
191
|
+
modifier_matched = case option
|
|
192
|
+
when :ctrl then ctrl_pressed
|
|
193
|
+
when :alt then alt_pressed
|
|
194
|
+
when :meta then meta_pressed
|
|
195
|
+
else true
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
affect_condition = affect == :all || Array(affect).include?($current_hovered_element)
|
|
199
|
+
exclude_condition = !Array(exclude).include?($current_hovered_element)
|
|
200
|
+
if $current_hovered_element.nil?
|
|
201
|
+
$current_hovered_element=:view
|
|
202
|
+
end
|
|
203
|
+
if key_pressed == key.to_s.downcase && modifier_matched && affect_condition && exclude_condition
|
|
204
|
+
block.call(key_pressed, $current_hovered_element)
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
def console(debug)
|
|
210
|
+
if debug
|
|
211
|
+
console=box({id: :console, width: :auto, height:225, bottom: 0,top: :auto, left: 0,right: 0,depth: 30, color: {alpha: 0, red: 0.1, green: 0.3 , blue:0.3}})
|
|
212
|
+
console_back=console.box({id: :console_back,blur: { value: 10, affect: :back}, overflow: :auto, width: :auto, height: :auto, top: 25, bottom: 0,left: 0,right: 0, depth: 30, color: {alpha: 0.3, red: 1, green: 1 , blue: 1}})
|
|
213
|
+
console_top=console.box({id: :console_top,overflow: :auto, width: :auto, height:25, top: 0, bottom: 0,left: 0,right: 0, depth: 30, color: {alpha: 1, red: 0.3, green: 0.3 , blue: 0.3}})
|
|
214
|
+
|
|
215
|
+
console_top.touch(:double) do
|
|
216
|
+
console.height(25)
|
|
217
|
+
console.bottom(0)
|
|
218
|
+
console.top(:auto)
|
|
219
|
+
end
|
|
220
|
+
console_top.shadow({
|
|
221
|
+
id: :s1,
|
|
222
|
+
# affect: [:the_circle],
|
|
223
|
+
left: 0, top: 3, blur: 9,
|
|
224
|
+
invert: false,
|
|
225
|
+
red: 0, green: 0, blue: 0, alpha: 1
|
|
226
|
+
})
|
|
227
|
+
console.drag(:locked) do |event|
|
|
228
|
+
dy = event[:dy]
|
|
229
|
+
y = console.to_px(:top)+dy.to_f
|
|
230
|
+
console.top(y)
|
|
231
|
+
console.height(:auto)
|
|
232
|
+
total_height=grab(:view).to_px(:height)
|
|
233
|
+
# console_back.height(total_height-console.top)
|
|
234
|
+
end
|
|
235
|
+
console_output=console_back.text({data: '', id: :console_output, component: {size: 12}})
|
|
236
|
+
JS.eval <<~JS
|
|
237
|
+
(function() {
|
|
238
|
+
var oldLog = console.log;
|
|
239
|
+
var consoleDiv = document.getElementById("console_output");
|
|
240
|
+
console.log = function(message) {
|
|
241
|
+
if (consoleDiv) {
|
|
242
|
+
consoleDiv.innerHTML += '<p>' + message + '</p>';
|
|
243
|
+
}
|
|
244
|
+
oldLog.apply(console, arguments);
|
|
245
|
+
};
|
|
246
|
+
}());
|
|
247
|
+
JS
|
|
248
|
+
|
|
249
|
+
console_clear=console_top.circle({id: :console_clear, color: :red, top: 3, left: 3, width: 19, height:19})
|
|
250
|
+
console_clear.touch(true) do
|
|
251
|
+
console_output.data("")
|
|
252
|
+
end
|
|
253
|
+
JS.global[:document].addEventListener("contextmenu") do |event|
|
|
254
|
+
end
|
|
255
|
+
# element[:style][:WebkitUserSelect] = 'none'
|
|
256
|
+
# element[:style][:MozUserSelect] = 'none'
|
|
257
|
+
else
|
|
258
|
+
grab(:console_back).delete(true)
|
|
259
|
+
JS.global[:document].addEventListener("contextmenu") do |native_event|
|
|
260
|
+
event = Native(native_event)
|
|
261
|
+
event.preventDefault
|
|
262
|
+
end
|
|
263
|
+
end
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
# import methode below
|
|
267
|
+
def importer_all(&proc)
|
|
268
|
+
JS.global[:document][:body].addEventListener('dragover') do |native_event|
|
|
269
|
+
event = Native(native_event)
|
|
270
|
+
event.preventDefault
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
JS.global[:document][:body].addEventListener('drop') do |native_event|
|
|
274
|
+
event = Native(native_event)
|
|
275
|
+
event.preventDefault
|
|
276
|
+
files = event[:dataTransfer][:files]
|
|
277
|
+
|
|
278
|
+
if files[:length].to_i > 0
|
|
279
|
+
(0...files[:length].to_i).each do |i|
|
|
280
|
+
file = files[i]
|
|
281
|
+
reader = JS.eval('let a= new FileReader(); return a')
|
|
282
|
+
reader.readAsText(file)
|
|
283
|
+
reader.addEventListener('load') do
|
|
284
|
+
proc.call({ content: reader[:result].to_s, name: file[:name].to_s, type: file[:type].to_s, size: file[:size].to_s })
|
|
285
|
+
end
|
|
286
|
+
reader.addEventListener('error') do
|
|
287
|
+
puts 'Error: ' + file[:name].to_s
|
|
288
|
+
end
|
|
289
|
+
end
|
|
290
|
+
end
|
|
291
|
+
end
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
def exception_import(atome_id, &proc)
|
|
295
|
+
if Universe.user_atomes.include?(atome_id.to_sym)
|
|
296
|
+
special_div = JS.global[:document].getElementById(atome_id)
|
|
297
|
+
special_div.addEventListener('dragover') do |native_event|
|
|
298
|
+
event = Native(native_event)
|
|
299
|
+
special_div[:style][:backgroundColor] = 'red'
|
|
300
|
+
event.preventDefault
|
|
301
|
+
event.stopPropagation
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
special_div.addEventListener('dragleave') do |native_event|
|
|
305
|
+
event = Native(native_event)
|
|
306
|
+
special_div[:style][:backgroundColor] = 'yellow'
|
|
307
|
+
event.stopPropagation
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
special_div.addEventListener('drop') do |native_event|
|
|
311
|
+
event = Native(native_event)
|
|
312
|
+
event.preventDefault
|
|
313
|
+
event.stopPropagation
|
|
314
|
+
|
|
315
|
+
files = event[:dataTransfer][:files]
|
|
316
|
+
|
|
317
|
+
if files[:length].to_i > 0
|
|
318
|
+
(0...files[:length].to_i).each do |i|
|
|
319
|
+
file = files[i]
|
|
320
|
+
reader = JS.eval('let a= new FileReader(); return a')
|
|
321
|
+
reader.readAsText(file)
|
|
322
|
+
reader.addEventListener('load') do
|
|
323
|
+
proc.call({ content: reader[:result].to_s, name: file[:name].to_s, type: file[:type].to_s, size: file[:size].to_s })
|
|
324
|
+
end
|
|
325
|
+
reader.addEventListener('error') do
|
|
326
|
+
puts 'Error: ' + file[:name].to_s
|
|
327
|
+
end
|
|
328
|
+
end
|
|
329
|
+
end
|
|
330
|
+
end
|
|
331
|
+
JS.global[:document][:body].addEventListener('drop') do |native_event|
|
|
332
|
+
event = Native(native_event)
|
|
333
|
+
event.preventDefault
|
|
334
|
+
event.stopPropagation
|
|
335
|
+
|
|
336
|
+
puts 'Fichier déposé hors de la zone spéciale'
|
|
337
|
+
end
|
|
338
|
+
end
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
def importer(target=:all,&proc)
|
|
342
|
+
if target== :all
|
|
343
|
+
importer_all(&proc)
|
|
344
|
+
else
|
|
345
|
+
exception_import(target,&proc)
|
|
346
|
+
end
|
|
347
|
+
end
|
|
168
348
|
|
|
169
349
|
end
|
|
@@ -6,6 +6,10 @@ new({ particle: :connection }) do |params, bloc|
|
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
new({ particle: :message }) do |params, bloc|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
|
|
10
|
+
params = {message: params } unless params.instance_of? Hash
|
|
11
|
+
params[:user]=Universe.current_user
|
|
12
|
+
params[:pass]=Black_matter.password
|
|
13
|
+
|
|
14
|
+
html.send_message(params, &bloc)
|
|
11
15
|
end
|
|
@@ -6,6 +6,8 @@ new ({ sanitizer: :password }) do |params|
|
|
|
6
6
|
params = { read: params, write: params } unless params.instance_of? Hash
|
|
7
7
|
|
|
8
8
|
# encoding below
|
|
9
|
+
params[:global] = Black_matter.encode(params[:global])
|
|
10
|
+
|
|
9
11
|
params[:read]&.each do |k, v|
|
|
10
12
|
params[:read][k] = Black_matter.encode(v)
|
|
11
13
|
end
|
|
@@ -25,7 +27,7 @@ end
|
|
|
25
27
|
|
|
26
28
|
new({ read: :password }) do |params|
|
|
27
29
|
params = Black_matter.password if params.nil?
|
|
28
|
-
params[:read][:atome]=Black_matter.password[:read][:atome] unless @authorisations[:write][:atome]
|
|
29
|
-
params[:write][:atome]=Black_matter.password[:write][:atome] unless @authorisations[:write][:atome]
|
|
30
|
+
params[:read][:atome] = Black_matter.password[:read][:atome] unless @authorisations[:write][:atome]
|
|
31
|
+
params[:write][:atome] = Black_matter.password[:write][:atome] unless @authorisations[:write][:atome]
|
|
30
32
|
params
|
|
31
33
|
end
|
|
@@ -79,7 +79,6 @@ Atome.new(
|
|
|
79
79
|
machine_id = :dummy_machine
|
|
80
80
|
# attention we must used two separate pass to avoid the password to be encode twice
|
|
81
81
|
machine_password = { read: { atome: :star_wars }, write: { atome: :star_wars } }
|
|
82
|
-
user_password = { read: { atome: :star_wars }, write: { atome: :star_wars } }
|
|
83
82
|
|
|
84
83
|
# copy basket
|
|
85
84
|
Atome.new({ renderers: [:html], id: :copy, collect: [], type: :group, tag: { system: true } })
|
|
@@ -90,6 +89,8 @@ Atome.new({ renderers: default_render, id: machine_id, type: :machine, password:
|
|
|
90
89
|
name: :macAir, data: { date: '10090717' }, tag: { system: true } })
|
|
91
90
|
|
|
92
91
|
#user
|
|
92
|
+
user_password = {global: :star_win, read: { atome: :star_wars }, write: { atome: :star_wars } }
|
|
93
|
+
|
|
93
94
|
human({ id: :anonymous, login: true, password: user_password, data: { birthday: '10/05/1996' },selection: [], tag: { system: true } , attach: :user_view })
|
|
94
95
|
|
|
95
96
|
Universe.current_machine = machine_id
|
|
@@ -115,4 +116,4 @@ def atome_infos
|
|
|
115
116
|
puts "server: #{server}"
|
|
116
117
|
end
|
|
117
118
|
|
|
118
|
-
atome_infos
|
|
119
|
+
# atome_infos
|
data/lib/atome/version.rb
CHANGED
|
@@ -21,6 +21,10 @@ new({ renderer: :html, method: :smooth, type: :string }) do |value, _user_proc|
|
|
|
21
21
|
html.style('border-radius', format_params)
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
new({ renderer: :html, method: :blur, type: :integer }) do |
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
new({ renderer: :html, method: :blur, type: :integer }) do |params, _user_proc|
|
|
25
|
+
if params[:affect] == :back
|
|
26
|
+
html.backdropFilter(:blur, "#{params[:value]}px")
|
|
27
|
+
else
|
|
28
|
+
html.filter(:blur, "#{params[:value]}px")
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -18,7 +18,7 @@ new({ renderer: :html, method: :apply, type: :string }) do |parent_found, _user_
|
|
|
18
18
|
alpha = shadow_found.alpha
|
|
19
19
|
left = shadow_found.left
|
|
20
20
|
top = shadow_found.top
|
|
21
|
-
blur = shadow_found.blur
|
|
21
|
+
blur = shadow_found.blur[:value] # new correct behavior all atome's value should now be get using :value,here to resolve conflict with blur and back blur
|
|
22
22
|
inset = :inset if shadow_found.invert
|
|
23
23
|
if shadow_found.option == :natural
|
|
24
24
|
shadows_to_apply[:filter] << "drop-shadow(#{left}px #{top}px #{blur}px rgba(#{red}, #{green}, #{blue}, #{alpha}))"
|
data/lib/renderers/html/html.rb
CHANGED
|
@@ -465,6 +465,11 @@ class HTML
|
|
|
465
465
|
@element[:style][:filter] = filter_needed
|
|
466
466
|
end
|
|
467
467
|
|
|
468
|
+
def backdropFilter(property, value)
|
|
469
|
+
filter_needed = "#{property}(#{value})"
|
|
470
|
+
@element[:style][:"-webkit-backdrop-filter"] = filter_needed
|
|
471
|
+
end
|
|
472
|
+
|
|
468
473
|
def currentTime(time)
|
|
469
474
|
@element[:currentTime] = time
|
|
470
475
|
end
|
|
@@ -22,3 +22,17 @@ new({ renderer: :html, method: :edit }) do |params|
|
|
|
22
22
|
html.attr(:contenteditable, params)
|
|
23
23
|
html.update_data(params)
|
|
24
24
|
end
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
new({ method: :border, type: :hash, renderer: :html }) do |value, _user_proc|
|
|
28
|
+
thickness = value[:thickness] || 5
|
|
29
|
+
type = value[:pattern] || :solid
|
|
30
|
+
color = if value[:color]
|
|
31
|
+
color_found = value[:color]
|
|
32
|
+
"#{color_found.red * 255},#{color_found.green * 255},#{color_found.blue * 255},#{color_found.alpha} "
|
|
33
|
+
else
|
|
34
|
+
"0,0,0,1"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
html.style(:border, "#{type} #{thickness}px rgba(#{color})")
|
|
38
|
+
end
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
new({ method: :top, type: :integer, renderer: :html }) do |params|
|
|
4
|
-
|
|
4
|
+
# TODO: replace px with the unit specified by the user or sepcified by default by the system
|
|
5
|
+
params="#{params}px" unless params.instance_of?(Symbol)
|
|
6
|
+
html.style(:top, params)
|
|
7
|
+
|
|
5
8
|
end
|
|
6
9
|
|
|
7
10
|
new({ method: :top, type: :integer, renderer: :html, specific: :text }) do |params|
|
|
@@ -10,19 +13,25 @@ end
|
|
|
10
13
|
new({ method: :top, type: :integer, renderer: :html, specific: :shadow })
|
|
11
14
|
|
|
12
15
|
new({ method: :bottom, type: :integer, renderer: :html }) do |params|
|
|
13
|
-
|
|
16
|
+
# TODO: replace px with the unit specified by the user or sepcified by default by the system
|
|
17
|
+
params="#{params}px" unless params.instance_of?(Symbol)
|
|
18
|
+
html.style(:bottom, params)
|
|
14
19
|
end
|
|
15
20
|
|
|
16
21
|
new({ method: :bottom, type: :integer, renderer: :html, specific: :text }) do |params|
|
|
17
|
-
html.style(:bottom,
|
|
22
|
+
html.style(:bottom, params)
|
|
18
23
|
end
|
|
19
24
|
|
|
20
25
|
new({ method: :right, type: :integer, renderer: :html }) do |params|
|
|
21
|
-
|
|
26
|
+
# TODO: replace px with the unit specified by the user or sepcified by default by the system
|
|
27
|
+
params="#{params}px" unless params.instance_of?(Symbol)
|
|
28
|
+
html.style(:right, params)
|
|
22
29
|
end
|
|
23
30
|
|
|
24
31
|
new({ method: :left, type: :integer, renderer: :html }) do |params|
|
|
25
|
-
|
|
32
|
+
# TODO: replace px with the unit specified by the user or sepcified by default by the system
|
|
33
|
+
params="#{params}px" unless params.instance_of?(Symbol)
|
|
34
|
+
html.style(:left, params)
|
|
26
35
|
end
|
|
27
36
|
|
|
28
37
|
new({ method: :left, type: :integer, specific: :color, renderer: :html })
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$current_hovered_element: untyped
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
support = box({ top: 250, left: 12, width: 300, height: 40, smooth: 9, color: { red: 0.3, green: 0.3, blue: 0.3 }, id: :support })
|
|
4
|
+
|
|
5
|
+
support.shadow({
|
|
6
|
+
id: :s3,
|
|
7
|
+
left: 3, top: 3, blur: 9,
|
|
8
|
+
invert: true,
|
|
9
|
+
red: 0, green: 0, blue: 0, alpha: 0.7
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
box({ id: :the_boxy })
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
support.import(true) do |content|
|
|
19
|
+
puts "add code here, content: #{content}"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
importer do |val|
|
|
24
|
+
alert "case 21 #{val}"
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# importer(:all) do |val|
|
|
28
|
+
# alert "case 21 #{val}"
|
|
29
|
+
# end
|
|
30
|
+
|
|
31
|
+
importer('the_boxy') do |val|
|
|
32
|
+
alert "yes !!! exception found : #{val}"
|
|
33
|
+
end
|
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
#
|
|
3
|
-
b = box({ color: :red })
|
|
4
2
|
|
|
3
|
+
user_password = {global: :all_star, read: { atome: :all_star }, write: { atome: :all_star } }
|
|
4
|
+
|
|
5
|
+
human({ id: :jeezs, login: true, password: user_password, data: { birthday: '10/05/2016' },selection: [], tag: { system: true } , attach: :user_view })
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
b = box({ color: :red, id: :my_box })
|
|
10
|
+
b.connection('localhost:9292') do |params|
|
|
11
|
+
alert " the connection is : #{params}"
|
|
12
|
+
end
|
|
5
13
|
b.touch(true) do
|
|
6
14
|
b.connection('localhost:9292') do |params|
|
|
7
15
|
alert " the connection is : #{params}"
|
|
8
16
|
end
|
|
9
17
|
end
|
|
10
18
|
|
|
19
|
+
|
|
11
20
|
c = box({ color: :yellow, left: 333 })
|
|
12
21
|
|
|
13
22
|
c.touch(true) do
|
|
14
|
-
b.message('
|
|
23
|
+
b.message({message: 'cd ..;cd server;ls; pwd', action: :terminal })
|
|
24
|
+
b.message({message: 'capture.rb', action: :file, option: :read })
|
|
25
|
+
b.message({message: 'tototo.rb', action: :file, option: :write, value: :hello })
|
|
26
|
+
# b.message({message: 'cd ..;cd server;ls; pwd'})
|
|
15
27
|
# c = box({ color: :red, left: 333 })
|
|
16
|
-
end
|
|
28
|
+
end
|
|
29
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
box({id: :my_box})
|
|
5
|
+
circle({id: :my_circle, left: 333})
|
|
6
|
+
box({id: :red_box, left: 666, color: :red})
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
shortcut(key: :b, affect: :all) do |key, object_id|
|
|
11
|
+
puts "Key #{key} press on #{object_id}"
|
|
12
|
+
end
|
|
13
|
+
text({data: "Key 'b' on :all", top: 0})
|
|
14
|
+
|
|
15
|
+
shortcut(key: :t, option: :meta,affect: [:my_circle, :red_box]) do |key, object_id|
|
|
16
|
+
puts "Key #{key} press on #{object_id}"
|
|
17
|
+
end
|
|
18
|
+
text({data: "Key 't' with Meta on [:my_circle, :red_box]", top: 30, left: 0, position: :absolute})
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
shortcut(key: :j, option: :ctrl, affect: :all, exclude: [:my_circle, :my_box]) do |key, object_id|
|
|
22
|
+
puts "Key #{key} with Ctrl press on #{object_id}"
|
|
23
|
+
end
|
|
24
|
+
text({data: "Key 'j' with Ctrl on :all but [:my_circle, :my_box]", top: 50,left: 0, position: :absolute})
|
|
25
|
+
|
|
@@ -138,6 +138,7 @@ cursor.drag({ restrict: {max:{ left: 309, top: 0}} }) do |event|
|
|
|
138
138
|
|
|
139
139
|
end
|
|
140
140
|
|
|
141
|
+
# new({ particle: :import })
|
|
141
142
|
|
|
142
143
|
support=box({top: 250, left: 12, width: 300, height: 40, smooth: 9, color:{red: 0.3, green: 0.3, blue: 0.3}, id: :support })
|
|
143
144
|
|
|
@@ -147,6 +148,8 @@ support.shadow({
|
|
|
147
148
|
invert: true,
|
|
148
149
|
red: 0, green: 0, blue: 0, alpha: 0.7
|
|
149
150
|
})
|
|
151
|
+
|
|
152
|
+
# support.duplicate
|
|
150
153
|
support.import(true) do |content|
|
|
151
154
|
puts "add code here, content: #{content}"
|
|
152
155
|
end
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# atome server
|
|
4
4
|
require 'em/pure_ruby' if RUBY_PLATFORM == 'x64-mingw32'
|
|
5
|
+
require 'fileutils'
|
|
5
6
|
require '../src/utilities/aui'
|
|
6
7
|
require 'digest/sha2'
|
|
7
8
|
require 'faye/websocket'
|
|
@@ -14,7 +15,30 @@ require 'rufus-scheduler'
|
|
|
14
15
|
require 'securerandom'
|
|
15
16
|
require 'sequel'
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
class EDen
|
|
19
|
+
def self.terminal(cmd,option,ws,value, user, pass)
|
|
20
|
+
`#{cmd}`
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def self.file(source, operation,ws,value,user, pass)
|
|
24
|
+
file_content= File.send(operation, source, value).to_s
|
|
25
|
+
file_content = file_content.gsub("'", "\"")
|
|
26
|
+
"=> operation: #{operation}, source: #{source} , content : #{file_content},"
|
|
27
|
+
end
|
|
28
|
+
# return_message = EDen.safe_send(action_requested, message,option, current_user, user_pass)
|
|
29
|
+
|
|
30
|
+
def self.safe_send(method_name, *args)
|
|
31
|
+
method_sym = method_name.to_sym
|
|
32
|
+
eden_methods = EDen.singleton_methods(false) - Object.singleton_methods
|
|
33
|
+
if eden_methods.include?(method_sym)
|
|
34
|
+
send(method_sym, *args)
|
|
35
|
+
else
|
|
36
|
+
"forbidden action: #{method_name}"
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
Faye::WebSocket.load_adapter('puma')
|
|
18
42
|
|
|
19
43
|
class String
|
|
20
44
|
def is_json?
|
|
@@ -65,6 +89,7 @@ class Database
|
|
|
65
89
|
end
|
|
66
90
|
|
|
67
91
|
class App < Roda
|
|
92
|
+
|
|
68
93
|
# comment below when test will be done
|
|
69
94
|
File.delete("./eden.sqlite3") if File.exist?("./eden.sqlite3")
|
|
70
95
|
eden = Database.connect_database
|
|
@@ -74,11 +99,8 @@ class App < Roda
|
|
|
74
99
|
items.insert(name: 'abc', width: rand * 100)
|
|
75
100
|
items.insert(name: 'def', width: rand * 100)
|
|
76
101
|
items.insert(name: 'ghi', width: rand * 100)
|
|
77
|
-
|
|
78
102
|
puts "Item count: #{items.count}"
|
|
79
|
-
|
|
80
103
|
puts "The average price is: #{items.avg(:width)}"
|
|
81
|
-
|
|
82
104
|
index_content = File.read("../src/index_server.html")
|
|
83
105
|
|
|
84
106
|
opts[:root] = '../src'
|
|
@@ -87,15 +109,26 @@ class App < Roda
|
|
|
87
109
|
r.root do
|
|
88
110
|
if Faye::WebSocket.websocket?(r.env)
|
|
89
111
|
ws = Faye::WebSocket.new(r.env)
|
|
90
|
-
|
|
91
112
|
ws.on :open do |event|
|
|
92
113
|
ws.send('server ready'.to_json)
|
|
93
114
|
ws.send('asking for synchro data'.to_json)
|
|
94
115
|
end
|
|
95
116
|
|
|
96
117
|
ws.on(:message) do |event|
|
|
97
|
-
|
|
98
|
-
|
|
118
|
+
json_string = event.data.gsub(/(\w+):/) { "\"#{$1}\":" }.gsub('=>', ':')
|
|
119
|
+
full_data = JSON.parse(json_string)
|
|
120
|
+
message = full_data['message']
|
|
121
|
+
action_requested = full_data['action']
|
|
122
|
+
value= full_data['value']
|
|
123
|
+
option= full_data['option']
|
|
124
|
+
current_user = full_data['user']
|
|
125
|
+
user_pass = full_data['pass']['global']
|
|
126
|
+
if action_requested
|
|
127
|
+
return_message = EDen.safe_send(action_requested, message,option,ws,value, current_user, user_pass)
|
|
128
|
+
else
|
|
129
|
+
return_message = "no action msg: #{full_data}"
|
|
130
|
+
end
|
|
131
|
+
ws.send(return_message.to_json)
|
|
99
132
|
end
|
|
100
133
|
|
|
101
134
|
ws.on(:close) do |event|
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
<script type="text/javascript" src="js/third_parties/papaparse.min.js" defer></script>
|
|
21
21
|
<script defer src="js/atome/atome_helpers/communication.js" type="text/javascript"></script>
|
|
22
22
|
<script defer src="js/atome/atome_helpers/file.js" type="text/javascript"></script>
|
|
23
|
-
<script
|
|
24
|
-
// to prevent right click
|
|
25
|
-
document.addEventListener("contextmenu", function (e) {
|
|
26
|
-
e.preventDefault()
|
|
27
|
-
})
|
|
28
|
-
</script
|
|
23
|
+
<!-- <script>-->
|
|
24
|
+
<!-- // to prevent right click-->
|
|
25
|
+
<!-- document.addEventListener("contextmenu", function (e) {-->
|
|
26
|
+
<!-- e.preventDefault();-->
|
|
27
|
+
<!-- });-->
|
|
28
|
+
<!-- </script>-->
|
|
29
29
|
<title>atome</title>
|
|
30
30
|
</head>
|
|
31
31
|
<body id='user_view' class='atome'>
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
require '/lib/atome_relative'
|
|
41
41
|
require './index'
|
|
42
42
|
#puts Universe.host
|
|
43
|
+
atome_infos
|
|
43
44
|
</script>
|
|
44
45
|
<script defer src="js/atome/specific/wasm.js" type="text/javascript"></script>
|
|
45
46
|
<script defer src="js/atome/atome.js" type="text/javascript"></script>
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
<script src='js/atome/kernel.js' defer></script>
|
|
26
26
|
<script defer src="js/atome/atome_helpers/communication.js" type="text/javascript"></script>
|
|
27
27
|
<script defer src="js/atome/atome_helpers/file.js" type="text/javascript"></script>
|
|
28
|
-
<script
|
|
29
|
-
// to prevent right click
|
|
30
|
-
document.addEventListener("contextmenu", function (e) {
|
|
31
|
-
e.preventDefault()
|
|
32
|
-
})
|
|
33
|
-
</script
|
|
28
|
+
<!-- <script>-->
|
|
29
|
+
<!-- // to prevent right click-->
|
|
30
|
+
<!-- document.addEventListener("contextmenu", function (e) {-->
|
|
31
|
+
<!-- e.preventDefault();-->
|
|
32
|
+
<!-- });-->
|
|
33
|
+
<!-- </script>-->
|
|
34
34
|
<title>atome</title>
|
|
35
35
|
</head>
|
|
36
36
|
<body id='user_view' class='atome'>
|
|
@@ -39,4 +39,9 @@
|
|
|
39
39
|
<script defer src="js/atome/specific/opal.js" type="text/javascript"></script>
|
|
40
40
|
<script defer src="js/atome/atome.js" type="text/javascript"></script>
|
|
41
41
|
<script src='js/application.js' defer></script>
|
|
42
|
+
<script>
|
|
43
|
+
window.addEventListener('load', function () {
|
|
44
|
+
Opal.eval('atome_infos')
|
|
45
|
+
})
|
|
46
|
+
</script>
|
|
42
47
|
</html>
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
<script defer src='js/atome/kernel.js'></script>
|
|
26
26
|
<script defer src="js/atome/atome_helpers/communication.js" type="text/javascript"></script>
|
|
27
27
|
<script defer src="js/atome/atome_helpers/file.js" type="text/javascript"></script>
|
|
28
|
-
<script
|
|
29
|
-
// to prevent right click
|
|
30
|
-
document.addEventListener("contextmenu", function (e) {
|
|
31
|
-
e.preventDefault()
|
|
32
|
-
})
|
|
33
|
-
</script
|
|
28
|
+
<!-- <script>-->
|
|
29
|
+
<!-- // to prevent right click-->
|
|
30
|
+
<!-- document.addEventListener("contextmenu", function (e) {-->
|
|
31
|
+
<!-- e.preventDefault();-->
|
|
32
|
+
<!-- });-->
|
|
33
|
+
<!-- </script>-->
|
|
34
34
|
<title>atome</title>
|
|
35
35
|
</head>
|
|
36
36
|
<body id='user_view' class='atome'>
|
|
@@ -39,5 +39,9 @@
|
|
|
39
39
|
<script defer src="js/atome/specific/opal.js" type="text/javascript"></script>
|
|
40
40
|
<script defer src="js/atome/atome.js" type="text/javascript"></script>
|
|
41
41
|
<script defer src='js/application.js'></script>
|
|
42
|
-
|
|
42
|
+
<script>
|
|
43
|
+
window.addEventListener('load', function () {
|
|
44
|
+
Opal.eval('atome_infos')
|
|
45
|
+
})
|
|
46
|
+
</script>
|
|
43
47
|
</html>
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
<script type="text/javascript" src="js/third_parties/papaparse.min.js" defer></script>
|
|
21
21
|
<script defer src="js/atome/atome_helpers/communication.js" type="text/javascript"></script>
|
|
22
22
|
<script defer src="js/atome/atome_helpers/file.js" type="text/javascript"></script>
|
|
23
|
-
<script
|
|
24
|
-
// to prevent right click
|
|
25
|
-
document.addEventListener("contextmenu", function (e) {
|
|
26
|
-
e.preventDefault()
|
|
27
|
-
})
|
|
28
|
-
</script
|
|
23
|
+
<!-- <script>-->
|
|
24
|
+
<!-- // to prevent right click-->
|
|
25
|
+
<!-- document.addEventListener("contextmenu", function (e) {-->
|
|
26
|
+
<!-- e.preventDefault();-->
|
|
27
|
+
<!-- });-->
|
|
28
|
+
<!-- </script>-->
|
|
29
29
|
<title>atome</title>
|
|
30
30
|
</head>
|
|
31
31
|
<body id='user_view' class='atome'>
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
require '/lib/atome_relative'
|
|
41
41
|
require './index'
|
|
42
42
|
#puts Universe.host
|
|
43
|
+
atome_infos
|
|
43
44
|
</script>
|
|
44
45
|
<script defer src="js/atome/specific/wasm.js" type="text/javascript"></script>
|
|
45
46
|
<script defer src="js/atome/atome.js" type="text/javascript"></script>
|
|
@@ -218,98 +218,3 @@ function fileForOpal(parent, bloc) {
|
|
|
218
218
|
})
|
|
219
219
|
|
|
220
220
|
}
|
|
221
|
-
|
|
222
|
-
function importer(){
|
|
223
|
-
|
|
224
|
-
// Gestionnaire pour le drag and drop de fichiers
|
|
225
|
-
document.body.addEventListener('dragover', function(e) {
|
|
226
|
-
e.preventDefault(); // Nécessaire pour autoriser le drop
|
|
227
|
-
// Modifier le style si nécessaire
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
document.body.addEventListener('drop', function(e) {
|
|
231
|
-
e.preventDefault();
|
|
232
|
-
let files = e.dataTransfer.files; // Obtention de la liste des fichiers déposés
|
|
233
|
-
|
|
234
|
-
if (files.length) {
|
|
235
|
-
// Parcourir chaque fichier
|
|
236
|
-
for (let i = 0; i < files.length; i++) {
|
|
237
|
-
let file = files[i];
|
|
238
|
-
let reader = new FileReader();
|
|
239
|
-
|
|
240
|
-
// Lire le fichier en tant que texte
|
|
241
|
-
reader.readAsText(file);
|
|
242
|
-
|
|
243
|
-
// Événement déclenché une fois la lecture terminée
|
|
244
|
-
reader.onload = function() {
|
|
245
|
-
console.log('Contenu du fichier #' + (i + 1));
|
|
246
|
-
console.log('Nom: ' + file.name);
|
|
247
|
-
console.log('Type: ' + file.type);
|
|
248
|
-
console.log('Taille: ' + file.size + ' octets');
|
|
249
|
-
console.log('Contenu: \n' + reader.result); // Affichage du contenu du fichier
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
// Gestion des erreurs de lecture
|
|
253
|
-
reader.onerror = function() {
|
|
254
|
-
console.error('Erreur de lecture du fichier: ' + file.name);
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
// if (e.dataTransfer.files.length) {
|
|
259
|
-
// alert (e.dataTransfer.files);
|
|
260
|
-
// // Traiter les fichiers déposés
|
|
261
|
-
// }
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
// Gestionnaire pour les éléments div
|
|
265
|
-
var divs = document.querySelectorAll('.draggable-div');
|
|
266
|
-
divs.forEach(function(div) {
|
|
267
|
-
div.addEventListener('dragstart', function(e) {
|
|
268
|
-
e.dataTransfer.setData('text/plain', 'some-data');
|
|
269
|
-
e.stopPropagation(); // Empêcher la propagation au body
|
|
270
|
-
});
|
|
271
|
-
});
|
|
272
|
-
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
importer()
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
function exception_import (){
|
|
279
|
-
// Sélectionner la div spéciale par son ID
|
|
280
|
-
var specialDiv = document.getElementById('my_box');
|
|
281
|
-
|
|
282
|
-
// Gestionnaire d'événements pour la 'special-div' pour le drag over
|
|
283
|
-
specialDiv.addEventListener('dragover', function(e) {
|
|
284
|
-
|
|
285
|
-
specialDiv.style.backgroundColor= 'red';
|
|
286
|
-
e.preventDefault(); // Prévenir le comportement par défaut
|
|
287
|
-
e.stopPropagation(); // Arrêter la propagation de l'événement
|
|
288
|
-
});
|
|
289
|
-
specialDiv.addEventListener('dragleave', function(e) {
|
|
290
|
-
specialDiv.style.backgroundColor = 'yellow'; // Réinitialiser la couleur de fond lors du drag out
|
|
291
|
-
e.stopPropagation(); // Arrêter la propagation de l'événement
|
|
292
|
-
});
|
|
293
|
-
// Gestionnaire d'événements pour la 'special-div' pour le drop
|
|
294
|
-
specialDiv.addEventListener('drop', function(e) {
|
|
295
|
-
e.preventDefault(); // Prévenir le comportement par défaut
|
|
296
|
-
e.stopPropagation(); // Arrêter la propagation de l'événement
|
|
297
|
-
|
|
298
|
-
// Traitement spécifique pour les fichiers déposés sur la 'special-div'
|
|
299
|
-
console.log('Fichier déposé dans la zone spéciale');
|
|
300
|
-
});
|
|
301
|
-
|
|
302
|
-
// Gestionnaire d'événements pour le body pour le drop
|
|
303
|
-
document.body.addEventListener('drop', function(e) {
|
|
304
|
-
e.preventDefault(); // Prévenir le comportement par défaut
|
|
305
|
-
|
|
306
|
-
// Traitement pour les fichiers déposés en dehors de la 'special-div'
|
|
307
|
-
console.log('Fichier déposé hors de la zone spéciale');
|
|
308
|
-
});
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
}
|
|
312
|
-
setTimeout(function () {
|
|
313
|
-
exception_import();
|
|
314
|
-
console.log('ready');
|
|
315
|
-
}, 3000);
|
|
@@ -29,7 +29,7 @@ const communication = {
|
|
|
29
29
|
|
|
30
30
|
if (window.webkit) {
|
|
31
31
|
try {
|
|
32
|
-
window.webkit.messageHandlers.
|
|
32
|
+
window.webkit.messageHandlers.wkHandler.postMessage(json_msg);
|
|
33
33
|
} catch (error) {
|
|
34
34
|
console.log('no server, unable to post message')
|
|
35
35
|
}
|
|
@@ -86,8 +86,9 @@ const communication = {
|
|
|
86
86
|
};
|
|
87
87
|
|
|
88
88
|
},
|
|
89
|
-
ws_sender: function (
|
|
90
|
-
|
|
89
|
+
ws_sender: function (message) {
|
|
90
|
+
// now we send the data to the server
|
|
91
|
+
this.websocket.send(message)
|
|
91
92
|
},
|
|
92
93
|
}
|
|
93
94
|
|
|
@@ -120,7 +121,7 @@ function connect(address) {
|
|
|
120
121
|
|
|
121
122
|
}
|
|
122
123
|
|
|
123
|
-
function ws_sender() {
|
|
124
|
-
|
|
125
|
-
}
|
|
124
|
+
// function ws_sender() {
|
|
125
|
+
// websocket.send("the Hello, WebSocket!!!")
|
|
126
|
+
// }
|
|
126
127
|
|
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.5.
|
|
4
|
+
version: 0.5.5.8.1
|
|
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-01-
|
|
11
|
+
date: 2024-01-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: eventmachine
|
|
@@ -471,6 +471,7 @@ files:
|
|
|
471
471
|
- sig/browser_helper.rbs
|
|
472
472
|
- sig/essentials.rbs
|
|
473
473
|
- sig/genesis.rbs
|
|
474
|
+
- sig/global_variables.rbs
|
|
474
475
|
- sig/matrix.rbs
|
|
475
476
|
- sig/object.rbs
|
|
476
477
|
- sig/universe.rbs
|
|
@@ -486,6 +487,8 @@ files:
|
|
|
486
487
|
- vendor/assets/application/examples/attach.rb
|
|
487
488
|
- vendor/assets/application/examples/attached.rb
|
|
488
489
|
- vendor/assets/application/examples/basic_understanding.rb
|
|
490
|
+
- vendor/assets/application/examples/blur.rb
|
|
491
|
+
- vendor/assets/application/examples/border.rb
|
|
489
492
|
- vendor/assets/application/examples/browse.rb
|
|
490
493
|
- vendor/assets/application/examples/callback.rb
|
|
491
494
|
- vendor/assets/application/examples/category.rb
|
|
@@ -493,6 +496,7 @@ files:
|
|
|
493
496
|
- vendor/assets/application/examples/clones.rb
|
|
494
497
|
- vendor/assets/application/examples/code.rb
|
|
495
498
|
- vendor/assets/application/examples/color.rb
|
|
499
|
+
- vendor/assets/application/examples/console.rb
|
|
496
500
|
- vendor/assets/application/examples/convert.rb
|
|
497
501
|
- vendor/assets/application/examples/copy.rb
|
|
498
502
|
- vendor/assets/application/examples/copybck.rb
|
|
@@ -516,6 +520,7 @@ files:
|
|
|
516
520
|
- vendor/assets/application/examples/history.rb
|
|
517
521
|
- vendor/assets/application/examples/hypertext.rb
|
|
518
522
|
- vendor/assets/application/examples/image.rb
|
|
523
|
+
- vendor/assets/application/examples/import.rb
|
|
519
524
|
- vendor/assets/application/examples/keyboard.rb
|
|
520
525
|
- vendor/assets/application/examples/layout.rb
|
|
521
526
|
- vendor/assets/application/examples/login.rb
|
|
@@ -544,6 +549,7 @@ files:
|
|
|
544
549
|
- vendor/assets/application/examples/selected.rb
|
|
545
550
|
- vendor/assets/application/examples/shadow.rb
|
|
546
551
|
- vendor/assets/application/examples/shapes.rb
|
|
552
|
+
- vendor/assets/application/examples/shortcut.rb
|
|
547
553
|
- vendor/assets/application/examples/smooth.rb
|
|
548
554
|
- vendor/assets/application/examples/style.rb
|
|
549
555
|
- vendor/assets/application/examples/sync.rb
|