hyperscript-rxjs 1.3.1 → 1.3.2
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/dist/hyperscript-rxjs.d.ts +119 -120
- package/dist/hyperscript-rxjs.js +1 -1
- package/package.json +3 -3
- package/readme.md +76 -104
package/package.json
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
"rxjs": "7.8.2",
|
17
17
|
"tslib": "2.8.1",
|
18
18
|
"typescript": "5.8.3",
|
19
|
-
"webpack": "5.99.
|
19
|
+
"webpack": "5.99.9",
|
20
20
|
"webpack-cli": "6.0.1",
|
21
21
|
"webpack-dev-server": "5.2.1",
|
22
22
|
"webpack-merge": "6.0.1"
|
@@ -34,14 +34,14 @@
|
|
34
34
|
"build": "webpack --config webpack.prod.js",
|
35
35
|
"start": "webpack serve --config webpack.dev.js",
|
36
36
|
"test": "jest",
|
37
|
-
"
|
37
|
+
"type-check": "tsc --noEmit",
|
38
38
|
"dts:extract": "api-extractor run --local"
|
39
39
|
},
|
40
40
|
"name": "hyperscript-rxjs",
|
41
41
|
"description": "A js UI library that uses rxjs to handle dom directly.",
|
42
42
|
"main": "dist/hyperscript-rxjs.js",
|
43
43
|
"types": "dist/hyperscript-rxjs.d.ts",
|
44
|
-
"version": "1.3.
|
44
|
+
"version": "1.3.2",
|
45
45
|
"author": "cuishengli<34696643@qq.com>",
|
46
46
|
"keywords": [
|
47
47
|
"ui",
|
package/readme.md
CHANGED
@@ -1,151 +1,123 @@
|
|
1
|
-
|
2
1
|
# hyperscript-rxjs
|
3
2
|
|
4
|
-
A JavaScript UI library that uses RxJS
|
3
|
+
A reactive JavaScript UI library that uses RxJS for direct DOM manipulation with observable data binding.
|
5
4
|
|
6
5
|
## Features
|
7
6
|
|
8
|
-
- Reactive
|
9
|
-
-
|
10
|
-
-
|
11
|
-
|
12
|
-
|
7
|
+
- **Reactive DOM Elements**: Create HTML elements with built-in RxJS observable support
|
8
|
+
- **Comprehensive HTML Support**: Functions for all standard HTML elements (`div`, `span`, `input`, etc.)
|
9
|
+
- **Advanced Data Binding**: Two-way binding for forms, tabs, and other UI components
|
10
|
+
- **Observable Utilities**: Specialized classes like `ObservableArray` for reactive collections
|
11
|
+
- **Deep Data Handling**: `Deep` class for nested observable structures
|
12
|
+
- **Type Safe**: Full TypeScript support with detailed type definitions
|
13
13
|
|
14
14
|
## Installation
|
15
15
|
|
16
|
-
Install the library via npm:
|
17
|
-
|
18
16
|
```bash
|
19
17
|
npm install hyperscript-rxjs
|
20
18
|
```
|
21
19
|
|
22
|
-
|
23
|
-
|
24
|
-
## Usage
|
25
|
-
|
26
|
-
### Basic Example
|
20
|
+
## Quick Start
|
27
21
|
|
22
|
+
### Basic Element Creation
|
28
23
|
```javascript
|
29
|
-
import {
|
24
|
+
import { div, h1, textNode } from 'hyperscript-rxjs';
|
25
|
+
import { BehaviorSubject } from 'rxjs';
|
30
26
|
|
31
|
-
const
|
32
|
-
|
33
|
-
|
27
|
+
const title$ = new BehaviorSubject('Hello World');
|
28
|
+
const app = div(
|
29
|
+
h1(textNode(title$))
|
30
|
+
);
|
34
31
|
|
35
|
-
|
36
|
-
|
37
|
-
You can import specific modules as needed:
|
38
|
-
|
39
|
-
```javascript
|
40
|
-
import { nestedCombineLatest } from "hyperscript-rxjs";
|
32
|
+
document.body.appendChild(app);
|
41
33
|
```
|
42
34
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
### Exported Modules
|
48
|
-
|
49
|
-
#### Comparers
|
50
|
-
- `Comparer`
|
51
|
-
- `defaultComparer`
|
52
|
-
- `keyComparer`
|
53
|
-
- `keyPathComparer`
|
54
|
-
- `entryComparer`
|
55
|
-
|
56
|
-
#### Reactive Utilities
|
57
|
-
- `isRxType`
|
58
|
-
- `ObservableArray`
|
59
|
-
|
60
|
-
#### Other Utilities
|
61
|
-
- `Deep`
|
62
|
-
- `nodes`
|
63
|
-
- `object`
|
64
|
-
- `props`
|
65
|
-
- `ramda`
|
66
|
-
- `structures`
|
67
|
-
- `unquoted-json`
|
68
|
-
|
69
|
-
---
|
70
|
-
|
71
|
-
## Development
|
72
|
-
|
73
|
-
### Prerequisites
|
74
|
-
|
75
|
-
Ensure you have the following installed:
|
76
|
-
- Node.js (>= 14.x)
|
77
|
-
- npm (>= 6.x)
|
35
|
+
### Reactive Form Controls
|
36
|
+
```javascript
|
37
|
+
import { textbox, checkbox, button } from 'hyperscript-rxjs';
|
38
|
+
import { BehaviorSubject } from 'rxjs';
|
78
39
|
|
79
|
-
|
40
|
+
const name$ = new BehaviorSubject('');
|
41
|
+
const active$ = new BehaviorSubject(true);
|
80
42
|
|
81
|
-
|
82
|
-
|
83
|
-
|
43
|
+
const form = div(
|
44
|
+
textbox({ value: name$ }),
|
45
|
+
checkbox({ checked: active$ }),
|
46
|
+
button('Submit')
|
47
|
+
);
|
84
48
|
```
|
85
49
|
|
86
|
-
|
50
|
+
## Core API Overview
|
87
51
|
|
88
|
-
|
89
|
-
|
52
|
+
### Element Creation
|
53
|
+
Functions for all HTML elements:
|
54
|
+
```typescript
|
55
|
+
a(), abbr(), address(), article(), aside(), audio(),
|
56
|
+
button(), div(), form(), h1()-h6(), input(),
|
57
|
+
select(), table(), textarea(), video(), ...and more
|
90
58
|
```
|
91
59
|
|
92
|
-
###
|
93
|
-
|
94
|
-
|
95
|
-
|
60
|
+
### Specialized Components
|
61
|
+
- `tabControl()` - Reactive tab components
|
62
|
+
- `textbox()`, `checkbox()`, `radio()`, `select()` - Form controls with binding
|
63
|
+
- `ObservableArray` - Reactive array with change notifications
|
64
|
+
- `Deep` - Nested observable data structures
|
65
|
+
|
66
|
+
### Reactive Utilities
|
67
|
+
- `bindTabIndex()` - Tab navigation binding
|
68
|
+
- `collapse()` - Observable-controlled visibility
|
69
|
+
- `flip()` - Toggle between two elements
|
70
|
+
- `pipeEvent()` - RxJS-powered event handling
|
71
|
+
- `subscribeProp()` - Bind observables to element properties
|
72
|
+
|
73
|
+
### Data Transformation
|
74
|
+
- `Comparer` - Sorting and collection utilities
|
75
|
+
- `flat()`/`erectObject()` - Object flattening/unflattening
|
76
|
+
- `restore()` - Deep observable updates
|
77
|
+
- `tojs()` - Convert flat data to nested objects
|
78
|
+
|
79
|
+
## Advanced Usage
|
80
|
+
|
81
|
+
### Custom Element Extensions
|
82
|
+
All elements support RxJS extensions:
|
83
|
+
```typescript
|
84
|
+
const btn = button('Click me')
|
85
|
+
.pipeEvent('click', click$ =>
|
86
|
+
click$.subscribe(() => console.log('Clicked!'))
|
87
|
+
.subscribeEvent('mouseover',
|
88
|
+
() => console.log('Mouse over'));
|
96
89
|
```
|
97
90
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
```bash
|
107
|
-
npm test
|
91
|
+
### Observable Arrays
|
92
|
+
```typescript
|
93
|
+
const items = new ObservableArray<string>();
|
94
|
+
items.insertBefore('New Item');
|
95
|
+
items.action$.subscribe(change => {
|
96
|
+
console.log('Array changed:', change);
|
97
|
+
});
|
108
98
|
```
|
109
99
|
|
110
|
-
|
100
|
+
## Development
|
111
101
|
|
102
|
+
### Build
|
112
103
|
```bash
|
113
|
-
npm run
|
104
|
+
npm run build
|
114
105
|
```
|
115
106
|
|
116
|
-
### Test
|
117
|
-
|
107
|
+
### Test
|
118
108
|
```bash
|
119
|
-
npm
|
109
|
+
npm test
|
120
110
|
```
|
121
111
|
|
122
|
-
---
|
123
|
-
|
124
|
-
## Contributing
|
125
|
-
|
126
|
-
Contributions are welcome! Please follow these steps:
|
127
|
-
|
128
|
-
1. Fork the repository.
|
129
|
-
2. Create a new branch for your feature or bugfix.
|
130
|
-
3. Commit your changes and push the branch.
|
131
|
-
4. Submit a pull request.
|
132
|
-
|
133
|
-
---
|
134
|
-
|
135
112
|
## License
|
136
113
|
|
137
|
-
|
138
|
-
|
139
|
-
---
|
114
|
+
LGPL-3.0-or-later
|
140
115
|
|
141
116
|
## Repository
|
142
117
|
|
143
118
|
[GitHub Repository](https://github.com/xp44mm/hyperscript-rxjs)
|
144
119
|
|
145
|
-
---
|
146
|
-
|
147
120
|
## Author
|
148
121
|
|
149
122
|
**cuishengli**
|
150
123
|
Email: 34696643@qq.com
|
151
|
-
```
|