atome 0.5.5.8.5 → 0.5.5.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -1
  3. data/exe/atome +4 -4
  4. data/lib/atome/atome.rb +7 -1
  5. data/lib/atome/genesis/generators/communication.rb +12 -4
  6. data/lib/atome/genesis/generators/spatial.rb +25 -13
  7. data/lib/atome/genesis/generators/utility.rb +1 -1
  8. data/lib/atome/genesis/sparkle.rb +23 -2
  9. data/lib/atome/helpers/essentials.rb +1 -1
  10. data/lib/atome/helpers/utilities.rb +20 -0
  11. data/lib/atome/kernel/universe.rb +18 -0
  12. data/lib/atome/version.rb +1 -1
  13. data/lib/renderers/html/communication.rb +3 -0
  14. data/lib/renderers/html/effect.rb +0 -1
  15. data/lib/renderers/html/geometry.rb +2 -2
  16. data/lib/renderers/html/html.rb +77 -4
  17. data/lib/renderers/html/identity.rb +6 -3
  18. data/lib/renderers/html/property.rb +9 -7
  19. data/lib/renderers/html/spatial.rb +29 -27
  20. data/vendor/assets/application/examples/atome.rb +0 -1
  21. data/vendor/assets/application/examples/atomizer.rb +3 -3
  22. data/vendor/assets/application/examples/center.rb +8 -0
  23. data/vendor/assets/application/examples/compute.rb +3 -3
  24. data/vendor/assets/application/examples/example.rb +27 -0
  25. data/vendor/assets/application/examples/help.rb +17 -0
  26. data/vendor/assets/application/examples/int8.rb +14 -0
  27. data/vendor/assets/application/examples/test.rb +20 -0
  28. data/vendor/assets/application/examples/unit.rb +14 -0
  29. data/vendor/assets/server/atome_server.rb +7 -4
  30. data/vendor/assets/src/index.html +15 -15
  31. data/vendor/assets/src/index_wasm.html +47 -0
  32. metadata +11 -4
  33. /data/vendor/assets/application/examples/{messaging.rb → server.rb} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fe95794110662e88b3aac3f5a49c75859e6d8f82bc8d54a1413b99f868139893
4
- data.tar.gz: a755990f9a94ee89f4b3d3271b2c6b822c971a225ae5b4b7465c1f845d99a920
3
+ metadata.gz: 3bff5ca5d96c5da19c164ec49593ae7f237251c9656135a6f74d8fcfb028243a
4
+ data.tar.gz: fc6035092c39b7d795157ab5b5dd91db2b1b7a3037b3d1af356c33050a316348
5
5
  SHA512:
6
- metadata.gz: '09a7452177a47e2720aec7f93a48f113a12087b5bd64fcdeb0ffbe30831f70e40ac7fab9f64dcdf8e7636bccbb2d5eb7f7b1b9e8db1cd4ddf1852ad135d2bdbe'
7
- data.tar.gz: a3832fda01f201a82ef0182a2275af3a1d650195c308a4cde13594bcf3e6a83e15c6db2c58e19a3e329960d89f9fe6ef3ee3d52c0c557327afe7d272f84fad37
6
+ metadata.gz: 10ca739de4b2760d6d77267f50ddc9aaf7d6b003e50dae9e2535259e542d83dc4da6536184fa45f59cafb84a4daf11764cb6f46e7fdc59028a3e201c4340d4f4
7
+ data.tar.gz: 6c58b50fab38c6d5c89e4ec86e384530165a1e26547f13415e0e056fd7c7c94c4b9cb75cc4f72bcf40c90c112d098dc1d0e1dd44ad2fa475b992c31e25f68c83
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
data/lib/atome/atome.rb CHANGED
@@ -10,9 +10,11 @@ class Atome
10
10
 
11
11
  # the keys :renderers, :type and :id should be placed in the first position in the hash
12
12
  @history = {}
13
+ # @language = :english
13
14
  @callback = {}
14
15
  @tag = {}
15
16
  @selected = false
17
+ @metrics = {}
16
18
  @unit = {}
17
19
  @collect = {}
18
20
  @id = new_atome[:id] || identity_generator(:element)
@@ -26,7 +28,7 @@ class Atome
26
28
  # now we store the proc in a an atome's property called :bloc
27
29
  new_atome[:code] = atomes_proc if atomes_proc
28
30
  # we reorder the hash
29
- ordered_keys = %i[renderers id alien type]
31
+ ordered_keys = %i[renderers id alien type int8 unit]
30
32
  ordered_part = ordered_keys.map { |k| [k, new_atome[k]] }.to_h
31
33
  other_part = new_atome.reject { |k, _| ordered_keys.include?(k) }
32
34
  # merge the parts to obtain an re-ordered hash
@@ -36,6 +38,10 @@ class Atome
36
38
  collapse(reordered_atome)
37
39
  end
38
40
 
41
+ def js
42
+ html.object
43
+ end
44
+
39
45
  def particle_creation(element, params, store, rendering, &user_proc)
40
46
 
41
47
  # @store_allow = false
@@ -7,13 +7,21 @@ end
7
7
 
8
8
  new({ particle: :message }) do |params, bloc|
9
9
 
10
- params = {message: params } unless params.instance_of? Hash
11
- params[:user]=Universe.current_user
12
- params[:pass]=Black_matter.password
10
+ params = { message: params } unless params.instance_of? Hash
11
+ params[:user] = Universe.current_user
12
+ params[:pass] = Black_matter.password
13
13
 
14
14
  html.send_message(params, &bloc)
15
15
  end
16
16
 
17
17
  new({ particle: :controller }) do |msg|
18
18
  Atome.controller_sender(msg)
19
- end
19
+ end
20
+
21
+ new({ particle: :int8 })
22
+
23
+ new({ particle: :language }) do |params|
24
+ @data = int8[params]
25
+ params
26
+ end
27
+
@@ -1,9 +1,25 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- new({ particle: :left, type: :integer })
4
- new({ particle: :right, type: :integer })
5
- new({ particle: :top, type: :integer })
6
- new({ particle: :bottom, type: :integer })
3
+ # new ({particle: :left}) do |params|
4
+ # {value: params, unit: :px} unless params.instance_of? Hash
5
+ # end
6
+ # new({ particle: :right, type: :integer })do |params|
7
+ # {value: params, unit: :px} unless params.instance_of? Hash
8
+ # end
9
+ # new({ particle: :top, type: :integer })do |params|
10
+ # {value: params, unit: :px} unless params.instance_of? Hash
11
+ #
12
+ # end
13
+ # new({ particle: :bottom, type: :integer })do |params|
14
+ # {value: params, unit: :px} unless params.instance_of? Hash
15
+ # end
16
+
17
+ new ({particle: :left})
18
+ new ({particle: :right})
19
+ new ({particle: :top})
20
+ new ({particle: :bottom})
21
+
22
+
7
23
  new({ particle: :rotate, type: :integer })
8
24
  new({ particle: :direction, type: :string })
9
25
  new({ particle: :center, type: :string})
@@ -12,9 +28,7 @@ new({ particle: :position })
12
28
  new({ particle: :organise })
13
29
  new({ particle: :spacing })
14
30
  new({ particle: :display }) do |params|
15
- unless params.instance_of? Hash
16
- params = { mode: params }
17
- end
31
+ params = { mode: params } unless params.instance_of? Hash
18
32
  params
19
33
  end
20
34
  new({ particle: :layout }) do |params|
@@ -23,9 +37,7 @@ new({ particle: :layout }) do |params|
23
37
  elements_style = params.delete(:element) || {}
24
38
  # now we get the list of the atome to layout
25
39
  atomes_to_organise = []
26
- if type == :group
27
- atomes_to_organise = collect
28
- end
40
+ atomes_to_organise = collect if type == :group
29
41
  # if params[:listing] is specified group collection is override
30
42
  atomes_to_organise = params[:listing] if params[:listing]
31
43
  if mode_found == :default
@@ -56,9 +68,7 @@ new({ particle: :layout }) do |params|
56
68
  end
57
69
  container.remove({ category: :atome })
58
70
  container.category(:matrix)
59
- if mode_found == :list
60
- params[:organise] = '1fr'
61
- end
71
+ params[:organise] = '1fr' if mode_found == :list
62
72
  params.each do |particle, value|
63
73
  container.send(particle, value)
64
74
  end
@@ -97,5 +107,7 @@ new({ particle: :layout }) do |params|
97
107
  end
98
108
  params
99
109
  end
110
+ new({particle: :center})
111
+
100
112
 
101
113
 
@@ -113,7 +113,7 @@ end
113
113
  new({ particle: :relations, type: :hash })
114
114
  new({ particle: :tag, render: false, type: :hash })
115
115
  new({ particle: :web })
116
- new({ particle: :unit, type: :hash })
116
+ new({ particle: :metrics, type: :hash })
117
117
  new({ initialize: :unit, value: {} })
118
118
  new({ particle: :login }) do |params|
119
119
  set_current_user(id) if params
@@ -91,7 +91,7 @@ Atome.new({ renderers: default_render, id: machine_id, type: :machine, password:
91
91
  #user
92
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
+ human({ id: :anonymous, login: true, password: user_password, data: { birthday: '10/05/1996' },selection: [], attach: :user_view })
95
95
 
96
96
  Universe.current_machine = machine_id
97
97
  # the constant A is used to access alla atomes methods
@@ -116,4 +116,25 @@ def atome_infos
116
116
  puts "server: #{server}"
117
117
  end
118
118
 
119
- # atome_infos
119
+
120
+ # help and example below :
121
+ #
122
+ A.example(:left) do
123
+ english = 'here is an example, touch me to get some help, or click the code to exec'
124
+ french = "voici un example, click moi pour de l'aide, ou clicker le code pour l'executer"
125
+ code = <<STR
126
+ b=box
127
+ puts b.left
128
+ b.left(155)
129
+ puts b.left
130
+ STR
131
+ example = text({ int8: { english: english, french: french }, language: :english, width: 666 })
132
+ code_text = text({ int8: { english: code }, language: :english, width: 666, top: 33 })
133
+ example.touch(true) do
134
+ example.delete(true)
135
+ help(:left)
136
+ end
137
+ code_text.touch(true) do
138
+ eval(code)
139
+ end
140
+ end
@@ -35,7 +35,7 @@ module Essentials
35
35
  left: 100, top: 100 },
36
36
  text: { type: :text, component: { size: 18 },left: 0, top: 0,
37
37
  apply: [:text_color],
38
- width: :auto, height: :auto },
38
+ width: :auto, height: :auto, language: :english },
39
39
  drm: { type: :drm, attach: :black_matter },
40
40
  shadow: { type: :shadow, red: 0, green: 0, blue: 0, alpha: 0 },
41
41
  color: { type: :color, red: 0, green: 0, blue: 0, alpha: 1}
@@ -52,6 +52,26 @@ class Atome
52
52
 
53
53
  end
54
54
 
55
+
56
+ def help(particle, &doc)
57
+ if doc
58
+ Universe.set_help(particle, &doc)
59
+ else
60
+ doc_found = Universe.get_help(particle)
61
+ instance_exec(&doc_found) if doc_found.is_a?(Proc)
62
+ end
63
+ end
64
+
65
+ def example(particle, &example)
66
+ if example
67
+ Universe.set_example(particle, &example)
68
+ else
69
+ example_found = Universe.get_example(particle)
70
+ instance_exec(&example_found) if example_found.is_a?(Proc)
71
+ end
72
+ end
73
+
74
+
55
75
  # local server messaging
56
76
  def file_for_opal(parent, bloc)
57
77
  JS.eval("fileForOpal('#{parent}', #{bloc})")
@@ -11,10 +11,28 @@ class Universe
11
11
  @specificities = {}
12
12
  @history = {}
13
13
  @users = {}
14
+ @help = {}
15
+ @example = {}
14
16
 
15
17
  class << self
16
18
  attr_reader :atomes, :renderer_list, :atome_list, :particle_list, :classes, :counter, :atomes_specificities
17
19
 
20
+ def set_help(particle, &doc)
21
+ @help[particle] = doc
22
+ end
23
+
24
+ def get_help(particle)
25
+ @help[particle]
26
+ end
27
+
28
+ def set_example(particle, &example)
29
+ @example[particle] = example
30
+ end
31
+
32
+ def get_example(particle)
33
+ @example[particle]
34
+ end
35
+
18
36
  def add_to_particle_list(particle = nil, type)
19
37
  instance_variable_get('@particle_list')[particle] = type
20
38
  end
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.9.1'
6
6
  end
@@ -0,0 +1,3 @@
1
+ new({ method: :language, renderer: :html }) do |params|
2
+ js[:innerHTML] = int8[params].to_s
3
+ end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  new({ renderer: :html, method: :smooth, type: :string }) do |value, _user_proc|
4
- # alert :ici
5
4
  format_params = case value
6
5
  when Array
7
6
  data_collected = []
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  new({ method: :width, type: :integer, renderer: :html }) do |value, _user_proc|
4
- unit_found = unit[:width]
4
+ unit_found = metrics[:width]
5
5
  if unit_found
6
6
  html.style(:width, "#{value}#{unit_found}")
7
7
  elsif value.is_a?(Numeric)
@@ -12,7 +12,7 @@ new({ method: :width, type: :integer, renderer: :html }) do |value, _user_proc|
12
12
  end
13
13
 
14
14
  new({ method: :height, renderer: :html, type: :string }) do |value, _user_proc|
15
- unit_found = unit[:height]
15
+ unit_found = metrics[:height]
16
16
  if unit_found
17
17
  html.style(:height, "#{value}#{unit_found}")
18
18
  elsif value.is_a?(Numeric)
@@ -20,13 +20,16 @@ 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
27
26
  @original_atome = current_atome
28
27
  end
29
28
 
29
+ def object
30
+ @element
31
+ end
32
+
30
33
  def hypertext(params)
31
34
  current_div = JS.global[:document].getElementById(@id.to_s)
32
35
  current_div[:innerHTML] = params
@@ -1268,6 +1271,7 @@ class HTML
1268
1271
  end
1269
1272
  end
1270
1273
  end
1274
+
1271
1275
  def set_td_style(td)
1272
1276
  cell_height = 50
1273
1277
  td[:style][:border] = '1px solid black'
@@ -1283,7 +1287,6 @@ class HTML
1283
1287
  { cell_height: cell_height, cell_width: cell_height }
1284
1288
  end
1285
1289
 
1286
-
1287
1290
  def insert_cell(params)
1288
1291
  row_index, cell_index = params[:cell]
1289
1292
  new_content = params[:content]
@@ -1390,7 +1393,6 @@ class HTML
1390
1393
 
1391
1394
  end
1392
1395
 
1393
-
1394
1396
  def table_remove(params)
1395
1397
  if params[:row]
1396
1398
  row_index = params[:row]
@@ -1437,9 +1439,80 @@ class HTML
1437
1439
 
1438
1440
  # atomisation!
1439
1441
  def atomized(html_object)
1440
- html_object=html_object[0] if html_object.instance_of? Array
1442
+ html_object = html_object[0] if html_object.instance_of? Array
1441
1443
  @element = html_object
1442
1444
  end
1445
+
1446
+
1447
+ # def center(options, attach)
1448
+ # parent = grab(attach)
1449
+ #
1450
+ # # Centre sur l'axe X
1451
+ # if options[:x]
1452
+ # x_position = calculate_position(options[:x], parent.to_px(:width), @original_atome.to_px(:width))
1453
+ # @original_atome.left(x_position)
1454
+ # end
1455
+ #
1456
+ # # Centre sur l'axe Y
1457
+ # if options[:y]
1458
+ # y_position = calculate_position(options[:y], parent.to_px(:height), @original_atome.to_px(:height))
1459
+ # @original_atome.top(y_position)
1460
+ # end
1461
+ # end
1462
+ #
1463
+ # # Méthode auxiliaire pour calculer la position
1464
+ # def calculate_position(option, parent_dimension, self_dimension)
1465
+ # if option.is_a?(String) && option.end_with?('%')
1466
+ # percent = option.chop.to_f / 100.0
1467
+ # (parent_dimension - self_dimension) * percent
1468
+ # elsif option == 0
1469
+ # # Cas spécial pour centrer l'objet
1470
+ # (parent_dimension - self_dimension) / 2.0
1471
+ # else
1472
+ # option
1473
+ # end
1474
+ # end
1475
+
1476
+ def center(options, attach)
1477
+ @center_options = options
1478
+ @parent = grab(attach)
1479
+
1480
+ apply_centering(@center_options, @parent)
1481
+
1482
+ if @center_options[:dynamic]
1483
+ event_handler = ->(event) do
1484
+ apply_centering(@center_options, @parent)
1485
+ end
1486
+ JS.global[:window].addEventListener('resize', event_handler)
1487
+ end
1488
+ end
1489
+
1490
+ private
1491
+
1492
+ def apply_centering(options, parent)
1493
+ # Centre sur l'axe X
1494
+ if options[:x]
1495
+ x_position = calculate_position(options[:x], parent.to_px(:width), @original_atome.to_px(:width))
1496
+ @original_atome.left(x_position)
1497
+ end
1498
+
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
+ def calculate_position(option, parent_dimension, self_dimension)
1506
+ if option.is_a?(String) && option.end_with?('%')
1507
+ percent = option.chop.to_f / 100.0
1508
+ (parent_dimension - self_dimension) * percent
1509
+ elsif option == 0
1510
+ (parent_dimension - self_dimension) / 2.0
1511
+ else
1512
+ option
1513
+ end
1514
+ end
1515
+
1443
1516
  end
1444
1517
 
1445
1518
 
@@ -41,9 +41,12 @@ end
41
41
  new({ method: :type, type: :string, specific: :color, renderer: :html }) do
42
42
  end
43
43
 
44
-
45
- new({ method: :data, type: :string, specific: :text, renderer: :html }) do |value, _user_proc|
46
- html.innerText(value)
44
+ new({ method: :data, type: :string, specific: :text, renderer: :html }) do |params|
45
+ js[:innerHTML] = if language
46
+ int8[language].to_s
47
+ else
48
+ params.to_s
49
+ end
47
50
  end
48
51
 
49
52
  new({ method: :data, type: :string, specific: :vector, renderer: :html }) do |value|
@@ -14,7 +14,6 @@ end
14
14
  new({ method: :alpha, type: :integer, specific: :color, renderer: :html }) do |value, _user_proc|
15
15
  end
16
16
 
17
-
18
17
  new({ renderer: :html, method: :diffusion, type: :string })
19
18
 
20
19
  # edit
@@ -23,7 +22,6 @@ new({ renderer: :html, method: :edit }) do |params|
23
22
  html.update_data(params)
24
23
  end
25
24
 
26
-
27
25
  new({ method: :border, type: :hash, renderer: :html }) do |value, _user_proc|
28
26
  thickness = value[:thickness] || 5
29
27
  type = value[:pattern] || :solid
@@ -45,15 +43,19 @@ new({ method: :insert, renderer: :html, type: :hash }) do |params|
45
43
  html.table_insert(params)
46
44
  end
47
45
 
48
-
49
-
50
46
  new({ method: :remove, renderer: :html, type: :hash }) do |params|
51
47
  html.table_remove(params)
52
48
  end
53
49
 
54
-
55
-
56
-
57
50
  new({ method: :sort, renderer: :html, type: :hash }) do |params|
58
51
  html.refresh_table(params)
52
+ end
53
+
54
+ new({ particle: :unit, store: false }) do |params|
55
+ params.each do |k, v|
56
+ @unit[k] = v
57
+ # now we refresh the particle
58
+ send(k, send(k))
59
+ end
60
+ @unit
59
61
  end
@@ -1,39 +1,37 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- new({ method: :top, type: :integer, renderer: :html }) do |params|
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
-
3
+ new({ method: :left, type: :integer, renderer: :html }) do |params|
4
+ unit = @unit[:left] || :px
5
+ js[:style][:left] = "#{params}#{unit}"
8
6
  end
9
7
 
10
- new({ method: :top, type: :integer, renderer: :html, specific: :text }) do |params|
11
- html.style(:top, "#{params}px")
8
+ new({ method: :top, type: :integer, renderer: :html }) do |params|
9
+ unit = @unit[:top] || :px
10
+ # alert unit
11
+ js[:style][:top] = "#{params}#{unit}"
12
12
  end
13
- new({ method: :top, type: :integer, renderer: :html, specific: :shadow })
14
-
15
13
  new({ method: :bottom, type: :integer, renderer: :html }) do |params|
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)
19
- end
20
-
21
- new({ method: :bottom, type: :integer, renderer: :html, specific: :text }) do |params|
22
- html.style(:bottom, params)
14
+ unit = @unit[:bottom] || :px
15
+ js[:style][:bottom] = "#{params}#{unit}"
23
16
  end
24
17
 
25
18
  new({ method: :right, type: :integer, renderer: :html }) do |params|
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)
29
- end
19
+ unit = @unit[:right] || :px
30
20
 
31
- new({ method: :left, type: :integer, renderer: :html }) do |params|
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)
21
+ js[:style][:right] = "#{params}#{unit}"
35
22
  end
36
23
 
24
+ new({ method: :top, type: :integer, renderer: :html, specific: :shadow })
25
+
26
+ # new({ method: :top, type: :integer, renderer: :html, specific: :text }) do |params|
27
+ # unit = @unit[:left] || :px
28
+ # html.style(:top, "#{params}#{unit}"
29
+ # end
30
+ #
31
+ # new({ method: :bottom, type: :integer, renderer: :html, specific: :text }) do |params|
32
+ # html.style(:bottom, "#{params}#{unit}")
33
+ # end
34
+
37
35
  new({ method: :left, type: :integer, specific: :color, renderer: :html })
38
36
 
39
37
  new({ method: :left, type: :integer, renderer: :html, specific: :shadow })
@@ -46,11 +44,11 @@ end
46
44
 
47
45
  new({ method: :rotate, type: :integer, renderer: :html, specific: :paint })
48
46
 
49
- new({renderer: :html, method: :position }) do |params|
47
+ new({ renderer: :html, method: :position }) do |params|
50
48
  html.style("position", params)
51
49
  end
52
50
 
53
- new({renderer: :html, method: :depth }) do |params|
51
+ new({ renderer: :html, method: :depth }) do |params|
54
52
  html.style("z-index", params)
55
53
  end
56
54
 
@@ -64,4 +62,8 @@ end
64
62
 
65
63
  new({ method: :display, renderer: :html }) do |params|
66
64
  html.style(:display, params)
67
- end
65
+ end
66
+
67
+ new({ renderer: :html, method: :center }) do |params|
68
+ html.center(params, attach)
69
+ end
@@ -3,4 +3,3 @@
3
3
  Atome.new( { renderers: [:html], attach: :view,id: :my_test_box, type: :shape, apply: [:shape_color],
4
4
  left: 120, top: 0, width: 100, smooth: 15, height: 100, overflow: :visible, attached: [], center: true
5
5
  })
6
-
@@ -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,8 +9,8 @@ c.touch(true) do
9
9
  end
10
10
 
11
11
  puts '------'
12
- puts "b.compute left return the position on the screen of the item : #{b.compute({reference: c.id, particle: :left, unit: :pixel})}"
12
+ puts "b.compute left return the position on the screen of the item : #{b.compute({reference: c.id, particle: :left, metrics: :pixel})}"
13
13
  puts "b.compute left : #{b.compute({ particle: :left })[:value]}, c left : #{b.left}"
14
14
  puts "b.compute top :#{b.compute({ particle: :top })[:value]}, c top: #{b.top}"
15
- alert "i.compute width :#{i.compute({ particle: :width })[:value]}, i width: #{i.width}"
16
- alert "i.compute height :#{i.compute({ particle: :height })[:value]}, i height: #{i.height}"
15
+ puts "i.compute width :#{i.compute({ particle: :width })[:value]}, i width: #{i.width}"
16
+ pus "i.compute height :#{i.compute({ particle: :height })[:value]}, i height: #{i.height}"
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+
4
+ b = box({ drag: true })
5
+
6
+ A.example(:left) do
7
+ english = 'here is an example, touch me to get some help, or click the code to exec'
8
+ french = "voici un example, click moi pour de l'aide, ou clicker le code pour l'executer"
9
+ code = <<STR
10
+ b=box
11
+ puts b.left
12
+ b.left(155)
13
+ puts b.left
14
+ STR
15
+ example = text({ int8: { english: english, french: french }, language: :english, width: 666 })
16
+ code_text = text({ int8: { english: code }, language: :english, width: 666, top: 33 })
17
+ example.touch(true) do
18
+ example.delete(true)
19
+ help(:left)
20
+ end
21
+ code_text.touch(true) do
22
+ eval(code)
23
+ end
24
+ end
25
+
26
+
27
+ b.example(:left)
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+
4
+ b = box({ drag: true })
5
+ A.help(:left) do
6
+ english = 'the left particle is,used to position the atome on the x axis, click me to get an example'
7
+ french = "'la particle left est utilisée pour positionner l'atome sur l'axe x, click moi pour obtenir un exemple"
8
+
9
+ t = text({ int8: { english: english, french: french }, width: 666 })
10
+ t.touch(true) do
11
+ t.delete(true)
12
+ example(:left)
13
+ end
14
+ end
15
+
16
+
17
+ b.help(:left)
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ t = text({ int8: { english: :hello, french: :salut, deutch: :halo }, language: :deutch })
4
+
5
+ wait 1 do
6
+ t.language(:french)
7
+ wait 1 do
8
+ t.language(:english)
9
+ # data is updated to the latest choice
10
+ puts t.data
11
+ end
12
+ end
13
+
14
+ puts t.data
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+
4
+
5
+ new ({particle: :left}) do |params|
6
+ unless params.instance_of? Hash
7
+ params= {value: params, unit: :px}
8
+ end
9
+ params
10
+ end
11
+
12
+ new ({method: :left, renderer: :html}) do |params|
13
+ js[:style][:left] = "#{params[:value]}#{params[:unit]}"
14
+ end
15
+
16
+
17
+ b=box
18
+ b.touch (true)do
19
+ b.left(533)
20
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+
4
+ box({ left: 50, id: :the_first_box, color: :blue })
5
+ b1=box({ left: 25, id: :the_second_box ,top: 3, unit: {left: '%', width: '%'}, color: :red})
6
+ box({ left: 550, id: :the_third_box , unit: {left: :px}, color: :green})
7
+ wait 2 do
8
+ b1.unit({left: 'cm'})
9
+ b1.unit({top: 'cm'})
10
+ # b1.unit[:top]='cm'
11
+ puts b1.unit
12
+ end
13
+
14
+
@@ -117,17 +117,20 @@ class App < Roda
117
117
  ws.on(:message) do |event|
118
118
  json_string = event.data.gsub(/(\w+):/) { "\"#{$1}\":" }.gsub('=>', ':')
119
119
  full_data = JSON.parse(json_string)
120
+
120
121
  message = full_data['message']
121
122
  action_requested = full_data['action']
122
123
  value= full_data['value']
123
124
  option= full_data['option']
124
125
  current_user = full_data['user']
125
126
  user_pass = full_data['pass']['global']
126
- if action_requested
127
+ # if action_requested == :request
128
+ # request (message)
129
+ # end
127
130
  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
+ # else
132
+ # return_message = "no action msg: #{full_data}"
133
+ # end
131
134
  ws.send(return_message.to_json)
132
135
  end
133
136
 
@@ -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.9.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-22 00:00:00.000000000 Z
11
+ date: 2024-01-25 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
@@ -512,6 +513,7 @@ files:
512
513
  - vendor/assets/application/examples/duplicate.rb
513
514
  - vendor/assets/application/examples/edit.rb
514
515
  - vendor/assets/application/examples/encode.rb
516
+ - vendor/assets/application/examples/example.rb
515
517
  - vendor/assets/application/examples/file.rb
516
518
  - vendor/assets/application/examples/find.rb
517
519
  - vendor/assets/application/examples/fit.rb
@@ -520,18 +522,19 @@ files:
520
522
  - vendor/assets/application/examples/grab.rb
521
523
  - vendor/assets/application/examples/gradient.rb
522
524
  - vendor/assets/application/examples/group.rb
525
+ - vendor/assets/application/examples/help.rb
523
526
  - vendor/assets/application/examples/hierarchy.rb
524
527
  - vendor/assets/application/examples/history.rb
525
528
  - vendor/assets/application/examples/hypertext.rb
526
529
  - vendor/assets/application/examples/image.rb
527
530
  - vendor/assets/application/examples/import.rb
528
531
  - vendor/assets/application/examples/infos.rb
532
+ - vendor/assets/application/examples/int8.rb
529
533
  - vendor/assets/application/examples/keyboard.rb
530
534
  - vendor/assets/application/examples/layout.rb
531
535
  - vendor/assets/application/examples/login.rb
532
536
  - vendor/assets/application/examples/markup.rb
533
537
  - vendor/assets/application/examples/match.rb
534
- - vendor/assets/application/examples/messaging.rb
535
538
  - vendor/assets/application/examples/monitor.rb
536
539
  - vendor/assets/application/examples/on_resize.rb
537
540
  - vendor/assets/application/examples/online.rb
@@ -552,6 +555,7 @@ files:
552
555
  - vendor/assets/application/examples/security.rb
553
556
  - vendor/assets/application/examples/select_text.rb
554
557
  - vendor/assets/application/examples/selected.rb
558
+ - vendor/assets/application/examples/server.rb
555
559
  - vendor/assets/application/examples/shadow.rb
556
560
  - vendor/assets/application/examples/shapes.rb
557
561
  - vendor/assets/application/examples/shortcut.rb
@@ -562,9 +566,11 @@ files:
562
566
  - vendor/assets/application/examples/table.rb
563
567
  - vendor/assets/application/examples/tagged.rb
564
568
  - vendor/assets/application/examples/terminal.rb
569
+ - vendor/assets/application/examples/test.rb
565
570
  - vendor/assets/application/examples/text.rb
566
571
  - vendor/assets/application/examples/touch.rb
567
572
  - vendor/assets/application/examples/type_mutation.rb
573
+ - vendor/assets/application/examples/unit.rb
568
574
  - vendor/assets/application/examples/universe.rb
569
575
  - vendor/assets/application/examples/vector.rb
570
576
  - vendor/assets/application/examples/video.rb
@@ -615,6 +621,7 @@ files:
615
621
  - vendor/assets/src/index_opal.html
616
622
  - vendor/assets/src/index_server.html
617
623
  - vendor/assets/src/index_server_wasm.html
624
+ - vendor/assets/src/index_wasm.html
618
625
  - vendor/assets/src/js/atome/atome.js
619
626
  - vendor/assets/src/js/atome/atome_helpers/add_font.js
620
627
  - vendor/assets/src/js/atome/atome_helpers/atome_animate.js
@@ -745,7 +752,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
745
752
  - !ruby/object:Gem::Version
746
753
  version: '0'
747
754
  requirements: []
748
- rubygems_version: 3.5.3
755
+ rubygems_version: 3.5.5
749
756
  signing_key:
750
757
  specification_version: 4
751
758
  summary: the creative framework