proscenium 0.12.0-x86_64-darwin → 0.14.0-x86_64-darwin
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 +7 -0
 - data/lib/proscenium/css_module/transformer.rb +4 -2
 - data/lib/proscenium/css_module.rb +8 -4
 - data/lib/proscenium/ext/proscenium +0 -0
 - data/lib/proscenium/helper.rb +18 -5
 - data/lib/proscenium/version.rb +1 -1
 - metadata +3 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 7266323f1f1f5120430ed43f1169343d711e61694986e08033c26bb2c50ca61e
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 32974f861da0870f1a38d5b7e5777988592372447c8a6a48b3a4d954a2765983
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 6e84a7553307fc8dc133c2afb4b2d3996166159e5c4aee783bb87a45d0ecb09af314f1fde21a356155ad2fa172a10d05f7b47d5581f740dd9466a57497a53ca4
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 6d0ceac47b5adf44e3f0072f76b2184697329d5aaa9a95ee2fcb306514f8f009bf0838c9931937209039cb72c9ae4f65fb937e3ab1780bcdbebc5ec57db4a332
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -552,6 +552,13 @@ css_module 'mypackage/button@big_button' 
     | 
|
| 
       552 
552 
     | 
    
         
             
            # => "big_button"
         
     | 
| 
       553 
553 
     | 
    
         
             
            ```
         
     | 
| 
       554 
554 
     | 
    
         | 
| 
      
 555 
     | 
    
         
            +
            `css_module` also accepts a `path` keyword argument, which allows you to specify the path to the CSS
         
     | 
| 
      
 556 
     | 
    
         
            +
            file. Note that this will use the given path for all class names passed to that instance of `css_module`.
         
     | 
| 
      
 557 
     | 
    
         
            +
             
     | 
| 
      
 558 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 559 
     | 
    
         
            +
            css_module :my_module_name, path: Rails.root.join('app/components/button.css')
         
     | 
| 
      
 560 
     | 
    
         
            +
            ```
         
     | 
| 
      
 561 
     | 
    
         
            +
             
     | 
| 
       555 
562 
     | 
    
         
             
            #### In your JavaScript
         
     | 
| 
       556 
563 
     | 
    
         | 
| 
       557 
564 
     | 
    
         
             
            Importing a CSS module from JS will automatically append the stylesheet to the document's head. And the result of the import will be an object of CSS class to module names.
         
     | 
| 
         @@ -69,11 +69,13 @@ module Proscenium 
     | 
|
| 
       69 
69 
     | 
    
         
             
                  resolved_path = Resolver.resolve(path.to_s)
         
     | 
| 
       70 
70 
     | 
    
         
             
                  digest = Importer.import(resolved_path)
         
     | 
| 
       71 
71 
     | 
    
         | 
| 
      
 72 
     | 
    
         
            +
                  transformed_path = ''
         
     | 
| 
      
 73 
     | 
    
         
            +
                  transformed_path = "__#{resolved_path[1..].gsub(%r{[/\.]}, '-')}" if Rails.env.development?
         
     | 
| 
       72 
74 
     | 
    
         
             
                  transformed_name = name.to_s
         
     | 
| 
       73 
75 
     | 
    
         
             
                  transformed_name = if transformed_name.start_with?('_')
         
     | 
| 
       74 
     | 
    
         
            -
                                       "_#{transformed_name[1..]}-#{digest}"
         
     | 
| 
      
 76 
     | 
    
         
            +
                                       "_#{transformed_name[1..]}-#{digest}#{transformed_path}"
         
     | 
| 
       75 
77 
     | 
    
         
             
                                     else
         
     | 
| 
       76 
     | 
    
         
            -
                                       "#{transformed_name}-#{digest}"
         
     | 
| 
      
 78 
     | 
    
         
            +
                                       "#{transformed_name}-#{digest}#{transformed_path}"
         
     | 
| 
       77 
79 
     | 
    
         
             
                                     end
         
     | 
| 
       78 
80 
     | 
    
         | 
| 
       79 
81 
     | 
    
         
             
                  [transformed_name, resolved_path]
         
     | 
| 
         @@ -18,16 +18,20 @@ module Proscenium::CssModule 
     | 
|
| 
       18 
18 
     | 
    
         
             
              # Accepts one or more CSS class names, and transforms them into CSS module names.
         
     | 
| 
       19 
19 
     | 
    
         
             
              #
         
     | 
| 
       20 
20 
     | 
    
         
             
              # @param name [String,Symbol,Array<String,Symbol>]
         
     | 
| 
      
 21 
     | 
    
         
            +
              # @param path [Pathname] the path to the CSS module file to use for the transformation.
         
     | 
| 
       21 
22 
     | 
    
         
             
              # @return [String] the transformed CSS module names concatenated as a string.
         
     | 
| 
       22 
     | 
    
         
            -
              def css_module(*names)
         
     | 
| 
       23 
     | 
    
         
            -
                 
     | 
| 
      
 23 
     | 
    
         
            +
              def css_module(*names, path: nil)
         
     | 
| 
      
 24 
     | 
    
         
            +
                transformer = path.nil? ? cssm : Transformer.new(path)
         
     | 
| 
      
 25 
     | 
    
         
            +
                transformer.class_names(*names, require_prefix: false).map { |name, _| name }.join(' ')
         
     | 
| 
       24 
26 
     | 
    
         
             
              end
         
     | 
| 
       25 
27 
     | 
    
         | 
| 
       26 
28 
     | 
    
         
             
              # @param name [String,Symbol,Array<String,Symbol>]
         
     | 
| 
      
 29 
     | 
    
         
            +
              # @param path [Pathname] the path to the CSS file to use for the transformation.
         
     | 
| 
       27 
30 
     | 
    
         
             
              # @return [String] the transformed CSS module names concatenated as a string.
         
     | 
| 
       28 
     | 
    
         
            -
              def class_names(*names)
         
     | 
| 
      
 31 
     | 
    
         
            +
              def class_names(*names, path: nil)
         
     | 
| 
       29 
32 
     | 
    
         
             
                names = names.flatten.compact
         
     | 
| 
       30 
     | 
    
         
            -
                 
     | 
| 
      
 33 
     | 
    
         
            +
                transformer = path.nil? ? cssm : Transformer.new(path)
         
     | 
| 
      
 34 
     | 
    
         
            +
                transformer.class_names(*names).map { |name, _| name }.join(' ') unless names.empty?
         
     | 
| 
       31 
35 
     | 
    
         
             
              end
         
     | 
| 
       32 
36 
     | 
    
         | 
| 
       33 
37 
     | 
    
         
             
              private
         
     | 
| 
         Binary file 
     | 
    
        data/lib/proscenium/helper.rb
    CHANGED
    
    | 
         @@ -20,11 +20,24 @@ module Proscenium 
     | 
|
| 
       20 
20 
     | 
    
         
             
                #
         
     | 
| 
       21 
21 
     | 
    
         
             
                # @see CssModule::Transformer#class_names
         
     | 
| 
       22 
22 
     | 
    
         
             
                # @param name [String,Symbol,Array<String,Symbol>]
         
     | 
| 
       23 
     | 
    
         
            -
                 
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
                   
     | 
| 
      
 23 
     | 
    
         
            +
                # @param path [Pathname] the path to the CSS module file to use for the transformation.
         
     | 
| 
      
 24 
     | 
    
         
            +
                # @return [String] the transformed CSS module names concatenated as a string.
         
     | 
| 
      
 25 
     | 
    
         
            +
                def css_module(*names, path: nil)
         
     | 
| 
      
 26 
     | 
    
         
            +
                  path ||= Pathname.new(@lookup_context.find(@virtual_path).identifier).sub_ext('')
         
     | 
| 
      
 27 
     | 
    
         
            +
                  CssModule::Transformer.new(path).class_names(*names, require_prefix: false)
         
     | 
| 
      
 28 
     | 
    
         
            +
                                        .map { |name, _| name }.join(' ')
         
     | 
| 
      
 29 
     | 
    
         
            +
                end
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                # @param name [String,Symbol,Array<String,Symbol>]
         
     | 
| 
      
 32 
     | 
    
         
            +
                # @param path [Pathname] the path to the CSS file to use for the transformation.
         
     | 
| 
      
 33 
     | 
    
         
            +
                # @return [String] the transformed CSS module names concatenated as a string.
         
     | 
| 
      
 34 
     | 
    
         
            +
                def class_names(*names, path: nil)
         
     | 
| 
      
 35 
     | 
    
         
            +
                  names = names.flatten.compact
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                  return if names.empty?
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                  path ||= Pathname.new(@lookup_context.find(@virtual_path).identifier).sub_ext('')
         
     | 
| 
      
 40 
     | 
    
         
            +
                  CssModule::Transformer.new(path).class_names(*names).map { |name, _| name }.join(' ')
         
     | 
| 
       28 
41 
     | 
    
         
             
                end
         
     | 
| 
       29 
42 
     | 
    
         | 
| 
       30 
43 
     | 
    
         
             
                def include_stylesheets(**options)
         
     | 
    
        data/lib/proscenium/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: proscenium
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.14.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: x86_64-darwin
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Joel Moss
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2023-11- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2023-11-17 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: activesupport
         
     | 
| 
         @@ -149,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       149 
149 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       150 
150 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       151 
151 
     | 
    
         
             
            requirements: []
         
     | 
| 
       152 
     | 
    
         
            -
            rubygems_version: 3.4. 
     | 
| 
      
 152 
     | 
    
         
            +
            rubygems_version: 3.4.22
         
     | 
| 
       153 
153 
     | 
    
         
             
            signing_key:
         
     | 
| 
       154 
154 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       155 
155 
     | 
    
         
             
            summary: The engine powering your Rails frontend
         
     |