atome 0.5.5.8.5 → 0.5.5.8.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fe95794110662e88b3aac3f5a49c75859e6d8f82bc8d54a1413b99f868139893
4
- data.tar.gz: a755990f9a94ee89f4b3d3271b2c6b822c971a225ae5b4b7465c1f845d99a920
3
+ metadata.gz: 4aa832acc6d311b046d0d0efeee475a0f1ec11774eb392218ab8fe8d8d2f3c52
4
+ data.tar.gz: 8e6c9a171461da40f3d88f2466a50d72e3a4d16bd80db228b53ea9e69d6d58be
5
5
  SHA512:
6
- metadata.gz: '09a7452177a47e2720aec7f93a48f113a12087b5bd64fcdeb0ffbe30831f70e40ac7fab9f64dcdf8e7636bccbb2d5eb7f7b1b9e8db1cd4ddf1852ad135d2bdbe'
7
- data.tar.gz: a3832fda01f201a82ef0182a2275af3a1d650195c308a4cde13594bcf3e6a83e15c6db2c58e19a3e329960d89f9fe6ef3ee3d52c0c557327afe7d272f84fad37
6
+ metadata.gz: 07b0fadc4e1818654614b1a47acde2bca31654f74782069a5f6b01a545740dfcf1a6676b960d50000ffa87ad66c6e50f6626e9997ada0ecaeaa772d5f910b4c9
7
+ data.tar.gz: f96b61891e6b0f359085f1412bd6bc5ed368be0dd8ee23df2dcdc087cfa31d4146482478129622113aef1fec9a4d15634b844db1eb329285fe3ea02c7fc4df35
data/Rakefile CHANGED
@@ -77,7 +77,7 @@ task :test_wasm do
77
77
 
78
78
  host_mode = 'pure_wasm'
79
79
 
80
- file_path = "./tmp/#{project_name}/src/index.html"
80
+ file_path = "./tmp/#{project_name}/src/index_wasm.html"
81
81
 
82
82
  case RbConfig::CONFIG['host_os']
83
83
  when /darwin|mac os/
data/exe/atome CHANGED
@@ -482,7 +482,7 @@ if ARGV.include?('update')
482
482
  # first we delete everything but application
483
483
 
484
484
  files_to_treat = %w[server src-tauri src-wasm Guardfile Rakefile src/css src/js/atome src/js/third_parties src/medias
485
- src/favicon.ico src/index.html src/index_opal.html src/index_server.html src/index_server_wasm.html]
485
+ src/favicon.ico src/index_wasm.html src/index_opal.html src/index_server.html src/index_server_wasm.html]
486
486
  files_to_treat.each do |item|
487
487
  item_path = File.join(destination, item)
488
488
  if File.directory?(item_path)
@@ -647,13 +647,13 @@ else
647
647
 
648
648
  if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
649
649
  # code to exec for Windows
650
- `start "" "#{destination}\\#{project_name}\\src\\index.html"`
650
+ `start "" "#{destination}\\#{project_name}\\src\\index_wasm.html"`
651
651
  elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
652
652
  # code to exec for MacOS
653
- `open #{destination}/#{project_name}/src/index.html`
653
+ `open #{destination}/#{project_name}/src/index_wasm.html`
654
654
  else
655
655
  # code to exec for Unix/Linux
656
- `open #{destination}/#{project_name}/src/index.html`
656
+ `open #{destination}/#{project_name}/src/index_wasm.html`
657
657
  end
658
658
 
659
659
  end
@@ -97,5 +97,7 @@ new({ particle: :layout }) do |params|
97
97
  end
98
98
  params
99
99
  end
100
+ new({particle: :center})
101
+
100
102
 
101
103
 
data/lib/atome/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  # return atome version
4
4
  class Atome
5
- VERSION = '0.5.5.8.5'
5
+ VERSION = '0.5.5.8.7'
6
6
  end
@@ -20,7 +20,6 @@ class HTML
20
20
  end
21
21
  end
22
22
 
23
-
24
23
  def initialize(id_found, current_atome)
25
24
  @element ||= JS.global[:document].getElementById(id_found.to_s)
26
25
  @id = id_found
@@ -1268,6 +1267,7 @@ class HTML
1268
1267
  end
1269
1268
  end
1270
1269
  end
1270
+
1271
1271
  def set_td_style(td)
1272
1272
  cell_height = 50
1273
1273
  td[:style][:border] = '1px solid black'
@@ -1283,7 +1283,6 @@ class HTML
1283
1283
  { cell_height: cell_height, cell_width: cell_height }
1284
1284
  end
1285
1285
 
1286
-
1287
1286
  def insert_cell(params)
1288
1287
  row_index, cell_index = params[:cell]
1289
1288
  new_content = params[:content]
@@ -1390,7 +1389,6 @@ class HTML
1390
1389
 
1391
1390
  end
1392
1391
 
1393
-
1394
1392
  def table_remove(params)
1395
1393
  if params[:row]
1396
1394
  row_index = params[:row]
@@ -1437,9 +1435,86 @@ class HTML
1437
1435
 
1438
1436
  # atomisation!
1439
1437
  def atomized(html_object)
1440
- html_object=html_object[0] if html_object.instance_of? Array
1438
+ html_object = html_object[0] if html_object.instance_of? Array
1441
1439
  @element = html_object
1442
1440
  end
1441
+
1442
+
1443
+ # def center(options, attach)
1444
+ # parent = grab(attach)
1445
+ #
1446
+ # # Centre sur l'axe X
1447
+ # if options[:x]
1448
+ # x_position = calculate_position(options[:x], parent.to_px(:width), @original_atome.to_px(:width))
1449
+ # @original_atome.left(x_position)
1450
+ # end
1451
+ #
1452
+ # # Centre sur l'axe Y
1453
+ # if options[:y]
1454
+ # y_position = calculate_position(options[:y], parent.to_px(:height), @original_atome.to_px(:height))
1455
+ # @original_atome.top(y_position)
1456
+ # end
1457
+ # end
1458
+ #
1459
+ # # Méthode auxiliaire pour calculer la position
1460
+ # def calculate_position(option, parent_dimension, self_dimension)
1461
+ # if option.is_a?(String) && option.end_with?('%')
1462
+ # percent = option.chop.to_f / 100.0
1463
+ # (parent_dimension - self_dimension) * percent
1464
+ # elsif option == 0
1465
+ # # Cas spécial pour centrer l'objet
1466
+ # (parent_dimension - self_dimension) / 2.0
1467
+ # else
1468
+ # option
1469
+ # end
1470
+ # end
1471
+
1472
+ def center(options, attach)
1473
+ @center_options = options
1474
+ @parent = grab(attach)
1475
+
1476
+ # Appliquer le centrage initial
1477
+ apply_centering(@center_options, @parent)
1478
+
1479
+ # Si l'option dynamique est activée, ajouter un écouteur d'événements
1480
+ if @center_options[:dynamic]
1481
+ event_handler = ->(event) do
1482
+ apply_centering(@center_options, @parent)
1483
+ end
1484
+ JS.global[:window].addEventListener('resize', event_handler)
1485
+ end
1486
+ end
1487
+
1488
+ private
1489
+
1490
+ # Méthode auxiliaire pour appliquer le centrage
1491
+ def apply_centering(options, parent)
1492
+ # Centre sur l'axe X
1493
+ if options[:x]
1494
+ x_position = calculate_position(options[:x], parent.to_px(:width), @original_atome.to_px(:width))
1495
+ @original_atome.left(x_position)
1496
+ end
1497
+
1498
+ # Centre sur l'axe Y
1499
+ if options[:y]
1500
+ y_position = calculate_position(options[:y], parent.to_px(:height), @original_atome.to_px(:height))
1501
+ @original_atome.top(y_position)
1502
+ end
1503
+ end
1504
+
1505
+ # Méthode auxiliaire pour calculer la position
1506
+ def calculate_position(option, parent_dimension, self_dimension)
1507
+ if option.is_a?(String) && option.end_with?('%')
1508
+ percent = option.chop.to_f / 100.0
1509
+ (parent_dimension - self_dimension) * percent
1510
+ elsif option == 0
1511
+ # Cas spécial pour centrer l'objet
1512
+ (parent_dimension - self_dimension) / 2.0
1513
+ else
1514
+ option
1515
+ end
1516
+ end
1517
+
1443
1518
  end
1444
1519
 
1445
1520
 
@@ -64,4 +64,8 @@ end
64
64
 
65
65
  new({ method: :display, renderer: :html }) do |params|
66
66
  html.style(:display, params)
67
- end
67
+ end
68
+
69
+ new({renderer: :html, method: :center}) do |params|
70
+ html.center(params, attach)
71
+ end
@@ -3,7 +3,7 @@
3
3
  # dummies html objects :
4
4
 
5
5
  #object 1
6
- div_rouge = JS.global[:document].call(:createElement, "div")
6
+ div_rouge = JS.global[:document].createElement( "div")
7
7
 
8
8
  div_rouge[:style][:backgroundColor] = "red"
9
9
  div_rouge[:style][:width] = "100px"
@@ -14,7 +14,7 @@ div_view.appendChild(div_rouge)
14
14
 
15
15
 
16
16
  #object 2
17
- span_bleu = JS.global[:document].call(:createElement, "span")
17
+ span_bleu = JS.global[:document].createElement( "span")
18
18
  span_bleu[:style][:backgroundColor] = "blue"
19
19
  span_bleu[:innerHTML] = "blue"
20
20
  span_bleu[:style][:width] = "10px"
@@ -23,7 +23,7 @@ div_rouge.appendChild(span_bleu)
23
23
 
24
24
 
25
25
  #object 2
26
- span_white = JS.global[:document].call(:createElement, "h1")
26
+ span_white = JS.global[:document].createElement( "h1")
27
27
  span_white[:style][:color] = "white"
28
28
  span_white[:innerHTML] = "Hello"
29
29
  span_white[:style][:width] = "10px"
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ b= box()
4
+
5
+
6
+ # b.center({ x: '10%', y: '20%' })
7
+ b.center({ x: 0, y: 0, dynamic: true })
8
+ # b.center({ x: true, y: true })
@@ -9,15 +9,20 @@
9
9
  <meta name="msapplication-tap-highlight" content="no">
10
10
  <link type="text/css" rel="stylesheet" href="css/style.css">
11
11
  <style id="atomic_style"></style>
12
- <script defer src="js/third_parties/browser.script.iife.min.js" type="text/javascript"></script>
13
12
  <script type="text/javascript" src="js/third_parties/interact.min.js" defer></script>
14
13
  <script type="text/javascript" src="js/third_parties/popmotion.min.js" defer></script>
15
14
  <script type="text/javascript" src="js/third_parties/sortable.min.js" defer></script>
16
15
  <script type="text/javascript" src="js/third_parties/wad.min.js" defer></script>
17
16
  <script type="text/javascript" src="js/third_parties/sha256.min.js" defer></script>
18
17
  <script type="text/javascript" src="js/third_parties/ping.min.js" defer></script>
19
- <script type="text/javascript" src="js/third_parties/fabric.min.js" defer></script>
18
+ <script defer src="js/third_parties/fabric.min.js" type="text/javascript"></script>
20
19
  <script type="text/javascript" src="js/third_parties/papaparse.min.js" defer></script>
20
+ <script src='js/opal/opal.js' defer></script>
21
+ <script src='js/opal/opal_parser.js' defer></script>
22
+ <script src='js/aui.js' defer></script>
23
+ <script defer defer src='js/host_mode.js'></script>
24
+ <script src='js/opal/atome_opal_extensions.js' defer></script>
25
+ <script src='js/atome/kernel.js' defer></script>
21
26
  <script defer src="js/atome/atome_helpers/communication.js" type="text/javascript"></script>
22
27
  <script defer src="js/atome/atome_helpers/file.js" type="text/javascript"></script>
23
28
  <!-- <script>-->
@@ -29,19 +34,14 @@
29
34
  <title>atome</title>
30
35
  </head>
31
36
  <body id='user_view' class='atome'>
32
-
33
- <div id='copyright'>©atome 2023</div>
37
+ <div id='copyright'>©atome 2027</div>
34
38
  </body>
35
- <script type="text/ruby">
36
- require 'js'
37
- require '/lib/platform_specific/wasm/atome_wasm_extensions'
38
- require '/utilities/aui'
39
- require '/utilities/host_mode'
40
- require '/lib/atome_relative'
41
- require './index'
42
- #puts Universe.host
43
- atome_infos
44
- </script>
45
- <script defer src="js/atome/specific/wasm.js" type="text/javascript"></script>
39
+ <script defer src="js/atome/specific/opal.js" type="text/javascript"></script>
46
40
  <script defer src="js/atome/atome.js" type="text/javascript"></script>
41
+ <script src='js/application.js' defer></script>
42
+ <script>
43
+ window.addEventListener('load', function () {
44
+ Opal.eval('atome_infos')
45
+ })
46
+ </script>
47
47
  </html>
@@ -0,0 +1,47 @@
1
+ <!DOCTYPE html>
2
+ <html lang="En">
3
+ <head>
4
+ <link rel="icon" type="image/x-icon"
5
+ href="https://github.com/atomecorp/atome/blob/master/vendor/assets/src/favicon.ico">
6
+ <meta name='viewport' content='initial-scale=1, width=device-width, viewport-fit=cover'>
7
+ <meta charset='UTF-8'/>
8
+ <meta name="format-detection" content="telephone=no">
9
+ <meta name="msapplication-tap-highlight" content="no">
10
+ <link type="text/css" rel="stylesheet" href="css/style.css">
11
+ <style id="atomic_style"></style>
12
+ <script defer src="js/third_parties/browser.script.iife.min.js" type="text/javascript"></script>
13
+ <script type="text/javascript" src="js/third_parties/interact.min.js" defer></script>
14
+ <script type="text/javascript" src="js/third_parties/popmotion.min.js" defer></script>
15
+ <script type="text/javascript" src="js/third_parties/sortable.min.js" defer></script>
16
+ <script type="text/javascript" src="js/third_parties/wad.min.js" defer></script>
17
+ <script type="text/javascript" src="js/third_parties/sha256.min.js" defer></script>
18
+ <script type="text/javascript" src="js/third_parties/ping.min.js" defer></script>
19
+ <script type="text/javascript" src="js/third_parties/fabric.min.js" defer></script>
20
+ <script type="text/javascript" src="js/third_parties/papaparse.min.js" defer></script>
21
+ <script defer src="js/atome/atome_helpers/communication.js" type="text/javascript"></script>
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>-->
29
+ <title>atome</title>
30
+ </head>
31
+ <body id='user_view' class='atome'>
32
+
33
+ <div id='copyright'>©atome 2023</div>
34
+ </body>
35
+ <script type="text/ruby">
36
+ require 'js'
37
+ require '/lib/platform_specific/wasm/atome_wasm_extensions'
38
+ require '/utilities/aui'
39
+ require '/utilities/host_mode'
40
+ require '/lib/atome_relative'
41
+ require './index'
42
+ #puts Universe.host
43
+ atome_infos
44
+ </script>
45
+ <script defer src="js/atome/specific/wasm.js" type="text/javascript"></script>
46
+ <script defer src="js/atome/atome.js" type="text/javascript"></script>
47
+ </html>
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.8.5
4
+ version: 0.5.5.8.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean-Eric Godard
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-22 00:00:00.000000000 Z
11
+ date: 2024-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eventmachine
@@ -493,6 +493,7 @@ files:
493
493
  - vendor/assets/application/examples/browse.rb
494
494
  - vendor/assets/application/examples/callback.rb
495
495
  - vendor/assets/application/examples/category.rb
496
+ - vendor/assets/application/examples/center.rb
496
497
  - vendor/assets/application/examples/clear.rb
497
498
  - vendor/assets/application/examples/clones.rb
498
499
  - vendor/assets/application/examples/code.rb
@@ -615,6 +616,7 @@ files:
615
616
  - vendor/assets/src/index_opal.html
616
617
  - vendor/assets/src/index_server.html
617
618
  - vendor/assets/src/index_server_wasm.html
619
+ - vendor/assets/src/index_wasm.html
618
620
  - vendor/assets/src/js/atome/atome.js
619
621
  - vendor/assets/src/js/atome/atome_helpers/add_font.js
620
622
  - vendor/assets/src/js/atome/atome_helpers/atome_animate.js