atome 0.5.7.1.6 → 0.5.7.1.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c05197d3eeae9cee5e96894387b264fa64b3f0436c513d03c9bee7edd7edc7aa
4
- data.tar.gz: d21606ce307a9c85eca0207d95b502572bf287668c360228230d917672306f53
3
+ metadata.gz: 49d9ecf130f643cc65b60e7a935dd513871f3ecf0afca6b97476b57650ac0fee
4
+ data.tar.gz: 60843a34a863fc4ed3b324d0ae29913c58355eb69c7a8a732eb9445c933d256e
5
5
  SHA512:
6
- metadata.gz: 69e1cc8e30ca124fa5402bd30ea6cb302bbef0b7aa90cad60cbcf9c80cef49bfefc2dc1ba35551f5ecc8d604154fd62f7c21dc3ca6340902d1a6a2c390d18aae
7
- data.tar.gz: 4a3b520343611c272ea18853bf5449af84e35adbc8153538b1c3a969dcbaaccbe60375ba08ac97eb70e27b8cdf57ba38d0eb1f1d8d5a9ac998d80832f4a44476
6
+ metadata.gz: e599f47ecf7ab87cf472fe12d95ac2991ad3e192b85e74252304b738537ec0c513bbda6371331912ffaee9fa33be66795a2ba31ca3607296d4e910bd4b06d0b9
7
+ data.tar.gz: 5041dfd0b3600ec8b406f7a3d9bfbdc6e9e66c3e8b002ba576292d01e6277f379040d1f0f945922a21e33bcc09e8037f8889fb62caf4cb06472bad0109bba827
@@ -642,7 +642,7 @@ class Object
642
642
  end
643
643
  end
644
644
 
645
- def above(item, margin)
645
+ def above(item, margin=6)
646
646
  pos = item.to_px(:bottom) + item.height + margin
647
647
  if item.display == :none
648
648
  33
@@ -651,7 +651,7 @@ class Object
651
651
  end
652
652
  end
653
653
 
654
- def below(item, margin)
654
+ def below(item, margin=6)
655
655
  pos = item.to_px(:top) + item.to_px(:height) + margin
656
656
  if item.display == :none
657
657
  0
@@ -661,7 +661,7 @@ class Object
661
661
 
662
662
  end
663
663
 
664
- def after(item, margin)
664
+ def after(item, margin=6)
665
665
  left_f = if item.left.instance_of?(Integer)
666
666
  item.left
667
667
  else
@@ -681,7 +681,7 @@ class Object
681
681
  end
682
682
  end
683
683
 
684
- def before(item, margin)
684
+ def before(item, margin=6)
685
685
  pos = item.to_px(:right) + item.width + margin
686
686
  if item.display == :none
687
687
  0
@@ -64,6 +64,7 @@ Atome.new(
64
64
  Atome.new(
65
65
  { renderers: default_render, aid: :view,type: :shape, attach: :user_view, apply: [:view_color],
66
66
  tag: { system: true }, left: 0, right: 0, top: 0, bottom: 0, width: :auto, height: :auto, overflow: :auto,
67
+ language: :english
67
68
  }
68
69
 
69
70
  )
@@ -166,17 +167,18 @@ def init_database
166
167
 
167
168
  particles = Universe.particle_list
168
169
  # now we populate the DB
169
- A.sync({ action: :crate_db_table, data: { table: :user, type: :string } }) do |_db_state|
170
+ A.sync({ action: :create_db_table, data: { table: :user, type: :string } }) do |_db_state|
170
171
  # puts "===> #{_db_state}"
171
172
  end
172
-
173
- A.sync({ action: :create_db_column, data: { table: :user, column: :email, type: :string, unique: true } }) do |_db_state|
173
+ A.sync({ action: :create_db_table, data: { table: :atome } }) do |_db_state|
174
174
  end
175
175
 
176
- A.sync({ action: :create_db_column, data: { table: :user, column: :password, type: :string } }) do |_db_state|
176
+ A.sync({ action: :create_db_table, data: { table: :history } }) do |_db_state|
177
177
  end
178
178
 
179
- A.sync({ action: :crate_db_table, data: { table: :history } }) do |_db_state|
179
+ A.sync({ action: :create_db_column, data: { table: :user, column: :email, type: :string, unique: true } }) do |_db_state|
180
+ end
181
+ A.sync({ action: :create_db_column, data: { table: :user, column: :password, type: :string } }) do |_db_state|
180
182
  end
181
183
  A.sync({ action: :create_db_column, data: { table: :history, column: :aid, type: :string } }) do |_db_state|
182
184
  end
@@ -187,13 +189,6 @@ def init_database
187
189
  A.sync({ action: :create_db_column, data: { table: :history, column: :date, type: :datetime } }) do |_db_state|
188
190
  end
189
191
 
190
- A.sync({ action: :crate_db_table, data: { table: :atome } }) do |_db_state|
191
- end
192
- particles.each do |particle, infos|
193
- type = infos[:type]
194
- A.sync({ action: :create_db_column, data: { table: :atome, column: particle, type: type } }) do |_db_state|
195
- end
196
- end
197
192
 
198
193
  # now we send localstorage content to the server
199
194
  puts "sending localstorage"
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.7.1.6'
5
+ VERSION = '0.5.7.1.7'
6
6
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
-
4
-
5
3
  size = 33
6
4
  smooth = 3
7
5
  shadow({
@@ -25,10 +23,10 @@ class Atome
25
23
  class << self
26
24
  def init_intuition
27
25
  Atome.start_click_analysis
28
- root = Universe.tools_root
29
- root.each_with_index do |root_tool, index|
26
+ toolbox_root = Universe.tools_root
27
+ toolbox_root[:tools].each_with_index do |root_tool, index|
30
28
  tools_scheme = Universe.tools[root_tool]
31
- A.build_tool({ name: root_tool, scheme: tools_scheme, index: index })
29
+ A.build_tool({ name: root_tool, scheme: tools_scheme, index: index ,toolbox: toolbox_root[:toolbox] })
32
30
  end
33
31
  end
34
32
 
@@ -92,11 +90,11 @@ class Atome
92
90
  Universe.allow_localstorage = false
93
91
  #################################
94
92
  touch_found = atome_touched.touch
95
- touch_procs=atome_touched.instance_variable_get("@touch_code")
93
+ touch_procs = atome_touched.instance_variable_get("@touch_code")
96
94
  resize_found = atome_touched.resize
97
- resize_procs=atome_touched.instance_variable_get("@resize_code")
98
- current_tool.data[:prev_states][atome_touched] = {events: { touch: touch_found, resize: resize_found },
99
- procs: {touch_code: touch_procs, resize_code: resize_procs } }
95
+ resize_procs = atome_touched.instance_variable_get("@resize_code")
96
+ current_tool.data[:prev_states][atome_touched] = { events: { touch: touch_found, resize: resize_found },
97
+ procs: { touch_code: touch_procs, resize_code: resize_procs } }
100
98
  #################################
101
99
  current_tool.instance_exec(params, &pre) if pre.is_a? Proc
102
100
  Universe.allow_localstorage = storage_allowed
@@ -174,11 +172,15 @@ class Atome
174
172
  end
175
173
 
176
174
  def build_tool(params)
177
- label = params[:name]
175
+ # here is the main entry for tool creation
176
+ language ||= grab(:view).language
177
+
178
+ label = params.dig(:scheme, :int8, language) || params[:name]
178
179
  tool_name = "#{params[:name]}_tool"
179
180
  index = params[:index]
180
- orientation_wanted = :sn
181
181
  tool_scheme = params[:scheme]
182
+ toolbox=params[:toolbox] || {}
183
+ orientation_wanted = tool_scheme[:orientation] || :sn
182
184
  color({ id: :active_tool_col, alpha: 1, red: 1, green: 1, blue: 1 })
183
185
  color({ id: :inactive_tool_col, alpha: 0.6 })
184
186
  grab(:intuition).storage[:tool_open] ||= []
@@ -188,8 +190,10 @@ class Atome
188
190
  case orientation_wanted
189
191
  when :sn
190
192
  top = :auto
191
- bottom = index * (size + 3)
192
- left = 0
193
+ bottom_offset=toolbox[:bottom] || 3
194
+ spacing = toolbox[:spacing] || 3
195
+ bottom = index * (size + spacing)+bottom_offset
196
+ left = toolbox[:left] || 3
193
197
  right = :auto
194
198
  when :ns
195
199
  when :ew
@@ -231,7 +235,18 @@ class Atome
231
235
  }
232
236
 
233
237
  })
234
- tool.vector({ tag: { system: true }, left: 9, top: :auto, bottom: 9, width: 18, height: 18, id: "#{tool_name}_icon" })
238
+ edition = "M257.7 752c2 0 4-0.2 6-0.5L431.9 722c2-0.4 3.9-1.3 5.3-2.8l423.9-423.9c3.9-3.9 3.9-10.2 0-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2c-1.9 11.1 1.5 21.9 9.4 29.8 6.6 6.4 14.9 9.9 23.8 9.9z m67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"
239
+
240
+ icon= tool.vector({ tag: { system: true }, left: 9, top: :auto, bottom: 9, width: 18, height: 18, id: "#{tool_name}_icon",
241
+ data: { path: { d: edition, id: :p1, stroke: :black, 'stroke-width' => 37, fill: :white } }})
242
+ # wait 2 do
243
+ # alert "#{tool_name}_icon"
244
+ # alert "current vector : #{grab("#{tool_name}_icon").id}"
245
+ grab("#{tool_name}_icon").color(:blue)
246
+ # icon.color(:red)
247
+ # end
248
+ # icon= tool_scheme[:icon] || params[:name]
249
+ # tool.image({path: "medias/images/icons/#{icon}.svg"})
235
250
  tool.text({ tag: { system: true }, data: label, component: { size: 9 }, color: :grey, id: "#{tool_name}_label" })
236
251
  code_for_zone = tool_scheme[:zone]
237
252
  tool.instance_exec(tool, &code_for_zone) if code_for_zone.is_a? Proc
@@ -129,7 +129,6 @@ new(molecule: :list) do |params, _bloc|
129
129
  # let's create the container
130
130
  new_atome = { renderers: renderer_found, attach: list.id }.merge(styles_found).merge({ type: :shape })
131
131
 
132
-
133
132
  el = Atome.new(new_atome)
134
133
  if action
135
134
  el.touch(action[:touch]) do
@@ -329,11 +328,11 @@ class Atome
329
328
 
330
329
  width(params[:width])
331
330
  height(params[:height])
332
- current_matrix=self
331
+ current_matrix = self
333
332
  real_width = current_matrix.to_px(:width)
334
333
  real_height = current_matrix.to_px(:height)
335
334
  spacing = current_matrix.data[:spacing]
336
- matrix_cells= current_matrix.data[:matrix]
335
+ matrix_cells = current_matrix.data[:matrix]
337
336
 
338
337
  total_spacing_x = spacing * (matrix_cells.collect.length ** (0.5) + 1)
339
338
  total_spacing_y = spacing * (matrix_cells.collect.length ** (0.5) + 1)
@@ -363,13 +362,21 @@ class Atome
363
362
  end
364
363
 
365
364
  new(molecule: :matrix) do |params, &bloc|
366
- id = params[:id]
367
- rows = params[:rows]
368
- columns = params[:columns]
369
- spacing = params[:spacing]
370
- size = params[:size]
365
+ params ||= {}
366
+ # We test if self is main if so we attach the matrix to the view
367
+ parent_found = if self == self
368
+ grab(:view)
369
+ else
370
+ self
371
+ end
372
+
373
+ id = params[:id] || identity_generator
374
+ rows = params[:rows] || 8
375
+ columns = params[:columns] || 8
376
+ spacing = params[:spacing] || 6
377
+ size = params[:size] || '100%'
371
378
 
372
- parent_found = self
379
+ # parent_found = self
373
380
  current_matrix = group({ id: id })
374
381
 
375
382
  current_matrix.data({ spacing: spacing, size: size })
@@ -414,7 +421,7 @@ new(molecule: :matrix) do |params, &bloc|
414
421
  end
415
422
  current_matrix.collect(matrix_cells)
416
423
  matrix_back.cells(current_matrix)
417
- params= params.merge({matrix: current_matrix})
424
+ params = params.merge({ matrix: current_matrix })
418
425
  matrix_back.data(params)
419
426
  matrix_back
420
427
  end
@@ -1,2 +1,204 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+
4
+ ########################### Test check and verification below ############################
5
+
6
+ new({ tool: :blur }) do |params|
7
+
8
+ active_code = lambda {
9
+ puts :alteration_tool_code_activated
10
+ }
11
+
12
+ inactive_code = lambda { |param|
13
+ puts :alteration_tool_code_inactivated
14
+ }
15
+ pre_code = lambda { |params|
16
+ puts "pre_creation_code,atome_touched: #{:params}"
17
+
18
+ }
19
+ post_code = lambda { |params|
20
+ puts "post_creation_code,atome_touched: #{:params}"
21
+
22
+ }
23
+
24
+ zone_spe = lambda { |current_tool|
25
+ puts "current tool is : #{:current_tool} now creating specific zone"
26
+ # b = box({ width: 33, height: 12 })
27
+ # b.text({ data: :all })
28
+
29
+ }
30
+
31
+ {
32
+ activation: active_code,
33
+ inactivation: inactive_code,
34
+ alteration: { width: 22, blur: 3 },
35
+ pre: pre_code,
36
+ post: post_code,
37
+ zone: zone_spe,
38
+ icon: :color,
39
+ int8: { french: :couleur, english: :color, german: :colorad } }
40
+
41
+ end
42
+
43
+ new({ tool: :box }) do |params|
44
+
45
+ active_code = lambda {
46
+ puts :creation_tool_code_activated
47
+ }
48
+
49
+ inactive_code = lambda { |atomes_treated|
50
+ puts :creation_tool_code_inactivated
51
+
52
+ }
53
+ pre_creation_code = lambda { |params|
54
+ puts "pre_creation_code : atome_touched : #{:params} "
55
+
56
+ }
57
+
58
+ post_creation_code = lambda { |params|
59
+ puts "post_creation_code,atome_touched: #{:params}"
60
+ }
61
+
62
+ { creation: { box: { color: :blue, width: 66, height: 66 } },
63
+ activation: active_code,
64
+ inactivation: inactive_code,
65
+ pre: pre_creation_code,
66
+ post: post_creation_code,
67
+ int8: { french: :formes, english: :shape, german: :jesaispas } }
68
+
69
+ end
70
+
71
+
72
+ new({ tool: :project }) do
73
+ active_code = lambda {
74
+
75
+ alert :get_projects_now
76
+ # if Atome.selection.instance_of? Array
77
+ # end
78
+ # Atome.selection.each do |atome_id_to_treat|
79
+ # # # # reinit first to avoid multiple drag event
80
+ # # # grab(atome_id_to_treat).drag(false)
81
+ # end
82
+ # drag_remove
83
+ # puts :alteration_tool_code_activated
84
+ }
85
+ { activation: active_code }
86
+ end
87
+
88
+ new({tool: :test}) do
89
+ active_code = lambda {
90
+ b=grab(:view).box({})
91
+ b.touch(true) do
92
+ alert :kool
93
+ end
94
+ }
95
+ # active_code=:tito
96
+ { activation: active_code }
97
+ end
98
+
99
+
100
+ Universe.tools_root= {tools: [:blur, :box, :test],toolbox: { orientation: :ew, left:9 , bottom: 9, spacing: 9} }
101
+ # Universe.tools_root=[:test]
102
+ Atome.init_intuition
103
+
104
+ wait 1 do
105
+ grab(:blur_tool_icon).color(:red)
106
+ wait 1 do
107
+ grab(:box_tool_icon).color(:red)
108
+ wait 1 do
109
+ grab(:test_tool_icon).color(:red)
110
+ end
111
+ end
112
+ end
113
+
114
+
115
+ # ################### check below
116
+
117
+ # b = box({ left: 123, top: 66, selected: false, id: :the_box, color: :green })
118
+ # b.touch(:down) do
119
+ # puts " on touch : #{Universe.allow_localstorage}"
120
+ # end
121
+ # b.resize(true) do
122
+ # puts :good!
123
+ # end
124
+ # the_circ = circle({ left: 123, top: 120, selected: false, id: :the_circle })
125
+ #
126
+ # the_circ.touch(:down) do |params|
127
+ # puts " down : params: #{params}, id: #{the_circ.id}"
128
+ # end
129
+ #
130
+ # the_circ.touch(:up) do
131
+ # puts "up :kool"
132
+ # end
133
+ # the_circ.drag(true) do
134
+ # puts "drag : now"
135
+ # end
136
+ #
137
+ # bb = box({ left: 333, width: 120, selected: false, id: :big_box })
138
+ #
139
+ # b = box({ id: :the_big_boxy })
140
+
141
+ #################@
142
+ # text({ data: :hello, selected: true, left: 120, id: :texting, blur: 12 })
143
+ # text({data: :hello, left: 120, id: :texting})
144
+ # Universe.tools.each_with_index do |(tool_name, bloc), index|
145
+ # Atome.instance_exec(&bloc) if bloc.is_a?(Proc)
146
+ # # alert "#{tool_name} : #{tool_content}"
147
+ # # alert b.id
148
+ # end
149
+
150
+ # wait 2 do
151
+ # # c.preset( {:box=>{:width=>39, :height=>39, :apply=>[:box_color], :left=>0, :top=>0}} )
152
+ # c.preset( :box )
153
+ # end
154
+ # b=box({left: 333, top: 333})
155
+ # b.touch(true) do
156
+ # alert Atome.selection
157
+ # end
158
+ # grab(:the_texting).color(:white)
159
+ # grab(:the_texting).left(33)
160
+ # grab(:the_texting).top(133)
161
+ # grab(:the_texting).width(133)
162
+ # grab(:the_texting).top(133)
163
+ # grab(:the_texting).data(:kool)
164
+ # grab(:the_texting).type(:text)
165
+ # grab(:the_texting).rotate(:text)
166
+
167
+ # b=box
168
+ # b.touch(true) do
169
+ # puts :ok
170
+ # # alert b.instance_variable_get('@touch')
171
+ # # alert b.instance_variable_get('@touch_code')
172
+ # b.touch(false)
173
+ # wait 3 do
174
+ # puts :ready
175
+ # b.touch(true) do
176
+ # puts :kool
177
+ # end
178
+ # # alert b.touch
179
+ # # alert b.instance_variable_get('@touch')
180
+ # # alert b.instance_variable_get('@touch_code')
181
+ # end
182
+ # end
183
+
184
+ # A.html.record
185
+
186
+ # A.html.record
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+ # edition = "M257.7 752c2 0 4-0.2 6-0.5L431.9 722c2-0.4 3.9-1.3 5.3-2.8l423.9-423.9c3.9-3.9 3.9-10.2 0-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2c-1.9 11.1 1.5 21.9 9.4 29.8 6.6 6.4 14.9 9.9 23.8 9.9z m67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"
195
+ #
196
+ # v = vector({left: 99, data: { path: { d: edition, id: :p1, stroke: :black, 'stroke-width' => 37, fill: :red } } })
197
+ # v2 = vector({top: 66,data: { circle: { cx: 300, cy: 300, r: 340, id: :p2, stroke: :blue, 'stroke-width' => 35, fill: :yellow } } } )
198
+ # wait 1 do
199
+ # v.color(:blue)
200
+ # wait 1 do
201
+ # v2.color(:blue)
202
+ # end
203
+ # end
204
+
@@ -32,21 +32,9 @@ class Database
32
32
  end
33
33
  end
34
34
 
35
- # def create_column(table, column_name, type)
36
- # eden = Sequel.connect("sqlite://eden.sqlite3")
37
- # if eden.table_exists?(table)
38
- # unless eden.schema(table).any? { |column| column.first == column_name }
39
- # Sequel.migration do
40
- # change do
41
- # add_column table, column_name, type
42
- # end
43
- # end.apply(eden, :up)
44
- # end
45
- # end
46
- # end
47
35
  def create_column(table, column_name, type)
48
36
  eden = Sequel.connect("sqlite://eden.sqlite3")
49
- if eden.table_exists?(table)
37
+ if eden.table_exists?(table) || !eden.schema(table).any? { |col| col[0] == column_name }
50
38
  begin
51
39
  Sequel.migration do
52
40
  change do
@@ -54,10 +42,14 @@ class Database
54
42
  end
55
43
  end.apply(eden, :up)
56
44
  rescue Sequel::DatabaseError => e
57
- puts "error adding column : #{e.message}"
45
+ puts "column #{e.message} already exist"
58
46
  end
59
47
  end
48
+
60
49
  end
50
+
51
+
52
+
61
53
  end
62
54
 
63
55
  end
@@ -234,7 +234,7 @@ class EDen
234
234
  { data: { message: 'database_ready' }, message_id: message_id }
235
235
  end
236
236
 
237
- def crate_db_table(data, message_id, ws)
237
+ def create_db_table(data, message_id, ws)
238
238
  table = data['table']
239
239
  type = data['type']
240
240
  primary = data['primary']
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.7.1.6
4
+ version: 0.5.7.1.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-05-28 00:00:00.000000000 Z
11
+ date: 2024-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eventmachine