hyperscript-rxjs 1.3.0 → 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 +1252 -0
- package/dist/hyperscript-rxjs.js +1 -1
- package/dist/tsdoc-metadata.json +11 -0
- package/package.json +20 -14
- package/readme.md +76 -108
@@ -0,0 +1,11 @@
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
3
|
+
{
|
4
|
+
"tsdocVersion": "0.12",
|
5
|
+
"toolPackages": [
|
6
|
+
{
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
8
|
+
"packageVersion": "7.52.8"
|
9
|
+
}
|
10
|
+
]
|
11
|
+
}
|
package/package.json
CHANGED
@@ -1,41 +1,47 @@
|
|
1
1
|
{
|
2
|
-
"dependencies": {},
|
3
2
|
"devDependencies": {
|
4
|
-
"rxjs": "7.8.2",
|
5
|
-
"jest": "29.7.0",
|
6
|
-
"jsdom": "26.1.0",
|
7
|
-
"jest-environment-jsdom": "29.7.0",
|
8
|
-
"node-fetch": "3.3.2",
|
9
|
-
"babel-jest": "29.7.0",
|
10
3
|
"@babel/core": "7.27.1",
|
11
4
|
"@babel/preset-env": "7.27.2",
|
12
|
-
"@
|
13
|
-
"@babel/plugin-proposal-export-namespace-from": "7.18.9",
|
5
|
+
"@microsoft/api-extractor": "7.52.8",
|
14
6
|
"@webpack-cli/serve": "3.0.1",
|
7
|
+
"babel-jest": "29.7.0",
|
15
8
|
"babel-loader": "10.0.0",
|
16
9
|
"clean-webpack-plugin": "4.0.0",
|
17
10
|
"core-js": "3.42.0",
|
11
|
+
"jest": "29.7.0",
|
12
|
+
"jest-environment-jsdom": "29.7.0",
|
13
|
+
"jsdom": "26.1.0",
|
14
|
+
"node-fetch": "3.3.2",
|
18
15
|
"regenerator-runtime": "0.14.1",
|
16
|
+
"rxjs": "7.8.2",
|
19
17
|
"tslib": "2.8.1",
|
20
|
-
"
|
18
|
+
"typescript": "5.8.3",
|
19
|
+
"webpack": "5.99.9",
|
21
20
|
"webpack-cli": "6.0.1",
|
22
21
|
"webpack-dev-server": "5.2.1",
|
23
22
|
"webpack-merge": "6.0.1"
|
24
23
|
},
|
25
24
|
"jest": {
|
26
|
-
"testEnvironment": "jsdom"
|
25
|
+
"testEnvironment": "jsdom",
|
26
|
+
"transform": {
|
27
|
+
"^.+\\.jsx?$": "babel-jest"
|
28
|
+
},
|
29
|
+
"transformIgnorePatterns": [
|
30
|
+
"/node_modules/(?!rxjs)"
|
31
|
+
]
|
27
32
|
},
|
28
33
|
"scripts": {
|
29
34
|
"build": "webpack --config webpack.prod.js",
|
30
35
|
"start": "webpack serve --config webpack.dev.js",
|
31
36
|
"test": "jest",
|
32
|
-
"
|
33
|
-
"
|
37
|
+
"type-check": "tsc --noEmit",
|
38
|
+
"dts:extract": "api-extractor run --local"
|
34
39
|
},
|
35
40
|
"name": "hyperscript-rxjs",
|
36
41
|
"description": "A js UI library that uses rxjs to handle dom directly.",
|
37
42
|
"main": "dist/hyperscript-rxjs.js",
|
38
|
-
"
|
43
|
+
"types": "dist/hyperscript-rxjs.d.ts",
|
44
|
+
"version": "1.3.2",
|
39
45
|
"author": "cuishengli<34696643@qq.com>",
|
40
46
|
"keywords": [
|
41
47
|
"ui",
|
package/readme.md
CHANGED
@@ -1,155 +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
|
-
- `nestedCombineLatest`
|
59
|
-
- `nestedMerge`
|
60
|
-
- `ObservableArray`
|
61
|
-
- `pickBehaviorSubject`
|
62
|
-
- `restore`
|
63
|
-
|
64
|
-
#### Other Utilities
|
65
|
-
- `Deep`
|
66
|
-
- `nodes`
|
67
|
-
- `object`
|
68
|
-
- `props`
|
69
|
-
- `ramda`
|
70
|
-
- `structures`
|
71
|
-
- `unquoted-json`
|
72
|
-
|
73
|
-
---
|
74
|
-
|
75
|
-
## Development
|
76
|
-
|
77
|
-
### Prerequisites
|
78
|
-
|
79
|
-
Ensure you have the following installed:
|
80
|
-
- Node.js (>= 14.x)
|
81
|
-
- npm (>= 6.x)
|
35
|
+
### Reactive Form Controls
|
36
|
+
```javascript
|
37
|
+
import { textbox, checkbox, button } from 'hyperscript-rxjs';
|
38
|
+
import { BehaviorSubject } from 'rxjs';
|
82
39
|
|
83
|
-
|
40
|
+
const name$ = new BehaviorSubject('');
|
41
|
+
const active$ = new BehaviorSubject(true);
|
84
42
|
|
85
|
-
|
86
|
-
|
87
|
-
|
43
|
+
const form = div(
|
44
|
+
textbox({ value: name$ }),
|
45
|
+
checkbox({ checked: active$ }),
|
46
|
+
button('Submit')
|
47
|
+
);
|
88
48
|
```
|
89
49
|
|
90
|
-
|
50
|
+
## Core API Overview
|
91
51
|
|
92
|
-
|
93
|
-
|
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
|
94
58
|
```
|
95
59
|
|
96
|
-
###
|
97
|
-
|
98
|
-
|
99
|
-
|
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'));
|
100
89
|
```
|
101
90
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
```bash
|
111
|
-
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
|
+
});
|
112
98
|
```
|
113
99
|
|
114
|
-
|
100
|
+
## Development
|
115
101
|
|
102
|
+
### Build
|
116
103
|
```bash
|
117
|
-
npm run
|
104
|
+
npm run build
|
118
105
|
```
|
119
106
|
|
120
|
-
### Test
|
121
|
-
|
107
|
+
### Test
|
122
108
|
```bash
|
123
|
-
npm
|
109
|
+
npm test
|
124
110
|
```
|
125
111
|
|
126
|
-
---
|
127
|
-
|
128
|
-
## Contributing
|
129
|
-
|
130
|
-
Contributions are welcome! Please follow these steps:
|
131
|
-
|
132
|
-
1. Fork the repository.
|
133
|
-
2. Create a new branch for your feature or bugfix.
|
134
|
-
3. Commit your changes and push the branch.
|
135
|
-
4. Submit a pull request.
|
136
|
-
|
137
|
-
---
|
138
|
-
|
139
112
|
## License
|
140
113
|
|
141
|
-
|
142
|
-
|
143
|
-
---
|
114
|
+
LGPL-3.0-or-later
|
144
115
|
|
145
116
|
## Repository
|
146
117
|
|
147
118
|
[GitHub Repository](https://github.com/xp44mm/hyperscript-rxjs)
|
148
119
|
|
149
|
-
---
|
150
|
-
|
151
120
|
## Author
|
152
121
|
|
153
122
|
**cuishengli**
|
154
123
|
Email: 34696643@qq.com
|
155
|
-
```
|