atome 0.5.7.3.1 → 0.5.7.3.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 +1 -0
- data/lib/atome/extensions/atome.rb +9 -4
- data/lib/atome/genesis/particles/event.rb +22 -16
- data/lib/atome/genesis/particles/utility.rb +26 -4
- data/lib/atome/version.rb +1 -1
- data/lib/molecules/intuition/utilities.rb +2 -0
- data/lib/renderers/html/html.rb +176 -29
- data/vendor/assets/application/examples/code.rb +2 -5
- data/vendor/assets/application/examples/overflow.rb +1 -0
- data/vendor/assets/application/examples/repeat.rb +12 -5
- data/vendor/assets/application/examples/run.rb +17 -0
- data/vendor/assets/application/examples/scheduler.rb +159 -0
- data/vendor/assets/application/examples/target.rb +25 -0
- data/vendor/assets/application/examples/test.rb +8 -1
- data/vendor/assets/application/examples/touch.rb +11 -6
- data/vendor/assets/application/examples/wait.rb +12 -1
- data/vendor/assets/src/medias/images/logos/arp.svg +7 -0
- 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: 0f111d86401c9293ac46fa899d202bf0ab2a1c905d5d17186f0b87ba0560f65d
         | 
| 4 | 
            +
              data.tar.gz: ae3208f9349448b93a93864308445ce9108c450366ce8ee2ac1b7026724b40c2
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 3139df2c2320097e707d095e2aa577104669823e61c77fa9b7a4e43553537068926cea7701bd0cd9c8e21bd41087f9d1e04f101883adcd0ea3b5cc84ba1d665e
         | 
| 7 | 
            +
              data.tar.gz: c151bca3643df87d2388087cf534eb44e22e3ca8bf4281de8a9311bc7a20717164dd8be7c4a65dced3365e23e110af18648d732374706aaa9aab1fabcfc98bee
         | 
    
        data/lib/atome/atome.rb
    CHANGED
    
    
| @@ -216,9 +216,9 @@ class Object | |
| 216 216 | 
             
                id
         | 
| 217 217 | 
             
              end
         | 
| 218 218 |  | 
| 219 | 
            -
              def repeater(counter, proc)
         | 
| 220 | 
            -
             | 
| 221 | 
            -
              end
         | 
| 219 | 
            +
              # def repeater(counter, proc)
         | 
| 220 | 
            +
              #   instance_exec(counter, &proc) if proc.is_a?(Proc)
         | 
| 221 | 
            +
              # end
         | 
| 222 222 |  | 
| 223 223 | 
             
              def repeat_callback(params, counter)
         | 
| 224 224 | 
             
                @repeat[params].call(counter)
         | 
| @@ -255,7 +255,7 @@ class Object | |
| 255 255 |  | 
| 256 256 | 
             
                  return intervalId;
         | 
| 257 257 | 
             
                JS
         | 
| 258 | 
            -
             | 
| 258 | 
            +
                repeat_id+1
         | 
| 259 259 | 
             
              end
         | 
| 260 260 |  | 
| 261 261 | 
             
              def stop(params)
         | 
| @@ -266,6 +266,11 @@ class Object | |
| 266 266 | 
             
                    JS.eval(<<~JS)
         | 
| 267 267 | 
             
                      clearInterval(#{repeater_to_stop});
         | 
| 268 268 | 
             
                    JS
         | 
| 269 | 
            +
                  elsif   params.key?(:wait)
         | 
| 270 | 
            +
                    waiter_to_stop = params[:wait]
         | 
| 271 | 
            +
                    JS.eval(<<~JS)
         | 
| 272 | 
            +
                    clearTimeout(window.timeoutIds['#{waiter_to_stop}'])
         | 
| 273 | 
            +
                    JS
         | 
| 269 274 | 
             
                  else
         | 
| 270 275 | 
             
                    puts "La clé :repeat n'existe pas dans params"
         | 
| 271 276 | 
             
                  end
         | 
| @@ -4,14 +4,14 @@ new({ particle: :touch, category: :event, type: :hash, store: false }) | |
| 4 4 | 
             
            new({ sanitizer: :touch }) do |params, user_bloc|
         | 
| 5 5 | 
             
              if params
         | 
| 6 6 | 
             
                # TODO: factorise code below
         | 
| 7 | 
            -
                # alert  "touch_code: #{@touch_code}"
         | 
| 8 7 | 
             
                @touch ||= {}
         | 
| 9 8 | 
             
                @touch_code ||= {}
         | 
| 10 9 | 
             
                option = true
         | 
| 11 10 | 
             
                params = if params.instance_of? Hash
         | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 11 | 
            +
                     user_bloc =params.delete(:code) if params[:code]
         | 
| 12 | 
            +
                     @touch_code[params.keys[0]] = user_bloc
         | 
| 13 | 
            +
                     option = params[params.keys[0]]
         | 
| 14 | 
            +
                     params.keys[0]
         | 
| 15 15 | 
             
                         else
         | 
| 16 16 | 
             
                           case params
         | 
| 17 17 | 
             
                           when true
         | 
| @@ -120,9 +120,10 @@ new({ sanitizer: :drag }) do |params, user_bloc| | |
| 120 120 | 
             
              @drag_code ||= {}
         | 
| 121 121 | 
             
              option = true
         | 
| 122 122 | 
             
              params = if params.instance_of? Hash
         | 
| 123 | 
            -
             | 
| 124 | 
            -
             | 
| 125 | 
            -
             | 
| 123 | 
            +
                   user_bloc =params.delete(:code) if params[:code]
         | 
| 124 | 
            +
                   @drag_code[params.keys[0]] = user_bloc
         | 
| 125 | 
            +
                   option = params[params.keys[0]]
         | 
| 126 | 
            +
                   params.keys[0]
         | 
| 126 127 | 
             
                       else
         | 
| 127 128 | 
             
                         case params
         | 
| 128 129 | 
             
                         when true
         | 
| @@ -173,9 +174,10 @@ new({ sanitizer: :drop }) do |params, user_bloc| | |
| 173 174 | 
             
              @drop_code ||= {}
         | 
| 174 175 | 
             
              option = true
         | 
| 175 176 | 
             
              params = if params.instance_of? Hash
         | 
| 176 | 
            -
             | 
| 177 | 
            -
             | 
| 178 | 
            -
             | 
| 177 | 
            +
                   user_bloc =params.delete(:code) if params[:code]
         | 
| 178 | 
            +
                   @drop_code[params.keys[0]] = user_bloc
         | 
| 179 | 
            +
                   option = params[params.keys[0]]
         | 
| 180 | 
            +
                   params.keys[0]
         | 
| 179 181 | 
             
                       else
         | 
| 180 182 | 
             
                         case params
         | 
| 181 183 | 
             
                         when true
         | 
| @@ -210,10 +212,10 @@ new({ sanitizer: :over }) do |params, user_bloc| | |
| 210 212 | 
             
              @over_code ||= {}
         | 
| 211 213 | 
             
              option = true
         | 
| 212 214 | 
             
              params = if params.instance_of? Hash
         | 
| 213 | 
            -
             | 
| 214 | 
            -
             | 
| 215 | 
            -
             | 
| 216 | 
            -
             | 
| 215 | 
            +
                   user_bloc =params.delete(:code) if params[:code]
         | 
| 216 | 
            +
                   @over_code[params.keys[0]] = user_bloc
         | 
| 217 | 
            +
                   option = params[params.keys[0]]
         | 
| 218 | 
            +
                   params.keys[0]
         | 
| 217 219 | 
             
                       else
         | 
| 218 220 | 
             
                         case params
         | 
| 219 221 | 
             
                         when true
         | 
| @@ -259,7 +261,7 @@ new({ particle: :mass, category: :event, type: :int }) | |
| 259 261 | 
             
            new({ particle: :damping, category: :event, type: :int })
         | 
| 260 262 | 
             
            new({ particle: :stiffness, category: :event, type: :int })
         | 
| 261 263 | 
             
            new({ particle: :velocity, category: :event, type: :int })
         | 
| 262 | 
            -
            new({ particle: :repeat, category: :event, type: :boolean })
         | 
| 264 | 
            +
            # new({ particle: :repeat, category: :event, type: :boolean })
         | 
| 263 265 | 
             
            new({ particle: :ease, category: :event, type: :boolean })
         | 
| 264 266 | 
             
            new(particle: :keyboard, category: :event, type: :hash, store: false)
         | 
| 265 267 | 
             
            new({ sanitizer: :keyboard }) do |params, user_bloc|
         | 
| @@ -269,8 +271,12 @@ new({ sanitizer: :keyboard }) do |params, user_bloc| | |
| 269 271 | 
             
              option = {}
         | 
| 270 272 | 
             
              params = if params.instance_of? Hash
         | 
| 271 273 | 
             
                         # @keyboard_code[:keyboard] = user_bloc
         | 
| 274 | 
            +
                         # option = params[params.keys[0]]
         | 
| 275 | 
            +
                         # :remove
         | 
| 276 | 
            +
                         user_bloc =params.delete(:code) if params[:code]
         | 
| 277 | 
            +
                         @keyboard_code[params.keys[0]] = user_bloc
         | 
| 272 278 | 
             
                         option = params[params.keys[0]]
         | 
| 273 | 
            -
                          | 
| 279 | 
            +
                         params.keys[0]
         | 
| 274 280 | 
             
                       else
         | 
| 275 281 | 
             
                         case params
         | 
| 276 282 | 
             
                         when true
         | 
| @@ -1,11 +1,33 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 3 | 
             
            new({ particle: :renderers, category: :utility, type: :string })
         | 
| 4 | 
            -
            new({ particle: :code, category: :utility, type: :string })
         | 
| 5 | 
            -
             | 
| 6 | 
            -
              code_found = @code
         | 
| 7 | 
            -
              instance_exec(params, &code_found) if code_found.is_a?(Proc)
         | 
| 4 | 
            +
            new({ particle: :code, category: :utility, type: :string, store: false }) do |params, code|
         | 
| 5 | 
            +
              @code[params]=code
         | 
| 8 6 | 
             
            end
         | 
| 7 | 
            +
            # new({ particle: :run, category: :utility, type: :boolean }) do |params|
         | 
| 8 | 
            +
            #   code_found = @code
         | 
| 9 | 
            +
            #   instance_exec(params, &code_found) if code_found.is_a?(Proc)
         | 
| 10 | 
            +
            # end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            new({ particle: :run }) do |params, code|
         | 
| 13 | 
            +
                instance_exec(¶ms) if params.is_a?(Proc)
         | 
| 14 | 
            +
                code_found = @code[params]
         | 
| 15 | 
            +
                instance_exec(params, &code_found) if code_found.is_a?(Proc)
         | 
| 16 | 
            +
            end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            new({ particle: :target }) do |params|
         | 
| 19 | 
            +
              params.each do |atome_f, value_f|
         | 
| 20 | 
            +
                if value_f.instance_of?(Hash)
         | 
| 21 | 
            +
                  value_f.each do |part_f, part_val|
         | 
| 22 | 
            +
                    grab(atome_f).send(part_f, part_val)
         | 
| 23 | 
            +
                  end
         | 
| 24 | 
            +
                else
         | 
| 25 | 
            +
                  grab(atome_f).send(value_f)
         | 
| 26 | 
            +
                end
         | 
| 27 | 
            +
              end
         | 
| 28 | 
            +
            end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
             | 
| 9 31 | 
             
            # new({ particle: :broadcast })
         | 
| 10 32 |  | 
| 11 33 | 
             
            def delete_recursive(atome_id, force=false)
         | 
    
        data/lib/atome/version.rb
    CHANGED
    
    
| @@ -427,11 +427,13 @@ new(molecule: :matrix) do |params, &bloc| | |
| 427 427 | 
             
              matrix_back.data(params)
         | 
| 428 428 | 
             
              matrix_back
         | 
| 429 429 | 
             
            end
         | 
| 430 | 
            +
             | 
| 430 431 | 
             
            new(molecule: :page) do |params, &bloc|
         | 
| 431 432 | 
             
              b = box({ color: :red, left: 99, drag: true })
         | 
| 432 433 | 
             
              b.remove(:box_color)
         | 
| 433 434 | 
             
              b.text(params)
         | 
| 434 435 | 
             
            end
         | 
| 436 | 
            +
             | 
| 435 437 | 
             
            new(molecule: :application) do |params, &bloc|
         | 
| 436 438 |  | 
| 437 439 | 
             
              main_page = box({ drag: true, width: :auto, height: :auto, top: 0, bottom: 0, left: 0, right: 0 })
         | 
    
        data/lib/renderers/html/html.rb
    CHANGED
    
    | @@ -650,7 +650,13 @@ class HTML | |
| 650 650 | 
             
                  mql = JS.global[:window].matchMedia(media_query)
         | 
| 651 651 |  | 
| 652 652 | 
             
                  event_handler = ->(event) do
         | 
| 653 | 
            -
                    bloc.call({ matches: event[:matches] }) if bloc.is_a? Proc
         | 
| 653 | 
            +
                    # bloc.call({ matches: event[:matches] }) if bloc.is_a? Proc
         | 
| 654 | 
            +
                    proc_content = bloc.call({ matches: event[:matches] }) if event_validation(bloc)
         | 
| 655 | 
            +
                    if proc_content.instance_of? Hash
         | 
| 656 | 
            +
                      proc_content.each do |k, v|
         | 
| 657 | 
            +
                        @original_atome.send(k, v)
         | 
| 658 | 
            +
                      end
         | 
| 659 | 
            +
                    end
         | 
| 654 660 | 
             
                  end
         | 
| 655 661 |  | 
| 656 662 | 
             
                  # add a listener to matchMedia object
         | 
| @@ -660,12 +666,33 @@ class HTML | |
| 660 666 | 
             
                  event_handler = ->(event) do
         | 
| 661 667 | 
             
                    width = JS.global[:window][:innerWidth]
         | 
| 662 668 | 
             
                    height = JS.global[:window][:innerHeight]
         | 
| 663 | 
            -
                    bloc.call({ width: width, height: height }) if bloc.is_a? Proc
         | 
| 669 | 
            +
                    # bloc.call({ width: width, height: height }) if bloc.is_a? Proc
         | 
| 670 | 
            +
                    proc_content = bloc.call({ width: width, height: height }) if event_validation(bloc)
         | 
| 671 | 
            +
                    if proc_content.instance_of? Hash
         | 
| 672 | 
            +
                      proc_content.each do |k, v|
         | 
| 673 | 
            +
                        @original_atome.send(k, v)
         | 
| 674 | 
            +
                      end
         | 
| 675 | 
            +
                    end
         | 
| 664 676 | 
             
                  end
         | 
| 677 | 
            +
             | 
| 678 | 
            +
                  # proc_content = @drag_move.call(event) if event_validation(@drag_move)
         | 
| 679 | 
            +
                  # if proc_content.instance_of? Hash
         | 
| 680 | 
            +
                  #   proc_content.each do |k, v|
         | 
| 681 | 
            +
                  #     @original_atome.send(k, v)
         | 
| 682 | 
            +
                  #   end
         | 
| 683 | 
            +
                  # end
         | 
| 684 | 
            +
                  # puts event_handler.class
         | 
| 665 685 | 
             
                  JS.global[:window].addEventListener('resize', event_handler)
         | 
| 686 | 
            +
                  # JS.global[:window].addEventListener('resize', event_handler)
         | 
| 666 687 | 
             
                else
         | 
| 667 688 | 
             
                  event_handler = ->(event) do
         | 
| 668 | 
            -
                    bloc.call(event) if bloc.is_a? Proc
         | 
| 689 | 
            +
                    # bloc.call(event) if bloc.is_a? Proc
         | 
| 690 | 
            +
                    proc_content = bloc.call(event) if event_validation(bloc)
         | 
| 691 | 
            +
                    if proc_content.instance_of? Hash
         | 
| 692 | 
            +
                      proc_content.each do |k, v|
         | 
| 693 | 
            +
                        @original_atome.send(k, v)
         | 
| 694 | 
            +
                      end
         | 
| 695 | 
            +
                    end
         | 
| 669 696 | 
             
                  end
         | 
| 670 697 | 
             
                  @element.addEventListener(property, event_handler)
         | 
| 671 698 | 
             
                end
         | 
| @@ -680,7 +707,13 @@ class HTML | |
| 680 707 | 
             
                  # we use .call instead of instance_eval because instance_eval bring the current object as context
         | 
| 681 708 | 
             
                  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
         | 
| 682 709 | 
             
                  # group etc..
         | 
| 683 | 
            -
                  @keyboard_press.call(event) if @keyboard_press.is_a?(Proc)
         | 
| 710 | 
            +
                  # @keyboard_press.call(event) if @keyboard_press.is_a?(Proc)
         | 
| 711 | 
            +
                  proc_content = @keyboard_press.call(event) if event_validation(@keyboard_press)
         | 
| 712 | 
            +
                  if proc_content.instance_of? Hash
         | 
| 713 | 
            +
                    proc_content.each do |k, v|
         | 
| 714 | 
            +
                      @original_atome.send(k, v)
         | 
| 715 | 
            +
                    end
         | 
| 716 | 
            +
                  end
         | 
| 684 717 | 
             
                end
         | 
| 685 718 | 
             
                @element.addEventListener('keypress', keypress_handler)
         | 
| 686 719 | 
             
              end
         | 
| @@ -692,7 +725,13 @@ class HTML | |
| 692 725 | 
             
                  # we use .call instead of instance_eval because instance_eval bring the current object as context
         | 
| 693 726 | 
             
                  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
         | 
| 694 727 | 
             
                  # group etc..
         | 
| 695 | 
            -
                  @keyboard_down.call(event) if @keyboard_down.is_a?(Proc)
         | 
| 728 | 
            +
                  # @keyboard_down.call(event) if @keyboard_down.is_a?(Proc)
         | 
| 729 | 
            +
                  proc_content = @keyboard_down.call(event) if event_validation(@keyboard_down)
         | 
| 730 | 
            +
                  if proc_content.instance_of? Hash
         | 
| 731 | 
            +
                    proc_content.each do |k, v|
         | 
| 732 | 
            +
                      @original_atome.send(k, v)
         | 
| 733 | 
            +
                    end
         | 
| 734 | 
            +
                  end
         | 
| 696 735 | 
             
                end
         | 
| 697 736 | 
             
                @element.addEventListener('keydown', keypress_handler)
         | 
| 698 737 | 
             
              end
         | 
| @@ -704,7 +743,13 @@ class HTML | |
| 704 743 | 
             
                  # we use .call instead of instance_eval because instance_eval bring the current object as context
         | 
| 705 744 | 
             
                  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
         | 
| 706 745 | 
             
                  # group etc..
         | 
| 707 | 
            -
                  @keyboard_up.call(event) if @keyboard_up.is_a?(Proc)
         | 
| 746 | 
            +
                  # @keyboard_up.call(event) if @keyboard_up.is_a?(Proc)
         | 
| 747 | 
            +
                  proc_content = @keyboard_up.call(event) if event_validation(@keyboard_up)
         | 
| 748 | 
            +
                  if proc_content.instance_of? Hash
         | 
| 749 | 
            +
                    proc_content.each do |k, v|
         | 
| 750 | 
            +
                      @original_atome.send(k, v)
         | 
| 751 | 
            +
                    end
         | 
| 752 | 
            +
                  end
         | 
| 708 753 | 
             
                end
         | 
| 709 754 | 
             
                @element.addEventListener('keyup', keypress_handler)
         | 
| 710 755 | 
             
              end
         | 
| @@ -772,7 +817,13 @@ class HTML | |
| 772 817 | 
             
                  # we use .call instead of instance_eval because instance_eval bring the current object as context
         | 
| 773 818 | 
             
                  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
         | 
| 774 819 | 
             
                  # group etc..
         | 
| 775 | 
            -
                  @drag_start.call(event) if event_validation(@drag_start)
         | 
| 820 | 
            +
                  # @drag_start.call(event) if event_validation(@drag_start)
         | 
| 821 | 
            +
                  proc_content = @drag_start.call(event) if event_validation(@drag_start)
         | 
| 822 | 
            +
                  if proc_content.instance_of? Hash
         | 
| 823 | 
            +
                    proc_content.each do |k, v|
         | 
| 824 | 
            +
                      @original_atome.send(k, v)
         | 
| 825 | 
            +
                    end
         | 
| 826 | 
            +
                  end
         | 
| 776 827 | 
             
                end
         | 
| 777 828 | 
             
              end
         | 
| 778 829 |  | 
| @@ -784,7 +835,13 @@ class HTML | |
| 784 835 | 
             
                  # we use .call instead of instance_eval because instance_eval bring the current object as context
         | 
| 785 836 | 
             
                  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
         | 
| 786 837 | 
             
                  # group etc..
         | 
| 787 | 
            -
                  @drag_end.call(event) if event_validation(@drag_end)
         | 
| 838 | 
            +
                  # @drag_end.call(event) if event_validation(@drag_end)
         | 
| 839 | 
            +
                  proc_content = @drag_end.call(event) if event_validation(@drag_end)
         | 
| 840 | 
            +
                  if proc_content.instance_of? Hash
         | 
| 841 | 
            +
                    proc_content.each do |k, v|
         | 
| 842 | 
            +
                      @original_atome.send(k, v)
         | 
| 843 | 
            +
                    end
         | 
| 844 | 
            +
                  end
         | 
| 788 845 | 
             
                end
         | 
| 789 846 | 
             
              end
         | 
| 790 847 |  | 
| @@ -807,7 +864,13 @@ class HTML | |
| 807 864 | 
             
                      # we use .call instead of instance_eval because instance_eval bring the current object as context
         | 
| 808 865 | 
             
                      # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
         | 
| 809 866 | 
             
                      # group etc..
         | 
| 810 | 
            -
                      @drag_move.call(event) if event_validation(@drag_move)
         | 
| 867 | 
            +
                      # @drag_move.call(event) if event_validation(@drag_move)
         | 
| 868 | 
            +
                      proc_content = @drag_move.call(event) if event_validation(@drag_move)
         | 
| 869 | 
            +
                      if proc_content.instance_of? Hash
         | 
| 870 | 
            +
                        proc_content.each do |k, v|
         | 
| 871 | 
            +
                          @original_atome.send(k, v)
         | 
| 872 | 
            +
                        end
         | 
| 873 | 
            +
                      end
         | 
| 811 874 | 
             
                      Universe.allow_tool_operations = false
         | 
| 812 875 | 
             
                      dx = event[:dx]
         | 
| 813 876 | 
             
                      dy = event[:dy]
         | 
| @@ -871,7 +934,13 @@ class HTML | |
| 871 934 | 
             
                  # we use .call instead of instance_eval because instance_eval bring the current object as context
         | 
| 872 935 | 
             
                  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
         | 
| 873 936 | 
             
                  # group etc..
         | 
| 874 | 
            -
                  @drag_move.call(event) if event_validation(@drag_move)
         | 
| 937 | 
            +
                  # @drag_move.call(event) if event_validation(@drag_move)
         | 
| 938 | 
            +
                  proc_content = @drag_move.call(event) if event_validation(@drag_move)
         | 
| 939 | 
            +
                  if proc_content.instance_of? Hash
         | 
| 940 | 
            +
                    proc_content.each do |k, v|
         | 
| 941 | 
            +
                      @original_atome.send(k, v)
         | 
| 942 | 
            +
                    end
         | 
| 943 | 
            +
                  end
         | 
| 875 944 | 
             
                  dx = event[:dx]
         | 
| 876 945 | 
             
                  dy = event[:dy]
         | 
| 877 946 | 
             
                  x = (@original_atome.left || 0) + dx.to_f
         | 
| @@ -898,7 +967,13 @@ class HTML | |
| 898 967 | 
             
                  # we use .call instead of instance_eval because instance_eval bring the current object as context
         | 
| 899 968 | 
             
                  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
         | 
| 900 969 | 
             
                  # group etc..
         | 
| 901 | 
            -
                  @drag_lock.call(event) if event_validation(@drag_lock)
         | 
| 970 | 
            +
                  # @drag_lock.call(event) if event_validation(@drag_lock)
         | 
| 971 | 
            +
                  proc_content = @drag_lock.call(event) if event_validation(@drag_lock)
         | 
| 972 | 
            +
                  if proc_content.instance_of? Hash
         | 
| 973 | 
            +
                    proc_content.each do |k, v|
         | 
| 974 | 
            +
                      @original_atome.send(k, v)
         | 
| 975 | 
            +
                    end
         | 
| 976 | 
            +
                  end
         | 
| 902 977 | 
             
                end
         | 
| 903 978 | 
             
              end
         | 
| 904 979 |  | 
| @@ -909,7 +984,13 @@ class HTML | |
| 909 984 | 
             
                # we use .call instead of instance_eval because instance_eval bring the current object as context
         | 
| 910 985 | 
             
                # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
         | 
| 911 986 | 
             
                # group etc..
         | 
| 912 | 
            -
                bloc.call({ source: draggable_element, destination: dropzone_element }) if event_validation(bloc)
         | 
| 987 | 
            +
                # bloc.call({ source: draggable_element, destination: dropzone_element }) if event_validation(bloc)
         | 
| 988 | 
            +
                proc_content = bloc.call({ source: draggable_element, destination: dropzone_element }) if event_validation(bloc)
         | 
| 989 | 
            +
                if proc_content.instance_of? Hash
         | 
| 990 | 
            +
                  proc_content.each do |k, v|
         | 
| 991 | 
            +
                    @original_atome.send(k, v)
         | 
| 992 | 
            +
                  end
         | 
| 993 | 
            +
                end
         | 
| 913 994 | 
             
              end
         | 
| 914 995 |  | 
| 915 996 | 
             
              def drop_activate(_option)
         | 
| @@ -920,7 +1001,16 @@ class HTML | |
| 920 1001 | 
             
                                    accept: nil, # Accept any element
         | 
| 921 1002 | 
             
                                    overlap: 0.75,
         | 
| 922 1003 | 
             
                                    ondropactivate: lambda do |native_event|
         | 
| 1004 | 
            +
                                      event = Native(native_event)
         | 
| 1005 | 
            +
             | 
| 923 1006 | 
             
                                      drop_action(native_event, @drop_activate) if event_validation(@drop_activate)
         | 
| 1007 | 
            +
                                      # @drag_lock.call(event) if event_validation(@drag_lock)
         | 
| 1008 | 
            +
                                      # proc_content = @drop_activate.call(event) if event_validation(@drop_activate)
         | 
| 1009 | 
            +
                                      # if proc_content.instance_of? Hash
         | 
| 1010 | 
            +
                                      #   proc_content.each do |k, v|
         | 
| 1011 | 
            +
                                      #     @original_atome.send(k, v)
         | 
| 1012 | 
            +
                                      #   end
         | 
| 1013 | 
            +
                                      # end
         | 
| 924 1014 | 
             
                                    end
         | 
| 925 1015 | 
             
                                  })
         | 
| 926 1016 | 
             
              end
         | 
| @@ -1030,7 +1120,14 @@ class HTML | |
| 1030 1120 | 
             
                                           # we use .call instead of instance_eval because instance_eval bring the current object as context
         | 
| 1031 1121 | 
             
                                           # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
         | 
| 1032 1122 | 
             
                                           # group etc..
         | 
| 1033 | 
            -
                                           @resize.call(event) if event_validation(@resize)
         | 
| 1123 | 
            +
                                           # @resize.call(event) if event_validation(@resize)
         | 
| 1124 | 
            +
                                           proc_content = @resize.call(event) if event_validation(@resize)
         | 
| 1125 | 
            +
                                           if proc_content.instance_of? Hash
         | 
| 1126 | 
            +
                                             proc_content.each do |k, v|
         | 
| 1127 | 
            +
                                               @original_atome.send(k, v)
         | 
| 1128 | 
            +
                                             end
         | 
| 1129 | 
            +
                                           end
         | 
| 1130 | 
            +
             | 
| 1034 1131 | 
             
                                           x = (@element[:offsetLeft].to_i || 0)
         | 
| 1035 1132 | 
             
                                           y = (@element[:offsetTop].to_i || 0)
         | 
| 1036 1133 | 
             
                                           width = event[:rect][:width]
         | 
| @@ -1054,13 +1151,21 @@ class HTML | |
| 1054 1151 | 
             
              def overflow(params, bloc)
         | 
| 1055 1152 | 
             
                style(:overflow, params)
         | 
| 1056 1153 | 
             
                @overflow = @original_atome.instance_variable_get('@overflow_code')[:overflow]
         | 
| 1057 | 
            -
                @element.addEventListener('scroll', lambda do | | 
| 1154 | 
            +
                @element.addEventListener('scroll', lambda do |native_event|
         | 
| 1155 | 
            +
                  # event = Native(native_event)
         | 
| 1058 1156 | 
             
                  scroll_top = @element[:scrollTop].to_i
         | 
| 1059 1157 | 
             
                  scroll_left = @element[:scrollLeft].to_i
         | 
| 1060 1158 | 
             
                  # we use .call instead of instance_eval because instance_eval bring the current object as context
         | 
| 1061 1159 | 
             
                  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
         | 
| 1062 1160 | 
             
                  # group etc..
         | 
| 1063 1161 | 
             
                  @overflow.call({ left: scroll_left, top: scroll_top }) if event_validation(@overflow)
         | 
| 1162 | 
            +
             | 
| 1163 | 
            +
                  proc_content = @overflow.call({ left: scroll_left, top: scroll_top }) if event_validation(@overflow)
         | 
| 1164 | 
            +
                  if proc_content.instance_of? Hash
         | 
| 1165 | 
            +
                    proc_content.each do |k, v|
         | 
| 1166 | 
            +
                      @original_atome.send(k, v)
         | 
| 1167 | 
            +
                    end
         | 
| 1168 | 
            +
                  end
         | 
| 1064 1169 | 
             
                end)
         | 
| 1065 1170 | 
             
              end
         | 
| 1066 1171 |  | 
| @@ -1073,7 +1178,14 @@ class HTML | |
| 1073 1178 | 
             
                  # we use .call instead of instance_eval because instance_eval bring the current object as context
         | 
| 1074 1179 | 
             
                  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
         | 
| 1075 1180 | 
             
                  # group etc..
         | 
| 1076 | 
            -
                  @over_over.call(event) if event_validation(@over_over)
         | 
| 1181 | 
            +
                  # @over_over.call(event) if event_validation(@over_over)
         | 
| 1182 | 
            +
             | 
| 1183 | 
            +
                  proc_content = @over_over.call(event) if event_validation(@over_over)
         | 
| 1184 | 
            +
                  if proc_content.instance_of? Hash
         | 
| 1185 | 
            +
                    proc_content.each do |k, v|
         | 
| 1186 | 
            +
                      @original_atome.send(k, v)
         | 
| 1187 | 
            +
                    end
         | 
| 1188 | 
            +
                  end
         | 
| 1077 1189 | 
             
                end
         | 
| 1078 1190 | 
             
              end
         | 
| 1079 1191 |  | 
| @@ -1085,7 +1197,13 @@ class HTML | |
| 1085 1197 | 
             
                  # we use .call instead of instance_eval because instance_eval bring the current object as context
         | 
| 1086 1198 | 
             
                  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
         | 
| 1087 1199 | 
             
                  # group etc..
         | 
| 1088 | 
            -
                  @over_enter.call(event) if event_validation(@over_enter)
         | 
| 1200 | 
            +
                  # @over_enter.call(event) if event_validation(@over_enter)
         | 
| 1201 | 
            +
                  proc_content = @over_enter.call(event) if event_validation(@over_enter)
         | 
| 1202 | 
            +
                  if proc_content.instance_of? Hash
         | 
| 1203 | 
            +
                    proc_content.each do |k, v|
         | 
| 1204 | 
            +
                      @original_atome.send(k, v)
         | 
| 1205 | 
            +
                    end
         | 
| 1206 | 
            +
                  end
         | 
| 1089 1207 | 
             
                end
         | 
| 1090 1208 | 
             
                @element.addEventListener('mouseenter', @over_enter_callback)
         | 
| 1091 1209 |  | 
| @@ -1101,7 +1219,13 @@ class HTML | |
| 1101 1219 | 
             
                  # we use .call instead of instance_eval because instance_eval bring the current object as context
         | 
| 1102 1220 | 
             
                  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
         | 
| 1103 1221 | 
             
                  # group etc..
         | 
| 1104 | 
            -
                  @over_leave.call(event) if event_validation(@over_leave)
         | 
| 1222 | 
            +
                  # @over_leave.call(event) if event_validation(@over_leave)
         | 
| 1223 | 
            +
                  proc_content = @over_leave.call(event) if event_validation(@over_leave)
         | 
| 1224 | 
            +
                  if proc_content.instance_of? Hash
         | 
| 1225 | 
            +
                    proc_content.each do |k, v|
         | 
| 1226 | 
            +
                      @original_atome.send(k, v)
         | 
| 1227 | 
            +
                    end
         | 
| 1228 | 
            +
                  end
         | 
| 1105 1229 | 
             
                end
         | 
| 1106 1230 | 
             
                @element.addEventListener('mouseleave', @over_leave_callback)
         | 
| 1107 1231 |  | 
| @@ -1148,7 +1272,13 @@ class HTML | |
| 1148 1272 | 
             
                  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
         | 
| 1149 1273 | 
             
                  # group etc..
         | 
| 1150 1274 | 
             
                  # @touch_down.call(event) if @touch_down.is_a?(Proc)  && (!Universe.edit_mode || @original_atome.tag[:system])
         | 
| 1151 | 
            -
                  @touch_down.call(event) if event_validation(@touch_down)
         | 
| 1275 | 
            +
                  # @touch_down.call(event) if event_validation(@touch_down)
         | 
| 1276 | 
            +
                  proc_content = @touch_down.call(event) if event_validation(@touch_down)
         | 
| 1277 | 
            +
                  if proc_content.instance_of? Hash
         | 
| 1278 | 
            +
                    proc_content.each do |k, v|
         | 
| 1279 | 
            +
                      @original_atome.send(k, v)
         | 
| 1280 | 
            +
                    end
         | 
| 1281 | 
            +
                  end
         | 
| 1152 1282 | 
             
                  # end
         | 
| 1153 1283 | 
             
                  # end
         | 
| 1154 1284 | 
             
                end
         | 
| @@ -1168,14 +1298,14 @@ class HTML | |
| 1168 1298 | 
             
                  # @touch_up.call(event) if @touch_up.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
         | 
| 1169 1299 | 
             
                  # event = Native(native_event)
         | 
| 1170 1300 | 
             
                  # ########## old code :
         | 
| 1171 | 
            -
                  @touch_tap.call(event) if event_validation(@touch_tap)
         | 
| 1301 | 
            +
                  # @touch_tap.call(event) if event_validation(@touch_tap)
         | 
| 1172 1302 | 
             
                  # ########## new code:
         | 
| 1173 | 
            -
                   | 
| 1174 | 
            -
                   | 
| 1175 | 
            -
             | 
| 1176 | 
            -
             | 
| 1177 | 
            -
             | 
| 1178 | 
            -
                   | 
| 1303 | 
            +
                  proc_content = @touch_tap.call(event) if event_validation(@touch_tap)
         | 
| 1304 | 
            +
                  if proc_content.instance_of? Hash
         | 
| 1305 | 
            +
                    proc_content.each do |k, v|
         | 
| 1306 | 
            +
                      @original_atome.send(k, v)
         | 
| 1307 | 
            +
                    end
         | 
| 1308 | 
            +
                  end
         | 
| 1179 1309 | 
             
                end
         | 
| 1180 1310 | 
             
                # end
         | 
| 1181 1311 | 
             
              end
         | 
| @@ -1191,7 +1321,13 @@ class HTML | |
| 1191 1321 | 
             
                  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
         | 
| 1192 1322 | 
             
                  # group etc..
         | 
| 1193 1323 | 
             
                  # @touch_up.call(event) if @touch_up.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
         | 
| 1194 | 
            -
                  @touch_up.call(event) if event_validation(@touch_up)
         | 
| 1324 | 
            +
                  # @touch_up.call(event) if event_validation(@touch_up)
         | 
| 1325 | 
            +
                  proc_content = @touch_up.call(event) if event_validation(@touch_up)
         | 
| 1326 | 
            +
                  if proc_content.instance_of? Hash
         | 
| 1327 | 
            +
                    proc_content.each do |k, v|
         | 
| 1328 | 
            +
                      @original_atome.send(k, v)
         | 
| 1329 | 
            +
                    end
         | 
| 1330 | 
            +
                  end
         | 
| 1195 1331 | 
             
                end
         | 
| 1196 1332 |  | 
| 1197 1333 | 
             
                # end
         | 
| @@ -1208,8 +1344,13 @@ class HTML | |
| 1208 1344 | 
             
                  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
         | 
| 1209 1345 | 
             
                  # group etc..
         | 
| 1210 1346 | 
             
                  # @touch_double.call(event) if @touch_double.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
         | 
| 1211 | 
            -
                  @touch_double.call(event) if event_validation(@touch_double)
         | 
| 1212 | 
            -
             | 
| 1347 | 
            +
                  # @touch_double.call(event) if event_validation(@touch_double)
         | 
| 1348 | 
            +
                  proc_content = @touch_double.call(event) if event_validation(@touch_double)
         | 
| 1349 | 
            +
                  if proc_content.instance_of? Hash
         | 
| 1350 | 
            +
                    proc_content.each do |k, v|
         | 
| 1351 | 
            +
                      @original_atome.send(k, v)
         | 
| 1352 | 
            +
                    end
         | 
| 1353 | 
            +
                  end
         | 
| 1213 1354 | 
             
                  # end
         | 
| 1214 1355 | 
             
                end
         | 
| 1215 1356 |  | 
| @@ -1225,7 +1366,13 @@ class HTML | |
| 1225 1366 | 
             
                  # we use .call instead of instance_eval because instance_eval bring the current object as context
         | 
| 1226 1367 | 
             
                  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
         | 
| 1227 1368 | 
             
                  # group etc..
         | 
| 1228 | 
            -
                  @touch_long.call(event) if event_validation(@touch_long)
         | 
| 1369 | 
            +
                  # @touch_long.call(event) if event_validation(@touch_long)
         | 
| 1370 | 
            +
                  proc_content = @touch_long.call(event) if event_validation(@touch_long)
         | 
| 1371 | 
            +
                  if proc_content.instance_of? Hash
         | 
| 1372 | 
            +
                    proc_content.each do |k, v|
         | 
| 1373 | 
            +
                      @original_atome.send(k, v)
         | 
| 1374 | 
            +
                    end
         | 
| 1375 | 
            +
                  end
         | 
| 1229 1376 | 
             
                  # @touch_long.call(event) if @touch_long.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
         | 
| 1230 1377 | 
             
                  # @touch_double.call(event) if event_validation(@touch_double)
         | 
| 1231 1378 |  | 
| @@ -1,11 +1,8 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 | 
            -
             | 
| 3 | 
            -
              code_found = @code_code[:code]
         | 
| 4 | 
            -
              instance_exec(params, &code_found) if code_found.is_a?(Proc)
         | 
| 5 | 
            -
            end
         | 
| 2 | 
            +
             | 
| 6 3 | 
             
            a = box
         | 
| 7 4 | 
             
            a.code(:hello) do
         | 
| 8 | 
            -
              circle({ left: 333 })
         | 
| 5 | 
            +
              circle({ left: 333, color: :orange })
         | 
| 9 6 | 
             
            end
         | 
| 10 7 | 
             
            wait 1 do
         | 
| 11 8 | 
             
              a.run(:hello)
         | 
| @@ -3,21 +3,28 @@ | |
| 3 3 |  | 
| 4 4 | 
             
            c=circle({width: 66, height: 66})
         | 
| 5 5 | 
             
            t1=c.text({id: :first, data: 0, left: 28})
         | 
| 6 | 
            -
             | 
| 7 | 
            -
            t2=cc.text({id: :second, data: 0, left: 28})
         | 
| 6 | 
            +
             | 
| 8 7 | 
             
            first_repeater=repeat(1, repeat = 99) do |counter|
         | 
| 9 8 | 
             
              t1.data(counter)
         | 
| 10 9 | 
             
            end
         | 
| 11 10 |  | 
| 12 | 
            -
            my_repeater=repeat(1, repeat = 9) do |counter|
         | 
| 13 | 
            -
              t2.data(counter)
         | 
| 14 | 
            -
            end
         | 
| 15 11 |  | 
| 16 12 | 
             
            c.touch(true) do
         | 
| 17 13 | 
             
              stop({ repeat: first_repeater })
         | 
| 18 14 | 
             
              t1.data(:stopped)
         | 
| 19 15 | 
             
            end
         | 
| 20 16 |  | 
| 17 | 
            +
             | 
| 18 | 
            +
            cc=circle({width: 66, height: 66, left: 90 })
         | 
| 19 | 
            +
            t2=cc.text({id: :second, data: 0, left: 28})
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            # # alert first_repeater
         | 
| 22 | 
            +
            my_repeater=repeat(1, repeat = 9) do |counter|
         | 
| 23 | 
            +
              t2.data(counter)
         | 
| 24 | 
            +
            end
         | 
| 25 | 
            +
            #
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            #
         | 
| 21 28 | 
             
            cc.touch(true) do
         | 
| 22 29 | 
             
              stop({ repeat: my_repeater })
         | 
| 23 30 | 
             
              t2.data(:stopped)
         | 
| @@ -0,0 +1,159 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require 'time'
         | 
| 4 | 
            +
            # Helper method to store task configuration in localStorage
         | 
| 5 | 
            +
            def store_task(name, config)
         | 
| 6 | 
            +
              JS.global[:localStorage].setItem(name, config.to_json)
         | 
| 7 | 
            +
            end
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            # Helper method to retrieve task configuration from localStorage
         | 
| 10 | 
            +
            def retrieve_task(name)
         | 
| 11 | 
            +
              config = JS.global[:localStorage].getItem(name)
         | 
| 12 | 
            +
              config.nil? ? nil : JSON.parse(config)
         | 
| 13 | 
            +
            end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            # Helper method to retrieve all tasks from localStorage
         | 
| 16 | 
            +
            def retrieve_all_tasks
         | 
| 17 | 
            +
              tasks = []
         | 
| 18 | 
            +
              local_storage = JS.global[:localStorage]
         | 
| 19 | 
            +
              if Atome::host == "web-opal"
         | 
| 20 | 
            +
                local_storage.each do |key|
         | 
| 21 | 
            +
                  value = local_storage.getItem(key)
         | 
| 22 | 
            +
                  if value
         | 
| 23 | 
            +
                    value= JSON.parse(value)
         | 
| 24 | 
            +
                    tasks << { name: key, config:value }
         | 
| 25 | 
            +
                  end
         | 
| 26 | 
            +
                end
         | 
| 27 | 
            +
              else
         | 
| 28 | 
            +
                length = local_storage[:length].to_i
         | 
| 29 | 
            +
                length.times do |i|
         | 
| 30 | 
            +
                  key = local_storage.call(:key, i)
         | 
| 31 | 
            +
                  value = local_storage.call(:getItem, key)
         | 
| 32 | 
            +
                  tasks << { name: key, config: JSON.parse(value.to_s) } if value
         | 
| 33 | 
            +
                end
         | 
| 34 | 
            +
              end
         | 
| 35 | 
            +
              tasks
         | 
| 36 | 
            +
            end
         | 
| 37 | 
            +
             | 
| 38 | 
            +
            # Helper method to schedule a task
         | 
| 39 | 
            +
            def schedule_task(name, years, month, day, hours, minutes, seconds, recurrence: nil, &block)
         | 
| 40 | 
            +
              target_time = Time.new(years, month, day, hours, minutes, seconds)
         | 
| 41 | 
            +
              now = Time.now
         | 
| 42 | 
            +
             | 
| 43 | 
            +
              if target_time < now
         | 
| 44 | 
            +
                schedule_recurrence(name, target_time, recurrence, &block)
         | 
| 45 | 
            +
              else
         | 
| 46 | 
            +
                seconds_until_target = target_time - now
         | 
| 47 | 
            +
                wait_task = wait(seconds_until_target) do
         | 
| 48 | 
            +
                  block.call
         | 
| 49 | 
            +
                  schedule_recurrence(name, target_time, recurrence, &block) if recurrence
         | 
| 50 | 
            +
                end
         | 
| 51 | 
            +
                store_task(name, { wait: wait_task, target_time: target_time, recurrence: recurrence })
         | 
| 52 | 
            +
              end
         | 
| 53 | 
            +
            end
         | 
| 54 | 
            +
             | 
| 55 | 
            +
            def schedule_recurrence(name, target_time, recurrence, &block)
         | 
| 56 | 
            +
              now = Time.now
         | 
| 57 | 
            +
              next_time = target_time
         | 
| 58 | 
            +
             | 
| 59 | 
            +
              case recurrence
         | 
| 60 | 
            +
              when :yearly
         | 
| 61 | 
            +
                next_time += 365 * 24 * 60 * 60 while next_time <= now
         | 
| 62 | 
            +
              when :monthly
         | 
| 63 | 
            +
                next_time = next_time >> 1 while next_time <= now
         | 
| 64 | 
            +
              when :weekly
         | 
| 65 | 
            +
                next_time += 7 * 24 * 60 * 60 while next_time <= now
         | 
| 66 | 
            +
              when :daily
         | 
| 67 | 
            +
                next_time += 24 * 60 * 60 while next_time <= now
         | 
| 68 | 
            +
              when :hourly
         | 
| 69 | 
            +
                next_time += 60 * 60 while next_time <= now
         | 
| 70 | 
            +
              when :minutely
         | 
| 71 | 
            +
                next_time += 60 while next_time <= now
         | 
| 72 | 
            +
              when :secondly
         | 
| 73 | 
            +
                next_time += 1 while next_time <= now
         | 
| 74 | 
            +
              when Hash
         | 
| 75 | 
            +
                if recurrence[:weekly]
         | 
| 76 | 
            +
                  wday = recurrence[:weekly]
         | 
| 77 | 
            +
                  next_time += 7 * 24 * 60 * 60 while next_time <= now
         | 
| 78 | 
            +
                  next_time += 24 * 60 * 60 until next_time.wday == wday
         | 
| 79 | 
            +
                elsif recurrence[:monthly]
         | 
| 80 | 
            +
                  week_of_month = recurrence[:monthly][:week]
         | 
| 81 | 
            +
                  wday = recurrence[:monthly][:wday]
         | 
| 82 | 
            +
                  while next_time <= now
         | 
| 83 | 
            +
                    next_month = next_time >> 1
         | 
| 84 | 
            +
                    next_time = Time.new(next_month.year, next_month.month, 1, target_time.hour, target_time.min, target_time.sec)
         | 
| 85 | 
            +
                    next_time += 24 * 60 * 60 while next_time.wday != wday
         | 
| 86 | 
            +
                    next_time += (week_of_month - 1) * 7 * 24 * 60 * 60
         | 
| 87 | 
            +
                  end
         | 
| 88 | 
            +
                end
         | 
| 89 | 
            +
              else
         | 
| 90 | 
            +
                puts "Invalid recurrence option"
         | 
| 91 | 
            +
                return
         | 
| 92 | 
            +
              end
         | 
| 93 | 
            +
             | 
| 94 | 
            +
              seconds_until_next = next_time - Time.now
         | 
| 95 | 
            +
              wait_task = wait(seconds_until_next) do
         | 
| 96 | 
            +
                block.call
         | 
| 97 | 
            +
                schedule_recurrence(name, next_time, recurrence, &block)
         | 
| 98 | 
            +
              end
         | 
| 99 | 
            +
              store_task(name, { wait: wait_task, target_time: next_time, recurrence: recurrence })
         | 
| 100 | 
            +
            end
         | 
| 101 | 
            +
             | 
| 102 | 
            +
            # Helper method to stop a scheduled task
         | 
| 103 | 
            +
            def stop_task(name)
         | 
| 104 | 
            +
              task_config = retrieve_task(name)
         | 
| 105 | 
            +
              return unless task_config
         | 
| 106 | 
            +
             | 
| 107 | 
            +
              stop({ wait: task_config['wait'] })
         | 
| 108 | 
            +
              JS.global[:localStorage].removeItem(name)
         | 
| 109 | 
            +
            end
         | 
| 110 | 
            +
             | 
| 111 | 
            +
            # Method to relaunch all tasks from localStorage
         | 
| 112 | 
            +
            def relaunch_all_tasks
         | 
| 113 | 
            +
              tasks = retrieve_all_tasks
         | 
| 114 | 
            +
             | 
| 115 | 
            +
              tasks.each do |task|
         | 
| 116 | 
            +
                name = task[:name]
         | 
| 117 | 
            +
                config = task[:config]
         | 
| 118 | 
            +
                target_time_found = config['target_time']
         | 
| 119 | 
            +
                target_time = Time.parse(target_time_found)
         | 
| 120 | 
            +
                recurrence_found = config['recurrence']
         | 
| 121 | 
            +
                next unless recurrence_found
         | 
| 122 | 
            +
                recurrence = config['recurrence'].is_a?(Hash) ? config['recurrence'].transform_keys(&:to_sym) : config['recurrence'].to_sym
         | 
| 123 | 
            +
                puts "found : #{name}, #{target_time.year}, #{target_time.month}, #{target_time.day}, #{target_time.hour}, #{target_time.min}, #{target_time.sec}, recurrence: #{recurrence}"
         | 
| 124 | 
            +
                schedule_task(name, target_time.year, target_time.month, target_time.day, target_time.hour, target_time.min, target_time.sec, recurrence: recurrence) do
         | 
| 125 | 
            +
                  puts "Relaunched task #{name}"
         | 
| 126 | 
            +
                end
         | 
| 127 | 
            +
              end
         | 
| 128 | 
            +
            end
         | 
| 129 | 
            +
             | 
| 130 | 
            +
            ######## check
         | 
| 131 | 
            +
             | 
| 132 | 
            +
            # Relaunch all tasks
         | 
| 133 | 
            +
            relaunch_all_tasks
         | 
| 134 | 
            +
             | 
| 135 | 
            +
            # Example: Schedule a task to run at a specific date and time
         | 
| 136 | 
            +
            schedule_task('specific_time_task', 2024, 11, 12, 15, 12, 30) do
         | 
| 137 | 
            +
              puts "Task running at the specific date and time"
         | 
| 138 | 
            +
            end
         | 
| 139 | 
            +
             | 
| 140 | 
            +
            # Example: Schedule a task to run every minute
         | 
| 141 | 
            +
            schedule_task('every_minute_task', 2024, 05, 12, 15, 12, 3, recurrence: :minutely) do
         | 
| 142 | 
            +
              puts "Task running every minute"
         | 
| 143 | 
            +
            end
         | 
| 144 | 
            +
             | 
| 145 | 
            +
            # Example: Schedule a task to run every Tuesday at the same time
         | 
| 146 | 
            +
            schedule_task('weekly_tuesday_task', 2024, 11, 12, 15, 12, 30, recurrence: { weekly: 2 }) do
         | 
| 147 | 
            +
              puts "Task running every Tuesday at the same time"
         | 
| 148 | 
            +
            end
         | 
| 149 | 
            +
             | 
| 150 | 
            +
            # Example: Schedule a task to run every second Wednesday of the month at the same time
         | 
| 151 | 
            +
            schedule_task('second_wednesday_task', 2024, 11, 12, 15, 12, 30, recurrence: { monthly: { week: 2, wday: 3 } }) do
         | 
| 152 | 
            +
              puts "Task running every second Wednesday of the month at the same time"
         | 
| 153 | 
            +
            end
         | 
| 154 | 
            +
             | 
| 155 | 
            +
            # Stop a task
         | 
| 156 | 
            +
            # wait 133 do
         | 
| 157 | 
            +
            #   puts 'stop'
         | 
| 158 | 
            +
            #   stop_task('every_minute_task')
         | 
| 159 | 
            +
            # end
         | 
| @@ -0,0 +1,25 @@ | |
| 1 | 
            +
            #  frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            b = box({ left: 333, color: :blue, smooth: 6, id: :the_box2 })
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            t = text({ id: :the_text, data: 'touch the box and wait!' })
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            exec_code=lambda do
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              wait 2 do
         | 
| 10 | 
            +
                t.data('it works!! ')
         | 
| 11 | 
            +
              end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            end
         | 
| 14 | 
            +
            b.code(:hello) do
         | 
| 15 | 
            +
              circle({ left: rand(333), color: :green })
         | 
| 16 | 
            +
            end
         | 
| 17 | 
            +
            b.run(:hello)
         | 
| 18 | 
            +
            b.touch(:tap) do
         | 
| 19 | 
            +
              {
         | 
| 20 | 
            +
                color: :cyan,
         | 
| 21 | 
            +
                target: { the_text: { data: :super! } },
         | 
| 22 | 
            +
                run: exec_code
         | 
| 23 | 
            +
              }
         | 
| 24 | 
            +
            end
         | 
| 25 | 
            +
             | 
| @@ -311,4 +311,11 @@ JS.eval("localStorage.clear();") | |
| 311 311 | 
             
            # verif(val=33) do |var|
         | 
| 312 312 | 
             
            #   # puts left = '20' + var.to_s
         | 
| 313 313 | 
             
            #   {left: '20' + var.to_s, alert: 'hello! and big bisous!!'}
         | 
| 314 | 
            -
            # end
         | 
| 314 | 
            +
            # end
         | 
| 315 | 
            +
             | 
| 316 | 
            +
             | 
| 317 | 
            +
            b=box
         | 
| 318 | 
            +
            b.touch({tap: true}) do
         | 
| 319 | 
            +
              alert :hello
         | 
| 320 | 
            +
            end
         | 
| 321 | 
            +
             | 
| @@ -2,7 +2,7 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            b = box({ left: 333, color: :blue, smooth: 6, id: :the_box2 })
         | 
| 4 4 |  | 
| 5 | 
            -
            t=text({id: :the_text, data: 'type of touch : ?'})
         | 
| 5 | 
            +
            t = text({ id: :the_text, data: 'type of touch : ?' })
         | 
| 6 6 |  | 
| 7 7 | 
             
            t.touch(:down) do |event|
         | 
| 8 8 | 
             
              puts :down
         | 
| @@ -17,17 +17,19 @@ t.touch(:down) do |event| | |
| 17 17 | 
             
               # b.touch(:remove) # or  b.touch(false) to remove all touches bindings
         | 
| 18 18 | 
             
              t.data('touch down killed')
         | 
| 19 19 | 
             
            end
         | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 20 | 
            +
             | 
| 21 | 
            +
            touch_code =lambda do
         | 
| 22 22 | 
             
              b.color(:red)
         | 
| 23 23 | 
             
              puts 'box tapped'
         | 
| 24 24 | 
             
              # b.instance_variable_set('@touch_code', nil)
         | 
| 25 25 | 
             
            end
         | 
| 26 | 
            +
            b.touch(tap: true, code: touch_code)
         | 
| 26 27 |  | 
| 27 28 | 
             
            b.touch(:long) do
         | 
| 28 | 
            -
              puts :long
         | 
| 29 | 
            -
              t.data('type of touch is : long ')
         | 
| 30 | 
            -
              b.color(:black)
         | 
| 29 | 
            +
              # puts :long
         | 
| 30 | 
            +
              # t.data('type of touch is : long ')
         | 
| 31 | 
            +
              # b.color(:black)
         | 
| 32 | 
            +
              {color: :cyan}
         | 
| 31 33 | 
             
            end
         | 
| 32 34 |  | 
| 33 35 | 
             
            b.touch(:up) do
         | 
| @@ -48,3 +50,6 @@ b.touch(:double) do | |
| 48 50 | 
             
              t.data('type of touch is : double ')
         | 
| 49 51 | 
             
              b.color(:yellowgreen)
         | 
| 50 52 | 
             
            end
         | 
| 53 | 
            +
             | 
| 54 | 
            +
             | 
| 55 | 
            +
             | 
| @@ -0,0 +1,7 @@ | |
| 1 | 
            +
            <?xml version="1.0" encoding="UTF-8"?>
         | 
| 2 | 
            +
            <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
         | 
| 3 | 
            +
            <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100" height="98"  xml:space="preserve" id="canvas1">
         | 
| 4 | 
            +
              <path id="canvas1-bezier2" stroke="rgb(205, 231, 182)" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" fill="none" d="M 10,24 L 10,85 70,85" />
         | 
| 5 | 
            +
              <path id="canvas1-bezier" stroke="rgb(205, 231, 182)" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" fill="none" d="M -43,3.75 L -36,32.75 -4,42.75" transform="translate(44.37, 49.72) rotate(-169.32)"  />
         | 
| 6 | 
            +
              <circle id="canvas1-oval" stroke="rgb(106, 140, 201)" stroke-width="16" stroke-miterlimit="10" fill="none" cx="47.5" cy="46.5" r="16.5" />
         | 
| 7 | 
            +
            </svg>
         | 
    
        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.3. | 
| 4 | 
            +
              version: 0.5.7.3.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-06- | 
| 11 | 
            +
            date: 2024-06-09 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: eventmachine
         | 
| @@ -628,6 +628,8 @@ files: | |
| 628 628 | 
             
            - vendor/assets/application/examples/repeat.rb
         | 
| 629 629 | 
             
            - vendor/assets/application/examples/resize.rb
         | 
| 630 630 | 
             
            - vendor/assets/application/examples/rotate.rb
         | 
| 631 | 
            +
            - vendor/assets/application/examples/run.rb
         | 
| 632 | 
            +
            - vendor/assets/application/examples/scheduler.rb
         | 
| 631 633 | 
             
            - vendor/assets/application/examples/security.rb
         | 
| 632 634 | 
             
            - vendor/assets/application/examples/select_text.rb
         | 
| 633 635 | 
             
            - vendor/assets/application/examples/selected.rb
         | 
| @@ -646,6 +648,7 @@ files: | |
| 646 648 | 
             
            - vendor/assets/application/examples/sync.rb
         | 
| 647 649 | 
             
            - vendor/assets/application/examples/table.rb
         | 
| 648 650 | 
             
            - vendor/assets/application/examples/tagged.rb
         | 
| 651 | 
            +
            - vendor/assets/application/examples/target.rb
         | 
| 649 652 | 
             
            - vendor/assets/application/examples/terminal.rb
         | 
| 650 653 | 
             
            - vendor/assets/application/examples/test.rb
         | 
| 651 654 | 
             
            - vendor/assets/application/examples/text.rb
         | 
| @@ -850,6 +853,7 @@ files: | |
| 850 853 | 
             
            - vendor/assets/src/medias/images/logos/X.svg
         | 
| 851 854 | 
             
            - vendor/assets/src/medias/images/logos/YouTube.svg
         | 
| 852 855 | 
             
            - vendor/assets/src/medias/images/logos/apple.svg
         | 
| 856 | 
            +
            - vendor/assets/src/medias/images/logos/arp.svg
         | 
| 853 857 | 
             
            - vendor/assets/src/medias/images/logos/atome.svg
         | 
| 854 858 | 
             
            - vendor/assets/src/medias/images/logos/freebsd.png
         | 
| 855 859 | 
             
            - vendor/assets/src/medias/images/logos/freebsd.svg
         |