atome 0.5.3.8.0 → 0.5.3.8.1

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: a7a73219833a1b762ef00a884f0799800a1b638742057c29352c98c4208f47df
4
- data.tar.gz: 7b343fa8cecaa21084ab2e764ce251b38dc954a8ff97d49e1a951fdcd18760fc
3
+ metadata.gz: fd6a8f4f6c72f5e9d1974bcf411e6ce19c3469953d39a1ad7ef7de1497626b60
4
+ data.tar.gz: 2e22cbbe3428e8506c1855fd0dadccfa55e6725912d5adf746963f0754e50884
5
5
  SHA512:
6
- metadata.gz: 482d2e6986aef0fa1ff7dc11df7b89e62fb9fab3211196f9ef5b8be39050478d6735b24e99e9b0e263fdd0fbfcc1fc323ed28ee26daeb7871294ff847cf37d16
7
- data.tar.gz: d81ed5c1b4c5e5eacdc3cb85726d0e3d81781726c052bff148664fcf8fd11843f2af975ac3478be9c18b2cffd3cb6cf8a11c6a77de896b528095cc894b378fdf
6
+ metadata.gz: '0769c9974cf27f2b275d540baf5f5d22a3a30b979be3c41972fbb246400925864f14299e3fddf4acdf07a89952949dbcbaa96056f14439d27fbb0896d4c4a727'
7
+ data.tar.gz: 6450a2fa9015d97cd14ca151324d9a70065a4893bd343f80936032ff6f8197ac7d80180d69eb959e5257a622905cb96830ee05dc03aa35c15820e92ca3fc3709
data/exe/atome CHANGED
@@ -124,11 +124,10 @@ end
124
124
 
125
125
  def browser_case(location)
126
126
  # `cd #{location}/src;open index.html`
127
- guard_check
127
+ # `echo jello`
128
+ # guard_check
128
129
  end
129
130
 
130
- #
131
-
132
131
  def osx_case(location)
133
132
  `cd #{location};cargo tauri dev`
134
133
  end
data/lib/atome/atome.rb CHANGED
@@ -3,34 +3,50 @@
3
3
  # TODO : remove monitoring
4
4
  # TODO : remove child
5
5
  # TODO : remove parents
6
-
6
+ # new({ particle: :type })
7
+ # create_particle(:type, true, true)
7
8
  # main entry here
8
9
  class Atome
9
10
  # TODO : clean or delete @private_atome
10
11
  include Essentials
12
+
11
13
  private
12
14
 
13
15
  def initialize(atomes = {}, &atomes_proc)
16
+ # puts "atome are #{atomes}"
14
17
  atomes.each_value do |elements|
15
18
  # the instance variable below contain the id all any atomes that need to be informed when changes occurs
16
19
  @broadcast = {}
17
20
  # now we store the proc in a an atome's property called :bloc
18
21
  elements[:code] = atomes_proc if atomes_proc
19
22
  @atome = elements
20
- # we initiate the rendering, eg for for browser we will call :browser_type generate method in identity.rb file
21
- create_particle(:type, true, true)
22
- # set type is a particle method it's dynamically generated at : generator/identity.rb
23
- set_type(@atome[:type])
23
+ # we initiate the rendering suing set_type method,
24
+ # eg for for browser we will call :browser_type generate method in identity.rb file
25
+ set_type(@atome[:type], &atomes_proc)
24
26
  collapse
27
+
25
28
  end
26
29
  end
27
30
 
31
+ def set_type(params, &atomes_proc)
32
+ # @atome[params]
33
+ # puts "params is : #{@atome[:children]}"
34
+ # @atome[:children]={shapes: [params]}
35
+ # @atome[:shape]=:poil
36
+ # puts "type is : #{@atome[params].class}"
37
+ # unless @atome[params]
38
+ # @atome[params] = []
39
+ # end
40
+ # @atome[params] << params
41
+ rendering(:type, params, &atomes_proc)
42
+ end
43
+
28
44
  def new_particle(element, store, render, &method_proc)
29
45
  Atome.define_method element do |params = nil, &user_proc|
30
46
  if params || params == false
31
47
  # the line below execute the proc created when using the build_particle method
32
48
  instance_exec(params, user_proc, &method_proc) if method_proc.is_a?(Proc)
33
- params = sanitize(element, params,&user_proc)
49
+ params = sanitize(element, params, &user_proc)
34
50
  create_particle(element, store, render)
35
51
  send("set_#{element}", params, &user_proc)
36
52
  else
@@ -55,20 +71,20 @@ class Atome
55
71
  send("set_#{element}", params, &user_proc)
56
72
  end
57
73
 
58
- def atome_initializer(element, params = {})
59
- temp_default = Essentials.default_params[element] || {}
60
- generated_render = params[:renderers] || []
61
- generated_id = params[:id] || identity_generator(:element)
62
-
63
- generated_parents = params[:parents] || [id.value]
64
- generated_children = params[:children] || []
65
- temp_default[:id] = generated_id
66
- temp_default[:parents] = generated_parents
67
- temp_default[:clones] = []
68
- temp_default[:renderers] = generated_render
69
- temp_default[:children] = generated_children
70
- temp_default.merge(params)
71
- end
74
+ # def atome_initializer(element, params = {})
75
+ # temp_default = Essentials.default_params[element] || {}
76
+ # generated_render = params[:renderers] || []
77
+ # generated_id = params[:id] || identity_generator(:element)
78
+ # alert "generated_parents: #{id.value}"
79
+ # generated_parents = params[:parents] || [id.value]
80
+ # generated_children = params[:children] || []
81
+ # temp_default[:id] = generated_id
82
+ # temp_default[:parents] = generated_parents
83
+ # temp_default[:clones] = []
84
+ # temp_default[:renderers] = generated_render
85
+ # temp_default[:children] = generated_children
86
+ # temp_default.merge(params)
87
+ # end
72
88
 
73
89
  def new_atome(element, &method_proc)
74
90
  Atome.define_method element do |params = nil, &user_proc|
@@ -119,10 +135,10 @@ class Atome
119
135
  # Params is now an instance variable so it should be passed thru different methods
120
136
  instance_variable_set("@#{element}", params) if store
121
137
  run_optional_proc("pre_render_#{element}".to_sym, self, params, &user_proc)
122
- rendering(element,params, &user_proc) if render
138
+ rendering(element, params, &user_proc) if render
123
139
  run_optional_proc("post_render_#{element}".to_sym, self, params, &user_proc)
124
140
  broadcasting(element)
125
- store_value(element) if store
141
+ store_value(element) if store
126
142
  self
127
143
  end
128
144
 
@@ -46,7 +46,8 @@ end
46
46
  def create_method_at_object_level(element)
47
47
 
48
48
  Object.define_method element do |params, &user_proc|
49
- grab(:view).send(element, params, &user_proc)
49
+ default_parent=Essentials.default_params[element][:parents][0]# we get the first parents
50
+ grab(default_parent).send(element, params, &user_proc)
50
51
  end
51
52
 
52
53
  end
@@ -1,15 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- new({ atome: :color })
3
+ new({ atome: :color, type: :hash })
4
4
 
5
5
  new({ sanitizer: :color }) do |params|
6
6
  parent_found = found_parents_and_renderers[:parent]
7
- if parent_found == [:view]
8
- parent_found = [:black_matter] if parent_found == [:view]
7
+ if parent_found == [:black_matter]
8
+
9
9
  elsif color.value
10
10
  # we delete any previous color if there's one
11
11
  detached(color.value)
12
- grab(color.value)&.delete(true)# we had the condition because the color may exist but
12
+ grab(color.value)&.delete(true) # we had the condition because the color may exist but
13
13
  # so it is not sanitized so it has no id
14
14
  end
15
15
 
@@ -61,7 +61,7 @@ new({ sanitizer: :shadow }) do |params|
61
61
  elsif shadow.value
62
62
  # we delete any previous color if there's one
63
63
  detached(shadow.value)
64
- grab(shadow.value)&.delete(true)# we had the condition because the shadow may exist but
64
+ grab(shadow.value)&.delete(true) # we had the condition because the shadow may exist but
65
65
  # so it is not sanitized so it has no id
66
66
  end
67
67
  ## we delete any previous shadow if there's one
@@ -123,7 +123,7 @@ new({ sanitizer: :animation }) do |params|
123
123
  params = atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
124
124
  params
125
125
  end
126
- new({ atome: :text })
126
+ new({ atome: :text, type: :hash })
127
127
  new({ sanitizer: :text }) do |params|
128
128
  params = { data: params } unless params.instance_of? Hash
129
129
  default_renderer = Essentials.default_params[:render_engines]
@@ -31,6 +31,12 @@ class Atome
31
31
  def build_atome(atome_name, &atome_proc)
32
32
  # we add the new method to the atome's collection of methods
33
33
  Universe.add_to_atome_list(atome_name)
34
+ unless Essentials.default_params[atome_name]
35
+ # if it doesn't exist
36
+ # we create default params for the new created atome, adding the hash to : module essential , @default_params
37
+ Essentials.new_default_params(atome_name => { type: atome_name, children: [], parents: [:view] })
38
+ end
39
+
34
40
  # the line below create an empty atome method for each renderer, eg: browser_left, headless_left, ...
35
41
  auto_render_generator(atome_name)
36
42
  new_atome(atome_name, &atome_proc)
@@ -4,27 +4,27 @@
4
4
  module Essentials
5
5
  @default_params = {
6
6
  render_engines: [:browser],
7
- collector: { type: :element, renderers: [], children: [] },
8
- animation: { type: :animation, children: [] },
9
- element: { type: :element, renderers: [], children: [] },
10
- matrix: { renderers: [], id: '', type: :shape, parents: [], width: 99, height: 99,
7
+ collector: { type: :element, renderers: [], children: [], parents: [:black_matter] },
8
+ animation: { type: :animation, children: [] , parents: [:black_matter]},
9
+ element: { type: :element, renderers: [], children: [] , parents: [:black_matter]},
10
+ matrix: { renderers: [], id: '', type: :shape, width: 99, height: 99,
11
11
  attached: [:matrix_color], children: [],
12
- left: 100, top: 100, clones: [], preset: :matrix },
13
- box: { renderers: [], id: '', type: :shape, parents: [], width: 99, height: 99,
14
- attached: [:box_color], children: [],
12
+ left: 100, top: 100, clones: [], preset: :matrix, parents: [:view] },
13
+ box: { renderers: [], id: '', type: :shape, width: 99, height: 99,
14
+ attached: [:box_color], children: [], parents: [:view],
15
15
  left: 100, top: 100, clones: [], preset: :box },
16
- circle: { renderers: [], id: '', type: :shape, parents: [], width: 99, height: 99, smooth: '100%',
17
- attached: [:circle_color], children: [],
16
+ circle: { renderers: [], id: '', type: :shape, width: 99, height: 99, smooth: '100%',
17
+ attached: [:circle_color], children: [], parents: [:view],
18
18
  left: 100, top: 100, clones: [], preset: :circle },
19
- shape: { renderers: [], id: '', type: :shape, parents: [], width: 99, height: 99,
20
- attached: [:shape_color], children: [],
19
+ shape: { renderers: [], id: '', type: :shape, width: 99, height: 99,
20
+ attached: [:shape_color], children: [], parents: [:view],
21
21
  left: 100, top: 100, clones: [] },
22
- text: { renderers: [], id: '', type: :text, parents: [:view], visual: { size: 25 },
23
- attached: [:text_color], children: [],
22
+ text: { renderers: [], id: '', type: :text, visual: { size: 25 },
23
+ attached: [:text_color], children: [], parents: [:view],
24
24
  data: 'this is a text sample', width: 199, height: 33, clones: [] },
25
- drm: { type: :drm },
26
- shadow: {},
27
- color: {}
25
+ drm: { type: :drm,parents: [:black_matter] },
26
+ shadow: {parents: [:black_matter]},
27
+ color: {parents: [:black_matter]}
28
28
  }
29
29
 
30
30
  def self.default_params
@@ -32,6 +32,7 @@ module Essentials
32
32
  end
33
33
 
34
34
  def self.new_default_params(new_default)
35
+ # puts "=====+====> #{new_default}, #{new_default.class}"
35
36
  @default_params.merge!(new_default)
36
37
  end
37
38
 
@@ -6,7 +6,6 @@ class Atome
6
6
 
7
7
  def collapse
8
8
  @atome.each do |element, value|
9
- # puts "=============> #{element}"
10
9
  send(element, value) unless element == :type
11
10
  end
12
11
  end
@@ -89,9 +88,14 @@ class Atome
89
88
  @atome[particle] << value
90
89
  end
91
90
 
91
+ def add_to_atome(atome_found, particle_found, &user_proc)
92
+ puts "we add : #{particle_found} to #{send(atome_found)} "
93
+ send(atome_found,particle_found,:adder, &user_proc)
94
+ end
95
+
92
96
  def add(particles, &user_proc)
93
97
  particles.each do |particle, value|
94
- particle_type = Universe.particle_list[particle]
98
+ particle_type = Universe.particle_list[particle] || 'atome'
95
99
  send("add_to_#{particle_type}", particle, value, &user_proc)
96
100
  end
97
101
  end
data/lib/atome/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Atome
4
- VERSION = '0.5.3.8.0'
4
+ VERSION = '0.5.3.8.1'
5
5
  end
@@ -8,7 +8,7 @@ top touch video wait web width]
8
8
  wait 1 * index do
9
9
  puts toto
10
10
  read("examples/#{toto}.rb", :ruby)
11
- `console.clear()`
11
+ # `console.clear()`
12
12
  end
13
13
  end
14
14
  end
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.3.8.0
4
+ version: 0.5.3.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: 2023-02-15 00:00:00.000000000 Z
11
+ date: 2023-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: arduino_firmata