atome 0.5.5.6.5 → 0.5.5.6.7.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -63,8 +63,6 @@ async function changeCurrentDirectory(atome_id, newPath) {
63
63
  }
64
64
 
65
65
 
66
-
67
-
68
66
  // Terminal
69
67
 
70
68
  async function terminal(atome_id, cmd) {
@@ -152,29 +150,167 @@ function createSvgElement(tagName, attributes) {
152
150
  return elem;
153
151
  }
154
152
 
153
+ //
154
+ // function sanitizeString(str) {
155
+ // return str.replace(/'/g, "\\'");
156
+ // }
157
+ // function fileread(){
158
+ // var inputElement = document.createElement("input");
159
+ // inputElement.type = "file";
160
+ //
161
+ // inputElement.addEventListener("change", function(event) {
162
+ // var file = event.target.files[0];
163
+ // var reader = new FileReader();
164
+ //
165
+ // reader.onload = function(event) {
166
+ // var content = event.target.result;
167
+ // var sanitizedContent = sanitizeString(content);
168
+ // rubyVMCallback("input_callback('"+sanitizedContent+"')");
169
+ // };
170
+ //
171
+ // reader.readAsText(file);
172
+ // });
173
+ //
174
+ // // Ajout de l'élément input à la div
175
+ // var viewDiv = document.querySelector("#support");
176
+ // viewDiv.appendChild(inputElement);
177
+ // }
155
178
 
156
- function sanitizeString(str) {
157
- return str.replace(/'/g, "\\'");
158
- }
159
- function fileread(){
160
- var inputElement = document.createElement("input");
161
- inputElement.type = "file";
162
-
163
- inputElement.addEventListener("change", function(event) {
164
- var file = event.target.files[0];
165
- var reader = new FileReader();
166
-
167
- reader.onload = function(event) {
168
- var content = event.target.result;
169
- var sanitizedContent = sanitizeString(content);
170
- rubyVMCallback("input_callback('"+sanitizedContent+"')");
179
+
180
+ function fileForOpal(parent, bloc) {
181
+ let input = document.createElement('input');
182
+ input.type = 'file';
183
+ input.style.position = "absolute";
184
+ input.style.display = "none";
185
+ input.style.width = "0px";
186
+ input.style.height = "0px";
187
+ input.addEventListener('change', function (event) {
188
+ let file = event.target.files[0];
189
+ let reader = new FileReader();
190
+
191
+ reader.onloadstart = function () {
192
+ console.log("Load start");
193
+ };
194
+
195
+ reader.onprogress = function (e) {
196
+ console.log("Loading: " + (e.loaded / e.total * 100) + '%');
197
+ };
198
+
199
+ reader.onload = function (e) {
200
+ var content = e.target.result;
201
+ Opal.Atome.$file_handler(parent, content, bloc)
202
+ };
203
+
204
+ reader.onloadend = function () {
205
+ console.log("Load end");
206
+ };
207
+
208
+ reader.onerror = function () {
209
+ console.error("Error reading file");
171
210
  };
172
211
 
173
212
  reader.readAsText(file);
174
213
  });
214
+ let div_element = document.getElementById(parent);
215
+ div_element.appendChild(input);
216
+ div_element.addEventListener('mousedown', function (event) {
217
+ input.click()
218
+ })
175
219
 
176
- // Ajout de l'élément input à la div
177
- var viewDiv = document.querySelector("#support");
178
- viewDiv.appendChild(inputElement);
179
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('exept');
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);
180
316
 
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.6.5
4
+ version: 0.5.5.6.7.9
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: 2023-12-15 00:00:00.000000000 Z
11
+ date: 2023-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: arduino_firmata
@@ -318,20 +318,6 @@ dependencies:
318
318
  - - "~>"
319
319
  - !ruby/object:Gem::Version
320
320
  version: '0.1'
321
- - !ruby/object:Gem::Dependency
322
- name: webrick
323
- requirement: !ruby/object:Gem::Requirement
324
- requirements:
325
- - - "~>"
326
- - !ruby/object:Gem::Version
327
- version: 1.7.0
328
- type: :runtime
329
- prerelease: false
330
- version_requirements: !ruby/object:Gem::Requirement
331
- requirements:
332
- - - "~>"
333
- - !ruby/object:Gem::Version
334
- version: 1.7.0
335
321
  description: the creative framework.
336
322
  email:
337
323
  - jeezs@atopme.one
@@ -346,7 +332,7 @@ files:
346
332
  - LICENSE.txt
347
333
  - README.md
348
334
  - Rakefile
349
- - app_builder_helpers/Rakefile
335
+ - atome.gemspec
350
336
  - documentation/atome.md
351
337
  - documentation/basic.md
352
338
  - documentation/database.JPG
@@ -729,7 +715,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
729
715
  - !ruby/object:Gem::Version
730
716
  version: '0'
731
717
  requirements: []
732
- rubygems_version: 3.4.20
718
+ rubygems_version: 3.4.22
733
719
  signing_key:
734
720
  specification_version: 4
735
721
  summary: the creative framework
@@ -1,278 +0,0 @@
1
- # # frozen_string_literal: true
2
- #
3
- # # FIXME: check when creating gem version the new gem is not always fully updated we have to type gem uninstall first
4
- #
5
- # require 'opal'
6
- # require 'parser'
7
- # require 'uglifier'
8
- #
9
- #
10
- # Opal.append_path 'app'
11
- #
12
- # # def build_opal_content
13
- # # Opal::Builder.build('../lib/platform_specific/opal/opal.rb').to_s
14
- # # end
15
- # #
16
- # # def build_opal(user_project_path)
17
- # #
18
- # # opal_directory = "#{user_project_path}/src/js/opal"
19
- # # opal_js = "#{opal_directory}/opal.js"
20
- # # Dir.mkdir(opal_directory) unless File.directory?(opal_directory)
21
- # #
22
- # # File.new opal_js, 'w'
23
- # # opal_content = build_opal_content
24
- # # File.open(opal_js, 'w') do |f|
25
- # # f.puts opal_content
26
- # # end
27
- # # end
28
- #
29
- # # def build_aui_for_opal(user_project_path)
30
- # # # now we add an uniq aui to the app
31
- # # aui_js = "#{user_project_path}/src/js/aui.js"
32
- # # File.new aui_js, 'w'
33
- # # builder = Opal::Builder.new
34
- # # aui_content = builder.build("#{user_project_path}/src/utilities/aui.rb").to_s
35
- # # File.open(aui_js, 'w') do |f|
36
- # # f.puts aui_content
37
- # # end
38
- # # end
39
- #
40
- # # def build_host_mode_for_opal(user_project_path)
41
- # # host_mode_js = "#{user_project_path}/src/js/host_mode.js"
42
- # # File.new host_mode_js, 'w'
43
- # # builder = Opal::Builder.new
44
- # # host_mode_content = builder.build("#{user_project_path}/src/utilities/host_mode.rb").to_s
45
- # # File.open(host_mode_js, 'w') do |f|
46
- # # f.puts host_mode_content
47
- # # end
48
- # # end
49
- #
50
- # # def copy_assets_files(user_project_path, gem_location)
51
- # # server_location = "#{gem_location}/../vendor/assets/server/"
52
- # # FileUtils.copy_entry server_location, "#{user_project_path}/server", preserve: nil
53
- # # css_location ="#{gem_location}/../vendor/assets/src/css/"
54
- # # FileUtils.copy_entry css_location, "#{user_project_path}/src/css", preserve: nil
55
- # # js_location ="#{gem_location}/../vendor/assets/src/js/"
56
- # # FileUtils.copy_entry js_location, "#{user_project_path}/src/js", preserve: nil
57
- # # index_location ="#{gem_location}/../vendor/assets/src/index.html"
58
- # # FileUtils.copy_entry index_location, "#{user_project_path}/src/index.html", preserve: nil
59
- # # end
60
- #
61
- # # def build_atome_kernel(user_project_path, gem_location)
62
- # # # now lets build the atome kernel
63
- # # atome_directory = "#{user_project_path}/src/js/atome"
64
- # # Dir.mkdir(atome_directory) unless File.directory?(atome_directory)
65
- # # kernel_js = "#{atome_directory}/kernel.js"
66
- # # File.new kernel_js, 'w'
67
- # # builder = Opal::Builder.new
68
- # # builder.append_paths("#{gem_location}/../lib/")
69
- # # kernel_content = builder.build("#{gem_location}/../lib/atome.rb").to_s
70
- # # File.open(kernel_js, 'w') do |f|
71
- # # f.puts kernel_content
72
- # # end
73
- # # end
74
- #
75
- # def build_opal_extensions(user_project_path, gem_location)
76
- # opal_directory = "#{user_project_path}/src/js/opal"
77
- # extensions_js = "#{opal_directory}/atome_opal_extensions.js"
78
- # File.new extensions_js, 'w'
79
- # builder = Opal::Builder.new
80
- # builder.append_paths("#{gem_location}/../lib/platform_specific/opal/")
81
- # extensions_content = builder.build("#{gem_location}/../lib/platform_specific/opal/atome_opal_extensions.rb").to_s
82
- # File.open(extensions_js, 'w') do |f|
83
- # f.puts extensions_content
84
- # end
85
- # end
86
- #
87
- # # def build_opal_parser(user_project_path)
88
- # # parser_js = "#{user_project_path}/src/js/opal/opal_parser.js"
89
- # # File.new parser_js, 'w'
90
- # # parser_content = Opal::Builder.build('../lib/platform_specific/opal/opal_parser.rb').to_s
91
- # # File.open(parser_js, 'w') do |f|
92
- # # f.puts parser_content
93
- # # end
94
- # # end
95
- #
96
- # def modify_and_copy_file(source_path, destination_path,source_code)
97
- # file_content = File.read(source_path)
98
- # modified_content = file_content.gsub(' ', ' ').gsub(' ', ' ').gsub(' ', ' ').gsub(' ', ' ').gsub("require './", "require 'tmp/opal/").gsub('require "./', 'require "tmp/opal/')
99
- # File.write(destination_path, modified_content)
100
- #
101
- # end
102
- # def process_directory(source_dir, destination_dir, source_code)
103
- # Dir.entries(source_dir).each do |entry|
104
- # next if entry == '.' || entry == '..'
105
- #
106
- # source_path = File.join(source_dir, entry)
107
- # destination_path = File.join(destination_dir, entry)
108
- #
109
- # if File.directory?(source_path)
110
- # Dir.mkdir(destination_path) unless Dir.exist?(destination_path)
111
- # process_directory(source_path, destination_path,source_code)
112
- # elsif File.file?(source_path)
113
- # modify_and_copy_file(source_path, destination_path,source_code)
114
- # end
115
- # end
116
- # end
117
- # def build_user_code(user_project_path, source_code)
118
- # application_js = "#{user_project_path}/src/js/application.js"
119
- # builder = Opal::Builder.new
120
- # builder.append_paths("#{user_project_path}/")
121
- # source_directory = "#{source_code}/application"
122
- # destination_directory = "#{source_code}/tmp/opal"
123
- # process_directory(source_directory, destination_directory, source_code)
124
- # application_content = builder.build("#{source_code}/tmp/opal/index.rb").to_s
125
- # File.open(application_js, 'w') do |f|
126
- # f.puts application_content
127
- # end
128
- # end
129
- #
130
- # def build_system_infos(user_project_path, source_code)
131
- # system_infos_js = "#{user_project_path}/src/js/infos.js"
132
- # builder = Opal::Builder.new
133
- # builder.append_paths("#{user_project_path}/")
134
- # # system_infos = builder.build("#{source_code}/src/utilities/mode.rb").to_s
135
- # File.open(system_infos_js, 'w') do |f|
136
- # f.puts system_infos
137
- # end
138
- # end
139
- #
140
- # def minimize_aui(user_project_path)
141
- # aui_js = "#{user_project_path}/src/js/aui.js"
142
- # aui_content = File.open(aui_js).read
143
- # aui_content = Uglifier.new.compile(aui_content)
144
- # File.open(aui_js, 'w') do |f|
145
- # f.puts aui_content
146
- # end
147
- # end
148
- #
149
- # def minimize_opal(user_project_path)
150
- # opal_js = "#{user_project_path}/src/js/opal/opal.js"
151
- # opal_content = File.open(opal_js).read
152
- # opal_content = Uglifier.new.compile(opal_content)
153
- # File.open(opal_js, 'w') do |f|
154
- # f.puts opal_content
155
- # end
156
- # end
157
- #
158
- # def minimize_parser(user_project_path)
159
- # parser_js = "#{user_project_path}/src/js/opal/opal_parser.js"
160
- # parser_content = File.open(parser_js).read
161
- # parser_content = Uglifier.new.compile(parser_content)
162
- # File.open(parser_js, 'w') do |f|
163
- # f.puts parser_content
164
- # end
165
- # end
166
- #
167
- # def minimize_kernel(user_project_path)
168
- # kernel_js = "#{user_project_path}/src/js/atome/kernel.js"
169
- # kernel_content = File.open(kernel_js).read
170
- # kernel_content = Uglifier.new.compile(kernel_content)
171
- # File.open(kernel_js, 'w') do |f|
172
- # f.puts kernel_content
173
- # end
174
- # end
175
- #
176
- # def minimize_atome(user_project_path)
177
- # atome_js = "#{user_project_path}/src/js/atome/atome.js"
178
- # atome_content = File.open(atome_js).read
179
- # atome_content = Uglifier.new.compile(atome_content)
180
- # File.open(atome_js, 'w') do |f|
181
- # f.puts atome_content
182
- # end
183
- # end
184
- #
185
- # def minimize_opal_extensions(user_project_path)
186
- # atome_opal_extensions_js = "#{user_project_path}/src/js/opal/atome_opal_extensions.js"
187
- # atome_opal_extensions_content = File.open(atome_opal_extensions_js).read
188
- # atome_opal_extensions_content = Uglifier.new.compile(atome_opal_extensions_content)
189
- # File.open(atome_opal_extensions_js, 'w') do |f|
190
- # f.puts atome_opal_extensions_content
191
- # end
192
- # end
193
- #
194
- # def minimize_libraries(user_project_path)
195
- # # minimizing aui
196
- # minimize_aui(user_project_path)
197
- # # minimizing opal
198
- # minimize_opal(user_project_path)
199
- # # # minimizing opal_browser
200
- # # minimize_browser(user_project_path)
201
- # # minimizing opal_parser
202
- # minimize_parser(user_project_path)
203
- # # minimizing atome_lib
204
- # minimize_kernel(user_project_path)
205
- # # minimizing atome
206
- # minimize_atome(user_project_path)
207
- # # minimizing atome_lib
208
- # minimize_opal_extensions(user_project_path)
209
- # # minimizing application
210
- # minimize_application(user_project_path)
211
- # # minimize(user_project_path) if production == 'production'
212
- # end
213
- #
214
- # def minimize_application(user_project_path)
215
- # # minimizing user codes
216
- # application_js = "#{user_project_path}/src/js/application.js"
217
- # application_content = File.open(application_js).read
218
- # application_content = Uglifier.new.compile(application_content)
219
- # File.open(application_js, 'w') do |f|
220
- # f.puts application_content
221
- # end
222
- # end
223
- #
224
- # task :build_user_code, :user_project_path, :production do |_t, args|
225
- # user_project_path = args[:user_project_path]
226
- # source_code = "#{user_project_path}"
227
- # build_system_infos(user_project_path, source_code)
228
- # build_user_code(user_project_path, source_code)
229
- # end
230
- #
231
- # task :system_builder, :user_project_path, :production do |_t, args|
232
- # user_project_path = args[:user_project_path]
233
- # production = args[:production]
234
- # source_code = '../vendor/assets'
235
- # build_common_libraries(user_project_path, production)
236
- # build_system_infos(user_project_path, source_code)
237
- # build_user_code(user_project_path, source_code)
238
- #
239
- # # TODO: catch and message to user when when there's no force and folder already exist
240
- # end
241
- #
242
- # task :system_updater, :user_project_path, :production do |_t, args|
243
- # user_project_path = args[:user_project_path]
244
- # production = args[:production]
245
- # gem_location = File.join(File.dirname(__FILE__))
246
- # build_libraries(user_project_path, gem_location)
247
- # build_common_libraries(user_project_path, production)
248
- # end
249
- #
250
- # task :minimizer, :user_project_path do |_t, args|
251
- # user_project_path = args[:user_project_path]
252
- # minimize(user_project_path)
253
- # end
254
- #
255
- # task default: :run
256
- #
257
- # def build_libraries(user_project_path, gem_location)
258
- # build_aui_for_opal(user_project_path)
259
- # build_host_mode_for_opal(user_project_path)
260
- # build_atome_kernel(user_project_path, gem_location)
261
- # build_opal(user_project_path)
262
- # build_opal_parser(user_project_path)
263
- # build_opal_extensions(user_project_path, gem_location)
264
- # end
265
- #
266
- # def minimize(user_project_path)
267
- # minimize_libraries(user_project_path)
268
- # # minimize_user_code(user_project_path)
269
- # end
270
- #
271
- # def build_common_libraries(user_project_path, production)
272
- # gem_location = File.join(File.dirname(__FILE__))
273
- # copy_assets_files(user_project_path, gem_location)
274
- # build_libraries(user_project_path, gem_location)
275
- # minimize(user_project_path) if production == 'production'
276
- # end
277
- #
278
- # # TODO: integrate pure JS (ruby2js) compilation