tagu-tagu 1.0.5 → 1.0.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 +11 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,13 +6,11 @@ A lightweight helper for vanilla `HTMLElement`, with reactivity. No config, no j
|
|
|
6
6
|
|
|
7
7
|
just a helper for `HTMLElement`:
|
|
8
8
|
|
|
9
|
-
```
|
|
10
|
-
<script type="module">
|
|
9
|
+
```javascript
|
|
11
10
|
import {button} from "https://cdn.jsdelivr.net/npm/tagu-tagu@1.0.1/dist/bundle.min.js";
|
|
12
11
|
|
|
13
12
|
const myButton = button("Hello!");// `HTMLButtonElement`
|
|
14
13
|
document.body.appendChild(myButton);
|
|
15
|
-
</script>
|
|
16
14
|
```
|
|
17
15
|
|
|
18
16
|
with reactivity!
|
|
@@ -20,7 +18,7 @@ with reactivity!
|
|
|
20
18
|
```javascript
|
|
21
19
|
import {button, span, div, useState} from "https://cdn.jsdelivr.net/npm/tagu-tagu@1.0.4/dist/bundle.min.js";
|
|
22
20
|
|
|
23
|
-
function
|
|
21
|
+
function CounterExample(){
|
|
24
22
|
const count = useState(4);
|
|
25
23
|
|
|
26
24
|
function decrementCount() {
|
|
@@ -37,7 +35,7 @@ function CounterDemo(){
|
|
|
37
35
|
])
|
|
38
36
|
}
|
|
39
37
|
|
|
40
|
-
document.body.appendChild(
|
|
38
|
+
document.body.appendChild(CounterExample());
|
|
41
39
|
```
|
|
42
40
|
|
|
43
41
|
No need to compile. But typescript is supported.
|
|
@@ -59,7 +57,7 @@ button({css: {background: "blue"}}, "Hello!");
|
|
|
59
57
|
```typescript
|
|
60
58
|
import { div, If, input, span, useState } from "tagu-tagu";
|
|
61
59
|
|
|
62
|
-
function
|
|
60
|
+
function IfExample() {
|
|
63
61
|
const isVisible = useState(false);
|
|
64
62
|
|
|
65
63
|
function toggle() {
|
|
@@ -80,7 +78,7 @@ function IfDemo() {
|
|
|
80
78
|
]);
|
|
81
79
|
}
|
|
82
80
|
|
|
83
|
-
document.body.appendChild(
|
|
81
|
+
document.body.appendChild(IfExample());
|
|
84
82
|
|
|
85
83
|
```
|
|
86
84
|
|
|
@@ -89,7 +87,7 @@ document.body.appendChild(IfDemo());
|
|
|
89
87
|
```typescript
|
|
90
88
|
import { button, div, Switch, useState } from "tagu-tagu";
|
|
91
89
|
|
|
92
|
-
function
|
|
90
|
+
function SwitchExample() {
|
|
93
91
|
const state = useState("triangle");
|
|
94
92
|
|
|
95
93
|
return div([
|
|
@@ -109,7 +107,7 @@ function SwitchDemo() {
|
|
|
109
107
|
]);
|
|
110
108
|
}
|
|
111
109
|
|
|
112
|
-
document.body.appendChild(
|
|
110
|
+
document.body.appendChild(SwitchExample());
|
|
113
111
|
|
|
114
112
|
```
|
|
115
113
|
|
|
@@ -118,7 +116,7 @@ document.body.appendChild(SwitchDemo());
|
|
|
118
116
|
```typescript
|
|
119
117
|
import { button, div, For, useState } from "tagu-tagu";
|
|
120
118
|
|
|
121
|
-
function
|
|
119
|
+
function ForExample() {
|
|
122
120
|
const numbers = useState([1, 2, 3].map((n) => ({ n })));
|
|
123
121
|
let id = numbers.get().length;
|
|
124
122
|
|
|
@@ -142,7 +140,7 @@ function ForDemo() {
|
|
|
142
140
|
]);
|
|
143
141
|
}
|
|
144
142
|
|
|
145
|
-
document.body.appendChild(
|
|
143
|
+
document.body.appendChild(ForExample());
|
|
146
144
|
|
|
147
145
|
```
|
|
148
146
|
|
|
@@ -162,7 +160,7 @@ function Sky() {
|
|
|
162
160
|
});
|
|
163
161
|
}
|
|
164
162
|
|
|
165
|
-
function
|
|
163
|
+
function DataBindingExample() {
|
|
166
164
|
const theme = useState("dark" as "dark" | "light");
|
|
167
165
|
|
|
168
166
|
return div({ data: { theme } }, [
|
|
@@ -172,7 +170,7 @@ function DataBindingDemo() {
|
|
|
172
170
|
]);
|
|
173
171
|
}
|
|
174
172
|
|
|
175
|
-
document.body.appendChild(
|
|
173
|
+
document.body.appendChild(DataBindingExample());
|
|
176
174
|
|
|
177
175
|
```
|
|
178
176
|
|