unpoly-rails 3.10.2 → 3.11.0.rc1
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/README.md +84 -71
 - data/assets/unpoly/unpoly-bootstrap3.min.js +1 -1
 - data/assets/unpoly/unpoly-bootstrap4.min.js +1 -1
 - data/assets/unpoly/unpoly-bootstrap5.min.js +1 -1
 - data/assets/unpoly/unpoly-migrate.js +46 -15
 - data/assets/unpoly/unpoly-migrate.min.js +1 -1
 - data/assets/unpoly/unpoly.css +1 -0
 - data/assets/unpoly/unpoly.es6.js +1004 -652
 - data/assets/unpoly/unpoly.es6.min.js +1 -1
 - data/assets/unpoly/unpoly.js +1000 -647
 - data/assets/unpoly/unpoly.min.css +1 -1
 - data/assets/unpoly/unpoly.min.js +1 -1
 - data/lib/unpoly/rails/change/cache.rb +11 -4
 - data/lib/unpoly/rails/change/layer.rb +9 -2
 - data/lib/unpoly/rails/change.rb +11 -0
 - data/lib/unpoly/rails/version.rb +1 -1
 - metadata +5 -5
 
| 
         @@ -15,17 +15,24 @@ module Unpoly 
     | 
|
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
                    # TODO: Docs
         
     | 
| 
       17 
17 
     | 
    
         
             
                    def expire(pattern = '*')
         
     | 
| 
       18 
     | 
    
         
            -
                       
     | 
| 
      
 18 
     | 
    
         
            +
                      if pattern == false
         
     | 
| 
      
 19 
     | 
    
         
            +
                        ActiveSupport::Deprecation.warn("up.cache.expire(false) has no effect. The server can no longer prevent cache expiration.")
         
     | 
| 
      
 20 
     | 
    
         
            +
                      else
         
     | 
| 
      
 21 
     | 
    
         
            +
                        change.expire_cache = pattern
         
     | 
| 
      
 22 
     | 
    
         
            +
                      end
         
     | 
| 
       19 
23 
     | 
    
         
             
                    end
         
     | 
| 
       20 
24 
     | 
    
         | 
| 
       21 
25 
     | 
    
         
             
                    # TODO: Docs
         
     | 
| 
       22 
26 
     | 
    
         
             
                    def evict(pattern = '*')
         
     | 
| 
       23 
     | 
    
         
            -
                       
     | 
| 
      
 27 
     | 
    
         
            +
                      if pattern == false
         
     | 
| 
      
 28 
     | 
    
         
            +
                        ActiveSupport::Deprecation.warn("up.cache.evict(false) has no effect. The server can no longer prevent cache eviction.")
         
     | 
| 
      
 29 
     | 
    
         
            +
                      else
         
     | 
| 
      
 30 
     | 
    
         
            +
                        change.evict_cache = pattern
         
     | 
| 
      
 31 
     | 
    
         
            +
                      end
         
     | 
| 
       24 
32 
     | 
    
         
             
                    end
         
     | 
| 
       25 
33 
     | 
    
         | 
| 
       26 
34 
     | 
    
         
             
                    def keep
         
     | 
| 
       27 
     | 
    
         
            -
                      ActiveSupport::Deprecation.warn("up.cache.keep  
     | 
| 
       28 
     | 
    
         
            -
                      expire(false)
         
     | 
| 
      
 35 
     | 
    
         
            +
                      ActiveSupport::Deprecation.warn("up.cache.keep has no effect. The server can no longer prevent cache expiration.")
         
     | 
| 
       29 
36 
     | 
    
         
             
                    end
         
     | 
| 
       30 
37 
     | 
    
         | 
| 
       31 
38 
     | 
    
         
             
                    private
         
     | 
| 
         @@ -4,7 +4,7 @@ module Unpoly 
     | 
|
| 
       4 
4 
     | 
    
         
             
                  class Layer
         
     | 
| 
       5 
5 
     | 
    
         
             
                    class CannotClose < Error; end
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
                    def initialize(change, mode:, context:)
         
     | 
| 
      
 7 
     | 
    
         
            +
                    def initialize(change, mode:, context: {})
         
     | 
| 
       8 
8 
     | 
    
         
             
                      @change = change
         
     | 
| 
       9 
9 
     | 
    
         
             
                      @mode = mode.presence || 'root'
         
     | 
| 
       10 
10 
     | 
    
         
             
                      @context = context
         
     | 
| 
         @@ -32,7 +32,7 @@ module Unpoly 
     | 
|
| 
       32 
32 
     | 
    
         | 
| 
       33 
33 
     | 
    
         
             
                    ##
         
     | 
| 
       34 
34 
     | 
    
         
             
                    # TODO: Docs
         
     | 
| 
       35 
     | 
    
         
            -
                    def emit(type, options 
     | 
| 
      
 35 
     | 
    
         
            +
                    def emit(type, **options)
         
     | 
| 
       36 
36 
     | 
    
         
             
                      change.emit(type, options.merge(layer: 'current'))
         
     | 
| 
       37 
37 
     | 
    
         
             
                    end
         
     | 
| 
       38 
38 
     | 
    
         | 
| 
         @@ -50,6 +50,13 @@ module Unpoly 
     | 
|
| 
       50 
50 
     | 
    
         
             
                      change.response.headers['X-Up-Dismiss-Layer'] = Util.safe_json_encode(value)
         
     | 
| 
       51 
51 
     | 
    
         
             
                    end
         
     | 
| 
       52 
52 
     | 
    
         | 
| 
      
 53 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 54 
     | 
    
         
            +
                    # TODO: Docs
         
     | 
| 
      
 55 
     | 
    
         
            +
                    def open(**options)
         
     | 
| 
      
 56 
     | 
    
         
            +
                      change.response.headers['X-Up-Open-Layer'] = Util.safe_json_encode(options)
         
     | 
| 
      
 57 
     | 
    
         
            +
                    end
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
       53 
60 
     | 
    
         
             
                    private
         
     | 
| 
       54 
61 
     | 
    
         | 
| 
       55 
62 
     | 
    
         
             
                    attr_reader :change
         
     | 
    
        data/lib/unpoly/rails/change.rb
    CHANGED
    
    | 
         @@ -20,6 +20,7 @@ module Unpoly 
     | 
|
| 
       20 
20 
     | 
    
         
             
                  field Field::SeparatedValues.new(:validate_names), request_header_name: 'X-Up-Validate'
         
     | 
| 
       21 
21 
     | 
    
         
             
                  field Field::String.new(:mode)
         
     | 
| 
       22 
22 
     | 
    
         
             
                  field Field::String.new(:fail_mode)
         
     | 
| 
      
 23 
     | 
    
         
            +
                  field Field::String.new(:origin_mode)
         
     | 
| 
       23 
24 
     | 
    
         
             
                  field Field::Hash.new(:context, default: -> { {} }), method: :input_context
         
     | 
| 
       24 
25 
     | 
    
         
             
                  field Field::Hash.new(:fail_context, default: -> { {} }), method: :input_fail_context
         
     | 
| 
       25 
26 
     | 
    
         
             
                  field Field::Hash.new(:context_changes, default: -> { {} }), response_header_name: 'X-Up-Context'
         
     | 
| 
         @@ -182,6 +183,12 @@ module Unpoly 
     | 
|
| 
       182 
183 
     | 
    
         
             
                    fail_mode_from_request
         
     | 
| 
       183 
184 
     | 
    
         
             
                  end
         
     | 
| 
       184 
185 
     | 
    
         | 
| 
      
 186 
     | 
    
         
            +
                  ##
         
     | 
| 
      
 187 
     | 
    
         
            +
                  # TODO: Docs
         
     | 
| 
      
 188 
     | 
    
         
            +
                  memoize def origin_mode
         
     | 
| 
      
 189 
     | 
    
         
            +
                    origin_mode_from_request
         
     | 
| 
      
 190 
     | 
    
         
            +
                  end
         
     | 
| 
      
 191 
     | 
    
         
            +
             
     | 
| 
       185 
192 
     | 
    
         
             
                  ##
         
     | 
| 
       186 
193 
     | 
    
         
             
                  # Returns the context object as sent from the frontend,
         
     | 
| 
       187 
194 
     | 
    
         
             
                  # before any changes made on the server.
         
     | 
| 
         @@ -309,6 +316,10 @@ module Unpoly 
     | 
|
| 
       309 
316 
     | 
    
         
             
                    Layer.new(self, mode: fail_mode, context: fail_context)
         
     | 
| 
       310 
317 
     | 
    
         
             
                  end
         
     | 
| 
       311 
318 
     | 
    
         | 
| 
      
 319 
     | 
    
         
            +
                  memoize def origin_layer
         
     | 
| 
      
 320 
     | 
    
         
            +
                    Layer.new(self, mode: origin_mode)
         
     | 
| 
      
 321 
     | 
    
         
            +
                  end
         
     | 
| 
      
 322 
     | 
    
         
            +
             
     | 
| 
       312 
323 
     | 
    
         
             
                  memoize def cache
         
     | 
| 
       313 
324 
     | 
    
         
             
                    Cache.new(self)
         
     | 
| 
       314 
325 
     | 
    
         
             
                  end
         
     | 
    
        data/lib/unpoly/rails/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: unpoly-rails
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 3. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 3.11.0.rc1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Henning Koch
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2025- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2025-05-08 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: railties
         
     | 
| 
         @@ -153,11 +153,11 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       153 
153 
     | 
    
         
             
                  version: 2.3.0
         
     | 
| 
       154 
154 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       155 
155 
     | 
    
         
             
              requirements:
         
     | 
| 
       156 
     | 
    
         
            -
              - - " 
     | 
| 
      
 156 
     | 
    
         
            +
              - - ">"
         
     | 
| 
       157 
157 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       158 
     | 
    
         
            -
                  version:  
     | 
| 
      
 158 
     | 
    
         
            +
                  version: 1.3.1
         
     | 
| 
       159 
159 
     | 
    
         
             
            requirements: []
         
     | 
| 
       160 
     | 
    
         
            -
            rubygems_version: 3. 
     | 
| 
      
 160 
     | 
    
         
            +
            rubygems_version: 3.1.6
         
     | 
| 
       161 
161 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       162 
162 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       163 
163 
     | 
    
         
             
            summary: Rails bindings for Unpoly, the unobtrusive JavaScript framework
         
     |