Skip to content

Commit 131500d

Browse files
Major updates
1 parent d72d2b0 commit 131500d

10 files changed

+986
-40
lines changed

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) Glowie
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<a href="https://packagist.org/packages/glowieframework/glowie-reactables"><img src="https://img.shields.io/github/v/release/glowieframework/glowie-reactables" alt="Latest Version"></a>
77
<a href="https://packagist.org/packages/glowieframework/glowie-reactables" target="_blank"><img src="https://img.shields.io/packagist/dt/glowieframework/glowie-reactables" alt="Total Downloads"></a>
88
<a href="https://packagist.org/packages/glowieframework/glowie-reactables" target="_blank"><img src="https://img.shields.io/github/license/glowieframework/glowie-reactables" alt="License"></a>
9-
<a href="https://packagist.org/packages/glowieframework/glowie-reactables" target="_blank"><img src="https://img.shields.io/packagist/php-v/glowieframework/glowie-reactables" alt="PHP Version"></a>
9+
<a href="https://packagist.org/packages/glowieframework/glowie-reactables" target="_blank"><img src="https://img.shields.io/packagist/php-v/glowieframework/glowie" alt="PHP Version"></a>
1010
</p>
1111

1212
> **Note:** This package is currently under development and may not work properly until a stable version is released!
@@ -15,4 +15,6 @@
1515
Reactables is a plugin designed to create dynamic and reactive view components with [Glowie Framework](https://glowie.tk).
1616

1717
## Credits
18-
Reactables and Glowie are currently being developed by [Gabriel Silva](https://eugabrielsilva.tk).
18+
Reactables and Glowie are currently being developed by [Gabriel Silva](https://eugabrielsilva.tk).
19+
20+
Special thanks to the developers of the dependencies: [jQuery](https://github.com/jquery/jquery) and [morphdom](https://github.com/patrick-steele-idem/morphdom).

docs/docs.md

+52-19
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,98 @@
11
### Inputs
2-
Input elements can be two-way data binded to a model, which represents a property of the component.
2+
Input elements can be two-way data bound to a model, which represents a property of the component.
33

44
```html
55
<input type="text" r-model="name" (r-lazy) (r-debounce="500")>
6+
67
Hello, {{ $this->name }}!
78
```
89

910
> **Note:** Attributes between parentheses are optional.
1011
11-
- `r-model` - binds the input directly to a component property.
12+
- `r-model` - component property name to bind to the input.
1213
- `r-lazy` - (optional) update model value only when an action is performed, instead of real-time.
13-
- `r-debounce` - (optional) update model value after a timeout in miliseconds, instead real-time.
14+
- `r-debounce` - (optional) update model value after a timeout in miliseconds, instead of real-time.
15+
16+
**Supported input types:** `text`, `checkbox`, `radio`, `date`, `datetime-local`, `email`, `number`, `month`, `password`, `range`, `search`, `tel`, `time`, `url`, `color`, `week` and `textarea`.
1417

1518
### Checkboxes and radios
16-
Checkboxes and radio buttons can have a custom value (other than a boolean) binded to their models when checked.
19+
Checkboxes and radio buttons can have a custom value (rather than a boolean) bound to their models when checked.
1720

1821
```html
19-
<input type="checkbox" r-model="accept" (r-value="Yes")>
22+
<input type="checkbox" r-model="accept" (value="Yes")>
2023
```
2124

2225
```html
23-
<input type="radio" r-model="rating" (r-value="1")>
24-
<input type="radio" r-model="rating" (r-value="2")>
25-
<input type="radio" r-model="rating" (r-value="3")>
26+
<input type="radio" r-model="rating" (value="1")>
27+
<input type="radio" r-model="rating" (value="2")>
28+
<input type="radio" r-model="rating" (value="3")>
2629
```
2730

2831
> **Note:** Attributes between parentheses are optional.
2932
3033
#### Multiple choices
31-
Multiple choices checkboxes should be binded to an array model. The component property will be filled with the selected checkboxes custom values.
34+
Multiple choices checkboxes should be bound to an array model. The component property will be filled with the selected checkboxes custom values.
35+
36+
```html
37+
<input type="checkbox" r-model="services[]" value="Service 1">
38+
<input type="checkbox" r-model="services[]" value="Service 2">
39+
<input type="checkbox" r-model="services[]" value="Service 3">
40+
```
41+
42+
### Selects
43+
Select options can have a custom value bounded to their models.
3244

3345
```html
34-
<input type="checkbox" r-model="services[]" r-value="Service 1">
35-
<input type="checkbox" r-model="services[]" r-value="Service 2">
36-
<input type="checkbox" r-model="services[]" r-value="Service 3">
46+
<select r-model="age">
47+
<option (value="18")>18 years old</option>
48+
<option (value="30")>30 years old</option>
49+
<option (value="60")>60 years old</option>
50+
</select>
3751
```
3852

53+
> **Note:** Attributes between parentheses are optional.
54+
55+
#### Multiple choices
56+
Multiple choices selects should be bound to an array model. The component property will be filled with the selected options (or their custom values, if any).
57+
58+
```html
59+
<select r-model="vehicles[]" multiple>
60+
<option (value="B")>Bike</option>
61+
<option (value="C")>Car</option>
62+
<option (value="A")>Airplane</option>
63+
</select>
64+
```
65+
66+
> **Note:** Attributes between parentheses are optional.
67+
3968
### Actions
40-
Some events in elements can be binded to call a method in the component controller.
69+
Some events in elements can be bound to call a method from the component controller.
4170

4271
```html
4372
<button r-click="load()" (r-prevent)>Click me!</button>
4473
```
4574

4675
> **Note:** Attributes between parentheses are optional.
4776
48-
- `r-click` - full method signature to call from the component controller. You can also use parameters in the function.
77+
- `r-click` - full method signature to call from the component controller. You can also pass parameters in the function.
4978
- `r-prevent` - (optional) prevent default browser action of the event.
5079

5180
#### Supported actions
5281
Current supported actions are:
5382

54-
- `r-click` - button click
55-
- `r-submit` - form submit
56-
- `r-enter` - enter key pressed
57-
- `r-tab` - tab key pressed
83+
- `r-click` - triggered on element click.
84+
- `r-submit` - triggered on `<form>` element submit.
85+
- `r-focus` - triggered when an element gains focus.
86+
- `r-blur` - triggered when an element loses focus.
87+
- `r-hover` - triggered when the mouse hovers an element.
88+
- `r-leave` - triggered when the mouse leaves an element.
89+
- `r-enter` - triggered when the **Enter** key is pressed in an input element.
90+
- `r-tab` - triggered when the **Tab** key is pressed in an input element.
5891

5992
#### Magic methods
6093
Some predefined methods are:
6194

62-
- `$refresh()` - refreshes the component, without performing any action.
95+
- `$refresh()` - refreshes the component render, without performing any action.
6396
- `$set('property_name', 'value')` - sets a property value in the component.
6497

6598
### Repeats

src/Assets/morphdom-umd.min.js

-1
This file was deleted.

0 commit comments

Comments
 (0)