atome 0.5.6.7.8 → 0.5.6.8.3
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 +4 -4
- data/lib/atome/atome.rb +4 -1
- data/lib/atome/extensions/atome.rb +13 -0
- data/lib/atome/genesis/genesis.rb +74 -0
- data/lib/atome/genesis/particles/communication.rb +13 -3
- data/lib/atome/genesis/particles/property.rb +10 -1
- data/lib/atome/genesis/particles/utility.rb +11 -1
- data/lib/atome/kernel/universe.rb +13 -5
- data/lib/atome/presets/atome.rb +6 -1
- data/lib/atome/utilities/essentials.rb +3 -0
- data/lib/atome/version.rb +1 -1
- data/lib/molecules/intuition/utillities.rb +258 -67
- data/lib/renderers/html/html.rb +1 -0
- data/vendor/assets/application/examples/alternate.rb +20 -2
- data/vendor/assets/application/examples/behavior.rb +32 -0
- data/vendor/assets/application/examples/executor.rb +36 -0
- data/vendor/assets/application/examples/holder.rb +62 -0
- data/vendor/assets/application/examples/input.rb +35 -0
- data/vendor/assets/application/examples/list.rb +5 -4
- data/vendor/assets/application/examples/sliders.rb +13 -2
- data/vendor/assets/src/js/atome/atome_helpers/communication.js +4 -4
- metadata +6 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 56128962742a3c148f7ce1187577af8438466642a81d1b227e0c3ab66275e322
         | 
| 4 | 
            +
              data.tar.gz: aada78b1931101f52fe14e414e0396e9e15eb03754005d0836b1198f1b0091ac
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 817bee9de2868ed5983838b98a6b650423f04dbf4d5f35ceb20c2315b6ae54c991465e31c2e10ee74f8300d963e4106e53d036f1ecbd2ef10d668783e3194cc9
         | 
| 7 | 
            +
              data.tar.gz: 6f075107a7e5b85f33ae0d0e757025a0702447365d7ffdb048b65a4f89138ac3d8e95acfb53b795b9a9743b2229692bae3edf32f17597a5bdc5e578dc26cede5
         | 
    
        data/lib/atome/atome.rb
    CHANGED
    
    | @@ -5,6 +5,8 @@ | |
| 5 5 | 
             
            # Atome.instance_variable_set('@initialized',{})
         | 
| 6 6 | 
             
            class Atome
         | 
| 7 7 | 
             
              include Essentials
         | 
| 8 | 
            +
              # controller_proc is used to stack multiple procs from native controller
         | 
| 9 | 
            +
              attr_accessor :controller_proc
         | 
| 8 10 |  | 
| 9 11 | 
             
              def aid(_v = nil)
         | 
| 10 12 | 
             
                @aid
         | 
| @@ -36,6 +38,7 @@ class Atome | |
| 36 38 | 
             
                # @language = :english
         | 
| 37 39 | 
             
                # @callback = {}
         | 
| 38 40 | 
             
                @tag = {}
         | 
| 41 | 
            +
                @behavior = {}
         | 
| 39 42 | 
             
                @selected = false
         | 
| 40 43 | 
             
                #@metrics = {}
         | 
| 41 44 | 
             
                @unit = {}
         | 
| @@ -44,7 +47,7 @@ class Atome | |
| 44 47 | 
             
                @int8 = {}
         | 
| 45 48 | 
             
                @css = {}
         | 
| 46 49 | 
             
                @aid = identity_generator
         | 
| 47 | 
            -
             | 
| 50 | 
            +
                @controller_proc=[]
         | 
| 48 51 | 
             
                @id = new_atome[:id] || @aid
         | 
| 49 52 | 
             
                Universe.atomes.each do |_aid,atome_f|
         | 
| 50 53 | 
             
                  # we affect the already existing atome to target
         | 
| @@ -51,6 +51,10 @@ module ObjectExtension | |
| 51 51 | 
             
                  #     alert option
         | 
| 52 52 | 
             
                  #     bloc.call(option)
         | 
| 53 53 | 
             
                  #   end
         | 
| 54 | 
            +
                elsif params.key?(:molecule)
         | 
| 55 | 
            +
                  molecule=params[:molecule]
         | 
| 56 | 
            +
                  Genesis.build_molecule(molecule, &bloc)
         | 
| 57 | 
            +
                  Universe.add_to_molecule_list(molecule)
         | 
| 54 58 | 
             
                end
         | 
| 55 59 | 
             
                super if defined?(super)
         | 
| 56 60 | 
             
              end
         | 
| @@ -156,6 +160,10 @@ class Object | |
| 156 160 | 
             
                grab(:view).box(params, &proc)
         | 
| 157 161 | 
             
              end
         | 
| 158 162 |  | 
| 163 | 
            +
              # def intuition(params = {}, &proc)
         | 
| 164 | 
            +
              #   grab(:view).intuition(params, &proc)
         | 
| 165 | 
            +
              # end
         | 
| 166 | 
            +
             | 
| 159 167 | 
             
              def circle(params = {}, &proc)
         | 
| 160 168 | 
             
                grab(:view).circle(params, &proc)
         | 
| 161 169 | 
             
              end
         | 
| @@ -661,6 +669,11 @@ class CssProxy | |
| 661 669 | 
             
                @current_atome.instance_variable_get('@css').to_s
         | 
| 662 670 | 
             
              end
         | 
| 663 671 |  | 
| 672 | 
            +
              def receptor(msg, &bloc)
         | 
| 673 | 
            +
                parsed = JSON.parse(msg)
         | 
| 674 | 
            +
                bloc.call(parsed)
         | 
| 675 | 
            +
              end
         | 
| 676 | 
            +
             | 
| 664 677 | 
             
            end
         | 
| 665 678 |  | 
| 666 679 |  | 
| @@ -50,6 +50,12 @@ class Genesis | |
| 50 50 | 
             
                  new_atome(atome_name, &atome_proc)
         | 
| 51 51 |  | 
| 52 52 | 
             
                end
         | 
| 53 | 
            +
                def build_molecule(molecule_name, &molecule_proc)
         | 
| 54 | 
            +
                  new_molecule(molecule_name, &molecule_proc)
         | 
| 55 | 
            +
                end
         | 
| 56 | 
            +
             | 
| 57 | 
            +
             | 
| 58 | 
            +
             | 
| 53 59 |  | 
| 54 60 | 
             
                def auto_render_generator(element)
         | 
| 55 61 | 
             
                  Universe.renderer_list.each do |render_engine|
         | 
| @@ -193,6 +199,74 @@ class Genesis | |
| 193 199 |  | 
| 194 200 | 
             
                end
         | 
| 195 201 |  | 
| 202 | 
            +
                def new_molecule(molecule, &method_proc)
         | 
| 203 | 
            +
             | 
| 204 | 
            +
                  Molecule.define_method molecule do |params, &user_proc|
         | 
| 205 | 
            +
                    m= instance_exec(params, user_proc, &method_proc) if method_proc.is_a?(Proc)
         | 
| 206 | 
            +
                    m
         | 
| 207 | 
            +
                  end
         | 
| 208 | 
            +
             | 
| 209 | 
            +
             | 
| 210 | 
            +
             | 
| 211 | 
            +
                  # # the method define below is the slowest but params are analysed and sanitized
         | 
| 212 | 
            +
                  # Atome.define_method element do |params = nil, &user_proc|
         | 
| 213 | 
            +
                  #   instance_exec(params, user_proc, &method_proc) if method_proc.is_a?(Proc)
         | 
| 214 | 
            +
                  #   if params
         | 
| 215 | 
            +
                  #     params = atome_sanitizer(element, params, &user_proc)
         | 
| 216 | 
            +
                  #     atome_processor(element, params, &user_proc)
         | 
| 217 | 
            +
                  #   else
         | 
| 218 | 
            +
                  #     # when no params passed whe assume teh user want a getter,
         | 
| 219 | 
            +
                  #     # as getter should give us all atome of a given within the atome
         | 
| 220 | 
            +
                  #     # ex : puts a.shape => return all atome with the type 'shape' in this atome
         | 
| 221 | 
            +
                  #     collected_atomes = []
         | 
| 222 | 
            +
                  #     # attached.each do |attached_atome|
         | 
| 223 | 
            +
                  #     #   collected_atomes << attached_atome if grab(attached_atome).type.to_sym == element.to_sym
         | 
| 224 | 
            +
                  #     # end
         | 
| 225 | 
            +
                  #     # TODO : add category for atome( material/physical vs modifier : color, shadow, .. vs shape, image ..)
         | 
| 226 | 
            +
                  #     # then add condition same things fo code in presets/atome atome_common
         | 
| 227 | 
            +
                  #     if %i[color shadow paint border].include?(element)
         | 
| 228 | 
            +
                  #       # we do the same for apply to be able to retrieve 'color' and other atome that apply instead of being attached
         | 
| 229 | 
            +
                  #       @apply.each do |attached_atome|
         | 
| 230 | 
            +
                  #         collected_atomes << attached_atome if grab(attached_atome).type.to_sym == element.to_sym
         | 
| 231 | 
            +
                  #       end
         | 
| 232 | 
            +
                  #     else
         | 
| 233 | 
            +
                  #       # collected_atomes = attached
         | 
| 234 | 
            +
                  #       # if @attached
         | 
| 235 | 
            +
                  #       attached.each do |attached_atome|
         | 
| 236 | 
            +
                  #         collected_atomes << attached_atome if grab(attached_atome).type.to_sym == element.to_sym
         | 
| 237 | 
            +
                  #       end
         | 
| 238 | 
            +
                  #       # end
         | 
| 239 | 
            +
                  #
         | 
| 240 | 
            +
                  #     end
         | 
| 241 | 
            +
                  #     # TODO/ FIXME : potential problem with group  here"
         | 
| 242 | 
            +
                  #     # group({ collect: collected_atomes })
         | 
| 243 | 
            +
                  #     collected_atomes
         | 
| 244 | 
            +
                  #   end
         | 
| 245 | 
            +
                  # end
         | 
| 246 | 
            +
                  #
         | 
| 247 | 
            +
                  # # the method define below is the fastest params are passed directly
         | 
| 248 | 
            +
                  # Atome.define_method "set_#{element}" do |params, &user_proc|
         | 
| 249 | 
            +
                  #   # we generate the corresponding module here:
         | 
| 250 | 
            +
                  #   # Object.const_set(element, Module.new)
         | 
| 251 | 
            +
                  #   # we add the newly created atome to the list of "child in it's category, eg if it's a shape we add the new atome
         | 
| 252 | 
            +
                  #   # to the shape particles list : @!atome[:shape] << params[:id]
         | 
| 253 | 
            +
                  #   # Atome.new(params, &user_proc)
         | 
| 254 | 
            +
                  #
         | 
| 255 | 
            +
                  #   if Universe.atomes[params[:id]]
         | 
| 256 | 
            +
                  #     # if atome id already exist we grab the previous one
         | 
| 257 | 
            +
                  #     # this prevent the creation of new atome if the atome already exist
         | 
| 258 | 
            +
                  #     previous_atome= grab(params[:id])
         | 
| 259 | 
            +
                  #     # now we must re-affect affected atomes
         | 
| 260 | 
            +
                  #     previous_atome.affect(params[:affect])
         | 
| 261 | 
            +
                  #     previous_atome
         | 
| 262 | 
            +
                  #   else
         | 
| 263 | 
            +
                  #     Atome.new(params, &user_proc)
         | 
| 264 | 
            +
                  #   end
         | 
| 265 | 
            +
                  #   # Now we return the newly created atome instead of the current atome that is the parent cf: b=box; c=b.circle
         | 
| 266 | 
            +
                  # end
         | 
| 267 | 
            +
             | 
| 268 | 
            +
                end
         | 
| 269 | 
            +
             | 
| 196 270 | 
             
              end
         | 
| 197 271 |  | 
| 198 272 | 
             
            end
         | 
| @@ -20,9 +20,7 @@ new({ particle: :message, category: :communication, type: :hash }) do |params, b | |
| 20 20 |  | 
| 21 21 | 
             
            end
         | 
| 22 22 |  | 
| 23 | 
            -
             | 
| 24 | 
            -
              Atome.controller_sender(msg)
         | 
| 25 | 
            -
            end
         | 
| 23 | 
            +
             | 
| 26 24 |  | 
| 27 25 | 
             
            new({ particle: :int8, category: :communication, type: :int })
         | 
| 28 26 |  | 
| @@ -30,4 +28,16 @@ new({ particle: :language, category: :communication, type: :string }) do |params | |
| 30 28 | 
             
              @data = int8[params]
         | 
| 31 29 | 
             
              params
         | 
| 32 30 | 
             
            end
         | 
| 31 | 
            +
            # method below are used for communication with ntaive core
         | 
| 32 | 
            +
            def receptor(msg)
         | 
| 33 | 
            +
              parsed = JSON.parse(msg)
         | 
| 34 | 
            +
              A.controller_code[:controller].call(parsed)
         | 
| 35 | 
            +
            end
         | 
| 33 36 |  | 
| 37 | 
            +
            new({ particle: :controller, category: :communication, type: :hash }) do |msg|
         | 
| 38 | 
            +
              Atome.controller_sender(msg)
         | 
| 39 | 
            +
            end
         | 
| 40 | 
            +
             | 
| 41 | 
            +
            new({post: :controller}) do |_p, bloc|
         | 
| 42 | 
            +
              @controller_proc << bloc
         | 
| 43 | 
            +
            end
         | 
| @@ -134,4 +134,13 @@ new({particle: :inside, render: false}) | |
| 134 134 | 
             
            new({ initialized: :inside }) do |params, &user_proc|
         | 
| 135 135 | 
             
              render(:inside, params, &user_proc)
         | 
| 136 136 | 
             
            end
         | 
| 137 | 
            -
            new({ particle: :margin })
         | 
| 137 | 
            +
            new({ particle: :margin })
         | 
| 138 | 
            +
             | 
| 139 | 
            +
            new({ particle: :value }) do |val|
         | 
| 140 | 
            +
              pro_f = behavior[:value]
         | 
| 141 | 
            +
              instance_exec(val, &pro_f) if pro_f.is_a?(Proc)
         | 
| 142 | 
            +
              val
         | 
| 143 | 
            +
            end
         | 
| 144 | 
            +
             | 
| 145 | 
            +
             | 
| 146 | 
            +
            new({ particle: :behavior })
         | 
| @@ -234,4 +234,14 @@ new ({ particle: :css, category: :utility, type: :string }) | |
| 234 234 |  | 
| 235 235 | 
             
            new({ read: :css }) do
         | 
| 236 236 | 
             
              CssProxy.new(js, nil, self)
         | 
| 237 | 
            -
            end
         | 
| 237 | 
            +
            end
         | 
| 238 | 
            +
             | 
| 239 | 
            +
            new({particle: :holder, category: :utility, type: :atome})
         | 
| 240 | 
            +
             | 
| 241 | 
            +
            # this particle is mainly used in conjunction with alternate particle as a 'lambda' to alternate  methods
         | 
| 242 | 
            +
            new({particle: :executor, category: :utility, type: :hash}) do |params|
         | 
| 243 | 
            +
              params.each do |method, opt|
         | 
| 244 | 
            +
                send(method, opt)
         | 
| 245 | 
            +
              end
         | 
| 246 | 
            +
              params
         | 
| 247 | 
            +
            end
         | 
| @@ -6,6 +6,7 @@ class Universe | |
| 6 6 | 
             
              @atomes = {}
         | 
| 7 7 | 
             
              @atomes_ids = {}
         | 
| 8 8 | 
             
              @atome_list = []
         | 
| 9 | 
            +
              @molecule_list = []
         | 
| 9 10 | 
             
              @particle_list = {}
         | 
| 10 11 | 
             
              @renderer_list = %i[html browser headless server log]
         | 
| 11 12 | 
             
              @sanitizers = {}
         | 
| @@ -24,7 +25,7 @@ class Universe | |
| 24 25 | 
             
              @database_ready = false
         | 
| 25 26 | 
             
              # @historicize=false
         | 
| 26 27 | 
             
              class << self
         | 
| 27 | 
            -
                attr_reader :atomes, :atomes_ids, :renderer_list, :atome_list, :particle_list, :classes, :counter, :atomes_specificities
         | 
| 28 | 
            +
                attr_reader :atomes, :atomes_ids, :renderer_list,:molecule_list, :atome_list, :particle_list, :classes, :counter, :atomes_specificities
         | 
| 28 29 | 
             
                attr_accessor :connected,:allow_sync, :allow_localstorage, :database_ready
         | 
| 29 30 |  | 
| 30 31 | 
             
                def messages
         | 
| @@ -68,7 +69,8 @@ class Universe | |
| 68 69 | 
             
                end
         | 
| 69 70 |  | 
| 70 71 | 
             
                def add_to_particle_list(particle = nil, type, category)
         | 
| 71 | 
            -
                  instance_variable_get('@particle_list')[particle] = { type: type, category: category }
         | 
| 72 | 
            +
                  # instance_variable_get('@particle_list')[particle] = { type: type, category: category }
         | 
| 73 | 
            +
                  @particle_list[particle] = { type: type, category: category }
         | 
| 72 74 | 
             
                end
         | 
| 73 75 |  | 
| 74 76 | 
             
                def add_atomes_specificities atome_type_to_add
         | 
| @@ -87,16 +89,22 @@ class Universe | |
| 87 89 |  | 
| 88 90 | 
             
                def add_sanitizer_method(method_name, &method_proc)
         | 
| 89 91 | 
             
                  # this method is used to add sanitizer methods
         | 
| 90 | 
            -
                  instance_variable_get('@sanitizers').merge!({ method_name => method_proc })
         | 
| 92 | 
            +
                  # instance_variable_get('@sanitizers').merge!({ method_name => method_proc })
         | 
| 93 | 
            +
                  @sanitizers.merge!({ method_name => method_proc })
         | 
| 91 94 | 
             
                end
         | 
| 92 95 |  | 
| 93 96 | 
             
                def get_sanitizer_method(method_name)
         | 
| 94 97 | 
             
                  # this method is used to add optional methods
         | 
| 95 | 
            -
                  instance_variable_get('@sanitizers')[method_name]
         | 
| 98 | 
            +
                  # instance_variable_get('@sanitizers')[method_name]
         | 
| 99 | 
            +
                  @sanitizers[method_name]
         | 
| 96 100 | 
             
                end
         | 
| 97 101 |  | 
| 98 102 | 
             
                def add_to_atome_list(atome)
         | 
| 99 | 
            -
                   | 
| 103 | 
            +
                  @atome_list.push(atome)
         | 
| 104 | 
            +
                end
         | 
| 105 | 
            +
             | 
| 106 | 
            +
                def add_to_molecule_list(molecule)
         | 
| 107 | 
            +
                  @molecule_list.push(molecule)
         | 
| 100 108 | 
             
                end
         | 
| 101 109 |  | 
| 102 110 | 
             
                def add_to_atomes(aid, atome)
         | 
    
        data/lib/atome/presets/atome.rb
    CHANGED
    
    | @@ -54,12 +54,17 @@ class Atome | |
| 54 54 | 
             
              end
         | 
| 55 55 |  | 
| 56 56 | 
             
              def box(params = {}, &bloc)
         | 
| 57 | 
            -
             | 
| 58 57 | 
             
                atome_preset = :box
         | 
| 59 58 | 
             
                params = atome_common(atome_preset, params)
         | 
| 60 59 | 
             
                preset_common(params, &bloc)
         | 
| 61 60 | 
             
              end
         | 
| 62 61 |  | 
| 62 | 
            +
              # def intuition(params = {}, &bloc)
         | 
| 63 | 
            +
              #   atome_preset = :intuition
         | 
| 64 | 
            +
              #   params = atome_common(atome_preset, params)
         | 
| 65 | 
            +
              #   preset_common(params, &bloc)
         | 
| 66 | 
            +
              # end
         | 
| 67 | 
            +
             | 
| 63 68 | 
             
              def circle(params = {}, &bloc)
         | 
| 64 69 | 
             
                atome_preset = :circle
         | 
| 65 70 | 
             
                params = atome_common(atome_preset, params)
         | 
| @@ -25,6 +25,9 @@ module Essentials | |
| 25 25 | 
             
                box: { type: :shape, width: 39, height: 39,
         | 
| 26 26 | 
             
                       apply: [:box_color],
         | 
| 27 27 | 
             
                       left: 0, top: 0,  preset: :box },
         | 
| 28 | 
            +
                # intuition: { type: :intuition, width: 39, height: 39,
         | 
| 29 | 
            +
                #        apply: [:box_color],
         | 
| 30 | 
            +
                #        left: 0, top: 0,  preset: :intuition },
         | 
| 28 31 | 
             
                vector: { type: :vector, width: 39, height: 39,
         | 
| 29 32 | 
             
                          left: 0, top: 0,  preset: :vector, definition: corp },
         | 
| 30 33 | 
             
                circle: { type: :shape, width: 39, height: 39, smooth: '100%',
         | 
    
        data/lib/atome/version.rb
    CHANGED
    
    
| @@ -1,78 +1,269 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 | 
            -
             | 
| 4 | 
            -
               | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
             | 
| 31 | 
            -
                   | 
| 3 | 
            +
            new(molecule: :input) do |params, bloc|
         | 
| 4 | 
            +
              params[:height] ||= 15
         | 
| 5 | 
            +
              params[:width] ||= 222
         | 
| 6 | 
            +
              trigger = params.delete(:trigger)
         | 
| 7 | 
            +
              trigger ||= :return
         | 
| 8 | 
            +
              limit = params.delete(:limit)
         | 
| 9 | 
            +
              limit ||= 15
         | 
| 10 | 
            +
              back_col = params.delete(:back)
         | 
| 11 | 
            +
              back_col ||= :grey
         | 
| 12 | 
            +
              text_col = params.delete(:text)
         | 
| 13 | 
            +
              text_col ||= :black
         | 
| 14 | 
            +
              default_text = params.delete(:default)
         | 
| 15 | 
            +
              default_text ||= :input
         | 
| 16 | 
            +
              default_parent = if self.instance_of?(Atome)
         | 
| 17 | 
            +
                                 id
         | 
| 18 | 
            +
                               else
         | 
| 19 | 
            +
                                 :view
         | 
| 20 | 
            +
                               end
         | 
| 21 | 
            +
              attach_to = params[:attach] || default_parent
         | 
| 22 | 
            +
              renderer_found = grab(attach_to).renderers
         | 
| 23 | 
            +
              input_back = Atome.new(
         | 
| 24 | 
            +
                { renderers: renderer_found, type: :shape, color: back_col,
         | 
| 25 | 
            +
                  left: 0, top: 0, data: '', attach: attach_to,
         | 
| 26 | 
            +
                  smooth: 6, overflow: :hidden,
         | 
| 27 | 
            +
                })
         | 
| 28 | 
            +
             | 
| 29 | 
            +
              text_input = Atome.new(
         | 
| 30 | 
            +
                { renderers: [:html], type: :text, color: text_col, component: { size: params[:height] },
         | 
| 31 | 
            +
                  data: default_text, left: params[:height] * 20 / 100, top: 0, edit: true, attach: input_back.id, height: params[:height],
         | 
| 32 | 
            +
                  position: :absolute
         | 
| 33 | 
            +
                }
         | 
| 34 | 
            +
              )
         | 
| 35 | 
            +
             | 
| 36 | 
            +
              text_input.touch(:down) do
         | 
| 37 | 
            +
                text_input.edit(true)
         | 
| 38 | 
            +
              end
         | 
| 39 | 
            +
             | 
| 40 | 
            +
              text_input.keyboard(:down) do |native_event|
         | 
| 41 | 
            +
                # text_input.component({ selected: { color: :red, text: :red } })
         | 
| 42 | 
            +
             | 
| 43 | 
            +
                event = Native(native_event)
         | 
| 44 | 
            +
                if event[:keyCode].to_s == '8' || event[:keyCode].to_s == '46'
         | 
| 45 | 
            +
                  # always allow
         | 
| 46 | 
            +
                elsif event[:keyCode].to_s == '13'
         | 
| 47 | 
            +
                  # we prevent the input
         | 
| 48 | 
            +
                  if trigger == :return
         | 
| 49 | 
            +
                    bloc.call(text_input.data)
         | 
| 50 | 
            +
                  end
         | 
| 51 | 
            +
                  text_input.edit(false)
         | 
| 52 | 
            +
                  event.preventDefault()
         | 
| 53 | 
            +
                elsif text_input.data.length > limit
         | 
| 54 | 
            +
                  event.preventDefault()
         | 
| 55 | 
            +
                end
         | 
| 56 | 
            +
                if trigger == :down
         | 
| 57 | 
            +
                  bloc.call(text_input.data)
         | 
| 32 58 | 
             
                end
         | 
| 33 | 
            -
                slider
         | 
| 34 59 | 
             
              end
         | 
| 35 60 |  | 
| 36 | 
            -
               | 
| 37 | 
            -
                 | 
| 38 | 
            -
                 | 
| 39 | 
            -
             | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 42 | 
            -
             | 
| 43 | 
            -
             | 
| 44 | 
            -
             | 
| 45 | 
            -
             | 
| 46 | 
            -
             | 
| 47 | 
            -
             | 
| 48 | 
            -
             | 
| 49 | 
            -
             | 
| 50 | 
            -
             | 
| 51 | 
            -
             | 
| 52 | 
            -
             | 
| 53 | 
            -
             | 
| 54 | 
            -
             | 
| 55 | 
            -
                 | 
| 56 | 
            -
             | 
| 61 | 
            +
              text_input.keyboard(:up) do |native_event|
         | 
| 62 | 
            +
                input_back.data = text_input.data
         | 
| 63 | 
            +
                if trigger == :up
         | 
| 64 | 
            +
                  bloc.call(text_input.data)
         | 
| 65 | 
            +
                end
         | 
| 66 | 
            +
              end
         | 
| 67 | 
            +
              params.each do |part_f, val_f|
         | 
| 68 | 
            +
                input_back.send(part_f, val_f)
         | 
| 69 | 
            +
              end
         | 
| 70 | 
            +
              input_back.holder(text_input)
         | 
| 71 | 
            +
              input_back
         | 
| 72 | 
            +
            end
         | 
| 73 | 
            +
            new(molecule: :list) do |params, _bloc|
         | 
| 74 | 
            +
             | 
| 75 | 
            +
              styles_found = params.delete(:styles)
         | 
| 76 | 
            +
              element = params.delete(:element)
         | 
| 77 | 
            +
              listing = params.delete(:listing)
         | 
| 78 | 
            +
             | 
| 79 | 
            +
              styles_found ||= {
         | 
| 80 | 
            +
                width: 99,
         | 
| 81 | 
            +
                height: 33,
         | 
| 82 | 
            +
                margin: 6,
         | 
| 83 | 
            +
                shadow: { blur: 9, left: 3, top: 3, id: :cell_shadow, red: 0, green: 0, blue: 0, alpha: 0.6 },
         | 
| 84 | 
            +
                left: 0,
         | 
| 85 | 
            +
                color: :yellowgreen
         | 
| 86 | 
            +
              }
         | 
| 87 | 
            +
              element ||= { width: 33,
         | 
| 88 | 
            +
                            height: 33,
         | 
| 89 | 
            +
                            left: :center,
         | 
| 90 | 
            +
                            top: :center,
         | 
| 91 | 
            +
                            color: :orange,
         | 
| 92 | 
            +
                            type: :text }
         | 
| 93 | 
            +
              unless params[:width]
         | 
| 94 | 
            +
                params[:width] = styles_found[:width]
         | 
| 95 | 
            +
              end
         | 
| 96 | 
            +
              unless element[:width]
         | 
| 97 | 
            +
                element[:width] = styles_found[width]
         | 
| 98 | 
            +
              end
         | 
| 99 | 
            +
              margin = styles_found[:margin]
         | 
| 100 | 
            +
              height_found = styles_found[:height]
         | 
| 101 | 
            +
             | 
| 102 | 
            +
              # lets create the listing container
         | 
| 103 | 
            +
              default_parent = if self.instance_of?(Atome)
         | 
| 104 | 
            +
                                 id
         | 
| 105 | 
            +
                               else
         | 
| 106 | 
            +
                                 :view
         | 
| 107 | 
            +
                               end
         | 
| 108 | 
            +
              attach_to = params[:attach] || default_parent
         | 
| 109 | 
            +
              renderer_found = grab(attach_to).renderers
         | 
| 110 | 
            +
              list = Atome.new({ renderers: renderer_found, type: :shape,  color: { alpha: 0 }, attach: attach_to }.merge(params))
         | 
| 111 | 
            +
              # Atome.new(
         | 
| 112 | 
            +
              #     { renderers: [:html], type: :shape, attach: :view, color: back_col,
         | 
| 113 | 
            +
              #       left: 0, top: 0, data: '', attach: attach_to,
         | 
| 114 | 
            +
              #       smooth: 6, overflow: :hidden,
         | 
| 115 | 
            +
              #     })
         | 
| 116 | 
            +
              # now the listing
         | 
| 117 | 
            +
              listing.each_with_index do |data, index|
         | 
| 118 | 
            +
                # let's create the container
         | 
| 119 | 
            +
                new_atome = { renderers: renderer_found, attach: list.id }.merge(styles_found).merge({ type: :shape })
         | 
| 120 | 
            +
                el = Atome.new(new_atome)
         | 
| 121 | 
            +
                el.top((height_found + margin) * index)
         | 
| 122 | 
            +
                # now the content
         | 
| 123 | 
            +
                Atome.new({ renderers: renderer_found, attach: el.id }.merge(element).merge(data))
         | 
| 124 | 
            +
             | 
| 125 | 
            +
              end
         | 
| 126 | 
            +
              list
         | 
| 127 | 
            +
            end
         | 
| 128 | 
            +
            new({ molecule: :slider }) do |params, bloc|
         | 
| 129 | 
            +
             | 
| 130 | 
            +
              default_value = params[:value] ||= 0
         | 
| 131 | 
            +
              orientation = params.delete(:orientation) || :horizontal
         | 
| 132 | 
            +
              range_found = params.delete(:range)
         | 
| 133 | 
            +
              min_value = params.delete(:min) || 0
         | 
| 134 | 
            +
              max_value = params.delete(:max) || 100
         | 
| 135 | 
            +
              color_found = params[:color] ||= :gray
         | 
| 136 | 
            +
              default_smooth = 9
         | 
| 137 | 
            +
              default_slider_particles = { color: color_found, width: 333, height: 33, left: 0, top: 0, smooth: default_smooth }
         | 
| 138 | 
            +
              default_cursor_particles = { color: color_found, width: 29, height: 29, left: 0, smooth: '100%' }
         | 
| 139 | 
            +
              cursor_found = params.delete(:cursor)
         | 
| 140 | 
            +
              slider_particle = default_slider_particles.merge(params)
         | 
| 141 | 
            +
              slider = box(slider_particle)
         | 
| 142 | 
            +
             | 
| 143 | 
            +
              slider_shadow = slider.shadow({
         | 
| 144 | 
            +
                                              id: :s2,
         | 
| 145 | 
            +
                                              left: 3, top: 3, blur: 9,
         | 
| 146 | 
            +
                                              invert: true,
         | 
| 147 | 
            +
                                              red: 0, green: 0, blue: 0, alpha: 0.7
         | 
| 148 | 
            +
                                            })
         | 
| 149 | 
            +
             | 
| 150 | 
            +
              range = slider.box({ id: "#{slider.id}_range", top: :auto, bottom: 0 })
         | 
| 151 | 
            +
             | 
| 152 | 
            +
              if range_found
         | 
| 153 | 
            +
                range.apply(slider_shadow.id,)
         | 
| 154 | 
            +
                range_found.each do |part, val|
         | 
| 155 | 
            +
                  range.send(part, val)
         | 
| 57 156 | 
             
                end
         | 
| 58 | 
            -
             | 
| 59 | 
            -
             | 
| 157 | 
            +
              else
         | 
| 158 | 
            +
                range.color({ alpha: 0 })
         | 
| 159 | 
            +
              end
         | 
| 160 | 
            +
              cursor_particle = default_cursor_particles.merge(cursor_found).merge({ id: "#{slider.id}_cursor" })
         | 
| 161 | 
            +
              cursor = slider.box(cursor_particle)
         | 
| 162 | 
            +
              cursor_left = (slider_particle[:width] - cursor_particle[:width]) / 2.0
         | 
| 163 | 
            +
              cursor_top = (slider_particle[:height] - cursor_particle[:height]) / 2.0
         | 
| 164 | 
            +
             | 
| 165 | 
            +
              my_behavior = lambda() do |new_value|
         | 
| 166 | 
            +
                if orientation == :vertical
         | 
| 167 | 
            +
                  if cursor.width < slider.width
         | 
| 168 | 
            +
                    range.width(cursor.width)
         | 
| 169 | 
            +
                    range.left(cursor_left)
         | 
| 170 | 
            +
                  else
         | 
| 171 | 
            +
                    range.width(slider.width)
         | 
| 172 | 
            +
                    range.smooth(default_smooth)
         | 
| 173 | 
            +
                  end
         | 
| 174 | 
            +
                  cursor_top_initial = ((max_value - new_value).to_f / (max_value - min_value)) * (slider_particle[:height] - cursor_particle[:height])
         | 
| 175 | 
            +
                  bloc.call(new_value)
         | 
| 176 | 
            +
                  slider.instance_variable_set('@value',new_value)
         | 
| 177 | 
            +
                  cursor.top(cursor_top_initial)
         | 
| 178 | 
            +
                  cursor.left(cursor_left)
         | 
| 179 | 
            +
                  range.height((slider.height - cursor.top) - cursor.height / 2)
         | 
| 180 | 
            +
                else
         | 
| 181 | 
            +
                  if cursor.height < slider.height
         | 
| 182 | 
            +
                    range.height(cursor.height)
         | 
| 183 | 
            +
                    range.top(cursor_top)
         | 
| 184 | 
            +
                  else
         | 
| 185 | 
            +
                    range.height(slider.height)
         | 
| 186 | 
            +
                    range.smooth(default_smooth)
         | 
| 187 | 
            +
                  end
         | 
| 188 | 
            +
                  cursor_left_initial = ((new_value - min_value).to_f / (max_value - min_value)) * (slider_particle[:width] - cursor_particle[:width])
         | 
| 189 | 
            +
                  bloc.call(new_value)
         | 
| 190 | 
            +
                  slider.instance_variable_set('@value',new_value)
         | 
| 191 | 
            +
                  cursor.left(cursor_left_initial)
         | 
| 192 | 
            +
                  cursor.top(cursor_top)
         | 
| 193 | 
            +
                  range.width(cursor.left + cursor.width / 2)
         | 
| 60 194 | 
             
                end
         | 
| 61 | 
            -
             | 
| 62 | 
            -
             | 
| 63 | 
            -
                renderer_found = renderers
         | 
| 64 | 
            -
                # lets create the listing container
         | 
| 65 | 
            -
                list = box({ attach: id, color: { alpha: 0 } }.merge(params))
         | 
| 66 | 
            -
                # now the listing
         | 
| 67 | 
            -
                listing.each_with_index do |data, index|
         | 
| 68 | 
            -
                  # let's create the container
         | 
| 69 | 
            -
                  new_atome = { renderers: renderer_found, attach: list.id }.merge(styles_found).merge({ type: :shape })
         | 
| 70 | 
            -
                  el = Atome.new(new_atome)
         | 
| 71 | 
            -
                  el.top((height_found + margin) * index)
         | 
| 72 | 
            -
                  # now the content
         | 
| 73 | 
            -
                  Atome.new({ renderers: renderer_found, attach: el.id }.merge(element).merge(data))
         | 
| 195 | 
            +
              end
         | 
| 196 | 
            +
              slider.behavior({ value: my_behavior })
         | 
| 74 197 |  | 
| 198 | 
            +
              update_value = lambda do |cursor_position, cursor_size, slider_size, orientation|
         | 
| 199 | 
            +
                effective_slider_size = slider_size - cursor_size
         | 
| 200 | 
            +
                if orientation == :vertical
         | 
| 201 | 
            +
                  percentage = 1.0 - (cursor_position.to_f / effective_slider_size)
         | 
| 202 | 
            +
                else
         | 
| 203 | 
            +
                  percentage = cursor_position.to_f / effective_slider_size
         | 
| 75 204 | 
             
                end
         | 
| 76 | 
            -
                 | 
| 205 | 
            +
                value_range = max_value - min_value
         | 
| 206 | 
            +
                calculated_value = min_value + (value_range * percentage).round
         | 
| 207 | 
            +
                calculated_value.clamp(min_value, max_value)
         | 
| 77 208 | 
             
              end
         | 
| 209 | 
            +
             | 
| 210 | 
            +
              if orientation == :vertical
         | 
| 211 | 
            +
                if cursor.width < slider.width
         | 
| 212 | 
            +
                  range.width(cursor.width)
         | 
| 213 | 
            +
                  range.left(cursor_left)
         | 
| 214 | 
            +
                else
         | 
| 215 | 
            +
                  range.width(slider.width)
         | 
| 216 | 
            +
                  range.smooth(default_smooth)
         | 
| 217 | 
            +
                end
         | 
| 218 | 
            +
             | 
| 219 | 
            +
                cursor_top_initial = ((max_value - default_value).to_f / (max_value - min_value)) * (slider_particle[:height] - cursor_particle[:height])
         | 
| 220 | 
            +
                bloc.call(default_value)
         | 
| 221 | 
            +
                cursor.top(cursor_top_initial)
         | 
| 222 | 
            +
                cursor.left(cursor_left)
         | 
| 223 | 
            +
                range.height((slider.height - cursor.top) - cursor.height / 2)
         | 
| 224 | 
            +
                # now the event
         | 
| 225 | 
            +
                cursor.drag({ restrict: { max: { top: slider_particle[:height] - cursor_particle[:height], left: cursor_left }, min: { left: cursor_left } } }) do |event|
         | 
| 226 | 
            +
                  value = update_value.call(cursor.top, cursor_particle[:height], slider_particle[:height], orientation)
         | 
| 227 | 
            +
                  range.height((slider.height - cursor.top) - cursor.height / 2)
         | 
| 228 | 
            +
                  bloc.call(value)
         | 
| 229 | 
            +
                  slider.instance_variable_set('@value',value)
         | 
| 230 | 
            +
                end
         | 
| 231 | 
            +
             | 
| 232 | 
            +
              else
         | 
| 233 | 
            +
             | 
| 234 | 
            +
                if cursor.height < slider.height
         | 
| 235 | 
            +
                  range.height(cursor.height)
         | 
| 236 | 
            +
                  range.top(cursor_top)
         | 
| 237 | 
            +
                else
         | 
| 238 | 
            +
                  range.height(slider.height)
         | 
| 239 | 
            +
                  range.smooth(default_smooth)
         | 
| 240 | 
            +
                end
         | 
| 241 | 
            +
             | 
| 242 | 
            +
                cursor_left_initial = ((default_value - min_value).to_f / (max_value - min_value)) * (slider_particle[:width] - cursor_particle[:width])
         | 
| 243 | 
            +
                bloc.call(default_value)
         | 
| 244 | 
            +
                cursor.left(cursor_left_initial)
         | 
| 245 | 
            +
                cursor.top(cursor_top)
         | 
| 246 | 
            +
                range.width(cursor.left + cursor.width / 2)
         | 
| 247 | 
            +
             | 
| 248 | 
            +
                # now the event
         | 
| 249 | 
            +
                cursor.drag({ restrict: { max: { left: slider_particle[:width] - cursor_particle[:width], top: cursor_top }, min: { top: cursor_top } } }) do |event|
         | 
| 250 | 
            +
                  value = update_value.call(cursor.left, cursor_particle[:width], slider_particle[:width], orientation)
         | 
| 251 | 
            +
                  range.width(cursor.left + cursor.width / 2)
         | 
| 252 | 
            +
                  bloc.call(value)
         | 
| 253 | 
            +
                  slider.instance_variable_set('@value',value)
         | 
| 254 | 
            +
                end
         | 
| 255 | 
            +
              end
         | 
| 256 | 
            +
              cursor.touch(:double) do
         | 
| 257 | 
            +
                slider.value(default_value)
         | 
| 258 | 
            +
              end
         | 
| 259 | 
            +
             | 
| 260 | 
            +
              cursor.shadow({
         | 
| 261 | 
            +
                              id: :s4,
         | 
| 262 | 
            +
                              left: 1, top: 1, blur: 3,
         | 
| 263 | 
            +
                              option: :natural,
         | 
| 264 | 
            +
                              red: 0, green: 0, blue: 0, alpha: 0.6
         | 
| 265 | 
            +
                            })
         | 
| 266 | 
            +
              slider
         | 
| 267 | 
            +
             | 
| 78 268 | 
             
            end
         | 
| 269 | 
            +
            new({ particle: :behavior })
         | 
    
        data/lib/renderers/html/html.rb
    CHANGED
    
    
| @@ -1,4 +1,14 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 | 
            +
            def act_on(obj)
         | 
| 3 | 
            +
              obj.color(:red)
         | 
| 4 | 
            +
              obj.left(56)
         | 
| 5 | 
            +
            end
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            def act_off(obj)
         | 
| 8 | 
            +
              obj.color(:blue)
         | 
| 9 | 
            +
              obj.left(33)
         | 
| 10 | 
            +
            end
         | 
| 11 | 
            +
             | 
| 2 12 |  | 
| 3 13 | 
             
            b = box({ left: 12, id: :the_first_box, top: 30 })
         | 
| 4 14 |  | 
| @@ -6,7 +16,7 @@ b.touch(true) do | |
| 6 16 | 
             
              b.alternate({ width: 33, color: :red, height: 33 , smooth: 0 }, { width: 66, color: :orange, blur: 8}, { height: 66, color: :green, smooth: 9, blur: 0})
         | 
| 7 17 | 
             
            end
         | 
| 8 18 |  | 
| 9 | 
            -
            c = circle({ left:  | 
| 19 | 
            +
            c = circle({ left: 99 , top: 30})
         | 
| 10 20 |  | 
| 11 21 | 
             
            c.touch(true) do
         | 
| 12 22 | 
             
              alt = b.alternate(true, false)
         | 
| @@ -15,4 +25,12 @@ c.touch(true) do | |
| 15 25 | 
             
              else
         | 
| 16 26 | 
             
                c.color(:orange)
         | 
| 17 27 | 
             
              end
         | 
| 18 | 
            -
            end
         | 
| 28 | 
            +
            end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
             | 
| 31 | 
            +
            c2 = circle({ left: 333 , top: 30})
         | 
| 32 | 
            +
             | 
| 33 | 
            +
             | 
| 34 | 
            +
            c2.touch(true) do
         | 
| 35 | 
            +
              b.alternate({  executor: {act_on: b}  }, { executor: {act_off: b}})
         | 
| 36 | 
            +
            end
         | 
| @@ -0,0 +1,32 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            # Behaviors allow you to add specific code to any particle, enabling the particle to behave differently.
         | 
| 4 | 
            +
            # Here, when the first box receives a value, it behaves differently from the second box even if they received
         | 
| 5 | 
            +
            # the same params .
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            text({ data: :hello, id: :the_txt, left: 120 })
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            b=box
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            my_lambda= lambda do |new_value|
         | 
| 12 | 
            +
              grab(:the_txt).color(:red)
         | 
| 13 | 
            +
            end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            b.behavior({value: my_lambda})
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            my_second_lambda= lambda do |new_value|
         | 
| 18 | 
            +
              grab(:the_txt).data('from cirle')
         | 
| 19 | 
            +
            end
         | 
| 20 | 
            +
            c=box({top: 69})
         | 
| 21 | 
            +
            c.behavior({value: my_second_lambda})
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            wait 1 do
         | 
| 24 | 
            +
              c.value(:ok)
         | 
| 25 | 
            +
            end
         | 
| 26 | 
            +
            wait 2 do
         | 
| 27 | 
            +
              b.value(:ok)
         | 
| 28 | 
            +
            end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
             | 
| 31 | 
            +
             | 
| 32 | 
            +
             | 
| @@ -0,0 +1,36 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
            def act_on(obj)
         | 
| 3 | 
            +
              obj.color(:red)
         | 
| 4 | 
            +
              obj.left(56)
         | 
| 5 | 
            +
            end
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            def act_off(obj)
         | 
| 8 | 
            +
              obj.color(:blue)
         | 
| 9 | 
            +
              obj.left(33)
         | 
| 10 | 
            +
            end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
             | 
| 13 | 
            +
            b = box({ left: 12, id: :the_first_box, top: 30 })
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            b.touch(true) do
         | 
| 16 | 
            +
              b.alternate({ width: 33, color: :red, height: 33 , smooth: 0 }, { width: 66, color: :orange, blur: 8}, { height: 66, color: :green, smooth: 9, blur: 0})
         | 
| 17 | 
            +
            end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            c = circle({ left: 99 , top: 30})
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            c.touch(true) do
         | 
| 22 | 
            +
              alt = b.alternate(true, false)
         | 
| 23 | 
            +
              if alt
         | 
| 24 | 
            +
                c.color(:yellowgreen)
         | 
| 25 | 
            +
              else
         | 
| 26 | 
            +
                c.color(:orange)
         | 
| 27 | 
            +
              end
         | 
| 28 | 
            +
            end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
             | 
| 31 | 
            +
            c2 = circle({ left: 333 , top: 30})
         | 
| 32 | 
            +
             | 
| 33 | 
            +
             | 
| 34 | 
            +
            c2.touch(true) do
         | 
| 35 | 
            +
              b.alternate({  executor: {act_on: b}  }, { executor: {act_off: b}})
         | 
| 36 | 
            +
            end
         | 
| @@ -0,0 +1,62 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
            # holder is a particle that contain an atome so we use my_objet.holder.left(33)
         | 
| 3 | 
            +
            # and it will move the atome contain in the holder particle to be manipulated
         | 
| 4 | 
            +
            # it facilitate the access of some atome without being worried about their id
         | 
| 5 | 
            +
            # this is mainly used int context of input , slider , etc...
         | 
| 6 | 
            +
             | 
| 7 | 
            +
             | 
| 8 | 
            +
            # simple example
         | 
| 9 | 
            +
            b=box({color: :black})
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            c=b.circle({width: 10, height: 10, color: :red})
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            b.holder(c)
         | 
| 14 | 
            +
            wait 1 do
         | 
| 15 | 
            +
              b.holder.center(true)
         | 
| 16 | 
            +
            end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
             | 
| 19 | 
            +
             | 
| 20 | 
            +
             | 
| 21 | 
            +
             | 
| 22 | 
            +
             | 
| 23 | 
            +
            # second example ( holder is build in the input molecule)
         | 
| 24 | 
            +
            text({ left: 33, top: 33, data: 'data collected', id: :infos })
         | 
| 25 | 
            +
             | 
| 26 | 
            +
            inp = A.input({ width: 166,
         | 
| 27 | 
            +
                            trigger: :up,
         | 
| 28 | 
            +
                            back: :orange,
         | 
| 29 | 
            +
                            shadow: {
         | 
| 30 | 
            +
                              id: :s2,
         | 
| 31 | 
            +
                              left: 3, top: 3, blur: 3,
         | 
| 32 | 
            +
                              invert: true,
         | 
| 33 | 
            +
                              red: 0, green: 0, blue: 0, alpha: 0.9
         | 
| 34 | 
            +
                            },
         | 
| 35 | 
            +
                            text: :black,
         | 
| 36 | 
            +
                            smooth: 3,
         | 
| 37 | 
            +
                            left: 66,
         | 
| 38 | 
            +
                            top: 33,
         | 
| 39 | 
            +
                            default: 'type here'
         | 
| 40 | 
            +
                          }) do |val|
         | 
| 41 | 
            +
             | 
| 42 | 
            +
              grab(:infos).data(val)
         | 
| 43 | 
            +
            end
         | 
| 44 | 
            +
             | 
| 45 | 
            +
            wait 2 do
         | 
| 46 | 
            +
              inp.top(12)
         | 
| 47 | 
            +
              wait 1 do
         | 
| 48 | 
            +
                inp.width(666)
         | 
| 49 | 
            +
                inp.holder.blur(6)
         | 
| 50 | 
            +
                wait 1 do
         | 
| 51 | 
            +
                  inp.holder.blur(0)
         | 
| 52 | 
            +
                  inp.holder.data('injected data')
         | 
| 53 | 
            +
                end
         | 
| 54 | 
            +
              end
         | 
| 55 | 
            +
             | 
| 56 | 
            +
            end
         | 
| 57 | 
            +
             | 
| 58 | 
            +
             | 
| 59 | 
            +
             | 
| 60 | 
            +
             | 
| 61 | 
            +
             | 
| 62 | 
            +
             | 
| @@ -0,0 +1,35 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
            t = text({ left: 33, top: 33, data: 'data collected', id: :infos })
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            inp=input({ width: 166,
         | 
| 5 | 
            +
                          trigger: :up,
         | 
| 6 | 
            +
                          back: :orange,
         | 
| 7 | 
            +
                          shadow: {
         | 
| 8 | 
            +
                            id: :s2,
         | 
| 9 | 
            +
                            left: 3, top: 3, blur: 3,
         | 
| 10 | 
            +
                            invert: true,
         | 
| 11 | 
            +
                            red: 0, green: 0, blue: 0, alpha: 0.9
         | 
| 12 | 
            +
                          },
         | 
| 13 | 
            +
                          attach: :intuition,
         | 
| 14 | 
            +
                          text: :black,
         | 
| 15 | 
            +
                          smooth: 3,
         | 
| 16 | 
            +
                          left: 66,
         | 
| 17 | 
            +
                          top: 33,
         | 
| 18 | 
            +
                          default: 'type here'
         | 
| 19 | 
            +
                        }) do |val|
         | 
| 20 | 
            +
             | 
| 21 | 
            +
              grab(:infos).data(val)
         | 
| 22 | 
            +
            end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            inp.top(12)
         | 
| 25 | 
            +
             | 
| 26 | 
            +
              wait 1 do
         | 
| 27 | 
            +
                inp.width(666)
         | 
| 28 | 
            +
                wait 1 do
         | 
| 29 | 
            +
                  inp.holder.data('new data')
         | 
| 30 | 
            +
                end
         | 
| 31 | 
            +
            end
         | 
| 32 | 
            +
             | 
| 33 | 
            +
             | 
| 34 | 
            +
             | 
| 35 | 
            +
             | 
| @@ -1,6 +1,5 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 | 
            -
             | 
| 4 3 | 
             
            styles = {
         | 
| 5 4 | 
             
              width: 199,
         | 
| 6 5 | 
             
              height: 33,
         | 
| @@ -24,11 +23,13 @@ listing = [ | |
| 24 23 | 
             
              { data: :hi },
         | 
| 25 24 | 
             
              { data: :ho }
         | 
| 26 25 | 
             
            ]
         | 
| 27 | 
            -
             | 
| 28 | 
            -
            list_1 =  | 
| 26 | 
            +
            b=box({drag: true})
         | 
| 27 | 
            +
            list_1 = grab(:intuition).list({
         | 
| 29 28 | 
             
                              styles: styles,
         | 
| 30 29 | 
             
                              element: element,
         | 
| 31 | 
            -
                              listing: listing
         | 
| 30 | 
            +
                              listing: listing,
         | 
| 31 | 
            +
                                           left: 33,
         | 
| 32 | 
            +
                              attach: b.id
         | 
| 32 33 | 
             
                            })
         | 
| 33 34 |  | 
| 34 35 | 
             
            # test2
         | 
| @@ -1,6 +1,17 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 | 
            -
            label=text({data: 0, top: 69, left: 69,attach:  :intuition, component: { size: 12 }, color: :gray})
         | 
| 3 2 |  | 
| 4 | 
            -
             | 
| 3 | 
            +
            label = text({ data: 0, top: 400, left: 69, component: { size: 12 }, color: :gray })
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            aaa = grab(:intuition).slider({ id: :toto, range: { color: :yellow }, min: -12, max: 33, width: 333, value: 12, height: 25, left: 99, top: 350, color: :orange, cursor: { color: :orange, width: 25, height: 25 } }) do |value|
         | 
| 6 | 
            +
              label.data("(#{value})")
         | 
| 7 | 
            +
            end
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            aa = grab(:intuition).slider({ orientation: :vertical, range: { color: :white }, value: 55, width: 55, height: 555, attach: :intuition, left: 555, top: 33, color: :red, cursor: { color: {alpha: 1, red: 0.12, green: 0.12, blue: 0.12}, width: 33, height: 66, smooth: 3 } }) do |value|
         | 
| 5 10 | 
             
              label.data("(#{value})")
         | 
| 6 11 | 
             
            end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            b=box
         | 
| 14 | 
            +
            b.touch(true) do
         | 
| 15 | 
            +
              aa.value(12)
         | 
| 16 | 
            +
              aaa.value(-6)
         | 
| 17 | 
            +
            end
         | 
| @@ -29,7 +29,7 @@ | |
| 29 29 | 
             
            // }
         | 
| 30 30 |  | 
| 31 31 |  | 
| 32 | 
            -
            function controller_message(msg) {
         | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
            }
         | 
| 32 | 
            +
            // function controller_message(msg) {
         | 
| 33 | 
            +
            //     // let json_msgs = JSON.parse(msg);
         | 
| 34 | 
            +
            //     rubyVMCallback("A.receptor("+msg+")")
         | 
| 35 | 
            +
            // }
         | 
    
        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.6. | 
| 4 | 
            +
              version: 0.5.6.8.3
         | 
| 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-03- | 
| 11 | 
            +
            date: 2024-03-22 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: artoo
         | 
| @@ -540,6 +540,7 @@ files: | |
| 540 540 | 
             
            - vendor/assets/application/examples/attach.rb
         | 
| 541 541 | 
             
            - vendor/assets/application/examples/attached.rb
         | 
| 542 542 | 
             
            - vendor/assets/application/examples/basic_understanding.rb
         | 
| 543 | 
            +
            - vendor/assets/application/examples/behavior.rb
         | 
| 543 544 | 
             
            - vendor/assets/application/examples/blur.rb
         | 
| 544 545 | 
             
            - vendor/assets/application/examples/border.rb
         | 
| 545 546 | 
             
            - vendor/assets/application/examples/browse.rb
         | 
| @@ -569,6 +570,7 @@ files: | |
| 569 570 | 
             
            - vendor/assets/application/examples/encode.rb
         | 
| 570 571 | 
             
            - vendor/assets/application/examples/encrypt.rb
         | 
| 571 572 | 
             
            - vendor/assets/application/examples/example.rb
         | 
| 573 | 
            +
            - vendor/assets/application/examples/executor.rb
         | 
| 572 574 | 
             
            - vendor/assets/application/examples/file.rb
         | 
| 573 575 | 
             
            - vendor/assets/application/examples/fill.rb
         | 
| 574 576 | 
             
            - vendor/assets/application/examples/find.rb
         | 
| @@ -581,11 +583,13 @@ files: | |
| 581 583 | 
             
            - vendor/assets/application/examples/help.rb
         | 
| 582 584 | 
             
            - vendor/assets/application/examples/hierarchy.rb
         | 
| 583 585 | 
             
            - vendor/assets/application/examples/history.rb
         | 
| 586 | 
            +
            - vendor/assets/application/examples/holder.rb
         | 
| 584 587 | 
             
            - vendor/assets/application/examples/hypertext.rb
         | 
| 585 588 | 
             
            - vendor/assets/application/examples/image.rb
         | 
| 586 589 | 
             
            - vendor/assets/application/examples/import.rb
         | 
| 587 590 | 
             
            - vendor/assets/application/examples/increment.rb
         | 
| 588 591 | 
             
            - vendor/assets/application/examples/infos.rb
         | 
| 592 | 
            +
            - vendor/assets/application/examples/input.rb
         | 
| 589 593 | 
             
            - vendor/assets/application/examples/int8.rb
         | 
| 590 594 | 
             
            - vendor/assets/application/examples/js&ruby.rb
         | 
| 591 595 | 
             
            - vendor/assets/application/examples/keyboard.rb
         |