tagu-tagu 3.2.4 → 3.2.6
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.
- package/README.md +29 -26
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -41,9 +41,6 @@ document.body.appendChild(CounterExample());
|
|
|
41
41
|
No need to compile. But typescript is supported.
|
|
42
42
|
|
|
43
43
|
## Examples
|
|
44
|
-
See examples [here](https://dothesimplest.github.io/tagu-tagu/).
|
|
45
|
-
|
|
46
|
-
## Features
|
|
47
44
|
|
|
48
45
|
### Initializers
|
|
49
46
|
`tagu-tagu` uses rest parameters. Arguments can be any order.
|
|
@@ -52,25 +49,6 @@ button("Hello!", {css: {background: "blue"}});
|
|
|
52
49
|
button({css: {background: "blue"}}, "Hello!");
|
|
53
50
|
```
|
|
54
51
|
|
|
55
|
-
#### Modify existing element
|
|
56
|
-
You can use initializers for existing element.
|
|
57
|
-
|
|
58
|
-
```typescript
|
|
59
|
-
import { Modify } from "tagu-tagu";
|
|
60
|
-
|
|
61
|
-
Modify(document.body, {
|
|
62
|
-
text: "💣",
|
|
63
|
-
css: {
|
|
64
|
-
background: "skyblue",
|
|
65
|
-
},
|
|
66
|
-
on: {
|
|
67
|
-
click: () => {
|
|
68
|
-
document.body.textContent = "💥";
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
```
|
|
74
52
|
|
|
75
53
|
#### `html` initializer
|
|
76
54
|
[JSFiddle](https://jsfiddle.net/do_the_simplest/6p9jh45L/2/)
|
|
@@ -119,19 +97,19 @@ document.body.appendChild(AttrExample());
|
|
|
119
97
|
```
|
|
120
98
|
|
|
121
99
|
#### `prop` initializer
|
|
122
|
-
[JSFiddle](https://jsfiddle.net/do_the_simplest/mc38ksqw/
|
|
100
|
+
[JSFiddle](https://jsfiddle.net/do_the_simplest/mc38ksqw/2/)
|
|
123
101
|
|
|
124
102
|
```typescript
|
|
125
103
|
import { option, select } from "tagu-tagu";
|
|
126
104
|
|
|
127
|
-
//
|
|
128
|
-
function
|
|
105
|
+
// Javascript properties
|
|
106
|
+
function PropExample() {
|
|
129
107
|
return select([option("One"), option("Two"), option("Three")], {
|
|
130
108
|
prop: { selectedIndex: 1 },
|
|
131
109
|
});
|
|
132
110
|
}
|
|
133
111
|
|
|
134
|
-
document.body.appendChild(
|
|
112
|
+
document.body.appendChild(PropExample());
|
|
135
113
|
```
|
|
136
114
|
|
|
137
115
|
#### `on` initializer
|
|
@@ -147,6 +125,27 @@ function OnExample() {
|
|
|
147
125
|
document.body.appendChild(OnExample());
|
|
148
126
|
```
|
|
149
127
|
|
|
128
|
+
#### Modify existing element
|
|
129
|
+
You can use initializers for existing element.
|
|
130
|
+
[JSFiddle](https://jsfiddle.net/do_the_simplest/o87nw6zL/15/)
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
import { Modify } from "tagu-tagu";
|
|
134
|
+
|
|
135
|
+
Modify(document.body, {
|
|
136
|
+
text: "💣",
|
|
137
|
+
css: {
|
|
138
|
+
background: "skyblue",
|
|
139
|
+
},
|
|
140
|
+
on: {
|
|
141
|
+
click: () => {
|
|
142
|
+
document.body.textContent = "💥";
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
|
|
150
149
|
#### `$` initializer
|
|
151
150
|
[JSFiddle](https://jsfiddle.net/do_the_simplest/b8roj7wx/1/)
|
|
152
151
|
```html
|
|
@@ -250,6 +249,7 @@ document.body.appendChild(InitializerCallbackExample());
|
|
|
250
249
|
```
|
|
251
250
|
|
|
252
251
|
### `If`
|
|
252
|
+
[JSFiddle](https://jsfiddle.net/do_the_simplest/bxuqsh1d/19/)
|
|
253
253
|
|
|
254
254
|
```typescript
|
|
255
255
|
import { div, If, input, span, useState } from "tagu-tagu";
|
|
@@ -280,6 +280,7 @@ document.body.appendChild(IfExample());
|
|
|
280
280
|
```
|
|
281
281
|
|
|
282
282
|
### `Switch`
|
|
283
|
+
[JSFiddle](https://jsfiddle.net/do_the_simplest/vw8hrz1t/14/)
|
|
283
284
|
|
|
284
285
|
```typescript
|
|
285
286
|
import { button, div, Switch, useState } from "tagu-tagu";
|
|
@@ -309,6 +310,7 @@ document.body.appendChild(SwitchExample());
|
|
|
309
310
|
```
|
|
310
311
|
|
|
311
312
|
### `For`
|
|
313
|
+
[JSFiddle](https://jsfiddle.net/do_the_simplest/soLa9v6t/12/)
|
|
312
314
|
|
|
313
315
|
```typescript
|
|
314
316
|
import { button, div, For, useState } from "tagu-tagu";
|
|
@@ -343,6 +345,7 @@ document.body.appendChild(ForExample());
|
|
|
343
345
|
|
|
344
346
|
### Data binding
|
|
345
347
|
You can use data of ancestors.
|
|
348
|
+
[JSFiddle](https://jsfiddle.net/do_the_simplest/9u6oz2bc/6/)
|
|
346
349
|
|
|
347
350
|
```typescript
|
|
348
351
|
import { button, div, useBinding, useState } from "tagu-tagu";
|