rblade 1.1.0 → 1.1.1
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/CHANGELOG.md +3 -0
 - data/README.md +6 -6
 - data/REFERENCE.md +2 -2
 - data/lib/rblade/compiler/statements/compiles_component_helpers.rb +3 -3
 - data/rblade.gemspec +1 -1
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 12abc58f2de63aabc65abf34fe60b17b63b8ba70141dbd16447d6d5b42b84a0a
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 101e136868a7cbb2d5eb7ab2d117b90013999c1dcd544726fa9a0423a3b6566e
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 6a96e14502ccb338afc0779779f8d18901b9f8ea4ef90ba26e0142d24acc7f8a8cac85e290f3109a92b7d82c5752da795481084c733810dc3ffcfed97302a6c4
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 0a17982fdb228fb5edaa308e9dbb2c58a16c9733d2bd5bbe89188a4bb1431940558be5904a41d02093fe9ae5346b631a98bcd2dd825fe72e47de390e85912343
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -491,7 +491,7 @@ You can define a component's data properties using a `@props` directive at the t 
     | 
|
| 
       491 
491 
     | 
    
         | 
| 
       492 
492 
     | 
    
         
             
            ```rblade
         
     | 
| 
       493 
493 
     | 
    
         
             
            {{-- alert.rblade --}}
         
     | 
| 
       494 
     | 
    
         
            -
            @props( 
     | 
| 
      
 494 
     | 
    
         
            +
            @props(type: "warning", message: required)
         
     | 
| 
       495 
495 
     | 
    
         
             
            <div class="{{ type }}">{{ message }}</div>
         
     | 
| 
       496 
496 
     | 
    
         
             
            ```
         
     | 
| 
       497 
497 
     | 
    
         | 
| 
         @@ -505,7 +505,7 @@ The `@props` directive accepts a Hash where the key is the name of the attribute 
     | 
|
| 
       505 
505 
     | 
    
         
             
            All properties in the `@props` directive are automatically removed from `attributes`. Properties with names that aren't valid Ruby variable names or are Ruby reserved keywords are not created as local variables. However, you can reference them via the `attributes` local variable:
         
     | 
| 
       506 
506 
     | 
    
         | 
| 
       507 
507 
     | 
    
         
             
            ```rblade
         
     | 
| 
       508 
     | 
    
         
            -
            @props( 
     | 
| 
      
 508 
     | 
    
         
            +
            @props("for": required, "data-value": nil)
         
     | 
| 
       509 
509 
     | 
    
         
             
            <div>{{ attributes[:for] }} {{ attributes[:'data-value'] }}</div>
         
     | 
| 
       510 
510 
     | 
    
         
             
            ```
         
     | 
| 
       511 
511 
     | 
    
         | 
| 
         @@ -697,7 +697,7 @@ Sometimes a component may need to render multiple different slots in different l 
     | 
|
| 
       697 
697 
     | 
    
         | 
| 
       698 
698 
     | 
    
         
             
            ```rblade
         
     | 
| 
       699 
699 
     | 
    
         
             
            {{-- /app/views/components/alert.rblade --}}
         
     | 
| 
       700 
     | 
    
         
            -
            @props( 
     | 
| 
      
 700 
     | 
    
         
            +
            @props(title: required)
         
     | 
| 
       701 
701 
     | 
    
         
             
            <span class="alert-title">{{ title }}</span>
         
     | 
| 
       702 
702 
     | 
    
         
             
            <div class="alert alert-danger">
         
     | 
| 
       703 
703 
     | 
    
         
             
                {{ slot }}
         
     | 
| 
         @@ -752,10 +752,10 @@ Like RBlade components, you can assign additional [attributes](#component-attrib 
     | 
|
| 
       752 
752 
     | 
    
         
             
            To interact with slot attributes, you can access the `attributes` property of the slot's variable. For more information on how to interact with attributes, please consult the documentation on [component attributes](#component-attributes):
         
     | 
| 
       753 
753 
     | 
    
         | 
| 
       754 
754 
     | 
    
         
             
            ```rblade
         
     | 
| 
       755 
     | 
    
         
            -
            @props( 
     | 
| 
      
 755 
     | 
    
         
            +
            @props(
         
     | 
| 
       756 
756 
     | 
    
         
             
                "heading": required,
         
     | 
| 
       757 
757 
     | 
    
         
             
                "footer": required,
         
     | 
| 
       758 
     | 
    
         
            -
             
     | 
| 
      
 758 
     | 
    
         
            +
            )
         
     | 
| 
       759 
759 
     | 
    
         | 
| 
       760 
760 
     | 
    
         
             
            <div {{ attributes.class('border') }}>
         
     | 
| 
       761 
761 
     | 
    
         
             
                <h1 {{ heading.attributes.class('text-lg') }}>
         
     | 
| 
         @@ -777,7 +777,7 @@ Sometimes, you may wish to return early from a component without printing anythi 
     | 
|
| 
       777 
777 
     | 
    
         | 
| 
       778 
778 
     | 
    
         
             
            ```rblade
         
     | 
| 
       779 
779 
     | 
    
         
             
            {{-- components/error.rblade --}}
         
     | 
| 
       780 
     | 
    
         
            -
            @props( 
     | 
| 
      
 780 
     | 
    
         
            +
            @props(errors: [])
         
     | 
| 
       781 
781 
     | 
    
         
             
            @shouldRender(errors.present?)
         
     | 
| 
       782 
782 
     | 
    
         
             
            ...
         
     | 
| 
       783 
783 
     | 
    
         
             
            ```
         
     | 
    
        data/REFERENCE.md
    CHANGED
    
    | 
         @@ -30,8 +30,8 @@ By default, RBlade will look for components in the `app/views/components` folder 
     | 
|
| 
       30 
30 
     | 
    
         
             
            | `<x-name @style({'bg-red-600': is_error})/>`             | Conditionally pass styles to a component                                                                                                   |
         
     | 
| 
       31 
31 
     | 
    
         
             
            | `<x-name attribute/>`                                    | Pass an attribute to a component with value `true`                                                                                         |
         
     | 
| 
       32 
32 
     | 
    
         
             
            | `<x-name {{ attributes }}/>`                             | Pass attributes to a child component                                                                                                       |
         
     | 
| 
       33 
     | 
    
         
            -
            | `@props( 
     | 
| 
       34 
     | 
    
         
            -
            | `@props( 
     | 
| 
      
 33 
     | 
    
         
            +
            | `@props(header: "Header")`                               | Remove `header` from the attributes Hash and introduce it as a local variable, using the specified value as a default                      |
         
     | 
| 
      
 34 
     | 
    
         
            +
            | `@props(header: required)`                               | Remove `header` from the attributes Hash and introduce it as a local variable, raising an error if it is not set                           |
         
     | 
| 
       35 
35 
     | 
    
         
             
            | `{{ slot }}`                                             | Output the block content passed into the current component                                                                                 |
         
     | 
| 
       36 
36 
     | 
    
         
             
            | `<x-name><x-slot::header><h1>Header</h1><//>Content<//>` | Pass a named block to a component                                                                                                          |
         
     | 
| 
       37 
37 
     | 
    
         
             
            | `{{ header }}`                                           | Output the contents of a named block                                                                                                       |
         
     | 
| 
         @@ -42,12 +42,12 @@ module RBlade 
     | 
|
| 
       42 
42 
     | 
    
         
             
                  private
         
     | 
| 
       43 
43 
     | 
    
         | 
| 
       44 
44 
     | 
    
         
             
                  def extractProps prop_string
         
     | 
| 
       45 
     | 
    
         
            -
                    if  
     | 
| 
       46 
     | 
    
         
            -
                       
     | 
| 
      
 45 
     | 
    
         
            +
                    if prop_string.start_with?("{") && prop_string.end_with?("}")
         
     | 
| 
      
 46 
     | 
    
         
            +
                      prop_string = prop_string.delete_prefix("{").delete_suffix("}")
         
     | 
| 
       47 
47 
     | 
    
         
             
                    end
         
     | 
| 
       48 
48 
     | 
    
         | 
| 
       49 
49 
     | 
    
         
             
                    props = {}
         
     | 
| 
       50 
     | 
    
         
            -
                    prop_strings = Tokenizer.extractCommaSeparatedValues prop_string 
     | 
| 
      
 50 
     | 
    
         
            +
                    prop_strings = Tokenizer.extractCommaSeparatedValues prop_string
         
     | 
| 
       51 
51 
     | 
    
         | 
| 
       52 
52 
     | 
    
         
             
                    prop_strings.each do |prop|
         
     | 
| 
       53 
53 
     | 
    
         
             
                      prop.strip!
         
     | 
    
        data/rblade.gemspec
    CHANGED
    
    | 
         @@ -1,6 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            Gem::Specification.new do |s|
         
     | 
| 
       2 
2 
     | 
    
         
             
              s.name = "rblade"
         
     | 
| 
       3 
     | 
    
         
            -
              s.version = "1.1. 
     | 
| 
      
 3 
     | 
    
         
            +
              s.version = "1.1.1"
         
     | 
| 
       4 
4 
     | 
    
         
             
              s.summary = "A component-first templating engine for Rails"
         
     | 
| 
       5 
5 
     | 
    
         
             
              s.description = "RBlade is a simple, yet powerful templating engine for Ruby on Rails, inspired by Laravel Blade."
         
     | 
| 
       6 
6 
     | 
    
         
             
              s.authors = ["Simon J"]
         
     |